compiles and works
This commit is contained in:
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@@ -5,13 +5,13 @@
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "bs list",
|
||||
"name": "bs",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build/bs/bs",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${fileDirname}",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
|
||||
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"*.cpt": "yaml",
|
||||
"*.seq": "yaml",
|
||||
"*.cpt": "yaml",
|
||||
"os_interface.h": "c",
|
||||
"bsdl_strings.h": "c",
|
||||
"script.h": "c",
|
||||
@@ -13,7 +13,9 @@
|
||||
"dlfcn.h": "c",
|
||||
"config_script.h": "c",
|
||||
"bs_defines.h": "c",
|
||||
"jtag_core.h": "c"
|
||||
"jtag_core.h": "c",
|
||||
"string.h": "c",
|
||||
"readline.h": "c"
|
||||
},
|
||||
"C_Cpp.default.includePath": [
|
||||
"libs/",
|
||||
|
||||
@@ -4,11 +4,13 @@ project(BoundaryScanExplorer)
|
||||
|
||||
# script and jtag_core must be the last linked archive for the application to compile
|
||||
set(BS_MODULES script jtag_core)
|
||||
set(DIR_MODULES ${CMAKE_SOURCE_DIR}/modules)
|
||||
set(DIR_LIBS ${CMAKE_SOURCE_DIR}/libs)
|
||||
|
||||
# We dive into submodules
|
||||
file(GLOB MODULES_DIRS RELATIVE ${CMAKE_SOURCE_DIR}/modules ${CMAKE_SOURCE_DIR}/modules/*)
|
||||
file(GLOB MODULES_DIRS RELATIVE ${DIR_MODULES} ${DIR_MODULES}/*)
|
||||
foreach(module ${MODULES_DIRS})
|
||||
set(module_path "${CMAKE_SOURCE_DIR}/modules/${module}")
|
||||
set(module_path "${DIR_MODULES}/${module}")
|
||||
|
||||
# checks if it is a sub-directory and if it contains a cmake file
|
||||
if(IS_DIRECTORY ${module_path} AND EXISTS "${module_path}/CMakeLists.txt")
|
||||
|
||||
30
bs/args.c
30
bs/args.c
@@ -74,18 +74,18 @@
|
||||
// return EXIT_SUCCESS;
|
||||
// }
|
||||
|
||||
void parse_command(char *line, int *argc, char **argv) {
|
||||
*argc = 0;
|
||||
while (*line != '\0') {
|
||||
while (*line == ' ' || *line == '\t' || *line == '\n') {
|
||||
*line++ = '\0';
|
||||
}
|
||||
if (*argc >= MAX_ARGS) break;
|
||||
(*argc)++;
|
||||
*argv++ = line;
|
||||
while (*line != '\0' && *line != ' ' && *line != '\t' && *line != '\n') {
|
||||
line++;
|
||||
}
|
||||
}
|
||||
*argv = '\0';
|
||||
}
|
||||
// void parse_command(char *line, int *argc, char **argv) {
|
||||
// *argc = 0;
|
||||
// while (*line != '\0') {
|
||||
// while (*line == ' ' || *line == '\t' || *line == '\n') {
|
||||
// *line++ = '\0';
|
||||
// }
|
||||
// if (*argc >= MAX_ARGS) break;
|
||||
// (*argc)++;
|
||||
// *argv++ = line;
|
||||
// while (*line != '\0' && *line != ' ' && *line != '\t' && *line != '\n') {
|
||||
// line++;
|
||||
// }
|
||||
// }
|
||||
// *argv = '\0';
|
||||
// }
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
#define _ARGS_H
|
||||
|
||||
// int parse_args(struct args *a, int argc, char *argv[]);
|
||||
void parse_command(char *line, int *argc, char **argv);
|
||||
// void parse_command(char *line, int *argc, char **argv);
|
||||
|
||||
#endif
|
||||
|
||||
100
bs/init.c
100
bs/init.c
@@ -19,6 +19,10 @@ Command commands[] = {
|
||||
{NULL, NULL}};
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "jtag_core/jtag_core.h"
|
||||
#include "config/version.h"
|
||||
#include "script/env.h"
|
||||
@@ -31,55 +35,99 @@ void jprint(jtag_core *jc, const char *msg)
|
||||
printf(msg);
|
||||
}
|
||||
|
||||
jtag_core *bsexp_init(void)
|
||||
int script_print(script_ctx *sctx, enum MSGTYPE typ, char *string, ...)
|
||||
{
|
||||
jtag_core *jc = NULL;
|
||||
script_ctx *sctx;
|
||||
int ret = 0;
|
||||
char msg[64] = {0};
|
||||
va_list args;
|
||||
|
||||
/* initialize the JTAG library */
|
||||
jc = jtagcore_init();
|
||||
switch (typ)
|
||||
{
|
||||
case MSG_DEBUG:
|
||||
strcpy(msg, "DEBUG :");
|
||||
break;
|
||||
case MSG_INFO_1:
|
||||
strcpy(msg, "INFO :");
|
||||
break;
|
||||
case MSG_WARNING:
|
||||
strcpy(msg, "WARNING :");
|
||||
break;
|
||||
case MSG_ERROR:
|
||||
strcpy(msg, "ERROR :");
|
||||
break;
|
||||
case MSG_INFO_0:
|
||||
default:
|
||||
strcpy(msg, "");
|
||||
break;
|
||||
}
|
||||
|
||||
if (NULL == jc)
|
||||
va_start(args, string);
|
||||
ret = printf(msg);
|
||||
ret += vprintf(string, args);
|
||||
va_end(args);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void bsexp_init(jtag_core **jc, script_ctx **sctx)
|
||||
{
|
||||
// JTAG core initialization
|
||||
*jc = jtagcore_init();
|
||||
if (NULL == *jc)
|
||||
goto end;
|
||||
|
||||
jc->envvar = (void *)initEnv(NULL, NULL);
|
||||
// Environment initialization
|
||||
(*jc)->envvar = (void *)initEnv(NULL, NULL);
|
||||
if (NULL == (*jc)->envvar) {
|
||||
jtagcore_deinit(*jc);
|
||||
*jc = NULL;
|
||||
goto end;
|
||||
}
|
||||
jtagcore_setEnvVar(*jc, "VERSION", "v" APP_VER_STR(APP_VER));
|
||||
|
||||
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");
|
||||
// Scripts initialization
|
||||
*sctx = jtagcore_initScript(*jc);
|
||||
if (NULL == *sctx) {
|
||||
deinitEnv((*jc)->envvar);
|
||||
jtagcore_deinit(*jc);
|
||||
*jc = NULL;
|
||||
goto end;
|
||||
}
|
||||
setOutputFunc_script(*sctx, script_print);
|
||||
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)
|
||||
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))
|
||||
if (jtagcore_getEnvVar(*jc, "LOG_MESSAGES_FILTER_LEVEL", NULL))
|
||||
{
|
||||
jtagcore_set_logs_level(jc, jtagcore_getEnvVarValue(jc, "LOG_MESSAGES_FILTER_LEVEL"));
|
||||
jtagcore_set_logs_level(*jc, jtagcore_getEnvVarValue(*jc, "LOG_MESSAGES_FILTER_LEVEL"));
|
||||
}
|
||||
|
||||
if (jtagcore_getEnvVar(jc, "LOG_MESSAGES_FILE_OUTPUT", NULL))
|
||||
if (jtagcore_getEnvVar(*jc, "LOG_MESSAGES_FILE_OUTPUT", NULL))
|
||||
{
|
||||
jtagcore_set_logs_file(jc, 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;
|
||||
return;
|
||||
}
|
||||
|
||||
void bsexp_deinit(jtag_core *jc)
|
||||
void bsexp_deinit(jtag_core *jc, script_ctx *sctx)
|
||||
{
|
||||
if (NULL == jc) return;
|
||||
envvar_entry *env = NULL;
|
||||
|
||||
envvar_entry *env = jc->envvar;
|
||||
if (NULL != jc)
|
||||
{
|
||||
deinit_script(sctx);
|
||||
}
|
||||
if (NULL != jc)
|
||||
{
|
||||
env = jc->envvar;
|
||||
deinitEnv(env);
|
||||
jtagcore_deinit(jc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ typedef struct {
|
||||
|
||||
extern Command commands[];
|
||||
|
||||
jtag_core *bsexp_init(void);
|
||||
void bsexp_deinit(jtag_core *jc);
|
||||
int script_print(script_ctx *sctx, enum MSGTYPE typ, char *string, ...);
|
||||
void bsexp_init(jtag_core **jc, script_ctx **sctx);
|
||||
void bsexp_deinit(jtag_core *jc, script_ctx *sctx);
|
||||
|
||||
#endif
|
||||
85
bs/main.c
85
bs/main.c
@@ -2,6 +2,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
|
||||
@@ -9,6 +10,7 @@
|
||||
#include "utils.h"
|
||||
#include "init.h"
|
||||
#include "args.h"
|
||||
#include "script/script.h"
|
||||
|
||||
// int main(int argc, char *argv[]) {
|
||||
// int success = 0;
|
||||
@@ -58,63 +60,70 @@
|
||||
// return error;
|
||||
// }
|
||||
|
||||
jtag_core *jc = NULL;
|
||||
script_ctx *sctx = NULL;
|
||||
|
||||
// int execute_command(jtag_core *jc, int argc, char **argv) {
|
||||
// int error = 0;
|
||||
// if (argv[0] == NULL) {
|
||||
// return 0;
|
||||
// }
|
||||
// Fonction de gestion du signal
|
||||
void handle_sigint(int sig) {
|
||||
bsexp_deinit(jc, sctx);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// for (int i = 0; commands[i].name != NULL; i++) {
|
||||
// if (strcmp(argv[0], commands[i].name) == 0) {
|
||||
// error = commands[i].cmd_call(jc, argc, argv);
|
||||
// return error;
|
||||
// }
|
||||
// }
|
||||
// error = -1;
|
||||
// printf("Command not found\n");
|
||||
// }
|
||||
int execute_command(script_ctx *sctx, char *line)
|
||||
{
|
||||
int error = 0;
|
||||
error = execute_line_script(sctx, line);
|
||||
return error;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int main()
|
||||
{
|
||||
char *line = NULL;
|
||||
int error = 0;
|
||||
int cmd_argc = 0;
|
||||
char *cmd_argv[MAX_ARGS] = {0};
|
||||
jtag_core *jc = NULL;
|
||||
|
||||
jc = bsexp_init();
|
||||
if (NULL == jc) {
|
||||
bsexp_init(&jc, &sctx);
|
||||
script_print(sctx, MSG_NONE, "\n");
|
||||
if ((NULL == jc) || (NULL == sctx))
|
||||
{
|
||||
error = JTAG_CORE_MEM_ERROR;
|
||||
printf("JTAG Core execution failed");
|
||||
goto err;
|
||||
printf("JTAG Core initialization failed!\n");
|
||||
goto err_no_deinit;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
signal(SIGINT, handle_sigint);
|
||||
while (1)
|
||||
{
|
||||
line = readline("bs_explorer> ");
|
||||
if (line == NULL) {
|
||||
if (line == NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (*line) {
|
||||
if (*line)
|
||||
{
|
||||
add_history(line);
|
||||
}
|
||||
parse_command(line, &cmd_argc, cmd_argv);
|
||||
if (cmd_argv[0] == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (strcmp(cmd_argv[0], "exit") == 0) {
|
||||
if (strcmp(line, "exit") == 0) {
|
||||
break;
|
||||
}
|
||||
// error = execute_command(jc, cmd_argc, cmd_argv);
|
||||
// printf("\n");
|
||||
// if (0 == error) {
|
||||
// } else {
|
||||
// printf("Command failed with code: %d", error);
|
||||
// }
|
||||
if (strcmp(line, "quit") == 0) {
|
||||
break;
|
||||
}
|
||||
error = execute_command(sctx, line);
|
||||
if (0 == error)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Command failed with code: %d\n", error);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
err_no_deinit:
|
||||
exit(error);
|
||||
err:
|
||||
return error;
|
||||
printf("Failed with error (%d)", error);
|
||||
end:
|
||||
bsexp_deinit(jc);
|
||||
bsexp_deinit(jc, sctx);
|
||||
exit(error);
|
||||
}
|
||||
4762
bsdl_files/xilinx/xcku15p_ffve1517.bsd
Normal file
4762
bsdl_files/xilinx/xcku15p_ffve1517.bsd
Normal file
File diff suppressed because it is too large
Load Diff
@@ -62,7 +62,7 @@ typedef struct _script_label
|
||||
|
||||
typedef struct _script_ctx script_ctx;
|
||||
|
||||
typedef int (*SCRIPT_PRINTF_FUNC)(script_ctx * ctx, int MSGTYPE, char *string, ...);
|
||||
typedef int (*SCRIPT_PRINTF_FUNC)(script_ctx * ctx, enum MSGTYPE typ, char *string, ...);
|
||||
|
||||
typedef struct _script_ctx
|
||||
{
|
||||
|
||||
@@ -11,11 +11,10 @@
|
||||
#define vxstr(s) vstr(s)
|
||||
#define vstr(s) #s
|
||||
|
||||
#define LIB_JTAG_CORE_VERSION vxstr(VDIG1) "." vxstr(VDIG2) "." vxstr(VDIG3) "." vxstr(VDIG4)
|
||||
#define LIB_JTAG_CORE_VERSION_COMMA vxstr(VDIG1) "," vxstr(VDIG2) "," vxstr(VDIG3) "," vxstr(VDIG4)
|
||||
|
||||
#define APP_VER VDIG1.VDIG2.VDIG3.VDIG4
|
||||
#define APP_VER_TXT( N ) JTAG Boundary Scanner v##N
|
||||
#define APP_VER_TXT_LONG( N ) JTAG Boundary Scanner v##N
|
||||
#define APP_VER_TXT( N ) v##N
|
||||
#define APP_VER_STR_LONG( N ) vxstr( APP_VER_TXT_LONG( N ) )
|
||||
#define APP_VER_STR( N ) vxstr( APP_VER_TXT( N ) )
|
||||
|
||||
#endif
|
||||
@@ -5,6 +5,10 @@ file(GLOB_RECURSE JLINK_SOURCES "jlink_jtag/*.c")
|
||||
file(GLOB_RECURSE FTDI_SOURCES "ftdi_jtag/*.c")
|
||||
file(GLOB_RECURSE GPIO_SOURCES "linux_gpio_jtag/*.c")
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
include_directories(${DIR_MODULES})
|
||||
include_directories(${DIR_LIBS})
|
||||
|
||||
add_compile_definitions(FTD2XX_STATIC)
|
||||
add_compile_definitions(FTDILIB)
|
||||
|
||||
add_library(drivers ${MAIN_SOURCES} ${FTDI_SOURCES} ${GPIO_SOURCES} ${JLINK_SOURCES})
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ftd2xx.h"
|
||||
#include "libftd2xx/ftd2xx.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -18,10 +18,8 @@ add_custom_target(
|
||||
DEPENDS prebuild_command_done
|
||||
)
|
||||
|
||||
add_compile_definitions(FTD2XX_STATIC)
|
||||
add_compile_definitions(FTDILIB)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
include_directories(${DIR_MODULES})
|
||||
include_directories(${DIR_LIBS})
|
||||
|
||||
add_library(jtag_core ${ALL_SOURCES})
|
||||
add_dependencies(jtag_core prebuild)
|
||||
|
||||
@@ -2,6 +2,7 @@ set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
file(GLOB_RECURSE ALL_SOURCES "*.c")
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
include_directories(${DIR_MODULES})
|
||||
include_directories(${DIR_LIBS})
|
||||
|
||||
add_library(script ${ALL_SOURCES})
|
||||
|
||||
@@ -40,26 +40,7 @@
|
||||
|
||||
#include "env.h"
|
||||
|
||||
#ifndef _script_cmd_func_
|
||||
typedef int (* CMD_FUNC)( script_ctx * ctx, char * line);
|
||||
#define _script_cmd_func_
|
||||
#endif
|
||||
|
||||
typedef struct cmd_list_
|
||||
{
|
||||
char * command;
|
||||
CMD_FUNC func;
|
||||
}cmd_list;
|
||||
|
||||
typedef struct label_list_
|
||||
{
|
||||
char * label;
|
||||
unsigned int file_offset;
|
||||
}label_list;
|
||||
|
||||
extern cmd_list script_commands_list[];
|
||||
|
||||
static int dummy_script_printf(script_ctx * ctx, int MSGTYPE, char * string, ... )
|
||||
static int dummy_script_printf(script_ctx *ctx, enum MSGTYPE typ, char *string, ...)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -840,7 +821,12 @@ script_ctx * deinit_script(script_ctx * ctx)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////// Generic commands/operations /////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const char *cmd_goto_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_goto(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i;
|
||||
@@ -856,6 +842,12 @@ static int cmd_goto( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_if_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_if(script_ctx *ctx, char *line)
|
||||
{
|
||||
//"if" command example :
|
||||
@@ -963,6 +955,12 @@ static int cmd_if( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_return_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_return(script_ctx *ctx, char *line)
|
||||
{
|
||||
if (ctx->script_file)
|
||||
@@ -973,6 +971,12 @@ static int cmd_return( script_ctx * ctx, char * line )
|
||||
return JTAG_CORE_NO_ERROR;
|
||||
}
|
||||
|
||||
const char *cmd_system_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_system(script_ctx *ctx, char *line)
|
||||
{
|
||||
int offs;
|
||||
@@ -993,6 +997,12 @@ static int cmd_system( script_ctx * ctx, char * line )
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_print_env_var_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_print_env_var(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i;
|
||||
@@ -1020,13 +1030,24 @@ static int cmd_print_env_var( script_ctx * ctx, char * line )
|
||||
}
|
||||
}
|
||||
|
||||
const char *cmd_version_help[] = {
|
||||
"<none>",
|
||||
"prints the version of the tool.",
|
||||
""};
|
||||
static int cmd_version(script_ctx *ctx, char *line)
|
||||
{
|
||||
ctx->script_printf( ctx, MSG_INFO_0, "Lib version : %s, Date : "__DATE__" "__TIME__"\n", LIB_JTAG_CORE_VERSION );
|
||||
ctx->script_printf(ctx, MSG_INFO_0, "%s, Date : "__DATE__
|
||||
" "__TIME__
|
||||
"\n",
|
||||
APP_VER_STR_LONG(APP_VER));
|
||||
|
||||
return JTAG_CORE_NO_ERROR;
|
||||
}
|
||||
|
||||
const char *cmd_print_help[] = {
|
||||
"<arg>(string)",
|
||||
"sends <arg> to standard output.",
|
||||
""};
|
||||
static int cmd_print(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i, j, s;
|
||||
@@ -1083,6 +1104,10 @@ static int cmd_print( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_NO_ERROR;
|
||||
}
|
||||
|
||||
const char *cmd_pause_help[] = {
|
||||
"<arg>(int)",
|
||||
"pauses the program for <arg> ms.",
|
||||
""};
|
||||
static int cmd_pause(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i;
|
||||
@@ -1102,26 +1127,72 @@ static int cmd_pause( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_help_help[] = {
|
||||
"<command>(string)",
|
||||
"if no args, it prints the list of commandsm,",
|
||||
"otherwise the help of the <command>.",
|
||||
""};
|
||||
static int cmd_help(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
int not_found = 1;
|
||||
char hcmd[DEFAULT_BUFLEN];
|
||||
|
||||
cmd_list *cmdlist;
|
||||
|
||||
cmdlist = (cmd_list *)ctx->cmdlist;
|
||||
|
||||
i = get_param(ctx, line, 1, hcmd);
|
||||
if (i >= 0)
|
||||
{
|
||||
i = 0;
|
||||
while (cmdlist[i].func)
|
||||
{
|
||||
if (0 == strcmp(hcmd, cmdlist[i].command))
|
||||
{
|
||||
not_found = 0;
|
||||
ctx->script_printf(ctx, MSG_NONE, "Documentation of command '%s' :\n", cmdlist[i].command);
|
||||
ctx->script_printf(ctx, MSG_NONE, "---------------------------------------------------\n");
|
||||
j = 0;
|
||||
while (strcmp(cmdlist[i].help[j], "")) {
|
||||
if (j == 0) {
|
||||
ctx->script_printf(ctx, MSG_NONE, "Parameters :\n");
|
||||
ctx->script_printf(ctx, MSG_NONE, " %s\n", cmdlist[i].help[j]);
|
||||
} else {
|
||||
if (j == 1) {
|
||||
ctx->script_printf(ctx, MSG_NONE, "Description :\n");
|
||||
}
|
||||
ctx->script_printf(ctx, MSG_NONE, " %s\n", cmdlist[i].help[j]);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (not_found)
|
||||
{
|
||||
ctx->script_printf(ctx, MSG_ERROR, "Command '%s' not found :\n\n", hcmd);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ctx->script_printf(ctx, MSG_INFO_0, "Supported Commands :\n\n");
|
||||
|
||||
i = 0;
|
||||
while (cmdlist[i].func)
|
||||
{
|
||||
ctx->script_printf(ctx, MSG_NONE, "%s\n", cmdlist[i].command);
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
return JTAG_CORE_NO_ERROR;
|
||||
}
|
||||
|
||||
const char *cmd_call_help[] = {
|
||||
"<path>(string)",
|
||||
"Executes a script located at <path>.",
|
||||
""};
|
||||
static int cmd_call(script_ctx *ctx, char *line)
|
||||
{
|
||||
int offs;
|
||||
@@ -1204,6 +1275,10 @@ static int cmd_call( script_ctx * ctx, char * line )
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_set_env_var_help[] = {
|
||||
"<varname>(string) <varvalue>(string)",
|
||||
"Stores <varvalue> in the environmen variable <varname>.",
|
||||
""};
|
||||
static int cmd_set_env_var(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i, j, ret;
|
||||
@@ -1228,6 +1303,10 @@ static int cmd_set_env_var( script_ctx * ctx, char * line )
|
||||
return ret;
|
||||
}
|
||||
|
||||
const char *cmd_rand_help[] = {
|
||||
"<seed>(int)",
|
||||
"Generates a random integer. Uses the <seed> value if present.",
|
||||
""};
|
||||
static int cmd_rand(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i;
|
||||
@@ -1326,7 +1405,10 @@ char * arrayresize(char * array, int size, unsigned char c)
|
||||
return array;
|
||||
}
|
||||
|
||||
|
||||
const char *cmd_initarray_help[] = {
|
||||
"<varname>(string) <varsize>(int) <value>(int)",
|
||||
"Initializes an array of size <varsize> with <value>. Stores it in the environment.",
|
||||
""};
|
||||
static int cmd_initarray(script_ctx *ctx, char *line)
|
||||
{
|
||||
// initarray $VARIABLE_1_TEST $BYTES $VALUE
|
||||
@@ -1375,14 +1457,17 @@ static int cmd_initarray( script_ctx * ctx, char * line)
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////// JTAG commands/operations //////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const char *cmd_autoinit_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_autoinit(script_ctx *ctx, char *line)
|
||||
{
|
||||
jtag_core *jc;
|
||||
@@ -1490,6 +1575,12 @@ static int cmd_autoinit( script_ctx * ctx, char * line)
|
||||
return loaded_bsdl;
|
||||
}
|
||||
|
||||
const char *cmd_init_and_scan_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_init_and_scan(script_ctx *ctx, char *line)
|
||||
{
|
||||
jtag_core *jc;
|
||||
@@ -1513,6 +1604,12 @@ static int cmd_init_and_scan( script_ctx * ctx, char * line)
|
||||
return ret;
|
||||
}
|
||||
|
||||
const char *cmd_print_nb_dev_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_print_nb_dev(script_ctx *ctx, char *line)
|
||||
{
|
||||
jtag_core *jc;
|
||||
@@ -1529,6 +1626,12 @@ static int cmd_print_nb_dev( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_NO_ERROR;
|
||||
}
|
||||
|
||||
const char *cmd_bsdl_id_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static void bsdl_id_str(unsigned long id, char *str)
|
||||
{
|
||||
int i;
|
||||
@@ -1545,9 +1648,12 @@ static void bsdl_id_str(unsigned long id, char * str)
|
||||
{
|
||||
strcat(str, "0");
|
||||
}
|
||||
if (i == 3) strcat(str, " ");
|
||||
if (i == 19) strcat(str, " ");
|
||||
if (i == 30) strcat(str, " ");
|
||||
if (i == 3)
|
||||
strcat(str, " ");
|
||||
if (i == 19)
|
||||
strcat(str, " ");
|
||||
if (i == 30)
|
||||
strcat(str, " ");
|
||||
}
|
||||
|
||||
str[i] = 0;
|
||||
@@ -1590,6 +1696,12 @@ static char * get_id_str( script_ctx * ctx, int numberofdevice)
|
||||
return stringbuffer;
|
||||
}
|
||||
|
||||
const char *cmd_print_devs_list_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_print_devs_list(script_ctx *ctx, char *line)
|
||||
{
|
||||
jtag_core *jc;
|
||||
@@ -1612,6 +1724,11 @@ static int cmd_print_devs_list( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_NOT_FOUND;
|
||||
}
|
||||
|
||||
const char *cmd_print_probes_list_help[] = {
|
||||
"<none>", // Arguments "1<arg>(type) ..."
|
||||
"Displays the list of detected probes.", // Explanations
|
||||
""
|
||||
};
|
||||
static int cmd_print_probes_list(script_ctx *ctx, char *line)
|
||||
{
|
||||
jtag_core *jc;
|
||||
@@ -1639,6 +1756,11 @@ static int cmd_print_probes_list( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_NO_ERROR;
|
||||
}
|
||||
|
||||
const char *cmd_open_probe_help[] = {
|
||||
"<probe_id>(int)", // Arguments "1<arg>(type) ..."
|
||||
"The probe id as given in the 'jtag_probe_list' function.",
|
||||
""
|
||||
};
|
||||
static int cmd_open_probe(script_ctx *ctx, char *line)
|
||||
{
|
||||
int ret;
|
||||
@@ -1669,6 +1791,12 @@ static int cmd_open_probe( script_ctx * ctx, char * line)
|
||||
}
|
||||
}
|
||||
|
||||
const char *cmd_load_bsdl_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_load_bsdl(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i, j;
|
||||
@@ -1700,6 +1828,12 @@ static int cmd_load_bsdl( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_set_scan_mode_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_set_scan_mode(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i, j;
|
||||
@@ -1742,6 +1876,11 @@ static int cmd_set_scan_mode( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_push_and_pop_help[] = {
|
||||
"<none>",
|
||||
"Do a JTAG chain transaction.",
|
||||
""
|
||||
};
|
||||
static int cmd_push_and_pop(script_ctx *ctx, char *line)
|
||||
{
|
||||
int ret;
|
||||
@@ -1764,6 +1903,11 @@ static int cmd_push_and_pop( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_NO_ERROR;
|
||||
}
|
||||
|
||||
const char *cmd_set_pin_mode_help[] = {
|
||||
"<device>(int) <pin>(string) <mode>(string)",
|
||||
"Change the mode (input or output) of the pin of the given device.",
|
||||
""
|
||||
};
|
||||
static int cmd_set_pin_mode(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i, j, k, id;
|
||||
@@ -1802,6 +1946,11 @@ static int cmd_set_pin_mode( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_set_pin_state_help[] = {
|
||||
"<device>(int) <pin>(string) <state>(string)",
|
||||
"Change the state (0 or 1) of the pin of the given device.",
|
||||
""
|
||||
};
|
||||
static int cmd_set_pin_state(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i, j, k, id;
|
||||
@@ -1840,6 +1989,12 @@ static int cmd_set_pin_state( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_get_pin_state_help[] = {
|
||||
"<device>(int) <pin>(string) <mode>(string)",
|
||||
"Gets the state (0 or 1) of the pin of the given device.",
|
||||
"The mode is to be chosen between 'input' or 'output'.",
|
||||
""
|
||||
};
|
||||
static int cmd_get_pin_state(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i, j, k, ret, id;
|
||||
@@ -1883,7 +2038,12 @@ static int cmd_get_pin_state( script_ctx * ctx, char * line)
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
// I2C Commands
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const char *cmd_set_i2c_sda_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_set_i2c_sda_pin(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i, j, id;
|
||||
@@ -1918,6 +2078,12 @@ static int cmd_set_i2c_sda_pin( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_set_i2c_scl_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_set_i2c_scl_pin(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i, j, id;
|
||||
@@ -1952,6 +2118,12 @@ static int cmd_set_i2c_scl_pin( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_do_i2c_wr_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_do_i2c_wr(script_ctx *ctx, char *line)
|
||||
{
|
||||
// jtag_set_do_i2c_wr E8 EAACCDD4455
|
||||
@@ -2014,6 +2186,12 @@ static int cmd_do_i2c_wr( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_do_i2c_rd_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_do_i2c_rd(script_ctx *ctx, char *line)
|
||||
{
|
||||
// jtag_set_do_i2c_rd 0xE8 8
|
||||
@@ -2073,7 +2251,12 @@ static int cmd_do_i2c_rd( script_ctx * ctx, char * line)
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
// MDIO Commands
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const char *cmd_set_mdio_mdc_pin_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_set_mdio_mdc_pin(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i, j, id;
|
||||
@@ -2108,6 +2291,12 @@ static int cmd_set_mdio_mdc_pin( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_set_mdio_mdio_pin_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_set_mdio_mdio_pin(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i, j, id;
|
||||
@@ -2142,6 +2331,12 @@ static int cmd_set_mdio_mdio_pin( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_do_mdio_wr_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_do_mdio_wr(script_ctx *ctx, char *line)
|
||||
{
|
||||
// jtag_mdio_wr 01 04 EAAC
|
||||
@@ -2181,6 +2376,12 @@ static int cmd_do_mdio_wr( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_do_mdio_rd_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_do_mdio_rd(script_ctx *ctx, char *line)
|
||||
{
|
||||
// jtag_mdio_rd 01 04
|
||||
@@ -2221,6 +2422,12 @@ static int cmd_do_mdio_rd( script_ctx * ctx, char * line)
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
// SPI Commands
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
const char *cmd_set_spi_cs_pin_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_set_spi_cs_pin(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i, j, k, id;
|
||||
@@ -2257,6 +2464,12 @@ static int cmd_set_spi_cs_pin( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_set_spi_clk_pin_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_set_spi_clk_pin(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i, j, k, id;
|
||||
@@ -2293,6 +2506,12 @@ static int cmd_set_spi_clk_pin( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_set_spi_mosi_pin_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_set_spi_mosi_pin(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i, j, k, id;
|
||||
@@ -2329,6 +2548,12 @@ static int cmd_set_spi_mosi_pin( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_set_spi_miso_pin_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_set_spi_miso_pin(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i, j, k, id;
|
||||
@@ -2365,6 +2590,12 @@ static int cmd_set_spi_miso_pin( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_spi_rd_wr_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_spi_rd_wr(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i, j, k, size;
|
||||
@@ -2428,6 +2659,12 @@ static int cmd_spi_rd_wr( script_ctx * ctx, char * line)
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
const char *cmd_get_pins_list_help[] = {
|
||||
"", // Arguments "1<arg>(type) ..."
|
||||
"explanations line one", // Explanations
|
||||
"explanations line two",
|
||||
""
|
||||
};
|
||||
static int cmd_get_pins_list(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i, j, nb_of_pins;
|
||||
@@ -2478,7 +2715,6 @@ static int cmd_get_pins_list( script_ctx * ctx, char * line)
|
||||
}
|
||||
|
||||
ctx->script_printf(ctx, MSG_NONE, "\n");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2491,60 +2727,47 @@ static int cmd_get_pins_list( script_ctx * ctx, char * line)
|
||||
|
||||
cmd_list script_commands_list[] =
|
||||
{
|
||||
{"print", cmd_print},
|
||||
{"help", cmd_help},
|
||||
{"?", cmd_help},
|
||||
{"version", cmd_version},
|
||||
{"pause", cmd_pause},
|
||||
{"set", cmd_set_env_var},
|
||||
{"print_env_var", cmd_print_env_var},
|
||||
{"call", cmd_call},
|
||||
{"system", cmd_system},
|
||||
|
||||
{"if", cmd_if},
|
||||
{"goto", cmd_goto},
|
||||
{"return", cmd_return},
|
||||
|
||||
{"rand", cmd_rand},
|
||||
|
||||
{"init_array", cmd_initarray},
|
||||
|
||||
{"jtag_get_probes_list", cmd_print_probes_list},
|
||||
{"jtag_open_probe", cmd_open_probe},
|
||||
{"jtag_autoinit", cmd_autoinit},
|
||||
|
||||
{"jtag_init_scan", cmd_init_and_scan},
|
||||
{"jtag_get_nb_of_devices", cmd_print_nb_dev},
|
||||
{"jtag_get_devices_list", cmd_print_devs_list},
|
||||
{"jtag_load_bsdl", cmd_load_bsdl},
|
||||
{"jtag_set_mode", cmd_set_scan_mode},
|
||||
|
||||
{"jtag_push_pop", cmd_push_and_pop},
|
||||
|
||||
{"jtag_get_pins_list", cmd_get_pins_list},
|
||||
|
||||
{"jtag_set_pin_dir", cmd_set_pin_mode},
|
||||
{"jtag_set_pin_state", cmd_set_pin_state},
|
||||
{"jtag_get_pin_state", cmd_get_pin_state},
|
||||
|
||||
{"jtag_set_i2c_scl_pin", cmd_set_i2c_scl_pin},
|
||||
{"jtag_set_i2c_sda_pin", cmd_set_i2c_sda_pin},
|
||||
{"jtag_i2c_rd", cmd_do_i2c_rd},
|
||||
{"jtag_i2c_wr", cmd_do_i2c_wr},
|
||||
|
||||
{"jtag_set_mdio_mdc_pin", cmd_set_mdio_mdc_pin},
|
||||
{"jtag_set_mdio_mdio_pin", cmd_set_mdio_mdio_pin},
|
||||
{"jtag_mdio_rd", cmd_do_mdio_rd},
|
||||
{"jtag_mdio_wr", cmd_do_mdio_wr},
|
||||
|
||||
{"jtag_set_spi_cs_pin", cmd_set_spi_cs_pin},
|
||||
{"jtag_set_spi_mosi_pin", cmd_set_spi_mosi_pin},
|
||||
{"jtag_set_spi_miso_pin", cmd_set_spi_miso_pin},
|
||||
{"jtag_set_spi_clk_pin", cmd_set_spi_clk_pin},
|
||||
{"jtag_spi_rd_wr", cmd_spi_rd_wr},
|
||||
|
||||
{0 , 0}
|
||||
};
|
||||
{"print", cmd_print, cmd_print_help},
|
||||
{"help", cmd_help, cmd_help_help},
|
||||
{"?", cmd_help, cmd_help_help},
|
||||
{"version", cmd_version, cmd_version_help},
|
||||
{"pause", cmd_pause, cmd_pause_help},
|
||||
{"set", cmd_set_env_var, cmd_set_env_var_help},
|
||||
{"print_env_var", cmd_print_env_var, cmd_print_env_var_help},
|
||||
{"call", cmd_call, cmd_call_help},
|
||||
{"system", cmd_system, cmd_system_help},
|
||||
{"if", cmd_if, cmd_if_help},
|
||||
{"goto", cmd_goto, cmd_goto_help},
|
||||
{"return", cmd_return, cmd_return_help},
|
||||
{"rand", cmd_rand, cmd_rand_help},
|
||||
{"init_array", cmd_initarray, cmd_initarray_help},
|
||||
{"jtag_get_probes_list", cmd_print_probes_list, cmd_print_probes_list_help},
|
||||
{"jtag_open_probe", cmd_open_probe, cmd_open_probe_help},
|
||||
{"jtag_autoinit", cmd_autoinit, cmd_autoinit_help},
|
||||
{"jtag_init_scan", cmd_init_and_scan, cmd_init_and_scan_help},
|
||||
{"jtag_get_nb_of_devices", cmd_print_nb_dev, cmd_print_nb_dev_help},
|
||||
{"jtag_get_devices_list", cmd_print_devs_list, cmd_print_devs_list_help},
|
||||
{"jtag_load_bsdl", cmd_load_bsdl, cmd_load_bsdl_help},
|
||||
{"jtag_set_mode", cmd_set_scan_mode, cmd_set_scan_mode_help},
|
||||
{"jtag_push_pop", cmd_push_and_pop, cmd_push_and_pop_help},
|
||||
{"jtag_get_pins_list", cmd_get_pins_list, cmd_get_pins_list_help},
|
||||
{"jtag_set_pin_dir", cmd_set_pin_mode, cmd_set_pin_mode_help},
|
||||
{"jtag_set_pin_state", cmd_set_pin_state, cmd_set_pin_state_help},
|
||||
{"jtag_get_pin_state", cmd_get_pin_state, cmd_get_pin_state_help},
|
||||
{"jtag_set_i2c_scl_pin", cmd_set_i2c_scl_pin, cmd_set_i2c_scl_help},
|
||||
{"jtag_set_i2c_sda_pin", cmd_set_i2c_sda_pin, cmd_set_i2c_sda_help},
|
||||
{"jtag_i2c_rd", cmd_do_i2c_rd, cmd_do_i2c_wr_help},
|
||||
{"jtag_i2c_wr", cmd_do_i2c_wr, cmd_do_i2c_rd_help},
|
||||
{"jtag_set_mdio_mdc_pin", cmd_set_mdio_mdc_pin, cmd_set_mdio_mdc_pin_help},
|
||||
{"jtag_set_mdio_mdio_pin", cmd_set_mdio_mdio_pin, cmd_set_mdio_mdio_pin_help},
|
||||
{"jtag_mdio_rd", cmd_do_mdio_rd, cmd_do_mdio_rd_help},
|
||||
{"jtag_mdio_wr", cmd_do_mdio_wr, cmd_do_mdio_wr_help},
|
||||
{"jtag_set_spi_cs_pin", cmd_set_spi_cs_pin, cmd_set_spi_cs_pin_help},
|
||||
{"jtag_set_spi_mosi_pin", cmd_set_spi_mosi_pin, cmd_set_spi_mosi_pin_help},
|
||||
{"jtag_set_spi_miso_pin", cmd_set_spi_miso_pin, cmd_set_spi_miso_pin_help},
|
||||
{"jtag_set_spi_clk_pin", cmd_set_spi_clk_pin, cmd_set_spi_clk_pin_help},
|
||||
{"jtag_spi_rd_wr", cmd_spi_rd_wr, cmd_spi_rd_wr_help},
|
||||
{0, 0}};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -27,6 +27,23 @@
|
||||
|
||||
#include "config/bs_defines.h"
|
||||
|
||||
typedef int (* CMD_FUNC)( script_ctx * ctx, char * line);
|
||||
|
||||
typedef struct cmd_list_
|
||||
{
|
||||
const char * command;
|
||||
CMD_FUNC func;
|
||||
const char ** help;
|
||||
}cmd_list;
|
||||
|
||||
typedef struct label_list_
|
||||
{
|
||||
char * label;
|
||||
unsigned int file_offset;
|
||||
}label_list;
|
||||
|
||||
extern cmd_list script_commands_list[];
|
||||
|
||||
script_ctx *jtagcore_initScript(jtag_core *jc);
|
||||
script_ctx * init_script(void * app_ctx, unsigned int flags, void * env);
|
||||
int execute_file_script( script_ctx * ctx, char * filename );
|
||||
|
||||
Reference in New Issue
Block a user