11 #ifndef OPENOCD_JTAG_JTAG_H
12 #define OPENOCD_JTAG_JTAG_H
19 #ifndef DEBUG_JTAG_IOZ
20 #define DEBUG_JTAG_IOZ 64
62 #define SRST_DEASSERT 0
64 #define TRST_DEASSERT 0
330 const uint8_t *out_bits, uint8_t *in_bits,
tap_state_t endstate);
552 #define ERROR_JTAG_INIT_FAILED (-100)
553 #define ERROR_JTAG_INVALID_INTERFACE (-101)
554 #define ERROR_JTAG_NOT_IMPLEMENTED (-102)
555 #define ERROR_JTAG_TRST_ASSERTED (-103)
556 #define ERROR_JTAG_QUEUE_FAILED (-104)
557 #define ERROR_JTAG_NOT_STABLE_STATE (-105)
558 #define ERROR_JTAG_DEVICE_ERROR (-107)
559 #define ERROR_JTAG_STATE_INVALID (-108)
560 #define ERROR_JTAG_TRANSITION_INVALID (-109)
561 #define ERROR_JTAG_INIT_SOFT_FAIL (-110)
Support functions to access arbitrary bits in a byte array.
static struct esp_usb_jtag * priv
void jtag_set_error(int error)
Set the current JTAG core execution error, unless one was set by a previous call previously.
int jtag_register_commands(struct command_context *cmd_ctx)
void jtag_poll_unmask(bool saved)
Restore saved mask for polling.
void jtag_add_ir_scan_noverify(struct jtag_tap *tap, const struct scan_field *fields, tap_state_t state)
The same as jtag_add_ir_scan except no verification is performed out the output values.
int jtag_init_inner(struct command_context *cmd_ctx)
void jtag_execute_queue_noclear(void)
same as jtag_execute_queue() but does not clear the error flag
int(* jtag_event_handler_t)(enum jtag_event event, void *priv)
Defines the function signature required for JTAG event callback functions, which are added with jtag_...
void jtag_add_pathmove(unsigned int num_states, const tap_state_t *path)
Application code must assume that interfaces will implement transitions between states with different...
int(* jtag_callback_t)(jtag_callback_data_t data0, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3)
Defines the interface of the JTAG callback mechanism.
tap_state
Defines JTAG Test Access Port states.
int jtag_unregister_event_callback(jtag_event_handler_t f, void *x)
unsigned int jtag_get_ntrst_assert_width(void)
const char * tap_state_name(tap_state_t state)
Function tap_state_name Returns a string suitable for display representing the JTAG tap_state.
unsigned int jtag_tap_count_enabled(void)
int jtag_init(struct command_context *cmd_ctx)
Initialize JTAG chain using only a RESET reset.
void jtag_poll_set_enabled(bool value)
Assign flag reporting whether JTAG polling is disallowed.
int jtag_srst_asserted(int *srst_asserted)
unsigned int jtag_get_nsrst_delay(void)
struct jtag_tap * jtag_tap_by_string(const char *dotted_name)
void jtag_add_plain_dr_scan(int num_bits, const uint8_t *out_bits, uint8_t *in_bits, tap_state_t endstate)
Scan out the bits in ir scan mode.
int jtag_execute_queue(void)
For software FIFO implementations, the queued commands can be executed during this call or earlier.
int jtag_add_tms_seq(unsigned int nbits, const uint8_t *seq, enum tap_state t)
If supported by the underlying adapter, this clocks a raw bit sequence onto TMS for switching between...
void jtag_add_clocks(unsigned int num_cycles)
Function jtag_add_clocks first checks that the state in which the clocks are to be issued is stable,...
void jtag_add_dr_scan(struct jtag_tap *tap, int num_fields, const struct scan_field *fields, tap_state_t endstate)
Generate a DR SCAN using the fields passed to the function.
void jtag_set_flush_queue_sleep(int ms)
Set ms to sleep after jtag_execute_queue() flushes queue.
bool is_jtag_poll_safe(void)
Return true if it's safe for a background polling task to access the JTAG scan chain.
const char * jtag_tap_name(const struct jtag_tap *tap)
struct jtag_tap * jtag_all_taps(void)
int jtag_power_dropout(int *dropout)
tap_state_t cmd_queue_cur_state
The current TAP state of the pending JTAG command queue.
int jtag_add_statemove(tap_state_t goal_state)
jtag_add_statemove() moves from the current state to goal_state.
unsigned int jtag_get_nsrst_assert_width(void)
void jtag_add_callback(jtag_callback1_t f, jtag_callback_data_t data0)
A simpler version of jtag_add_callback4().
struct jtag_tap * jtag_tap_by_position(unsigned int abs_position)
void jtag_set_nsrst_assert_width(unsigned int delay)
int jtag_init_reset(struct command_context *cmd_ctx)
reset, then initialize JTAG chain
void jtag_add_reset(int req_tlr_or_trst, int srst)
A reset of the TAP state machine can be requested.
struct jtag_tap * jtag_tap_next_enabled(struct jtag_tap *p)
void jtag_add_tlr(void)
Run a TAP_RESET reset where the end state is TAP_RESET, regardless of the start state.
bool jtag_poll_get_enabled(void)
Return flag reporting whether JTAG polling is disallowed.
bool jtag_will_verify(void)
int jtag_call_event_callbacks(enum jtag_event event)
void jtag_set_ntrst_delay(unsigned int delay)
void jtag_set_verify_capture_ir(bool enable)
Enable or disable verification of IR scan checking.
unsigned int jtag_get_ntrst_delay(void)
enum tap_state tap_state_t
Defines JTAG Test Access Port states.
void jtag_add_sleep(uint32_t us)
bool jtag_will_verify_capture_ir(void)
void jtag_tap_free(struct jtag_tap *tap)
unsigned int jtag_get_flush_queue_count(void)
int jtag_register_event_callback(jtag_event_handler_t f, void *x)
__COMMAND_HANDLER(handle_jtag_newtap)
tap_state_t tap_state_by_name(const char *name)
Provides user-friendly name lookup of TAP states.
void jtag_add_ir_scan(struct jtag_tap *tap, struct scan_field *fields, tap_state_t endstate)
Generate an IR SCAN with a list of scan fields with one entry for each enabled TAP.
struct jtag_tap * jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *obj)
void jtag_check_value_mask(struct scan_field *field, uint8_t *value, uint8_t *mask)
Execute jtag queue and check value with an optional mask.
void jtag_set_nsrst_delay(unsigned int delay)
void jtag_sleep(uint32_t us)
void jtag_add_dr_scan_check(struct jtag_tap *tap, int num_fields, struct scan_field *fields, tap_state_t endstate)
A version of jtag_add_dr_scan() that uses the check_value/mask fields.
void jtag_add_runtest(unsigned int num_cycles, tap_state_t endstate)
Goes to TAP_IDLE (if we're not already there), cycle precisely num_cycles in the TAP_IDLE state,...
void jtag_tap_init(struct jtag_tap *tap)
void jtag_set_reset_config(enum reset_types type)
enum reset_types jtag_get_reset_config(void)
void jtag_add_plain_ir_scan(int num_bits, const uint8_t *out_bits, uint8_t *in_bits, tap_state_t endstate)
Scan out the bits in ir scan mode.
void jtag_notify_event(enum jtag_event)
Report Tcl event to all TAPs.
void jtag_set_ntrst_assert_width(unsigned int delay)
intptr_t jtag_callback_data_t
Defines the type of data passed to the jtag_callback_t interface.
bool jtag_poll_mask(void)
Mask (disable) polling and return the current mask status that should be feed to jtag_poll_unmask() t...
void(* jtag_callback1_t)(jtag_callback_data_t data0)
Defines a simple JTAG callback that can allow conversions on data scanned in from an interface.
void jtag_set_verify(bool enable)
Enable or disable data scan verification checking.
struct jtag_tap_event_action * next
enum jtag_event event
The event for which this action will be triggered.
Jim_Obj * body
Contains a script to 'eval' when the event is triggered.
Jim_Interp * interp
The interpreter to use for evaluating the body.
uint32_t ir_capture_value
bool bypass
Bypass register selected.
uint8_t * expected_mask
Capture-IR expected mask.
bool ignore_version
Flag saying whether to ignore version field in expected_ids[].
bool disabled_after_reset
Is this TAP disabled after JTAG reset?
struct jtag_tap_event_action * event_action
uint8_t * cur_instr
current instruction
unsigned int ir_length
size of instruction register
uint8_t * expected
Capture-IR expected value.
uint8_t expected_ids_cnt
Number of expected identification codes.
bool has_idcode
not all devices have idcode, we'll discover this during chain examination
unsigned int abs_chain_position
bool ignore_bypass
Flag saying whether to ignore the bypass bit in the code.
bool enabled
Is this TAP currently enabled?
uint64_t ir_bypass_value
Bypass instruction value.
uint32_t * expected_ids
Array of expected identification codes.
struct jtag_tap * next_tap
uint32_t idcode
device identification code
This structure defines a single scan field in the scan.
uint8_t * in_value
A pointer to a 32-bit memory location for data scanned out.
uint8_t * check_value
The value used to check the data scanned out.
const uint8_t * out_value
A pointer to value to be scanned into the device.
unsigned int num_bits
The number of bits this field specifies.
uint8_t * check_mask
The mask to go with check_value.