86 lines
1.9 KiB
C
86 lines
1.9 KiB
C
#include <stddef.h>
|
|
#include <stdio.h>
|
|
|
|
/*
|
|
#include "common.h"
|
|
#include "cmds/help.h"
|
|
#include "cmds/scan.h"
|
|
#include "cmds/list_probes.h"
|
|
#include "cmds/exit.h"
|
|
#include "cmds/select_probe.h"
|
|
|
|
// Table des commandes internes
|
|
Command commands[] = {
|
|
{"help", cmd_help, NULL},
|
|
{"list_probes", cmd_list_probes, cmd_list_probes_help},
|
|
{"scan", cmd_scan, cmd_scan_help},
|
|
{"select_probe", cmd_select_probe, cmd_select_probe_help},
|
|
{"exit", cmd_exit, cmd_exit_help},
|
|
{NULL, NULL}};
|
|
*/
|
|
|
|
#include "jtag_core/jtag_core.h"
|
|
#include "config/version.h"
|
|
#include "script/env.h"
|
|
#include "script/script.h"
|
|
|
|
#include "config/config_script.h"
|
|
|
|
void jprint(jtag_core *jc, const char *msg)
|
|
{
|
|
printf(msg);
|
|
}
|
|
|
|
jtag_core *bsexp_init(void)
|
|
{
|
|
jtag_core *jc = NULL;
|
|
script_ctx *sctx;
|
|
|
|
/* initialize the JTAG library */
|
|
jc = jtagcore_init();
|
|
|
|
if (NULL == jc)
|
|
goto end;
|
|
|
|
jc->envvar = (void *)initEnv(NULL, NULL);
|
|
|
|
jtagcore_setEnvVar(jc, "VERSION", "v" LIB_JTAG_CORE_VERSION);
|
|
|
|
sctx = jtagcore_initScript(jc);
|
|
|
|
execute_ram_script(sctx, config_script, config_script_len);
|
|
|
|
execute_file_script(sctx, "config.script");
|
|
|
|
/* Log printing callback */
|
|
if (jtagcore_set_logs_callback(jc, jprint) < 0)
|
|
{
|
|
printf("Impossible to define the logs callback!\n");
|
|
}
|
|
else
|
|
{
|
|
if (jtagcore_getEnvVar(jc, "LOG_MESSAGES_FILTER_LEVEL", NULL))
|
|
{
|
|
jtagcore_set_logs_level(jc, jtagcore_getEnvVarValue(jc, "LOG_MESSAGES_FILTER_LEVEL"));
|
|
}
|
|
|
|
if (jtagcore_getEnvVar(jc, "LOG_MESSAGES_FILE_OUTPUT", NULL))
|
|
{
|
|
jtagcore_set_logs_file(jc, jtagcore_getEnvVar(jc, "LOG_MESSAGES_FILE_OUTPUT", NULL));
|
|
}
|
|
}
|
|
deinit_script(sctx);
|
|
|
|
end:
|
|
return jc;
|
|
}
|
|
|
|
void bsexp_deinit(jtag_core *jc)
|
|
{
|
|
if (NULL == jc) return;
|
|
|
|
envvar_entry *env = jc->envvar;
|
|
deinitEnv(env);
|
|
jtagcore_deinit(jc);
|
|
}
|