jtag/commands: Use 'unsigned int' data type
This patch modifies as little code as possible in order to simplify the review. Data types that are affected by these changes will be addresses in following patches. While at it, apply coding style fixes if these are not too extensive. Change-Id: Ie048b3d472f546fecb6733f17f9d0f17fda40187 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: https://review.openocd.org/c/openocd/+/8404 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
parent
42450345dd
commit
0847a4d7fb
|
@ -166,10 +166,9 @@ void jtag_scan_field_clone(struct scan_field *dst, const struct scan_field *src)
|
|||
|
||||
enum scan_type jtag_scan_type(const struct scan_command *cmd)
|
||||
{
|
||||
int i;
|
||||
int type = 0;
|
||||
|
||||
for (i = 0; i < cmd->num_fields; i++) {
|
||||
for (unsigned int i = 0; i < cmd->num_fields; i++) {
|
||||
if (cmd->fields[i].in_value)
|
||||
type |= SCAN_IN;
|
||||
if (cmd->fields[i].out_value)
|
||||
|
@ -182,10 +181,9 @@ enum scan_type jtag_scan_type(const struct scan_command *cmd)
|
|||
int jtag_scan_size(const struct scan_command *cmd)
|
||||
{
|
||||
int bit_count = 0;
|
||||
int i;
|
||||
|
||||
/* count bits in scan command */
|
||||
for (i = 0; i < cmd->num_fields; i++)
|
||||
for (unsigned int i = 0; i < cmd->num_fields; i++)
|
||||
bit_count += cmd->fields[i].num_bits;
|
||||
|
||||
return bit_count;
|
||||
|
@ -194,18 +192,17 @@ int jtag_scan_size(const struct scan_command *cmd)
|
|||
int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer)
|
||||
{
|
||||
int bit_count = 0;
|
||||
int i;
|
||||
|
||||
bit_count = jtag_scan_size(cmd);
|
||||
*buffer = calloc(1, DIV_ROUND_UP(bit_count, 8));
|
||||
|
||||
bit_count = 0;
|
||||
|
||||
LOG_DEBUG_IO("%s num_fields: %i",
|
||||
LOG_DEBUG_IO("%s num_fields: %u",
|
||||
cmd->ir_scan ? "IRSCAN" : "DRSCAN",
|
||||
cmd->num_fields);
|
||||
|
||||
for (i = 0; i < cmd->num_fields; i++) {
|
||||
for (unsigned int i = 0; i < cmd->num_fields; i++) {
|
||||
if (cmd->fields[i].out_value) {
|
||||
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO)) {
|
||||
char *char_buf = buf_to_hex_str(cmd->fields[i].out_value,
|
||||
|
@ -213,14 +210,14 @@ int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer)
|
|||
? DEBUG_JTAG_IOZ
|
||||
: cmd->fields[i].num_bits);
|
||||
|
||||
LOG_DEBUG("fields[%i].out_value[%i]: 0x%s", i,
|
||||
LOG_DEBUG("fields[%u].out_value[%i]: 0x%s", i,
|
||||
cmd->fields[i].num_bits, char_buf);
|
||||
free(char_buf);
|
||||
}
|
||||
buf_set_buf(cmd->fields[i].out_value, 0, *buffer,
|
||||
bit_count, cmd->fields[i].num_bits);
|
||||
} else {
|
||||
LOG_DEBUG_IO("fields[%i].out_value[%i]: NULL",
|
||||
LOG_DEBUG_IO("fields[%u].out_value[%i]: NULL",
|
||||
i, cmd->fields[i].num_bits);
|
||||
}
|
||||
|
||||
|
@ -234,14 +231,13 @@ int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer)
|
|||
|
||||
int jtag_read_buffer(uint8_t *buffer, const struct scan_command *cmd)
|
||||
{
|
||||
int i;
|
||||
int bit_count = 0;
|
||||
int retval;
|
||||
|
||||
/* we return ERROR_OK, unless a check fails, or a handler reports a problem */
|
||||
retval = ERROR_OK;
|
||||
|
||||
for (i = 0; i < cmd->num_fields; i++) {
|
||||
for (unsigned int i = 0; i < cmd->num_fields; i++) {
|
||||
/* if neither in_value nor in_handler
|
||||
* are specified we don't have to examine this field
|
||||
*/
|
||||
|
@ -256,7 +252,7 @@ int jtag_read_buffer(uint8_t *buffer, const struct scan_command *cmd)
|
|||
? DEBUG_JTAG_IOZ
|
||||
: num_bits);
|
||||
|
||||
LOG_DEBUG("fields[%i].in_value[%i]: 0x%s",
|
||||
LOG_DEBUG("fields[%u].in_value[%i]: 0x%s",
|
||||
i, num_bits, char_buf);
|
||||
free(char_buf);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ struct scan_command {
|
|||
/** instruction/not data scan */
|
||||
bool ir_scan;
|
||||
/** number of fields in *fields array */
|
||||
int num_fields;
|
||||
unsigned int num_fields;
|
||||
/** pointer to an array of data scan fields */
|
||||
struct scan_field *fields;
|
||||
/** state in which JTAG commands should finish */
|
||||
|
@ -50,14 +50,14 @@ struct statemove_command {
|
|||
|
||||
struct pathmove_command {
|
||||
/** number of states in *path */
|
||||
int num_states;
|
||||
unsigned int num_states;
|
||||
/** states that have to be passed */
|
||||
tap_state_t *path;
|
||||
};
|
||||
|
||||
struct runtest_command {
|
||||
/** number of cycles to spend in Run-Test/Idle state */
|
||||
int num_cycles;
|
||||
unsigned int num_cycles;
|
||||
/** state in which JTAG commands should finish */
|
||||
tap_state_t end_state;
|
||||
};
|
||||
|
@ -65,7 +65,7 @@ struct runtest_command {
|
|||
|
||||
struct stableclocks_command {
|
||||
/** number of clock cycles that should be sent */
|
||||
int num_cycles;
|
||||
unsigned int num_cycles;
|
||||
};
|
||||
|
||||
|
||||
|
@ -100,7 +100,7 @@ struct sleep_command {
|
|||
*/
|
||||
struct tms_command {
|
||||
/** How many bits should be clocked out. */
|
||||
unsigned num_bits;
|
||||
unsigned int num_bits;
|
||||
/** The bits to clock out; the LSB is bit 0 of bits[0]. */
|
||||
const uint8_t *bits;
|
||||
};
|
||||
|
|
|
@ -514,7 +514,7 @@ int jtag_add_tms_seq(unsigned nbits, const uint8_t *seq, enum tap_state state)
|
|||
return retval;
|
||||
}
|
||||
|
||||
void jtag_add_pathmove(int num_states, const tap_state_t *path)
|
||||
void jtag_add_pathmove(unsigned int num_states, const tap_state_t *path)
|
||||
{
|
||||
tap_state_t cur_state = cmd_queue_cur_state;
|
||||
|
||||
|
@ -525,7 +525,7 @@ void jtag_add_pathmove(int num_states, const tap_state_t *path)
|
|||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < num_states; i++) {
|
||||
for (unsigned int i = 0; i < num_states; i++) {
|
||||
if (path[i] == TAP_RESET) {
|
||||
LOG_ERROR("BUG: TAP_RESET is not a valid state for pathmove sequences");
|
||||
jtag_set_error(ERROR_JTAG_STATE_INVALID);
|
||||
|
@ -589,14 +589,14 @@ int jtag_add_statemove(tap_state_t goal_state)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
void jtag_add_runtest(int num_cycles, tap_state_t state)
|
||||
void jtag_add_runtest(unsigned int num_cycles, tap_state_t state)
|
||||
{
|
||||
jtag_prelude(state);
|
||||
jtag_set_error(interface_jtag_add_runtest(num_cycles, state));
|
||||
}
|
||||
|
||||
|
||||
void jtag_add_clocks(int num_cycles)
|
||||
void jtag_add_clocks(unsigned int num_cycles)
|
||||
{
|
||||
if (!tap_is_state_stable(cmd_queue_cur_state)) {
|
||||
LOG_ERROR("jtag_add_clocks() called with TAP in unstable state \"%s\"",
|
||||
|
@ -960,7 +960,7 @@ int default_interface_jtag_execute_queue(void)
|
|||
LOG_DEBUG_IO("JTAG %s SCAN to %s",
|
||||
cmd->cmd.scan->ir_scan ? "IR" : "DR",
|
||||
tap_state_name(cmd->cmd.scan->end_state));
|
||||
for (int i = 0; i < cmd->cmd.scan->num_fields; i++) {
|
||||
for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++) {
|
||||
struct scan_field *field = cmd->cmd.scan->fields + i;
|
||||
if (field->out_value) {
|
||||
char *str = buf_to_hex_str(field->out_value, field->num_bits);
|
||||
|
|
|
@ -203,7 +203,7 @@ static void amt_jtagaccel_state_move(void)
|
|||
tap_set_state(end_state);
|
||||
}
|
||||
|
||||
static void amt_jtagaccel_runtest(int num_cycles)
|
||||
static void amt_jtagaccel_runtest(unsigned int num_cycles)
|
||||
{
|
||||
int i = 0;
|
||||
uint8_t aw_scan_tms_5;
|
||||
|
|
|
@ -1836,15 +1836,17 @@ static int angie_reset(int trst, int srst)
|
|||
*/
|
||||
static int angie_queue_pathmove(struct angie *device, struct jtag_command *cmd)
|
||||
{
|
||||
int ret, i, num_states, batch_size, state_count;
|
||||
int ret, state_count;
|
||||
tap_state_t *path;
|
||||
uint8_t tms_sequence;
|
||||
|
||||
num_states = cmd->cmd.pathmove->num_states;
|
||||
unsigned int num_states = cmd->cmd.pathmove->num_states;
|
||||
path = cmd->cmd.pathmove->path;
|
||||
state_count = 0;
|
||||
|
||||
while (num_states > 0) {
|
||||
unsigned int batch_size;
|
||||
|
||||
tms_sequence = 0;
|
||||
|
||||
/* Determine batch size */
|
||||
|
@ -1853,7 +1855,7 @@ static int angie_queue_pathmove(struct angie *device, struct jtag_command *cmd)
|
|||
else
|
||||
batch_size = num_states;
|
||||
|
||||
for (i = 0; i < batch_size; i++) {
|
||||
for (unsigned int i = 0; i < batch_size; i++) {
|
||||
if (tap_state_transition(tap_get_state(), false) == path[state_count]) {
|
||||
/* Append '0' transition: clear bit 'i' in tms_sequence */
|
||||
buf_set_u32(&tms_sequence, i, 1, 0x0);
|
||||
|
@ -1908,14 +1910,13 @@ static int angie_queue_sleep(struct angie *device, struct jtag_command *cmd)
|
|||
static int angie_queue_stableclocks(struct angie *device, struct jtag_command *cmd)
|
||||
{
|
||||
int ret;
|
||||
unsigned int num_cycles;
|
||||
|
||||
if (!tap_is_state_stable(tap_get_state())) {
|
||||
LOG_ERROR("JTAG_STABLECLOCKS: state not stable");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
num_cycles = cmd->cmd.stableclocks->num_cycles;
|
||||
unsigned int num_cycles = cmd->cmd.stableclocks->num_cycles;
|
||||
|
||||
/* TMS stays either high (Test Logic Reset state) or low (all other states) */
|
||||
if (tap_get_state() == TAP_RESET)
|
||||
|
|
|
@ -44,8 +44,8 @@ static uint8_t usb_out_buffer[ARMJTAGEW_OUT_BUFFER_SIZE];
|
|||
/* Queue command functions */
|
||||
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_path_move(unsigned int num_states, tap_state_t *path);
|
||||
static void armjtagew_runtest(unsigned int num_cycles);
|
||||
static void armjtagew_scan(bool ir_scan,
|
||||
enum scan_type type,
|
||||
uint8_t *buffer,
|
||||
|
@ -95,7 +95,7 @@ static int armjtagew_execute_queue(struct jtag_command *cmd_queue)
|
|||
while (cmd) {
|
||||
switch (cmd->type) {
|
||||
case JTAG_RUNTEST:
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %i",
|
||||
LOG_DEBUG_IO("runtest %u cycles, end in %i",
|
||||
cmd->cmd.runtest->num_cycles,
|
||||
cmd->cmd.runtest->end_state);
|
||||
|
||||
|
@ -111,7 +111,7 @@ static int armjtagew_execute_queue(struct jtag_command *cmd_queue)
|
|||
break;
|
||||
|
||||
case JTAG_PATHMOVE:
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %i",
|
||||
LOG_DEBUG_IO("pathmove: %u states, end in %i",
|
||||
cmd->cmd.pathmove->num_states,
|
||||
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
|
||||
|
||||
|
@ -279,11 +279,9 @@ static void armjtagew_state_move(void)
|
|||
tap_set_state(tap_get_end_state());
|
||||
}
|
||||
|
||||
static void armjtagew_path_move(int num_states, tap_state_t *path)
|
||||
static void armjtagew_path_move(unsigned int num_states, tap_state_t *path)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_states; i++) {
|
||||
for (unsigned int i = 0; i < num_states; i++) {
|
||||
/*
|
||||
* TODO: The ARM-JTAG-EW hardware delays TDI with 3 TCK cycles when in RTCK mode.
|
||||
* Either handle that here, or update the documentation with examples
|
||||
|
@ -305,10 +303,8 @@ static void armjtagew_path_move(int num_states, tap_state_t *path)
|
|||
tap_set_end_state(tap_get_state());
|
||||
}
|
||||
|
||||
static void armjtagew_runtest(int num_cycles)
|
||||
static void armjtagew_runtest(unsigned int num_cycles)
|
||||
{
|
||||
int i;
|
||||
|
||||
tap_state_t saved_end_state = tap_get_end_state();
|
||||
|
||||
/* only do a state_move when we're not already in IDLE */
|
||||
|
@ -318,7 +314,7 @@ static void armjtagew_runtest(int num_cycles)
|
|||
}
|
||||
|
||||
/* execute num_cycles */
|
||||
for (i = 0; i < num_cycles; i++)
|
||||
for (unsigned int i = 0; i < num_cycles; i++)
|
||||
armjtagew_tap_append_step(0, 0);
|
||||
|
||||
/* finish in end_state */
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
* this function checks the current stable state to decide on the value of TMS
|
||||
* to use.
|
||||
*/
|
||||
static int bitbang_stableclocks(int num_cycles);
|
||||
static int bitbang_stableclocks(unsigned int num_cycles);
|
||||
|
||||
static void bitbang_swd_write_reg(uint8_t cmd, uint32_t value, uint32_t ap_delay_clk);
|
||||
|
||||
|
@ -95,7 +95,7 @@ static int bitbang_execute_tms(struct jtag_command *cmd)
|
|||
unsigned num_bits = cmd->cmd.tms->num_bits;
|
||||
const uint8_t *bits = cmd->cmd.tms->bits;
|
||||
|
||||
LOG_DEBUG_IO("TMS: %d bits", num_bits);
|
||||
LOG_DEBUG_IO("TMS: %u bits", num_bits);
|
||||
|
||||
int tms = 0;
|
||||
for (unsigned i = 0; i < num_bits; i++) {
|
||||
|
@ -113,7 +113,7 @@ static int bitbang_execute_tms(struct jtag_command *cmd)
|
|||
|
||||
static int bitbang_path_move(struct pathmove_command *cmd)
|
||||
{
|
||||
int num_states = cmd->num_states;
|
||||
unsigned int num_states = cmd->num_states;
|
||||
int state_count;
|
||||
int tms = 0;
|
||||
|
||||
|
@ -147,10 +147,8 @@ static int bitbang_path_move(struct pathmove_command *cmd)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static int bitbang_runtest(int num_cycles)
|
||||
static int bitbang_runtest(unsigned int num_cycles)
|
||||
{
|
||||
int i;
|
||||
|
||||
tap_state_t saved_end_state = tap_get_end_state();
|
||||
|
||||
/* only do a state_move when we're not already in IDLE */
|
||||
|
@ -161,7 +159,7 @@ static int bitbang_runtest(int num_cycles)
|
|||
}
|
||||
|
||||
/* execute num_cycles */
|
||||
for (i = 0; i < num_cycles; i++) {
|
||||
for (unsigned int i = 0; i < num_cycles; i++) {
|
||||
if (bitbang_interface->write(0, 0, 0) != ERROR_OK)
|
||||
return ERROR_FAIL;
|
||||
if (bitbang_interface->write(1, 0, 0) != ERROR_OK)
|
||||
|
@ -179,13 +177,12 @@ static int bitbang_runtest(int num_cycles)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static int bitbang_stableclocks(int num_cycles)
|
||||
static int bitbang_stableclocks(unsigned int num_cycles)
|
||||
{
|
||||
int tms = (tap_get_state() == TAP_RESET ? 1 : 0);
|
||||
int i;
|
||||
|
||||
/* send num_cycles clocks onto the cable */
|
||||
for (i = 0; i < num_cycles; i++) {
|
||||
for (unsigned int i = 0; i < num_cycles; i++) {
|
||||
if (bitbang_interface->write(1, tms, 0) != ERROR_OK)
|
||||
return ERROR_FAIL;
|
||||
if (bitbang_interface->write(0, tms, 0) != ERROR_OK)
|
||||
|
@ -319,7 +316,7 @@ int bitbang_execute_queue(struct jtag_command *cmd_queue)
|
|||
while (cmd) {
|
||||
switch (cmd->type) {
|
||||
case JTAG_RUNTEST:
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %s",
|
||||
LOG_DEBUG_IO("runtest %u cycles, end in %s",
|
||||
cmd->cmd.runtest->num_cycles,
|
||||
tap_state_name(cmd->cmd.runtest->end_state));
|
||||
bitbang_end_state(cmd->cmd.runtest->end_state);
|
||||
|
@ -343,7 +340,7 @@ int bitbang_execute_queue(struct jtag_command *cmd_queue)
|
|||
return ERROR_FAIL;
|
||||
break;
|
||||
case JTAG_PATHMOVE:
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %s",
|
||||
LOG_DEBUG_IO("pathmove: %u states, end in %s",
|
||||
cmd->cmd.pathmove->num_states,
|
||||
tap_state_name(cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]));
|
||||
if (bitbang_path_move(cmd->cmd.pathmove) != ERROR_OK)
|
||||
|
|
|
@ -18,7 +18,7 @@ struct bitq_interface *bitq_interface; /* low level bit queue interface */
|
|||
/* state of input queue */
|
||||
struct bitq_state {
|
||||
struct jtag_command *cmd; /* command currently processed */
|
||||
int field_idx; /* index of field currently being processed */
|
||||
unsigned int field_idx; /* index of field currently being processed */
|
||||
int bit_pos; /* position of bit currently being processed */
|
||||
int status; /* processing status */
|
||||
};
|
||||
|
@ -108,9 +108,7 @@ static void bitq_state_move(tap_state_t new_state)
|
|||
|
||||
static void bitq_path_move(struct pathmove_command *cmd)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < cmd->num_states; i++) {
|
||||
for (unsigned int i = 0; i < cmd->num_states; i++) {
|
||||
if (tap_state_transition(tap_get_state(), false) == cmd->path[i])
|
||||
bitq_io(0, 0, 0);
|
||||
else if (tap_state_transition(tap_get_state(), true) == cmd->path[i])
|
||||
|
@ -127,16 +125,14 @@ static void bitq_path_move(struct pathmove_command *cmd)
|
|||
tap_set_end_state(tap_get_state());
|
||||
}
|
||||
|
||||
static void bitq_runtest(int num_cycles)
|
||||
static void bitq_runtest(unsigned int num_cycles)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* only do a state_move when we're not already in IDLE */
|
||||
if (tap_get_state() != TAP_IDLE)
|
||||
bitq_state_move(TAP_IDLE);
|
||||
|
||||
/* execute num_cycles */
|
||||
for (i = 0; i < num_cycles; i++)
|
||||
for (unsigned int i = 0; i < num_cycles; i++)
|
||||
bitq_io(0, 0, 0);
|
||||
|
||||
/* finish in end_state */
|
||||
|
@ -190,13 +186,12 @@ static void bitq_scan_field(struct scan_field *field, int do_pause)
|
|||
|
||||
static void bitq_scan(struct scan_command *cmd)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (cmd->ir_scan)
|
||||
bitq_state_move(TAP_IRSHIFT);
|
||||
else
|
||||
bitq_state_move(TAP_DRSHIFT);
|
||||
|
||||
unsigned int i;
|
||||
for (i = 0; i < cmd->num_fields - 1; i++)
|
||||
bitq_scan_field(&cmd->fields[i], 0);
|
||||
|
||||
|
@ -226,7 +221,7 @@ int bitq_execute_queue(struct jtag_command *cmd_queue)
|
|||
break;
|
||||
|
||||
case JTAG_RUNTEST:
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles, cmd->cmd.runtest->end_state);
|
||||
LOG_DEBUG_IO("runtest %u cycles, end in %i", cmd->cmd.runtest->num_cycles, cmd->cmd.runtest->end_state);
|
||||
bitq_end_state(cmd->cmd.runtest->end_state);
|
||||
bitq_runtest(cmd->cmd.runtest->num_cycles);
|
||||
break;
|
||||
|
@ -238,7 +233,7 @@ int bitq_execute_queue(struct jtag_command *cmd_queue)
|
|||
break;
|
||||
|
||||
case JTAG_PATHMOVE:
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %i", cmd->cmd.pathmove->num_states,
|
||||
LOG_DEBUG_IO("pathmove: %u states, end in %i", cmd->cmd.pathmove->num_states,
|
||||
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
|
||||
bitq_path_move(cmd->cmd.pathmove);
|
||||
break;
|
||||
|
|
|
@ -27,11 +27,11 @@ static int buspirate_reset(int trst, int srst);
|
|||
|
||||
static void buspirate_end_state(tap_state_t state);
|
||||
static void buspirate_state_move(void);
|
||||
static void buspirate_path_move(int num_states, tap_state_t *path);
|
||||
static void buspirate_runtest(int num_cycles);
|
||||
static void buspirate_path_move(unsigned int num_states, tap_state_t *path);
|
||||
static void buspirate_runtest(unsigned int num_cycles);
|
||||
static void buspirate_scan(bool ir_scan, enum scan_type type,
|
||||
uint8_t *buffer, int scan_size, struct scan_command *command);
|
||||
static void buspirate_stableclocks(int num_cycles);
|
||||
static void buspirate_stableclocks(unsigned int num_cycles);
|
||||
|
||||
#define CMD_UNKNOWN 0x00
|
||||
#define CMD_PORT_MODE 0x01
|
||||
|
@ -162,7 +162,7 @@ static int buspirate_execute_queue(struct jtag_command *cmd_queue)
|
|||
while (cmd) {
|
||||
switch (cmd->type) {
|
||||
case JTAG_RUNTEST:
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %s",
|
||||
LOG_DEBUG_IO("runtest %u cycles, end in %s",
|
||||
cmd->cmd.runtest->num_cycles,
|
||||
tap_state_name(cmd->cmd.runtest
|
||||
->end_state));
|
||||
|
@ -180,7 +180,7 @@ static int buspirate_execute_queue(struct jtag_command *cmd_queue)
|
|||
buspirate_state_move();
|
||||
break;
|
||||
case JTAG_PATHMOVE:
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %s",
|
||||
LOG_DEBUG_IO("pathmove: %u states, end in %s",
|
||||
cmd->cmd.pathmove->num_states,
|
||||
tap_state_name(cmd->cmd.pathmove
|
||||
->path[cmd->cmd.pathmove
|
||||
|
@ -210,7 +210,7 @@ static int buspirate_execute_queue(struct jtag_command *cmd_queue)
|
|||
jtag_sleep(cmd->cmd.sleep->us);
|
||||
break;
|
||||
case JTAG_STABLECLOCKS:
|
||||
LOG_DEBUG_IO("stable clock %i cycles", cmd->cmd.stableclocks->num_cycles);
|
||||
LOG_DEBUG_IO("stable clock %u cycles", cmd->cmd.stableclocks->num_cycles);
|
||||
buspirate_stableclocks(cmd->cmd.stableclocks->num_cycles);
|
||||
break;
|
||||
default:
|
||||
|
@ -580,11 +580,9 @@ static void buspirate_state_move(void)
|
|||
tap_set_state(tap_get_end_state());
|
||||
}
|
||||
|
||||
static void buspirate_path_move(int num_states, tap_state_t *path)
|
||||
static void buspirate_path_move(unsigned int num_states, tap_state_t *path)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_states; i++) {
|
||||
for (unsigned int i = 0; i < num_states; i++) {
|
||||
if (tap_state_transition(tap_get_state(), false) == path[i]) {
|
||||
buspirate_tap_append(0, 0);
|
||||
} else if (tap_state_transition(tap_get_state(), true)
|
||||
|
@ -604,10 +602,8 @@ static void buspirate_path_move(int num_states, tap_state_t *path)
|
|||
tap_set_end_state(tap_get_state());
|
||||
}
|
||||
|
||||
static void buspirate_runtest(int num_cycles)
|
||||
static void buspirate_runtest(unsigned int num_cycles)
|
||||
{
|
||||
int i;
|
||||
|
||||
tap_state_t saved_end_state = tap_get_end_state();
|
||||
|
||||
/* only do a state_move when we're not already in IDLE */
|
||||
|
@ -616,7 +612,7 @@ static void buspirate_runtest(int num_cycles)
|
|||
buspirate_state_move();
|
||||
}
|
||||
|
||||
for (i = 0; i < num_cycles; i++)
|
||||
for (unsigned int i = 0; i < num_cycles; i++)
|
||||
buspirate_tap_append(0, 0);
|
||||
|
||||
LOG_DEBUG_IO("runtest: cur_state %s end_state %s",
|
||||
|
@ -658,14 +654,13 @@ static void buspirate_scan(bool ir_scan, enum scan_type type,
|
|||
buspirate_state_move();
|
||||
}
|
||||
|
||||
static void buspirate_stableclocks(int num_cycles)
|
||||
static void buspirate_stableclocks(unsigned int num_cycles)
|
||||
{
|
||||
int i;
|
||||
int tms = (tap_get_state() == TAP_RESET ? 1 : 0);
|
||||
|
||||
buspirate_tap_make_space(0, num_cycles);
|
||||
|
||||
for (i = 0; i < num_cycles; i++)
|
||||
for (unsigned int i = 0; i < num_cycles; i++)
|
||||
buspirate_tap_append(tms, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1752,7 +1752,7 @@ static void cmsis_dap_execute_scan(struct jtag_command *cmd)
|
|||
LOG_DEBUG("discarding trailing empty field");
|
||||
}
|
||||
|
||||
if (cmd->cmd.scan->num_fields == 0) {
|
||||
if (!cmd->cmd.scan->num_fields) {
|
||||
LOG_DEBUG("empty scan, doing nothing");
|
||||
return;
|
||||
}
|
||||
|
@ -1774,9 +1774,9 @@ static void cmsis_dap_execute_scan(struct jtag_command *cmd)
|
|||
struct scan_field *field = cmd->cmd.scan->fields;
|
||||
unsigned scan_size = 0;
|
||||
|
||||
for (int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
|
||||
for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
|
||||
scan_size += field->num_bits;
|
||||
LOG_DEBUG_IO("%s%s field %d/%d %d bits",
|
||||
LOG_DEBUG_IO("%s%s field %u/%u %d bits",
|
||||
field->in_value ? "in" : "",
|
||||
field->out_value ? "out" : "",
|
||||
i,
|
||||
|
@ -1872,16 +1872,16 @@ static void cmsis_dap_execute_pathmove(struct jtag_command *cmd)
|
|||
cmsis_dap_pathmove(cmd->cmd.pathmove->num_states, cmd->cmd.pathmove->path);
|
||||
}
|
||||
|
||||
static void cmsis_dap_stableclocks(int num_cycles)
|
||||
static void cmsis_dap_stableclocks(unsigned int num_cycles)
|
||||
{
|
||||
uint8_t tms = tap_get_state() == TAP_RESET;
|
||||
/* TODO: Perform optimizations? */
|
||||
/* Execute num_cycles. */
|
||||
for (int i = 0; i < num_cycles; i++)
|
||||
for (unsigned int i = 0; i < num_cycles; i++)
|
||||
cmsis_dap_add_tms_sequence(&tms, 1);
|
||||
}
|
||||
|
||||
static void cmsis_dap_runtest(int num_cycles)
|
||||
static void cmsis_dap_runtest(unsigned int num_cycles)
|
||||
{
|
||||
tap_state_t saved_end_state = tap_get_end_state();
|
||||
|
||||
|
@ -1901,7 +1901,7 @@ static void cmsis_dap_runtest(int num_cycles)
|
|||
|
||||
static void cmsis_dap_execute_runtest(struct jtag_command *cmd)
|
||||
{
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles,
|
||||
LOG_DEBUG_IO("runtest %u cycles, end in %i", cmd->cmd.runtest->num_cycles,
|
||||
cmd->cmd.runtest->end_state);
|
||||
|
||||
cmsis_dap_end_state(cmd->cmd.runtest->end_state);
|
||||
|
@ -1910,13 +1910,13 @@ static void cmsis_dap_execute_runtest(struct jtag_command *cmd)
|
|||
|
||||
static void cmsis_dap_execute_stableclocks(struct jtag_command *cmd)
|
||||
{
|
||||
LOG_DEBUG_IO("stableclocks %i cycles", cmd->cmd.runtest->num_cycles);
|
||||
LOG_DEBUG_IO("stableclocks %u cycles", cmd->cmd.runtest->num_cycles);
|
||||
cmsis_dap_stableclocks(cmd->cmd.runtest->num_cycles);
|
||||
}
|
||||
|
||||
static void cmsis_dap_execute_tms(struct jtag_command *cmd)
|
||||
{
|
||||
LOG_DEBUG_IO("TMS: %d bits", cmd->cmd.tms->num_bits);
|
||||
LOG_DEBUG_IO("TMS: %u bits", cmd->cmd.tms->num_bits);
|
||||
cmsis_dap_cmd_dap_swj_sequence(cmd->cmd.tms->num_bits, cmd->cmd.tms->bits);
|
||||
}
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ int interface_add_tms_seq(unsigned num_bits, const uint8_t *seq, enum tap_state
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
int interface_jtag_add_pathmove(int num_states, const tap_state_t *path)
|
||||
int interface_jtag_add_pathmove(unsigned int num_states, const tap_state_t *path)
|
||||
{
|
||||
/* allocate memory for a new list member */
|
||||
struct jtag_command *cmd = cmd_queue_alloc(sizeof(struct jtag_command));
|
||||
|
@ -272,13 +272,13 @@ int interface_jtag_add_pathmove(int num_states, const tap_state_t *path)
|
|||
cmd->cmd.pathmove->num_states = num_states;
|
||||
cmd->cmd.pathmove->path = cmd_queue_alloc(sizeof(tap_state_t) * num_states);
|
||||
|
||||
for (int i = 0; i < num_states; i++)
|
||||
for (unsigned int i = 0; i < num_states; i++)
|
||||
cmd->cmd.pathmove->path[i] = path[i];
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
int interface_jtag_add_runtest(int num_cycles, tap_state_t state)
|
||||
int interface_jtag_add_runtest(unsigned int num_cycles, tap_state_t state)
|
||||
{
|
||||
/* allocate memory for a new list member */
|
||||
struct jtag_command *cmd = cmd_queue_alloc(sizeof(struct jtag_command));
|
||||
|
@ -294,7 +294,7 @@ int interface_jtag_add_runtest(int num_cycles, tap_state_t state)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
int interface_jtag_add_clocks(int num_cycles)
|
||||
int interface_jtag_add_clocks(unsigned int num_cycles)
|
||||
{
|
||||
/* allocate memory for a new list member */
|
||||
struct jtag_command *cmd = cmd_queue_alloc(sizeof(struct jtag_command));
|
||||
|
|
|
@ -657,7 +657,7 @@ static int syncbb_execute_tms(struct jtag_command *cmd)
|
|||
unsigned num_bits = cmd->cmd.tms->num_bits;
|
||||
const uint8_t *bits = cmd->cmd.tms->bits;
|
||||
|
||||
LOG_DEBUG_IO("TMS: %d bits", num_bits);
|
||||
LOG_DEBUG_IO("TMS: %u bits", num_bits);
|
||||
|
||||
int tms = 0;
|
||||
for (unsigned i = 0; i < num_bits; i++) {
|
||||
|
@ -672,7 +672,7 @@ static int syncbb_execute_tms(struct jtag_command *cmd)
|
|||
|
||||
static void syncbb_path_move(struct pathmove_command *cmd)
|
||||
{
|
||||
int num_states = cmd->num_states;
|
||||
unsigned int num_states = cmd->num_states;
|
||||
int state_count;
|
||||
int tms = 0;
|
||||
|
||||
|
@ -702,9 +702,8 @@ static void syncbb_path_move(struct pathmove_command *cmd)
|
|||
tap_set_end_state(tap_get_state());
|
||||
}
|
||||
|
||||
static void syncbb_runtest(int num_cycles)
|
||||
static void syncbb_runtest(unsigned int num_cycles)
|
||||
{
|
||||
int i;
|
||||
|
||||
tap_state_t saved_end_state = tap_get_end_state();
|
||||
|
||||
|
@ -715,7 +714,7 @@ static void syncbb_runtest(int num_cycles)
|
|||
}
|
||||
|
||||
/* execute num_cycles */
|
||||
for (i = 0; i < num_cycles; i++) {
|
||||
for (unsigned int i = 0; i < num_cycles; i++) {
|
||||
ft232r_write(0, 0, 0);
|
||||
ft232r_write(1, 0, 0);
|
||||
}
|
||||
|
@ -735,13 +734,12 @@ static void syncbb_runtest(int num_cycles)
|
|||
* this function checks the current stable state to decide on the value of TMS
|
||||
* to use.
|
||||
*/
|
||||
static void syncbb_stableclocks(int num_cycles)
|
||||
static void syncbb_stableclocks(unsigned int num_cycles)
|
||||
{
|
||||
int tms = (tap_get_state() == TAP_RESET ? 1 : 0);
|
||||
int i;
|
||||
|
||||
/* send num_cycles clocks onto the cable */
|
||||
for (i = 0; i < num_cycles; i++) {
|
||||
for (unsigned int i = 0; i < num_cycles; i++) {
|
||||
ft232r_write(1, tms, 0);
|
||||
ft232r_write(0, tms, 0);
|
||||
}
|
||||
|
@ -832,7 +830,7 @@ static int syncbb_execute_queue(struct jtag_command *cmd_queue)
|
|||
break;
|
||||
|
||||
case JTAG_RUNTEST:
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %s", cmd->cmd.runtest->num_cycles,
|
||||
LOG_DEBUG_IO("runtest %u cycles, end in %s", cmd->cmd.runtest->num_cycles,
|
||||
tap_state_name(cmd->cmd.runtest->end_state));
|
||||
|
||||
syncbb_end_state(cmd->cmd.runtest->end_state);
|
||||
|
@ -854,7 +852,7 @@ static int syncbb_execute_queue(struct jtag_command *cmd_queue)
|
|||
break;
|
||||
|
||||
case JTAG_PATHMOVE:
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %s", cmd->cmd.pathmove->num_states,
|
||||
LOG_DEBUG_IO("pathmove: %u states, end in %s", cmd->cmd.pathmove->num_states,
|
||||
tap_state_name(cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]));
|
||||
|
||||
syncbb_path_move(cmd->cmd.pathmove);
|
||||
|
|
|
@ -311,10 +311,9 @@ static void ftdi_end_state(tap_state_t state)
|
|||
|
||||
static void ftdi_execute_runtest(struct jtag_command *cmd)
|
||||
{
|
||||
int i;
|
||||
uint8_t zero = 0;
|
||||
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %s",
|
||||
LOG_DEBUG_IO("runtest %u cycles, end in %s",
|
||||
cmd->cmd.runtest->num_cycles,
|
||||
tap_state_name(cmd->cmd.runtest->end_state));
|
||||
|
||||
|
@ -322,7 +321,7 @@ static void ftdi_execute_runtest(struct jtag_command *cmd)
|
|||
move_to_state(TAP_IDLE);
|
||||
|
||||
/* TODO: Reuse ftdi_execute_stableclocks */
|
||||
i = cmd->cmd.runtest->num_cycles;
|
||||
unsigned int i = cmd->cmd.runtest->num_cycles;
|
||||
while (i > 0) {
|
||||
/* there are no state transitions in this code, so omit state tracking */
|
||||
unsigned this_len = i > 7 ? 7 : i;
|
||||
|
@ -335,7 +334,7 @@ static void ftdi_execute_runtest(struct jtag_command *cmd)
|
|||
if (tap_get_state() != tap_get_end_state())
|
||||
move_to_state(tap_get_end_state());
|
||||
|
||||
LOG_DEBUG_IO("runtest: %i, end in %s",
|
||||
LOG_DEBUG_IO("runtest: %u, end in %s",
|
||||
cmd->cmd.runtest->num_cycles,
|
||||
tap_state_name(tap_get_end_state()));
|
||||
}
|
||||
|
@ -358,7 +357,7 @@ static void ftdi_execute_statemove(struct jtag_command *cmd)
|
|||
*/
|
||||
static void ftdi_execute_tms(struct jtag_command *cmd)
|
||||
{
|
||||
LOG_DEBUG_IO("TMS: %d bits", cmd->cmd.tms->num_bits);
|
||||
LOG_DEBUG_IO("TMS: %u bits", cmd->cmd.tms->num_bits);
|
||||
|
||||
/* TODO: Missing tap state tracking, also missing from ft2232.c! */
|
||||
mpsse_clock_tms_cs_out(mpsse_ctx,
|
||||
|
@ -372,9 +371,9 @@ static void ftdi_execute_tms(struct jtag_command *cmd)
|
|||
static void ftdi_execute_pathmove(struct jtag_command *cmd)
|
||||
{
|
||||
tap_state_t *path = cmd->cmd.pathmove->path;
|
||||
int num_states = cmd->cmd.pathmove->num_states;
|
||||
unsigned int num_states = cmd->cmd.pathmove->num_states;
|
||||
|
||||
LOG_DEBUG_IO("pathmove: %i states, current: %s end: %s", num_states,
|
||||
LOG_DEBUG_IO("pathmove: %u states, current: %s end: %s", num_states,
|
||||
tap_state_name(tap_get_state()),
|
||||
tap_state_name(path[num_states-1]));
|
||||
|
||||
|
@ -432,7 +431,7 @@ static void ftdi_execute_scan(struct jtag_command *cmd)
|
|||
LOG_DEBUG_IO("discarding trailing empty field");
|
||||
}
|
||||
|
||||
if (cmd->cmd.scan->num_fields == 0) {
|
||||
if (!cmd->cmd.scan->num_fields) {
|
||||
LOG_DEBUG_IO("empty scan, doing nothing");
|
||||
return;
|
||||
}
|
||||
|
@ -450,9 +449,9 @@ static void ftdi_execute_scan(struct jtag_command *cmd)
|
|||
struct scan_field *field = cmd->cmd.scan->fields;
|
||||
unsigned scan_size = 0;
|
||||
|
||||
for (int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
|
||||
for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
|
||||
scan_size += field->num_bits;
|
||||
LOG_DEBUG_IO("%s%s field %d/%d %d bits",
|
||||
LOG_DEBUG_IO("%s%s field %u/%u %d bits",
|
||||
field->in_value ? "in" : "",
|
||||
field->out_value ? "out" : "",
|
||||
i,
|
||||
|
@ -576,7 +575,7 @@ static void ftdi_execute_stableclocks(struct jtag_command *cmd)
|
|||
/* this is only allowed while in a stable state. A check for a stable
|
||||
* state was done in jtag_add_clocks()
|
||||
*/
|
||||
int num_cycles = cmd->cmd.stableclocks->num_cycles;
|
||||
unsigned int num_cycles = cmd->cmd.stableclocks->num_cycles;
|
||||
|
||||
/* 7 bits of either ones or zeros. */
|
||||
uint8_t tms = tap_get_state() == TAP_RESET ? 0x7f : 0x00;
|
||||
|
@ -590,7 +589,7 @@ static void ftdi_execute_stableclocks(struct jtag_command *cmd)
|
|||
num_cycles -= this_len;
|
||||
}
|
||||
|
||||
LOG_DEBUG_IO("clocks %i while in %s",
|
||||
LOG_DEBUG_IO("clocks %u while in %s",
|
||||
cmd->cmd.stableclocks->num_cycles,
|
||||
tap_state_name(tap_get_state()));
|
||||
}
|
||||
|
|
|
@ -185,10 +185,9 @@ static void gw16012_path_move(struct pathmove_command *cmd)
|
|||
tap_set_end_state(tap_get_state());
|
||||
}
|
||||
|
||||
static void gw16012_runtest(int num_cycles)
|
||||
static void gw16012_runtest(unsigned int num_cycles)
|
||||
{
|
||||
tap_state_t saved_end_state = tap_get_end_state();
|
||||
int i;
|
||||
|
||||
/* only do a state_move when we're not already in IDLE */
|
||||
if (tap_get_state() != TAP_IDLE) {
|
||||
|
@ -196,7 +195,7 @@ static void gw16012_runtest(int num_cycles)
|
|||
gw16012_state_move();
|
||||
}
|
||||
|
||||
for (i = 0; i < num_cycles; i++) {
|
||||
for (unsigned int i = 0; i < num_cycles; i++) {
|
||||
gw16012_control(0x0); /* single-bit mode */
|
||||
gw16012_data(0x0); /* TMS cycle with TMS low */
|
||||
}
|
||||
|
@ -292,7 +291,7 @@ static int gw16012_execute_queue(struct jtag_command *cmd_queue)
|
|||
gw16012_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||
break;
|
||||
case JTAG_RUNTEST:
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles,
|
||||
LOG_DEBUG_IO("runtest %u cycles, end in %i", cmd->cmd.runtest->num_cycles,
|
||||
cmd->cmd.runtest->end_state);
|
||||
gw16012_end_state(cmd->cmd.runtest->end_state);
|
||||
gw16012_runtest(cmd->cmd.runtest->num_cycles);
|
||||
|
|
|
@ -80,9 +80,9 @@ static struct device_config tmp_config;
|
|||
/* Queue command functions */
|
||||
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_stableclocks(int num_cycles);
|
||||
static void jlink_runtest(int num_cycles);
|
||||
static void jlink_path_move(unsigned int num_states, tap_state_t *path);
|
||||
static void jlink_stableclocks(unsigned int num_cycles);
|
||||
static void jlink_runtest(unsigned int num_cycles);
|
||||
static void jlink_reset(int trst, int srst);
|
||||
static int jlink_reset_safe(int trst, int srst);
|
||||
static int jlink_swd_run_queue(void);
|
||||
|
@ -140,7 +140,7 @@ static void jlink_execute_statemove(struct jtag_command *cmd)
|
|||
|
||||
static void jlink_execute_pathmove(struct jtag_command *cmd)
|
||||
{
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %i",
|
||||
LOG_DEBUG_IO("pathmove: %u states, end in %i",
|
||||
cmd->cmd.pathmove->num_states,
|
||||
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
|
||||
|
||||
|
@ -159,7 +159,7 @@ static void jlink_execute_scan(struct jtag_command *cmd)
|
|||
LOG_DEBUG("discarding trailing empty field");
|
||||
}
|
||||
|
||||
if (cmd->cmd.scan->num_fields == 0) {
|
||||
if (!cmd->cmd.scan->num_fields) {
|
||||
LOG_DEBUG("empty scan, doing nothing");
|
||||
return;
|
||||
}
|
||||
|
@ -181,9 +181,9 @@ static void jlink_execute_scan(struct jtag_command *cmd)
|
|||
struct scan_field *field = cmd->cmd.scan->fields;
|
||||
unsigned scan_size = 0;
|
||||
|
||||
for (int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
|
||||
for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
|
||||
scan_size += field->num_bits;
|
||||
LOG_DEBUG_IO("%s%s field %d/%d %d bits",
|
||||
LOG_DEBUG_IO("%s%s field %u/%u %d bits",
|
||||
field->in_value ? "in" : "",
|
||||
field->out_value ? "out" : "",
|
||||
i,
|
||||
|
@ -885,12 +885,11 @@ static void jlink_state_move(void)
|
|||
tap_set_state(tap_get_end_state());
|
||||
}
|
||||
|
||||
static void jlink_path_move(int num_states, tap_state_t *path)
|
||||
static void jlink_path_move(unsigned int num_states, tap_state_t *path)
|
||||
{
|
||||
int i;
|
||||
uint8_t tms = 0xff;
|
||||
|
||||
for (i = 0; i < num_states; i++) {
|
||||
for (unsigned int i = 0; i < num_states; i++) {
|
||||
if (path[i] == tap_state_transition(tap_get_state(), false))
|
||||
jlink_clock_data(NULL, 0, NULL, 0, NULL, 0, 1);
|
||||
else if (path[i] == tap_state_transition(tap_get_state(), true))
|
||||
|
@ -907,17 +906,15 @@ static void jlink_path_move(int num_states, tap_state_t *path)
|
|||
tap_set_end_state(tap_get_state());
|
||||
}
|
||||
|
||||
static void jlink_stableclocks(int num_cycles)
|
||||
static void jlink_stableclocks(unsigned int num_cycles)
|
||||
{
|
||||
int i;
|
||||
|
||||
uint8_t tms = tap_get_state() == TAP_RESET;
|
||||
/* Execute num_cycles. */
|
||||
for (i = 0; i < num_cycles; i++)
|
||||
for (unsigned int i = 0; i < num_cycles; i++)
|
||||
jlink_clock_data(NULL, 0, &tms, 0, NULL, 0, 1);
|
||||
}
|
||||
|
||||
static void jlink_runtest(int num_cycles)
|
||||
static void jlink_runtest(unsigned int num_cycles)
|
||||
{
|
||||
tap_state_t saved_end_state = tap_get_end_state();
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int jtag_dpi_runtest(int cycles)
|
||||
static int jtag_dpi_runtest(unsigned int num_cycles)
|
||||
{
|
||||
char buf[20];
|
||||
uint8_t *data_buf = last_ir_buf, *read_scan;
|
||||
|
@ -189,7 +189,7 @@ static int jtag_dpi_runtest(int cycles)
|
|||
return ERROR_FAIL;
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "ib %d\n", num_bits);
|
||||
while (cycles > 0) {
|
||||
while (num_cycles > 0) {
|
||||
ret = write_sock(buf, strlen(buf));
|
||||
if (ret != ERROR_OK) {
|
||||
LOG_ERROR("write_sock() fail, file %s, line %d",
|
||||
|
@ -209,7 +209,7 @@ static int jtag_dpi_runtest(int cycles)
|
|||
goto out;
|
||||
}
|
||||
|
||||
cycles -= num_bits + 6;
|
||||
num_cycles -= num_bits + 6;
|
||||
}
|
||||
|
||||
out:
|
||||
|
@ -217,9 +217,9 @@ out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int jtag_dpi_stableclocks(int cycles)
|
||||
static int jtag_dpi_stableclocks(unsigned int num_cycles)
|
||||
{
|
||||
return jtag_dpi_runtest(cycles);
|
||||
return jtag_dpi_runtest(num_cycles);
|
||||
}
|
||||
|
||||
static int jtag_dpi_execute_queue(struct jtag_command *cmd_queue)
|
||||
|
|
|
@ -254,7 +254,7 @@ static int jtag_vpi_path_move(struct pathmove_command *cmd)
|
|||
|
||||
memset(trans, 0, DIV_ROUND_UP(cmd->num_states, 8));
|
||||
|
||||
for (int i = 0; i < cmd->num_states; i++) {
|
||||
for (unsigned int i = 0; i < cmd->num_states; i++) {
|
||||
if (tap_state_transition(tap_get_state(), true) == cmd->path[i])
|
||||
buf_set_u32(trans, i, 1, 1);
|
||||
tap_set_state(cmd->path[i]);
|
||||
|
@ -440,7 +440,7 @@ static int jtag_vpi_scan(struct scan_command *cmd)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static int jtag_vpi_runtest(int cycles, tap_state_t state)
|
||||
static int jtag_vpi_runtest(unsigned int num_cycles, tap_state_t state)
|
||||
{
|
||||
int retval;
|
||||
|
||||
|
@ -448,23 +448,21 @@ static int jtag_vpi_runtest(int cycles, tap_state_t state)
|
|||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
retval = jtag_vpi_queue_tdi(NULL, cycles, NO_TAP_SHIFT);
|
||||
retval = jtag_vpi_queue_tdi(NULL, num_cycles, NO_TAP_SHIFT);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
return jtag_vpi_state_move(state);
|
||||
}
|
||||
|
||||
static int jtag_vpi_stableclocks(int cycles)
|
||||
static int jtag_vpi_stableclocks(unsigned int num_cycles)
|
||||
{
|
||||
uint8_t tms_bits[4];
|
||||
int cycles_remain = cycles;
|
||||
unsigned int cycles_remain = num_cycles;
|
||||
int nb_bits;
|
||||
int retval;
|
||||
const int CYCLES_ONE_BATCH = sizeof(tms_bits) * 8;
|
||||
|
||||
assert(cycles >= 0);
|
||||
|
||||
/* use TMS=1 in TAP RESET state, TMS=0 in all other stable states */
|
||||
memset(&tms_bits, (tap_get_state() == TAP_RESET) ? 0xff : 0x00, sizeof(tms_bits));
|
||||
|
||||
|
|
|
@ -106,8 +106,8 @@ static int opendous_quit(void);
|
|||
/* Queue command functions */
|
||||
static void opendous_end_state(tap_state_t state);
|
||||
static void opendous_state_move(void);
|
||||
static void opendous_path_move(int num_states, tap_state_t *path);
|
||||
static void opendous_runtest(int num_cycles);
|
||||
static void opendous_path_move(unsigned int num_states, tap_state_t *path);
|
||||
static void opendous_runtest(unsigned int num_cycles);
|
||||
static void opendous_scan(int ir_scan, enum scan_type type, uint8_t *buffer,
|
||||
int scan_size, struct scan_command *command);
|
||||
static void opendous_reset(int trst, int srst);
|
||||
|
@ -248,7 +248,7 @@ static int opendous_execute_queue(struct jtag_command *cmd_queue)
|
|||
while (cmd) {
|
||||
switch (cmd->type) {
|
||||
case JTAG_RUNTEST:
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles,
|
||||
LOG_DEBUG_IO("runtest %u cycles, end in %i", cmd->cmd.runtest->num_cycles,
|
||||
cmd->cmd.runtest->end_state);
|
||||
|
||||
if (cmd->cmd.runtest->end_state != -1)
|
||||
|
@ -265,7 +265,7 @@ static int opendous_execute_queue(struct jtag_command *cmd_queue)
|
|||
break;
|
||||
|
||||
case JTAG_PATHMOVE:
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %i",
|
||||
LOG_DEBUG_IO("pathmove: %u states, end in %i",
|
||||
cmd->cmd.pathmove->num_states,
|
||||
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
|
||||
|
||||
|
@ -419,11 +419,9 @@ void opendous_state_move(void)
|
|||
tap_set_state(tap_get_end_state());
|
||||
}
|
||||
|
||||
void opendous_path_move(int num_states, tap_state_t *path)
|
||||
void opendous_path_move(unsigned int num_states, tap_state_t *path)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_states; i++) {
|
||||
for (unsigned int i = 0; i < num_states; i++) {
|
||||
if (path[i] == tap_state_transition(tap_get_state(), false))
|
||||
opendous_tap_append_step(0, 0);
|
||||
else if (path[i] == tap_state_transition(tap_get_state(), true))
|
||||
|
@ -440,10 +438,8 @@ void opendous_path_move(int num_states, tap_state_t *path)
|
|||
tap_set_end_state(tap_get_state());
|
||||
}
|
||||
|
||||
void opendous_runtest(int num_cycles)
|
||||
void opendous_runtest(unsigned int num_cycles)
|
||||
{
|
||||
int i;
|
||||
|
||||
tap_state_t saved_end_state = tap_get_end_state();
|
||||
|
||||
/* only do a state_move when we're not already in IDLE */
|
||||
|
@ -453,7 +449,7 @@ void opendous_runtest(int num_cycles)
|
|||
}
|
||||
|
||||
/* execute num_cycles */
|
||||
for (i = 0; i < num_cycles; i++)
|
||||
for (unsigned int i = 0; i < num_cycles; i++)
|
||||
opendous_tap_append_step(0, 0);
|
||||
|
||||
/* finish in end_state */
|
||||
|
|
|
@ -760,15 +760,17 @@ static void openjtag_execute_runtest(struct jtag_command *cmd)
|
|||
if (openjtag_variant != OPENJTAG_VARIANT_CY7C65215 ||
|
||||
cmd->cmd.runtest->num_cycles) {
|
||||
uint8_t command;
|
||||
int cycles = cmd->cmd.runtest->num_cycles;
|
||||
unsigned int num_cycles = cmd->cmd.runtest->num_cycles;
|
||||
|
||||
do {
|
||||
const unsigned int num_cycles_cmd = MIN(num_cycles, 16);
|
||||
|
||||
command = 7;
|
||||
command |= (((cycles > 16 ? 16 : cycles) - 1) & 0x0F) << 4;
|
||||
command |= ((num_cycles_cmd - 1) & 0x0F) << 4;
|
||||
|
||||
openjtag_add_byte(command);
|
||||
cycles -= 16;
|
||||
} while (cycles > 0);
|
||||
num_cycles -= num_cycles_cmd;
|
||||
} while (num_cycles > 0);
|
||||
}
|
||||
|
||||
tap_set_end_state(end_state);
|
||||
|
|
|
@ -381,7 +381,7 @@ static int osbdm_quit(void)
|
|||
static int osbdm_add_pathmove(
|
||||
struct queue *queue,
|
||||
tap_state_t *path,
|
||||
int num_states)
|
||||
unsigned int num_states)
|
||||
{
|
||||
assert(num_states <= 32);
|
||||
|
||||
|
@ -392,7 +392,7 @@ static int osbdm_add_pathmove(
|
|||
}
|
||||
|
||||
uint32_t tms = 0;
|
||||
for (int i = 0; i < num_states; i++) {
|
||||
for (unsigned int i = 0; i < num_states; i++) {
|
||||
if (tap_state_transition(tap_get_state(), 1) == path[i]) {
|
||||
tms |= (1 << i);
|
||||
} else if (tap_state_transition(tap_get_state(), 0) == path[i]) {
|
||||
|
@ -451,7 +451,7 @@ static int osbdm_add_statemove(
|
|||
|
||||
static int osbdm_add_stableclocks(
|
||||
struct queue *queue,
|
||||
int count)
|
||||
unsigned int count)
|
||||
{
|
||||
if (!tap_is_state_stable(tap_get_state())) {
|
||||
LOG_ERROR("BUG: current state (%s) is not stable",
|
||||
|
@ -489,7 +489,7 @@ static int osbdm_add_tms(
|
|||
static int osbdm_add_scan(
|
||||
struct queue *queue,
|
||||
struct scan_field *fields,
|
||||
int num_fields,
|
||||
unsigned int num_fields,
|
||||
tap_state_t end_state,
|
||||
bool ir_scan)
|
||||
{
|
||||
|
@ -508,7 +508,7 @@ static int osbdm_add_scan(
|
|||
|
||||
/* Add scan */
|
||||
tap_set_end_state(end_state);
|
||||
for (int idx = 0; idx < num_fields; idx++) {
|
||||
for (unsigned int idx = 0; idx < num_fields; idx++) {
|
||||
struct sequence *next = queue_add_tail(queue, fields[idx].num_bits);
|
||||
if (!next) {
|
||||
LOG_ERROR("Can't allocate bit sequence");
|
||||
|
@ -536,7 +536,7 @@ static int osbdm_add_scan(
|
|||
|
||||
static int osbdm_add_runtest(
|
||||
struct queue *queue,
|
||||
int num_cycles,
|
||||
unsigned int num_cycles,
|
||||
tap_state_t end_state)
|
||||
{
|
||||
if (osbdm_add_statemove(queue, TAP_IDLE, 0) != ERROR_OK)
|
||||
|
|
|
@ -869,7 +869,7 @@ static void rlink_state_move(void)
|
|||
|
||||
static void rlink_path_move(struct pathmove_command *cmd)
|
||||
{
|
||||
int num_states = cmd->num_states;
|
||||
unsigned int num_states = cmd->num_states;
|
||||
int state_count;
|
||||
int tms = 0;
|
||||
|
||||
|
@ -896,10 +896,8 @@ static void rlink_path_move(struct pathmove_command *cmd)
|
|||
tap_set_end_state(tap_get_state());
|
||||
}
|
||||
|
||||
static void rlink_runtest(int num_cycles)
|
||||
static void rlink_runtest(unsigned int num_cycles)
|
||||
{
|
||||
int i;
|
||||
|
||||
tap_state_t saved_end_state = tap_get_end_state();
|
||||
|
||||
/* only do a state_move when we're not already in RTI */
|
||||
|
@ -909,7 +907,7 @@ static void rlink_runtest(int num_cycles)
|
|||
}
|
||||
|
||||
/* execute num_cycles */
|
||||
for (i = 0; i < num_cycles; i++)
|
||||
for (unsigned int i = 0; i < num_cycles; i++)
|
||||
tap_state_queue_append(0);
|
||||
|
||||
/* finish in end_state */
|
||||
|
@ -1323,7 +1321,7 @@ static int rlink_execute_queue(struct jtag_command *cmd_queue)
|
|||
rlink_state_move();
|
||||
break;
|
||||
case JTAG_PATHMOVE:
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %i",
|
||||
LOG_DEBUG_IO("pathmove: %u states, end in %i",
|
||||
cmd->cmd.pathmove->num_states,
|
||||
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
|
||||
rlink_path_move(cmd->cmd.pathmove);
|
||||
|
|
|
@ -1701,15 +1701,17 @@ static int ulink_queue_reset(struct ulink *device, struct jtag_command *cmd)
|
|||
*/
|
||||
static int ulink_queue_pathmove(struct ulink *device, struct jtag_command *cmd)
|
||||
{
|
||||
int ret, i, num_states, batch_size, state_count;
|
||||
int ret, state_count;
|
||||
tap_state_t *path;
|
||||
uint8_t tms_sequence;
|
||||
|
||||
num_states = cmd->cmd.pathmove->num_states;
|
||||
unsigned int num_states = cmd->cmd.pathmove->num_states;
|
||||
path = cmd->cmd.pathmove->path;
|
||||
state_count = 0;
|
||||
|
||||
while (num_states > 0) {
|
||||
unsigned int batch_size;
|
||||
|
||||
tms_sequence = 0;
|
||||
|
||||
/* Determine batch size */
|
||||
|
@ -1718,7 +1720,7 @@ static int ulink_queue_pathmove(struct ulink *device, struct jtag_command *cmd)
|
|||
else
|
||||
batch_size = num_states;
|
||||
|
||||
for (i = 0; i < batch_size; i++) {
|
||||
for (unsigned int i = 0; i < batch_size; i++) {
|
||||
if (tap_state_transition(tap_get_state(), false) == path[state_count]) {
|
||||
/* Append '0' transition: clear bit 'i' in tms_sequence */
|
||||
buf_set_u32(&tms_sequence, i, 1, 0x0);
|
||||
|
@ -1774,14 +1776,13 @@ static int ulink_queue_sleep(struct ulink *device, struct jtag_command *cmd)
|
|||
static int ulink_queue_stableclocks(struct ulink *device, struct jtag_command *cmd)
|
||||
{
|
||||
int ret;
|
||||
unsigned num_cycles;
|
||||
|
||||
if (!tap_is_state_stable(tap_get_state())) {
|
||||
LOG_ERROR("JTAG_STABLECLOCKS: state not stable");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
num_cycles = cmd->cmd.stableclocks->num_cycles;
|
||||
unsigned int num_cycles = cmd->cmd.stableclocks->num_cycles;
|
||||
|
||||
/* TMS stays either high (Test Logic Reset state) or low (all other states) */
|
||||
if (tap_get_state() == TAP_RESET)
|
||||
|
|
|
@ -474,11 +474,9 @@ static void ublast_tms(struct tms_command *cmd)
|
|||
*/
|
||||
static void ublast_path_move(struct pathmove_command *cmd)
|
||||
{
|
||||
int i;
|
||||
|
||||
LOG_DEBUG_IO("(num_states=%d, last_state=%d)",
|
||||
LOG_DEBUG_IO("(num_states=%u, last_state=%d)",
|
||||
cmd->num_states, cmd->path[cmd->num_states - 1]);
|
||||
for (i = 0; i < cmd->num_states; i++) {
|
||||
for (unsigned int i = 0; i < cmd->num_states; i++) {
|
||||
if (tap_state_transition(tap_get_state(), false) == cmd->path[i])
|
||||
ublast_clock_tms(0);
|
||||
if (tap_state_transition(tap_get_state(), true) == cmd->path[i])
|
||||
|
@ -675,19 +673,19 @@ static void ublast_queue_tdi(uint8_t *bits, int nb_bits, enum scan_type scan)
|
|||
ublast_idle_clock();
|
||||
}
|
||||
|
||||
static void ublast_runtest(int cycles, tap_state_t state)
|
||||
static void ublast_runtest(unsigned int num_cycles, tap_state_t state)
|
||||
{
|
||||
LOG_DEBUG_IO("%s(cycles=%i, end_state=%d)", __func__, cycles, state);
|
||||
LOG_DEBUG_IO("%s(cycles=%u, end_state=%d)", __func__, num_cycles, state);
|
||||
|
||||
ublast_state_move(TAP_IDLE, 0);
|
||||
ublast_queue_tdi(NULL, cycles, SCAN_OUT);
|
||||
ublast_queue_tdi(NULL, num_cycles, SCAN_OUT);
|
||||
ublast_state_move(state, 0);
|
||||
}
|
||||
|
||||
static void ublast_stableclocks(int cycles)
|
||||
static void ublast_stableclocks(unsigned int num_cycles)
|
||||
{
|
||||
LOG_DEBUG_IO("%s(cycles=%i)", __func__, cycles);
|
||||
ublast_queue_tdi(NULL, cycles, SCAN_OUT);
|
||||
LOG_DEBUG_IO("%s(cycles=%u)", __func__, num_cycles);
|
||||
ublast_queue_tdi(NULL, num_cycles, SCAN_OUT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
static void usbprog_end_state(tap_state_t state);
|
||||
static void usbprog_state_move(void);
|
||||
static void usbprog_path_move(struct pathmove_command *cmd);
|
||||
static void usbprog_runtest(int num_cycles);
|
||||
static void usbprog_runtest(unsigned int num_cycles);
|
||||
static void usbprog_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size);
|
||||
|
||||
#define UNKNOWN_COMMAND 0x00
|
||||
|
@ -101,7 +101,7 @@ static int usbprog_execute_queue(struct jtag_command *cmd_queue)
|
|||
usbprog_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||
break;
|
||||
case JTAG_RUNTEST:
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %i",
|
||||
LOG_DEBUG_IO("runtest %u cycles, end in %i",
|
||||
cmd->cmd.runtest->num_cycles,
|
||||
cmd->cmd.runtest->end_state);
|
||||
usbprog_end_state(cmd->cmd.runtest->end_state);
|
||||
|
@ -113,7 +113,7 @@ static int usbprog_execute_queue(struct jtag_command *cmd_queue)
|
|||
usbprog_state_move();
|
||||
break;
|
||||
case JTAG_PATHMOVE:
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %i",
|
||||
LOG_DEBUG_IO("pathmove: %u states, end in %i",
|
||||
cmd->cmd.pathmove->num_states,
|
||||
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
|
||||
usbprog_path_move(cmd->cmd.pathmove);
|
||||
|
@ -189,7 +189,7 @@ static void usbprog_state_move(void)
|
|||
|
||||
static void usbprog_path_move(struct pathmove_command *cmd)
|
||||
{
|
||||
int num_states = cmd->num_states;
|
||||
unsigned int num_states = cmd->num_states;
|
||||
int state_count;
|
||||
|
||||
/* There may be queued transitions, and before following a specified
|
||||
|
@ -222,10 +222,8 @@ static void usbprog_path_move(struct pathmove_command *cmd)
|
|||
tap_set_end_state(tap_get_state());
|
||||
}
|
||||
|
||||
static void usbprog_runtest(int num_cycles)
|
||||
static void usbprog_runtest(unsigned int num_cycles)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* only do a state_move when we're not already in IDLE */
|
||||
if (tap_get_state() != TAP_IDLE) {
|
||||
usbprog_end_state(TAP_IDLE);
|
||||
|
@ -241,7 +239,7 @@ static void usbprog_runtest(int num_cycles)
|
|||
/* LOG_INFO("NUM CYCLES %i",num_cycles); */
|
||||
}
|
||||
|
||||
for (i = 0; i < num_cycles; i++) {
|
||||
for (unsigned int i = 0; i < num_cycles; i++) {
|
||||
usbprog_write(1, 0, 0);
|
||||
usbprog_write(0, 0, 0);
|
||||
}
|
||||
|
|
|
@ -931,11 +931,11 @@ static int vdebug_jtag_tms_seq(const uint8_t *tms, int num, uint8_t f_flush)
|
|||
static int vdebug_jtag_path_move(struct pathmove_command *cmd, uint8_t f_flush)
|
||||
{
|
||||
uint8_t tms[DIV_ROUND_UP(cmd->num_states, 8)];
|
||||
LOG_DEBUG_IO("path num states %d", cmd->num_states);
|
||||
LOG_DEBUG_IO("path num states %u", cmd->num_states);
|
||||
|
||||
memset(tms, 0, DIV_ROUND_UP(cmd->num_states, 8));
|
||||
|
||||
for (uint8_t i = 0; i < cmd->num_states; i++) {
|
||||
for (unsigned int i = 0; i < cmd->num_states; i++) {
|
||||
if (tap_state_transition(tap_get_state(), true) == cmd->path[i])
|
||||
buf_set_u32(tms, i, 1, 1);
|
||||
tap_set_state(cmd->path[i]);
|
||||
|
@ -971,9 +971,9 @@ static int vdebug_jtag_scan(struct scan_command *cmd, uint8_t f_flush)
|
|||
uint8_t tms_post = tap_get_tms_path(state, cmd->end_state);
|
||||
uint8_t num_post = tap_get_tms_path_len(state, cmd->end_state);
|
||||
int num_bits = jtag_scan_size(cmd);
|
||||
LOG_DEBUG_IO("scan len:%d fields:%d ir/!dr:%d state cur:%x end:%x",
|
||||
LOG_DEBUG_IO("scan len:%d fields:%u ir/!dr:%d state cur:%x end:%x",
|
||||
num_bits, cmd->num_fields, cmd->ir_scan, cur, cmd->end_state);
|
||||
for (int i = 0; i < cmd->num_fields; i++) {
|
||||
for (unsigned int i = 0; i < cmd->num_fields; i++) {
|
||||
uint8_t cur_num_pre = i == 0 ? num_pre : 0;
|
||||
uint8_t cur_tms_pre = i == 0 ? tms_pre : 0;
|
||||
uint8_t cur_num_post = i == cmd->num_fields - 1 ? num_post : 0;
|
||||
|
@ -992,24 +992,24 @@ static int vdebug_jtag_scan(struct scan_command *cmd, uint8_t f_flush)
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int vdebug_jtag_runtest(int cycles, tap_state_t state, uint8_t f_flush)
|
||||
static int vdebug_jtag_runtest(unsigned int num_cycles, tap_state_t state, uint8_t f_flush)
|
||||
{
|
||||
tap_state_t cur = tap_get_state();
|
||||
uint8_t tms_pre = tap_get_tms_path(cur, state);
|
||||
uint8_t num_pre = tap_get_tms_path_len(cur, state);
|
||||
LOG_DEBUG_IO("idle len:%d state cur:%x end:%x", cycles, cur, state);
|
||||
int rc = vdebug_jtag_shift_tap(vdc.hsocket, pbuf, num_pre, tms_pre, cycles, NULL, 0, 0, NULL, f_flush);
|
||||
LOG_DEBUG_IO("idle len:%u state cur:%x end:%x", num_cycles, cur, state);
|
||||
int rc = vdebug_jtag_shift_tap(vdc.hsocket, pbuf, num_pre, tms_pre, num_cycles, NULL, 0, 0, NULL, f_flush);
|
||||
if (cur != state)
|
||||
tap_set_state(state);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int vdebug_jtag_stableclocks(int num, uint8_t f_flush)
|
||||
static int vdebug_jtag_stableclocks(unsigned int num_cycles, uint8_t f_flush)
|
||||
{
|
||||
LOG_DEBUG("stab len:%d state cur:%x", num, tap_get_state());
|
||||
LOG_DEBUG("stab len:%u state cur:%x", num_cycles, tap_get_state());
|
||||
|
||||
return vdebug_jtag_shift_tap(vdc.hsocket, pbuf, 0, 0, num, NULL, 0, 0, NULL, f_flush);
|
||||
return vdebug_jtag_shift_tap(vdc.hsocket, pbuf, 0, 0, num_cycles, NULL, 0, 0, NULL, f_flush);
|
||||
}
|
||||
|
||||
static int vdebug_sleep(int us)
|
||||
|
|
|
@ -43,10 +43,10 @@ static struct pending_scan_result
|
|||
/* Queue command functions */
|
||||
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_path_move(unsigned int num_states, tap_state_t *path);
|
||||
static void vsllink_tms(int num_bits, const uint8_t *bits);
|
||||
static void vsllink_runtest(int num_cycles);
|
||||
static void vsllink_stableclocks(int num_cycles, int tms);
|
||||
static void vsllink_runtest(unsigned int num_cycles);
|
||||
static void vsllink_stableclocks(unsigned int num_cycles, int tms);
|
||||
static void vsllink_scan(bool ir_scan, enum scan_type type,
|
||||
uint8_t *buffer, int scan_size, struct scan_command *command);
|
||||
static int vsllink_reset(int trst, int srst);
|
||||
|
@ -98,7 +98,7 @@ static int vsllink_execute_queue(struct jtag_command *cmd_queue)
|
|||
while (cmd) {
|
||||
switch (cmd->type) {
|
||||
case JTAG_RUNTEST:
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %s",
|
||||
LOG_DEBUG_IO("runtest %u cycles, end in %s",
|
||||
cmd->cmd.runtest->num_cycles,
|
||||
tap_state_name(cmd->cmd.runtest->end_state));
|
||||
|
||||
|
@ -115,7 +115,7 @@ static int vsllink_execute_queue(struct jtag_command *cmd_queue)
|
|||
break;
|
||||
|
||||
case JTAG_PATHMOVE:
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %s",
|
||||
LOG_DEBUG_IO("pathmove: %u states, end in %s",
|
||||
cmd->cmd.pathmove->num_states,
|
||||
tap_state_name(cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]));
|
||||
|
||||
|
@ -161,7 +161,7 @@ static int vsllink_execute_queue(struct jtag_command *cmd_queue)
|
|||
break;
|
||||
|
||||
case JTAG_STABLECLOCKS:
|
||||
LOG_DEBUG_IO("add %d clocks",
|
||||
LOG_DEBUG_IO("add %u clocks",
|
||||
cmd->cmd.stableclocks->num_cycles);
|
||||
|
||||
switch (tap_get_state()) {
|
||||
|
@ -371,9 +371,9 @@ static void vsllink_state_move(void)
|
|||
tap_set_state(tap_get_end_state());
|
||||
}
|
||||
|
||||
static void vsllink_path_move(int num_states, tap_state_t *path)
|
||||
static void vsllink_path_move(unsigned int num_states, tap_state_t *path)
|
||||
{
|
||||
for (int i = 0; i < num_states; i++) {
|
||||
for (unsigned int i = 0; i < num_states; i++) {
|
||||
if (path[i] == tap_state_transition(tap_get_state(), false))
|
||||
vsllink_tap_append_step(0, 0);
|
||||
else if (path[i] == tap_state_transition(tap_get_state(), true))
|
||||
|
@ -397,7 +397,7 @@ static void vsllink_tms(int num_bits, const uint8_t *bits)
|
|||
vsllink_tap_append_step((bits[i / 8] >> (i % 8)) & 1, 0);
|
||||
}
|
||||
|
||||
static void vsllink_stableclocks(int num_cycles, int tms)
|
||||
static void vsllink_stableclocks(unsigned int num_cycles, int tms)
|
||||
{
|
||||
while (num_cycles > 0) {
|
||||
vsllink_tap_append_step(tms, 0);
|
||||
|
@ -405,7 +405,7 @@ static void vsllink_stableclocks(int num_cycles, int tms)
|
|||
}
|
||||
}
|
||||
|
||||
static void vsllink_runtest(int num_cycles)
|
||||
static void vsllink_runtest(unsigned int num_cycles)
|
||||
{
|
||||
tap_state_t saved_end_state = tap_get_end_state();
|
||||
|
||||
|
|
|
@ -1669,7 +1669,6 @@ static void xds110_execute_tlr_reset(struct jtag_command *cmd)
|
|||
|
||||
static void xds110_execute_pathmove(struct jtag_command *cmd)
|
||||
{
|
||||
uint32_t i;
|
||||
uint32_t num_states;
|
||||
uint8_t *path;
|
||||
|
||||
|
@ -1685,7 +1684,7 @@ static void xds110_execute_pathmove(struct jtag_command *cmd)
|
|||
}
|
||||
|
||||
/* Convert requested path states into XDS API states */
|
||||
for (i = 0; i < num_states; i++)
|
||||
for (unsigned int i = 0; i < num_states; i++)
|
||||
path[i] = (uint8_t)xds_jtag_state[cmd->cmd.pathmove->path[i]];
|
||||
|
||||
if (xds110.firmware >= OCD_FIRMWARE_VERSION) {
|
||||
|
@ -1704,7 +1703,6 @@ static void xds110_execute_pathmove(struct jtag_command *cmd)
|
|||
|
||||
static void xds110_queue_scan(struct jtag_command *cmd)
|
||||
{
|
||||
int i;
|
||||
uint32_t offset;
|
||||
uint32_t total_fields;
|
||||
uint32_t total_bits;
|
||||
|
@ -1715,7 +1713,7 @@ static void xds110_queue_scan(struct jtag_command *cmd)
|
|||
/* Calculate the total number of bits to scan */
|
||||
total_bits = 0;
|
||||
total_fields = 0;
|
||||
for (i = 0; i < cmd->cmd.scan->num_fields; i++) {
|
||||
for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++) {
|
||||
total_fields++;
|
||||
total_bits += (uint32_t)cmd->cmd.scan->fields[i].num_bits;
|
||||
}
|
||||
|
@ -1756,7 +1754,7 @@ static void xds110_queue_scan(struct jtag_command *cmd)
|
|||
buffer = &xds110.txn_requests[xds110.txn_request_size];
|
||||
/* Clear data out buffer to default value of all zeros */
|
||||
memset((void *)buffer, 0x00, total_bytes);
|
||||
for (i = 0; i < cmd->cmd.scan->num_fields; i++) {
|
||||
for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++) {
|
||||
if (cmd->cmd.scan->fields[i].out_value) {
|
||||
/* Copy over data to scan out into request buffer */
|
||||
bit_copy(buffer, offset, cmd->cmd.scan->fields[i].out_value, 0,
|
||||
|
@ -1775,7 +1773,7 @@ static void xds110_queue_scan(struct jtag_command *cmd)
|
|||
|
||||
static void xds110_queue_runtest(struct jtag_command *cmd)
|
||||
{
|
||||
uint32_t clocks = (uint32_t)cmd->cmd.stableclocks->num_cycles;
|
||||
uint32_t clocks = cmd->cmd.stableclocks->num_cycles;
|
||||
uint8_t end_state = (uint8_t)xds_jtag_state[cmd->cmd.runtest->end_state];
|
||||
|
||||
/* Check if new request would be too large to fit */
|
||||
|
@ -1794,7 +1792,7 @@ static void xds110_queue_runtest(struct jtag_command *cmd)
|
|||
|
||||
static void xds110_queue_stableclocks(struct jtag_command *cmd)
|
||||
{
|
||||
uint32_t clocks = (uint32_t)cmd->cmd.stableclocks->num_cycles;
|
||||
uint32_t clocks = cmd->cmd.stableclocks->num_cycles;
|
||||
|
||||
/* Check if new request would be too large to fit */
|
||||
if ((xds110.txn_request_size + 1 + sizeof(clocks) + 1) > MAX_DATA_BLOCK)
|
||||
|
|
|
@ -128,7 +128,7 @@ static int xlnx_pcie_xvc_execute_stableclocks(struct jtag_command *cmd)
|
|||
size_t write;
|
||||
int err;
|
||||
|
||||
LOG_DEBUG("stableclocks %i cycles", cmd->cmd.runtest->num_cycles);
|
||||
LOG_DEBUG("stableclocks %u cycles", cmd->cmd.runtest->num_cycles);
|
||||
|
||||
while (left) {
|
||||
write = MIN(XLNX_XVC_MAX_BITS, left);
|
||||
|
@ -167,7 +167,7 @@ static int xlnx_pcie_xvc_execute_runtest(struct jtag_command *cmd)
|
|||
{
|
||||
int err = ERROR_OK;
|
||||
|
||||
LOG_DEBUG("runtest %i cycles, end in %i",
|
||||
LOG_DEBUG("runtest %u cycles, end in %i",
|
||||
cmd->cmd.runtest->num_cycles,
|
||||
cmd->cmd.runtest->end_state);
|
||||
|
||||
|
@ -200,16 +200,15 @@ static int xlnx_pcie_xvc_execute_runtest(struct jtag_command *cmd)
|
|||
|
||||
static int xlnx_pcie_xvc_execute_pathmove(struct jtag_command *cmd)
|
||||
{
|
||||
size_t num_states = cmd->cmd.pathmove->num_states;
|
||||
unsigned int num_states = cmd->cmd.pathmove->num_states;
|
||||
tap_state_t *path = cmd->cmd.pathmove->path;
|
||||
int err = ERROR_OK;
|
||||
size_t i;
|
||||
|
||||
LOG_DEBUG("pathmove: %i states, end in %i",
|
||||
LOG_DEBUG("pathmove: %u states, end in %i",
|
||||
cmd->cmd.pathmove->num_states,
|
||||
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
|
||||
|
||||
for (i = 0; i < num_states; i++) {
|
||||
for (unsigned int i = 0; i < num_states; i++) {
|
||||
if (path[i] == tap_state_transition(tap_get_state(), false)) {
|
||||
err = xlnx_pcie_xvc_transact(1, 1, 0, NULL);
|
||||
} else if (path[i] == tap_state_transition(tap_get_state(), true)) {
|
||||
|
|
|
@ -436,7 +436,7 @@ void jtag_add_tlr(void);
|
|||
* - ERROR_JTAG_TRANSITION_INVALID -- The path includes invalid
|
||||
* state transitions.
|
||||
*/
|
||||
void jtag_add_pathmove(int num_states, const tap_state_t *path);
|
||||
void jtag_add_pathmove(unsigned int num_states, const tap_state_t *path);
|
||||
|
||||
/**
|
||||
* jtag_add_statemove() moves from the current state to @a goal_state.
|
||||
|
@ -459,7 +459,7 @@ int jtag_add_statemove(tap_state_t goal_state);
|
|||
* via TAP_IDLE.
|
||||
* @param endstate The final state.
|
||||
*/
|
||||
void jtag_add_runtest(int num_cycles, tap_state_t endstate);
|
||||
void jtag_add_runtest(unsigned int num_cycles, tap_state_t endstate);
|
||||
|
||||
/**
|
||||
* A reset of the TAP state machine can be requested.
|
||||
|
@ -495,7 +495,7 @@ int jtag_add_tms_seq(unsigned nbits, const uint8_t *seq, enum tap_state t);
|
|||
* first checks that the state in which the clocks are to be issued is
|
||||
* stable, then queues up num_cycles clocks for transmission.
|
||||
*/
|
||||
void jtag_add_clocks(int num_cycles);
|
||||
void jtag_add_clocks(unsigned int num_cycles);
|
||||
|
||||
/**
|
||||
* For software FIFO implementations, the queued commands can be executed
|
||||
|
|
|
@ -51,8 +51,8 @@ int interface_jtag_add_plain_dr_scan(
|
|||
tap_state_t endstate);
|
||||
|
||||
int interface_jtag_add_tlr(void);
|
||||
int interface_jtag_add_pathmove(int num_states, const tap_state_t *path);
|
||||
int interface_jtag_add_runtest(int num_cycles, tap_state_t endstate);
|
||||
int interface_jtag_add_pathmove(unsigned int num_states, const tap_state_t *path);
|
||||
int interface_jtag_add_runtest(unsigned int num_cycles, tap_state_t endstate);
|
||||
|
||||
int interface_add_tms_seq(unsigned num_bits,
|
||||
const uint8_t *bits, enum tap_state state);
|
||||
|
@ -67,7 +67,7 @@ int interface_add_tms_seq(unsigned num_bits,
|
|||
*/
|
||||
int interface_jtag_add_reset(int trst, int srst);
|
||||
int interface_jtag_add_sleep(uint32_t us);
|
||||
int interface_jtag_add_clocks(int num_cycles);
|
||||
int interface_jtag_add_clocks(unsigned int num_cycles);
|
||||
int interface_jtag_execute_queue(void);
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,11 +58,12 @@ static int esirisc_jtag_get_padding(void)
|
|||
return padding;
|
||||
}
|
||||
|
||||
static int esirisc_jtag_count_bits(int num_fields, struct scan_field *fields)
|
||||
static int esirisc_jtag_count_bits(unsigned int num_fields,
|
||||
struct scan_field *fields)
|
||||
{
|
||||
int bit_count = 0;
|
||||
|
||||
for (int i = 0; i < num_fields; ++i)
|
||||
for (unsigned int i = 0; i < num_fields; ++i)
|
||||
bit_count += fields[i].num_bits;
|
||||
|
||||
return bit_count;
|
||||
|
|
Loading…
Reference in New Issue