本文整理汇总了C++中IThread::isEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ IThread::isEnabled方法的具体用法?C++ IThread::isEnabled怎么用?C++ IThread::isEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IThread
的用法示例。
在下文中一共展示了IThread::isEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[]) {
int cfgsz = 0;
char path[1024];
bool loadConfig = true;
bool disableSim = true;
AttributeType scriptFile("");
// Parse arguments:
if (argc > 1) {
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "-nocfg") == 0) {
loadConfig = false;
} else if (strcmp(argv[i], "-sim") == 0) {
disableSim = false;
} else if (strcmp(argv[i], "-script") == 0) {
i++;
scriptFile.make_string(argv[i]);
}
}
}
// Select configuration input (default/stored file):
RISCV_init();
RISCV_get_core_folder(path, sizeof(path));
std::string cfg_filename = std::string(path)
+ std::string(JSON_CONFIG_FILE);
if (loadConfig) {
cfgsz = RISCV_read_json_file(cfg_filename.c_str(), cfgbuf,
static_cast<int>(sizeof(cfgbuf)));
}
// Convert string to attribute:
if (cfgsz == 0) {
Config.from_config(default_config);
} else {
Config.from_config(cfgbuf);
}
// Enable/Disable simulator option:
Config["GlobalSettings"]["SimEnable"].make_boolean(!disableSim);
//scriptFile.make_string("");
Config["GlobalSettings"]["ScriptFile"] = scriptFile;
RISCV_set_configuration(&Config);
// Connect simulator to the EDCL debugger if enabled:
if (!disableSim) {
IUdp *iudp1 = static_cast<IUdp *>
(RISCV_get_service_iface("udpboard", IFACE_UDP));
IUdp *iudp2 = static_cast<IUdp *>
(RISCV_get_service_iface("udpedcl", IFACE_UDP));
AttributeType t1 = iudp1->getConnectionSettings();
iudp2->setTargetSettings(&t1);
t1 = iudp2->getConnectionSettings();
iudp1->setTargetSettings(&t1);
}
void *obj = glip_tcp_create(PORT, WIDTH);
// Working cycle with console:
IThread *in = static_cast<IThread *>(RISCV_get_service_iface("console0", IFACE_THREAD));
edcl_itap = static_cast<ITap *>(RISCV_get_service_iface("edcltap", IFACE_TAP));
if (in) {
while (in->isEnabled()) {
// RISCV_sleep_ms(100);
glip_tcp_toplevel(obj);
}
}
/*
const char *t1 = RISCV_get_configuration();
RISCV_write_json_file(cfg_filename.c_str(), t1);
*/
RISCV_cleanup();
return 0;
}