code refactoring
This commit is contained in:
21
bs/init.c
21
bs/init.c
@@ -20,15 +20,21 @@ Command commands[] = {
|
||||
*/
|
||||
|
||||
#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 * bsexp_init(void)
|
||||
{
|
||||
jtag_core *jc = NULL;
|
||||
script_ctx * sctx;
|
||||
|
||||
/* initialize the JTAG library */
|
||||
jc = jtagcore_init();
|
||||
@@ -37,13 +43,13 @@ jtag_core *bsexp_init(void)
|
||||
|
||||
jc->envvar = (void*)initEnv(NULL, NULL);
|
||||
|
||||
jtagcore_setEnvVar( jc, "VERSION", "v"jtag_core_VERSION);
|
||||
jtagcore_setEnvVar( jc, "VERSION", "v"LIB_JTAG_CORE_VERSION);
|
||||
|
||||
sctx = jtagcore_initScript(jc);
|
||||
|
||||
jtagcore_execScriptRam( sctx, config_script, config_script_len );
|
||||
execute_ram_script(sctx, config_script, config_script_len );
|
||||
|
||||
jtagcore_execScriptFile( sctx, "config.script" );
|
||||
execute_file_script( sctx, "config.script" );
|
||||
|
||||
/* Log printing callback */
|
||||
if (jtagcore_set_logs_callback(jc, jprint) < 0)
|
||||
@@ -56,6 +62,13 @@ jtag_core *bsexp_init(void)
|
||||
{
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user