interface: define TMS sequence command

For support of SWD we need to be able to clock out special bit
sequences over TMS or SWDIO.  Create this as a generic operation,
not yet called by anything, which is split as usual into:

 - upper level abstraction ... here, jtag_add_tms_seq();
 - midlayer implementation logic hooking that to the lowlevel code;
 - lowlevel minidriver operation ... here, interface_add_tms_seq();
 - message type for request queue, here JTAG_TMS.

This is done slightly differently than other operations: there's a flag
saying whether the interface driver supports this request.  (In fact a
flag *word* so upper layers can learn about other capabilities too ...
for example, supporting SWD operations.)

That approach (flag) lets this method *eventually* be used to eliminate
pathmove() and statemove() support from most adapter drivers, by moving
all that logic into the mid-layer and increasing uniformity between the
various drivers.  (Which will in turn reduce subtle bugginess.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
This commit is contained in:
David Brownell
2010-02-27 00:12:38 -08:00
parent 4a64820f23
commit a3245bd7cd
8 changed files with 124 additions and 11 deletions

View File

@@ -98,19 +98,39 @@ struct sleep_command {
uint32_t us;
};
/**
* Encapsulates a series of bits to be clocked out, affecting state
* and mode of the interface.
*
* In JTAG mode these are clocked out on TMS, using TCK. They may be
* used for link resets, transitioning between JTAG and SWD modes, or
* to implement JTAG state machine transitions (implementing pathmove
* or statemove operations).
*
* In SWD mode these are clocked out on SWDIO, using SWCLK, and are
* used for link resets and transitioning between SWD and JTAG modes.
*/
struct tms_command {
/** How many bits should be clocked out. */
unsigned num_bits;
/** The bits to clock out; the LSB is bit 0 of bits[0]. */
const uint8_t *bits;
};
/**
* Defines a container type that hold a pointer to a JTAG command
* structure of any defined type.
*/
union jtag_command_container {
struct scan_command* scan;
struct statemove_command* statemove;
struct pathmove_command* pathmove;
struct runtest_command* runtest;
struct stableclocks_command* stableclocks;
struct reset_command* reset;
struct end_state_command* end_state;
struct sleep_command* sleep;
struct scan_command *scan;
struct statemove_command *statemove;
struct pathmove_command *pathmove;
struct runtest_command *runtest;
struct stableclocks_command *stableclocks;
struct reset_command *reset;
struct end_state_command *end_state;
struct sleep_command *sleep;
struct tms_command *tms;
};
/**
@@ -124,7 +144,8 @@ enum jtag_command_type {
JTAG_RESET = 4,
JTAG_PATHMOVE = 6,
JTAG_SLEEP = 7,
JTAG_STABLECLOCKS = 8
JTAG_STABLECLOCKS = 8,
JTAG_TMS = 9,
};
struct jtag_command {