}
else
{
- LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[state_count]]);
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(cmd->path[state_count]));
exit(-1);
}
if (tap_transitions[cur_state].low == cmd->path[i]) bitq_io(0, 0, 0);
else if (tap_transitions[cur_state].high == cmd->path[i]) bitq_io(1, 0, 0);
else {
- LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[i]]);
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(cmd->path[i)]);
exit(-1);
}
buf_set_u32(&tms_byte, bit_count++, 1, 0x1);
else
{
- LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[state_count]]);
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(cmd->path[state_count]));
exit(-1);
}
}
else
{
- LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[state_count]]);
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(cmd->path[state_count]));
exit(-1);
}
}
else
{
- LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[path[i]]);
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(path[i]));
exit(-1);
}
int jtag_error=ERROR_OK;
-char* tap_state_strings[16] =
-{
- "tlr",
- "sds", "cd", "sd", "e1d", "pd", "e2d", "ud",
- "rti",
- "sis", "ci", "si", "e1i", "pi", "e2i", "ui"
-};
-
typedef struct cmd_queue_page_s
{
void *address;
if ((tap_transitions[cur_state].low != path[i])&&
(tap_transitions[cur_state].high != path[i]))
{
- LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[path[i]]);
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(path[i]));
exit(-1);
}
cur_state = path[i];
{
for (state = 0; state < 16; state++)
{
- if (strcmp(args[0], tap_state_strings[state]) == 0)
+ if (strcmp(args[0], jtag_state_name(state)) == 0)
{
jtag_add_end_state(state);
jtag_execute_queue();
}
}
}
- command_print(cmd_ctx, "current endstate: %s", tap_state_strings[cmd_queue_end_state]);
+ command_print(cmd_ctx, "current endstate: %s", jtag_state_name(cmd_queue_end_state));
return ERROR_OK;
}
Jim_Nvp_value2name_simple( nvp_jtag_tap_event, e)->name);
}
}
+
+
+/* map state number to SVF state string */
+const char* jtag_state_name(enum tap_state state)
+{
+ const char* ret;
+
+ switch( state )
+ {
+ case TAP_RESET: ret = "RESET"; break;
+ case TAP_IDLE: ret = "IDLE"; break;
+ case TAP_DRSELECT: ret = "DRSELECT"; break;
+ case TAP_DRCAPTURE: ret = "DRCAPTURE"; break;
+ case TAP_DRSHIFT: ret = "DRSHIFT"; break;
+ case TAP_DREXIT1: ret = "DREXIT1"; break;
+ case TAP_DRPAUSE: ret = "DRPAUSE"; break;
+ case TAP_DREXIT2: ret = "DREXIT2"; break;
+ case TAP_DRUPDATE: ret = "DRUPDATE"; break;
+ case TAP_IRSELECT: ret = "IRSELECT"; break;
+ case TAP_IRCAPTURE: ret = "IRCAPTURE"; break;
+ case TAP_IRSHIFT: ret = "IRSHIFT"; break;
+ case TAP_IREXIT1: ret = "IREXIT1"; break;
+ case TAP_IRPAUSE: ret = "IRPAUSE"; break;
+ case TAP_IREXIT2: ret = "IREXIT2"; break;
+ case TAP_IRUPDATE: ret = "IRUPDATE"; break;
+ default: ret = "???";
+ }
+
+ return ret;
+}
+
enum tap_state low;
} tap_transition_t;
-extern char* tap_state_strings[16];
extern int tap_move_map[16]; /* map 16 TAP states to 6 stable states */
extern u8 tap_move[6][6]; /* value scanned to TMS to move from one of six stable states to another */
extern tap_transition_t tap_transitions[16]; /* describe the TAP state diagram */
interface_jtag_add_dr_out(tap, num_fields, num_bits, value, cmd_queue_end_state);
}
+/**
+ * Function jtag_state_name
+ * Returns a string suitable for display representing the JTAG tap_state
+ */
+const char* jtag_state_name(enum tap_state state);
+
+
#endif /* JTAG_H */
}
else
{
- LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[state_count]]);
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(cmd->path[state_count]));
exit(-1);
}
int loadFile(const char *fileName, void **data, int *len)
{
FILE * pFile;
- pFile = fopen (fileName,"rb");
+ pFile = fopen(fileName,"rb");
if (pFile==NULL)
{
LOG_ERROR("Can't open %s\n", fileName);
return ERROR_JTAG_DEVICE_ERROR;
}
- if (fseek (pFile, 0, SEEK_END)!=0)
- {
+ if (fseek(pFile, 0, SEEK_END)!=0)
+ {
LOG_ERROR("Can't open %s\n", fileName);
fclose(pFile);
return ERROR_JTAG_DEVICE_ERROR;
- }
- *len=ftell (pFile);
- if (*len==-1)
- {
+ }
+ *len=ftell(pFile);
+ if (*len==-1)
+ {
LOG_ERROR("Can't open %s\n", fileName);
fclose(pFile);
return ERROR_JTAG_DEVICE_ERROR;
- }
+ }
- if (fseek (pFile, 0, SEEK_SET)!=0)
- {
+ if (fseek(pFile, 0, SEEK_SET)!=0)
+ {
LOG_ERROR("Can't open %s\n", fileName);
fclose(pFile);
return ERROR_JTAG_DEVICE_ERROR;
- }
- *data=malloc(*len+1);
- if (*data==NULL)
- {
+ }
+ *data=malloc(*len+1);
+ if (*data==NULL)
+ {
LOG_ERROR("Can't open %s\n", fileName);
fclose(pFile);
return ERROR_JTAG_DEVICE_ERROR;
- }
+ }
- if (fread(*data, 1, *len, pFile)!=*len)
- {
+ if (fread(*data, 1, *len, pFile)!=*len)
+ {
fclose(pFile);
free(*data);
LOG_ERROR("Can't open %s\n", fileName);
return ERROR_JTAG_DEVICE_ERROR;
- }
- fclose (pFile);
- *(((char *)(*data))+*len)=0; /* sentinel */
+ }
+ fclose(pFile);
+ *(((char *)(*data))+*len)=0; /* sentinel */
- return ERROR_OK;
+ return ERROR_OK;
#if 0
static void shiftValueInnerFlip(const enum tap_state state, const enum tap_state endState, int repeat, cyg_uint32 value)
{
- VERBOSE(LOG_INFO("shiftValueInner %s %s %d %08x (flipped)", tap_state_strings[state], tap_state_strings[endState], repeat, value));
+ VERBOSE(LOG_INFO("shiftValueInner %s %s %d %08x (flipped)", jtag_state_name(state), jtag_state_name(endState), repeat, value));
cyg_uint32 a,b;
a=state;
b=endState;
int r=fields[i].in_handler(inBuffer, fields[i].in_handler_priv, fields+i);
if (r!=ERROR_OK)
{
- /* this will cause jtag_execute_queue() to return an error */
+ /* this will cause jtag_execute_queue() to return an error */
jtag_error=r;
}
}
}
else
{
- LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[path[state_count]]);
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(path[state_count)]);
exit(-1);
}