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

@ -68,7 +68,7 @@ static int str9xpec_erase_area(struct flash_bank *bank, unsigned int first,
static int str9xpec_set_address(struct flash_bank *bank, uint8_t sector);
static int str9xpec_write_options(struct flash_bank *bank);
static int str9xpec_set_instr(struct jtag_tap *tap, uint32_t new_instr, tap_state_t end_state)
static int str9xpec_set_instr(struct jtag_tap *tap, uint32_t new_instr, enum tap_state end_state)
{
if (!tap)
return ERROR_TARGET_INVALID;

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;

View File

@ -59,7 +59,7 @@ static const struct lattice_devices_elem lattice_devices[] = {
{0x010f4043, 362, LATTICE_CERTUS /* LFCPNX-100 */},
};
int lattice_set_instr(struct jtag_tap *tap, uint8_t new_instr, tap_state_t endstate)
int lattice_set_instr(struct jtag_tap *tap, uint8_t new_instr, enum tap_state endstate)
{
struct scan_field field;
field.num_bits = tap->ir_length;

View File

@ -20,7 +20,7 @@ struct lattice_pld_device {
enum lattice_family_e family;
};
int lattice_set_instr(struct jtag_tap *tap, uint8_t new_instr, tap_state_t endstate);
int lattice_set_instr(struct jtag_tap *tap, uint8_t new_instr, enum tap_state endstate);
int lattice_read_u32_register(struct jtag_tap *tap, uint8_t cmd, uint32_t *in_val,
uint32_t out_val, bool do_idle);
int lattice_read_u64_register(struct jtag_tap *tap, uint8_t cmd, uint64_t *in_val,

View File

@ -75,10 +75,10 @@ static const char *svf_trst_mode_name[4] = {
};
struct svf_statemove {
tap_state_t from;
tap_state_t to;
enum tap_state from;
enum tap_state to;
uint32_t num_of_moves;
tap_state_t paths[8];
enum tap_state paths[8];
};
/*
@ -155,10 +155,10 @@ struct svf_xxr_para {
struct svf_para {
float frequency;
tap_state_t ir_end_state;
tap_state_t dr_end_state;
tap_state_t runtest_run_state;
tap_state_t runtest_end_state;
enum tap_state ir_end_state;
enum tap_state dr_end_state;
enum tap_state runtest_run_state;
enum tap_state runtest_end_state;
enum trst_mode trst_mode;
struct svf_xxr_para hir_para;
@ -313,9 +313,9 @@ static void svf_free_xxd_para(struct svf_xxr_para *para)
}
}
int svf_add_statemove(tap_state_t state_to)
int svf_add_statemove(enum tap_state state_to)
{
tap_state_t state_from = cmd_queue_cur_state;
enum tap_state state_from = cmd_queue_cur_state;
unsigned int index_var;
/* when resetting, be paranoid and ignore current state */
@ -816,7 +816,7 @@ parse_char:
return ERROR_OK;
}
bool svf_tap_state_is_stable(tap_state_t state)
bool svf_tap_state_is_stable(enum tap_state state)
{
return (state == TAP_RESET) || (state == TAP_IDLE)
|| (state == TAP_DRPAUSE) || (state == TAP_IRPAUSE);
@ -995,7 +995,7 @@ static int svf_run_command(struct command_context *cmd_ctx, char *cmd_str)
uint8_t **pbuffer_tmp;
struct scan_field field;
/* for STATE */
tap_state_t *path = NULL, state;
enum tap_state *path = NULL, state;
/* flag padding commands skipped due to -tap command */
int padding_command_skipped = 0;
@ -1498,7 +1498,7 @@ xxr_common:
}
if (num_of_argu > 2) {
/* STATE pathstate1 ... stable_state */
path = malloc((num_of_argu - 1) * sizeof(tap_state_t));
path = malloc((num_of_argu - 1) * sizeof(enum tap_state));
if (!path) {
LOG_ERROR("not enough memory");
return ERROR_FAIL;

View File

@ -23,7 +23,7 @@ int svf_register_commands(struct command_context *cmd_ctx);
* SVF specification for single-argument STATE commands (and also used
* for various other state transitions).
*/
int svf_add_statemove(tap_state_t goal_state);
int svf_add_statemove(enum tap_state goal_state);
/**
* svf_tap_state_is_stable() returns true for stable non-SHIFT states
@ -31,6 +31,6 @@ int svf_add_statemove(tap_state_t goal_state);
* @param state The TAP state in question
* @return true iff the state is stable and not a SHIFT state.
*/
bool svf_tap_state_is_stable(tap_state_t state);
bool svf_tap_state_is_stable(enum tap_state state);
#endif /* OPENOCD_SVF_SVF_H */

View File

@ -66,7 +66,7 @@ static void arc_jtag_enque_write_ir(struct arc_jtag *jtag_info, uint32_t
* @param end_state End state after reading.
*/
static void arc_jtag_enque_read_dr(struct arc_jtag *jtag_info, uint8_t *data,
tap_state_t end_state)
enum tap_state end_state)
{
assert(jtag_info);
@ -88,7 +88,7 @@ static void arc_jtag_enque_read_dr(struct arc_jtag *jtag_info, uint8_t *data,
* @param end_state End state after writing.
*/
static void arc_jtag_enque_write_dr(struct arc_jtag *jtag_info, uint32_t data,
tap_state_t end_state)
enum tap_state end_state)
{
uint8_t out_value[sizeof(uint32_t)] = {0};
@ -116,7 +116,7 @@ static void arc_jtag_enque_write_dr(struct arc_jtag *jtag_info, uint32_t data,
* @param end_state End state after writing.
*/
static void arc_jtag_enque_set_transaction(struct arc_jtag *jtag_info,
uint32_t new_trans, tap_state_t end_state)
uint32_t new_trans, enum tap_state end_state)
{
uint8_t out_value[sizeof(uint32_t)] = {0};

View File

@ -31,13 +31,13 @@ behavior of the FTDI driver IIRC was to go via RTI.
Conversely there may be other places in this code where the ARM11 code relies
on the driver to hit through RTI when coming from Update-?R.
*/
static const tap_state_t arm11_move_pi_to_si_via_ci[] = {
static const enum tap_state arm11_move_pi_to_si_via_ci[] = {
TAP_IREXIT2, TAP_IRUPDATE, TAP_DRSELECT, TAP_IRSELECT, TAP_IRCAPTURE, TAP_IRSHIFT
};
/* REVISIT no error handling here! */
static void arm11_add_ir_scan_vc(struct jtag_tap *tap, struct scan_field *fields,
tap_state_t state)
enum tap_state state)
{
if (cmd_queue_cur_state == TAP_IRPAUSE)
jtag_add_pathmove(ARRAY_SIZE(arm11_move_pi_to_si_via_ci),
@ -46,13 +46,13 @@ static void arm11_add_ir_scan_vc(struct jtag_tap *tap, struct scan_field *fields
jtag_add_ir_scan(tap, fields, state);
}
static const tap_state_t arm11_move_pd_to_sd_via_cd[] = {
static const enum tap_state arm11_move_pd_to_sd_via_cd[] = {
TAP_DREXIT2, TAP_DRUPDATE, TAP_DRSELECT, TAP_DRCAPTURE, TAP_DRSHIFT
};
/* REVISIT no error handling here! */
void arm11_add_dr_scan_vc(struct jtag_tap *tap, int num_fields, struct scan_field *fields,
tap_state_t state)
enum tap_state state)
{
if (cmd_queue_cur_state == TAP_DRPAUSE)
jtag_add_pathmove(ARRAY_SIZE(arm11_move_pd_to_sd_via_cd),
@ -121,7 +121,7 @@ static const char *arm11_ir_to_string(uint8_t ir)
*
* \remarks This adds to the JTAG command queue but does \em not execute it.
*/
void arm11_add_ir(struct arm11_common *arm11, uint8_t instr, tap_state_t state)
void arm11_add_ir(struct arm11_common *arm11, uint8_t instr, enum tap_state state)
{
struct jtag_tap *tap = arm11->arm.target->tap;
@ -181,7 +181,7 @@ static void arm11_in_handler_scan_n(uint8_t *in_value)
*/
int arm11_add_debug_scan_n(struct arm11_common *arm11,
uint8_t chain, tap_state_t state)
uint8_t chain, enum tap_state state)
{
/* Don't needlessly switch the scan chain.
* NOTE: the ITRSEL instruction fakes SCREG changing;
@ -240,7 +240,7 @@ int arm11_add_debug_scan_n(struct arm11_common *arm11,
* to ensure that the rDTR is ready before that Run-Test/Idle state.
*/
static void arm11_add_debug_inst(struct arm11_common *arm11,
uint32_t inst, uint8_t *flag, tap_state_t state)
uint32_t inst, uint8_t *flag, enum tap_state state)
{
JTAG_DEBUG("INST <= 0x%08" PRIx32, inst);
@ -542,7 +542,7 @@ int arm11_run_instr_data_to_core(struct arm11_common *arm11,
* https://lists.berlios.de/pipermail/openocd-development/2009-July/009698.html
* https://lists.berlios.de/pipermail/openocd-development/2009-August/009865.html
*/
static const tap_state_t arm11_move_drpause_idle_drpause_with_delay[] = {
static const enum tap_state arm11_move_drpause_idle_drpause_with_delay[] = {
TAP_DREXIT2, TAP_DRUPDATE, TAP_IDLE, TAP_IDLE, TAP_IDLE, TAP_DRSELECT, TAP_DRCAPTURE,
TAP_DRSHIFT
};

View File

@ -17,9 +17,9 @@
void arm11_setup_field(struct arm11_common *arm11, int num_bits,
void *in_data, void *out_data, struct scan_field *field);
void arm11_add_ir(struct arm11_common *arm11,
uint8_t instr, tap_state_t state);
uint8_t instr, enum tap_state state);
int arm11_add_debug_scan_n(struct arm11_common *arm11,
uint8_t chain, tap_state_t state);
uint8_t chain, enum tap_state state);
int arm11_read_dscr(struct arm11_common *arm11);
int arm11_write_dscr(struct arm11_common *arm11, uint32_t dscr);
@ -40,7 +40,7 @@ int arm11_run_instr_data_to_core_via_r0(struct arm11_common *arm11,
uint32_t opcode, uint32_t data);
void arm11_add_dr_scan_vc(struct jtag_tap *tap, int num_fields, struct scan_field *fields,
tap_state_t state);
enum tap_state state);
/**
* Used with arm11_sc7_run to make a list of read/write commands for

View File

@ -19,7 +19,7 @@
#endif
int arm_jtag_set_instr_inner(struct jtag_tap *tap,
uint32_t new_instr, void *no_verify_capture, tap_state_t end_state)
uint32_t new_instr, void *no_verify_capture, enum tap_state end_state)
{
struct scan_field field;
uint8_t t[4] = { 0 };
@ -41,7 +41,7 @@ int arm_jtag_set_instr_inner(struct jtag_tap *tap,
return ERROR_OK;
}
int arm_jtag_scann_inner(struct arm_jtag *jtag_info, uint32_t new_scan_chain, tap_state_t end_state)
int arm_jtag_scann_inner(struct arm_jtag *jtag_info, uint32_t new_scan_chain, enum tap_state end_state)
{
int retval = ERROR_OK;

View File

@ -26,10 +26,10 @@ struct arm_jtag {
int arm_jtag_set_instr_inner(struct jtag_tap *tap, uint32_t new_instr,
void *no_verify_capture,
tap_state_t end_state);
enum tap_state end_state);
static inline int arm_jtag_set_instr(struct jtag_tap *tap,
uint32_t new_instr, void *no_verify_capture, tap_state_t end_state)
uint32_t new_instr, void *no_verify_capture, enum tap_state end_state)
{
/* inline most common code path */
if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != (new_instr & (BIT(tap->ir_length) - 1)))
@ -39,8 +39,8 @@ static inline int arm_jtag_set_instr(struct jtag_tap *tap,
}
int arm_jtag_scann_inner(struct arm_jtag *jtag_info, uint32_t new_scan_chain, tap_state_t end_state);
static inline int arm_jtag_scann(struct arm_jtag *jtag_info, uint32_t new_scan_chain, tap_state_t end_state)
int arm_jtag_scann_inner(struct arm_jtag *jtag_info, uint32_t new_scan_chain, enum tap_state end_state);
static inline int arm_jtag_scann(struct arm_jtag *jtag_info, uint32_t new_scan_chain, enum tap_state end_state)
{
/* inline most common code path */
int retval = ERROR_OK;

View File

@ -44,7 +44,7 @@ static int reset_jtag(void)
{
int retval;
tap_state_t states[2];
enum tap_state states[2];
const char *cp = "RESET";

View File

@ -137,7 +137,7 @@ static int xscale_verify_pointer(struct command_invocation *cmd,
return ERROR_OK;
}
static int xscale_jtag_set_instr(struct jtag_tap *tap, uint32_t new_instr, tap_state_t end_state)
static int xscale_jtag_set_instr(struct jtag_tap *tap, uint32_t new_instr, enum tap_state end_state)
{
assert(tap);
@ -232,7 +232,7 @@ static int xscale_receive(struct target *target, uint32_t *buffer, int num_words
struct xscale_common *xscale = target_to_xscale(target);
int retval = ERROR_OK;
tap_state_t path[3];
enum tap_state path[3];
struct scan_field fields[3];
uint8_t *field0 = malloc(num_words * 1);
uint8_t field0_check_value = 0x2;
@ -330,8 +330,8 @@ static int xscale_receive(struct target *target, uint32_t *buffer, int num_words
static int xscale_read_tx(struct target *target, int consume)
{
struct xscale_common *xscale = target_to_xscale(target);
tap_state_t path[3];
tap_state_t noconsume_path[6];
enum tap_state path[3];
enum tap_state noconsume_path[6];
int retval;
struct timeval timeout, now;
struct scan_field fields[3];

View File

@ -60,7 +60,7 @@ static void xtensa_dm_add_dr_scan(struct xtensa_debug_module *dm,
int len,
const uint8_t *src,
uint8_t *dest,
tap_state_t endstate)
enum tap_state endstate)
{
struct scan_field field;

View File

@ -111,10 +111,10 @@ TDO (1);
static int xsvf_fd;
/* map xsvf tap state to an openocd "tap_state_t" */
static tap_state_t xsvf_to_tap(int xsvf_state)
/* map xsvf tap state to an openocd "enum tap_state" */
static enum tap_state xsvf_to_tap(int xsvf_state)
{
tap_state_t ret;
enum tap_state ret;
switch (xsvf_state) {
case XSV_RESET:
@ -196,16 +196,16 @@ COMMAND_HANDLER(handle_xsvf_command)
int xruntest = 0; /* number of TCK cycles OR *microseconds */
int xrepeat = 0; /* number of retries */
tap_state_t xendir = TAP_IDLE; /* see page 8 of the SVF spec, initial
enum tap_state xendir = TAP_IDLE; /* see page 8 of the SVF spec, initial
*xendir to be TAP_IDLE */
tap_state_t xenddr = TAP_IDLE;
enum tap_state xenddr = TAP_IDLE;
uint8_t opcode;
uint8_t uc = 0;
long file_offset = 0;
int loop_count = 0;
tap_state_t loop_state = TAP_IDLE;
enum tap_state loop_state = TAP_IDLE;
int loop_clocks = 0;
int loop_usecs = 0;
@ -216,7 +216,7 @@ COMMAND_HANDLER(handle_xsvf_command)
int verbose = 1;
bool collecting_path = false;
tap_state_t path[XSTATE_MAX_PATH];
enum tap_state path[XSTATE_MAX_PATH];
unsigned int pathlen = 0;
/* a flag telling whether to clock TCK during waits,
@ -272,7 +272,7 @@ COMMAND_HANDLER(handle_xsvf_command)
* or terminate a path.
*/
if (collecting_path) {
tap_state_t mystate;
enum tap_state mystate;
switch (opcode) {
case XCOMMENT:
@ -455,7 +455,7 @@ COMMAND_HANDLER(handle_xsvf_command)
* will be skipped entirely if xrepeat is set to zero.
*/
static tap_state_t exception_path[] = {
static enum tap_state exception_path[] = {
TAP_DREXIT2,
TAP_DRSHIFT,
TAP_DREXIT1,
@ -563,7 +563,7 @@ COMMAND_HANDLER(handle_xsvf_command)
case XSTATE:
{
tap_state_t mystate;
enum tap_state mystate;
if (read(xsvf_fd, &uc, 1) < 0) {
do_abort = 1;
@ -654,7 +654,7 @@ COMMAND_HANDLER(handle_xsvf_command)
uint8_t short_buf[2];
uint8_t *ir_buf;
int bitcount;
tap_state_t my_end_state = xruntest ? TAP_IDLE : xendir;
enum tap_state my_end_state = xruntest ? TAP_IDLE : xendir;
if (opcode == XSIR) {
/* one byte bitcount */
@ -744,8 +744,8 @@ COMMAND_HANDLER(handle_xsvf_command)
uint8_t end;
uint8_t delay_buf[4];
tap_state_t wait_state;
tap_state_t end_state;
enum tap_state wait_state;
enum tap_state end_state;
int delay;
if (read(xsvf_fd, &wait_local, 1) < 0
@ -788,8 +788,8 @@ COMMAND_HANDLER(handle_xsvf_command)
uint8_t usecs_buf[4];
uint8_t wait_local;
uint8_t end;
tap_state_t wait_state;
tap_state_t end_state;
enum tap_state wait_state;
enum tap_state end_state;
int clock_count;
int usecs;