diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index b522b21e..e564f76e 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,3 +1,14 @@ +2010-02-02 Jie Zhang + + * src/tap/state.c (urj_tap_state_name): New. + (urj_tap_state_dump): New. + (urj_tap_state_dump_2): New. + (urj_tap_state_init): Call urj_tap_state_dump. + (urj_tap_state_done): Likewise. + (urj_tap_state_reset): Likewise. + (urj_tap_state_set_trst): Likewise. + (urj_tap_state_clock): Call urj_tap_state_dump_2. + 2010-02-02 Jie Zhang * src/tap/usbconn/libftdi.c (usbconn_ftdi_write): Make sure diff --git a/urjtag/src/tap/state.c b/urjtag/src/tap/state.c index 59c36847..669d48d0 100644 --- a/urjtag/src/tap/state.c +++ b/urjtag/src/tap/state.c @@ -26,6 +26,46 @@ #include #include +static const char * +urj_tap_state_name (int state) +{ + switch (state) + { + case URJ_TAP_STATE_UNKNOWN_STATE: return "UNKNOWN_STATE"; + case URJ_TAP_STATE_TEST_LOGIC_RESET: return "TEST_LOGIC_RESET"; + case URJ_TAP_STATE_RUN_TEST_IDLE: return "RUN_TEST_IDLE"; + case URJ_TAP_STATE_SELECT_DR_SCAN: return "SELECT_DR_SCAN"; + case URJ_TAP_STATE_CAPTURE_DR: return "CAPTURE_DR"; + case URJ_TAP_STATE_SHIFT_DR: return "SHIFT_DR"; + case URJ_TAP_STATE_EXIT1_DR: return "EXIT1_DR"; + case URJ_TAP_STATE_PAUSE_DR: return "PAUSE_DR"; + case URJ_TAP_STATE_EXIT2_DR: return "EXIT2_DR"; + case URJ_TAP_STATE_UPDATE_DR: return "UPDATE_DR"; + case URJ_TAP_STATE_SELECT_IR_SCAN: return "SELECT_IR_SCAN"; + case URJ_TAP_STATE_CAPTURE_IR: return "CAPTURE_IR"; + case URJ_TAP_STATE_SHIFT_IR: return "SHIFT_IR"; + case URJ_TAP_STATE_EXIT1_IR: return "EXIT1_IR"; + case URJ_TAP_STATE_PAUSE_IR: return "PAUSE_IR"; + case URJ_TAP_STATE_EXIT2_IR: return "EXIT2_IR"; + case URJ_TAP_STATE_UPDATE_IR: return "UPDATE_IR"; + default: return "??????"; + } +} + +static void +urj_tap_state_dump (int state) +{ + urj_log (URJ_LOG_LEVEL_DEBUG, "tap_state: %s\n", + urj_tap_state_name (state)); +} + +static void +urj_tap_state_dump_2 (int state0, int state1, int tms) +{ + urj_log (URJ_LOG_LEVEL_DEBUG, "tap_state: %16s =(tms:%d)=> %s\n", + urj_tap_state_name (state0), tms, urj_tap_state_name (state1)); +} + int urj_tap_state (urj_chain_t *chain) { @@ -35,18 +75,21 @@ urj_tap_state (urj_chain_t *chain) int urj_tap_state_init (urj_chain_t *chain) { + urj_tap_state_dump (URJ_TAP_STATE_UNKNOWN_STATE); return chain->state = URJ_TAP_STATE_UNKNOWN_STATE; } int urj_tap_state_done (urj_chain_t *chain) { + urj_tap_state_dump (URJ_TAP_STATE_UNKNOWN_STATE); return chain->state = URJ_TAP_STATE_UNKNOWN_STATE; } int urj_tap_state_reset (urj_chain_t *chain) { + urj_tap_state_dump (URJ_TAP_STATE_TEST_LOGIC_RESET); return chain->state = URJ_TAP_STATE_TEST_LOGIC_RESET; } @@ -64,12 +107,15 @@ urj_tap_state_set_trst (urj_chain_t *chain, int old_trst, int new_trst) chain->state = URJ_TAP_STATE_UNKNOWN_STATE; } + urj_tap_state_dump (chain->state); return chain->state; } int urj_tap_state_clock (urj_chain_t *chain, int tms) { + int oldstate = chain->state; + if (tms) { switch (chain->state) @@ -154,5 +200,6 @@ urj_tap_state_clock (urj_chain_t *chain, int tms) } } + urj_tap_state_dump_2 (oldstate, chain->state, tms); return chain->state; }