code refactoring

This commit is contained in:
2025-02-16 19:32:01 +01:00
parent f3c2569a30
commit c8bda25d90
42 changed files with 439 additions and 543 deletions

View File

@@ -29,18 +29,14 @@
#include <stdlib.h>
#include <string.h>
#include "drivers/drv_loader.h"
#include "jtag_core/jtag_core_internal.h"
#include "script/env.h"
#include "jtag_core/jtag_core.h"
#include "bsdl_loader.h"
#include "bsdl_strings.h"
#include "natsort/strnatcmp.h"
#include "os_interface/os_interface.h"
#include "jtag_core/dbg_logs.h"
#define DEBUG 1
char *string_upper(char *str)

View File

@@ -1,3 +1,5 @@
#ifndef _BSDL_LOADER_H
#define _BSDL_LOADER_H
/*
* JTAG Core library
* Copyright (c) 2008 - 2024 Viveris Technologies
@@ -23,6 +25,8 @@
* @author Jean-François DEL NERO <Jean-Francois.DELNERO@viveris.fr>
*/
#include "jtag_core/jtag_core.h"
#define MAX_ELEMENT_SIZE (64+1)
typedef struct _pin_ctrl
@@ -79,3 +83,5 @@ typedef struct _jtag_bsdl
jtag_bsdl * load_bsdlfile(jtag_core * jc,char *filename);
void unload_bsdlfile(jtag_core * jc, jtag_bsdl * bsdl);
#endif

View File

@@ -25,8 +25,6 @@
#include <string.h>
#include "drivers/drv_loader.h"
#include "jtag_core/jtag_core_internal.h"
#include "jtag_core/jtag_core.h"
#include "bsdl_loader.h"

View File

@@ -1,3 +1,5 @@
#ifndef _BSDL_STRING_H
#define _BSDL_STRING_H
/*
* JTAG Core library
* Copyright (c) 2008 - 2024 Viveris Technologies
@@ -75,3 +77,5 @@ extern type_strings statetype_str[];
extern type_strings pintype_str[];
int get_typecode(type_strings * typelist,char * name);
#endif

View File

@@ -27,8 +27,6 @@
#include <string.h>
#include <stdlib.h>
#include "drivers/drv_loader.h"
#include "jtag_core/jtag_core_internal.h"
#include "jtag_core/jtag_core.h"
#include "bsdl_parser/bsdl_loader.h"

View File

@@ -27,9 +27,6 @@
#include <string.h>
#include <stdlib.h>
#include "drivers/drv_loader.h"
#include "jtag_core/jtag_core_internal.h"
#include "jtag_core/jtag_core.h"
#include "bsdl_parser/bsdl_loader.h"

View File

@@ -27,9 +27,6 @@
#include <string.h>
#include <stdlib.h>
#include "drivers/drv_loader.h"
#include "jtag_core/jtag_core_internal.h"
#include "jtag_core/jtag_core.h"
#include "bsdl_parser/bsdl_loader.h"

View File

@@ -27,9 +27,6 @@
#include <string.h>
#include <stdlib.h>
#include "drivers/drv_loader.h"
#include "jtag_core/jtag_core_internal.h"
#include "jtag_core/jtag_core.h"
#include "bsdl_parser/bsdl_loader.h"

195
modules/config/bs_defines.h Normal file
View File

@@ -0,0 +1,195 @@
#ifndef _BS_TYPES_H
#define _BS_TYPES_H
#include <stdio.h>
#include <stdint.h>
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Functions Error / return codes
#define JTAG_CORE_NO_ERROR 0
#define JTAG_CORE_BAD_PARAMETER -1
#define JTAG_CORE_ACCESS_ERROR -2
#define JTAG_CORE_IO_ERROR -3
#define JTAG_CORE_MEM_ERROR -4
#define JTAG_CORE_NO_PROBE -5
#define JTAG_CORE_NOT_FOUND -6
#define JTAG_CORE_CMD_NOT_FOUND -7
#define JTAG_CORE_INTERNAL_ERROR -8
#define JTAG_CORE_BAD_CMD -9
#define JTAG_CORE_I2C_BUS_NOTFREE -10
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifdef SCRIPT_64BITS_SUPPORT
#define env_var_value uint64_t
#define STRTOVALUE strtoull
#define LONGHEXSTR "%llX"
#else
#define env_var_value uint32_t
#define STRTOVALUE strtoul
#define LONGHEXSTR "%.8X"
#endif
#define MAX_LABEL_SIZE 64
#define MAX_LABEL 256
#define DEFAULT_BUFLEN 1024
enum {
GET_DRV_ID = 1,
GET_DRV_DESCRIPTION,
GET_DRV_FUNCPTR,
GET_DRV_DETECT
};
// Output message types/levels
enum MSGTYPE
{
MSG_DEBUG = 0,
MSG_INFO_0,
MSG_INFO_1,
MSG_WARNING,
MSG_ERROR,
MSG_NONE
};
typedef struct _script_label
{
char label_name[MAX_LABEL_SIZE];
unsigned int offset;
} script_label;
typedef struct _script_ctx script_ctx;
typedef int (*SCRIPT_PRINTF_FUNC)(script_ctx * ctx, int MSGTYPE, char *string, ...);
typedef struct _script_ctx
{
SCRIPT_PRINTF_FUNC script_printf;
void * app_ctx;
void * env;
void * cmdlist;
FILE * script_file;
char script_file_path[1024];
int cur_label_index;
script_label labels[MAX_LABEL];
int cur_script_offset;
int dry_run;
int last_error_code;
env_var_value last_data_value;
int last_flags;
char pre_command[1024 + 32];
uint32_t rand_seed;
} script_ctx;
#define MAX_NB_JTAG_DEVICE 64
#define MAX_NUMBER_BITS_IN_CHAIN (256 * 1024)
#define MAX_NUMBER_PINS_PER_DEV (64 * 1024)
#define MAX_BSDL_FILE_SIZE (1024 * 1024)
#define MAX_NUMBER_OF_BSDL_LINES (64 * 1024)
#define MAX_PATH_LEN 4096
typedef struct _jtag_device
{
void *bsdl;
unsigned long devices_id;
unsigned char *out_boundary_scan;
unsigned char *in_boundary_scan;
int boundary_scan_size;
int scan_mode;
} jtag_device;
#define MAX_BUS_WIDTH 32
typedef struct _jtag_core jtag_core;
typedef int (*DRV_DETECT) (jtag_core* jc);
typedef int (*DRV_INIT) (jtag_core* jc,int sub_drv,char * params);
typedef int (*DRV_TXRXDATA) (jtag_core* jc, unsigned char * str_out, unsigned char * str_in, int size);
typedef int (*DRV_TXTMS) (jtag_core* jc, unsigned char * str_out, int size);
typedef int (*DRV_GETMODULEINFOS) (jtag_core* jc,int sub_drv,unsigned int infotype, void * returnvalue);
typedef int (*DRV_DEINIT) (jtag_core* jc);
typedef struct drv_ptr_
{
DRV_DETECT drv_Detect;
DRV_INIT drv_Init;
DRV_DEINIT drv_DeInit;
DRV_TXTMS drv_TX_TMS;
DRV_TXRXDATA drv_TXRX_DATA;
DRV_GETMODULEINFOS drv_Get_ModInfos;
} drv_ptr;
typedef struct _jtag_core
{
drv_ptr io_functions;
void *jtagcore_print_callback;
int logs_level;
void *envvar;
int t;
int nb_of_devices_in_chain;
int total_IR_lenght;
jtag_device devices_list[MAX_NB_JTAG_DEVICE];
int IR_filled;
// I2C over JTAG
int i2c_sda_device;
int i2c_scl_device;
int i2c_sda_pin;
int i2c_scl_pin;
// SPI over JTAG
int spi_mosi_device;
int spi_miso_device;
int spi_cs_device;
int spi_clk_device;
int spi_mosi_pin;
int spi_miso_pin;
int spi_cs_pin;
int spi_clk_pin;
int spi_cs_pol;
int spi_clk_pol;
int spi_mosi_pol;
int spi_miso_pol;
int spi_lsb_first;
// MDIO over JTAG
int mdio_mdc_pin;
int mdio_mdc_device;
int mdio_mdio_pin;
int mdio_mdio_device;
// Memory over JTAG
int ram_address_pin[MAX_BUS_WIDTH];
int ram_address_device[MAX_BUS_WIDTH];
int ram_data_pin[MAX_BUS_WIDTH];
int ram_data_device[MAX_BUS_WIDTH];
int ram_ctrl_pin[16];
int ram_ctrl_pin_pol[16];
int ram_ctrl_device[16];
char log_file_path[MAX_PATH_LEN];
} jtag_core;
#endif

21
modules/config/version.h Normal file
View File

@@ -0,0 +1,21 @@
#ifndef _VERSION_H
#define _VERSION_H
#define VDIG1 2
#define VDIG2 6
#define VDIG3 7
#define VDIG4 1
#define STR_DATE "28 Oct 2024"
#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_STR( N ) vxstr( APP_VER_TXT( N ) )
#endif

View File

@@ -23,9 +23,6 @@
* @author Jean-François DEL NERO <Jean-Francois.DELNERO@viveris.fr>
*/
#include "drv_loader.h"
#include "jtag_core/jtag_core_internal.h"
#include "jtag_core/jtag_core.h"
#include "bsdl_parser/bsdl_loader.h"

View File

@@ -1,3 +1,5 @@
#ifndef _DRIVERS_LIST_H
#define _DRIVERS_LIST_H
/*
* JTAG Core library
* Copyright (c) 2008 - 2024 Viveris Technologies
@@ -30,4 +32,4 @@ typedef struct _drv_entry
extern const drv_entry staticdrvs[];
#endif

View File

@@ -26,9 +26,6 @@
#include <stdio.h>
#include <string.h>
#include "drv_loader.h"
#include "jtag_core/jtag_core_internal.h"
#include "jtag_core/jtag_core.h"
#include "bsdl_parser/bsdl_loader.h"

View File

@@ -1,3 +1,5 @@
#ifndef _DRV_LOADER_H
#define _DRV_LOADER_H
/*
* JTAG Core library
* Copyright (c) 2008 - 2024 Viveris Technologies
@@ -22,29 +24,9 @@
* @brief driver functions definitions
* @author Jean-François DEL NERO <Jean-Francois.DELNERO@viveris.fr>
*/
enum {
GET_DRV_ID = 1,
GET_DRV_DESCRIPTION,
GET_DRV_FUNCPTR,
GET_DRV_DETECT
};
typedef int (*DRV_DETECT) (void* jtag_core);
typedef int (*DRV_INIT) (void* jtag_core,int sub_drv,char * params);
typedef int (*DRV_TXRXDATA) (void* jtag_core, unsigned char * str_out, unsigned char * str_in, int size);
typedef int (*DRV_TXTMS) (void* jtag_core, unsigned char * str_out, int size);
typedef int (*DRV_GETMODULEINFOS) (void* jtag_core,int sub_drv,unsigned int infotype, void * returnvalue);
typedef int (*DRV_DEINIT) (void* jtag_core);
#include "config/bs_defines.h"
typedef struct drv_ptr_
{
DRV_DETECT drv_Detect;
DRV_INIT drv_Init;
DRV_DEINIT drv_DeInit;
DRV_TXTMS drv_TX_TMS;
DRV_TXRXDATA drv_TXRX_DATA;
DRV_GETMODULEINFOS drv_Get_ModInfos;
} drv_ptr;
int GetDrvInfo(void * jc_ctx, unsigned long infotype, void * returnvalue, const char * drv_id, const char * drv_desc, drv_ptr * drv_func);
int GetDrvInfo(void * jc_ctx, unsigned long infotype, void * returnvalue, const char * drv_id, const char * drv_desc, drv_ptr * drv_func);
#endif

View File

@@ -31,10 +31,9 @@
#include <sys/time.h>
#endif
#include "../drv_loader.h"
#include "jtag_core/jtag_core_internal.h"
#include "script/env.h"
#include "jtag_core/jtag_core.h"
#include "bsdl_parser/bsdl_loader.h"
#include "drivers/drv_loader.h"
#include "jtag_core/dbg_logs.h"
#include "os_interface/os_interface.h"

View File

@@ -1,3 +1,5 @@
#ifndef _FTDI_JTAG_DRV_H
#define _FTDI_JTAG_DRV_H
/*
* JTAG Core library
* Copyright (c) 2008 - 2024 Viveris Technologies
@@ -23,4 +25,8 @@
* @author Jean-François DEL NERO <Jean-Francois.DELNERO@viveris.fr>
*/
#include "jtag_core/jtag_core.h"
int drv_FTDI_libGetDrv(jtag_core * jc,int sub_drv, unsigned int infotype,void * returnvalue);
#endif

View File

@@ -25,12 +25,10 @@
#include <stdio.h>
#include <string.h>
#include "../drv_loader.h"
#include "jtag_core/jtag_core_internal.h"
#include "script/env.h"
#include "jtag_core/jtag_core.h"
#include "bsdl_parser/bsdl_loader.h"
#include "drivers/drv_loader.h"
#include "jtag_core/dbg_logs.h"
#if defined(WIN32)

View File

@@ -1,3 +1,5 @@
#ifndef _JLINK_JTAG_DRV_H
#define _JLINK_JTAG_DRV_H
/*
* JTAG Core library
* Copyright (c) 2008 - 2024 Viveris Technologies
@@ -23,4 +25,8 @@
* @author Jean-François DEL NERO <Jean-Francois.DELNERO@viveris.fr>
*/
#include "jtag_core/jtag_core.h"
int drv_JLINK_libGetDrv(jtag_core * jc,int sub_drv, unsigned int infotype,void * returnvalue);
#endif

View File

@@ -34,14 +34,10 @@
#include <unistd.h>
#endif
#include "../drv_loader.h"
#include "jtag_core/jtag_core_internal.h"
#include "script/env.h"
#include "jtag_core/jtag_core.h"
#include "bsdl_parser/bsdl_loader.h"
#include "drivers/drv_loader.h"
#include "os_interface/os_interface.h"
#include "jtag_core/dbg_logs.h"
char linux_gpio_base[512];

View File

@@ -1,3 +1,5 @@
#ifndef _GPIO_JTAG_DRV_H
#define _GPIO_JTAG_DRV_H
/*
* JTAG Core library
* Copyright (c) 2008 - 2024 Viveris Technologies
@@ -23,4 +25,8 @@
* @author Jean-François DEL NERO <Jean-Francois.DELNERO@viveris.fr>
*/
#include "jtag_core/jtag_core.h"
int drv_LinuxGPIO_libGetDrv(jtag_core * jc,int sub_drv,unsigned int infotype,void * returnvalue);
#endif

View File

@@ -32,12 +32,9 @@
#include <conio.h>
#endif
#include "../drv_loader.h"
#include "jtag_core/jtag_core_internal.h"
#include "script/env.h"
#include "jtag_core/jtag_core.h"
#include "bsdl_parser/bsdl_loader.h"
#include "drivers/drv_loader.h"
#include "jtag_core/dbg_logs.h"
#if defined(WIN32)

View File

@@ -1,3 +1,5 @@
#ifndef _LPT_JTAG_DRV_H
#define _LPT_JTAG_DRV_H
/*
* JTAG Core library
* Copyright (c) 2008 - 2024 Viveris Technologies
@@ -24,3 +26,5 @@
*/
int drv_LPT_libGetDrv(jtag_core * jc,int sub_drv,unsigned int infotype,void * returnvalue);
#endif

View File

@@ -29,8 +29,6 @@
#include <stdlib.h>
#include <stdarg.h>
#include "drivers/drv_loader.h"
#include "jtag_core_internal.h"
#include "jtag_core.h"
#include "os_interface/os_interface.h"

View File

@@ -1,3 +1,5 @@
#ifndef _DBG_LOGS_H
#define _DBG_LOGS_H
/*
* JTAG Core library
* Copyright (c) 2008 - 2024 Viveris Technologies
@@ -23,4 +25,8 @@
* @author Jean-François DEL NERO <Jean-Francois.DELNERO@viveris.fr>
*/
#include "config/bs_defines.h"
int jtagcore_logs_printf(jtag_core * jc, int MSGTYPE, char * chaine, ...);
#endif

View File

@@ -28,10 +28,7 @@
#include <stdlib.h>
#include <stdint.h>
#include "drivers/drv_loader.h"
#include "jtag_core_internal.h"
#include "jtag_core.h"
#include "version.h"
#include "script/env.h"
@@ -45,7 +42,6 @@
jtag_core * jtagcore_init()
{
jtag_core * jc;
script_ctx * sctx;
jc = (jtag_core *)malloc(sizeof(jtag_core));
if ( jc )
@@ -1076,33 +1072,6 @@ int jtagcore_select_and_open_probe(jtag_core * jc, int probe_id)
return JTAG_CORE_BAD_PARAMETER;
}
int jtagcore_setEnvVar( jtag_core * jc, char * varname, char * varvalue )
{
if( setEnvVarDat( jc->envvar, varname, varvalue ) >= 0 )
{
return JTAG_CORE_NO_ERROR;
}
else
{
return JTAG_CORE_MEM_ERROR;
}
}
char * jtagcore_getEnvVar( jtag_core * jc, char * varname, char * varvalue)
{
return getEnvVarDat( jc->envvar, varname, varvalue, 512 );
}
char * jtagcore_getEnvVarIndex( jtag_core * jc, int index, char * varvalue)
{
return getEnvVarDatIndex( jc->envvar, index, varvalue, 512 );
}
int jtagcore_getEnvVarValue( jtag_core * jc, char * varname)
{
return getEnvVarValue( jc->envvar, varname);
}
void jtagcore_deinit(jtag_core * jc)
{
if( jc )

View File

@@ -1,6 +1,5 @@
#ifndef _JTAG_CORE_H
#define _JTAG_CORE_H
/*
* JTAG Core library
* Copyright (c) 2008 - 2024 Viveris Technologies
@@ -26,103 +25,83 @@
* @author Jean-François DEL NERO <Jean-Francois.DELNERO@viveris.fr>
*/
#ifndef _jtag_core_
typedef void jtag_core;
#define _jtag_core_
#endif
#include "config/bs_defines.h"
#ifndef _script_ctx_
typedef void script_ctx;
#define _script_ctx_
#endif
#define JTAG_STR_DOUT 0x01
#define JTAG_STR_TMS 0x02
#define JTAG_STR_CLKDIS 0x04
#define JTAG_STR_JTAGRST 0x08
#define JTAG_STR_DIN 0x10
#define JTAG_STR_DINREQ 0x20
#ifndef _jtag_emu_
typedef void jtag_emu;
#define _jtag_emu_
#endif
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Functions Error / return codes
#define JTAG_CORE_NO_ERROR 0
#define JTAG_CORE_BAD_PARAMETER -1
#define JTAG_CORE_ACCESS_ERROR -2
#define JTAG_CORE_IO_ERROR -3
#define JTAG_CORE_MEM_ERROR -4
#define JTAG_CORE_NO_PROBE -5
#define JTAG_CORE_NOT_FOUND -6
#define JTAG_CORE_CMD_NOT_FOUND -7
#define JTAG_CORE_INTERNAL_ERROR -8
#define JTAG_CORE_BAD_CMD -9
#define JTAG_CORE_I2C_BUS_NOTFREE -10
int jtagcore_loaddriver(jtag_core *jc, int id, char *parameters);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Lib init functions
// jtagcore_init : Library alloc and init
jtag_core * jtagcore_init();
jtag_core *jtagcore_init();
// jtagcore_init : Library dealloc and deinit
void jtagcore_deinit(jtag_core * jc);
void jtagcore_deinit(jtag_core *jc);
#ifndef _JTAGCORE_PRINT_FUNC_
typedef void (*JTAGCORE_PRINT_FUNC)(jtag_core * jc, const char * string);
typedef void (*JTAGCORE_PRINT_FUNC)(jtag_core *jc, const char *string);
#define _JTAGCORE_PRINT_FUNC_
#endif
int jtagcore_set_logs_callback(jtag_core * jc, JTAGCORE_PRINT_FUNC jtag_core_print);
int jtagcore_set_logs_level(jtag_core * jc,int level);
int jtagcore_get_logs_level(jtag_core * jc);
int jtagcore_set_logs_file(jtag_core * jc,char * path);
char * jtagcore_get_logs_file(jtag_core * jc);
int jtagcore_set_logs_callback(jtag_core *jc, JTAGCORE_PRINT_FUNC jtag_core_print);
int jtagcore_set_logs_level(jtag_core *jc, int level);
int jtagcore_get_logs_level(jtag_core *jc);
int jtagcore_set_logs_file(jtag_core *jc, char *path);
char *jtagcore_get_logs_file(jtag_core *jc);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Probe driver selection/initialisation functions
// jtagcore_get_number_of_probes_drv : Return the "number of supported probes"
int jtagcore_get_number_of_probes_drv(jtag_core * jc);
int jtagcore_get_number_of_probes(jtag_core * jc, int probe_driver_id);
int jtagcore_get_number_of_probes_drv(jtag_core *jc);
int jtagcore_get_number_of_probes(jtag_core *jc, int probe_driver_id);
#define PROBE_ID(drv_id,probe_index) ( (drv_id<<8) | probe_index )
#define PROBE_ID(drv_id, probe_index) ((drv_id << 8) | probe_index)
// jtagcore_get_probe_name : Return the probe name (probe_id should be between 0 and "number of supported probes" - 1)
int jtagcore_get_probe_name(jtag_core * jc, int probe_id,char * name);
int jtagcore_get_probe_name(jtag_core *jc, int probe_id, char *name);
// jtagcore_select_and_open_probe : Try to init the probe (probe_id should be between 0 and "number of supported probes" - 1)
int jtagcore_select_and_open_probe(jtag_core * jc, int probe_id);
int jtagcore_select_and_open_probe(jtag_core *jc, int probe_id);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// JTAG Chain init functions
// jtagcore_scan_and_init_chain : Scan and init the chain (devices detection)
int jtagcore_scan_and_init_chain(jtag_core * jc);
int jtagcore_scan_and_init_chain(jtag_core *jc);
// jtagcore_get_number_of_devices : return "the number of devices into the chain" found by jtagcore_scan_and_init_chain
int jtagcore_get_number_of_devices(jtag_core * jc);
int jtagcore_get_number_of_devices(jtag_core *jc);
// jtagcore_get_dev_id : Return the device chip ID
// "device" should be between 0 and "the number of devices into the chain" - 1
unsigned long jtagcore_get_dev_id(jtag_core * jc, int device);
unsigned long jtagcore_get_dev_id(jtag_core *jc, int device);
// jtagcore_loadbsdlfile : Load/attach a bsdl file to a device into the chain
// "device" should be between 0 and "the number of devices into the chain" - 1
int jtagcore_loadbsdlfile(jtag_core * jc, char * path, int device);
int jtagcore_loadbsdlfile(jtag_core *jc, char *path, int device);
// jtagcore_get_dev_name : Get the currently loaded bsdl name & path
// "device" should be between 0 and "the number of devices into the chain" - 1
int jtagcore_get_dev_name(jtag_core * jc, int device, char * devname, char * bsdlpath);
int jtagcore_get_dev_name(jtag_core *jc, int device, char *devname, char *bsdlpath);
// jtagcore_get_bsdl_id : Return the chip id present into a bsdl file
unsigned long jtagcore_get_bsdl_id(jtag_core * jc, char * path, unsigned long * mask);
unsigned long jtagcore_get_bsdl_id(jtag_core *jc, char *path, unsigned long *mask);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Pins/IO access functions
@@ -131,7 +110,7 @@ unsigned long jtagcore_get_bsdl_id(jtag_core * jc, char * path, unsigned long *
// "device" should be between 0 and "the number of devices into the chain" - 1
// and a bsdl must be attached to this device
int jtagcore_get_number_of_pins(jtag_core * jc,int device);
int jtagcore_get_number_of_pins(jtag_core *jc, int device);
// jtagcore_get_pin_properties : Return the pin properties
// "device" should be between 0 and "the number of devices into the chain" - 1
@@ -139,34 +118,34 @@ int jtagcore_get_number_of_pins(jtag_core * jc,int device);
// "pin" should be between 0 and "number of pins of a device" - 1
// "type" return is a mask between JTAG_CORE_PIN_IS_INPUT / JTAG_CORE_PIN_IS_OUTPUT / JTAG_CORE_PIN_IS_TRISTATES states
int jtagcore_get_pin_properties(jtag_core * jc, int device, int pin, char * pinname, int maxsize, int * type);
int jtagcore_get_pin_properties(jtag_core *jc, int device, int pin, char *pinname, int maxsize, int *type);
#define JTAG_CORE_PIN_IS_INPUT 0x01
#define JTAG_CORE_PIN_IS_OUTPUT 0x02
#define JTAG_CORE_PIN_IS_INPUT 0x01
#define JTAG_CORE_PIN_IS_OUTPUT 0x02
#define JTAG_CORE_PIN_IS_TRISTATES 0x04
// jtagcore_get_pin_id : Find and return a pin id (if exist) from the pin name
// "device" should be between 0 and "the number of devices into the chain" - 1
int jtagcore_get_pin_id(jtag_core * jc, int device, char * pinname);
int jtagcore_get_pin_id(jtag_core *jc, int device, char *pinname);
// jtagcore_get_pin_state : Return the current pin state
// "device" should be between 0 and "the number of devices into the chain" - 1
// "pin" should be between 0 and "number of pins of a device" - 1
// "type" should be set to JTAG_CORE_INPUT or JTAG_CORE_OUTPUT or JTAG_CORE_OE
int jtagcore_get_pin_state(jtag_core * jc, int device, int pin, int type);
int jtagcore_get_pin_state(jtag_core *jc, int device, int pin, int type);
// jtagcore_set_pin_state : Set the pin state
// "device" should be between 0 and "the number of devices into the chain" - 1
// "pin" should be between 0 and "number of pins of a device" - 1
// "type" should be set to JTAG_CORE_INPUT or JTAG_CORE_OUTPUT or JTAG_CORE_OE
int jtagcore_set_pin_state(jtag_core * jc, int device, int pin, int type, int state);
int jtagcore_set_pin_state(jtag_core *jc, int device, int pin, int type, int state);
#define JTAG_CORE_INPUT 0x01
#define JTAG_CORE_OUTPUT 0x02
#define JTAG_CORE_OE 0x04
#define JTAG_CORE_INPUT 0x01
#define JTAG_CORE_OUTPUT 0x02
#define JTAG_CORE_OE 0x04
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Scan chain functions
@@ -174,18 +153,18 @@ int jtagcore_set_pin_state(jtag_core * jc, int device, int pin, int type, int st
// jtagcore_set_scan_mode : Set the scan mode for a particular device
// "device" should be between 0 and "the number of devices into the chain" - 1
// "scan_mode" should be set to JTAG_CORE_SAMPLE_SCANMODE (observation only) or JTAG_CORE_EXTEST_SCANMODE (full pin control)
int jtagcore_set_scan_mode(jtag_core * jc, int device, int scan_mode);
int jtagcore_set_scan_mode(jtag_core *jc, int device, int scan_mode);
// JTAG Scan mode
#define JTAG_CORE_SAMPLE_SCANMODE 0x00
#define JTAG_CORE_EXTEST_SCANMODE 0x01
#define JTAG_CORE_SAMPLE_SCANMODE 0x00
#define JTAG_CORE_EXTEST_SCANMODE 0x01
// jtagcore_push_and_pop_chain : Do a JTAG chain transaction.
// "mode" should be set to JTAG_CORE_WRITE_READ (Push/write and pop/read the chain) or JTAG_CORE_WRITE_ONLY (only Push/write the chain)
int jtagcore_push_and_pop_chain(jtag_core * jc, int mode);
int jtagcore_push_and_pop_chain(jtag_core *jc, int mode);
#define JTAG_CORE_WRITE_READ 0x00
#define JTAG_CORE_WRITE_ONLY 0x01
#define JTAG_CORE_WRITE_READ 0x00
#define JTAG_CORE_WRITE_ONLY 0x01
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// I2C over JTAG API functions
@@ -194,21 +173,20 @@ int jtagcore_push_and_pop_chain(jtag_core * jc, int mode);
// "device" should be between 0 and "the number of devices into the chain" - 1
// "pin" should be between 0 and "number of pins of a device" - 1
int jtagcore_i2c_set_scl_pin(jtag_core * jc, int device, int pin);
int jtagcore_i2c_set_scl_pin(jtag_core *jc, int device, int pin);
// jtagcore_i2c_set_sda_pin : Select the SDA pin
// "device" should be between 0 and "the number of devices into the chain" - 1
// "pin" should be between 0 and "number of pins of a device" - 1
int jtagcore_i2c_set_sda_pin(jtag_core * jc, int device, int pin);
int jtagcore_i2c_set_sda_pin(jtag_core *jc, int device, int pin);
// jtagcore_i2c_write_read : Do an I2C transfert
// "address" : I2C address (8 bits aligned)
// "address10bits" != 0 if this is an 10bits address
// "wr_size" write size
// "rd_size" read size
int jtagcore_i2c_write_read(jtag_core * jc, int address, int address10bits,int wr_size,unsigned char * wr_buffer,int rd_size,unsigned char * rd_buffer);
int jtagcore_i2c_write_read(jtag_core *jc, int address, int address10bits, int wr_size, unsigned char *wr_buffer, int rd_size, unsigned char *rd_buffer);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// SPI over JTAG API functions
@@ -217,34 +195,34 @@ int jtagcore_i2c_write_read(jtag_core * jc, int address, int address10bits,int w
// "device" should be between 0 and "the number of devices into the chain" - 1
// "pin" should be between 0 and "number of pins of a device" - 1
int jtagcore_spi_set_cs_pin(jtag_core * jc, int device, int pin, int polarity);
int jtagcore_spi_set_cs_pin(jtag_core *jc, int device, int pin, int polarity);
// jtagcore_spi_set_clk_pin : Select the CLK pin
// "device" should be between 0 and "the number of devices into the chain" - 1
// "pin" should be between 0 and "number of pins of a device" - 1
int jtagcore_spi_set_clk_pin(jtag_core * jc, int device, int pin, int polarity);
int jtagcore_spi_set_clk_pin(jtag_core *jc, int device, int pin, int polarity);
// jtagcore_spi_set_miso_pin : Select the MISO pin
// "device" should be between 0 and "the number of devices into the chain" - 1
// "pin" should be between 0 and "number of pins of a device" - 1
int jtagcore_spi_set_miso_pin(jtag_core * jc, int device, int pin, int sample_clk_phase);
int jtagcore_spi_set_miso_pin(jtag_core *jc, int device, int pin, int sample_clk_phase);
// jtagcore_spi_set_mosi_pin : Select the MOSI pin
// "device" should be between 0 and "the number of devices into the chain" - 1
// "pin" should be between 0 and "number of pins of a device" - 1
int jtagcore_spi_set_mosi_pin(jtag_core * jc, int device, int pin, int sample_clk_phase);
int jtagcore_spi_set_mosi_pin(jtag_core *jc, int device, int pin, int sample_clk_phase);
// jtagcore_spi_write_read : Do a SPI transfert
// "wr_size" is the transaction size
int jtagcore_spi_write_read(jtag_core * jc, int wr_size,unsigned char * wr_buffer,unsigned char * rd_buffer, int flags);
int jtagcore_spi_write_read(jtag_core *jc, int wr_size, unsigned char *wr_buffer, unsigned char *rd_buffer, int flags);
// jtagcore_spi_set_bitorder : Select MSB/LSB first mode
int jtagcore_spi_set_bitorder(jtag_core * jc, int lsb_first);
int jtagcore_spi_set_bitorder(jtag_core *jc, int lsb_first);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// MDIO over JTAG API functions
@@ -253,96 +231,40 @@ int jtagcore_spi_set_bitorder(jtag_core * jc, int lsb_first);
// "device" should be between 0 and "the number of devices into the chain" - 1
// "pin" should be between 0 and "number of pins of a device" - 1
int jtagcore_mdio_set_mdio_pin(jtag_core * jc, int device, int pin);
int jtagcore_mdio_set_mdio_pin(jtag_core *jc, int device, int pin);
// jtagcore_mdio_set_mdc_pin : Select the MDC pin
// "device" should be between 0 and "the number of devices into the chain" - 1
// "pin" should be between 0 and "number of pins of a device" - 1
int jtagcore_mdio_set_mdc_pin(jtag_core * jc, int device, int pin);
int jtagcore_mdio_set_mdc_pin(jtag_core *jc, int device, int pin);
// jtagcore_mdio_read : Read to an MDIO register
// phy_adr : Phylayer address
// reg_adr : Register address
int jtagcore_mdio_read(jtag_core * jc, int phy_adr, int reg_adr);
int jtagcore_mdio_read(jtag_core *jc, int phy_adr, int reg_adr);
// jtagcore_mdio_write : Write to an MDIO register
// phy_adr : Phylayer address
// reg_adr : Register address
// data : data value to write
int jtagcore_mdio_write(jtag_core * jc, int phy_adr, int reg_adr, int data);
int jtagcore_mdio_write(jtag_core *jc, int phy_adr, int reg_adr, int data);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Parallel Memory over JTAG API functions
#define JTAG_CORE_RAM_CS_CTRL 0x00
#define JTAG_CORE_RAM_WR_CTRL 0x01
#define JTAG_CORE_RAM_RD_CTRL 0x02
#define JTAG_CORE_RAM_RW_CTRL 0x03
#define JTAG_CORE_RAM_CS_CTRL 0x00
#define JTAG_CORE_RAM_WR_CTRL 0x01
#define JTAG_CORE_RAM_RD_CTRL 0x02
#define JTAG_CORE_RAM_RW_CTRL 0x03
int jtagcore_memory_clear_pins(jtag_core * jc);
int jtagcore_memory_set_address_pin(jtag_core * jc, int address_bit, int device, int pin);
int jtagcore_memory_set_data_pin(jtag_core * jc, int data_bit, int device, int pin);
int jtagcore_memory_set_ctrl_pin(jtag_core * jc, int ctrl, int polarity, int device, int pin);
unsigned long jtagcore_memory_read(jtag_core * jc, int mem_adr);
int jtagcore_memory_write(jtag_core * jc, int mem_adr, unsigned long data);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal variables functions
int jtagcore_setEnvVar( jtag_core * jc, char * varname, char * varvalue );
char * jtagcore_getEnvVar( jtag_core * jc, char * varname, char * varvalue);
int jtagcore_getEnvVarValue( jtag_core * jc, char * varname);
char * jtagcore_getEnvVarIndex( jtag_core * jc, int index, char * varvalue);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Script execution functions
#define DEFAULT_BUFLEN 1024
// Output message types/levels
enum MSGTYPE
{
MSG_DEBUG = 0,
MSG_INFO_0,
MSG_INFO_1,
MSG_WARNING,
MSG_ERROR,
MSG_NONE
};
#ifndef _jtag_script_printf_func_
typedef int (* SCRIPT_PRINTF_FUNC)(void * ctx, int MSGTYPE, char * string, ... );
#define _jtag_script_printf_func_
#endif
script_ctx * jtagcore_initScript(jtag_core * jc);
void jtagcore_setScriptOutputFunc( script_ctx * ctx, SCRIPT_PRINTF_FUNC ext_printf );
int jtagcore_execScriptLine( script_ctx * ctx, char * line );
int jtagcore_execScriptFile( script_ctx * ctx, char * script_path );
int jtagcore_execScriptRam( script_ctx * ctx, unsigned char * script_buffer, int buffersize );
script_ctx * jtagcore_deinitScript( script_ctx * ctx );
int jtagcore_savePinsStateScript( jtag_core * jc, int device, char * script_path );
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// JTAG Emulation layer (WIP)
#if 0
jtag_emu * jtagemu_init(jtag_core * jc);
int jtagemu_reset(jtag_emu * je);
int jtagemu_tick(jtag_emu * je, unsigned char io_state);
int jtagemu_get_regbit_state(jtag_emu * je, int regid, int bit);
int jtagemu_loadbsdlfile(jtag_emu * je, char * path, int device);
void jtagemu_deinit(jtag_emu * je);
#endif
int jtagcore_memory_clear_pins(jtag_core *jc);
int jtagcore_memory_set_address_pin(jtag_core *jc, int address_bit, int device, int pin);
int jtagcore_memory_set_data_pin(jtag_core *jc, int data_bit, int device, int pin);
int jtagcore_memory_set_ctrl_pin(jtag_core *jc, int ctrl, int polarity, int device, int pin);
unsigned long jtagcore_memory_read(jtag_core *jc, int mem_adr);
int jtagcore_memory_write(jtag_core *jc, int mem_adr, unsigned long data);
#endif

View File

@@ -1,155 +0,0 @@
/*
* JTAG Core library
* Copyright (c) 2008 - 2024 Viveris Technologies
*
* JTAG Core library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* JTAG Core library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with JTAG Core library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file jtag_core_internal.h
* @brief jtag core library internal structures and defines types
* @author Jean-François DEL NERO <Jean-Francois.DELNERO@viveris.fr>
*/
#define _jtag_core_
#define MAX_NB_JTAG_DEVICE 64
#define MAX_NUMBER_BITS_IN_CHAIN ( 256 * 1024 )
#define MAX_NUMBER_PINS_PER_DEV ( 64 * 1024 )
#define MAX_BSDL_FILE_SIZE ( 1024 * 1024 )
#define MAX_NUMBER_OF_BSDL_LINES ( 64 * 1024 )
#define MAX_PATH_LEN 4096
typedef struct _jtag_device
{
void * bsdl;
unsigned long devices_id;
unsigned char * out_boundary_scan;
unsigned char * in_boundary_scan;
int boundary_scan_size;
int scan_mode;
}jtag_device;
#define MAX_BUS_WIDTH 32
typedef struct _jtag_core
{
drv_ptr io_functions;
void * jtagcore_print_callback;
int logs_level;
void * envvar;
int t;
int nb_of_devices_in_chain;
int total_IR_lenght;
jtag_device devices_list[MAX_NB_JTAG_DEVICE];
int IR_filled;
// I2C over JTAG
int i2c_sda_device;
int i2c_scl_device;
int i2c_sda_pin;
int i2c_scl_pin;
// SPI over JTAG
int spi_mosi_device;
int spi_miso_device;
int spi_cs_device;
int spi_clk_device;
int spi_mosi_pin;
int spi_miso_pin;
int spi_cs_pin;
int spi_clk_pin;
int spi_cs_pol;
int spi_clk_pol;
int spi_mosi_pol;
int spi_miso_pol;
int spi_lsb_first;
// MDIO over JTAG
int mdio_mdc_pin;
int mdio_mdc_device;
int mdio_mdio_pin;
int mdio_mdio_device;
// Memory over JTAG
int ram_address_pin[MAX_BUS_WIDTH];
int ram_address_device[MAX_BUS_WIDTH];
int ram_data_pin[MAX_BUS_WIDTH];
int ram_data_device[MAX_BUS_WIDTH];
int ram_ctrl_pin[16];
int ram_ctrl_pin_pol[16];
int ram_ctrl_device[16];
char log_file_path[MAX_PATH_LEN];
}jtag_core;
#define JTAG_STR_DOUT 0x01
#define JTAG_STR_TMS 0x02
#define JTAG_STR_CLKDIS 0x04
#define JTAG_STR_JTAGRST 0x08
#define JTAG_STR_DIN 0x10
#define JTAG_STR_DINREQ 0x20
int jtagcore_loaddriver(jtag_core * jc,int id, char * parameters);
// jtag device emulator
#define _jtag_emu_
typedef struct _jtag_emu
{
jtag_core * jc;
void * bsdl_file;
unsigned char * out_boundary_scan;
unsigned char * in_boundary_scan;
unsigned char * data_register;
unsigned char * inst_register;
int jtag_state_machine;
}jtag_emu;
enum
{
JTAG_EMU_STATE_RESET = 0,
JTAG_EMU_STATE_IDLE,
JTAG_EMU_STATE_SEL_DR_SCAN,
JTAG_EMU_STATE_CAPTURE_DR,
JTAG_EMU_STATE_SHIFT_DR,
JTAG_EMU_STATE_EXIT1_DR,
JTAG_EMU_STATE_PAUSE_DR,
JTAG_EMU_STATE_EXIT2_DR,
JTAG_EMU_STATE_UPDATE_DR,
JTAG_EMU_STATE_SEL_IR_SCAN,
JTAG_EMU_STATE_CAPTURE_IR,
JTAG_EMU_STATE_SHIFT_IR,
JTAG_EMU_STATE_EXIT1_IR,
JTAG_EMU_STATE_PAUSE_IR,
JTAG_EMU_STATE_EXIT2_IR,
JTAG_EMU_STATE_UPDATE_IR
};

View File

@@ -1,3 +1,6 @@
#ifndef _STRNATCMP_H
#define _STRNATCMP_H
/* -*- mode: c; c-file-style: "k&r" -*-
strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
@@ -29,3 +32,5 @@ typedef char nat_char;
int strnatcmp(nat_char const *a, nat_char const *b);
int strnatcasecmp(nat_char const *a, nat_char const *b);
#endif

View File

@@ -1,3 +1,5 @@
#ifndef _OS_INTERFACE_H
#define _OS_INTERFACE_H
/*
* JTAG Boundary Scanner
* Copyright (c) 2008 - 2024 Viveris Technologies
@@ -116,3 +118,5 @@ int network_close(void * network_connection);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -28,6 +28,7 @@
#include <stdio.h>
#include <stdint.h>
#include "config/bs_defines.h"
#include "env.h"
/*
@@ -547,6 +548,33 @@ envvar_entry * initEnv(envvar_entry * src, envvar_entry * dst)
return NULL;
}
int jtagcore_setEnvVar( jtag_core * jc, char * varname, char * varvalue )
{
if( setEnvVarDat( jc->envvar, varname, varvalue ) >= 0 )
{
return JTAG_CORE_NO_ERROR;
}
else
{
return JTAG_CORE_MEM_ERROR;
}
}
char * jtagcore_getEnvVar( jtag_core * jc, char * varname, char * varvalue)
{
return getEnvVarDat( jc->envvar, varname, varvalue, 512 );
}
char * jtagcore_getEnvVarIndex( jtag_core * jc, int index, char * varvalue)
{
return getEnvVarDatIndex( jc->envvar, index, varvalue, 512 );
}
int jtagcore_getEnvVarValue( jtag_core * jc, char * varname)
{
return getEnvVarValue( jc->envvar, varname);
}
void deinitEnv(envvar_entry * env)
{
#ifndef STATIC_ENV_BUFFER

View File

@@ -1,3 +1,5 @@
#ifndef _ENV_H
#define _ENV_H
/*
* JTAG Boundary Scanner
* Copyright (c) 2008 - 2024 Viveris Technologies
@@ -22,6 +24,9 @@
* @brief Internal variables support header file.
* @author Jean-François DEL NERO <Jean-Francois.DELNERO@viveris.fr>
*/
#include "config/bs_defines.h"
#ifdef SCRIPT_64BITS_SUPPORT
#define env_var_value uint64_t
#define signed_env_var_value int64_t
@@ -58,3 +63,12 @@ env_var_value getEnvVarValue( envvar_entry * env, char * varname );
char * getEnvVarDatIndex( envvar_entry * env, int index, char * vardata, int maxsize );
void deinitEnv( envvar_entry * env );
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal variables functions
int jtagcore_setEnvVar(jtag_core *jc, char *varname, char *varvalue);
char *jtagcore_getEnvVar(jtag_core *jc, char *varname, char *varvalue);
int jtagcore_getEnvVarValue(jtag_core *jc, char *varname);
char *jtagcore_getEnvVarIndex(jtag_core *jc, int index, char *varvalue);
#endif

View File

@@ -31,11 +31,9 @@
#define MAX_PATH 256
#include "drivers/drv_loader.h"
#include "jtag_core/jtag_core_internal.h"
#include "script.h"
#include "jtag_core/jtag_core.h"
#include "jtag_core/version.h"
#include "config/version.h"
#include "bsdl_parser/bsdl_loader.h"
#include "os_interface/os_interface.h"
@@ -61,7 +59,7 @@ typedef struct label_list_
extern cmd_list script_commands_list[];
static int dummy_script_printf(void * ctx, int MSGTYPE, char * string, ... )
static int dummy_script_printf(script_ctx * ctx, int MSGTYPE, char * string, ... )
{
return 0;
}
@@ -2557,43 +2555,6 @@ script_ctx * jtagcore_initScript(jtag_core * jc)
return init_script((void*)jc,0x00000000,(void*)jc->envvar);
}
void jtagcore_setScriptOutputFunc( script_ctx * ctx, SCRIPT_PRINTF_FUNC ext_printf )
{
setOutputFunc_script(ctx, ext_printf);
}
int jtagcore_execScriptLine( script_ctx * ctx, char * line )
{
if(!ctx)
return JTAG_CORE_INTERNAL_ERROR;
return execute_line_script( ctx, line );
}
int jtagcore_execScriptFile( script_ctx * ctx, char * script_path )
{
if(!ctx)
return JTAG_CORE_INTERNAL_ERROR;
return execute_file_script( ctx, script_path );
}
int jtagcore_execScriptRam( script_ctx * ctx, unsigned char * script_buffer, int buffersize )
{
if(!ctx)
return JTAG_CORE_INTERNAL_ERROR;
return execute_ram_script( ctx, script_buffer, buffersize );
}
script_ctx * jtagcore_deinitScript(script_ctx * ctx)
{
if(!ctx)
return NULL;
return deinit_script(ctx);
}
int jtagcore_savePinsStateScript( jtag_core * jc, int device, char * script_path )
{
FILE * f;

View File

@@ -1,3 +1,5 @@
#ifndef _SCRIPT_H
#define _SCRIPT_H
/*
* JTAG Boundary Scanner
* Copyright (c) 2008 - 2024 Viveris Technologies
@@ -23,64 +25,15 @@
* @author Jean-François DEL NERO <Jean-Francois.DELNERO@viveris.fr>
*/
#define _script_ctx_
#ifndef _script_printf_func_
typedef int (* SCRIPT_PRINTF_FUNC)(void * ctx, int MSGTYPE, char * string, ... );
#define _script_printf_func_
#endif
#ifdef SCRIPT_64BITS_SUPPORT
#define env_var_value uint64_t
#define STRTOVALUE strtoull
#define LONGHEXSTR "%llX"
#else
#define env_var_value uint32_t
#define STRTOVALUE strtoul
#define LONGHEXSTR "%.8X"
#endif
#define MAX_LABEL_SIZE 64
#define MAX_LABEL 256
typedef struct _script_label
{
char label_name[MAX_LABEL_SIZE];
unsigned int offset;
} script_label;
typedef struct _script_ctx
{
SCRIPT_PRINTF_FUNC script_printf;
void * app_ctx;
void * env;
void * cmdlist;
FILE * script_file;
char script_file_path[1024];
int cur_label_index;
script_label labels[MAX_LABEL];
int cur_script_offset;
int dry_run;
int last_error_code;
env_var_value last_data_value;
int last_flags;
char pre_command[1024 + 32];
uint32_t rand_seed;
} script_ctx;
#include "config/bs_defines.h"
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 );
int execute_line_script( script_ctx * ctx, char * line );
int execute_ram_script( script_ctx * ctx, unsigned char * script_buffer, int buffersize );
void setOutputFunc_script( script_ctx * ctx, SCRIPT_PRINTF_FUNC ext_printf );
script_ctx * deinit_script(script_ctx * ctx);
int jtagcore_savePinsStateScript(jtag_core *jc, int device, char *script_path);
#endif