89 LOG_ERROR(
"FATAL: unstable state \"%s\" in tap_move_ndx()",
111 #define HEX__(n) 0x##n##LU
114 ((((x) & 0x0000000FLU) ? (1 << 0) : 0) \
115 +(((x) & 0x000000F0LU) ? (1 << 1) : 0) \
116 +(((x) & 0x00000F00LU) ? (1 << 2) : 0) \
117 +(((x) & 0x0000F000LU) ? (1 << 3) : 0) \
118 +(((x) & 0x000F0000LU) ? (1 << 4) : 0) \
119 +(((x) & 0x00F00000LU) ? (1 << 5) : 0) \
120 +(((x) & 0x0F000000LU) ? (1 << 6) : 0) \
121 +(((x) & 0xF0000000LU) ? (1 << 7) : 0))
123 #define B8(bits, count) {((uint8_t)B8__(HEX__(bits))), (count)}
134 {
B8(1111111, 7),
B8(0000000, 7),
B8(0010111, 7),
B8(0001010, 7),
B8(0011011, 7),
B8(0010110, 7)},
135 {
B8(1111111, 7),
B8(0000000, 7),
B8(0100101, 7),
B8(0000101, 7),
B8(0101011, 7),
B8(0001011, 7)},
136 {
B8(1111111, 7),
B8(0110001, 7),
B8(0000000, 7),
B8(0000001, 7),
B8(0001111, 7),
B8(0101111, 7)},
137 {
B8(1111111, 7),
B8(0110000, 7),
B8(0100000, 7),
B8(0010111, 7),
B8(0011110, 7),
B8(0101111, 7)},
138 {
B8(1111111, 7),
B8(0110001, 7),
B8(0000111, 7),
B8(0010111, 7),
B8(0000000, 7),
B8(0000001, 7)},
139 {
B8(1111111, 7),
B8(0110000, 7),
B8(0011100, 7),
B8(0010111, 7),
B8(0011110, 7),
B8(0101111, 7)},
178 {
B8(1111111, 7),
B8(0000000, 7),
B8(0010111, 7),
B8(0001010, 7),
B8(0011011, 7),
B8(0010110, 7)},
179 {
B8(1111111, 7),
B8(0000000, 7),
B8(001, 3),
B8(0101, 4),
B8(0011, 4),
B8(01011, 5)},
180 {
B8(1111111, 7),
B8(011, 3),
B8(00111, 5),
B8(01, 2),
B8(001111, 6),
B8(0101111, 7)},
181 {
B8(1111111, 7),
B8(011, 3),
B8(01, 2),
B8(0, 1),
B8(001111, 6),
B8(0101111, 7)},
182 {
B8(1111111, 7),
B8(011, 3),
B8(00111, 5),
B8(010111, 6),
B8(001111, 6),
B8(01, 2)},
183 {
B8(1111111, 7),
B8(011, 3),
B8(00111, 5),
B8(010111, 6),
B8(01, 2),
B8(0, 1)}
234 new_state = cur_state;
270 LOG_ERROR(
"fatal: invalid argument cur_state=%d", cur_state);
307 LOG_ERROR(
"fatal: invalid argument cur_state=%d", cur_state);
368 #define JTAG_DEBUG_STATE_APPEND(buf, len, bit) \
369 do { buf[len] = bit ? '1' : '0'; } while (0)
370 #define JTAG_DEBUG_STATE_PRINT(a, b, astr, bstr) \
371 LOG_DEBUG_IO("TAP/SM: %9s -> %5s\tTMS: %s\tTDI: %s", \
372 tap_state_name(a), tap_state_name(b), astr, bstr)
383 unsigned tap_out_bits;
390 last_state = next_state;
397 LOG_DEBUG_IO(
"TAP/SM: TMS bits: %u (bytes: %u)", tap_bits, tap_bytes);
400 for (cur_byte = 0; cur_byte < tap_bytes; cur_byte++) {
401 for (cur_bit = 0; cur_bit < 8; cur_bit++) {
403 unsigned tap_bit = cur_byte * 8 + cur_bit;
404 if (tap_bit == tap_bits)
408 tap_bit = !!(
tms_buffer[cur_byte] & (1 << cur_bit));
415 tap_bit = !!(
tdi_buffer[cur_byte] & (1 << cur_bit));
423 if ((next_state == last_state) && (tap_out_bits < 32))
427 tms_str[tap_out_bits] = tdi_str[tap_out_bits] = 0;
431 last_state = next_state;
438 tms_str[tap_out_bits] = tdi_str[tap_out_bits] = 0;
static uint8_t tms_buffer[ARMJTAGEW_TAP_BUFFER_SIZE]
static uint8_t tdi_buffer[ARMJTAGEW_TAP_BUFFER_SIZE]
static const struct name_mapping tap_name_mapping[]
static const struct tms_sequences old_tms_seqs[6][6]
static tap_state_t end_state_follower
static tap_state_t state_follower
bool tap_is_state_stable(tap_state_t astate)
Function tap_is_state_stable returns true if the astate is stable.
tap_state_t tap_state_transition(tap_state_t cur_state, bool tms)
Function tap_state_transition takes a current TAP state and returns the next state according to the t...
const char * tap_state_name(tap_state_t state)
Function tap_state_name Returns a string suitable for display representing the JTAG tap_state.
void tap_set_end_state(tap_state_t new_end_state)
This function sets the state of an "end state follower" which tracks the state that any cable driver ...
#define JTAG_DEBUG_STATE_PRINT(a, b, astr, bstr)
void tap_use_new_tms_table(bool use_new)
Allow switching between old and new TMS tables.
tap_state_t tap_get_end_state(void)
For more information,.
bool tap_uses_new_tms_table(void)
int tap_get_tms_path(tap_state_t from, tap_state_t to)
This function provides a "bit sequence" indicating what has to be done with TMS during a sequence of ...
#define JTAG_DEBUG_STATE_APPEND(buf, len, bit)
int tap_get_tms_path_len(tap_state_t from, tap_state_t to)
Function int tap_get_tms_path_len returns the total number of bits that represents a TMS path transit...
int tap_move_ndx(tap_state_t astate)
Function tap_move_ndx when given a stable state, returns an index from 0-5.
const struct tms_sequences tms_table[6][6]
static const struct tms_sequences short_tms_seqs[6][6]
tap_state_t jtag_debug_state_machine_(const void *tms_buf, const void *tdi_buf, unsigned tap_bits, tap_state_t next_state)
void tap_set_state_impl(tap_state_t new_state)
implementation of wrapper function tap_set_state()
tap_state_t tap_state_by_name(const char *name)
Provides user-friendly name lookup of TAP states.
tap_state_t tap_get_state(void)
This function gets the state of the "state follower" which tracks the state of the TAPs connected to ...
static tms_table * tms_seqs
The JTAG interface can be implemented with a software or hardware fifo.
tap_state
Defines JTAG Test Access Port states.
enum tap_state tap_state_t
Defines JTAG Test Access Port states.
#define LOG_DEBUG_IO(expr ...)
#define LOG_ERROR(expr ...)
#define ARRAY_SIZE(x)
Compute the number of elements of a variable length array.
#define DIV_ROUND_UP(m, n)
Rounds m up to the nearest multiple of n using division.