#include "log.h"
/* configuration */
-u16 amt_jtagaccel_port;
+static u16 amt_jtagaccel_port;
/* interface variables
*/
#if PARPORT_USE_PPDEV == 1
static int device_handle;
-int addr_mode = IEEE1284_MODE_EPP | IEEE1284_ADDR ;
-int data_mode = IEEE1284_MODE_EPP | IEEE1284_DATA ;
+
+static int addr_mode = IEEE1284_MODE_EPP | IEEE1284_ADDR ;
#define AMT_AW(val) do { ioctl(device_handle, PPSETMODE, &addr_mode); write(device_handle, &val, 1); } while (0)
#define AMT_AR(val) do { ioctl(device_handle, PPSETMODE, &addr_mode); read(device_handle, &val, 1); } while (0)
+
+static int data_mode = IEEE1284_MODE_EPP | IEEE1284_DATA ;
#define AMT_DW(val) do { ioctl(device_handle, PPSETMODE, &data_mode); write(device_handle, &val, 1); } while (0)
#define AMT_DR(val) do { ioctl(device_handle, PPSETMODE, &data_mode); read(device_handle, &val, 1); } while (0)
+
#else
+
#define AMT_AW(val) do { outb(val, amt_jtagaccel_port + 3); } while (0)
#define AMT_AR(val) do { val = inb(amt_jtagaccel_port + 3); } while (0)
#define AMT_DW(val) do { outb(val, amt_jtagaccel_port + 4); } while (0)
#define AMT_DR(val) do { val = inb(amt_jtagaccel_port + 4); } while (0)
-#endif
-int amt_jtagaccel_execute_queue(void);
-int amt_jtagaccel_register_commands(struct command_context_s *cmd_ctx);
-int amt_jtagaccel_speed(int speed);
-int amt_jtagaccel_init(void);
-int amt_jtagaccel_quit(void);
+#endif // PARPORT_USE_PPDEV
+
+static int amt_jtagaccel_execute_queue(void);
+static int amt_jtagaccel_register_commands(struct command_context_s *cmd_ctx);
+static int amt_jtagaccel_speed(int speed);
+static int amt_jtagaccel_init(void);
+static int amt_jtagaccel_quit(void);
-int amt_jtagaccel_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int amt_jtagaccel_handle_rtck_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int amt_jtagaccel_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int amt_jtagaccel_handle_rtck_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
/* tap_move[i][j]: tap movement command to go from state i to state j
* 0: Test-Logic-Reset
* 4: Shift-IR
* 5: Pause-IR
*/
-u8 amt_jtagaccel_tap_move[6][6][2] =
+static u8 amt_jtagaccel_tap_move[6][6][2] =
{
/* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */
{{0x1f, 0x00}, {0x0f, 0x00}, {0x8a, 0x04}, {0x0a, 0x00}, {0x06, 0x00}, {0x96, 0x00}}, /* RESET */
.quit = amt_jtagaccel_quit,
};
-int amt_jtagaccel_register_commands(struct command_context_s *cmd_ctx)
+static int amt_jtagaccel_register_commands(struct command_context_s *cmd_ctx)
{
register_command(cmd_ctx, NULL, "parport_port", amt_jtagaccel_handle_parport_port_command,
COMMAND_CONFIG, NULL);
return ERROR_OK;
}
-void amt_jtagaccel_reset(int trst, int srst)
+static void amt_jtagaccel_reset(int trst, int srst)
{
if (trst == 1)
aw_control_rst |= 0x4;
AMT_AW(aw_control_rst);
}
-int amt_jtagaccel_speed(int speed)
+static int amt_jtagaccel_speed(int speed)
{
aw_control_baudrate &= 0xf0;
aw_control_baudrate |= speed & 0x0f;
return ERROR_OK;
}
-void amt_jtagaccel_end_state(tap_state_t state)
+static void amt_jtagaccel_end_state(tap_state_t state)
{
if (tap_is_state_stable(state))
tap_set_end_state(state);
}
}
-void amt_wait_scan_busy(void)
+static void amt_wait_scan_busy(void)
{
int timeout = 4096;
u8 ar_status;
}
}
-void amt_jtagaccel_state_move(void)
+static void amt_jtagaccel_state_move(void)
{
u8 aw_scan_tms_5;
u8 tms_scan[2];
tap_set_state(end_state);
}
-void amt_jtagaccel_runtest(int num_cycles)
+static void amt_jtagaccel_runtest(int num_cycles)
{
int i = 0;
u8 aw_scan_tms_5;
amt_jtagaccel_state_move();
}
-void amt_jtagaccel_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size)
+static void amt_jtagaccel_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size)
{
int bits_left = scan_size;
int bit_count = 0;
tap_set_state(tap_get_end_state());
}
-int amt_jtagaccel_execute_queue(void)
+static int amt_jtagaccel_execute_queue(void)
{
jtag_command_t *cmd = jtag_command_queue; /* currently processed command */
int scan_size;
}
#endif
-int amt_jtagaccel_init(void)
+static int amt_jtagaccel_init(void)
{
#if PARPORT_USE_PPDEV == 1
char buffer[256];
return ERROR_OK;
}
-int amt_jtagaccel_quit(void)
+static int amt_jtagaccel_quit(void)
{
return ERROR_OK;
}
-int amt_jtagaccel_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int amt_jtagaccel_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc == 0)
return ERROR_OK;
return ERROR_OK;
}
-int amt_jtagaccel_handle_rtck_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int amt_jtagaccel_handle_rtck_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc == 0)
{
static u8 usb_out_buffer[ARMJTAGEW_OUT_BUFFER_SIZE];
/* External interface functions */
-int armjtagew_execute_queue(void);
-int armjtagew_speed(int speed);
-int armjtagew_khz(int khz, int *jtag_speed);
-int armjtagew_register_commands(struct command_context_s *cmd_ctx);
-int armjtagew_init(void);
-int armjtagew_quit(void);
+static int armjtagew_execute_queue(void);
+static int armjtagew_speed(int speed);
+static int armjtagew_khz(int khz, int *jtag_speed);
+static int armjtagew_register_commands(struct command_context_s *cmd_ctx);
+static int armjtagew_init(void);
+static int armjtagew_quit(void);
/* CLI command handler functions */
-int armjtagew_handle_armjtagew_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int armjtagew_handle_armjtagew_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
/* Queue command functions */
-void armjtagew_end_state(tap_state_t state);
-void armjtagew_state_move(void);
-void armjtagew_path_move(int num_states, tap_state_t *path);
-void armjtagew_runtest(int num_cycles);
-void armjtagew_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command);
-void armjtagew_reset(int trst, int srst);
-void armjtagew_simple_command(u8 command);
-int armjtagew_get_status(void);
+static void armjtagew_end_state(tap_state_t state);
+static void armjtagew_state_move(void);
+static void armjtagew_path_move(int num_states, tap_state_t *path);
+static void armjtagew_runtest(int num_cycles);
+static void armjtagew_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command);
+static void armjtagew_reset(int trst, int srst);
+//static void armjtagew_simple_command(u8 command);
+static int armjtagew_get_status(void);
/* tap buffer functions */
-void armjtagew_tap_init(void);
-int armjtagew_tap_execute(void);
-void armjtagew_tap_ensure_space(int scans, int bits);
-void armjtagew_tap_append_step(int tms, int tdi);
-void armjtagew_tap_append_scan(int length, u8 *buffer, scan_command_t *command);
+static void armjtagew_tap_init(void);
+static int armjtagew_tap_execute(void);
+static void armjtagew_tap_ensure_space(int scans, int bits);
+static void armjtagew_tap_append_step(int tms, int tdi);
+static void armjtagew_tap_append_scan(int length, u8 *buffer, scan_command_t *command);
/* ARM-JTAG-EW lowlevel functions */
typedef struct armjtagew_jtag
struct usb_dev_handle* usb_handle;
} armjtagew_jtag_t;
-armjtagew_jtag_t *armjtagew_usb_open(void);
-void armjtagew_usb_close(armjtagew_jtag_t *armjtagew_jtag);
-int armjtagew_usb_message(armjtagew_jtag_t *armjtagew_jtag, int out_length, int in_length);
-int armjtagew_usb_write(armjtagew_jtag_t *armjtagew_jtag, int out_length);
-int armjtagew_usb_read(armjtagew_jtag_t *armjtagew_jtag, int exp_in_length);
+static armjtagew_jtag_t *armjtagew_usb_open(void);
+static void armjtagew_usb_close(armjtagew_jtag_t *armjtagew_jtag);
+static int armjtagew_usb_message(armjtagew_jtag_t *armjtagew_jtag, int out_length, int in_length);
+static int armjtagew_usb_write(armjtagew_jtag_t *armjtagew_jtag, int out_length);
+static int armjtagew_usb_read(armjtagew_jtag_t *armjtagew_jtag, int exp_in_length);
/* helper functions */
-int armjtagew_get_version_info(void);
+static int armjtagew_get_version_info(void);
#ifdef _DEBUG_USB_COMMS_
-void armjtagew_debug_buffer(u8 *buffer, int length);
+static void armjtagew_debug_buffer(u8 *buffer, int length);
#endif
-armjtagew_jtag_t* armjtagew_jtag_handle;
+static armjtagew_jtag_t* armjtagew_jtag_handle;
};
-int armjtagew_execute_queue(void)
+static int armjtagew_execute_queue(void)
{
jtag_command_t *cmd = jtag_command_queue;
int scan_size;
/* Sets speed in kHz. */
-int armjtagew_speed(int speed)
+static int armjtagew_speed(int speed)
{
int result;
int speed_real;
}
-int armjtagew_khz(int khz, int *jtag_speed)
+static int armjtagew_khz(int khz, int *jtag_speed)
{
*jtag_speed = khz;
return ERROR_OK;
}
-int armjtagew_register_commands(struct command_context_s *cmd_ctx)
+static int armjtagew_register_commands(struct command_context_s *cmd_ctx)
{
register_command(cmd_ctx, NULL, "armjtagew_info", armjtagew_handle_armjtagew_info_command, COMMAND_EXEC,
"query armjtagew info");
return ERROR_OK;
}
-int armjtagew_init(void)
+static int armjtagew_init(void)
{
int check_cnt;
return ERROR_OK;
}
-int armjtagew_quit(void)
+static int armjtagew_quit(void)
{
armjtagew_usb_close(armjtagew_jtag_handle);
return ERROR_OK;
/***************************************************************************/
/* Queue command implementations */
-void armjtagew_end_state(tap_state_t state)
+static void armjtagew_end_state(tap_state_t state)
{
if (tap_is_state_stable(state))
{
}
/* Goes to the end state. */
-void armjtagew_state_move(void)
+static void armjtagew_state_move(void)
{
int i;
int tms = 0;
tap_set_state(tap_get_end_state());
}
-void armjtagew_path_move(int num_states, tap_state_t *path)
+static void armjtagew_path_move(int num_states, tap_state_t *path)
{
int i;
tap_set_end_state(tap_get_state());
}
-void armjtagew_runtest(int num_cycles)
+static void armjtagew_runtest(int num_cycles)
{
int i;
}
}
-void armjtagew_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command)
+static void armjtagew_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command)
{
tap_state_t saved_end_state;
}
}
-void armjtagew_reset(int trst, int srst)
+static void armjtagew_reset(int trst, int srst)
{
const u8 trst_mask = (1u<<5);
const u8 srst_mask = (1u<<6);
}
-int armjtagew_get_status(void)
+static int armjtagew_get_status(void)
{
int result;
return ERROR_OK;
}
-int armjtagew_get_version_info(void)
+static int armjtagew_get_version_info(void)
{
int result;
char sn[16];
return ERROR_OK;
}
-int armjtagew_handle_armjtagew_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int armjtagew_handle_armjtagew_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (armjtagew_get_version_info() == ERROR_OK)
{
static int last_tms;
-void armjtagew_tap_init(void)
+static void armjtagew_tap_init(void)
{
tap_length = 0;
pending_scan_results_length = 0;
}
-void armjtagew_tap_ensure_space(int scans, int bits)
+static void armjtagew_tap_ensure_space(int scans, int bits)
{
int available_scans = MAX_PENDING_SCAN_RESULTS - pending_scan_results_length;
int available_bits = ARMJTAGEW_TAP_BUFFER_SIZE * 8 - tap_length;
}
}
-void armjtagew_tap_append_step(int tms, int tdi)
+static void armjtagew_tap_append_step(int tms, int tdi)
{
last_tms = tms;
int index = tap_length / 8;
/* Pad and send a tap sequence to the device, and receive the answer.
* For the purpose of padding we assume that we are in idle or pause state. */
-int armjtagew_tap_execute(void)
+static int armjtagew_tap_execute(void)
{
int byte_length;
int tms_offset;
/*****************************************************************************/
/* JLink USB low-level functions */
-armjtagew_jtag_t* armjtagew_usb_open()
+static armjtagew_jtag_t* armjtagew_usb_open()
{
struct usb_bus *busses;
struct usb_bus *bus;
return NULL;
}
-void armjtagew_usb_close(armjtagew_jtag_t *armjtagew_jtag)
+static void armjtagew_usb_close(armjtagew_jtag_t *armjtagew_jtag)
{
usb_close(armjtagew_jtag->usb_handle);
free(armjtagew_jtag);
}
/* Send a message and receive the reply. */
-int armjtagew_usb_message(armjtagew_jtag_t *armjtagew_jtag, int out_length, int in_length)
+static int armjtagew_usb_message(armjtagew_jtag_t *armjtagew_jtag, int out_length, int in_length)
{
int result;
}
/* Write data from out_buffer to USB. */
-int armjtagew_usb_write(armjtagew_jtag_t *armjtagew_jtag, int out_length)
+static int armjtagew_usb_write(armjtagew_jtag_t *armjtagew_jtag, int out_length)
{
int result;
}
/* Read data from USB into in_buffer. */
-int armjtagew_usb_read(armjtagew_jtag_t *armjtagew_jtag, int exp_in_length)
+static int armjtagew_usb_read(armjtagew_jtag_t *armjtagew_jtag, int exp_in_length)
{
int result = usb_bulk_read(armjtagew_jtag->usb_handle, ARMJTAGEW_EPT_BULK_IN, \
(char*)usb_in_buffer, exp_in_length, ARMJTAGEW_USB_TIMEOUT);
#ifdef _DEBUG_USB_COMMS_
#define BYTES_PER_LINE 16
-void armjtagew_debug_buffer(u8 *buffer, int length)
+static void armjtagew_debug_buffer(u8 *buffer, int length)
{
char line[81];
char s[4];
/* low level command set
*/
-int at91rm9200_read(void);
-void at91rm9200_write(int tck, int tms, int tdi);
-void at91rm9200_reset(int trst, int srst);
+static int at91rm9200_read(void);
+static void at91rm9200_write(int tck, int tms, int tdi);
+static void at91rm9200_reset(int trst, int srst);
-int at91rm9200_speed(int speed);
-int at91rm9200_register_commands(struct command_context_s *cmd_ctx);
-int at91rm9200_init(void);
-int at91rm9200_quit(void);
+static int at91rm9200_speed(int speed);
+static int at91rm9200_register_commands(struct command_context_s *cmd_ctx);
+static int at91rm9200_init(void);
+static int at91rm9200_quit(void);
jtag_interface_t at91rm9200_interface =
{
.quit = at91rm9200_quit,
};
-bitbang_interface_t at91rm9200_bitbang =
+static bitbang_interface_t at91rm9200_bitbang =
{
.read = at91rm9200_read,
.write = at91rm9200_write,
.blink = 0
};
-int at91rm9200_read(void)
+static int at91rm9200_read(void)
{
return (pio_base[device->TDO_PIO + PIO_PDSR] & device->TDO_MASK) != 0;
}
-void at91rm9200_write(int tck, int tms, int tdi)
+static void at91rm9200_write(int tck, int tms, int tdi)
{
if (tck)
pio_base[device->TCK_PIO + PIO_SODR] = device->TCK_MASK;
}
/* (1) assert or (0) deassert reset lines */
-void at91rm9200_reset(int trst, int srst)
+static void at91rm9200_reset(int trst, int srst)
{
if (trst == 0)
pio_base[device->TRST_PIO + PIO_SODR] = device->TRST_MASK;
pio_base[device->SRST_PIO + PIO_CODR] = device->SRST_MASK;
}
-int at91rm9200_speed(int speed)
+static int at91rm9200_speed(int speed)
{
return ERROR_OK;
}
-int at91rm9200_handle_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int at91rm9200_handle_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc == 0)
return ERROR_OK;
return ERROR_OK;
}
-int at91rm9200_register_commands(struct command_context_s *cmd_ctx)
+static int at91rm9200_register_commands(struct command_context_s *cmd_ctx)
{
register_command(cmd_ctx, NULL, "at91rm9200_device", at91rm9200_handle_device_command,
COMMAND_CONFIG, NULL);
return ERROR_OK;
}
-int at91rm9200_init(void)
+static int at91rm9200_init(void)
{
struct device_t *cur_device;
return ERROR_OK;
}
-int at91rm9200_quit(void)
+static int at91rm9200_quit(void)
{
return ERROR_OK;
*/
#define CLOCK_IDLE() 0
-int bitbang_execute_queue(void);
-
/* The bitbang driver leaves the TCK 0 when in idle */
-
-void bitbang_end_state(tap_state_t state)
+static void bitbang_end_state(tap_state_t state)
{
if (tap_is_state_stable(state))
tap_set_end_state(state);
}
}
-void bitbang_state_move(void)
+static void bitbang_state_move(void)
{
int i=0, tms=0;
u8 tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state());
tap_set_state(tap_get_end_state());
}
-void bitbang_path_move(pathmove_command_t *cmd)
+static void bitbang_path_move(pathmove_command_t *cmd)
{
int num_states = cmd->num_states;
int state_count;
tap_set_end_state(tap_get_state());
}
-void bitbang_runtest(int num_cycles)
+static void bitbang_runtest(int num_cycles)
{
int i;
-void bitbang_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size)
+static void bitbang_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size)
{
tap_state_t saved_end_state = tap_get_end_state();
int bit_cnt;
bitq_interface_t* bitq_interface; /* low level bit queue interface */
-bitq_state_t bitq_in_state; /* state of input queue */
+static bitq_state_t bitq_in_state; /* state of input queue */
-u8* bitq_in_buffer; /* buffer dynamically reallocated as needed */
-int bitq_in_bufsize = 32; /* min. buffer size */
+static u8* bitq_in_buffer; /* buffer dynamically reallocated as needed */
+static int bitq_in_bufsize = 32; /* min. buffer size */
/*
* input queue processing does not use jtag_read_buffer() to avoid unnecessary overhead
static u32 dummy_data;\r
\r
\r
-int dummy_speed(int speed);\r
-int dummy_register_commands(struct command_context_s *cmd_ctx);\r
-int dummy_init(void);\r
-int dummy_quit(void);\r
+static int dummy_speed(int speed);\r
+static int dummy_register_commands(struct command_context_s *cmd_ctx);\r
+static int dummy_init(void);\r
+static int dummy_quit(void);\r
static int dummy_khz(int khz, int *jtag_speed);\r
static int dummy_speed_div(int speed, int *khz);\r
\r
.quit = dummy_quit,\r
};\r
\r
-int dummy_read(void);\r
-void dummy_write(int tck, int tms, int tdi);\r
-void dummy_reset(int trst, int srst);\r
-void dummy_led(int on);\r
+static int dummy_read(void);\r
+static void dummy_write(int tck, int tms, int tdi);\r
+static void dummy_reset(int trst, int srst);\r
+static void dummy_led(int on);\r
\r
-bitbang_interface_t dummy_bitbang =\r
+static bitbang_interface_t dummy_bitbang =\r
{\r
.read = dummy_read,\r
.write = dummy_write,\r
.blink = dummy_led\r
};\r
\r
-int dummy_read(void)\r
+static int dummy_read(void)\r
{\r
int data = 1 & dummy_data;\r
dummy_data = (dummy_data >> 1) | (1<<31);\r
}\r
\r
\r
-void dummy_write(int tck, int tms, int tdi)\r
+static void dummy_write(int tck, int tms, int tdi)\r
{\r
/* TAP standard: "state transitions occur on rising edge of clock" */\r
if( tck != dummy_clock )\r
}\r
}\r
\r
-void dummy_reset(int trst, int srst)\r
+static void dummy_reset(int trst, int srst)\r
{\r
dummy_clock = 0;\r
\r
return ERROR_OK;\r
}\r
\r
-int dummy_speed(int speed)\r
+static int dummy_speed(int speed)\r
{\r
return ERROR_OK;\r
}\r
\r
-int dummy_register_commands(struct command_context_s *cmd_ctx)\r
+static int dummy_register_commands(struct command_context_s *cmd_ctx)\r
{\r
return ERROR_OK;\r
}\r
\r
-int dummy_init(void)\r
+static int dummy_init(void)\r
{\r
bitbang_interface = &dummy_bitbang;\r
\r
return ERROR_OK;\r
}\r
\r
-int dummy_quit(void)\r
+static int dummy_quit(void)\r
{\r
return ERROR_OK;\r
}\r
\r
-void dummy_led(int on)\r
+static void dummy_led(int on)\r
{\r
}\r
\r
/* low level command set
*/
-int ep93xx_read(void);
-void ep93xx_write(int tck, int tms, int tdi);
-void ep93xx_reset(int trst, int srst);
+static int ep93xx_read(void);
+static void ep93xx_write(int tck, int tms, int tdi);
+static void ep93xx_reset(int trst, int srst);
-int ep93xx_speed(int speed);
-int ep93xx_register_commands(struct command_context_s *cmd_ctx);
-int ep93xx_init(void);
-int ep93xx_quit(void);
+static int ep93xx_speed(int speed);
+static int ep93xx_register_commands(struct command_context_s *cmd_ctx);
+static int ep93xx_init(void);
+static int ep93xx_quit(void);
struct timespec ep93xx_zzzz;
.quit = ep93xx_quit,
};
-bitbang_interface_t ep93xx_bitbang =
+static bitbang_interface_t ep93xx_bitbang =
{
.read = ep93xx_read,
.write = ep93xx_write,
.blink = 0,
};
-int ep93xx_read(void)
+static int ep93xx_read(void)
{
return !!(*gpio_data_register & TDO_BIT);
}
-void ep93xx_write(int tck, int tms, int tdi)
+static void ep93xx_write(int tck, int tms, int tdi)
{
if (tck)
output_value |= TCK_BIT;
}
/* (1) assert or (0) deassert reset lines */
-void ep93xx_reset(int trst, int srst)
+static void ep93xx_reset(int trst, int srst)
{
if (trst == 0)
output_value |= TRST_BIT;
nanosleep(&ep93xx_zzzz, NULL);
}
-int ep93xx_speed(int speed)
+static int ep93xx_speed(int speed)
{
return ERROR_OK;
}
-int ep93xx_register_commands(struct command_context_s *cmd_ctx)
+static int ep93xx_register_commands(struct command_context_s *cmd_ctx)
{
return ERROR_OK;
return ERROR_OK;
}
-int ep93xx_init(void)
+static int ep93xx_init(void)
{
int ret;
return ERROR_OK;
}
-int ep93xx_quit(void)
+static int ep93xx_quit(void)
{
return ERROR_OK;
#define _DEBUG_USB_COMMS_
#endif
-int ft2232_execute_queue(void);
+static int ft2232_execute_queue(void);
-int ft2232_speed(int speed);
-int ft2232_speed_div(int speed, int* khz);
-int ft2232_khz(int khz, int* jtag_speed);
-int ft2232_register_commands(struct command_context_s* cmd_ctx);
-int ft2232_init(void);
-int ft2232_quit(void);
+static int ft2232_speed(int speed);
+static int ft2232_speed_div(int speed, int* khz);
+static int ft2232_khz(int khz, int* jtag_speed);
+static int ft2232_register_commands(struct command_context_s* cmd_ctx);
+static int ft2232_init(void);
+static int ft2232_quit(void);
-int ft2232_handle_device_desc_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc);
-int ft2232_handle_serial_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc);
-int ft2232_handle_layout_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc);
-int ft2232_handle_vid_pid_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc);
-int ft2232_handle_latency_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc);
+static int ft2232_handle_device_desc_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc);
+static int ft2232_handle_serial_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc);
+static int ft2232_handle_layout_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc);
+static int ft2232_handle_vid_pid_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc);
+static int ft2232_handle_latency_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc);
/**
static int ft2232_stableclocks(int num_cycles, jtag_command_t* cmd);
-char * ft2232_device_desc_A = NULL;
-char* ft2232_device_desc = NULL;
-char* ft2232_serial = NULL;
-char* ft2232_layout = NULL;
-unsigned char ft2232_latency = 2;
+static char * ft2232_device_desc_A = NULL;
+static char* ft2232_device_desc = NULL;
+static char* ft2232_serial = NULL;
+static char* ft2232_layout = NULL;
+static unsigned char ft2232_latency = 2;
#define MAX_USB_IDS 8
/* vid = pid = 0 marks the end of the list */
} ft2232_layout_t;
/* init procedures for supported layouts */
-int usbjtag_init(void);
-int jtagkey_init(void);
-int olimex_jtag_init(void);
-int flyswatter_init(void);
-int turtle_init(void);
-int comstick_init(void);
-int stm32stick_init(void);
-int axm0432_jtag_init(void);
-int sheevaplug_init(void);
+static int usbjtag_init(void);
+static int jtagkey_init(void);
+static int olimex_jtag_init(void);
+static int flyswatter_init(void);
+static int turtle_init(void);
+static int comstick_init(void);
+static int stm32stick_init(void);
+static int axm0432_jtag_init(void);
+static int sheevaplug_init(void);
/* reset procedures for supported layouts */
-void usbjtag_reset(int trst, int srst);
-void jtagkey_reset(int trst, int srst);
-void olimex_jtag_reset(int trst, int srst);
-void flyswatter_reset(int trst, int srst);
-void turtle_reset(int trst, int srst);
-void comstick_reset(int trst, int srst);
-void stm32stick_reset(int trst, int srst);
-void axm0432_jtag_reset(int trst, int srst);
-void sheevaplug_reset(int trst, int srst);
+static void usbjtag_reset(int trst, int srst);
+static void jtagkey_reset(int trst, int srst);
+static void olimex_jtag_reset(int trst, int srst);
+static void flyswatter_reset(int trst, int srst);
+static void turtle_reset(int trst, int srst);
+static void comstick_reset(int trst, int srst);
+static void stm32stick_reset(int trst, int srst);
+static void axm0432_jtag_reset(int trst, int srst);
+static void sheevaplug_reset(int trst, int srst);
/* blink procedures for layouts that support a blinking led */
-void olimex_jtag_blink(void);
-void flyswatter_jtag_blink(void);
-void turtle_jtag_blink(void);
+static void olimex_jtag_blink(void);
+static void flyswatter_jtag_blink(void);
+static void turtle_jtag_blink(void);
ft2232_layout_t ft2232_layouts[] =
{
.quit = ft2232_quit,
};
-int ft2232_write(u8* buf, int size, u32* bytes_written)
+static int ft2232_write(u8* buf, int size, u32* bytes_written)
{
#if BUILD_FT2232_FTD2XX == 1
FT_STATUS status;
}
-int ft2232_read(u8* buf, u32 size, u32* bytes_read)
+static int ft2232_read(u8* buf, u32 size, u32* bytes_read)
{
#if BUILD_FT2232_FTD2XX == 1
DWORD dw_bytes_read;
}
-int ft2232_speed(int speed)
+static int ft2232_speed(int speed)
{
u8 buf[3];
int retval;
}
-int ft2232_speed_div(int speed, int* khz)
+static int ft2232_speed_div(int speed, int* khz)
{
/* Take a look in the FT2232 manual,
* AN2232C-01 Command Processor for
}
-int ft2232_khz(int khz, int* jtag_speed)
+static int ft2232_khz(int khz, int* jtag_speed)
{
if (khz==0)
{
}
-int ft2232_register_commands(struct command_context_s* cmd_ctx)
+static int ft2232_register_commands(struct command_context_s* cmd_ctx)
{
register_command(cmd_ctx, NULL, "ft2232_device_desc", ft2232_handle_device_desc_command,
COMMAND_CONFIG, "the USB device description of the FTDI FT2232 device");
}
-void ft2232_read_scan(enum scan_type type, u8* buffer, int scan_size)
+static void ft2232_read_scan(enum scan_type type, u8* buffer, int scan_size)
{
int num_bytes = (scan_size + 7) / 8;
int bits_left = scan_size;
}
-void ft2232_debug_dump_buffer(void)
+static void ft2232_debug_dump_buffer(void)
{
int i;
char line[256];
}
-int ft2232_send_and_recv(jtag_command_t* first, jtag_command_t* last)
+static int ft2232_send_and_recv(jtag_command_t* first, jtag_command_t* last)
{
jtag_command_t* cmd;
u8* buffer;
}
-void ft2232_add_pathmove(pathmove_command_t* cmd)
+static void ft2232_add_pathmove(pathmove_command_t* cmd)
{
int num_states = cmd->num_states;
int state_count = 0;
}
-int ft2232_large_scan(scan_command_t* cmd, enum scan_type type, u8* buffer, int scan_size)
+static int ft2232_large_scan(scan_command_t* cmd, enum scan_type type, u8* buffer, int scan_size)
{
int num_bytes = (scan_size + 7) / 8;
int bits_left = scan_size;
}
-int ft2232_predict_scan_out(int scan_size, enum scan_type type)
+static int ft2232_predict_scan_out(int scan_size, enum scan_type type)
{
int predicted_size = 3;
int num_bytes = (scan_size - 1) / 8;
}
-int ft2232_predict_scan_in(int scan_size, enum scan_type type)
+static int ft2232_predict_scan_in(int scan_size, enum scan_type type)
{
int predicted_size = 0;
}
-void usbjtag_reset(int trst, int srst)
+static void usbjtag_reset(int trst, int srst)
{
if (trst == 1)
{
}
-void jtagkey_reset(int trst, int srst)
+static void jtagkey_reset(int trst, int srst)
{
if (trst == 1)
{
}
-void olimex_jtag_reset(int trst, int srst)
+static void olimex_jtag_reset(int trst, int srst)
{
if (trst == 1)
{
}
-void axm0432_jtag_reset(int trst, int srst)
+static void axm0432_jtag_reset(int trst, int srst)
{
if (trst == 1)
{
}
-void flyswatter_reset(int trst, int srst)
+static void flyswatter_reset(int trst, int srst)
{
if (trst == 1)
{
}
-void turtle_reset(int trst, int srst)
+static void turtle_reset(int trst, int srst)
{
trst = trst;
}
-void comstick_reset(int trst, int srst)
+static void comstick_reset(int trst, int srst)
{
if (trst == 1)
{
}
-void stm32stick_reset(int trst, int srst)
+static void stm32stick_reset(int trst, int srst)
{
if (trst == 1)
{
-void sheevaplug_reset(int trst, int srst)
+static void sheevaplug_reset(int trst, int srst)
{
if (trst == 1)
high_output &= ~nTRST;
LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction);
}
-int ft2232_execute_queue()
+static int ft2232_execute_queue()
{
jtag_command_t* cmd = jtag_command_queue; /* currently processed command */
u8* buffer;
#endif /* BUILD_FT2232_LIBFTDI == 1 */
-int ft2232_init(void)
+static int ft2232_init(void)
{
u8 buf[1];
int retval;
}
-int usbjtag_init(void)
+static int usbjtag_init(void)
{
u8 buf[3];
u32 bytes_written;
}
-int axm0432_jtag_init(void)
+static int axm0432_jtag_init(void)
{
u8 buf[3];
u32 bytes_written;
}
-int jtagkey_init(void)
+static int jtagkey_init(void)
{
u8 buf[3];
u32 bytes_written;
}
-int olimex_jtag_init(void)
+static int olimex_jtag_init(void)
{
u8 buf[3];
u32 bytes_written;
}
-int flyswatter_init(void)
+static int flyswatter_init(void)
{
u8 buf[3];
u32 bytes_written;
}
-int turtle_init(void)
+static int turtle_init(void)
{
u8 buf[3];
u32 bytes_written;
}
-int comstick_init(void)
+static int comstick_init(void)
{
u8 buf[3];
u32 bytes_written;
}
-int stm32stick_init(void)
+static int stm32stick_init(void)
{
u8 buf[3];
u32 bytes_written;
}
-int sheevaplug_init(void)
+static int sheevaplug_init(void)
{
u8 buf[3];
u32 bytes_written;
return ERROR_OK;
}
-void olimex_jtag_blink(void)
+static void olimex_jtag_blink(void)
{
/* Olimex ARM-USB-OCD has a LED connected to ACBUS3
* ACBUS3 is bit 3 of the GPIOH port
}
-void flyswatter_jtag_blink(void)
+static void flyswatter_jtag_blink(void)
{
/*
* Flyswatter has two LEDs connected to ACBUS2 and ACBUS3
}
-void turtle_jtag_blink(void)
+static void turtle_jtag_blink(void)
{
/*
* Turtelizer2 has two LEDs connected to ACBUS2 and ACBUS3
}
-int ft2232_quit(void)
+static int ft2232_quit(void)
{
#if BUILD_FT2232_FTD2XX == 1
FT_STATUS status;
}
-int ft2232_handle_device_desc_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc)
+static int ft2232_handle_device_desc_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc)
{
char *cp;
char buf[200];
}
-int ft2232_handle_serial_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc)
+static int ft2232_handle_serial_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc)
{
if (argc == 1)
{
}
-int ft2232_handle_layout_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc)
+static int ft2232_handle_layout_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc)
{
if (argc == 0)
return ERROR_OK;
}
-int ft2232_handle_vid_pid_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc)
+static int ft2232_handle_vid_pid_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc)
{
int i;
}
-int ft2232_handle_latency_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc)
+static int ft2232_handle_latency_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc)
{
if (argc == 1)
{
static int device_handle;
#endif
-int gw16012_execute_queue(void);
-int gw16012_register_commands(struct command_context_s *cmd_ctx);
-int gw16012_speed(int speed);
-int gw16012_init(void);
-int gw16012_quit(void);
+static int gw16012_execute_queue(void);
+static int gw16012_register_commands(struct command_context_s *cmd_ctx);
+static int gw16012_speed(int speed);
+static int gw16012_init(void);
+static int gw16012_quit(void);
-int gw16012_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int gw16012_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
jtag_interface_t gw16012_interface =
{
.quit = gw16012_quit,
};
-int gw16012_register_commands(struct command_context_s *cmd_ctx)
+static int gw16012_register_commands(struct command_context_s *cmd_ctx)
{
register_command(cmd_ctx, NULL, "parport_port", gw16012_handle_parport_port_command,
COMMAND_CONFIG, NULL);
return ERROR_OK;
}
-void gw16012_data(u8 value)
+static void gw16012_data(u8 value)
{
value = (value & 0x7f) | gw16012_msb;
gw16012_msb ^= 0x80; /* toggle MSB */
#endif
}
-void gw16012_control(u8 value)
+static void gw16012_control(u8 value)
{
if (value != gw16012_control_value)
{
}
}
-void gw16012_input(u8 *value)
+static void gw16012_input(u8 *value)
{
#if PARPORT_USE_PPDEV == 1
ioctl(device_handle, PPRSTATUS, value);
}
/* (1) assert or (0) deassert reset lines */
-void gw16012_reset(int trst, int srst)
+static void gw16012_reset(int trst, int srst)
{
LOG_DEBUG("trst: %i, srst: %i", trst, srst);
gw16012_control(0x0b);
}
-int gw16012_speed(int speed)
+static int gw16012_speed(int speed)
{
return ERROR_OK;
}
-void gw16012_end_state(tap_state_t state)
+static void gw16012_end_state(tap_state_t state)
{
if (tap_is_state_stable(state))
tap_set_end_state(state);
}
}
-void gw16012_state_move(void)
+static void gw16012_state_move(void)
{
int i=0, tms=0;
u8 tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state());
tap_set_state(tap_get_end_state());
}
-void gw16012_path_move(pathmove_command_t *cmd)
+static void gw16012_path_move(pathmove_command_t *cmd)
{
int num_states = cmd->num_states;
int state_count;
tap_set_end_state(tap_get_state());
}
-void gw16012_runtest(int num_cycles)
+static void gw16012_runtest(int num_cycles)
{
tap_state_t saved_end_state = tap_get_end_state();
int i;
gw16012_state_move();
}
-void gw16012_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size)
+static void gw16012_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size)
{
int bits_left = scan_size;
int bit_count = 0;
}
}
-int gw16012_execute_queue(void)
+static int gw16012_execute_queue(void)
{
jtag_command_t *cmd = jtag_command_queue; /* currently processed command */
int scan_size;
}
#if PARPORT_USE_GIVEIO == 1
-int gw16012_get_giveio_access()
+static int gw16012_get_giveio_access()
{
HANDLE h;
OSVERSIONINFO version;
}
#endif
-int gw16012_init(void)
+static int gw16012_init(void)
{
#if PARPORT_USE_PPDEV == 1
char buffer[256];
return ERROR_OK;
}
-int gw16012_quit(void)
+static int gw16012_quit(void)
{
return ERROR_OK;
}
-int gw16012_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int gw16012_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc == 0)
return ERROR_OK;
#define JLINK_MAX_SPEED 12000
/* External interface functions */
-int jlink_execute_queue(void);
-int jlink_speed(int speed);
-int jlink_speed_div(int speed, int* khz);
-int jlink_khz(int khz, int *jtag_speed);
-int jlink_register_commands(struct command_context_s *cmd_ctx);
-int jlink_init(void);
-int jlink_quit(void);
+static int jlink_execute_queue(void);
+static int jlink_speed(int speed);
+static int jlink_speed_div(int speed, int* khz);
+static int jlink_khz(int khz, int *jtag_speed);
+static int jlink_register_commands(struct command_context_s *cmd_ctx);
+static int jlink_init(void);
+static int jlink_quit(void);
/* CLI command handler functions */
-int jlink_handle_jlink_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int jlink_handle_jlink_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
/* Queue command functions */
-void jlink_end_state(tap_state_t state);
-void jlink_state_move(void);
-void jlink_path_move(int num_states, tap_state_t *path);
-void jlink_runtest(int num_cycles);
-void jlink_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command);
-void jlink_reset(int trst, int srst);
-void jlink_simple_command(u8 command);
-int jlink_get_status(void);
+static void jlink_end_state(tap_state_t state);
+static void jlink_state_move(void);
+static void jlink_path_move(int num_states, tap_state_t *path);
+static void jlink_runtest(int num_cycles);
+static void jlink_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command);
+static void jlink_reset(int trst, int srst);
+static void jlink_simple_command(u8 command);
+static int jlink_get_status(void);
/* J-Link tap buffer functions */
-void jlink_tap_init(void);
-int jlink_tap_execute(void);
-void jlink_tap_ensure_space(int scans, int bits);
-void jlink_tap_append_step(int tms, int tdi);
-void jlink_tap_append_scan(int length, u8 *buffer, scan_command_t *command);
+static void jlink_tap_init(void);
+static int jlink_tap_execute(void);
+static void jlink_tap_ensure_space(int scans, int bits);
+static void jlink_tap_append_step(int tms, int tdi);
+static void jlink_tap_append_scan(int length, u8 *buffer, scan_command_t *command);
/* Jlink lowlevel functions */
typedef struct jlink_jtag
struct usb_dev_handle* usb_handle;
} jlink_jtag_t;
-jlink_jtag_t *jlink_usb_open(void);
-void jlink_usb_close(jlink_jtag_t *jlink_jtag);
-int jlink_usb_message(jlink_jtag_t *jlink_jtag, int out_length, int in_length);
-int jlink_usb_write(jlink_jtag_t *jlink_jtag, int out_length);
-int jlink_usb_read(jlink_jtag_t *jlink_jtag, int expected_size);
-int jlink_usb_read_emu_result(jlink_jtag_t *jlink_jtag);
+static jlink_jtag_t *jlink_usb_open(void);
+static void jlink_usb_close(jlink_jtag_t *jlink_jtag);
+static int jlink_usb_message(jlink_jtag_t *jlink_jtag, int out_length, int in_length);
+static int jlink_usb_write(jlink_jtag_t *jlink_jtag, int out_length);
+static int jlink_usb_read(jlink_jtag_t *jlink_jtag, int expected_size);
+static int jlink_usb_read_emu_result(jlink_jtag_t *jlink_jtag);
/* helper functions */
-int jlink_get_version_info(void);
+static int jlink_get_version_info(void);
#ifdef _DEBUG_USB_COMMS_
-void jlink_debug_buffer(u8 *buffer, int length);
+static void jlink_debug_buffer(u8 *buffer, int length);
#endif
-jlink_jtag_t* jlink_jtag_handle;
+static jlink_jtag_t* jlink_jtag_handle;
/***************************************************************************/
/* External interface implementation */
.quit = jlink_quit
};
-int jlink_execute_queue(void)
+static int jlink_execute_queue(void)
{
jtag_command_t *cmd = jtag_command_queue;
int scan_size;
}
/* Sets speed in kHz. */
-int jlink_speed(int speed)
+static int jlink_speed(int speed)
{
int result;
return ERROR_OK;
}
-int jlink_speed_div(int speed, int* khz)
+static int jlink_speed_div(int speed, int* khz)
{
*khz = speed;
return ERROR_OK;
}
-int jlink_khz(int khz, int *jtag_speed)
+static int jlink_khz(int khz, int *jtag_speed)
{
*jtag_speed = khz;
return ERROR_OK;
}
-int jlink_register_commands(struct command_context_s *cmd_ctx)
+static int jlink_register_commands(struct command_context_s *cmd_ctx)
{
register_command(cmd_ctx, NULL, "jlink_info", jlink_handle_jlink_info_command, COMMAND_EXEC,
"query jlink info");
return ERROR_OK;
}
-int jlink_init(void)
+static int jlink_init(void)
{
int check_cnt;
return ERROR_OK;
}
-int jlink_quit(void)
+static int jlink_quit(void)
{
jlink_usb_close(jlink_jtag_handle);
return ERROR_OK;
/***************************************************************************/
/* Queue command implementations */
-void jlink_end_state(tap_state_t state)
+static void jlink_end_state(tap_state_t state)
{
if (tap_is_state_stable(state))
{
}
/* Goes to the end state. */
-void jlink_state_move(void)
+static void jlink_state_move(void)
{
int i;
int tms = 0;
tap_set_state(tap_get_end_state());
}
-void jlink_path_move(int num_states, tap_state_t *path)
+static void jlink_path_move(int num_states, tap_state_t *path)
{
int i;
tap_set_end_state(tap_get_state());
}
-void jlink_runtest(int num_cycles)
+static void jlink_runtest(int num_cycles)
{
int i;
}
}
-void jlink_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command)
+static void jlink_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command)
{
tap_state_t saved_end_state;
}
}
-void jlink_reset(int trst, int srst)
+static void jlink_reset(int trst, int srst)
{
LOG_DEBUG("trst: %i, srst: %i", trst, srst);
}
}
-void jlink_simple_command(u8 command)
+static void jlink_simple_command(u8 command)
{
int result;
}
}
-int jlink_get_status(void)
+static int jlink_get_status(void)
{
int result;
return ERROR_OK;
}
-int jlink_get_version_info(void)
+static int jlink_get_version_info(void)
{
int result;
int len = 0;
return ERROR_JTAG_DEVICE_ERROR;
}
-int jlink_handle_jlink_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int jlink_handle_jlink_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (jlink_get_version_info() == ERROR_OK)
{
static int last_tms;
-void jlink_tap_init(void)
+static void jlink_tap_init(void)
{
tap_length = 0;
pending_scan_results_length = 0;
}
-void jlink_tap_ensure_space(int scans, int bits)
+static void jlink_tap_ensure_space(int scans, int bits)
{
int available_scans = MAX_PENDING_SCAN_RESULTS - pending_scan_results_length;
int available_bits = JLINK_TAP_BUFFER_SIZE * 8 - tap_length;
}
}
-void jlink_tap_append_step(int tms, int tdi)
+static void jlink_tap_append_step(int tms, int tdi)
{
last_tms = tms;
int index = tap_length / 8;
}
}
-void jlink_tap_append_scan(int length, u8 *buffer, scan_command_t *command)
+static void jlink_tap_append_scan(int length, u8 *buffer, scan_command_t *command)
{
pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[pending_scan_results_length];
int i;
/* Pad and send a tap sequence to the device, and receive the answer.
* For the purpose of padding we assume that we are in idle or pause state. */
-int jlink_tap_execute(void)
+static int jlink_tap_execute(void)
{
int byte_length;
int tms_offset;
/*****************************************************************************/
/* JLink USB low-level functions */
-jlink_jtag_t* jlink_usb_open()
+static jlink_jtag_t* jlink_usb_open()
{
struct usb_bus *busses;
struct usb_bus *bus;
return NULL;
}
-void jlink_usb_close(jlink_jtag_t *jlink_jtag)
+static void jlink_usb_close(jlink_jtag_t *jlink_jtag)
{
usb_close(jlink_jtag->usb_handle);
free(jlink_jtag);
}
/* Send a message and receive the reply. */
-int jlink_usb_message(jlink_jtag_t *jlink_jtag, int out_length, int in_length)
+static int jlink_usb_message(jlink_jtag_t *jlink_jtag, int out_length, int in_length)
{
int result;
int result2;
}
}
-int usb_bulk_write_ex(usb_dev_handle *dev, int ep, char *bytes, int size,
+static int usb_bulk_write_ex(usb_dev_handle *dev, int ep, char *bytes, int size,
int timeout) {
int rc = 0, tries = 3, this_size;
}
-int usb_bulk_read_ex(usb_dev_handle *dev, int ep, char *bytes, int size,
+static int usb_bulk_read_ex(usb_dev_handle *dev, int ep, char *bytes, int size,
int timeout) {
int rc = 0, tries = 3, this_size;
/* Write data from out_buffer to USB. */
-int jlink_usb_write(jlink_jtag_t *jlink_jtag, int out_length)
+static int jlink_usb_write(jlink_jtag_t *jlink_jtag, int out_length)
{
int result;
}
/* Read data from USB into in_buffer. */
-int jlink_usb_read(jlink_jtag_t *jlink_jtag, int expected_size)
+static int jlink_usb_read(jlink_jtag_t *jlink_jtag, int expected_size)
{
int result = usb_bulk_read_ex(jlink_jtag->usb_handle, JLINK_READ_ENDPOINT,
(char *)usb_in_buffer, expected_size, JLINK_USB_TIMEOUT);
}
/* Read the result from the previous EMU cmd into result_buffer. */
-int jlink_usb_read_emu_result(jlink_jtag_t *jlink_jtag)
+static int jlink_usb_read_emu_result(jlink_jtag_t *jlink_jtag)
{
int result = usb_bulk_read_ex(jlink_jtag->usb_handle, JLINK_READ_ENDPOINT,
(char *)usb_emu_result_buffer, 1 /* JLINK_EMU_RESULT_BUFFER_SIZE */,
#ifdef _DEBUG_USB_COMMS_
#define BYTES_PER_LINE 16
-void jlink_debug_buffer(u8 *buffer, int length)
+static void jlink_debug_buffer(u8 *buffer, int length)
{
char line[81];
char s[4];
int jtag_verify_capture_ir = 1;
/* how long the OpenOCD should wait before attempting JTAG communication after reset lines deasserted (in ms) */
-int jtag_nsrst_delay = 0; /* default to no nSRST delay */
-int jtag_ntrst_delay = 0; /* default to no nTRST delay */
+static int jtag_nsrst_delay = 0; /* default to no nSRST delay */
+static int jtag_ntrst_delay = 0; /* default to no nTRST delay */
/* maximum number of JTAG devices expected in the chain
*/
jtag_interface_t *jtag = NULL;
/* configuration */
-jtag_interface_t *jtag_interface = NULL;
+static jtag_interface_t *jtag_interface = NULL;
int jtag_speed = 0;
/* forward declarations */
-void jtag_add_pathmove(int num_states, tap_state_t *path);
-void jtag_add_runtest(int num_cycles, tap_state_t endstate);
-void jtag_add_end_state(tap_state_t endstate);
-void jtag_add_sleep(u32 us);
-int jtag_execute_queue(void);
-tap_state_t tap_state_by_name(const char *name);
+//void jtag_add_pathmove(int num_states, tap_state_t *path);
+//void jtag_add_runtest(int num_cycles, tap_state_t endstate);
+//void jtag_add_end_state(tap_state_t endstate);
+//void jtag_add_sleep(u32 us);
+//int jtag_execute_queue(void);
+static tap_state_t tap_state_by_name(const char *name);
/* jtag commands */
-int handle_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int handle_jtag_speed_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int handle_jtag_khz_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int handle_reset_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int handle_jtag_nsrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int handle_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int handle_jtag_speed_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int handle_jtag_khz_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int handle_reset_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int handle_jtag_nsrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int handle_endstate_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int handle_jtag_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int handle_runtest_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *argv);
+static int handle_endstate_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int handle_jtag_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int handle_runtest_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *argv);
-int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
jtag_tap_t *jtag_AllTaps(void)
{
return ERROR_OK;
}
-int handle_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int handle_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
int i;
int retval;
return ERROR_JTAG_INVALID_INTERFACE;
}
-int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
int e;
char buf[1024];
return e;
}
-int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
jtag_tap_t *tap;
return ERROR_OK;
}
-int handle_reset_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int handle_reset_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc < 1)
return ERROR_COMMAND_SYNTAX_ERROR;
return ERROR_OK;
}
-int handle_jtag_nsrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int handle_jtag_nsrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc < 1)
{
return ERROR_OK;
}
-int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc < 1)
{
return ERROR_OK;
}
-int handle_jtag_speed_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int handle_jtag_speed_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
int retval=ERROR_OK;
return retval;
}
-int handle_jtag_khz_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int handle_jtag_khz_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
int retval=ERROR_OK;
LOG_DEBUG("handle jtag khz");
}
-int handle_endstate_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int handle_endstate_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
tap_state_t state;
return ERROR_OK;
}
-int handle_jtag_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int handle_jtag_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
int trst = -1;
int srst = -1;
return ERROR_OK;
}
-int handle_runtest_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int handle_runtest_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc < 1)
{
}
-int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
int i;
scan_field_t *fields;
return ERROR_OK;
}
-int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args)
+static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args)
{
int retval;
scan_field_t *fields;
return JIM_OK;
}
-int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc == 1)
{
return ret;
}
-tap_state_t tap_state_by_name( const char *name )
+static tap_state_t tap_state_by_name( const char *name )
{
tap_state_t x;
u8 LED_MASK; /* data port bit for LED */
} cable_t;
-cable_t cables[] =
+static cable_t cables[] =
{
/* name tdo trst tms tck tdi srst o_inv i_inv init exit led */
{ "wiggler", 0x80, 0x10, 0x02, 0x04, 0x08, 0x01, 0x01, 0x80, 0x80, 0x80, 0x00 },
};
/* configuration */
-char* parport_cable = NULL;
-u16 parport_port;
+static char* parport_cable = NULL;
+static u16 parport_port;
static int parport_exit = 0;
/* interface variables
/* low level command set
*/
-int parport_read(void);
-void parport_write(int tck, int tms, int tdi);
-void parport_reset(int trst, int srst);
-void parport_led(int on);
+static int parport_read(void);
+static void parport_write(int tck, int tms, int tdi);
+static void parport_reset(int trst, int srst);
+static void parport_led(int on);
-int parport_speed(int speed);
-int parport_register_commands(struct command_context_s *cmd_ctx);
-int parport_init(void);
-int parport_quit(void);
+static int parport_speed(int speed);
+static int parport_register_commands(struct command_context_s *cmd_ctx);
+static int parport_init(void);
+static int parport_quit(void);
/* interface commands */
-int parport_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int parport_handle_parport_cable_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int parport_handle_write_on_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int parport_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int parport_handle_parport_cable_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int parport_handle_write_on_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
jtag_interface_t parport_interface =
{
.quit = parport_quit,
};
-bitbang_interface_t parport_bitbang =
+static bitbang_interface_t parport_bitbang =
{
.read = parport_read,
.write = parport_write,
.blink = parport_led
};
-int parport_read(void)
+static int parport_read(void)
{
int data = 0;
#endif
}
-void parport_write(int tck, int tms, int tdi)
+static void parport_write(int tck, int tms, int tdi)
{
int i = jtag_speed + 1;
}
/* (1) assert or (0) deassert reset lines */
-void parport_reset(int trst, int srst)
+static void parport_reset(int trst, int srst)
{
LOG_DEBUG("trst: %i, srst: %i", trst, srst);
}
/* turn LED on parport adapter on (1) or off (0) */
-void parport_led(int on)
+static void parport_led(int on)
{
if (on)
dataport_value |= cable->LED_MASK;
parport_write_data();
}
-int parport_speed(int speed)
+static int parport_speed(int speed)
{
return ERROR_OK;
}
-int parport_register_commands(struct command_context_s *cmd_ctx)
+static int parport_register_commands(struct command_context_s *cmd_ctx)
{
register_command(cmd_ctx, NULL, "parport_port", parport_handle_parport_port_command,
COMMAND_CONFIG, "either the address of the I/O port or the number of the \91/dev/parport\92 device");
}
#if PARPORT_USE_GIVEIO == 1
-int parport_get_giveio_access(void)
+static int parport_get_giveio_access(void)
{
HANDLE h;
OSVERSIONINFO version;
}
#endif
-int parport_init(void)
+static int parport_init(void)
{
cable_t *cur_cable;
#if PARPORT_USE_PPDEV == 1
return ERROR_OK;
}
-int parport_quit(void)
+static int parport_quit(void)
{
parport_led(0);
return ERROR_OK;
}
-int parport_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int parport_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc == 0)
return ERROR_OK;
return ERROR_OK;
}
-int parport_handle_parport_cable_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int parport_handle_parport_cable_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc == 0)
return ERROR_OK;
return ERROR_OK;
}
-int parport_handle_write_on_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int parport_handle_write_on_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc != 1)
{
#error "BUG: either FTD2XX and LIBFTDI has to be used"
#endif
-int presto_jtag_speed(int speed);
-int presto_jtag_khz(int khz, int *jtag_speed);
-int presto_jtag_speed_div(int speed, int *khz);
-int presto_jtag_register_commands(struct command_context_s *cmd_ctx);
-int presto_jtag_init(void);
-int presto_jtag_quit(void);
+static int presto_jtag_speed(int speed);
+static int presto_jtag_khz(int khz, int *jtag_speed);
+static int presto_jtag_speed_div(int speed, int *khz);
+static int presto_jtag_register_commands(struct command_context_s *cmd_ctx);
+static int presto_jtag_init(void);
+static int presto_jtag_quit(void);
jtag_interface_t presto_interface =
{
.quit = presto_jtag_quit,
};
-int presto_bitq_out(int tms, int tdi, int tdo_req);
-int presto_bitq_flush(void);
-int presto_bitq_sleep(unsigned long us);
-int presto_bitq_reset(int trst, int srst);
-int presto_bitq_in_rdy(void);
-int presto_bitq_in(void);
+static int presto_bitq_out(int tms, int tdi, int tdo_req);
+static int presto_bitq_flush(void);
+static int presto_bitq_sleep(unsigned long us);
+static int presto_bitq_reset(int trst, int srst);
+static int presto_bitq_in_rdy(void);
+static int presto_bitq_in(void);
-bitq_interface_t presto_bitq =
+static bitq_interface_t presto_bitq =
{
.out = presto_bitq_out,
.flush = presto_bitq_flush,
} presto_t;
-presto_t presto_state;
-presto_t *presto = &presto_state;
+static presto_t presto_state;
+static presto_t *presto = &presto_state;
-u8 presto_init_seq[] =
+static u8 presto_init_seq[] =
{
0x80, 0xA0, 0xA8, 0xB0, 0xC0, 0xE0
};
-int presto_write(u8 *buf, u32 size)
+static int presto_write(u8 *buf, u32 size)
{
#if BUILD_PRESTO_FTD2XX == 1
DWORD ftbytes;
return ERROR_OK;
}
-int presto_read(u8* buf, u32 size)
+static int presto_read(u8* buf, u32 size)
{
#if BUILD_PRESTO_FTD2XX == 1
DWORD ftbytes;
}
#if BUILD_PRESTO_FTD2XX == 1
-int presto_open_ftd2xx(char *req_serial)
+static int presto_open_ftd2xx(char *req_serial)
{
u32 i;
DWORD numdevs;
}
#elif BUILD_PRESTO_LIBFTDI == 1
-int presto_open_libftdi(char *req_serial)
+static int presto_open_libftdi(char *req_serial)
{
u8 presto_data;
}
#endif /* BUILD_PRESTO_LIBFTDI == 1 */
-int presto_open(char *req_serial)
+static int presto_open(char *req_serial)
{
presto->buff_out_pos=0;
presto->buff_in_pos=0;
#endif
}
-int presto_close(void)
+static int presto_close(void)
{
int result = ERROR_OK;
return result;
}
-int presto_flush(void)
+static int presto_flush(void)
{
if (presto->buff_out_pos == 0)
return ERROR_OK;
return ERROR_OK;
}
-int presto_sendbyte(int data)
+static int presto_sendbyte(int data)
{
if (data == EOF) return presto_flush();
return ERROR_OK;
}
-int presto_getbyte(void)
+#if 0
+static int presto_getbyte(void)
{
if (presto->buff_in_pos < presto->buff_in_len)
return presto->buff_in[presto->buff_in_pos++];
return -1;
}
+#endif
/* -------------------------------------------------------------------------- */
-int presto_tdi_flush(void)
+static int presto_tdi_flush(void)
{
if (presto->jtag_tdi_count == 0)
return 0;
return 0;
}
-int presto_tck_idle(void)
+static int presto_tck_idle(void)
{
if (presto->jtag_tck == 1)
{
/* -------------------------------------------------------------------------- */
-int presto_bitq_out(int tms, int tdi, int tdo_req)
+static int presto_bitq_out(int tms, int tdi, int tdo_req)
{
int i;
unsigned char cmd;
return 0;
}
-int presto_bitq_flush(void)
+static int presto_bitq_flush(void)
{
presto_tdi_flush();
presto_tck_idle();
return presto_flush();
}
-int presto_bitq_in_rdy(void)
+static int presto_bitq_in_rdy(void)
{
if (presto->buff_in_pos>=presto->buff_in_len)
return 0;
return presto->buff_in_len-presto->buff_in_pos;
}
-int presto_bitq_in(void)
+static int presto_bitq_in(void)
{
if (presto->buff_in_pos>=presto->buff_in_len)
return -1;
return 0;
}
-int presto_bitq_sleep(unsigned long us)
+static int presto_bitq_sleep(unsigned long us)
{
long waits;
return 0;
}
-int presto_bitq_reset(int trst, int srst)
+static int presto_bitq_reset(int trst, int srst)
{
presto_tdi_flush();
presto_tck_idle();
/* -------------------------------------------------------------------------- */
-int presto_jtag_khz(int khz, int *jtag_speed)
+static int presto_jtag_khz(int khz, int *jtag_speed)
{
if (khz < 0)
{
return 0;
}
-int presto_jtag_speed_div(int speed, int *khz)
+static int presto_jtag_speed_div(int speed, int *khz)
{
if ((speed < 0) || (speed > 1000))
{
return 0;
}
-int presto_jtag_speed(int speed)
+static int presto_jtag_speed(int speed)
{
int khz;
return 0;
}
-char *presto_serial;
+static char *presto_serial;
-int presto_handle_serial_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int presto_handle_serial_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc == 1)
{
return ERROR_OK;
}
-int presto_jtag_register_commands(struct command_context_s *cmd_ctx)
+static int presto_jtag_register_commands(struct command_context_s *cmd_ctx)
{
register_command(cmd_ctx, NULL, "presto_serial", presto_handle_serial_command,
COMMAND_CONFIG, NULL);
return ERROR_OK;
}
-int presto_jtag_init(void)
+static int presto_jtag_init(void)
{
if (presto_open(presto_serial) != ERROR_OK)
{
return ERROR_OK;
}
-int presto_jtag_quit(void)
+static int presto_jtag_quit(void)
{
bitq_cleanup();
presto_close();
#define TCK_BIT 2
#define TMS_BIT 1
-int usbprog_execute_queue(void);
-int usbprog_speed(int speed);
-int usbprog_register_commands(struct command_context_s *cmd_ctx);
-int usbprog_init(void);
-int usbprog_quit(void);
-
-void usbprog_end_state(tap_state_t state);
-void usbprog_state_move(void);
-void usbprog_path_move(pathmove_command_t *cmd);
-void usbprog_runtest(int num_cycles);
-void usbprog_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size);
+static int usbprog_execute_queue(void);
+static int usbprog_speed(int speed);
+static int usbprog_register_commands(struct command_context_s *cmd_ctx);
+static int usbprog_init(void);
+static int usbprog_quit(void);
+
+static void usbprog_end_state(tap_state_t state);
+static void usbprog_state_move(void);
+static void usbprog_path_move(pathmove_command_t *cmd);
+static void usbprog_runtest(int num_cycles);
+static void usbprog_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size);
jtag_interface_t usbprog_interface =
{
struct usb_dev_handle* usb_handle;
};
-struct usbprog_jtag * usbprog_jtag_handle;
+static struct usbprog_jtag * usbprog_jtag_handle;
-struct usbprog_jtag* usbprog_jtag_open(void);
-void usbprog_jtag_close(struct usbprog_jtag *usbprog_jtag);
-void usbprog_jtag_init(struct usbprog_jtag *usbprog_jtag);
-unsigned char usbprog_jtag_message(struct usbprog_jtag *usbprog_jtag, char *msg, int msglen);
+static struct usbprog_jtag* usbprog_jtag_open(void);
+//static void usbprog_jtag_close(struct usbprog_jtag *usbprog_jtag);
+static void usbprog_jtag_init(struct usbprog_jtag *usbprog_jtag);
+static unsigned char usbprog_jtag_message(struct usbprog_jtag *usbprog_jtag, char *msg, int msglen);
-void usbprog_jtag_read_tdo(struct usbprog_jtag *usbprog_jtag, char * buffer, int size);
-void usbprog_jtag_write_tdi(struct usbprog_jtag *usbprog_jtag, char * buffer, int size);
-void usbprog_jtag_write_and_read(struct usbprog_jtag *usbprog_jtag, char * buffer, int size);
-void usbprog_jtag_write_tms(struct usbprog_jtag *usbprog_jtag, char tms_scan);
+static void usbprog_jtag_read_tdo(struct usbprog_jtag *usbprog_jtag, char * buffer, int size);
+static void usbprog_jtag_write_tdi(struct usbprog_jtag *usbprog_jtag, char * buffer, int size);
+static void usbprog_jtag_write_and_read(struct usbprog_jtag *usbprog_jtag, char * buffer, int size);
+static void usbprog_jtag_write_tms(struct usbprog_jtag *usbprog_jtag, char tms_scan);
-char tms_chain[64];
-int tms_chain_index;
-void usbprog_jtag_tms_collect(char tms_scan);
-void usbprog_jtag_tms_send(struct usbprog_jtag *usbprog_jtag);
+static char tms_chain[64];
+static int tms_chain_index;
-void usbprog_write(int tck, int tms, int tdi);
-void usbprog_reset(int trst, int srst);
+static void usbprog_jtag_tms_collect(char tms_scan);
+static void usbprog_jtag_tms_send(struct usbprog_jtag *usbprog_jtag);
-void usbprog_jtag_set_direction(struct usbprog_jtag *usbprog_jtag, unsigned char direction);
-void usbprog_jtag_write_slice(struct usbprog_jtag *usbprog_jtag,unsigned char value);
-unsigned char usbprog_jtag_get_port(struct usbprog_jtag *usbprog_jtag);
-void usbprog_jtag_set_bit(struct usbprog_jtag *usbprog_jtag,int bit, int value);
-int usbprog_jtag_get_bit(struct usbprog_jtag *usbprog_jtag, int bit);
+static void usbprog_write(int tck, int tms, int tdi);
+static void usbprog_reset(int trst, int srst);
-int usbprog_speed(int speed)
+static void usbprog_jtag_set_direction(struct usbprog_jtag *usbprog_jtag, unsigned char direction);
+static void usbprog_jtag_write_slice(struct usbprog_jtag *usbprog_jtag,unsigned char value);
+//static unsigned char usbprog_jtag_get_port(struct usbprog_jtag *usbprog_jtag);
+static void usbprog_jtag_set_bit(struct usbprog_jtag *usbprog_jtag,int bit, int value);
+//static int usbprog_jtag_get_bit(struct usbprog_jtag *usbprog_jtag, int bit);
+
+static int usbprog_speed(int speed)
{
return ERROR_OK;
}
-int usbprog_register_commands(struct command_context_s *cmd_ctx)
+static int usbprog_register_commands(struct command_context_s *cmd_ctx)
{
return ERROR_OK;
}
-int usbprog_execute_queue(void)
+static int usbprog_execute_queue(void)
{
jtag_command_t *cmd = jtag_command_queue; /* currently processed command */
int scan_size;
return ERROR_OK;
}
-int usbprog_init(void)
+static int usbprog_init(void)
{
usbprog_jtag_handle = usbprog_jtag_open();
return ERROR_OK;
}
-int usbprog_quit(void)
+static int usbprog_quit(void)
{
return ERROR_OK;
}
/*************** jtag execute commands **********************/
-void usbprog_end_state(tap_state_t state)
+static void usbprog_end_state(tap_state_t state)
{
if (tap_is_state_stable(state))
tap_set_end_state(state);
}
}
-void usbprog_state_move(void)
+static void usbprog_state_move(void)
{
int i = 0, tms = 0;
u8 tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state());
tap_set_state(tap_get_end_state());
}
-void usbprog_path_move(pathmove_command_t *cmd)
+static void usbprog_path_move(pathmove_command_t *cmd)
{
int num_states = cmd->num_states;
int state_count;
tap_set_end_state(tap_get_state());
}
-void usbprog_runtest(int num_cycles)
+static void usbprog_runtest(int num_cycles)
{
int i;
*/
}
-void usbprog_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size)
+static void usbprog_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size)
{
tap_state_t saved_end_state = tap_get_end_state();
/*************** jtag wrapper functions *********************/
-void usbprog_write(int tck, int tms, int tdi)
+static void usbprog_write(int tck, int tms, int tdi)
{
unsigned char output_value=0x00;
}
/* (1) assert or (0) deassert reset lines */
-void usbprog_reset(int trst, int srst)
+static void usbprog_reset(int trst, int srst)
{
LOG_DEBUG("trst: %i, srst: %i", trst, srst);
return 0;
}
-void usbprog_jtag_close(struct usbprog_jtag *usbprog_jtag)
+#if 0
+static void usbprog_jtag_close(struct usbprog_jtag *usbprog_jtag)
{
usb_close(usbprog_jtag->usb_handle);
free(usbprog_jtag);
}
+#endif
-unsigned char usbprog_jtag_message(struct usbprog_jtag *usbprog_jtag, char *msg, int msglen)
+static unsigned char usbprog_jtag_message(struct usbprog_jtag *usbprog_jtag, char *msg, int msglen)
{
int res = usb_bulk_write(usbprog_jtag->usb_handle, 3, msg,msglen, 100);
if ((msg[0] == 2) || (msg[0] == 1) || (msg[0] == 4) || (msg[0] == 0) || \
return 0;
}
-void usbprog_jtag_init(struct usbprog_jtag *usbprog_jtag)
+static void usbprog_jtag_init(struct usbprog_jtag *usbprog_jtag)
{
usbprog_jtag_set_direction(usbprog_jtag, 0xFE);
}
-void usbprog_jtag_write_and_read(struct usbprog_jtag *usbprog_jtag, char * buffer, int size)
+static void usbprog_jtag_write_and_read(struct usbprog_jtag *usbprog_jtag, char * buffer, int size)
{
char tmp[64]; /* fastes packet size for usb controller */
int send_bits, bufindex = 0, fillindex = 0, i, loops;
}
}
-void usbprog_jtag_read_tdo(struct usbprog_jtag *usbprog_jtag, char * buffer, int size)
+static void usbprog_jtag_read_tdo(struct usbprog_jtag *usbprog_jtag, char * buffer, int size)
{
char tmp[64]; /* fastes packet size for usb controller */
int send_bits, fillindex = 0, i, loops;
}
}
-void usbprog_jtag_write_tdi(struct usbprog_jtag *usbprog_jtag, char * buffer, int size)
+static void usbprog_jtag_write_tdi(struct usbprog_jtag *usbprog_jtag, char * buffer, int size)
{
char tmp[64]; /* fastes packet size for usb controller */
int send_bits, bufindex = 0, i, loops;
}
}
-void usbprog_jtag_write_tms(struct usbprog_jtag *usbprog_jtag, char tms_scan)
+static void usbprog_jtag_write_tms(struct usbprog_jtag *usbprog_jtag, char tms_scan)
{
usbprog_jtag_tms_collect(tms_scan);
}
-void usbprog_jtag_set_direction(struct usbprog_jtag *usbprog_jtag, unsigned char direction)
+static void usbprog_jtag_set_direction(struct usbprog_jtag *usbprog_jtag, unsigned char direction)
{
char tmp[2];
tmp[0] = PORT_DIRECTION;
usbprog_jtag_message(usbprog_jtag, tmp, 2);
}
-void usbprog_jtag_write_slice(struct usbprog_jtag *usbprog_jtag,unsigned char value)
+static void usbprog_jtag_write_slice(struct usbprog_jtag *usbprog_jtag,unsigned char value)
{
char tmp[2];
tmp[0] = PORT_SET;
usbprog_jtag_message(usbprog_jtag, tmp, 2);
}
-unsigned char usbprog_jtag_get_port(struct usbprog_jtag *usbprog_jtag)
+#if 0
+static unsigned char usbprog_jtag_get_port(struct usbprog_jtag *usbprog_jtag)
{
char tmp[2];
tmp[0] = PORT_GET;
tmp[1] = 0x00;
return usbprog_jtag_message(usbprog_jtag, tmp, 2);
}
+#endif
-void usbprog_jtag_set_bit(struct usbprog_jtag *usbprog_jtag,int bit, int value)
+static void usbprog_jtag_set_bit(struct usbprog_jtag *usbprog_jtag,int bit, int value)
{
char tmp[3];
tmp[0] = PORT_SETBIT;
usbprog_jtag_message(usbprog_jtag, tmp, 3);
}
-int usbprog_jtag_get_bit(struct usbprog_jtag *usbprog_jtag, int bit)
+#if 0
+static int usbprog_jtag_get_bit(struct usbprog_jtag *usbprog_jtag, int bit)
{
char tmp[2];
tmp[0] = PORT_GETBIT;
else
return 0;
}
+#endif
-void usbprog_jtag_tms_collect(char tms_scan)
+static void usbprog_jtag_tms_collect(char tms_scan)
{
tms_chain[tms_chain_index] = tms_scan;
tms_chain_index++;
}
-void usbprog_jtag_tms_send(struct usbprog_jtag *usbprog_jtag)
+static void usbprog_jtag_tms_send(struct usbprog_jtag *usbprog_jtag)
{
int i;
/* LOG_INFO("TMS SEND"); */
#define DEBUG_JTAG_IO(expr ...)
#endif
-u16 vsllink_vid;
-u16 vsllink_pid;
-u8 vsllink_bulkout;
-u8 vsllink_bulkin;
+static u16 vsllink_vid;
+static u16 vsllink_pid;
+static u8 vsllink_bulkout;
+static u8 vsllink_bulkin;
#define VSLLINK_USB_TIMEOUT 10000
*
* SD->SD and SI->SI have to be caught in interface specific code
*/
-u8 VSLLINK_tap_move[6][6] =
+static u8 VSLLINK_tap_move[6][6] =
{
/* TLR RTI SD PD SI PI */
{0xff, 0x7f, 0x2f, 0x0a, 0x37, 0x16}, /* TLR */
unsigned char insert_position;
}insert_insignificant_operation_t;
-insert_insignificant_operation_t VSLLINK_TAP_MOVE_INSERT_INSIGNIFICANT[6][6] =
+static insert_insignificant_operation_t VSLLINK_TAP_MOVE_INSERT_INSIGNIFICANT[6][6] =
{
/* stuff offset */
{/* TLR */
{0, 0,}}, /* PI */
};
-u8 VSLLINK_BIT_MSK[8] =
+static u8 VSLLINK_BIT_MSK[8] =
{
0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f
};
static pending_scan_result_t pending_scan_results_buffer[MAX_PENDING_SCAN_RESULTS];
/* External interface functions */
-int vsllink_execute_queue(void);
-int vsllink_speed(int speed);
-int vsllink_khz(int khz, int *jtag_speed);
-int vsllink_speed_div(int jtag_speed, int *khz);
-int vsllink_register_commands(struct command_context_s *cmd_ctx);
-int vsllink_init(void);
-int vsllink_quit(void);
+static int vsllink_execute_queue(void);
+static int vsllink_speed(int speed);
+static int vsllink_khz(int khz, int *jtag_speed);
+static int vsllink_speed_div(int jtag_speed, int *khz);
+static int vsllink_register_commands(struct command_context_s *cmd_ctx);
+static int vsllink_init(void);
+static int vsllink_quit(void);
/* CLI command handler functions */
-int vsllink_handle_usb_vid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int vsllink_handle_usb_pid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int vsllink_handle_usb_bulkin_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int vsllink_handle_usb_bulkout_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int vsllink_handle_usb_vid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int vsllink_handle_usb_pid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int vsllink_handle_usb_bulkin_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int vsllink_handle_usb_bulkout_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
/* Queue command functions */
-void vsllink_end_state(tap_state_t state);
-void vsllink_state_move(void);
-void vsllink_path_move(int num_states, tap_state_t *path);
-void vsllink_runtest(int num_cycles);
-void vsllink_stableclocks(int num_cycles, int tms);
-void vsllink_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command);
-void vsllink_reset(int trst, int srst);
-void vsllink_simple_command(u8 command);
+static void vsllink_end_state(tap_state_t state);
+static void vsllink_state_move(void);
+static void vsllink_path_move(int num_states, tap_state_t *path);
+static void vsllink_runtest(int num_cycles);
+static void vsllink_stableclocks(int num_cycles, int tms);
+static void vsllink_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command);
+static void vsllink_reset(int trst, int srst);
+static void vsllink_simple_command(u8 command);
/* VSLLink tap buffer functions */
-void vsllink_tap_init(void);
-int vsllink_tap_execute(void);
-void vsllink_tap_ensure_space(int scans, int bytes);
-void vsllink_tap_append_scan(int length, u8 *buffer, scan_command_t *command, int offset);
+static void vsllink_tap_init(void);
+static int vsllink_tap_execute(void);
+static void vsllink_tap_ensure_space(int scans, int bytes);
+static void vsllink_tap_append_scan(int length, u8 *buffer, scan_command_t *command, int offset);
/* VSLLink lowlevel functions */
typedef struct vsllink_jtag
struct usb_dev_handle* usb_handle;
} vsllink_jtag_t;
-vsllink_jtag_t *vsllink_usb_open(void);
-void vsllink_usb_close(vsllink_jtag_t *vsllink_jtag);
-int vsllink_usb_message(vsllink_jtag_t *vsllink_jtag, int out_length, int in_length);
-int vsllink_usb_write(vsllink_jtag_t *vsllink_jtag, int out_length);
-int vsllink_usb_read(vsllink_jtag_t *vsllink_jtag);
+static vsllink_jtag_t *vsllink_usb_open(void);
+static void vsllink_usb_close(vsllink_jtag_t *vsllink_jtag);
+static int vsllink_usb_message(vsllink_jtag_t *vsllink_jtag, int out_length, int in_length);
+static int vsllink_usb_write(vsllink_jtag_t *vsllink_jtag, int out_length);
+static int vsllink_usb_read(vsllink_jtag_t *vsllink_jtag);
-void vsllink_debug_buffer(u8 *buffer, int length);
+#ifdef _DEBUG_USB_COMMS_
+static void vsllink_debug_buffer(u8 *buffer, int length);
+#endif
static int vsllink_tms_data_len = 0;
static u8* vsllink_tms_cmd_pos;
-vsllink_jtag_t* vsllink_jtag_handle;
+static vsllink_jtag_t* vsllink_jtag_handle;
/***************************************************************************/
/* External interface implementation */
.quit = vsllink_quit
};
-int vsllink_execute_queue(void)
+static int vsllink_execute_queue(void)
{
jtag_command_t *cmd = jtag_command_queue;
int scan_size;
return vsllink_tap_execute();
}
-int vsllink_speed(int speed)
+static int vsllink_speed(int speed)
{
int result;
return ERROR_OK;
}
-int vsllink_khz(int khz, int *jtag_speed)
+static int vsllink_khz(int khz, int *jtag_speed)
{
*jtag_speed = khz;
return ERROR_OK;
}
-int vsllink_speed_div(int jtag_speed, int *khz)
+static int vsllink_speed_div(int jtag_speed, int *khz)
{
*khz = jtag_speed;
return ERROR_OK;
}
-int vsllink_register_commands(struct command_context_s *cmd_ctx)
+static int vsllink_register_commands(struct command_context_s *cmd_ctx)
{
register_command(cmd_ctx, NULL, "vsllink_usb_vid", vsllink_handle_usb_vid_command,
COMMAND_CONFIG, NULL);
return ERROR_OK;
}
-int vsllink_init(void)
+static int vsllink_init(void)
{
int check_cnt;
int result;
return ERROR_OK;
}
-int vsllink_quit(void)
+static int vsllink_quit(void)
{
if ((vsllink_usb_in_buffer != NULL) && (vsllink_usb_out_buffer != NULL))
{
// when vsllink_tms_data_len > 0, vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] is the byte that need to be appended.
// length of VSLLINK_CMDJTAGSEQ_TMSBYTE has been set, no need to set it here.
-void vsllink_append_tms(void)
+static void vsllink_append_tms(void)
{
u8 tms_scan = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state());
u16 tms2;
/***************************************************************************/
/* Queue command implementations */
-void vsllink_end_state(tap_state_t state)
+static void vsllink_end_state(tap_state_t state)
{
if (tap_is_state_stable(state))
{
}
/* Goes to the end state. */
-void vsllink_state_move(void)
+static void vsllink_state_move(void)
{
if (vsllink_tms_data_len > 0)
{
}
// write tms from current vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx]
-void vsllink_add_path(int start, int num, tap_state_t *path)
+static void vsllink_add_path(int start, int num, tap_state_t *path)
{
int i;
tap_set_end_state(tap_get_state());
}
-void vsllink_path_move(int num_states, tap_state_t *path)
+static void vsllink_path_move(int num_states, tap_state_t *path)
{
int i, tms_len, tms_cmd_pos, path_idx = 0;
}
}
-void vsllink_stableclocks(int num_cycles, int tms)
+static void vsllink_stableclocks(int num_cycles, int tms)
{
int tms_len;
u16 tms_append_byte;
}
}
-void vsllink_runtest(int num_cycles)
+static void vsllink_runtest(int num_cycles)
{
tap_state_t saved_end_state = tap_get_end_state();
}
}
-void vsllink_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command)
+static void vsllink_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command)
{
tap_state_t saved_end_state;
u8 bits_left, tms_tmp, tdi_len;
tap_set_state(tap_get_end_state());
}
-void vsllink_reset(int trst, int srst)
+static void vsllink_reset(int trst, int srst)
{
int result;
}
}
-void vsllink_simple_command(u8 command)
+static void vsllink_simple_command(u8 command)
{
int result;
}
}
-int vsllink_handle_usb_vid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int vsllink_handle_usb_vid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc != 1) {
LOG_ERROR("parameter error, should be one parameter for VID");
return ERROR_OK;
}
-int vsllink_handle_usb_pid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int vsllink_handle_usb_pid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc != 1) {
LOG_ERROR("parameter error, should be one parameter for PID");
return ERROR_OK;
}
-int vsllink_handle_usb_bulkin_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int vsllink_handle_usb_bulkin_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc != 1) {
LOG_ERROR("parameter error, should be one parameter for BULKIN endpoint");
return ERROR_OK;
}
-int vsllink_handle_usb_bulkout_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int vsllink_handle_usb_bulkout_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc != 1) {
LOG_ERROR("parameter error, should be one parameter for BULKOUT endpoint");
/***************************************************************************/
/* VSLLink tap functions */
-void vsllink_tap_init(void)
+static void vsllink_tap_init(void)
{
vsllink_usb_out_buffer_idx = 0;
vsllink_usb_in_want_length = 0;
pending_scan_results_length = 0;
}
-void vsllink_tap_ensure_space(int scans, int bytes)
+static void vsllink_tap_ensure_space(int scans, int bytes)
{
int available_scans = MAX_PENDING_SCAN_RESULTS - pending_scan_results_length;
int available_bytes = VSLLINK_BufferSize - vsllink_usb_out_buffer_idx;
}
}
-void vsllink_tap_append_scan(int length, u8 *buffer, scan_command_t *command, int offset)
+static void vsllink_tap_append_scan(int length, u8 *buffer, scan_command_t *command, int offset)
{
pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[pending_scan_results_length];
int i;
/* Pad and send a tap sequence to the device, and receive the answer.
* For the purpose of padding we assume that we are in reset or idle or pause state. */
-int vsllink_tap_execute(void)
+static int vsllink_tap_execute(void)
{
int i;
int result;
return NULL;
}
-void vsllink_usb_close(vsllink_jtag_t *vsllink_jtag)
+static void vsllink_usb_close(vsllink_jtag_t *vsllink_jtag)
{
usb_close(vsllink_jtag->usb_handle);
free(vsllink_jtag);
}
/* Send a message and receive the reply. */
-int vsllink_usb_message(vsllink_jtag_t *vsllink_jtag, int out_length, int in_length)
+static int vsllink_usb_message(vsllink_jtag_t *vsllink_jtag, int out_length, int in_length)
{
int result;
}
/* Write data from out_buffer to USB. */
-int vsllink_usb_write(vsllink_jtag_t *vsllink_jtag, int out_length)
+static int vsllink_usb_write(vsllink_jtag_t *vsllink_jtag, int out_length)
{
int result;
}
/* Read data from USB into in_buffer. */
-int vsllink_usb_read(vsllink_jtag_t *vsllink_jtag)
+static int vsllink_usb_read(vsllink_jtag_t *vsllink_jtag)
{
int result = usb_bulk_read(vsllink_jtag->usb_handle, vsllink_bulkin, \
(char *)vsllink_usb_in_buffer, VSLLINK_BufferSize, VSLLINK_USB_TIMEOUT);
#define BYTES_PER_LINE 16
-void vsllink_debug_buffer(u8 *buffer, int length)
+#ifdef _DEBUG_USB_COMMS_
+static void vsllink_debug_buffer(u8 *buffer, int length)
{
char line[81];
char s[4];
LOG_DEBUG(line);
}
}
+#endif // _DEBUG_USB_COMMS_