void tap_capture_dr( chain_t *chain ) { if ((tap_state( chain ) & (TAPSTAT_RESET | TAPSTAT_IDLE)) != TAPSTAT_IDLE) printf( _("%s: Invalid state: %2X\n"), "tap_capture_dr", tap_state( chain ) ); /* Run-Test/Idle or Update-DR or Update-IR state */ chain_clock( chain, 1, 0 ); /* Select-DR-Scan */ chain_clock( chain, 0, 0 ); /* Capture-DR */ }
/** * bus->driver->(*init) * */ static int jopcyc_bus_init( bus_t *bus ) { part_t *p = PART; chain_t *chain = CHAIN; component_t *comp; if (tap_state(chain) != Run_Test_Idle) { /* silently skip initialization if TAP isn't in RUNTEST/IDLE state this is required to avoid interfering with detect when initbus is contained in the part description file bus_init() will be called latest by bus_prepare() */ return URJTAG_STATUS_OK; } /* Preload update registers See AN039, "Guidelines for IEEE Std. 1149.1 Boundary Scan Testing */ part_set_instruction( p, "SAMPLE/PRELOAD" ); chain_shift_instructions( chain ); /* RAMA */ comp = COMP_RAMA; set_data_in( bus, comp ); part_set_signal( p, nCS, 1, 1 ); part_set_signal( p, nWE, 1, 1 ); part_set_signal( p, nOE, 1, 1 ); part_set_signal( p, nLB, 1, 1 ); part_set_signal( p, nUB, 1, 1 ); /* RAMB */ comp = COMP_RAMB; set_data_in( bus, comp ); part_set_signal( p, nCS, 1, 1 ); part_set_signal( p, nWE, 1, 1 ); part_set_signal( p, nOE, 1, 1 ); part_set_signal( p, nLB, 1, 1 ); part_set_signal( p, nUB, 1, 1 ); /* FLASH */ comp = COMP_FLASH; set_data_in( bus, comp ); part_set_signal( p, nCS, 1, 1 ); part_set_signal( p, nWE, 1, 1 ); part_set_signal( p, nOE, 1, 1 ); part_set_signal( p, nCS2, 1, 1 ); part_set_signal( p, nRDY, 0, 0 ); /* Serial Port */ part_set_signal( p, SER_RXD, 0, 0 ); part_set_signal( p, SER_NRTS, 1, 1 ); part_set_signal( p, SER_TXD, 1, 1 ); part_set_signal( p, SER_NCTS, 0, 0 ); chain_shift_data_registers( chain, 0 ); INITIALIZED = 1; return URJTAG_STATUS_OK; }
void tap_shift_register( chain_t *chain, const tap_register *in, tap_register *out, int exit ) { int i; if (!(tap_state( chain ) & TAPSTAT_SHIFT)) printf( _("%s: Invalid state: %2X\n"), "tap_shift_register", tap_state( chain ) ); /* Capture-DR, Capture-IR, Shift-DR, Shift-IR, Exit2-DR or Exit2-IR state */ if (tap_state( chain ) & TAPSTAT_CAPTURE) chain_clock( chain, 0, 0 ); /* save last TDO bit :-) */ for (i = 0; i < in->len; i++) { if (out && (i < out->len)) out->data[i] = cable_get_tdo( chain->cable ); chain_clock( chain, (exit && ((i + 1) == in->len)) ? 1 : 0, in->data[i] ); /* Shift (& Exit1) */ } /* Shift-DR, Shift-IR, Exit1-DR or Exit1-IR state */ if (exit) { chain_clock( chain, 1, 0 ); /* Update-DR or Update-IR */ chain_clock( chain, 0, 0 ); /* Run-Test/Idle */ } }
/** * bus->driver->(*init) * */ static int s3c4510_bus_init( bus_t *bus ) { part_t *p = PART; chain_t *chain = CHAIN; if (tap_state(chain) != Run_Test_Idle) { /* silently skip initialization if TAP isn't in RUNTEST/IDLE state this is required to avoid interfering with detect when initbus is contained in the part description file bus_init() will be called latest by bus_prepare() */ return URJTAG_STATUS_OK; } part_set_instruction( p, "SAMPLE/PRELOAD" ); chain_shift_instructions( chain ); chain_shift_data_registers( chain, 0 ); INITIALIZED = 1; return URJTAG_STATUS_OK; }
/* * svf_goto_state(state) * * Moves from any TAP state to the specified state. * The state traversal is done according to the SVF specification. * See STATE of the Serial Vector Format Specification * * Encoding of state is according to the jtag suite's defines. * * Parameter: * state : new TAP controller state */ static void svf_goto_state( chain_t *chain, int new_state) { int current_state; current_state = tap_state(chain); /* handle unknown state */ if (new_state == Unknown_State) new_state = Test_Logic_Reset; /* abort if new_state already reached */ if (current_state == new_state) return; switch (current_state) { case Test_Logic_Reset: chain_clock(chain, 0, 0, 1); break; case Run_Test_Idle: chain_clock(chain, 1, 0, 1); break; case Select_DR_Scan: case Select_IR_Scan: if (new_state == Test_Logic_Reset || new_state == Run_Test_Idle || (current_state & TAPSTAT_DR && new_state & TAPSTAT_IR) || (current_state & TAPSTAT_IR && new_state & TAPSTAT_DR)) /* progress in select-idle/reset loop */ chain_clock(chain, 1, 0, 1); else /* enter DR/IR branch */ chain_clock(chain, 0, 0, 1); break; case Capture_DR: if (new_state == Shift_DR) /* enter Shift_DR state */ chain_clock(chain, 0, 0, 1); else /* bypass Shift_DR */ chain_clock(chain, 1, 0, 1); break; case Capture_IR: if (new_state == Shift_IR) /* enter Shift_IR state */ chain_clock(chain, 0, 0, 1); else /* bypass Shift_IR */ chain_clock(chain, 1, 0, 1); break; case Shift_DR: case Shift_IR: /* progress to Exit1_DR/IR */ chain_clock(chain, 1, 0, 1); break; case Exit1_DR: if (new_state == Pause_DR) /* enter Pause_DR state */ chain_clock(chain, 0, 0, 1); else /* bypass Pause_DR */ chain_clock(chain, 1, 0, 1); break; case Exit1_IR: if (new_state == Pause_IR) /* enter Pause_IR state */ chain_clock(chain, 0, 0, 1); else /* bypass Pause_IR */ chain_clock(chain, 1, 0, 1); break; case Pause_DR: case Pause_IR: /* progress to Exit2_DR/IR */ chain_clock(chain, 1, 0, 1); break; case Exit2_DR: if (new_state == Shift_DR) /* enter Shift_DR state */ chain_clock(chain, 0, 0, 1); else /* progress to Update_DR */ chain_clock(chain, 1, 0, 1); break; case Exit2_IR: if (new_state == Shift_IR) /* enter Shift_IR state */ chain_clock(chain, 0, 0, 1); else /* progress to Update_IR */ chain_clock(chain, 1, 0, 1); break; case Update_DR: case Update_IR: if (new_state == Run_Test_Idle) /* enter Run_Test_Idle */ chain_clock(chain, 0, 0, 1); else /* progress to Select_DR/IR */ chain_clock(chain, 1, 0, 1); break; default: svf_force_reset_state(chain); break; } /* continue state changes */ svf_goto_state(chain, new_state); }