-tap_state_t tap_state_transition(tap_state_t current_state, bool tms);
-
-/**
- * Function tap_state_name
- * Returns a string suitable for display representing the JTAG tap_state
- */
-const char* tap_state_name(tap_state_t state);
-
-#ifdef _DEBUG_JTAG_IO_
-/**
- * @brief Prints verbose TAP state transitions for the given TMS/TDI buffers.
- * @param tms_buf must points to a buffer containing the TMS bitstream.
- * @param tdi_buf must points to a buffer containing the TDI bitstream.
- * @param tap_len must specify the length of the TMS/TDI bitstreams.
- * @param start_tap_state must specify the current TAP state.
- * @returns the final TAP state; pass as @a start_tap_state in following call.
- */
-tap_state_t jtag_debug_state_machine(const void *tms_buf, const void *tdi_buf,
- unsigned tap_len, tap_state_t start_tap_state);
-#else
-static inline tap_state_t jtag_debug_state_machine(const void *tms_buf,
- const void *tdi_buf, unsigned tap_len, tap_state_t start_tap_state)
-{
- return start_tap_state;
-}
-#endif // _DEBUG_JTAG_IO_
-
-/*-----</Cable Helper API>------------------------------------------*/
-
-#endif // INCLUDE_JTAG_INTERFACE_H
-
-
-extern tap_state_t cmd_queue_end_state; /* finish DR scans in dr_end_state */
-extern tap_state_t cmd_queue_cur_state; /* current TAP state */
-
-typedef struct scan_field_s
-{
- jtag_tap_t* tap; /* tap pointer this instruction refers to */
- int num_bits; /* number of bits this field specifies (up to 32) */
- u8* out_value; /* value to be scanned into the device */
- u8* in_value; /* pointer to a 32-bit memory location to take data scanned out */
-
- u8* check_value; /* Used together with jtag_add_dr_scan_check() to check data clocked
- in */
- u8* check_mask; /* mask to go with check_value */
-
- /* internal work space */
- int allocated; /* in_value has been allocated for the queue */
- int modified; /* did we modify the in_value? */
- u8 intmp[4]; /* temporary storage for checking synchronously */
-} scan_field_t;
-
-#ifdef INCLUDE_JTAG_INTERFACE_H
-
-enum scan_type {
- /* IN: from device to host, OUT: from host to device */
- SCAN_IN = 1, SCAN_OUT = 2, SCAN_IO = 3
-};
-
-typedef struct scan_command_s
-{
- bool ir_scan; /* instruction/not data scan */
- int num_fields; /* number of fields in *fields array */
- scan_field_t* fields; /* pointer to an array of data scan fields */
- tap_state_t end_state; /* TAP state in which JTAG commands should finish */
-} scan_command_t;
-
-typedef struct statemove_command_s
-{
- tap_state_t end_state; /* TAP state in which JTAG commands should finish */
-} statemove_command_t;
-
-typedef struct pathmove_command_s
-{
- int num_states; /* number of states in *path */
- tap_state_t* path; /* states that have to be passed */
-} pathmove_command_t;
-
-typedef struct runtest_command_s
-{
- int num_cycles; /* number of cycles that should be spent in Run-Test/Idle */
- tap_state_t end_state; /* TAP state in which JTAG commands should finish */
-} runtest_command_t;
-
-
-typedef struct stableclocks_command_s
-{
- int num_cycles; /* number of clock cycles that should be sent */
-} stableclocks_command_t;
-
-
-typedef struct reset_command_s
-{
- int trst; /* trst/srst 0: deassert, 1: assert, -1: don't change */
- int srst;
-} reset_command_t;
-
-typedef struct end_state_command_s
-{
- tap_state_t end_state; /* TAP state in which JTAG commands should finish */
-} end_state_command_t;
-
-typedef struct sleep_command_s
-{
- u32 us; /* number of microseconds to sleep */
-} sleep_command_t;
-
-typedef union jtag_command_container_u
-{
- scan_command_t* scan;
- statemove_command_t* statemove;
- pathmove_command_t* pathmove;
- runtest_command_t* runtest;
- stableclocks_command_t* stableclocks;
- reset_command_t* reset;
- end_state_command_t* end_state;
- sleep_command_t* sleep;
-} jtag_command_container_t;
-
-enum jtag_command_type {
- JTAG_SCAN = 1,
- JTAG_STATEMOVE = 2,
- JTAG_RUNTEST = 3,
- JTAG_RESET = 4,
- JTAG_PATHMOVE = 6,
- JTAG_SLEEP = 7,
- JTAG_STABLECLOCKS = 8