X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fjtag%2Fjtag.h;h=786b2b839fc0873fbddef4d6c536c08b1715f436;hp=b7bfd4cc9d4b3211061c0e0eba96eccf877bf147;hb=39b57471bfd92ef0d9a3aceb69f40c1335f5b62f;hpb=4f7761828c91108d4bf4a12e78f23b6483b18ade diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h index b7bfd4cc9d..786b2b839f 100644 --- a/src/jtag/jtag.h +++ b/src/jtag/jtag.h @@ -192,23 +192,32 @@ extern unsigned jtag_tap_count(void); /* - * There are three cases when JTAG_TRST_ASSERTED callback is invoked. The - * event is invoked *after* TRST is asserted(or queued rather). It is illegal - * to communicate with the JTAG interface during the callback(as there is - * currently a queue being built). + * - TRST_ASSERTED triggers two sets of callbacks, after operations to + * reset the scan chain -- via TMS+TCK signaling, or deasserting the + * nTRST signal -- are queued: * - * - TMS reset - * - SRST pulls TRST - * - TRST asserted + * + Callbacks in C code fire first, patching internal state + * + Then post-reset event scripts fire ... activating JTAG circuits + * via TCK cycles, exiting SWD mode via TMS sequences, etc * - * TAP activation/deactivation is currently implemented outside the core - * using scripted code that understands the specific router type. + * During those callbacks, scan chain contents have not been validated. + * JTAG operations that address a specific TAP (primarily DR/IR scans) + * must *not* be queued. + * + * - TAP_EVENT_SETUP is reported after TRST_ASSERTED, and after the scan + * chain has been validated. JTAG operations including scans that + * target specific TAPs may be performed. + * + * - TAP_EVENT_ENABLE and TAP_EVENT_DISABLE implement TAP activation and + * deactivation outside the core using scripted code that understands + * the specific JTAG router type. They might be triggered indirectly + * from EVENT_SETUP operations. */ enum jtag_event { JTAG_TRST_ASSERTED, + JTAG_TAP_EVENT_SETUP, JTAG_TAP_EVENT_ENABLE, JTAG_TAP_EVENT_DISABLE, - JTAG_TAP_EVENT_POST_RESET, }; struct jtag_tap_event_action_s @@ -277,6 +286,7 @@ enum reset_types { RESET_TRST_PULLS_SRST = 0x8, RESET_TRST_OPEN_DRAIN = 0x10, RESET_SRST_PUSH_PULL = 0x20, + RESET_SRST_GATES_JTAG = 0x40, }; enum reset_types jtag_get_reset_config(void); @@ -288,6 +298,12 @@ unsigned jtag_get_nsrst_delay(void); void jtag_set_ntrst_delay(unsigned delay); unsigned jtag_get_ntrst_delay(void); +void jtag_set_nsrst_assert_width(unsigned delay); +unsigned jtag_get_nsrst_assert_width(void); + +void jtag_set_ntrst_assert_width(unsigned delay); +unsigned jtag_get_ntrst_assert_width(void); + /// @returns The current state of TRST. int jtag_get_trst(void); /// @returns The current state of SRST. @@ -319,8 +335,9 @@ extern int jtag_interface_quit(void); extern int jtag_init(struct command_context_s* cmd_ctx); /// reset, then initialize JTAG chain -extern int jtag_init_reset(struct command_context_s* cmd_ctx); -extern int jtag_register_commands(struct command_context_s* cmd_ctx); +extern int jtag_init_reset(struct command_context_s* cmd_ctx); +extern int jtag_register_commands(struct command_context_s* cmd_ctx); +extern int jtag_init_inner(struct command_context_s *cmd_ctx); /** * @file @@ -636,8 +653,8 @@ extern void jtag_execute_queue_noclear(void); /// @returns the number of times the scan queue has been flushed int jtag_get_flush_queue_count(void); -/// Notify all TAP's about a TLR reset -void jtag_notify_reset(void); +/// Report Tcl event to all TAPs +void jtag_notify_event(enum jtag_event); /* can be implemented by hw + sw */