diff --git a/common/Makefile.am b/common/Makefile.am index 41212cd78b9bcfec592096d716a750d4214718fb..a367999527d53ef0264cb43ea36d08c371911e52 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -13,7 +13,7 @@ common_log = log/Ring_fifo.c log/skyeye_log.c log/skyeye_log_group.cpp common_loader = loader/loader_elf.c loader/loader_file.c loader/loader_coff.c loader/loader_elf_by_space.c loader/loader_hex.c common_mm = mm/skyeye_mm.c common_cli = cli/skyeye_command.c cli/skyeye_cli.c cli/default_command.c cli/com_command.c cli/skyeye_new_api.c -common_lic = lic/verify.c lic/lic_local.c lic/lic_network.c lic/lic_dog.c + common_portable = portable/mman.c portable/usleep.c portable/gettimeofday.c common_preference = preference/skyeye_pref.c common_profile = profile/symbol.c profile/bfd_target.c profile/skyeye_stat.c @@ -33,7 +33,7 @@ common_return_msg = return_msg/return_msg.c pkglib_LTLIBRARIES = libcommon.la -libcommon_la_SOURCES = $(common_module) $(common_misc) $(common_breakpoint) $(common_ctrl) $(common_portable) $(common_preference) $(common_core) $(common_conf_parser) $(common_log) $(common_cli) $(common_lic) $(common_mm) $(common_mach) $(common_device) $(common_memory) $(common_loader) $(common_callback) $(common_profile) $(common_checkpoint) $(common_disas) $(common_json_conf) $(common_disassemble) $(common_fault_injection) $(common_parse_symbol) $(common_return_msg) +libcommon_la_SOURCES = $(common_module) $(common_misc) $(common_breakpoint) $(common_ctrl) $(common_portable) $(common_preference) $(common_core) $(common_conf_parser) $(common_log) $(common_cli) $(common_mm) $(common_mach) $(common_device) $(common_memory) $(common_loader) $(common_callback) $(common_profile) $(common_checkpoint) $(common_disas) $(common_json_conf) $(common_disassemble) $(common_fault_injection) $(common_parse_symbol) $(common_return_msg) libcommon_la_LIBADD = diff --git a/common/cli/com_command.c b/common/cli/com_command.c index 31583a5a137327e48562b8d57d37453056f71921..65a5e938a27719d8f1c00683df5efa1963caa100 100644 --- a/common/cli/com_command.c +++ b/common/cli/com_command.c @@ -17,8 +17,6 @@ #include #include #include "skyeye_readline_cli.h" -#include "lic.h" - #include int com_run(arg) @@ -263,7 +261,6 @@ int com_cd(arg) int com_quit(arg) char *arg; { - close_network_lic(); SIM_quit(); return 0; diff --git a/common/cli/default_command.h b/common/cli/default_command.h index 661aec57cebc12675ec07f7229a5e4b75a352ccb..ceda4111e65ede5c074f0f2d9a4bafb923eda576 100755 --- a/common/cli/default_command.h +++ b/common/cli/default_command.h @@ -46,7 +46,7 @@ #include "systemc_exec.h" #include "skyeye_misc.h" #include "mm_monitor.h" -#include "lic.h" + #include "parse_symbol.h" #ifdef __WIN32__ #include diff --git a/common/cli/skyeye_new_api.c b/common/cli/skyeye_new_api.c index 2f600e79aa4dd3f237f578d6d2b6f8b87538846d..165a397c351fd20b6b7f03f9a7b5120ac475f5d9 100644 --- a/common/cli/skyeye_new_api.c +++ b/common/cli/skyeye_new_api.c @@ -1,12 +1,31 @@ /************************************************************************* - > File Name : skyeye_new_api.c - > Author : jiachao - > Mail : jiachao@digiproto.com - > Created Time : 2021/3/24 14:19:08 + > File Name : skyeye_new_api.c + > Author : jiachao + > Mail : jiachao@digiproto.com + > Created Time : 2021/3/24 14:19:08 ************************************************************************/ #include "skyeye_new_api.h" +enum +{ + OUTPUT_2_LOG = 0, + OUTPUT_2_PYTHON = 1, + OUTPUT_2_LOG_PY = 2 +} put_msg_range; + +static char *msg[128] = {0}; + +#define output_msg(log_level, err_code, ret_msg, range, ...) \ + do \ + { \ + sprintf(msg, __VA_ARGS__); \ + if (range == OUTPUT_2_PYTHON || range == OUTPUT_2_LOG_PY) \ + ret_msg = getErrorMessage("%x %s %d %s", err_code, __func__, __LINE__, msg); \ + if (range == OUTPUT_2_LOG || range == OUTPUT_2_LOG_PY) \ + skyeye_log(log_level, __FUNCTION__, "s", msg); \ + } while (0) + char **getErrorMessage(char *format, ...) { static char *retPtr[MAX_PARM_NUM]; @@ -17,30 +36,30 @@ char **getErrorMessage(char *format, ...) va_start(args, format); - while((c = *format++) > 0) + while ((c = *format++) > 0) { - if(c == '%') + if (c == '%') { - switch(c = *format++) + switch (c = *format++) { - case 's': - assert(i < MAX_PARM_NUM); - retPtr[i++] = va_arg(args, char*); - break; - case 'd': - num = va_arg(args, int); - assert(i < MAX_PARM_NUM); - sprintf(tmpStr[i], "%d", num); - retPtr[i] = tmpStr[i]; - i++; - break; - case 'x': - num = va_arg(args, int); - assert(i < MAX_PARM_NUM); - sprintf(tmpStr[i], "0x%x", num); - retPtr[i] = tmpStr[i]; - i++; - break; + case 's': + assert(i < MAX_PARM_NUM); + retPtr[i++] = va_arg(args, char *); + break; + case 'd': + num = va_arg(args, int); + assert(i < MAX_PARM_NUM); + sprintf(tmpStr[i], "%d", num); + retPtr[i] = tmpStr[i]; + i++; + break; + case 'x': + num = va_arg(args, int); + assert(i < MAX_PARM_NUM); + sprintf(tmpStr[i], "0x%x", num); + retPtr[i] = tmpStr[i]; + i++; + break; } } } @@ -50,60 +69,79 @@ char **getErrorMessage(char *format, ...) /* * 1.仿真控制相关API接口 -*/ + */ -//SkyEye运行 -SkyEyeAPIRetST skyeye_run() +// SkyEye运行 +SkyEyeAPIRetST skyeye_run(void) { SkyEyeAPIRetST ApiRet; memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (!SIM_run()) { + output_msg(Debug_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG, + "Open-SkyEye running!\n"); ApiRet.result = API_OK; - } else + } + else { + output_msg(Warning_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "No load machine %s!\n"); ApiRet.result = API_ERROR; } return ApiRet; } -//SkyEye暂停 -SkyEyeAPIRetST skyeye_stop() +// SkyEye暂停 +SkyEyeAPIRetST skyeye_stop(void) { SkyEyeAPIRetST ApiRet; memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); - SIM_stop(NULL); - ApiRet.result = API_OK; + if (!SIM_stop(NULL)) + { + output_msg(Debug_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG, + "Open-SkyEye stoped!\n"); + ApiRet.result = API_OK; + } + else + { + output_msg(Warning_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "No load machine!\n"); + ApiRet.result = API_ERROR; + } return ApiRet; } -//SkyEye退出 -SkyEyeAPIRetST skyeye_quit() +// SkyEye退出 +SkyEyeAPIRetST skyeye_quit(void) { SkyEyeAPIRetST ApiRet; memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); close_network_lic(); + output_msg(Debug_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG, + "Open-SkyEye quit!\n"); SIM_quit(); ApiRet.result = API_OK; return ApiRet; } -//SkyEye重置 -SkyEyeAPIRetST skyeye_reset() +// SkyEye重置 +SkyEyeAPIRetST skyeye_reset(void) { SkyEyeAPIRetST ApiRet; memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); + output_msg(Debug_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG, + "Open-SkyEye reset!\n"); SIM_reset(); ApiRet.result = API_OK; return ApiRet; } -//SkyEye获取运行状态 -SkyEyeAPIRetST skyeye_running_status() +// SkyEye获取运行状态 +SkyEyeAPIRetST skyeye_running_status(void) { SkyEyeAPIRetST ApiRet; memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); @@ -113,7 +151,7 @@ SkyEyeAPIRetST skyeye_running_status() return ApiRet; } -//SkyEye init-ok命令实现,创建线程来调度执行处理器指令 +// SkyEye init-ok命令实现,创建线程来调度执行处理器指令 SkyEyeAPIRetST skyeye_prepare_running() { SkyEyeAPIRetST ApiRet; @@ -122,11 +160,15 @@ SkyEyeAPIRetST skyeye_prepare_running() /* Call prepare_to_run to create cell to run instructions*/ if (0 == (unsigned int)prepare_to_run()) { + output_msg(Debug_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG, + "Open-SkyEye Init OK!\n"); ApiRet.result = API_OK; - } else + } + else { + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call prepare_to_run Failed!\n"); ApiRet.result = API_ERROR; - skyeye_log(Error_log, __FUNCTION__, "Call prepare_to_run Failed!\n"); } return ApiRet; @@ -134,9 +176,9 @@ SkyEyeAPIRetST skyeye_prepare_running() /* * 2.快照功能API接口 -*/ + */ -//SkyEye加载快照 +// SkyEye加载快照 SkyEyeAPIRetST skyeye_load_checkpoint(char *checkpoint_path) { SkyEyeAPIRetST ApiRet; @@ -144,7 +186,8 @@ SkyEyeAPIRetST skyeye_load_checkpoint(char *checkpoint_path) if (0 != save_chp(checkpoint_path)) { - skyeye_log(Error_log, __FUNCTION__, "Call save_chp Failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call save_chp Failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -154,7 +197,7 @@ SkyEyeAPIRetST skyeye_load_checkpoint(char *checkpoint_path) return ApiRet; } -//SkyEye保存快照 +// SkyEye保存快照 SkyEyeAPIRetST skyeye_save_checkpoint(char *checkpoint_path) { SkyEyeAPIRetST ApiRet; @@ -162,7 +205,8 @@ SkyEyeAPIRetST skyeye_save_checkpoint(char *checkpoint_path) if (0 != load_chp(checkpoint_path)) { - skyeye_log(Error_log, __FUNCTION__, "Call load_chp Failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call load_chp Failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -173,9 +217,9 @@ SkyEyeAPIRetST skyeye_save_checkpoint(char *checkpoint_path) /* * 3.断点功能API接口 -*/ + */ -//SkyEye创建断点 +// SkyEye创建断点 SkyEyeAPIRetST skyeye_create_breakpoint(char *cpuname, uint32_t addr) { SkyEyeAPIRetST ApiRet; @@ -185,7 +229,8 @@ SkyEyeAPIRetST skyeye_create_breakpoint(char *cpuname, uint32_t addr) memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -194,8 +239,8 @@ SkyEyeAPIRetST skyeye_create_breakpoint(char *cpuname, uint32_t addr) if (iface == NULL) { - skyeye_log(Warning_log, __FUNCTION__, "can not get %s interface from %s\n", CORE_BREAKPOINT_OP_INTF_NAME, - cpuname); + output_msg(Warning_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "can not get %s interface from %s\n", CORE_BREAKPOINT_OP_INTF_NAME, cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -203,7 +248,8 @@ SkyEyeAPIRetST skyeye_create_breakpoint(char *cpuname, uint32_t addr) if (ret != 0) { - skyeye_log(Warning_log, __FUNCTION__, "Call %s insert_bp iface Failed!\n", cpuname); + output_msg(Warning_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call %s insert_bp iface Failed!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -212,7 +258,7 @@ SkyEyeAPIRetST skyeye_create_breakpoint(char *cpuname, uint32_t addr) return ApiRet; } -//SkyEye删除断点-通过ID +// SkyEye删除断点-通过ID SkyEyeAPIRetST skyeye_delete_breakpoint_by_id(char *cpuname, int id) { SkyEyeAPIRetST ApiRet; @@ -222,7 +268,8 @@ SkyEyeAPIRetST skyeye_delete_breakpoint_by_id(char *cpuname, int id) memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -231,8 +278,8 @@ SkyEyeAPIRetST skyeye_delete_breakpoint_by_id(char *cpuname, int id) if (iface == NULL) { - skyeye_log(Warning_log, __FUNCTION__, "can not get %s interface from %s\n", CORE_BREAKPOINT_OP_INTF_NAME, - cpuname); + output_msg(Warning_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "can not get %s interface from %s\n", CORE_BREAKPOINT_OP_INTF_NAME, cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -240,7 +287,8 @@ SkyEyeAPIRetST skyeye_delete_breakpoint_by_id(char *cpuname, int id) address = iface->get_bp_addr_by_id(core, id); if (0 != iface->delete_bp(core, address)) { - skyeye_log(Warning_log, __FUNCTION__, "Call %s delete_bp iface Failed!\n", cpuname); + output_msg(Warning_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call %s delete_bp iface Failed!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -249,7 +297,7 @@ SkyEyeAPIRetST skyeye_delete_breakpoint_by_id(char *cpuname, int id) return ApiRet; } -//SkyEye删除断点-通过地址 +// SkyEye删除断点-通过地址 SkyEyeAPIRetST skyeye_delete_breakpoint_by_addr(char *cpuname, uint32_t address) { SkyEyeAPIRetST ApiRet; @@ -258,7 +306,8 @@ SkyEyeAPIRetST skyeye_delete_breakpoint_by_addr(char *cpuname, uint32_t address) memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -267,14 +316,16 @@ SkyEyeAPIRetST skyeye_delete_breakpoint_by_addr(char *cpuname, uint32_t address) if (iface == NULL) { - skyeye_log(Warning_log, __FUNCTION__, "Can't get %s %s iface!\n", cpuname, CORE_BREAKPOINT_OP_INTF_NAME); + output_msg(Warning_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface!\n", cpuname, CORE_BREAKPOINT_OP_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } if (0 != iface->delete_bp(core, address)) { - skyeye_log(Warning_log, __FUNCTION__, "Call %s delete_bp iface Failed!\n", cpuname); + output_msg(Warning_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call %s delete_bp iface Failed!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -283,7 +334,7 @@ SkyEyeAPIRetST skyeye_delete_breakpoint_by_addr(char *cpuname, uint32_t address) return ApiRet; } -//SkyEye获取断点地址-通过ID +// SkyEye获取断点地址-通过ID SkyEyeAPIRetST skyeye_get_breakpoint_address_by_id(char *cpuname, int id) { SkyEyeAPIRetST ApiRet; @@ -292,7 +343,8 @@ SkyEyeAPIRetST skyeye_get_breakpoint_address_by_id(char *cpuname, int id) memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -301,7 +353,8 @@ SkyEyeAPIRetST skyeye_get_breakpoint_address_by_id(char *cpuname, int id) if (iface == NULL) { - skyeye_log(Warning_log, __FUNCTION__, "Can't get %s %s iface!\n", cpuname, CORE_BREAKPOINT_OP_INTF_NAME); + output_msg(Warning_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface!\n", cpuname, CORE_BREAKPOINT_OP_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -311,7 +364,7 @@ SkyEyeAPIRetST skyeye_get_breakpoint_address_by_id(char *cpuname, int id) return ApiRet; } -//SkyEye获取断点数量 +// SkyEye获取断点数量 SkyEyeAPIRetST skyeye_get_bp_numbers(char *cpuname) { SkyEyeAPIRetST ApiRet; @@ -320,7 +373,8 @@ SkyEyeAPIRetST skyeye_get_bp_numbers(char *cpuname) memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -329,7 +383,8 @@ SkyEyeAPIRetST skyeye_get_bp_numbers(char *cpuname) if (iface == NULL) { - skyeye_log(Warning_log, __FUNCTION__, "Can't get %s %s iface!\n", cpuname, CORE_BREAKPOINT_OP_INTF_NAME); + output_msg(Warning_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface!\n", cpuname, CORE_BREAKPOINT_OP_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -339,7 +394,7 @@ SkyEyeAPIRetST skyeye_get_bp_numbers(char *cpuname) return ApiRet; } -//SkyEye检查断点是否触发 +// SkyEye检查断点是否触发 SkyEyeAPIRetST skyeye_check_bp_hit(char *cpuname) { SkyEyeAPIRetST ApiRet; @@ -348,7 +403,8 @@ SkyEyeAPIRetST skyeye_check_bp_hit(char *cpuname) memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -357,7 +413,8 @@ SkyEyeAPIRetST skyeye_check_bp_hit(char *cpuname) if (iface == NULL) { - skyeye_log(Warning_log, __FUNCTION__, "Can't get %s %s iface!\n", cpuname, CORE_BREAKPOINT_OP_INTF_NAME); + output_msg(Warning_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface!\n", cpuname, CORE_BREAKPOINT_OP_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -367,7 +424,7 @@ SkyEyeAPIRetST skyeye_check_bp_hit(char *cpuname) return ApiRet; } -//SkyEye获取触发断点ID +// SkyEye获取触发断点ID SkyEyeAPIRetST skyeye_get_bp_hit_id(char *cpuname) { SkyEyeAPIRetST ApiRet; @@ -376,7 +433,8 @@ SkyEyeAPIRetST skyeye_get_bp_hit_id(char *cpuname) memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -385,7 +443,8 @@ SkyEyeAPIRetST skyeye_get_bp_hit_id(char *cpuname) if (iface == NULL) { - skyeye_log(Warning_log, __FUNCTION__, "Can't get %s %s iface!\n", cpuname, CORE_BREAKPOINT_OP_INTF_NAME); + output_msg(Warning_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface!\n", cpuname, CORE_BREAKPOINT_OP_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -395,7 +454,7 @@ SkyEyeAPIRetST skyeye_get_bp_hit_id(char *cpuname) return ApiRet; } -//SkyEye清除断点 +// SkyEye清除断点 SkyEyeAPIRetST skyeye_clear_bp_hit(char *cpuname) { SkyEyeAPIRetST ApiRet; @@ -405,7 +464,8 @@ SkyEyeAPIRetST skyeye_clear_bp_hit(char *cpuname) memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -414,7 +474,8 @@ SkyEyeAPIRetST skyeye_clear_bp_hit(char *cpuname) if (iface == NULL) { - skyeye_log(Warning_log, __FUNCTION__, "Can't get %s %s iface!\n", cpuname, CORE_BREAKPOINT_OP_INTF_NAME); + output_msg(Warning_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface!\n", cpuname, CORE_BREAKPOINT_OP_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -426,9 +487,9 @@ SkyEyeAPIRetST skyeye_clear_bp_hit(char *cpuname) /* *3.SkyEye创建目标系统各模块API接口 -*/ + */ -//SkyEye实例化模块,实际返回object对象指针 +// SkyEye实例化模块,实际返回object对象指针 SkyEyeAPIRetST skyeye_add_pre_obj(char *objname, char *classname) { SkyEyeAPIRetST ApiRet; @@ -437,7 +498,8 @@ SkyEyeAPIRetST skyeye_add_pre_obj(char *objname, char *classname) memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (conf_obj == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", objname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", objname); ApiRet.result = API_ERROR; return ApiRet; } @@ -447,7 +509,7 @@ SkyEyeAPIRetST skyeye_add_pre_obj(char *objname, char *classname) return ApiRet; } -//SkyEye创建mach +// SkyEye创建mach SkyEyeAPIRetST skyeye_create_mach(char *objname, char *classname) { SkyEyeAPIRetST ApiRet; @@ -456,7 +518,8 @@ SkyEyeAPIRetST skyeye_create_mach(char *objname, char *classname) memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (conf_obj == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Create :%s object fail.", objname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Create :%s object fail.", objname); ApiRet.result = API_ERROR; return ApiRet; } @@ -466,7 +529,7 @@ SkyEyeAPIRetST skyeye_create_mach(char *objname, char *classname) return ApiRet; } -//SkyEye创建linker设备 +// SkyEye创建linker设备 SkyEyeAPIRetST skyeye_create_linker(char *objname, char *classname) { SkyEyeAPIRetST ApiRet; @@ -475,7 +538,8 @@ SkyEyeAPIRetST skyeye_create_linker(char *objname, char *classname) if (conf_obj == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Create :%s object fail.", objname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Create :%s object fail.", objname); ApiRet.result = API_ERROR; return ApiRet; } @@ -485,7 +549,7 @@ SkyEyeAPIRetST skyeye_create_linker(char *objname, char *classname) return ApiRet; } -//SkyEye创建cpu +// SkyEye创建cpu SkyEyeAPIRetST skyeye_create_cpu(char *machname, char *objname, char *classname) { SkyEyeAPIRetST ApiRet; @@ -495,7 +559,8 @@ SkyEyeAPIRetST skyeye_create_cpu(char *machname, char *objname, char *classname) //检查cpu是否授权,返回0表示失败 if (0 == check_cpu(classname)) { - skyeye_log(Error_log, __FUNCTION__, "The Core:%s is not in the permit! Please Check License.\n", classname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "The Core:%s is not in the permit! Please Check License.\n", classname); ApiRet.result = API_ERROR; return ApiRet; } @@ -504,7 +569,8 @@ SkyEyeAPIRetST skyeye_create_cpu(char *machname, char *objname, char *classname) conf_object_t *cpu = pre_conf_obj(objname, classname); if (cpu == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Create :%s object fail.\n", objname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Create :%s object fail.\n", objname); ApiRet.result = API_ERROR; return ApiRet; } @@ -512,7 +578,8 @@ SkyEyeAPIRetST skyeye_create_cpu(char *machname, char *objname, char *classname) conf_object_t *mach_obj = get_conf_obj(machname); if (mach_obj == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s object\n", machname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s object\n", machname); ApiRet.result = API_ERROR; return ApiRet; } @@ -523,7 +590,7 @@ SkyEyeAPIRetST skyeye_create_cpu(char *machname, char *objname, char *classname) return ApiRet; } -//SkyEye创建device +// SkyEye创建device SkyEyeAPIRetST skyeye_create_device(char *machname, char *objname, char *classname) { SkyEyeAPIRetST ApiRet; @@ -535,7 +602,8 @@ SkyEyeAPIRetST skyeye_create_device(char *machname, char *objname, char *classna if (device == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Create :%s object fail.\n", objname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Create :%s object fail.\n", objname); ApiRet.result = API_ERROR; return ApiRet; } @@ -547,10 +615,10 @@ SkyEyeAPIRetST skyeye_create_device(char *machname, char *objname, char *classna sys_soc_t *sys_soc = mach_obj->sys_struct; core = sys_soc->cpus[0].cpu; - core_info_intf *core_info = (core_info_intf *) SKY_get_iface(core, CORE_INFO_INTF_NAME); + core_info_intf *core_info = (core_info_intf *)SKY_get_iface(core, CORE_INFO_INTF_NAME); endian_t endianess = core_info->get_endian(core); - attr_after_making = make_new_attr(Val_UInteger, (void *) endianess); + attr_after_making = make_new_attr(Val_UInteger, (void *)endianess); set_conf_attr(device, "endian", attr_after_making); } @@ -560,7 +628,7 @@ SkyEyeAPIRetST skyeye_create_device(char *machname, char *objname, char *classna return ApiRet; } -//SkyEye虚拟系统所有模块初始化配置接口 +// SkyEye虚拟系统所有模块初始化配置接口 SkyEyeAPIRetST skyeye_config_obj() { SkyEyeAPIRetST ApiRet; @@ -568,7 +636,8 @@ SkyEyeAPIRetST skyeye_config_obj() if (0 == system_config_conf_obj()) { - skyeye_log(Error_log, __FUNCTION__, "Call system_config_conf_obj fail!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call system_config_conf_obj fail!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -577,7 +646,7 @@ SkyEyeAPIRetST skyeye_config_obj() return ApiRet; } -//SkyEye模块初始化配置接口 +// SkyEye模块初始化配置接口 SkyEyeAPIRetST skyeye_config_module(char *objname) { SkyEyeAPIRetST ApiRet; @@ -587,7 +656,8 @@ SkyEyeAPIRetST skyeye_config_module(char *objname) if (module == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Create :%s object fail.\n", objname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Create :%s object fail.\n", objname); ApiRet.result = API_ERROR; return ApiRet; } @@ -598,7 +668,7 @@ SkyEyeAPIRetST skyeye_config_module(char *objname) return ApiRet; } -//SkyEye获取soc数量 +// SkyEye获取soc数量 SkyEyeAPIRetST skyeye_get_soc_num() { SkyEyeAPIRetST ApiRet; @@ -612,7 +682,7 @@ SkyEyeAPIRetST skyeye_get_soc_num() return ApiRet; } -//SkyEye获取指定SOC上的CPU数量 +// SkyEye获取指定SOC上的CPU数量 SkyEyeAPIRetST skyeye_get_cpu_num_by_soc_name(char *soc_name) { SkyEyeAPIRetST ApiRet; @@ -621,19 +691,20 @@ SkyEyeAPIRetST skyeye_get_cpu_num_by_soc_name(char *soc_name) memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (soc == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s object\n", soc_name); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s object\n", soc_name); ApiRet.result = API_ERROR; return ApiRet; } - sys_soc_t * sys_soc = (sys_soc_t *)soc->sys_struct; + sys_soc_t *sys_soc = (sys_soc_t *)soc->sys_struct; ApiRet.retIntValue = sys_soc->cpu_cnt; ApiRet.result = API_OK; return ApiRet; } -//SkyEye获取整个虚拟系统所有模块对象名称 +// SkyEye获取整个虚拟系统所有模块对象名称 SkyEyeAPIRetST skyeye_get_current_system_module_name() { SkyEyeAPIRetST ApiRet; @@ -644,7 +715,7 @@ SkyEyeAPIRetST skyeye_get_current_system_module_name() return ApiRet; } -//SkyEye添加设备在内存总线上的地址映射 +// SkyEye添加设备在内存总线上的地址映射 SkyEyeAPIRetST skyeye_add_map(char *memory_space_name, char *device_name, uint64_t address, uint32_t length) { SkyEyeAPIRetST ApiRet; @@ -653,7 +724,8 @@ SkyEyeAPIRetST skyeye_add_map(char *memory_space_name, char *device_name, uint64 //返回1表示成功,0表示失败 if (0 == WIN_memory_space_add_map(memory_space_name, device_name, address, length)) { - skyeye_log(Error_log, __FUNCTION__, "Call WIN_memory_space_add_map Failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call WIN_memory_space_add_map Failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -662,9 +734,9 @@ SkyEyeAPIRetST skyeye_add_map(char *memory_space_name, char *device_name, uint64 return ApiRet; } -//SkyEye添加设备到内存空间组 +// SkyEye添加设备到内存空间组 SkyEyeAPIRetST skyeye_add_map_group(char *memory_space_name, char *device_name, - uint64_t address, uint32_t length, uint32_t index) + uint64_t address, uint32_t length, uint32_t index) { SkyEyeAPIRetST ApiRet; memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); @@ -672,7 +744,8 @@ SkyEyeAPIRetST skyeye_add_map_group(char *memory_space_name, char *device_name, //返回1表示成功,0表示失败 if (0 == WIN_memory_space_add_map_group(memory_space_name, device_name, address, length, index)) { - skyeye_log(Error_log, __FUNCTION__, "Call WIN_memory_space_add_map_group Failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call WIN_memory_space_add_map_group Failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -683,7 +756,7 @@ SkyEyeAPIRetST skyeye_add_map_group(char *memory_space_name, char *device_name, /* *4.SkyEye处理器相关API接口 -*/ + */ //获取PC地址-通过处理器名称 SkyEyeAPIRetST skyeye_get_pc_by_cpuname(char *cpuname) { @@ -694,16 +767,18 @@ SkyEyeAPIRetST skyeye_get_pc_by_cpuname(char *cpuname) if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } - core_info_intf *core_info = (core_info_intf *) SKY_get_iface(core, CORE_INFO_INTF_NAME); + core_info_intf *core_info = (core_info_intf *)SKY_get_iface(core, CORE_INFO_INTF_NAME); if (core_info == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", cpuname, CORE_INFO_INTF_NAME); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", cpuname, CORE_INFO_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -723,7 +798,8 @@ SkyEyeAPIRetST skyeye_step_run(char *cpuname, const char *arg) if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -731,7 +807,8 @@ SkyEyeAPIRetST skyeye_step_run(char *cpuname, const char *arg) if (arg == NULL || *arg == '\0') { steps = 1; - } else + } + else { steps = strtoul(arg, NULL, 10); } @@ -739,9 +816,9 @@ SkyEyeAPIRetST skyeye_step_run(char *cpuname, const char *arg) if (SIM_get_core_mode(core) == DYNCOM_RUN) { SIM_stop(NULL); - //TODO(wshen): can't stop the simulator thread competely + // TODO(wshen): can't stop the simulator thread competely #ifdef __WIN32__ - Sleep(50000); //sleep 50s + Sleep(50000); // sleep 50s #else usleep(50000); #endif @@ -764,16 +841,18 @@ SkyEyeAPIRetST skyeye_disassemble_by_addr(char *cpuname, uint32_t addr) if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } - core_info_intf *core_info = (core_info_intf *) SKY_get_iface(core, CORE_INFO_INTF_NAME); + core_info_intf *core_info = (core_info_intf *)SKY_get_iface(core, CORE_INFO_INTF_NAME); if (core_info == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", cpuname, CORE_INFO_INTF_NAME); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", cpuname, CORE_INFO_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -799,16 +878,18 @@ SkyEyeAPIRetST skyeye_get_cpu_address_width(char *cpuname) if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } - core_info_intf *core_info = (core_info_intf *) SKY_get_iface(core, CORE_INFO_INTF_NAME); + core_info_intf *core_info = (core_info_intf *)SKY_get_iface(core, CORE_INFO_INTF_NAME); if (core_info == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", cpuname, CORE_INFO_INTF_NAME); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", cpuname, CORE_INFO_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -828,16 +909,18 @@ SkyEyeAPIRetST skyeye_get_cpu_steps(char *cpuname) if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } - core_info_intf *core_info = (core_info_intf *) SKY_get_iface(core, CORE_INFO_INTF_NAME); + core_info_intf *core_info = (core_info_intf *)SKY_get_iface(core, CORE_INFO_INTF_NAME); if (core_info == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", cpuname, CORE_INFO_INTF_NAME); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", cpuname, CORE_INFO_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -858,7 +941,8 @@ SkyEyeAPIRetST skyeye_set_cpu_run_mode(char *cpuname, int mode) if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -869,9 +953,11 @@ SkyEyeAPIRetST skyeye_set_cpu_run_mode(char *cpuname, int mode) SKY_set_attribute(core, "mode", &value); ApiRet.result = API_OK; return ApiRet; - } else + } + else { - skyeye_log(Error_log, __FUNCTION__, "cpu_name: %s not have mode attribute!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "cpu_name: %s not have mode attribute!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -887,16 +973,18 @@ SkyEyeAPIRetST skyeye_get_cpu_architecture(char *cpuname) if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } - core_info_intf *core_info = (core_info_intf *) SKY_get_iface(core, CORE_INFO_INTF_NAME); + core_info_intf *core_info = (core_info_intf *)SKY_get_iface(core, CORE_INFO_INTF_NAME); if (core_info == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", cpuname, CORE_INFO_INTF_NAME); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", cpuname, CORE_INFO_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -926,7 +1014,8 @@ SkyEyeAPIRetST skyeye_get_simulation_time(char *cpuname) if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -940,7 +1029,8 @@ SkyEyeAPIRetST skyeye_get_simulation_time(char *cpuname) if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", idle_obj->objname, IDLE_DEV_API_INTF_NAME); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", idle_obj->objname, IDLE_DEV_API_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -961,21 +1051,23 @@ SkyEyeAPIRetST skyeye_get_simulation_insn_num(char *cpuname) if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } - core_info_intf *core_info = (core_info_intf *) SKY_get_iface(core, CORE_INFO_INTF_NAME); + core_info_intf *core_info = (core_info_intf *)SKY_get_iface(core, CORE_INFO_INTF_NAME); if (core_info == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", cpuname, CORE_INFO_INTF_NAME); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", cpuname, CORE_INFO_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } - uint32_t cpu_freq = 10000000; //默认是10MHZ + uint32_t cpu_freq = 10000000; //默认是10MHZ uint64_t insn_num = 0; core_info->get_cpu_run_status(core, &cpu_freq, &insn_num); @@ -997,7 +1089,8 @@ SkyEyeAPIRetST skyeye_get_cpu_freq(char *cpuname) memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -1010,9 +1103,9 @@ SkyEyeAPIRetST skyeye_get_cpu_freq(char *cpuname) /* *5.SkyEye内存读写API接口 -*/ + */ -//SkyEye内存读 +// SkyEye内存读 SkyEyeAPIRetST skyeye_memory_read(char *cpuname, uint32_t addr, int count) { SkyEyeAPIRetST ApiRet; @@ -1022,16 +1115,18 @@ SkyEyeAPIRetST skyeye_memory_read(char *cpuname, uint32_t addr, int count) memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } - memory_space_intf *iface = (memory_space_intf *) SKY_get_iface(core, MEMORY_SPACE_INTF_NAME); + memory_space_intf *iface = (memory_space_intf *)SKY_get_iface(core, MEMORY_SPACE_INTF_NAME); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", cpuname, MEMORY_SPACE_INTF_NAME); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", cpuname, MEMORY_SPACE_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -1040,7 +1135,8 @@ SkyEyeAPIRetST skyeye_memory_read(char *cpuname, uint32_t addr, int count) if (ret != No_exp) { - skyeye_log(Error_log, __FUNCTION__, "Read addr:%x Failed!\n", addr); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Read addr:%x Failed!\n", addr); ApiRet.result = API_ERROR; return ApiRet; } @@ -1049,7 +1145,7 @@ SkyEyeAPIRetST skyeye_memory_read(char *cpuname, uint32_t addr, int count) return ApiRet; } -//SkyEye内存写 +// SkyEye内存写 SkyEyeAPIRetST skyeye_memory_write(char *cpuname, uint32_t addr, char *val, int count) { SkyEyeAPIRetST ApiRet; @@ -1059,16 +1155,18 @@ SkyEyeAPIRetST skyeye_memory_write(char *cpuname, uint32_t addr, char *val, int memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } - memory_space_intf *iface = (memory_space_intf *) SKY_get_iface(core, MEMORY_SPACE_INTF_NAME); + memory_space_intf *iface = (memory_space_intf *)SKY_get_iface(core, MEMORY_SPACE_INTF_NAME); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", cpuname, MEMORY_SPACE_INTF_NAME); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", cpuname, MEMORY_SPACE_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -1076,7 +1174,8 @@ SkyEyeAPIRetST skyeye_memory_write(char *cpuname, uint32_t addr, char *val, int exception_t ret = iface->write(core, addr, val, count); if (ret != No_exp) { - skyeye_log(Error_log, __FUNCTION__, "Write addr:%x Failed!\n", addr); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Write addr:%x Failed!\n", addr); ApiRet.result = API_ERROR; return ApiRet; } @@ -1084,7 +1183,7 @@ SkyEyeAPIRetST skyeye_memory_write(char *cpuname, uint32_t addr, char *val, int return ApiRet; } -//SkyEye设备读 +// SkyEye设备读 SkyEyeAPIRetST skyeye_device_read(char *device_name, uint32_t offset, int count) { SkyEyeAPIRetST ApiRet; @@ -1094,16 +1193,18 @@ SkyEyeAPIRetST skyeye_device_read(char *device_name, uint32_t offset, int count) memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (device == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get device_name: %s object!\n", device_name); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get device_name: %s object!\n", device_name); ApiRet.result = API_ERROR; return ApiRet; } - memory_space_intf *iface = (memory_space_intf *) SKY_get_iface(device, MEMORY_SPACE_INTF_NAME); + memory_space_intf *iface = (memory_space_intf *)SKY_get_iface(device, MEMORY_SPACE_INTF_NAME); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", device_name, MEMORY_SPACE_INTF_NAME); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", device_name, MEMORY_SPACE_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -1111,7 +1212,8 @@ SkyEyeAPIRetST skyeye_device_read(char *device_name, uint32_t offset, int count) exception_t ret = iface->read(device, offset, &data, count); if (ret != No_exp) { - skyeye_log(Error_log, __FUNCTION__, "Read offset:%x Failed!\n", offset); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Read offset:%x Failed!\n", offset); ApiRet.result = API_ERROR; return ApiRet; } @@ -1121,7 +1223,7 @@ SkyEyeAPIRetST skyeye_device_read(char *device_name, uint32_t offset, int count) return ApiRet; } -//SkyEye设备写 +// SkyEye设备写 SkyEyeAPIRetST skyeye_device_write(char *device_name, uint32_t offset, char *buf, int count) { SkyEyeAPIRetST ApiRet; @@ -1130,16 +1232,18 @@ SkyEyeAPIRetST skyeye_device_write(char *device_name, uint32_t offset, char *buf memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (device == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get device_name: %s object!\n", device_name); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get device_name: %s object!\n", device_name); ApiRet.result = API_ERROR; return ApiRet; } - memory_space_intf *iface = (memory_space_intf *) SKY_get_iface(device, MEMORY_SPACE_INTF_NAME); + memory_space_intf *iface = (memory_space_intf *)SKY_get_iface(device, MEMORY_SPACE_INTF_NAME); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", device_name, MEMORY_SPACE_INTF_NAME); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", device_name, MEMORY_SPACE_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -1147,7 +1251,8 @@ SkyEyeAPIRetST skyeye_device_write(char *device_name, uint32_t offset, char *buf exception_t ret = iface->write(device, offset, buf, count); if (ret != No_exp) { - skyeye_log(Error_log, __FUNCTION__, "Write offset:%x Failed!\n", offset); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Write offset:%x Failed!\n", offset); ApiRet.result = API_ERROR; return ApiRet; } @@ -1155,7 +1260,7 @@ SkyEyeAPIRetST skyeye_device_write(char *device_name, uint32_t offset, char *buf return ApiRet; } -//SkyEye激励设备读 +// SkyEye激励设备读 SkyEyeAPIRetST skyeye_inject_device_read(char *device_name, char *data) { SkyEyeAPIRetST ApiRet; @@ -1164,16 +1269,18 @@ SkyEyeAPIRetST skyeye_inject_device_read(char *device_name, char *data) memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (device == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get device_name: %s object!\n", device_name); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get device_name: %s object!\n", device_name); ApiRet.result = API_ERROR; return ApiRet; } - data_inject_intf *iface = (data_inject_intf *) SKY_get_iface(device, DATA_INJECT_INTF); + data_inject_intf *iface = (data_inject_intf *)SKY_get_iface(device, DATA_INJECT_INTF); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", device_name, DATA_INJECT_INTF); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", device_name, DATA_INJECT_INTF); ApiRet.result = API_ERROR; return ApiRet; } @@ -1183,7 +1290,7 @@ SkyEyeAPIRetST skyeye_inject_device_read(char *device_name, char *data) return ApiRet; } -//SkyEye激励设备写 +// SkyEye激励设备写 SkyEyeAPIRetST skyeye_inject_device_write(char *device_name, char *data, int size) { SkyEyeAPIRetST ApiRet; @@ -1192,16 +1299,18 @@ SkyEyeAPIRetST skyeye_inject_device_write(char *device_name, char *data, int siz memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (device == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get device_name: %s object!\n", device_name); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get device_name: %s object!\n", device_name); ApiRet.result = API_ERROR; return ApiRet; } - data_inject_intf *iface = (data_inject_intf *) SKY_get_iface(device, DATA_INJECT_INTF); + data_inject_intf *iface = (data_inject_intf *)SKY_get_iface(device, DATA_INJECT_INTF); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", device_name, DATA_INJECT_INTF); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", device_name, DATA_INJECT_INTF); ApiRet.result = API_ERROR; return ApiRet; } @@ -1213,7 +1322,7 @@ SkyEyeAPIRetST skyeye_inject_device_write(char *device_name, char *data, int siz /* *6.SkyEye其他API接口 -*/ + */ SkyEyeAPIRetST skyeye_set_min_syn_time(double s, double delay) { @@ -1234,7 +1343,8 @@ SkyEyeAPIRetST skyeye_set_attr(char *objname, char *key, char *attr_type, char * if (0 == WIN_set_attr(objname, key, attr_type, value)) { - skyeye_log(Error_log, __FUNCTION__, "Call WIN_set_attr failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call WIN_set_attr failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -1251,7 +1361,8 @@ SkyEyeAPIRetST skyeye_connect_device(char *con_objname, char *iface_objname, cha if (0 == WIN_connect(con_objname, iface_objname, name, index)) { - skyeye_log(Error_log, __FUNCTION__, "Call WIN_connect failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call WIN_connect failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -1277,7 +1388,8 @@ SkyEyeAPIRetST skyeye_get_module_type(char *objname) if (obj == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get module_name: %s object!\n", objname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get module_name: %s object!\n", objname); ApiRet.result = API_ERROR; return ApiRet; } @@ -1489,7 +1601,8 @@ SkyEyeAPIRetST skyeye_license_verify() if (ApiRet.retIntValue != 3) { - skyeye_log(Error_log, __FUNCTION__, "License Check failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "License Check failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -1509,7 +1622,8 @@ SkyEyeAPIRetST skyeye_read_license_info(char *filename) { strcpy(ApiRet.retStrValue, tmpStrValue); ApiRet.result = API_OK; - } else + } + else { ApiRet.result = API_ERROR; } @@ -1528,7 +1642,8 @@ SkyEyeAPIRetST skyeye_get_cpuid() { strcpy(ApiRet.retStrValue, tmpStrValue); ApiRet.result = API_OK; - } else + } + else { ApiRet.result = API_ERROR; } @@ -1543,7 +1658,8 @@ SkyEyeAPIRetST skyeye_check_usbKey_connect() if (0 == check_usb_lic_connect()) { - skyeye_log(Error_log, __FUNCTION__, "usbKey connect failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "usbKey connect failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -1560,7 +1676,8 @@ SkyEyeAPIRetST skyeye_set_script_path(char *path) if (-1 == WIN_set_script_path(path)) { - skyeye_log(Error_log, __FUNCTION__, "Call WIN_set_script_path failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call WIN_set_script_path failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -1605,7 +1722,7 @@ SkyEyeAPIRetST skyeye_get_work_path() /* *7.SkyEye数据激励功能API接口 -*/ + */ SkyEyeAPIRetST skyeye_parse_symbol(char *cpuname, char *hex_file_name) { @@ -1616,7 +1733,8 @@ SkyEyeAPIRetST skyeye_parse_symbol(char *cpuname, char *hex_file_name) if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -1647,7 +1765,8 @@ SkyEyeAPIRetST skyeye_get_symbol_addr(char *cpu_name, char *sym_str) if (SYM_OK != SkyEye_GetSymbol_Addr(cpu_name, sym_str, &global_addr)) { - skyeye_log(Error_log, __FUNCTION__, "Get Symobl:%s Addr Failed!\n", sym_str); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Get Symobl:%s Addr Failed!\n", sym_str); ApiRet.result = API_ERROR; return ApiRet; } @@ -1701,7 +1820,8 @@ SkyEyeAPIRetST skyeye_set_symbol_value(char *cpu_name, char *sym_str, uint64_t v if (SYM_OK != result) { - skyeye_log(Error_log, __FUNCTION__, "Set Symobl:%s Value Failed!\n", sym_str); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Set Symobl:%s Value Failed!\n", sym_str); ApiRet.result = API_ERROR; return ApiRet; } @@ -1721,7 +1841,8 @@ SkyEyeAPIRetST skyeye_set_float_symbol_value(char *cpu_name, char *sym_str, floa if (SYM_OK != result) { - skyeye_log(Error_log, __FUNCTION__, "Set Float Symobl:%s Value Failed!\n", sym_str); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Set Float Symobl:%s Value Failed!\n", sym_str); ApiRet.result = API_ERROR; return ApiRet; } @@ -1741,7 +1862,8 @@ SkyEyeAPIRetST skyeye_set_double_symbol_value(char *cpu_name, char *sym_str, dou if (SYM_OK != result) { - skyeye_log(Error_log, __FUNCTION__, "Set Float Symobl:%s Value Failed!\n", sym_str); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Set Float Symobl:%s Value Failed!\n", sym_str); ApiRet.result = API_ERROR; return ApiRet; } @@ -1761,7 +1883,8 @@ SkyEyeAPIRetST skyeye_get_func_addr(char *cpu_name, char *func_str) if (ApiRet.retIntValue == 0) { - skyeye_log(Error_log, __FUNCTION__, "Get Function Addr:%s Failed!\n", func_str); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Get Function Addr:%s Failed!\n", func_str); ApiRet.result = API_ERROR; return ApiRet; } @@ -1780,7 +1903,8 @@ SkyEyeAPIRetST skyeye_get_func_length(char *cpu_name, char *func_str) if (ApiRet.retIntValue == 0) { - skyeye_log(Error_log, __FUNCTION__, "Get Function Length:%s Failed!\n", func_str); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Get Function Length:%s Failed!\n", func_str); ApiRet.result = API_ERROR; return ApiRet; } @@ -1791,7 +1915,7 @@ SkyEyeAPIRetST skyeye_get_func_length(char *cpu_name, char *func_str) /* *8.SkyEye寄存器API接口 -*/ + */ SkyEyeAPIRetST skyeye_get_register_num(char *devicename) { @@ -1803,26 +1927,29 @@ SkyEyeAPIRetST skyeye_get_register_num(char *devicename) if (device == NULL) { - skyeye_log(Error_log, __FUNCTION__, " Can't get device_name: %s object!\n", devicename); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + " Can't get device_name: %s object!\n", devicename); ApiRet.result = API_ERROR; return ApiRet; } - //First check if have SKYEYE_REG64_INTF + // First check if have SKYEYE_REG64_INTF skyeye_reg64_intf *iface64 = SKY_get_iface(device, SKYEYE_REG64_INTF); if (iface64 == NULL) { - //if no SKYEYE_REG64_INTF, check SKYEYE_REG_INTF + // if no SKYEYE_REG64_INTF, check SKYEYE_REG_INTF skyeye_reg_intf *iface = SKY_get_iface(device, SKYEYE_REG_INTF); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", devicename, SKYEYE_REG_INTF); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", devicename, SKYEYE_REG_INTF); ApiRet.result = API_ERROR; return ApiRet; } reg_num = iface->get_regnum(device); - } else + } + else { reg_num = iface64->get_regnum(device); } @@ -1841,26 +1968,29 @@ SkyEyeAPIRetST skyeye_get_regvalue_by_id(char *devicename, uint32_t id) if (device == NULL) { - skyeye_log(Error_log, __FUNCTION__, " Can't get device_name: %s object!\n", devicename); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + " Can't get device_name: %s object!\n", devicename); ApiRet.result = API_ERROR; return ApiRet; } - //First check if have SKYEYE_REG64_INTF + // First check if have SKYEYE_REG64_INTF skyeye_reg64_intf *iface64 = SKY_get_iface(device, SKYEYE_REG64_INTF); if (iface64 == NULL) { - //if no SKYEYE_REG64_INTF, check SKYEYE_REG_INTF + // if no SKYEYE_REG64_INTF, check SKYEYE_REG_INTF skyeye_reg_intf *iface = SKY_get_iface(device, SKYEYE_REG_INTF); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", devicename, SKYEYE_REG_INTF); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", devicename, SKYEYE_REG_INTF); ApiRet.result = API_ERROR; return ApiRet; } ApiRet.retLongValue = iface->get_regvalue_by_id(device, id); - } else + } + else { ApiRet.retLongValue = iface64->get_regvalue_by_id(device, id); } @@ -1879,26 +2009,29 @@ SkyEyeAPIRetST skyeye_get_regname_by_id(char *devicename, uint32_t id) if (device == NULL) { - skyeye_log(Error_log, __FUNCTION__, " Can't get device_name: %s object!\n", devicename); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + " Can't get device_name: %s object!\n", devicename); ApiRet.result = API_ERROR; return ApiRet; } - //First check if have SKYEYE_REG64_INTF + // First check if have SKYEYE_REG64_INTF skyeye_reg64_intf *iface64 = SKY_get_iface(device, SKYEYE_REG64_INTF); if (iface64 == NULL) { - //if no SKYEYE_REG64_INTF, check SKYEYE_REG_INTF + // if no SKYEYE_REG64_INTF, check SKYEYE_REG_INTF skyeye_reg_intf *iface = SKY_get_iface(device, SKYEYE_REG_INTF); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", devicename, SKYEYE_REG_INTF); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", devicename, SKYEYE_REG_INTF); ApiRet.result = API_ERROR; return ApiRet; } tmpStrValue = iface->get_regname_by_id(device, id); - } else + } + else { tmpStrValue = iface64->get_regname_by_id(device, id); } @@ -1922,21 +2055,23 @@ SkyEyeAPIRetST skyeye_get_regoffset_by_id(char *devicename, uint32_t id) if (device == NULL) { - skyeye_log(Error_log, __FUNCTION__, " Can't get device_name: %s object!\n", devicename); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + " Can't get device_name: %s object!\n", devicename); ApiRet.result = API_ERROR; return ApiRet; } - //First check if have SKYEYE_REG64_INTF + // First check if have SKYEYE_REG64_INTF skyeye_reg64_intf *iface64 = SKY_get_iface(device, SKYEYE_REG64_INTF); if (iface64 == NULL) { - //if no SKYEYE_REG64_INTF, check SKYEYE_REG_INTF + // if no SKYEYE_REG64_INTF, check SKYEYE_REG_INTF skyeye_reg_intf *iface = SKY_get_iface(device, SKYEYE_REG_INTF); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", devicename, SKYEYE_REG_INTF); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", devicename, SKYEYE_REG_INTF); ApiRet.result = API_ERROR; return ApiRet; } @@ -1948,7 +2083,8 @@ SkyEyeAPIRetST skyeye_get_regoffset_by_id(char *devicename, uint32_t id) return ApiRet; } ApiRet.retIntValue = iface->get_regoffset_by_id(device, id); - } else + } + else { if (iface64->get_regoffset_by_id == NULL) { @@ -1974,27 +2110,30 @@ SkyEyeAPIRetST skyeye_set_regvalue_by_id(char *devicename, uint64_t value, uint3 if (device == NULL) { - skyeye_log(Error_log, __FUNCTION__, " Can't get device_name: %s object!\n", devicename); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + " Can't get device_name: %s object!\n", devicename); ApiRet.result = API_ERROR; return ApiRet; } - //First check if have SKYEYE_REG64_INTF + // First check if have SKYEYE_REG64_INTF skyeye_reg64_intf *iface64 = SKY_get_iface(device, SKYEYE_REG64_INTF); if (iface64 == NULL) { - //if no SKYEYE_REG64_INTF, check SKYEYE_REG_INTF + // if no SKYEYE_REG64_INTF, check SKYEYE_REG_INTF skyeye_reg_intf *iface = SKY_get_iface(device, SKYEYE_REG_INTF); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", devicename, SKYEYE_REG_INTF); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", devicename, SKYEYE_REG_INTF); ApiRet.result = API_ERROR; return ApiRet; } iface->set_regvalue_by_id(device, (uint32_t)value, id); - } else + } + else { iface64->set_regvalue_by_id(device, value, id); } @@ -2013,27 +2152,30 @@ SkyEyeAPIRetST skyeye_get_regid_by_name(char *devicename, char *name) if (device == NULL) { - skyeye_log(Error_log, __FUNCTION__, " Can't get device_name: %s object!\n", devicename); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + " Can't get device_name: %s object!\n", devicename); ApiRet.result = API_ERROR; return ApiRet; } - //First check if have SKYEYE_REG64_INTF + // First check if have SKYEYE_REG64_INTF skyeye_reg64_intf *iface64 = SKY_get_iface(device, SKYEYE_REG64_INTF); if (iface64 == NULL) { - //if no SKYEYE_REG64_INTF, check SKYEYE_REG_INTF + // if no SKYEYE_REG64_INTF, check SKYEYE_REG_INTF skyeye_reg_intf *iface = SKY_get_iface(device, SKYEYE_REG_INTF); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface\n", devicename, SKYEYE_REG_INTF); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface\n", devicename, SKYEYE_REG_INTF); ApiRet.result = API_ERROR; return ApiRet; } ApiRet.retIntValue = iface->get_regid_by_name(device, name); - } else + } + else { ApiRet.retIntValue = iface64->get_regid_by_name(device, name); } @@ -2044,7 +2186,7 @@ SkyEyeAPIRetST skyeye_get_regid_by_name(char *devicename, char *name) /* *9.SkyEye GDB调试功能API接口 -*/ + */ SkyEyeAPIRetST skyeye_create_remote_gdb(char *cpuname, int port, char *ip) { @@ -2054,7 +2196,8 @@ SkyEyeAPIRetST skyeye_create_remote_gdb(char *cpuname, int port, char *ip) if (0 == WIN_create_remote_gdb(cpuname, port, ip)) { - skyeye_log(Error_log, __FUNCTION__, "Call WIN_create_remote_gdb iface Failed\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call WIN_create_remote_gdb iface Failed\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -2070,7 +2213,8 @@ SkyEyeAPIRetST skyeye_delete_remote_gdb(char *cpuname) if (0 == WIN_delete_remote_gdb(cpuname)) { - skyeye_log(Error_log, __FUNCTION__, "Call WIN_delete_remote_gdb iface Failed\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call WIN_delete_remote_gdb iface Failed\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -2086,7 +2230,8 @@ SkyEyeAPIRetST skyeye_remote_gdb_check_link(char *cpuname) if (0 == WIN_remote_gdb_check_link(cpuname)) { - skyeye_log(Error_log, __FUNCTION__, "Call WIN_remote_gdb_check_link iface Failed\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call WIN_remote_gdb_check_link iface Failed\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -2113,7 +2258,7 @@ SkyEyeAPIRetST skyeye_remote_gdb_get_client_ip(char *cpuname) } /* *10.SkyEye加载功能API接口 -*/ + */ SkyEyeAPIRetST skyeye_load_file(char *cpuname, const char *filename, generic_address_t load_addr) { @@ -2123,10 +2268,10 @@ SkyEyeAPIRetST skyeye_load_file(char *cpuname, const char *filename, generic_add memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); - if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -2134,20 +2279,20 @@ SkyEyeAPIRetST skyeye_load_file(char *cpuname, const char *filename, generic_add ret = load_file(core, filename, load_addr); if (ret == File_open_exp) { - errCode = 0x90000001; //error_message_data.json define errCode - ApiRet.errMsg = getErrorMessage("%x %s %d %s", errCode, __func__, __LINE__, filename); + // error_message_data.json define errCode + output_msg(Warning_log, 0x90000001, ApiRet.errMsg, OUTPUT_2_PYTHON, "%s", filename); ApiRet.result = API_ERROR; return ApiRet; - } else if (ret == Not_found_exp) + } + else if (ret == Not_found_exp) { - errCode = 0x90000002; - ApiRet.errMsg = getErrorMessage("%x %s %d %s %s", errCode, __func__, __LINE__, cpuname, MEMORY_SPACE_INTF_NAME); + output_msg(Warning_log, 0x90000002, ApiRet.errMsg, OUTPUT_2_PYTHON, "%s %s", cpuname, MEMORY_SPACE_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; - } else if (ret == Excess_range_exp) + } + else if (ret == Excess_range_exp) { - errCode = 0x90000003; - ApiRet.errMsg = getErrorMessage("%x %s %d", errCode, __func__, __LINE__); + output_msg(Warning_log, 0x90000003, ApiRet.errMsg, OUTPUT_2_PYTHON, " "); ApiRet.result = API_ERROR; return ApiRet; } @@ -2166,18 +2311,17 @@ SkyEyeAPIRetST skyeye_load_binary(char *cpuname, char *elfname) memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); - if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } if (access(elfname, F_OK)) { - errCode = 0x90000001; - ApiRet.errMsg = getErrorMessage("%x %s %d %s", errCode, __func__, __LINE__, elfname); + output_msg(Warning_log, 0x90000001, ApiRet.errMsg, OUTPUT_2_PYTHON, "%s", elfname); ApiRet.result = API_ERROR; return ApiRet; } @@ -2185,22 +2329,24 @@ SkyEyeAPIRetST skyeye_load_binary(char *cpuname, char *elfname) if (is_elf(elfname)) { exp = get_elf_start_addr(elfname, &start_addr, &code_start_addr, &code_end_addr); - } else if (is_coff(elfname)) + } + else if (is_coff(elfname)) { exp = get_coff_start_addr(elfname, &start_addr, &code_start_addr, &code_end_addr); - } else if (is_hex(elfname)) + } + else if (is_hex(elfname)) { exp = get_hex_start_addr(elfname, &start_addr, &code_start_addr, &code_end_addr); - } else + } + else { exp = Invarg_exp; } if (exp != No_exp) { - errCode = 0x90000004; - skyeye_log(Error_log, __FUNCTION__, "Get Binary Start Address Failed!\n"); - ApiRet.errMsg = getErrorMessage("%x %s %d", errCode, __func__, __LINE__); + output_msg(Error_log, 0x90000004, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Get Binary Start Address Failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -2234,16 +2380,15 @@ SkyEyeAPIRetST skyeye_load_binary(char *cpuname, char *elfname) if (exp != No_exp) { - skyeye_log(Error_log, __FUNCTION__, "Load binary File Failed!\n"); - errCode = 0x90000005; - ApiRet.errMsg = getErrorMessage("%x %s %d", errCode, __func__, __LINE__); + output_msg(Error_log, 0x90000005, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Load binary File Failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } SIM_set_pc(core, start_addr, code_start_addr, code_end_addr); - sys_cpu_t *cpu = (sys_cpu_t *) (core->sys_struct); + sys_cpu_t *cpu = (sys_cpu_t *)(core->sys_struct); sys_soc_t *soc = cpu->sys_soc; sprintf(soc->binary_path, "%s", elfname); @@ -2260,7 +2405,8 @@ SkyEyeAPIRetST skyeye_load_bin_binary(char *cpuname, const char *filename, gener if (core == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get cpu_name: %s object!\n", cpuname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get cpu_name: %s object!\n", cpuname); ApiRet.result = API_ERROR; return ApiRet; } @@ -2290,16 +2436,18 @@ SkyEyeAPIRetST skyeye_new_load_file(char *memoryspace_name, const char *filename if (memory_space == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get memory_space name: %s object!\n", memoryspace_name); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get memory_space name: %s object!\n", memoryspace_name); ApiRet.result = API_ERROR; return ApiRet; } - memory_space_intf *iface = (memory_space_intf *) SKY_get_iface(memory_space, MEMORY_SPACE_INTF_NAME); + memory_space_intf *iface = (memory_space_intf *)SKY_get_iface(memory_space, MEMORY_SPACE_INTF_NAME); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Get memory_space interface from %s error!!!\n", memory_space->objname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Get memory_space interface from %s error!!!\n", memory_space->objname); ApiRet.result = API_ERROR; return ApiRet; } @@ -2307,7 +2455,8 @@ SkyEyeAPIRetST skyeye_new_load_file(char *memoryspace_name, const char *filename f = fopen(filename, "rb"); if (f == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can not open file %s.\n", filename); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can not open file %s.\n", filename); ApiRet.result = API_ERROR; return ApiRet; } @@ -2333,7 +2482,7 @@ SkyEyeAPIRetST skyeye_new_load_file(char *memoryspace_name, const char *filename } /* *11.SkyEye故障注入功能API接口 -*/ + */ SkyEyeAPIRetST skyeye_set_fault(char *memory_space_name, uint32_t addr, uint32_t bit, uint32_t mode, uint32_t count) { @@ -2346,7 +2495,8 @@ SkyEyeAPIRetST skyeye_set_fault(char *memory_space_name, uint32_t addr, uint32_t if (memory_space == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get memory_space_name: %s object!\n", memory_space_name); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get memory_space_name: %s object!\n", memory_space_name); ApiRet.result = API_ERROR; return ApiRet; } @@ -2355,17 +2505,19 @@ SkyEyeAPIRetST skyeye_set_fault(char *memory_space_name, uint32_t addr, uint32_t if (plug_iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface!\n", memory_space_name, MEMORY_SPACE_SET_PLUG_INTF_NAME); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface!\n", memory_space_name, MEMORY_SPACE_SET_PLUG_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } ret = plug_iface->set_plug(memory_space, addr, bit, mode); - memory_space_intf *iface = (memory_space_intf *) SKY_get_iface(memory_space, MEMORY_SPACE_INTF_NAME); + memory_space_intf *iface = (memory_space_intf *)SKY_get_iface(memory_space, MEMORY_SPACE_INTF_NAME); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface!\n", memory_space_name, MEMORY_SPACE_INTF_NAME); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface!\n", memory_space_name, MEMORY_SPACE_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -2373,29 +2525,35 @@ SkyEyeAPIRetST skyeye_set_fault(char *memory_space_name, uint32_t addr, uint32_t ret = iface->read(memory_space, addr, &buf, count); if (ret != No_exp) { - skyeye_log(Error_log, __FUNCTION__, "Read address:0x%x failed!\n", addr); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Read address:0x%x failed!\n", addr); ApiRet.result = API_ERROR; return ApiRet; } if (mode == 0) { - buf &= ~(0x1 << bit); //set bit : 0 - } else if (mode == 1) + buf &= ~(0x1 << bit); // set bit : 0 + } + else if (mode == 1) { - buf |= (0x1 << bit); //set bit : 1 - } else if (mode == 2) - { //reverse bit :if 0: set 1; if 1: set 0 + buf |= (0x1 << bit); // set bit : 1 + } + else if (mode == 2) + { // reverse bit :if 0: set 1; if 1: set 0 if (buf & (0x1 << bit)) { buf &= ~(0x1 << bit); - } else + } + else { buf |= (0x1 << bit); } - } else + } + else { - skyeye_log(Error_log, __FUNCTION__, "Can not set mode %d.\n", mode); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can not set mode %d.\n", mode); ApiRet.result = API_ERROR; return ApiRet; } @@ -2403,7 +2561,8 @@ SkyEyeAPIRetST skyeye_set_fault(char *memory_space_name, uint32_t addr, uint32_t ret = iface->write(memory_space, addr, &buf, count); if (ret != No_exp) { - skyeye_log(Error_log, __FUNCTION__, "Write address:0x%x failed!\n", addr); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Write address:0x%x failed!\n", addr); ApiRet.result = API_ERROR; return ApiRet; } @@ -2422,16 +2581,18 @@ SkyEyeAPIRetST skyeye_get_fault(char *memory_space_name, uint32_t addr) if (memory_space == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get memory_space_name: %s object!\n", memory_space_name); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get memory_space_name: %s object!\n", memory_space_name); ApiRet.result = API_ERROR; return ApiRet; } memory_space_set_plug_intf *iface = - (memory_space_set_plug_intf *) SKY_get_iface(memory_space, MEMORY_SPACE_SET_PLUG_INTF_NAME); + (memory_space_set_plug_intf *)SKY_get_iface(memory_space, MEMORY_SPACE_SET_PLUG_INTF_NAME); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface!\n", memory_space_name, MEMORY_SPACE_SET_PLUG_INTF_NAME); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface!\n", memory_space_name, MEMORY_SPACE_SET_PLUG_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -2454,7 +2615,8 @@ SkyEyeAPIRetST skyeye_clear_fault(char *memory_space_name, uint32_t addr, uint32 if (memory_space == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get memory_space_name: %s object!\n", memory_space_name); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get memory_space_name: %s object!\n", memory_space_name); ApiRet.result = API_ERROR; return ApiRet; } @@ -2463,7 +2625,8 @@ SkyEyeAPIRetST skyeye_clear_fault(char *memory_space_name, uint32_t addr, uint32 if (plug_iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface!\n", memory_space_name, MEMORY_SPACE_SET_PLUG_INTF_NAME); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface!\n", memory_space_name, MEMORY_SPACE_SET_PLUG_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -2471,17 +2634,17 @@ SkyEyeAPIRetST skyeye_clear_fault(char *memory_space_name, uint32_t addr, uint32 if (ret != No_exp) { - errCode = 0x90000006; - ApiRet.errMsg = getErrorMessage("%x %s %d", errCode, __func__, __LINE__); + output_msg(Error_log, 0x90000006, ApiRet.errMsg, OUTPUT_2_LOG_PY, "clear_plug failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } - memory_space_intf *iface = (memory_space_intf *) SKY_get_iface(memory_space, MEMORY_SPACE_INTF_NAME); + memory_space_intf *iface = (memory_space_intf *)SKY_get_iface(memory_space, MEMORY_SPACE_INTF_NAME); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface!\n", memory_space_name, MEMORY_SPACE_INTF_NAME); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface!\n", memory_space_name, MEMORY_SPACE_INTF_NAME); ApiRet.result = API_ERROR; return ApiRet; } @@ -2489,7 +2652,8 @@ SkyEyeAPIRetST skyeye_clear_fault(char *memory_space_name, uint32_t addr, uint32 ret = iface->read(memory_space, addr, &buf, 4); if (ret != No_exp) { - skyeye_log(Error_log, __FUNCTION__, "Read address:0x%x failed!\n", addr); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Read address:0x%x failed!\n", addr); ApiRet.result = API_ERROR; return ApiRet; } @@ -2497,23 +2661,28 @@ SkyEyeAPIRetST skyeye_clear_fault(char *memory_space_name, uint32_t addr, uint32 if (mode == 0) { buf |= (1 << bit); - } else if (mode == 1) + } + else if (mode == 1) { buf &= ~(1 << bit); if ((buf >> 31) & 0x1) buf = 0; - } else if (mode == 2) - { //reverse bit :if 0: set 1; if 1: set 0 + } + else if (mode == 2) + { // reverse bit :if 0: set 1; if 1: set 0 if (buf & (0x1 << bit)) { buf &= ~(0x1 << bit); - } else + } + else { buf |= (0x1 << bit); } - } else + } + else { - skyeye_log(Error_log, __FUNCTION__, "Can not set mode %d.\n", mode); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can not set mode %d.\n", mode); ApiRet.result = API_ERROR; return ApiRet; } @@ -2521,7 +2690,8 @@ SkyEyeAPIRetST skyeye_clear_fault(char *memory_space_name, uint32_t addr, uint32 ret = iface->write(memory_space, addr, &buf, 4); if (ret != No_exp) { - skyeye_log(Error_log, __FUNCTION__, "Write address:0x%x failed!\n", addr); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Write address:0x%x failed!\n", addr); ApiRet.result = API_ERROR; return ApiRet; } @@ -2531,7 +2701,7 @@ SkyEyeAPIRetST skyeye_clear_fault(char *memory_space_name, uint32_t addr, uint32 /* *12.SkyEye代码覆盖率功能API接口 -*/ + */ SkyEyeAPIRetST skyeye_get_executed_pc_file(char *instr_process_name, char *filename) { @@ -2542,16 +2712,18 @@ SkyEyeAPIRetST skyeye_get_executed_pc_file(char *instr_process_name, char *filen if (instr_process == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get instr_process_name: %s object!\n", instr_process_name); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get instr_process_name: %s object!\n", instr_process_name); ApiRet.result = API_ERROR; return ApiRet; } - instr_process_intf *iface = (instr_process_intf *) SKY_get_iface(instr_process, INSTR_PROCESS_INTF); + instr_process_intf *iface = (instr_process_intf *)SKY_get_iface(instr_process, INSTR_PROCESS_INTF); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface!\n", instr_process_name, INSTR_PROCESS_INTF); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface!\n", instr_process_name, INSTR_PROCESS_INTF); ApiRet.result = API_ERROR; return ApiRet; } @@ -2587,7 +2759,8 @@ SkyEyeAPIRetST skyeye_enable_cpu_codecov(char *machname) if (0 == WIN_enable_cpu_codecov(machname)) { - skyeye_log(Error_log, __FUNCTION__, "Call WIN_enable_cpu_codecov iface failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call WIN_enable_cpu_codecov iface failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -2598,7 +2771,7 @@ SkyEyeAPIRetST skyeye_enable_cpu_codecov(char *machname) /* *13.SkyEye指令流记录功能API接口 -*/ + */ SkyEyeAPIRetST skyeye_get_pc_record_size(char *instr_process_name) { @@ -2609,16 +2782,18 @@ SkyEyeAPIRetST skyeye_get_pc_record_size(char *instr_process_name) if (instr_process == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get instr_process_name: %s object!\n", instr_process_name); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get instr_process_name: %s object!\n", instr_process_name); ApiRet.result = API_ERROR; return ApiRet; } - instr_process_intf *iface = (instr_process_intf *) SKY_get_iface(instr_process, INSTR_PROCESS_INTF); + instr_process_intf *iface = (instr_process_intf *)SKY_get_iface(instr_process, INSTR_PROCESS_INTF); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface!\n", instr_process_name, INSTR_PROCESS_INTF); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface!\n", instr_process_name, INSTR_PROCESS_INTF); ApiRet.result = API_ERROR; return ApiRet; } @@ -2638,16 +2813,18 @@ SkyEyeAPIRetST skyeye_set_pc_record_size(char *instr_process_name, int size) if (instr_process == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get instr_process_name: %s object!\n", instr_process_name); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get instr_process_name: %s object!\n", instr_process_name); ApiRet.result = API_ERROR; return ApiRet; } - instr_process_intf *iface = (instr_process_intf *) SKY_get_iface(instr_process, INSTR_PROCESS_INTF); + instr_process_intf *iface = (instr_process_intf *)SKY_get_iface(instr_process, INSTR_PROCESS_INTF); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface!\n", instr_process_name, INSTR_PROCESS_INTF); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface!\n", instr_process_name, INSTR_PROCESS_INTF); ApiRet.result = API_ERROR; return ApiRet; } @@ -2667,16 +2844,18 @@ SkyEyeAPIRetST skyeye_get_pc_record_nums(char *instr_process_name) if (instr_process == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get instr_process_name: %s object!\n", instr_process_name); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get instr_process_name: %s object!\n", instr_process_name); ApiRet.result = API_ERROR; return ApiRet; } - instr_process_intf *iface = (instr_process_intf *) SKY_get_iface(instr_process, INSTR_PROCESS_INTF); + instr_process_intf *iface = (instr_process_intf *)SKY_get_iface(instr_process, INSTR_PROCESS_INTF); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface!\n", instr_process_name, INSTR_PROCESS_INTF); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface!\n", instr_process_name, INSTR_PROCESS_INTF); ApiRet.result = API_ERROR; return ApiRet; } @@ -2696,16 +2875,18 @@ SkyEyeAPIRetST skyeye_get_pc_record_index(char *instr_process_name) if (instr_process == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get instr_process_name: %s object!\n", instr_process_name); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get instr_process_name: %s object!\n", instr_process_name); ApiRet.result = API_ERROR; return ApiRet; } - instr_process_intf *iface = (instr_process_intf *) SKY_get_iface(instr_process, INSTR_PROCESS_INTF); + instr_process_intf *iface = (instr_process_intf *)SKY_get_iface(instr_process, INSTR_PROCESS_INTF); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface!\n", instr_process_name, INSTR_PROCESS_INTF); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface!\n", instr_process_name, INSTR_PROCESS_INTF); ApiRet.result = API_ERROR; return ApiRet; } @@ -2725,16 +2906,18 @@ SkyEyeAPIRetST skyeye_get_pc_record_overflow(char *instr_process_name) if (instr_process == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get instr_process_name: %s object!\n", instr_process_name); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get instr_process_name: %s object!\n", instr_process_name); ApiRet.result = API_ERROR; return ApiRet; } - instr_process_intf *iface = (instr_process_intf *) SKY_get_iface(instr_process, INSTR_PROCESS_INTF); + instr_process_intf *iface = (instr_process_intf *)SKY_get_iface(instr_process, INSTR_PROCESS_INTF); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface!\n", instr_process_name, INSTR_PROCESS_INTF); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface!\n", instr_process_name, INSTR_PROCESS_INTF); ApiRet.result = API_ERROR; return ApiRet; } @@ -2754,16 +2937,18 @@ SkyEyeAPIRetST skyeye_get_pc_by_index(char *instr_process_name, int id) if (instr_process == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get instr_process_name: %s object!\n", instr_process_name); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get instr_process_name: %s object!\n", instr_process_name); ApiRet.result = API_ERROR; return ApiRet; } - instr_process_intf *iface = (instr_process_intf *) SKY_get_iface(instr_process, INSTR_PROCESS_INTF); + instr_process_intf *iface = (instr_process_intf *)SKY_get_iface(instr_process, INSTR_PROCESS_INTF); if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s %s iface!\n", instr_process_name, INSTR_PROCESS_INTF); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s %s iface!\n", instr_process_name, INSTR_PROCESS_INTF); ApiRet.result = API_ERROR; return ApiRet; } @@ -2782,7 +2967,8 @@ SkyEyeAPIRetST skyeye_open_instr_record(char *cpu_name, char *filename) if (0 == WIN_open_instr_record(cpu_name, filename)) { - skyeye_log(Error_log, __FUNCTION__, "Call WIN_open_instr_record iface failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call WIN_open_instr_record iface failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -2798,7 +2984,8 @@ SkyEyeAPIRetST skyeye_close_instr_record(char *cpu_name) if (0 == WIN_close_instr_record(cpu_name)) { - skyeye_log(Error_log, __FUNCTION__, "Call WIN_close_instr_record iface failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call WIN_close_instr_record iface failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -2809,7 +2996,7 @@ SkyEyeAPIRetST skyeye_close_instr_record(char *cpu_name) /* *14.SkyEye异常触发功能API接口 -*/ + */ SkyEyeAPIRetST skyeye_get_cpu_exception_num(char *cpu_name) { @@ -2820,7 +3007,8 @@ SkyEyeAPIRetST skyeye_get_cpu_exception_num(char *cpu_name) if (0 == ApiRet.retIntValue) { - skyeye_log(Error_log, __FUNCTION__, "Call SkyEye_GetCpuExceptionNum iface failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call SkyEye_GetCpuExceptionNum iface failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -2836,7 +3024,8 @@ SkyEyeAPIRetST skyeye_set_cpu_exception(char *cpu_name, int exception_id) if (No_exp != SkyEye_SetCpuException(cpu_name, exception_id)) { - skyeye_log(Error_log, __FUNCTION__, "Call SkyEye_SetCpuException iface failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call SkyEye_SetCpuException iface failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -2853,7 +3042,8 @@ SkyEyeAPIRetST skyeye_set_ext_interrupt(char *intc_name, int interrupt_num) if (No_exp != SkyEye_SetExtInterrupt(intc_name, interrupt_num)) { - skyeye_log(Error_log, __FUNCTION__, "Call SkyEye_SetExtInterrupt iface failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call SkyEye_SetExtInterrupt iface failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -2881,7 +3071,7 @@ SkyEyeAPIRetST skyeye_get_cpu_exception_name_by_id(char *cpu_name, int exception /* *15.SkyEye使能和禁用设备API接口 -*/ + */ SkyEyeAPIRetST skyeye_disable_device_work(char *device_name) { @@ -2891,7 +3081,8 @@ SkyEyeAPIRetST skyeye_disable_device_work(char *device_name) if (0 == WIN_disable_device_work(device_name)) { - skyeye_log(Error_log, __FUNCTION__, "Call WIN_disable_device_work iface failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call WIN_disable_device_work iface failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -2908,7 +3099,8 @@ SkyEyeAPIRetST skyeye_enable_device_work(char *device_name) if (0 == WIN_enable_device_work(device_name)) { - skyeye_log(Error_log, __FUNCTION__, "Call WIN_enable_device_work iface failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call WIN_enable_device_work iface failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -2918,7 +3110,7 @@ SkyEyeAPIRetST skyeye_enable_device_work(char *device_name) /* *16.设置和获取CPU PC API接口 -*/ + */ SkyEyeAPIRetST skyeye_set_pc(char *cpu_name, unsigned int pc) { @@ -2928,7 +3120,8 @@ SkyEyeAPIRetST skyeye_set_pc(char *cpu_name, unsigned int pc) if (0xffffffff == WIN_setPC(cpu_name, pc)) { - skyeye_log(Error_log, __FUNCTION__, "Call WIN_setPC iface failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call WIN_setPC iface failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -2945,7 +3138,8 @@ SkyEyeAPIRetST skyeye_get_pc(char *cpu_name) if (0xffffffff == ApiRet.retIntValue) { - skyeye_log(Error_log, __FUNCTION__, "Call WIN_getPC iface failed!\n"); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Call WIN_getPC iface failed!\n"); ApiRet.result = API_ERROR; return ApiRet; } @@ -2968,12 +3162,13 @@ SkyEyeAPIRetST skyeye_enable_debug(char *soc_name) memset(&ApiRet, 0, sizeof(SkyEyeAPIRetST)); if (soc == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can't get %s object\n", soc_name); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can't get %s object\n", soc_name); ApiRet.result = API_ERROR; return ApiRet; } - sys_soc_t * sys_soc = (sys_soc_t *)soc->sys_struct; + sys_soc_t *sys_soc = (sys_soc_t *)soc->sys_struct; for (i = 0; i < sys_soc->cpu_cnt; i++) { sys_cpu = &(sys_soc->cpus[i]); @@ -3022,7 +3217,8 @@ SkyEyeAPIRetST skyeye_term_wait_for_string(char *termname, const char *string) if (term == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can not get %s object.", termname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can not get %s object.", termname); ApiRet.result = API_ERROR; return ApiRet; } @@ -3030,7 +3226,8 @@ SkyEyeAPIRetST skyeye_term_wait_for_string(char *termname, const char *string) if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can not get %s interface from %s", SKYEYE_UART_INTF, term->objname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can not get %s interface from %s", SKYEYE_UART_INTF, term->objname); ApiRet.result = API_ERROR; return ApiRet; } @@ -3051,7 +3248,8 @@ SkyEyeAPIRetST skyeye_term_write(char *termname, const char *string) if (term == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can not get %s object.", termname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can not get %s object.", termname); ApiRet.result = API_ERROR; return ApiRet; } @@ -3059,7 +3257,8 @@ SkyEyeAPIRetST skyeye_term_write(char *termname, const char *string) if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can not get %s interface from %s", SKYEYE_UART_INTF, term->objname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can not get %s interface from %s", SKYEYE_UART_INTF, term->objname); ApiRet.result = API_ERROR; return ApiRet; } @@ -3079,7 +3278,8 @@ SkyEyeAPIRetST skyeye_term_wait_then_write(char *termname, const char *wait_stri if (term == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can not get %s object.", termname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can not get %s object.", termname); ApiRet.result = API_ERROR; return ApiRet; } @@ -3087,7 +3287,8 @@ SkyEyeAPIRetST skyeye_term_wait_then_write(char *termname, const char *wait_stri if (iface == NULL) { - skyeye_log(Error_log, __FUNCTION__, "Can not get %s interface from %s", SKYEYE_UART_INTF, term->objname); + output_msg(Error_log, 0xffffffff, ApiRet.errMsg, OUTPUT_2_LOG_PY, + "Can not get %s interface from %s", SKYEYE_UART_INTF, term->objname); ApiRet.result = API_ERROR; return ApiRet; } diff --git a/common/ctrl/sim_ctrl.c b/common/ctrl/sim_ctrl.c index f9eaa04da7f6095c7a76ddfc0748e6b3c83fc23a..422ccb90bff5c1db182d913d35a8f135c944a3fd 100644 --- a/common/ctrl/sim_ctrl.c +++ b/common/ctrl/sim_ctrl.c @@ -48,7 +48,6 @@ #include "skyeye_mach.h" #include "skyeye_internal.h" #include "skyeye_system.h" -#include "lic.h" #include "parse_symbol.h" #ifdef __WIN32__ #include @@ -332,7 +331,6 @@ void SIM_init() } if (pref->autoboot == True) { - license_verify(); char cmdstr[256] = { '\0' }; #ifdef __WIN32__ char lib_path[1024] = { '\0' }; @@ -350,12 +348,10 @@ void SIM_init() } if (pref->autotest == True) { - license_verify(); RunAutotest(); } if (pref->autoload == True) { - license_verify(); char cmdstr[256] = { '\0' }; #ifdef __WIN32__ char lib_path[1024] = { '\0' }; diff --git a/common/ctrl/thread_ctrl.c b/common/ctrl/thread_ctrl.c index fd1b85620bb0e70044926b34b2f4897495013b73..a199a7f4e548e4b01d988897206d5e12ea85c438 100644 --- a/common/ctrl/thread_ctrl.c +++ b/common/ctrl/thread_ctrl.c @@ -300,7 +300,7 @@ void start_all_thread() { int i; - skyeye_log(Debug_log, __FUNCTION__, "SkyEye is running\n"); + //skyeye_log(Debug_log, __FUNCTION__, "SkyEye is running\n"); for (i = 0; i < MAX_THREAD_NUMBER; i++) { /* @@ -318,7 +318,7 @@ void start_all_thread() */ void stop_all_thread() { - skyeye_log(Debug_log, __FUNCTION__, "SkyEye is stoped\n"); + //skyeye_log(Debug_log, __FUNCTION__, "SkyEye is stoped\n"); int i; for (i = 0; i < MAX_THREAD_NUMBER; i++) diff --git a/common/include/lic.h b/common/include/lic.h deleted file mode 100644 index 63e0863e3fcc2178902dcfcd3a501725f3a71bcd..0000000000000000000000000000000000000000 --- a/common/include/lic.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __LIC_H__ -#define __LIC_H__ -#include -#include -extern char allow_cpu_list[2048]; -extern int verify_status; -int local_lic_validation(char* file); -int network_lic_validation(char* ip, int port); -int license_verify(); -int check_cpu(char* cpuname); -const char* read_lic_info(char* filename); -const char* get_cpuid(); -void close_network_lic(); -int dog_lic_validation(); -const bool_t check_usb_lic_connect(); -#endif - diff --git a/common/lic/lic_dog.c b/common/lic/lic_dog.c deleted file mode 100644 index 589b4df33460633f4ac5bc115f504111edf0ce64..0000000000000000000000000000000000000000 --- a/common/lic/lic_dog.c +++ /dev/null @@ -1,159 +0,0 @@ -#include -#include -#include -#ifdef __MINGW32__ -#include -#else -#include -#endif -#include -#include "lic.h" -#include "skyeye_internal.h" -#include "dog_api.h" -#include "dog_vcode.h" - -/*surper dog code */ -#define CUSTOM_FEATURE 1022 -#define CUSTOM_FILEID 1 //DOG_FILEID_RW -#define DEMO_MEMBUFFER_SIZE 128 - -#define NO_DLL_ERROR 17 -#define DOG_LOGIN_OK 18 -#define DOG_NOT_FOUND_ERROR 19 -#define DOG_FEATURE_NOT_FOUND_ERROR 20 -#define DOG_INV_VCODE_ERROR 21 -#define DOG_LOCAL_API_ERROR 22 -#define DOG_FEATURE_EXPIRED_ERROR 23 -#define DOG_FEATURE_ERROR 24 -#define Read_Data_Failed_ERROR 25 - -char Lincense_Data_Buff[DEMO_MEMBUFFER_SIZE]; - -int dog_lic_validation() -{ -#ifndef __MINGW32__ - return 3; -#else - int ret = 0; - int i = 0; - char surper_dog_dlldir[512] = { 0 }; - char *skyeye_bin = get_bin_env_path("BIN"); - dog_status_t status; - dog_handle_t handle; - dog_size_t fsize; - - /*surper dog code */ - strcpy(surper_dog_dlldir, skyeye_bin); - strcat(surper_dog_dlldir, "\\..\\..\\..\\third_party\\dog_windows_3159223.dll"); - if ((access(surper_dog_dlldir, F_OK)) == -1) - { - skyeye_log(Error_log, __FUNCTION__, "The file %s has not been found!\n", surper_dog_dlldir); - return NO_DLL_ERROR; - } - HMODULE surper_dog_dll = LoadLibrary(surper_dog_dlldir); - - Dog_Login_t Dog_Login = (Dog_Login_t) GetProcAddress(surper_dog_dll, "dog_login"); - Dog_Logout_t Dog_Logout = (Dog_Logout_t) GetProcAddress(surper_dog_dll, "dog_logout"); - Dog_Read_t Dog_Read = (Dog_Read_t) GetProcAddress(surper_dog_dll, "dog_read"); - Dog_Get_Size_t Dog_Get_Size = (Dog_Get_Size_t) GetProcAddress(surper_dog_dll, "dog_get_size"); - - status = Dog_Login(CUSTOM_FEATURE, (dog_vendor_code_t *) vendor_code, &handle); - switch (status) - { - case DOG_STATUS_OK: - skyeye_log(Info_log, __FUNCTION__, "Surper Dog Login Success!\n"); - break; - case DOG_FEATURE_NOT_FOUND: - skyeye_log(Error_log, __FUNCTION__, "login to default feature failed\n"); - ret = DOG_FEATURE_NOT_FOUND_ERROR; - break; - case DOG_NOT_FOUND: - skyeye_log(Error_log, __FUNCTION__, "no SuperDog with vendor code DEMOMA found\n"); - ret = DOG_NOT_FOUND_ERROR; - break; - case DOG_INV_VCODE: - skyeye_log(Error_log, __FUNCTION__, "invalid vendor code\n"); - ret = DOG_INV_VCODE_ERROR; - break; - case DOG_LOCAL_COMM_ERR: - skyeye_log(Error_log, __FUNCTION__, "communication error between API and local SuperDog License Manager\n"); - ret = DOG_LOCAL_API_ERROR; - break; - case DOG_FEATURE_EXPIRED: - skyeye_log(Error_log, __FUNCTION__, "feature can't be used\n"); - ret = DOG_FEATURE_EXPIRED_ERROR; - break; - default: - skyeye_log(Error_log, __FUNCTION__, "login to default feature failed with status error\n"); - ret = DOG_FEATURE_ERROR; - break; - } - if (status) - { - return ret; - } - Dog_Get_Size(handle, CUSTOM_FILEID, &fsize); - status = Dog_Read(handle, CUSTOM_FILEID, 0, fsize, &Lincense_Data_Buff[0]); - - if (status) - { - skyeye_log(Error_log, __FUNCTION__, "Surper Dog License Data Error!\n"); - return Read_Data_Failed_ERROR; - } else - { - strcpy(allow_cpu_list, (const char *) Lincense_Data_Buff); - skyeye_log(Info_log, __FUNCTION__, "Surper Dog License Data Success!\n"); - return DOG_LOGIN_OK; - } -#endif -} - -const bool_t check_usb_lic_connect() -{ -#ifndef __MINGW32__ - return False; -#else - char surper_dog_dlldir[512] = { 0 }; - char *skyeye_bin = get_bin_env_path("BIN"); - dog_status_t status; - dog_handle_t handle; - - /*surper dog code */ - strcpy(surper_dog_dlldir, skyeye_bin); - strcat(surper_dog_dlldir, "\\..\\..\\..\\third_party\\dog_windows_3159223.dll"); - if ((access(surper_dog_dlldir, F_OK)) == -1) - { - skyeye_log(Error_log, __FUNCTION__, "The file %s has not been found!\n", surper_dog_dlldir); - return False; - } - HMODULE surper_dog_dll = LoadLibrary(surper_dog_dlldir); - - Dog_Login_t Dog_Login = (Dog_Login_t) GetProcAddress(surper_dog_dll, "dog_login"); - Dog_Logout_t Dog_Logout = (Dog_Logout_t) GetProcAddress(surper_dog_dll, "dog_logout"); - Dog_Read_t Dog_Read = (Dog_Read_t) GetProcAddress(surper_dog_dll, "dog_read"); - Dog_Get_Size_t Dog_Get_Size = (Dog_Get_Size_t) GetProcAddress(surper_dog_dll, "dog_get_size"); - - status = Dog_Login(CUSTOM_FEATURE, (dog_vendor_code_t *) vendor_code, &handle); - /* - * if(status == DOG_STATUS_OK) - * { - * //printf("surper dog link success!\n"); - * return true; - * } else - * { - * //printf("surper dog link error!\n"); - * return false; - * } - */ - if (status == DOG_NOT_FOUND) - { - //printf("surper dog link error!\n"); - return False; - } else - { - //printf("surper dog link success!\n"); - return True; - } - -#endif -} diff --git a/common/lic/lic_local.c b/common/lic/lic_local.c deleted file mode 100644 index a356d8ad16a6ce58a65a246994daa5dd39c0eccc..0000000000000000000000000000000000000000 --- a/common/lic/lic_local.c +++ /dev/null @@ -1,70 +0,0 @@ -#include -#include -#include -#include "lic.h" -#include "skyeye_internal.h" -#ifdef __WIN32__ -#include "rsa_lic.h" -#endif - -int local_lic_validation(char *filename) -{ -#ifndef __MINGW32__ - return 3; -#else - int ret = 0; - ret = licensecmp(filename); - switch (ret) - { - case 1: - skyeye_log(Error_log, __FUNCTION__, "Outside the scope of the allowed time\n"); - return 1; - case 2: - skyeye_log(Error_log, __FUNCTION__, "Outside the scope of the allowed MAC addresses\n"); - return 2; - case 3: - strcpy(allow_cpu_list, (const char *) get_cpu_list()); - return 3; - case 4: - skyeye_log(Error_log, __FUNCTION__, "Could not find the Key\n"); - return 4; - case 5: - skyeye_log(Error_log, __FUNCTION__, "Could not find the license\n"); - return 5; - case 26: - skyeye_log(Error_log, __FUNCTION__, "Invalid license file with incorrect length\n"); - return 26; - case 27: - skyeye_log(Error_log, __FUNCTION__, "License file does not match key\n"); - return 27; - case 28: - skyeye_log(Error_log, __FUNCTION__, "CPU information does not match\n"); - return 28; - default: - return ret; - } -#endif -} -const char *read_lic_info(char *filename) -{ -#ifndef __MINGW32__ - return NULL; -#else - const char *ret; - ret = read_license_info(filename); - return ret; -#endif -} - -const char *get_cpuid() -{ -#ifndef __MINGW32__ - return NULL; -#else - const char *ret; - - ret = get_cpuid_info(); - - return ret; -#endif -} diff --git a/common/lic/lic_network.c b/common/lic/lic_network.c deleted file mode 100644 index 00df21ea6b964734cab8a7964fe4c02a41bd399a..0000000000000000000000000000000000000000 --- a/common/lic/lic_network.c +++ /dev/null @@ -1,221 +0,0 @@ - -#include - -#include -#include -#include "lic.h" -#include "skyeye_internal.h" -#ifdef __WIN32__ -#include -#include -SOCKET sclient = -1; -#endif - -#define true 1; -#define false 0; - -char *old_ip = NULL; -int old_port = 0; - -int check_data(char *des) -{ - if (des[0] == '#' && des[4] == '@' && des[strlen(des) - 1] == '$') - return true; - return false; -} - -#ifdef __WIN32__ -int *thread(void *arg) -{ - pthread_t newthid; - - newthid = pthread_self(); - char temp[10] = { 0 }; - int nNetTimeout = 2000; - char recData[2048] = { 0 }; - setsockopt(arg, SOL_SOCKET, (int) recData, (char *) &nNetTimeout, sizeof (int)); - while (1) - { - memset(recData, 0, sizeof (recData)); - int ret = recv(arg, recData, 2048, 0); - - if (ret <= 0) - { - memset(allow_cpu_list, 0, strlen(allow_cpu_list)); - printf("The server lost connection!\n"); - skyeye_log(Error_log, __FUNCTION__, "The server lost connection\n"); - verify_status = 0; - return false; - } else - { - if (check_data(recData)) - { - strncpy(temp, recData + 1, 3); - if (strcmp(temp, "030") == 0) - { - memset(allow_cpu_list, 0, strlen(allow_cpu_list)); - printf("Server down\n"); - skyeye_log(Error_log, __FUNCTION__, "Server down\n"); - verify_status = 0; - return false; - } else if (strcmp(temp, "040") == 0) - { - send(arg, recData, strlen(recData), 0); - continue; - } - } - } - } -} - -void connect_failed(char *info, SOCKET client) -{ - printf(info); - skyeye_log(Error_log, __FUNCTION__, info); - verify_status = 0; - if (client != NULL) - { - closesocket(client); - } -} -#endif - -void close_network_lic() -{ -#ifdef __WIN32__ - if (sclient != -1) - { - char *sendData = "quit"; - - send(sclient, sendData, strlen(sendData), 0); - free(old_ip); - } -#endif -} - -int network_lic_validation(char *ip, int port) -{ -#ifndef __WIN32__ - return 3; -#else - int i; - - if (verify_status == 1 && strcmp(ip, old_ip) == 0 && old_port == port) - { - return 3; - } - old_ip = (char *) calloc(strlen(ip), sizeof (char)); - strcpy(old_ip, ip); - old_port = port; - WORD sockVersion = MAKEWORD(2, 2); - WSADATA data; - - if (WSAStartup(sockVersion, &data) != 0) - { - connect_failed("Execute the WSAStartup fail\n", NULL); - return 10; - } - - sclient = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - if (sclient == INVALID_SOCKET) - { - connect_failed("Create socket error!\n", NULL); - return 11; - } - unsigned long on = 1; - - if (ioctlsocket(sclient, FIONBIO, &on) < 0) - { - connect_failed("ioctlsocket failed\n", NULL); - return 12; - } - struct sockaddr_in serAddr; - - serAddr.sin_family = AF_INET; - serAddr.sin_port = htons(port); - serAddr.sin_addr.S_un.S_addr = inet_addr(ip); - int ret = connect(sclient, (SOCKADDR *) & serAddr, sizeof (SOCKADDR)); - - if (ret < 0 && WSAGetLastError() != WSAEWOULDBLOCK) - { - WSACleanup(); - connect_failed("Connection failed!\n", sclient); - return 12; - } - fd_set writeset; - - FD_ZERO(&writeset); - FD_SET(sclient, &writeset); - struct timeval tv; - - tv.tv_sec = 3; - tv.tv_usec = 0; - ret = select(sclient + 1, NULL, &writeset, NULL, &tv); - if (ret == 0) - { - WSACleanup(); - connect_failed("Connection timeout!\n", sclient); - return 12; - } else if (ret < 0) - { - WSACleanup(); - connect_failed("Connection failed!\n", sclient); - return 12; - } else - { - //printf("connect success2\n"); - } - unsigned long off = 0; - - if (ioctlsocket(sclient, FIONBIO, &off) < 0) - { - connect_failed("ioctlsocket failed!\n", sclient); - return 12; - } - char *sendData = "can"; - - send(sclient, sendData, strlen(sendData), 0); - - char recData[2048] = { 0 }; - char temp[10] = { 0 }; - ret = recv(sclient, recData, 2048, 0); - if (ret > 0) - { - if (check_data(recData)) - { - strncpy(temp, recData + 1, 3); - if (strcmp(temp, "010") == 0) - { - for (i = 0; i < (ret - 6) / 2; i++) - { - memset(temp, 0, sizeof (temp)); - strncpy(temp, recData + 5 + i * 2, 2); - sscanf(temp, "%x", &allow_cpu_list[i]); - } - } else if (strcmp(temp, "020") == 0) - { - WSACleanup(); - connect_failed("Link exceeds maximum connectable number!\n", sclient); - return 13; - } - } - } else - { - WSACleanup(); - connect_failed("Return information is empty!\n", sclient); - return 14; - } - ret = 0; - pthread_t thid; - - ret = pthread_create(&thid, NULL, (void *) thread, sclient); - if (ret != 0) - { - connect_failed("The heartbeat thread creation failed!", NULL); - return 15; - } - verify_status = 1; - return 3; -#endif - -} diff --git a/common/lic/verify.c b/common/lic/verify.c deleted file mode 100644 index 15513bb173a98257f8e265f668414dff42466d09..0000000000000000000000000000000000000000 --- a/common/lic/verify.c +++ /dev/null @@ -1,69 +0,0 @@ -#include -#include -#include -#include "lic.h" -#include "skyeye_internal.h" - -char allow_cpu_list[2048]; -int verify_status = 0; - -void split(char **arr, char *str, const char *del) -{ - char *s = strtok(str, del); - - while (s != NULL) - { - *arr++ = s; - s = strtok(NULL, del); - } -} -int check_cpu(char *cpuname) -{ - if (strstr(allow_cpu_list, "ALL") != NULL || strstr(allow_cpu_list, cpuname) != NULL) - return 1; - else - return 0; -} - -int license_verify() -{ - char conf_dir[512] = { 0 }; - FILE *fp; - char buffer[512] = { 0 }; - char *arr[3]; - char *skyeye_bin = get_bin_env_path("BIN"); - char temp[2][128] = { 0 }; - int i, ret = 0; - -#ifndef __WIN32__ - return 3; -#else - strcpy(conf_dir, skyeye_bin); - strcat(conf_dir, "\\..\\..\\..\\info\\license\\lic_conf.dat"); - if ((access(conf_dir, 0)) == -1) - { - printf("The license configuration file was not found\n"); - skyeye_log(Error_log, __FUNCTION__, "The license configuration file was not found\n"); - return 8; - } - fp = fopen(conf_dir, "r"); - fread(buffer, 512, 1, fp); - fclose(fp); - split(arr, buffer, "\n"); - if (strstr(arr[0], "network") != NULL) - { - for (i = 1; i < 3; i++) - sscanf(arr[i], "%*[^:]:%s", temp[i - 1]); - ret = network_lic_validation(temp[0], atoi(temp[1])); - - } else if (strstr(arr[0], "local") != NULL) - { - sscanf(arr[1], "%*[^:]:%s", temp[0]); - ret = local_lic_validation(temp[0]); - } else - { - ret = dog_lic_validation(); - } - return ret; -#endif -} diff --git a/utils/pycli/skyeye_cli.py b/utils/pycli/skyeye_cli.py index b9d3b6b0c6dc48e3ecb620249146ed3d8a5477c9..07e6df42e48c7a3397d080e4ef77bbf8ef7c0c22 100755 --- a/utils/pycli/skyeye_cli.py +++ b/utils/pycli/skyeye_cli.py @@ -20,9 +20,6 @@ import pytimer import functools import operator import fault_inject as sfi -import skyeye_license as se_lic -import coverage -import network_control as NetCtrl import readline import argparse @@ -55,10 +52,6 @@ class SkyEyeCli(cmd.Cmd): cmd.Cmd.__init__(self) self.args_list = args welcome_message() - ret=se_lic.license_verify() - if ret[0]==False: - print (ret[1]) - #exit() # log=output_log() # se.log=log self.open_conf_flag = False @@ -1024,13 +1017,9 @@ class SkyEyeCli(cmd.Cmd): ns = parser.parse_args(arg.split()) except: return - self.postloop() - if mips.mips_thread != None: mips.mips_thread.stop() - coverage.kill_objdump_thread() - NetCtrl.server_stop() try: SkyEyeQuit() except Exception as e: diff --git a/utils/pycli/skyeye_common_module.py b/utils/pycli/skyeye_common_module.py index 1e561ff88993d3f5e9dbbf767032fe6161e74c4d..bba308c862640a2d6af28fdb886b19ed8ad0dc04 100644 --- a/utils/pycli/skyeye_common_module.py +++ b/utils/pycli/skyeye_common_module.py @@ -1059,25 +1059,6 @@ def SkyEyeSetX86Slow(cpu, isLow): libcommon.slow_x86(cpu.encode("utf-8"), isLow) return [True, True, None] -@swtich_try -def SkyEyeLicenseVerify(): - libcommon.skyeye_license_verify.restype = skyeye_api_result - ret = libcommon.skyeye_license_verify() - return [ret.result, ret.retIntValue, ret.errMsg] - -@swtich_try -def SkyEyeReadLicenseInfo(filename): - libcommon.skyeye_read_license_info.restype = skyeye_api_result - libcommon.skyeye_read_license_info.argtypes = [c_char_p] - ret = libcommon.skyeye_read_license_info(filename.encode("utf-8")) - return [ret.result, ret.retStrValue, ret.errMsg] - -@swtich_try -def SkyEyeGetCpuId(): - libcommon.skyeye_get_cpuid.restype = skyeye_api_result - ret = libcommon.skyeye_get_cpuid() - return [ret.result, ret.retStrValue, ret.errMsg] - @swtich_try def SkyEyeCheckUsbLicConnect(): libcommon.skyeye_check_usbKey_connect.restype = skyeye_api_result diff --git a/utils/pycli/skyeye_gui.py b/utils/pycli/skyeye_gui.py index be7b987e6d0aba077078d5d3b9d6d613424105cf..94b29eeb88ad84388b21b9b328bf612236a88d3d 100644 --- a/utils/pycli/skyeye_gui.py +++ b/utils/pycli/skyeye_gui.py @@ -39,7 +39,6 @@ import errormessage import conf as se_conf import custom_dialog as CDialog import win_workspace as WS -import skyeye_license as se_lic import network_control as NetCtrl from sky_log import * @@ -1205,11 +1204,6 @@ class SkyEyeGUI(wx.App): wx.App.__init__(self,redirect=False) def OnInit(self): #self.locale = wx.Locale(wx.LANGUAGE_CHINESE_SIMPLIFIED) - ret = CheckKEY() - if ret == False: - return False - else: - pass init_gui_log_view() self.frame = MainFrame(parent = None) self.frame.Show() @@ -1224,15 +1218,6 @@ class SkyEyeGUI(wx.App): pass return True -def CheckKEY(): - ret = se_lic.license_verify() - if ret[0] == False: - lic = lic_gui.LicDialog() - lic.ShowModal() - ret = se_lic.license_verify() - if ret[0] == False: - return False - return True def Main(): global AppRestart diff --git a/utils/pycli/skyeye_gui_about.py b/utils/pycli/skyeye_gui_about.py index b26d171959f478f8c73a0a936e110a25c150ddd0..c770593ce413b3ca61e6436a51a94689e3c80f63 100644 --- a/utils/pycli/skyeye_gui_about.py +++ b/utils/pycli/skyeye_gui_about.py @@ -3,7 +3,6 @@ import wx, sys, os from skyeye_common_module import * import se_path import tools -import skyeye_license as se_lic fname = 'Segoe UI' @@ -111,12 +110,7 @@ class main_panel(wx.Panel): sizer.Add(static_sizer2, 1, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT|wx.BOTTOM, 10) self.SetSizer(sizer) self.Fit() - ######################################## - lic_data=se_lic.gui_get_license_info() - LicMode=lic_data.get_license_mode() - LicTime=lic_data.get_license_time() - LicCpus=lic_data.get_license_cpus() - + ######################################## package_config = tools.GetPackageConfig() diff --git a/utils/pycli/skyeye_gui_lic.py b/utils/pycli/skyeye_gui_lic.py deleted file mode 100644 index 6245898c0c0932aae430f9c4851ac6a2c8ed6f79..0000000000000000000000000000000000000000 --- a/utils/pycli/skyeye_gui_lic.py +++ /dev/null @@ -1,306 +0,0 @@ -#coding:utf-8 -import wx -import os,re,time -import skyeye_license as se_lic -import se_path -import threading -import _thread - -class local_lic(wx.Panel): - def __init__(self,parent): - wx.Panel.__init__(self,parent.note) - self.parent=parent - self.show_flag = False - self.local_box=wx.BoxSizer(wx.VERTICAL) - mac_temp = wx.BoxSizer(wx.HORIZONTAL) - mac_tit = wx.StaticText(self,-1,"网卡") - self.mac_choice = wx.Choice(self,-1) - self.mac_choice.Enable(False) - self.mac_choice.SetMinSize((100,25)) - self.Bind(wx.EVT_CHOICE,self.select_mac,self.mac_choice) - mac_temp.Add(mac_tit,0,wx.ALL|wx.EXPAND,3) - mac_temp.Add(self.mac_choice,1,wx.ALL|wx.EXPAND,0) - - self.file_tc=wx.TextCtrl(self,-1,size=(420,25),style=wx.TE_RICH2 | wx.TE_MULTILINE | wx.TE_READONLY) - self.img_box = wx.BoxSizer(wx.HORIZONTAL) - self.show_image() - but_box=wx.BoxSizer(wx.HORIZONTAL) - imp_but=wx.Button(self,-1,"导入License文件") - self.reg_but=wx.Button(self,-1,"注册") - cancel_but=wx.Button(self,-1,"取消") - self.reg_but.Enable(0) - self.Bind(wx.EVT_BUTTON,self.import_lic_file,imp_but) - self.Bind(wx.EVT_BUTTON,self.register_lic,self.reg_but) - self.Bind(wx.EVT_BUTTON,parent.OnCloseWindow,cancel_but) - but_box.Add((0,0),1,wx.ALL|wx.EXPAND,5) - but_box.Add(imp_but,0,wx.ALL|wx.EXPAND,5) - but_box.Add(self.reg_but,0,wx.ALL|wx.EXPAND,5) - but_box.Add(cancel_but,0,wx.ALL|wx.EXPAND,5) - - self.local_box.Add(mac_temp,1,wx.ALL|wx.EXPAND,5) - self.local_box.Add(self.file_tc,1,wx.ALL|wx.EXPAND,5) - self.local_box.Add(self.img_box,0,wx.ALL|wx.EXPAND,0) - self.local_box.Add(but_box,0,wx.ALL|wx.EXPAND,5) - self.SetSizer(self.local_box) - self.Fit() - self.mac_list = [] - self.licfile=None - - def select_mac(self,evt): - index = self.mac_choice.GetCurrentSelection() - hardware_info = se_lic.get_hardware_info(self.mac_list[index][1]) - if hardware_info[0] == False: - message_dialog(hardware_info[1]) - return - self.refresh_image(hardware_info[1],hardware_info[2]) - - def refresh_image(self,cipher,image): - if self.show_flag == False or \ - self.parent.close == True: - return - self.file_tc.SetValue(cipher) - img=wx.Image(image,wx.BITMAP_TYPE_ANY) - img=img.Scale(150,150).ConvertToBitmap() - self.lic_img.SetBitmap(img) - self.img_box.Layout() - - def get_system_info(self): - self.mac_list = se_lic.get_mac_info() - self.mac_choice.SetItems([mac[0] for mac in self.mac_list]) - self.mac_choice.SetSelection(0) - self.mac_choice.Enable(True) - hardware_info = se_lic.get_hardware_info() - if hardware_info[0] == False: - message_dialog(hardware_info[1]) - return - self.refresh_image(hardware_info[1],hardware_info[2]) - - def show_image(self): - if self.show_flag == True: - return - self.file_tc.SetValue("获取中请稍后...") - img_path = se_path.GetPicPath("getting.png") - img=wx.Image(img_path,wx.BITMAP_TYPE_ANY) - img=img.Scale(150,150).ConvertToBitmap() - self.lic_img=wx.StaticBitmap(self,-1,img) - self.img_box.Add(self.lic_img,1,wx.ALL|wx.EXPAND,0) - self.img_box.Layout() - self.local_box.Layout() - _thread.start_new_thread(self.get_system_info, () ) - self.show_flag = True - - def hide_image(self): - if self.show_flag == False: - return - self.img_box.Hide(0) - self.img_box.Remove(0) - self.img_box.Layout() - self.local_box.Layout() - self.show_flag = False - - def display_license(self,filename): - try: - ret=se_lic.read_license_info(filename) - except: - ret=None - if ret==None: - message_dialog("无效的License文件") - self.reg_but.Enable(0) - return False - else: - data="" - for i in ["start","end","cpu_list"]: - data=data+("%s:\n\t%s\n\n"%(i.upper(),ret[i].replace(":","\n\t"))) - self.hide_image() - self.file_tc.SetValue(data) - self.reg_but.Enable(1) - - def import_lic_file(self,evt): - dialog = wx.FileDialog(None, "License文件导入", "c:\\","", "license file(*.lic)|*.lic", wx.FD_OPEN) - if dialog.ShowModal() == wx.ID_OK: - self.licfile = dialog.GetPath() - self.display_license(self.licfile) - - def register_lic(self,evt): - se_lic.set_local_license(self.licfile) - try: - ret=se_lic.license_verify() - except: - ret=(False,"license verify call error") - if ret[0]==False: - message_dialog(ret[1]) - se_lic.clear_license_config() - self.show_image() - self.reg_but.Enable(0) - return False - else: - message_dialog(ret[1]) - self.parent.OnCloseWindow(1) - -class network_lic(wx.Panel): - def __init__(self,parent): - wx.Panel.__init__(self,parent.note) - self.parent=parent - net_box=wx.BoxSizer(wx.VERTICAL) - ip_box=wx.BoxSizer(wx.HORIZONTAL) - ip_t=wx.StaticText(self,-1,"IP ") - self.ip_tc=wx.TextCtrl(self,-1) - ip_box.Add(ip_t,0,wx.ALL|wx.EXPAND,8) - ip_box.Add(self.ip_tc,1,wx.ALL|wx.EXPAND,5) - - port_box=wx.BoxSizer(wx.HORIZONTAL) - port_t=wx.StaticText(self,-1,"Port") - self.port_tc=wx.TextCtrl(self,-1) - port_box.Add(port_t,0,wx.ALL|wx.EXPAND,8) - port_box.Add(self.port_tc,1,wx.ALL|wx.EXPAND,5) - - ctrl_box=wx.BoxSizer(wx.HORIZONTAL) - link_but=wx.Button(self,-1,"连接") - cancel_but=wx.Button(self,-1,"取消") - self.Bind(wx.EVT_BUTTON,self.link_server,link_but) - self.Bind(wx.EVT_BUTTON,parent.OnCloseWindow,cancel_but) - ctrl_box.Add((0,0),1,wx.ALL|wx.EXPAND,5) - ctrl_box.Add(link_but,0,wx.ALL|wx.EXPAND,5) - ctrl_box.Add(cancel_but,0,wx.ALL|wx.EXPAND,5) - - net_box.Add(ip_box,0,wx.ALL|wx.EXPAND,5) - net_box.Add(port_box,0,wx.ALL|wx.EXPAND,5) - net_box.Add((0,0),1,wx.ALL|wx.EXPAND,5) - net_box.Add(ctrl_box,0,wx.ALL|wx.EXPAND,5) - self.SetSizer(net_box) - self.Fit() - - def link_server(self,evt): - ip=self.ip_tc.GetValue() - port=self.port_tc.GetValue() - if self.check_data(ip,port): - se_lic.set_network_license(ip,port) - try: - ret=se_lic.license_verify() - except: - ret=(False,"license verify call error") - if ret[0]==False: - message_dialog(ret[1]) - se_lic.clear_license_config() - return False - else: - message_dialog(ret[1]) - self.parent.OnCloseWindow(1) - - else: - pass - - def check_data(self,ip,port): - flag=True - if not re.match(r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$", ip): - self.ip_tc.SetBackgroundColour("#FFC0CB") - flag=False - else: - self.ip_tc.SetBackgroundColour("#FFFFFF") - if port=="" or not port.isdigit() or int(port)>65535 or int(port)<0: - self.port_tc.SetBackgroundColour("#FFC0CB") - flag=False - else: - self.port_tc.SetBackgroundColour("#FFFFFF") - self.Refresh() - return flag - -class usb_check(threading.Thread): - def __init__(self, win): - threading.Thread.__init__(self) - self.setDaemon(True) - self.thread_stop = False - self.win = win - def run(self): - while self.thread_stop == False: - ret = se_lic.check_usb_connect() - wx.CallAfter(self.win.set_connect_status,ret) - time.sleep(0.5) - def stop(self): - self.thread_stop = True - -class dog_lic(wx.Panel): - def __init__(self,parent): - wx.Panel.__init__(self,parent.note) - self.parent = parent - dog_box = wx.BoxSizer(wx.VERTICAL) - insert_box = wx.BoxSizer(wx.HORIZONTAL) - inser_t = wx.StaticText(self,-1,"USB ID") - self.insert_tc = wx.TextCtrl(self,-1,"未连接",style = wx.TE_READONLY) - insert_box.Add(inser_t,0,wx.ALL|wx.EXPAND,8) - insert_box.Add(self.insert_tc,1,wx.ALL,5) - - ctrl_box = wx.BoxSizer(wx.HORIZONTAL) - verify_but = wx.Button(self,-1,"验证") - cancel_but = wx.Button(self,-1,"取消") - self.Bind(wx.EVT_BUTTON,self.verify_dog,verify_but) - self.Bind(wx.EVT_BUTTON,parent.OnCloseWindow,cancel_but) - ctrl_box.Add((0,0),1,wx.ALL|wx.EXPAND,5) - ctrl_box.Add(verify_but,0,wx.ALL|wx.EXPAND,5) - ctrl_box.Add(cancel_but,0,wx.ALL|wx.EXPAND,5) - - dog_box.Add(insert_box,1,wx.ALL|wx.EXPAND,5) - dog_box.Add(ctrl_box,0,wx.ALL|wx.EXPAND,5) - self.SetSizer(dog_box) - self.Fit() - - def set_connect_status(self,status): - if self.parent.close == True: - return - text = "未连接" - if status == True: - text = "已连接" - self.insert_tc.SetValue(text) - def verify_dog(self,evt): - se_lic.set_usb_license() - try: - ret = se_lic.license_verify() - except: - ret = (False,"license verify call error") - if ret[0] == False: - message_dialog(ret[1]) - return False - else: - message_dialog(ret[1]) - self.parent.OnCloseWindow(1) - -class LicDialog(wx.Dialog): - def __init__(self): - wx.Dialog.__init__(self,None,-1,"产品注册") - icon = wx.Icon(se_path.GetPicPath("lic.ico"), wx.BITMAP_TYPE_ICO) - self.SetIcon(icon) - self.main_panel=wx.Panel(self) - self.main_box=wx.BoxSizer(wx.HORIZONTAL) - self.note=wx.Notebook(self.main_panel) - self.local_lic_page=local_lic(self) - self.net_lic_page=network_lic(self) - self.dog_lic_page=dog_lic(self) - self.note.AddPage(self.local_lic_page,"本地License验证") - self.note.AddPage(self.net_lic_page,"网络License验证") - self.note.AddPage(self.dog_lic_page,"USBLicense验证") - - self.main_box.Add(self.note,1,wx.ALL|wx.EXPAND,10) - self.main_panel.SetSizer(self.main_box) - self.main_panel.Fit() - self.Fit() - - self.Bind(wx.EVT_CLOSE,self.OnCloseWindow) - self.uc = usb_check(self.dog_lic_page) - self.uc.start() - self.close = False - - def OnCloseWindow(self,evt): - self.close = True - self.uc.stop() - self.Destroy() - -def message_dialog(info): - dlg = wx.MessageDialog(None,info,"提示", wx.OK) - dlg.ShowModal() - dlg.Destroy() - -if __name__ == '__main__': - app = wx.PySimpleApp() - Regsdlg = LicDialog() - Regsdlg.Show() - app.MainLoop() diff --git a/utils/pycli/views.py b/utils/pycli/views.py index 4070f47ff972dcdd4452f51dee0845d46dff0740..56c8e64231db84ce5c1d1b2e59fce6dc54a60a42 100644 --- a/utils/pycli/views.py +++ b/utils/pycli/views.py @@ -16,7 +16,6 @@ import regs import mips import tools import net_api_func as naf -import skyeye_license as sky_lic def SE_get_workspace(request): error = None @@ -765,60 +764,6 @@ def SE_get_cpu_address_width(request): error = str(e) return response(request, result,error) -def SE_set_local_license(request): - result = 'false' - error = None - lic_path = request["args"]["path"] - try: - ret = sky_lic.set_local_license(lic_path) - if ret[0] == True: - result="true" - else: - error = ret[1] - except Exception as e: - error = str(e) - return response(request, result,error) - -def SE_set_network_license(request): - result='false' - error=None - ip = request["args"]["ip"] - port = request["args"]["port"] - try: - ret=sky_lic.set_network_license(ip,port) - if ret==True: - result="true" - except Exception as e: - error = str(e) - return response(request, result,error) - -def SE_read_license_info(request): - result='false' - error=None - lic_path = request["args"]["path"] - try: - ret=sky_lic.read_license_info(lic_path) - if ret!=None: - result=ret - else: - error = 'license 文件读取失败,可能产生此问题的原因:\n 1.文件名称或路径包含中文。\n 2.生成license文件的密钥不匹配。\n 3.无效的license文件。' - except Exception as e: - error = str(e) - return response(request, result,error) - -def SE_license_verify(request): - result='false' - error=None - try: - ret=sky_lic.license_verify() - if ret[0]==False: - error=ret[1] - else: - result="true" - except Exception as e: - error = str(e) - return response(request, result,error) - def SE_get_mac_list(request): result = 'false' error = None @@ -828,23 +773,6 @@ def SE_get_mac_list(request): error = str(e) return response(request, result,error) -def SE_get_hardware_info(request): - result = 'false' - error = None - try: - mac_addr = request["args"]["mac_addr"] - except: - mac_addr = None - try: - ret = sky_lic.get_hardware_info(mac_addr) - if ret[0] == False: - error = ret[1] - else: - result = ret[1:] - except Exception as e: - error = str(e) - return response(request, result,error) - def SE_get_simulation_run_time(request): result='false' error=None @@ -880,10 +808,6 @@ def SE_get_abort_gui_info(request): error = None try: ver_ret = naf.get_version_info() - lic_ret = sky_lic.gui_get_license_info() - if lic_ret != None: - result = ver_ret - result["lic_info"] = lic_ret.get_info() except Exception as e: error = str(e) return response(request, result,error) @@ -996,12 +920,7 @@ cmd_patterns = { "SE_get_cpu_register_info":SE_get_cpu_register_info, "SE_get_cpu_mips":SE_get_cpu_mips, "SE_get_cpu_address_width":SE_get_cpu_address_width, - "SE_set_local_license":SE_set_local_license, - "SE_set_network_license":SE_set_network_license, - "SE_read_license_info":SE_read_license_info, - "SE_license_verify":SE_license_verify, "SE_get_mac_list":SE_get_mac_list, - "SE_get_hardware_info":SE_get_hardware_info, "SE_get_simulation_run_time":SE_get_simulation_run_time, "SE_get_simulation_insn_number":SE_get_simulation_insn_number, "SE_get_binary_file_type":SE_get_binary_file_type,