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

@@ -388,6 +388,31 @@ int interface_jtag_add_tlr(void)
return ERROR_OK;
}
int interface_add_tms_seq(unsigned num_bits, const uint8_t *seq)
{
struct jtag_command *cmd;
cmd = cmd_queue_alloc(sizeof(struct jtag_command));
if (cmd == NULL)
return ERROR_FAIL;
cmd->type = JTAG_TMS;
cmd->cmd.tms = cmd_queue_alloc(sizeof(*cmd->cmd.tms));
if (!cmd->cmd.tms)
return ERROR_FAIL;
/* copy the bits; our caller doesn't guarantee they'll persist */
cmd->cmd.tms->num_bits = num_bits;
cmd->cmd.tms->bits = buf_cpy(seq,
cmd_queue_alloc(DIV_ROUND_UP(num_bits, 8)), num_bits);
if (!cmd->cmd.tms->bits)
return ERROR_FAIL;
jtag_queue_command(cmd);
return ERROR_OK;
}
int interface_jtag_add_pathmove(int num_states, const tap_state_t *path)
{
/* allocate memory for a new list member */