jtag: drop useless typedef tap_state_t

No need to use a typedef for an enum.
Drop it.

Change-Id: I9eb2dc4f926671c5bb44e61453d92880e3036848
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8709
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
This commit is contained in:
Antonio Borneo
2025-01-10 17:05:29 +01:00
parent 0d1932520b
commit 4895a556fa
46 changed files with 232 additions and 232 deletions

View File

@@ -40,26 +40,26 @@ struct scan_command {
/** pointer to an array of data scan fields */
struct scan_field *fields;
/** state in which JTAG commands should finish */
tap_state_t end_state;
enum tap_state end_state;
};
struct statemove_command {
/** state in which JTAG commands should finish */
tap_state_t end_state;
enum tap_state end_state;
};
struct pathmove_command {
/** number of states in *path */
unsigned int num_states;
/** states that have to be passed */
tap_state_t *path;
enum tap_state *path;
};
struct runtest_command {
/** number of cycles to spend in Run-Test/Idle state */
unsigned int num_cycles;
/** state in which JTAG commands should finish */
tap_state_t end_state;
enum tap_state end_state;
};
@@ -78,7 +78,7 @@ struct reset_command {
struct end_state_command {
/** state in which JTAG commands should finish */
tap_state_t end_state;
enum tap_state end_state;
};
struct sleep_command {

View File

@@ -48,8 +48,8 @@ static void jtag_add_scan_check(struct jtag_tap *active,
void (*jtag_add_scan)(struct jtag_tap *active,
int in_num_fields,
const struct scan_field *in_fields,
tap_state_t state),
int in_num_fields, struct scan_field *in_fields, tap_state_t state);
enum tap_state state),
int in_num_fields, struct scan_field *in_fields, enum tap_state state);
static int jtag_error_clear(void);
@@ -87,7 +87,7 @@ static int jtag_srst = -1;
static struct jtag_tap *__jtag_all_taps;
static enum reset_types jtag_reset_config = RESET_NONE;
tap_state_t cmd_queue_cur_state = TAP_RESET;
enum tap_state cmd_queue_cur_state = TAP_RESET;
static bool jtag_verify_capture_ir = true;
static bool jtag_verify = true;
@@ -350,7 +350,7 @@ static void jtag_checks(void)
assert(jtag_trst == 0);
}
static void jtag_prelude(tap_state_t state)
static void jtag_prelude(enum tap_state state)
{
jtag_checks();
@@ -360,7 +360,7 @@ static void jtag_prelude(tap_state_t state)
}
void jtag_add_ir_scan_noverify(struct jtag_tap *active, const struct scan_field *in_fields,
tap_state_t state)
enum tap_state state)
{
jtag_prelude(state);
@@ -371,13 +371,13 @@ void jtag_add_ir_scan_noverify(struct jtag_tap *active, const struct scan_field
static void jtag_add_ir_scan_noverify_callback(struct jtag_tap *active,
int dummy,
const struct scan_field *in_fields,
tap_state_t state)
enum tap_state state)
{
jtag_add_ir_scan_noverify(active, in_fields, state);
}
/* If fields->in_value is filled out, then the captured IR value will be checked */
void jtag_add_ir_scan(struct jtag_tap *active, struct scan_field *in_fields, tap_state_t state)
void jtag_add_ir_scan(struct jtag_tap *active, struct scan_field *in_fields, enum tap_state state)
{
assert(state != TAP_RESET);
@@ -396,7 +396,7 @@ void jtag_add_ir_scan(struct jtag_tap *active, struct scan_field *in_fields, tap
}
void jtag_add_plain_ir_scan(int num_bits, const uint8_t *out_bits, uint8_t *in_bits,
tap_state_t state)
enum tap_state state)
{
assert(out_bits);
assert(state != TAP_RESET);
@@ -426,8 +426,8 @@ static void jtag_add_scan_check(struct jtag_tap *active, void (*jtag_add_scan)(
struct jtag_tap *active,
int in_num_fields,
const struct scan_field *in_fields,
tap_state_t state),
int in_num_fields, struct scan_field *in_fields, tap_state_t state)
enum tap_state state),
int in_num_fields, struct scan_field *in_fields, enum tap_state state)
{
jtag_add_scan(active, in_num_fields, in_fields, state);
@@ -445,7 +445,7 @@ static void jtag_add_scan_check(struct jtag_tap *active, void (*jtag_add_scan)(
void jtag_add_dr_scan_check(struct jtag_tap *active,
int in_num_fields,
struct scan_field *in_fields,
tap_state_t state)
enum tap_state state)
{
if (jtag_verify)
jtag_add_scan_check(active, jtag_add_dr_scan, in_num_fields, in_fields, state);
@@ -457,7 +457,7 @@ void jtag_add_dr_scan_check(struct jtag_tap *active,
void jtag_add_dr_scan(struct jtag_tap *active,
int in_num_fields,
const struct scan_field *in_fields,
tap_state_t state)
enum tap_state state)
{
assert(state != TAP_RESET);
@@ -469,7 +469,7 @@ void jtag_add_dr_scan(struct jtag_tap *active,
}
void jtag_add_plain_dr_scan(int num_bits, const uint8_t *out_bits, uint8_t *in_bits,
tap_state_t state)
enum tap_state state)
{
assert(out_bits);
assert(state != TAP_RESET);
@@ -520,9 +520,9 @@ int jtag_add_tms_seq(unsigned int nbits, const uint8_t *seq, enum tap_state stat
return retval;
}
void jtag_add_pathmove(unsigned int num_states, const tap_state_t *path)
void jtag_add_pathmove(unsigned int num_states, const enum tap_state *path)
{
tap_state_t cur_state = cmd_queue_cur_state;
enum tap_state cur_state = cmd_queue_cur_state;
/* the last state has to be a stable state */
if (!tap_is_state_stable(path[num_states - 1])) {
@@ -554,9 +554,9 @@ void jtag_add_pathmove(unsigned int num_states, const tap_state_t *path)
cmd_queue_cur_state = path[num_states - 1];
}
int jtag_add_statemove(tap_state_t goal_state)
int jtag_add_statemove(enum tap_state goal_state)
{
tap_state_t cur_state = cmd_queue_cur_state;
enum tap_state cur_state = cmd_queue_cur_state;
if (goal_state != cur_state) {
LOG_DEBUG("cur_state=%s goal_state=%s",
@@ -575,7 +575,7 @@ int jtag_add_statemove(tap_state_t goal_state)
else if (tap_is_state_stable(cur_state) && tap_is_state_stable(goal_state)) {
unsigned int tms_bits = tap_get_tms_path(cur_state, goal_state);
unsigned int tms_count = tap_get_tms_path_len(cur_state, goal_state);
tap_state_t moves[8];
enum tap_state moves[8];
assert(tms_count < ARRAY_SIZE(moves));
for (unsigned int i = 0; i < tms_count; i++, tms_bits >>= 1) {
@@ -595,7 +595,7 @@ int jtag_add_statemove(tap_state_t goal_state)
return ERROR_OK;
}
void jtag_add_runtest(unsigned int num_cycles, tap_state_t state)
void jtag_add_runtest(unsigned int num_cycles, enum tap_state state)
{
jtag_prelude(state);
jtag_set_error(interface_jtag_add_runtest(num_cycles, state));

View File

@@ -146,7 +146,7 @@ static int amt_jtagaccel_speed(int speed)
return ERROR_OK;
}
static void amt_jtagaccel_end_state(tap_state_t state)
static void amt_jtagaccel_end_state(enum tap_state state)
{
if (tap_is_state_stable(state))
tap_set_end_state(state);
@@ -179,8 +179,8 @@ static void amt_jtagaccel_state_move(void)
uint8_t aw_scan_tms_5;
uint8_t tms_scan[2];
tap_state_t cur_state = tap_get_state();
tap_state_t end_state = tap_get_end_state();
enum tap_state cur_state = tap_get_state();
enum tap_state end_state = tap_get_end_state();
tms_scan[0] = amt_jtagaccel_tap_move[tap_move_ndx(cur_state)][tap_move_ndx(end_state)][0];
tms_scan[1] = amt_jtagaccel_tap_move[tap_move_ndx(cur_state)][tap_move_ndx(end_state)][1];
@@ -209,7 +209,7 @@ static void amt_jtagaccel_runtest(unsigned int num_cycles)
uint8_t aw_scan_tms_5;
uint8_t aw_scan_tms_1to4;
tap_state_t saved_end_state = tap_get_end_state();
enum tap_state saved_end_state = tap_get_end_state();
/* only do a state_move when we're not already in IDLE */
if (tap_get_state() != TAP_IDLE) {
@@ -237,7 +237,7 @@ static void amt_jtagaccel_scan(bool ir_scan, enum scan_type type, uint8_t *buffe
{
int bits_left = scan_size;
int bit_count = 0;
tap_state_t saved_end_state = tap_get_end_state();
enum tap_state saved_end_state = tap_get_end_state();
uint8_t aw_tdi_option;
uint8_t dw_tdi_scan;
uint8_t dr_tdo;

View File

@@ -219,7 +219,7 @@ static int angie_append_test_cmd(struct angie *device);
static int angie_calculate_delay(enum angie_delay_type type, long f, int *delay);
/* Interface between ANGIE and OpenOCD */
static void angie_set_end_state(tap_state_t endstate);
static void angie_set_end_state(enum tap_state endstate);
static int angie_queue_statemove(struct angie *device);
static int angie_queue_scan(struct angie *device, struct jtag_command *cmd);
@@ -1519,7 +1519,7 @@ static long angie_calculate_frequency(enum angie_delay_type type, int delay)
*
* @param endstate the state the end state follower should be set to.
*/
static void angie_set_end_state(tap_state_t endstate)
static void angie_set_end_state(enum tap_state endstate)
{
if (tap_is_state_stable(endstate))
tap_set_end_state(endstate);
@@ -1837,7 +1837,7 @@ static int angie_reset(int trst, int srst)
static int angie_queue_pathmove(struct angie *device, struct jtag_command *cmd)
{
int ret, state_count;
tap_state_t *path;
enum tap_state *path;
uint8_t tms_sequence;
unsigned int num_states = cmd->cmd.pathmove->num_states;

View File

@@ -42,9 +42,9 @@ static uint8_t usb_in_buffer[ARMJTAGEW_IN_BUFFER_SIZE];
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_end_state(enum tap_state state);
static void armjtagew_state_move(void);
static void armjtagew_path_move(unsigned int num_states, tap_state_t *path);
static void armjtagew_path_move(unsigned int num_states, enum tap_state *path);
static void armjtagew_runtest(unsigned int num_cycles);
static void armjtagew_scan(bool ir_scan,
enum scan_type type,
@@ -253,7 +253,7 @@ static int armjtagew_quit(void)
/**************************************************************************
* Queue command implementations */
static void armjtagew_end_state(tap_state_t state)
static void armjtagew_end_state(enum tap_state state)
{
if (tap_is_state_stable(state))
tap_set_end_state(state);
@@ -279,7 +279,7 @@ static void armjtagew_state_move(void)
tap_set_state(tap_get_end_state());
}
static void armjtagew_path_move(unsigned int num_states, tap_state_t *path)
static void armjtagew_path_move(unsigned int num_states, enum tap_state *path)
{
for (unsigned int i = 0; i < num_states; i++) {
/*
@@ -305,7 +305,7 @@ static void armjtagew_path_move(unsigned int num_states, tap_state_t *path)
static void armjtagew_runtest(unsigned int num_cycles)
{
tap_state_t saved_end_state = tap_get_end_state();
enum tap_state saved_end_state = tap_get_end_state();
/* only do a state_move when we're not already in IDLE */
if (tap_get_state() != TAP_IDLE) {
@@ -329,7 +329,7 @@ static void armjtagew_scan(bool ir_scan,
int scan_size,
struct scan_command *command)
{
tap_state_t saved_end_state;
enum tap_state saved_end_state;
armjtagew_tap_ensure_space(1, scan_size + 8);

View File

@@ -60,7 +60,7 @@ const struct bitbang_interface *bitbang_interface;
#define CLOCK_IDLE() 0
/* The bitbang driver leaves the TCK 0 when in idle */
static void bitbang_end_state(tap_state_t state)
static void bitbang_end_state(enum tap_state state)
{
assert(tap_is_state_stable(state));
tap_set_end_state(state);
@@ -149,7 +149,7 @@ static int bitbang_path_move(struct pathmove_command *cmd)
static int bitbang_runtest(unsigned int num_cycles)
{
tap_state_t saved_end_state = tap_get_end_state();
enum tap_state saved_end_state = tap_get_end_state();
/* only do a state_move when we're not already in IDLE */
if (tap_get_state() != TAP_IDLE) {
@@ -195,7 +195,7 @@ static int bitbang_stableclocks(unsigned int num_cycles)
static int bitbang_scan(bool ir_scan, enum scan_type type, uint8_t *buffer,
unsigned int scan_size)
{
tap_state_t saved_end_state = tap_get_end_state();
enum tap_state saved_end_state = tap_get_end_state();
unsigned int bit_cnt;
if (!((!ir_scan &&

View File

@@ -76,7 +76,7 @@ static void bitq_io(int tms, int tdi, int tdo_req)
bitq_in_proc();
}
static void bitq_end_state(tap_state_t state)
static void bitq_end_state(enum tap_state state)
{
if (!tap_is_state_stable(state)) {
LOG_ERROR("BUG: %i is not a valid end state", state);
@@ -85,7 +85,7 @@ static void bitq_end_state(tap_state_t state)
tap_set_end_state(state);
}
static void bitq_state_move(tap_state_t new_state)
static void bitq_state_move(enum tap_state new_state)
{
int i = 0;
uint8_t tms_scan;

View File

@@ -25,9 +25,9 @@ static int buspirate_init(void);
static int buspirate_quit(void);
static int buspirate_reset(int trst, int srst);
static void buspirate_end_state(tap_state_t state);
static void buspirate_end_state(enum tap_state state);
static void buspirate_state_move(void);
static void buspirate_path_move(unsigned int num_states, tap_state_t *path);
static void buspirate_path_move(unsigned int num_states, enum tap_state *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);
@@ -554,7 +554,7 @@ struct adapter_driver buspirate_adapter_driver = {
};
/*************** jtag execute commands **********************/
static void buspirate_end_state(tap_state_t state)
static void buspirate_end_state(enum tap_state state)
{
if (tap_is_state_stable(state))
tap_set_end_state(state);
@@ -580,7 +580,7 @@ static void buspirate_state_move(void)
tap_set_state(tap_get_end_state());
}
static void buspirate_path_move(unsigned int num_states, tap_state_t *path)
static void buspirate_path_move(unsigned int num_states, enum tap_state *path)
{
for (unsigned int i = 0; i < num_states; i++) {
if (tap_state_transition(tap_get_state(), false) == path[i]) {
@@ -604,7 +604,7 @@ static void buspirate_path_move(unsigned int num_states, tap_state_t *path)
static void buspirate_runtest(unsigned int num_cycles)
{
tap_state_t saved_end_state = tap_get_end_state();
enum tap_state saved_end_state = tap_get_end_state();
/* only do a state_move when we're not already in IDLE */
if (tap_get_state() != TAP_IDLE) {
@@ -628,7 +628,7 @@ 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)
{
tap_state_t saved_end_state;
enum tap_state saved_end_state;
buspirate_tap_make_space(1, scan_size+8);
/* is 8 correct ? (2 moves = 16) */

View File

@@ -1502,7 +1502,7 @@ static int cmsis_dap_execute_tlr_reset(struct jtag_command *cmd)
}
/* Set new end state */
static void cmsis_dap_end_state(tap_state_t state)
static void cmsis_dap_end_state(enum tap_state state)
{
if (tap_is_state_stable(state))
tap_set_end_state(state);
@@ -1831,7 +1831,7 @@ static void cmsis_dap_execute_scan(struct jtag_command *cmd)
tap_state_name(tap_get_end_state()));
}
static void cmsis_dap_pathmove(int num_states, tap_state_t *path)
static void cmsis_dap_pathmove(int num_states, enum tap_state *path)
{
uint8_t tms0 = 0x00;
uint8_t tms1 = 0xff;
@@ -1873,7 +1873,7 @@ static void cmsis_dap_stableclocks(unsigned int num_cycles)
static void cmsis_dap_runtest(unsigned int num_cycles)
{
tap_state_t saved_end_state = tap_get_end_state();
enum tap_state saved_end_state = tap_get_end_state();
/* Only do a state_move when we're not already in IDLE. */
if (tap_get_state() != TAP_IDLE) {

View File

@@ -49,7 +49,7 @@ static void jtag_callback_queue_reset(void)
*
*/
int interface_jtag_add_ir_scan(struct jtag_tap *active,
const struct scan_field *in_fields, tap_state_t state)
const struct scan_field *in_fields, enum tap_state state)
{
size_t num_taps = jtag_tap_count_enabled();
@@ -111,7 +111,7 @@ int interface_jtag_add_ir_scan(struct jtag_tap *active,
*
*/
int interface_jtag_add_dr_scan(struct jtag_tap *active, int in_num_fields,
const struct scan_field *in_fields, tap_state_t state)
const struct scan_field *in_fields, enum tap_state state)
{
/* count devices in bypass */
@@ -184,7 +184,7 @@ int interface_jtag_add_dr_scan(struct jtag_tap *active, int in_num_fields,
}
static int jtag_add_plain_scan(int num_bits, const uint8_t *out_bits,
uint8_t *in_bits, tap_state_t state, bool ir_scan)
uint8_t *in_bits, enum tap_state state, bool ir_scan)
{
struct jtag_command *cmd = cmd_queue_alloc(sizeof(struct jtag_command));
struct scan_command *scan = cmd_queue_alloc(sizeof(struct scan_command));
@@ -207,19 +207,19 @@ static int jtag_add_plain_scan(int num_bits, const uint8_t *out_bits,
return ERROR_OK;
}
int interface_jtag_add_plain_dr_scan(int num_bits, const uint8_t *out_bits, uint8_t *in_bits, tap_state_t state)
int interface_jtag_add_plain_dr_scan(int num_bits, const uint8_t *out_bits, uint8_t *in_bits, enum tap_state state)
{
return jtag_add_plain_scan(num_bits, out_bits, in_bits, state, false);
}
int interface_jtag_add_plain_ir_scan(int num_bits, const uint8_t *out_bits, uint8_t *in_bits, tap_state_t state)
int interface_jtag_add_plain_ir_scan(int num_bits, const uint8_t *out_bits, uint8_t *in_bits, enum tap_state state)
{
return jtag_add_plain_scan(num_bits, out_bits, in_bits, state, true);
}
int interface_jtag_add_tlr(void)
{
tap_state_t state = TAP_RESET;
enum tap_state state = TAP_RESET;
/* allocate memory for a new list member */
struct jtag_command *cmd = cmd_queue_alloc(sizeof(struct jtag_command));
@@ -259,7 +259,7 @@ int interface_add_tms_seq(unsigned int num_bits, const uint8_t *seq, enum tap_st
return ERROR_OK;
}
int interface_jtag_add_pathmove(unsigned int num_states, const tap_state_t *path)
int interface_jtag_add_pathmove(unsigned int num_states, const enum tap_state *path)
{
/* allocate memory for a new list member */
struct jtag_command *cmd = cmd_queue_alloc(sizeof(struct jtag_command));
@@ -270,7 +270,7 @@ int interface_jtag_add_pathmove(unsigned int num_states, const tap_state_t *path
cmd->cmd.pathmove = cmd_queue_alloc(sizeof(struct pathmove_command));
cmd->cmd.pathmove->num_states = num_states;
cmd->cmd.pathmove->path = cmd_queue_alloc(sizeof(tap_state_t) * num_states);
cmd->cmd.pathmove->path = cmd_queue_alloc(sizeof(enum tap_state) * num_states);
for (unsigned int i = 0; i < num_states; i++)
cmd->cmd.pathmove->path[i] = path[i];
@@ -278,7 +278,7 @@ int interface_jtag_add_pathmove(unsigned int num_states, const tap_state_t *path
return ERROR_OK;
}
int interface_jtag_add_runtest(unsigned int num_cycles, tap_state_t state)
int interface_jtag_add_runtest(unsigned int num_cycles, enum tap_state state)
{
/* allocate memory for a new list member */
struct jtag_command *cmd = cmd_queue_alloc(sizeof(struct jtag_command));

View File

@@ -14,7 +14,7 @@
#include "hello.h"
/* my private tap controller state, which tracks state for calling code */
static tap_state_t dummy_state = TAP_RESET;
static enum tap_state dummy_state = TAP_RESET;
static int dummy_clock; /* edge detector */
@@ -34,7 +34,7 @@ static int dummy_write(int tck, int tms, int tdi)
/* TAP standard: "state transitions occur on rising edge of clock" */
if (tck != dummy_clock) {
if (tck) {
tap_state_t old_state = dummy_state;
enum tap_state old_state = dummy_state;
dummy_state = tap_state_transition(old_state, tms);
if (old_state != dummy_state) {

View File

@@ -622,7 +622,7 @@ static const struct command_registration ft232r_command_handlers[] = {
* Synchronous bitbang protocol implementation.
*/
static void syncbb_end_state(tap_state_t state)
static void syncbb_end_state(enum tap_state state)
{
if (tap_is_state_stable(state))
tap_set_end_state(state);
@@ -705,7 +705,7 @@ static void syncbb_path_move(struct pathmove_command *cmd)
static void syncbb_runtest(unsigned int num_cycles)
{
tap_state_t saved_end_state = tap_get_end_state();
enum tap_state saved_end_state = tap_get_end_state();
/* only do a state_move when we're not already in IDLE */
if (tap_get_state() != TAP_IDLE) {
@@ -747,7 +747,7 @@ static void syncbb_stableclocks(unsigned int num_cycles)
static void syncbb_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size)
{
tap_state_t saved_end_state = tap_get_end_state();
enum tap_state saved_end_state = tap_get_end_state();
int bit_cnt, bit0_index;
if (!((!ir_scan && (tap_get_state() == TAP_DRSHIFT)) || (ir_scan && (tap_get_state() == TAP_IRSHIFT)))) {

View File

@@ -238,9 +238,9 @@ static int ftdi_get_signal(const struct signal *s, uint16_t *value_out)
*
* @param goal_state is the destination state for the move.
*/
static void move_to_state(tap_state_t goal_state)
static void move_to_state(enum tap_state goal_state)
{
tap_state_t start_state = tap_get_state();
enum tap_state start_state = tap_get_state();
/* goal_state is 1/2 of a tuple/pair of states which allow convenient
lookup of the required TMS pattern to move to this state from the
@@ -299,7 +299,7 @@ static int ftdi_khz(int khz, int *jtag_speed)
return ERROR_OK;
}
static void ftdi_end_state(tap_state_t state)
static void ftdi_end_state(enum tap_state state)
{
if (tap_is_state_stable(state))
tap_set_end_state(state);
@@ -370,7 +370,7 @@ 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;
enum tap_state *path = cmd->cmd.pathmove->path;
unsigned int num_states = cmd->cmd.pathmove->num_states;
LOG_DEBUG_IO("pathmove: %u states, current: %s end: %s", num_states,

View File

@@ -133,7 +133,7 @@ static void gw16012_reset(int trst, int srst)
gw16012_control(0x0b);
}
static void gw16012_end_state(tap_state_t state)
static void gw16012_end_state(enum tap_state state)
{
if (tap_is_state_stable(state))
tap_set_end_state(state);
@@ -187,7 +187,7 @@ static void gw16012_path_move(struct pathmove_command *cmd)
static void gw16012_runtest(unsigned int num_cycles)
{
tap_state_t saved_end_state = tap_get_end_state();
enum tap_state saved_end_state = tap_get_end_state();
/* only do a state_move when we're not already in IDLE */
if (tap_get_state() != TAP_IDLE) {
@@ -209,7 +209,7 @@ static void gw16012_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int
{
int bits_left = scan_size;
int bit_count = 0;
tap_state_t saved_end_state = tap_get_end_state();
enum tap_state saved_end_state = tap_get_end_state();
uint8_t scan_out, scan_in;
/* only if we're not already in the correct Shift state */

View File

@@ -78,9 +78,9 @@ static struct device_config config;
static struct device_config tmp_config;
/* Queue command functions */
static void jlink_end_state(tap_state_t state);
static void jlink_end_state(enum tap_state state);
static void jlink_state_move(void);
static void jlink_path_move(unsigned int num_states, tap_state_t *path);
static void jlink_path_move(unsigned int num_states, enum tap_state *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);
@@ -875,7 +875,7 @@ static int jlink_quit(void)
/***************************************************************************/
/* Queue command implementations */
static void jlink_end_state(tap_state_t state)
static void jlink_end_state(enum tap_state state)
{
if (tap_is_state_stable(state))
tap_set_end_state(state);
@@ -899,7 +899,7 @@ static void jlink_state_move(void)
tap_set_state(tap_get_end_state());
}
static void jlink_path_move(unsigned int num_states, tap_state_t *path)
static void jlink_path_move(unsigned int num_states, enum tap_state *path)
{
uint8_t tms = 0xff;
@@ -930,7 +930,7 @@ static void jlink_stableclocks(unsigned int num_cycles)
static void jlink_runtest(unsigned int num_cycles)
{
tap_state_t saved_end_state = tap_get_end_state();
enum tap_state saved_end_state = tap_get_end_state();
/* Only do a state_move when we're not already in IDLE. */
if (tap_get_state() != TAP_IDLE) {

View File

@@ -272,7 +272,7 @@ static int jtag_vpi_tms(struct tms_command *cmd)
return jtag_vpi_tms_seq(cmd->bits, cmd->num_bits);
}
static int jtag_vpi_state_move(tap_state_t state)
static int jtag_vpi_state_move(enum tap_state state)
{
if (tap_get_state() == state)
return ERROR_OK;
@@ -440,7 +440,7 @@ static int jtag_vpi_scan(struct scan_command *cmd)
return ERROR_OK;
}
static int jtag_vpi_runtest(unsigned int num_cycles, tap_state_t state)
static int jtag_vpi_runtest(unsigned int num_cycles, enum tap_state state)
{
int retval;

View File

@@ -104,9 +104,9 @@ static int opendous_init(void);
static int opendous_quit(void);
/* Queue command functions */
static void opendous_end_state(tap_state_t state);
static void opendous_end_state(enum tap_state state);
static void opendous_state_move(void);
static void opendous_path_move(unsigned int num_states, tap_state_t *path);
static void opendous_path_move(unsigned int num_states, enum tap_state *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);
@@ -393,7 +393,7 @@ static int opendous_quit(void)
/***************************************************************************/
/* Queue command implementations */
void opendous_end_state(tap_state_t state)
void opendous_end_state(enum tap_state state)
{
if (tap_is_state_stable(state))
tap_set_end_state(state);
@@ -419,7 +419,7 @@ void opendous_state_move(void)
tap_set_state(tap_get_end_state());
}
void opendous_path_move(unsigned int num_states, tap_state_t *path)
void opendous_path_move(unsigned int num_states, enum tap_state *path)
{
for (unsigned int i = 0; i < num_states; i++) {
if (path[i] == tap_state_transition(tap_get_state(), false))
@@ -440,7 +440,7 @@ void opendous_path_move(unsigned int num_states, tap_state_t *path)
void opendous_runtest(unsigned int num_cycles)
{
tap_state_t saved_end_state = tap_get_end_state();
enum tap_state saved_end_state = tap_get_end_state();
/* only do a state_move when we're not already in IDLE */
if (tap_get_state() != TAP_IDLE) {
@@ -460,7 +460,7 @@ void opendous_runtest(unsigned int num_cycles)
void opendous_scan(int ir_scan, enum scan_type type, uint8_t *buffer, int scan_size, struct scan_command *command)
{
tap_state_t saved_end_state;
enum tap_state saved_end_state;
opendous_tap_ensure_space(1, scan_size + 8);

View File

@@ -748,7 +748,7 @@ static void openjtag_execute_scan(struct jtag_command *cmd)
static void openjtag_execute_runtest(struct jtag_command *cmd)
{
tap_state_t end_state = cmd->cmd.runtest->end_state;
enum tap_state end_state = cmd->cmd.runtest->end_state;
tap_set_end_state(end_state);
/* only do a state_move when we're not already in IDLE */

View File

@@ -380,7 +380,7 @@ static int osbdm_quit(void)
static int osbdm_add_pathmove(
struct queue *queue,
tap_state_t *path,
enum tap_state *path,
unsigned int num_states)
{
assert(num_states <= 32);
@@ -415,7 +415,7 @@ static int osbdm_add_pathmove(
static int osbdm_add_statemove(
struct queue *queue,
tap_state_t new_state,
enum tap_state new_state,
int skip_first)
{
int len = 0;
@@ -490,7 +490,7 @@ static int osbdm_add_scan(
struct queue *queue,
struct scan_field *fields,
unsigned int num_fields,
tap_state_t end_state,
enum tap_state end_state,
bool ir_scan)
{
/* Move to desired shift state */
@@ -537,7 +537,7 @@ static int osbdm_add_scan(
static int osbdm_add_runtest(
struct queue *queue,
unsigned int num_cycles,
tap_state_t end_state)
enum tap_state end_state)
{
if (osbdm_add_statemove(queue, TAP_IDLE, 0) != ERROR_OK)
return ERROR_FAIL;

View File

@@ -842,7 +842,7 @@ static int tap_state_queue_append(uint8_t tms)
return 0;
}
static void rlink_end_state(tap_state_t state)
static void rlink_end_state(enum tap_state state)
{
if (tap_is_state_stable(state))
tap_set_end_state(state);
@@ -898,7 +898,7 @@ static void rlink_path_move(struct pathmove_command *cmd)
static void rlink_runtest(unsigned int num_cycles)
{
tap_state_t saved_end_state = tap_get_end_state();
enum tap_state saved_end_state = tap_get_end_state();
/* only do a state_move when we're not already in RTI */
if (tap_get_state() != TAP_IDLE) {
@@ -1019,7 +1019,7 @@ static int rlink_scan(struct jtag_command *cmd, enum scan_type type,
uint8_t *buffer, int scan_size)
{
bool ir_scan;
tap_state_t saved_end_state;
enum tap_state saved_end_state;
int byte_bits;
int extra_bits;
int chunk_bits;

View File

@@ -212,7 +212,7 @@ static int ulink_append_test_cmd(struct ulink *device);
static int ulink_calculate_delay(enum ulink_delay_type type, long f, int *delay);
/* Interface between OpenULINK and OpenOCD */
static void ulink_set_end_state(tap_state_t endstate);
static void ulink_set_end_state(enum tap_state endstate);
static int ulink_queue_statemove(struct ulink *device);
static int ulink_queue_scan(struct ulink *device, struct jtag_command *cmd);
@@ -1393,7 +1393,7 @@ static long ulink_calculate_frequency(enum ulink_delay_type type, int delay)
*
* @param endstate the state the end state follower should be set to.
*/
static void ulink_set_end_state(tap_state_t endstate)
static void ulink_set_end_state(enum tap_state endstate)
{
if (tap_is_state_stable(endstate))
tap_set_end_state(endstate);
@@ -1702,7 +1702,7 @@ 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, state_count;
tap_state_t *path;
enum tap_state *path;
uint8_t tms_sequence;
unsigned int num_states = cmd->cmd.pathmove->num_states;

View File

@@ -494,7 +494,7 @@ static void ublast_path_move(struct pathmove_command *cmd)
* Input the correct TMS sequence to the JTAG TAP so that we end up in the
* target state. This assumes the current state (tap_get_state()) is correct.
*/
static void ublast_state_move(tap_state_t state, int skip)
static void ublast_state_move(enum tap_state state, int skip)
{
uint8_t tms_scan;
int tms_len;
@@ -673,7 +673,7 @@ static void ublast_queue_tdi(uint8_t *bits, int nb_bits, enum scan_type scan)
ublast_idle_clock();
}
static void ublast_runtest(unsigned int num_cycles, tap_state_t state)
static void ublast_runtest(unsigned int num_cycles, enum tap_state state)
{
LOG_DEBUG_IO("%s(cycles=%u, end_state=%d)", __func__, num_cycles, state);

View File

@@ -34,7 +34,7 @@
#define TCK_BIT 2
#define TMS_BIT 1
static void usbprog_end_state(tap_state_t state);
static void usbprog_end_state(enum tap_state state);
static void usbprog_state_move(void);
static void usbprog_path_move(struct pathmove_command *cmd);
static void usbprog_runtest(unsigned int num_cycles);
@@ -168,7 +168,7 @@ static int usbprog_quit(void)
}
/*************** jtag execute commands **********************/
static void usbprog_end_state(tap_state_t state)
static void usbprog_end_state(enum tap_state state)
{
if (tap_is_state_stable(state))
tap_set_end_state(state);
@@ -257,7 +257,7 @@ 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)
{
tap_state_t saved_end_state = tap_get_end_state();
enum tap_state saved_end_state = tap_get_end_state();
if (ir_scan)
usbprog_end_state(TAP_IRSHIFT);

View File

@@ -944,11 +944,11 @@ static int vdebug_jtag_path_move(struct pathmove_command *cmd, uint8_t f_flush)
return vdebug_jtag_tms_seq(tms, cmd->num_states, f_flush);
}
static int vdebug_jtag_tlr(tap_state_t state, uint8_t f_flush)
static int vdebug_jtag_tlr(enum tap_state state, uint8_t f_flush)
{
int rc = ERROR_OK;
tap_state_t cur = tap_get_state();
enum tap_state 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("tlr from %x to %x", cur, state);
@@ -964,7 +964,7 @@ static int vdebug_jtag_scan(struct scan_command *cmd, uint8_t f_flush)
{
int rc = ERROR_OK;
tap_state_t cur = tap_get_state();
enum tap_state cur = tap_get_state();
uint8_t state = cmd->ir_scan ? TAP_IRSHIFT : TAP_DRSHIFT;
uint8_t tms_pre = tap_get_tms_path(cur, state);
uint8_t num_pre = tap_get_tms_path_len(cur, state);
@@ -992,9 +992,9 @@ static int vdebug_jtag_scan(struct scan_command *cmd, uint8_t f_flush)
return rc;
}
static int vdebug_jtag_runtest(unsigned int num_cycles, tap_state_t state, uint8_t f_flush)
static int vdebug_jtag_runtest(unsigned int num_cycles, enum tap_state state, uint8_t f_flush)
{
tap_state_t cur = tap_get_state();
enum tap_state 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:%u state cur:%x end:%x", num_cycles, cur, state);

View File

@@ -41,9 +41,9 @@ static struct pending_scan_result
pending_scan_results_buffer[MAX_PENDING_SCAN_RESULTS];
/* Queue command functions */
static void vsllink_end_state(tap_state_t state);
static void vsllink_end_state(enum tap_state state);
static void vsllink_state_move(void);
static void vsllink_path_move(unsigned int num_states, tap_state_t *path);
static void vsllink_path_move(unsigned int num_states, enum tap_state *path);
static void vsllink_tms(int num_bits, const uint8_t *bits);
static void vsllink_runtest(unsigned int num_cycles);
static void vsllink_stableclocks(unsigned int num_cycles, int tms);
@@ -346,7 +346,7 @@ static int vsllink_init(void)
/**************************************************************************
* Queue command implementations */
static void vsllink_end_state(tap_state_t state)
static void vsllink_end_state(enum tap_state state)
{
if (tap_is_state_stable(state))
tap_set_end_state(state);
@@ -371,7 +371,7 @@ static void vsllink_state_move(void)
tap_set_state(tap_get_end_state());
}
static void vsllink_path_move(unsigned int num_states, tap_state_t *path)
static void vsllink_path_move(unsigned int num_states, enum tap_state *path)
{
for (unsigned int i = 0; i < num_states; i++) {
if (path[i] == tap_state_transition(tap_get_state(), false))
@@ -407,7 +407,7 @@ static void vsllink_stableclocks(unsigned int num_cycles, int tms)
static void vsllink_runtest(unsigned int num_cycles)
{
tap_state_t saved_end_state = tap_get_end_state();
enum tap_state saved_end_state = tap_get_end_state();
if (tap_get_state() != TAP_IDLE) {
/* enter IDLE state */
@@ -427,7 +427,7 @@ static void vsllink_runtest(unsigned int num_cycles)
static void vsllink_scan(bool ir_scan, enum scan_type type, uint8_t *buffer,
int scan_size, struct scan_command *command)
{
tap_state_t saved_end_state;
enum tap_state saved_end_state;
saved_end_state = tap_get_end_state();

View File

@@ -172,7 +172,7 @@
#define CMD_RUNTEST 3
#define CMD_STABLECLOCKS 4
/* Array to convert from OpenOCD tap_state_t to XDS JTAG state */
/* Array to convert from OpenOCD enum tap_state to XDS JTAG state */
static const uint32_t xds_jtag_state[] = {
XDS_JTAG_STATE_EXIT2_DR, /* TAP_DREXIT2 = 0x0 */
XDS_JTAG_STATE_EXIT1_DR, /* TAP_DREXIT1 = 0x1 */

View File

@@ -171,7 +171,7 @@ static int xlnx_pcie_xvc_execute_runtest(struct jtag_command *cmd)
cmd->cmd.runtest->num_cycles,
cmd->cmd.runtest->end_state);
tap_state_t tmp_state = tap_get_end_state();
enum tap_state tmp_state = tap_get_end_state();
if (tap_get_state() != TAP_IDLE) {
tap_set_end_state(TAP_IDLE);
@@ -201,7 +201,7 @@ static int xlnx_pcie_xvc_execute_runtest(struct jtag_command *cmd)
static int xlnx_pcie_xvc_execute_pathmove(struct jtag_command *cmd)
{
unsigned int num_states = cmd->cmd.pathmove->num_states;
tap_state_t *path = cmd->cmd.pathmove->path;
enum tap_state *path = cmd->cmd.pathmove->path;
int err = ERROR_OK;
LOG_DEBUG("pathmove: %u states, end in %i",
@@ -232,7 +232,7 @@ static int xlnx_pcie_xvc_execute_pathmove(struct jtag_command *cmd)
static int xlnx_pcie_xvc_execute_scan(struct jtag_command *cmd)
{
enum scan_type type = jtag_scan_type(cmd->cmd.scan);
tap_state_t saved_end_state = cmd->cmd.scan->end_state;
enum tap_state saved_end_state = cmd->cmd.scan->end_state;
bool ir_scan = cmd->cmd.scan->ir_scan;
uint32_t tdi, tms, tdo;
uint8_t *buf, *rd_ptr;

View File

@@ -26,15 +26,15 @@
* @see tap_set_state() and tap_get_state() accessors.
* Actual name is not important since accessors hide it.
*/
static tap_state_t state_follower = TAP_RESET;
static enum tap_state state_follower = TAP_RESET;
void tap_set_state_impl(tap_state_t new_state)
void tap_set_state_impl(enum tap_state new_state)
{
/* this is the state we think the TAPs are in now, was cur_state */
state_follower = new_state;
}
tap_state_t tap_get_state(void)
enum tap_state tap_get_state(void)
{
return state_follower;
}
@@ -43,9 +43,9 @@ tap_state_t tap_get_state(void)
* @see tap_set_end_state() and tap_get_end_state() accessors.
* Actual name is not important because accessors hide it.
*/
static tap_state_t end_state_follower = TAP_RESET;
static enum tap_state end_state_follower = TAP_RESET;
void tap_set_end_state(tap_state_t new_end_state)
void tap_set_end_state(enum tap_state new_end_state)
{
/* this is the state we think the TAPs will be in at completion of the
* current TAP operation, was end_state
@@ -53,12 +53,12 @@ void tap_set_end_state(tap_state_t new_end_state)
end_state_follower = new_end_state;
}
tap_state_t tap_get_end_state(void)
enum tap_state tap_get_end_state(void)
{
return end_state_follower;
}
int tap_move_ndx(tap_state_t astate)
int tap_move_ndx(enum tap_state astate)
{
/* given a stable state, return the index into the tms_seqs[]
* array within tap_get_tms_path()
@@ -187,17 +187,17 @@ typedef const struct tms_sequences tms_table[6][6];
static tms_table *tms_seqs = &short_tms_seqs;
int tap_get_tms_path(tap_state_t from, tap_state_t to)
int tap_get_tms_path(enum tap_state from, enum tap_state to)
{
return (*tms_seqs)[tap_move_ndx(from)][tap_move_ndx(to)].bits;
}
int tap_get_tms_path_len(tap_state_t from, tap_state_t to)
int tap_get_tms_path_len(enum tap_state from, enum tap_state to)
{
return (*tms_seqs)[tap_move_ndx(from)][tap_move_ndx(to)].bit_count;
}
bool tap_is_state_stable(tap_state_t astate)
bool tap_is_state_stable(enum tap_state astate)
{
bool is_stable;
@@ -220,9 +220,9 @@ bool tap_is_state_stable(tap_state_t astate)
return is_stable;
}
tap_state_t tap_state_transition(tap_state_t cur_state, bool tms)
enum tap_state tap_state_transition(enum tap_state cur_state, bool tms)
{
tap_state_t new_state;
enum tap_state new_state;
/* A switch is used because it is symbol dependent and not value dependent
* like an array. Also it can check for out of range conditions.
@@ -341,7 +341,7 @@ static const struct name_mapping {
{ TAP_IDLE, "IDLE", },
};
const char *tap_state_name(tap_state_t state)
const char *tap_state_name(enum tap_state state)
{
unsigned int i;
@@ -352,7 +352,7 @@ const char *tap_state_name(tap_state_t state)
return "???";
}
tap_state_t tap_state_by_name(const char *name)
enum tap_state tap_state_by_name(const char *name)
{
unsigned int i;
@@ -371,8 +371,8 @@ tap_state_t tap_state_by_name(const char *name)
LOG_DEBUG_IO("TAP/SM: %9s -> %5s\tTMS: %s\tTDI: %s", \
tap_state_name(a), tap_state_name(b), astr, bstr)
tap_state_t jtag_debug_state_machine_(const void *tms_buf, const void *tdi_buf,
unsigned int tap_bits, tap_state_t next_state)
enum tap_state jtag_debug_state_machine_(const void *tms_buf, const void *tdi_buf,
unsigned int tap_bits, enum tap_state next_state)
{
const uint8_t *tms_buffer;
const uint8_t *tdi_buffer;
@@ -384,7 +384,7 @@ tap_state_t jtag_debug_state_machine_(const void *tms_buf, const void *tdi_buf,
char tms_str[33];
char tdi_str[33];
tap_state_t last_state;
enum tap_state last_state;
/* set startstate (and possibly last, if tap_bits == 0) */
last_state = next_state;

View File

@@ -28,7 +28,7 @@
/** implementation of wrapper function tap_set_state() */
void tap_set_state_impl(tap_state_t new_state);
void tap_set_state_impl(enum tap_state new_state);
/**
* This function sets the state of a "state follower" which tracks the
@@ -55,9 +55,9 @@ void tap_set_state_impl(tap_state_t new_state);
/**
* This function gets the state of the "state follower" which tracks the
* state of the TAPs connected to the cable. @see tap_set_state @return
* tap_state_t The state the TAPs are in now.
* enum tap_state The state the TAPs are in now.
*/
tap_state_t tap_get_state(void);
enum tap_state tap_get_state(void);
/**
* This function sets the state of an "end state follower" which tracks
@@ -70,13 +70,13 @@ tap_state_t tap_get_state(void);
* @param new_end_state The state the TAPs should enter at completion of
* a pending TAP operation.
*/
void tap_set_end_state(tap_state_t new_end_state);
void tap_set_end_state(enum tap_state new_end_state);
/**
* For more information, @see tap_set_end_state
* @return tap_state_t - The state the TAPs should be in at completion of the current TAP operation.
* @return enum tap_state - The state the TAPs should be in at completion of the current TAP operation.
*/
tap_state_t tap_get_end_state(void);
enum tap_state tap_get_end_state(void);
/**
* This function provides a "bit sequence" indicating what has to be
@@ -91,7 +91,7 @@ tap_state_t tap_get_end_state(void);
* @return int The required TMS bit sequence, with the first bit in the
* sequence at bit 0.
*/
int tap_get_tms_path(tap_state_t from, tap_state_t to);
int tap_get_tms_path(enum tap_state from, enum tap_state to);
/**
* Function int tap_get_tms_path_len
@@ -109,7 +109,7 @@ int tap_get_tms_path(tap_state_t from, tap_state_t to);
* @param to is the resultant or final state
* @return int - the total number of bits in a transition.
*/
int tap_get_tms_path_len(tap_state_t from, tap_state_t to);
int tap_get_tms_path_len(enum tap_state from, enum tap_state to);
/**
@@ -125,30 +125,30 @@ int tap_get_tms_path_len(tap_state_t from, tap_state_t to);
* and terminate.
* @return int - the array (or sequence) index as described above
*/
int tap_move_ndx(tap_state_t astate);
int tap_move_ndx(enum tap_state astate);
/**
* Function tap_is_state_stable
* returns true if the \a astate is stable.
*/
bool tap_is_state_stable(tap_state_t astate);
bool tap_is_state_stable(enum tap_state astate);
/**
* Function tap_state_transition
* takes a current TAP state and returns the next state according to the tms value.
* @param current_state is the state of a TAP currently.
* @param tms is either zero or non-zero, just like a real TMS line in a jtag interface.
* @return tap_state_t - the next state a TAP would enter.
* @return enum tap_state - the next state a TAP would enter.
*/
tap_state_t tap_state_transition(tap_state_t current_state, bool tms);
enum tap_state tap_state_transition(enum tap_state current_state, bool tms);
/** Allow switching between old and new TMS tables. @see tap_get_tms_path */
void tap_use_new_tms_table(bool use_new);
/** @returns True if new TMS table is active; false otherwise. */
bool tap_uses_new_tms_table(void);
tap_state_t jtag_debug_state_machine_(const void *tms_buf, const void *tdi_buf,
unsigned int tap_len, tap_state_t start_tap_state);
enum tap_state jtag_debug_state_machine_(const void *tms_buf, const void *tdi_buf,
unsigned int tap_len, enum tap_state start_tap_state);
/**
* @brief Prints verbose TAP state transitions for the given TMS/TDI buffers.
@@ -158,8 +158,8 @@ tap_state_t jtag_debug_state_machine_(const void *tms_buf, const void *tdi_buf,
* @param start_tap_state must specify the current TAP state.
* @returns the final TAP state; pass as @a start_tap_state in following call.
*/
static inline tap_state_t jtag_debug_state_machine(const void *tms_buf,
const void *tdi_buf, unsigned int tap_len, tap_state_t start_tap_state)
static inline enum tap_state jtag_debug_state_machine(const void *tms_buf,
const void *tdi_buf, unsigned int tap_len, enum tap_state start_tap_state)
{
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO))
return jtag_debug_state_machine_(tms_buf, tdi_buf, tap_len, start_tap_state);

View File

@@ -34,7 +34,7 @@
* Fix those drivers to map as appropriate ... then pick some
* sane set of numbers here (where 0/uninitialized == INVALID).
*/
typedef enum tap_state {
enum tap_state {
TAP_INVALID = -1,
/* Proper ARM recommended numbers */
@@ -54,7 +54,7 @@ typedef enum tap_state {
TAP_IRUPDATE = 0xd,
TAP_IRCAPTURE = 0xe,
TAP_RESET = 0x0f,
} tap_state_t;
};
/**
* Defines arguments for reset functions
@@ -68,13 +68,13 @@ typedef enum tap_state {
* Function tap_state_name
* Returns a string suitable for display representing the JTAG tap_state
*/
const char *tap_state_name(tap_state_t state);
const char *tap_state_name(enum tap_state state);
/** Provides user-friendly name lookup of TAP states. */
tap_state_t tap_state_by_name(const char *name);
enum tap_state tap_state_by_name(const char *name);
/** The current TAP state of the pending JTAG command queue. */
extern tap_state_t cmd_queue_cur_state;
extern enum tap_state cmd_queue_cur_state;
/**
* This structure defines a single scan field in the scan. It provides
@@ -295,20 +295,20 @@ int jtag_init_inner(struct command_context *cmd_ctx);
*
*/
void jtag_add_ir_scan(struct jtag_tap *tap,
struct scan_field *fields, tap_state_t endstate);
struct scan_field *fields, enum tap_state endstate);
/**
* The same as jtag_add_ir_scan except no verification is performed out
* the output values.
*/
void jtag_add_ir_scan_noverify(struct jtag_tap *tap,
const struct scan_field *fields, tap_state_t state);
const struct scan_field *fields, enum tap_state state);
/**
* Scan out the bits in ir scan mode.
*
* If in_bits == NULL, discard incoming bits.
*/
void jtag_add_plain_ir_scan(int num_bits, const uint8_t *out_bits, uint8_t *in_bits,
tap_state_t endstate);
enum tap_state endstate);
/**
* Generate a DR SCAN using the fields passed to the function.
@@ -317,17 +317,17 @@ void jtag_add_plain_ir_scan(int num_bits, const uint8_t *out_bits, uint8_t *in_b
* 1-bit field. The bypass status of TAPs is set by jtag_add_ir_scan().
*/
void jtag_add_dr_scan(struct jtag_tap *tap, int num_fields,
const struct scan_field *fields, tap_state_t endstate);
const struct scan_field *fields, enum tap_state endstate);
/** A version of jtag_add_dr_scan() that uses the check_value/mask fields */
void jtag_add_dr_scan_check(struct jtag_tap *tap, int num_fields,
struct scan_field *fields, tap_state_t endstate);
struct scan_field *fields, enum tap_state endstate);
/**
* Scan out the bits in ir scan mode.
*
* If in_bits == NULL, discard incoming bits.
*/
void jtag_add_plain_dr_scan(int num_bits,
const uint8_t *out_bits, uint8_t *in_bits, tap_state_t endstate);
const uint8_t *out_bits, uint8_t *in_bits, enum tap_state endstate);
/**
* Defines the type of data passed to the jtag_callback_t interface.
@@ -435,7 +435,7 @@ void jtag_add_tlr(void);
* - ERROR_JTAG_TRANSITION_INVALID -- The path includes invalid
* state transitions.
*/
void jtag_add_pathmove(unsigned int num_states, const tap_state_t *path);
void jtag_add_pathmove(unsigned int num_states, const enum tap_state *path);
/**
* jtag_add_statemove() moves from the current state to @a goal_state.
@@ -446,7 +446,7 @@ void jtag_add_pathmove(unsigned int num_states, const tap_state_t *path);
* Moves from the current state to the goal \a state.
* Both states must be stable.
*/
int jtag_add_statemove(tap_state_t goal_state);
int jtag_add_statemove(enum tap_state goal_state);
/**
* Goes to TAP_IDLE (if we're not already there), cycle
@@ -458,7 +458,7 @@ int jtag_add_statemove(tap_state_t goal_state);
* via TAP_IDLE.
* @param endstate The final state.
*/
void jtag_add_runtest(unsigned int num_cycles, tap_state_t endstate);
void jtag_add_runtest(unsigned int num_cycles, enum tap_state endstate);
/**
* A reset of the TAP state machine can be requested.

View File

@@ -38,21 +38,21 @@
int interface_jtag_add_ir_scan(struct jtag_tap *active,
const struct scan_field *fields,
tap_state_t endstate);
enum tap_state endstate);
int interface_jtag_add_plain_ir_scan(
int num_bits, const uint8_t *out_bits, uint8_t *in_bits,
tap_state_t endstate);
enum tap_state endstate);
int interface_jtag_add_dr_scan(struct jtag_tap *active,
int num_fields, const struct scan_field *fields,
tap_state_t endstate);
enum tap_state endstate);
int interface_jtag_add_plain_dr_scan(
int num_bits, const uint8_t *out_bits, uint8_t *in_bits,
tap_state_t endstate);
enum tap_state endstate);
int interface_jtag_add_tlr(void);
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_jtag_add_pathmove(unsigned int num_states, const enum tap_state *path);
int interface_jtag_add_runtest(unsigned int num_cycles, enum tap_state endstate);
int interface_add_tms_seq(unsigned int num_bits,
const uint8_t *bits, enum tap_state state);

View File

@@ -61,7 +61,7 @@ struct jtag_tap *jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *o)
return t;
}
static bool scan_is_safe(tap_state_t state)
static bool scan_is_safe(enum tap_state state)
{
switch (state) {
case TAP_RESET:
@@ -126,7 +126,7 @@ COMMAND_HANDLER(handle_jtag_command_drscan)
return ERROR_FAIL;
}
tap_state_t endstate = TAP_IDLE;
enum tap_state endstate = TAP_IDLE;
if (CMD_ARGC > 3 && !strcmp("-endstate", CMD_ARGV[CMD_ARGC - 2])) {
const char *state_name = CMD_ARGV[CMD_ARGC - 1];
endstate = tap_state_by_name(state_name);
@@ -176,7 +176,7 @@ fail:
COMMAND_HANDLER(handle_jtag_command_pathmove)
{
tap_state_t states[8];
enum tap_state states[8];
if (CMD_ARGC < 1 || CMD_ARGC > ARRAY_SIZE(states))
return ERROR_COMMAND_SYNTAX_ERROR;
@@ -919,7 +919,7 @@ COMMAND_HANDLER(handle_irscan_command)
int i;
struct scan_field *fields;
struct jtag_tap *tap = NULL;
tap_state_t endstate;
enum tap_state endstate;
if ((CMD_ARGC < 2) || (CMD_ARGC % 2))
return ERROR_COMMAND_SYNTAX_ERROR;