#define PID 0x0c63
/* Pins at usbprog */
-#define TDO_BIT 0
-#define TDI_BIT 3
-#define TCK_BIT 2
-#define TMS_BIT 1
+#define TDO_BIT 0
+#define TDI_BIT 3
+#define TCK_BIT 2
+#define TMS_BIT 1
int usbprog_execute_queue(void);
int usbprog_speed(int speed);
.quit = usbprog_quit
};
-#define UNKOWN_COMMAND 0x00
-#define PORT_DIRECTION 0x01
-#define PORT_SET 0x02
-#define PORT_GET 0x03
-#define PORT_SETBIT 0x04
-#define PORT_GETBIT 0x05
-#define WRITE_TDI 0x06
-#define READ_TDO 0x07
-#define WRITE_AND_READ 0x08
-#define WRITE_TMS 0x09
-#define WRITE_TMS_CHAIN 0x0A
+#define UNKOWN_COMMAND 0x00
+#define PORT_DIRECTION 0x01
+#define PORT_SET 0x02
+#define PORT_GET 0x03
+#define PORT_SETBIT 0x04
+#define PORT_GETBIT 0x05
+#define WRITE_TDI 0x06
+#define READ_TDO 0x07
+#define WRITE_AND_READ 0x08
+#define WRITE_TMS 0x09
+#define WRITE_TMS_CHAIN 0x0A
struct usbprog_jtag
{
struct usbprog_jtag * usbprog_jtag_handle;
-struct usbprog_jtag* usbprog_jtag_open();
+struct usbprog_jtag* usbprog_jtag_open(void);
void usbprog_jtag_close(struct usbprog_jtag *usbprog_jtag);
void usbprog_jtag_init(struct usbprog_jtag *usbprog_jtag);
unsigned char usbprog_jtag_message(struct usbprog_jtag *usbprog_jtag, char *msg, int msglen);
{
case JTAG_END_STATE:
#ifdef _DEBUG_JTAG_IO_
- DEBUG("end_state: %i", cmd->cmd.end_state->end_state);
+ LOG_DEBUG("end_state: %i", cmd->cmd.end_state->end_state);
#endif
if (cmd->cmd.end_state->end_state != -1)
usbprog_end_state(cmd->cmd.end_state->end_state);
break;
case JTAG_RESET:
#ifdef _DEBUG_JTAG_IO_
- DEBUG("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
+ LOG_DEBUG("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
#endif
if (cmd->cmd.reset->trst == 1)
{
- cur_state = TAP_TLR;
+ cur_state = TAP_RESET;
}
usbprog_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
break;
case JTAG_RUNTEST:
#ifdef _DEBUG_JTAG_IO_
- DEBUG("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles, cmd->cmd.runtest->end_state);
+ LOG_DEBUG("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles, cmd->cmd.runtest->end_state);
#endif
if (cmd->cmd.runtest->end_state != -1)
usbprog_end_state(cmd->cmd.runtest->end_state);
break;
case JTAG_STATEMOVE:
#ifdef _DEBUG_JTAG_IO_
- DEBUG("statemove end in %i", cmd->cmd.statemove->end_state);
+ LOG_DEBUG("statemove end in %i", cmd->cmd.statemove->end_state);
#endif
if (cmd->cmd.statemove->end_state != -1)
usbprog_end_state(cmd->cmd.statemove->end_state);
break;
case JTAG_PATHMOVE:
#ifdef _DEBUG_JTAG_IO_
- DEBUG("pathmove: %i states, end in %i", cmd->cmd.pathmove->num_states,
+ LOG_DEBUG("pathmove: %i states, end in %i", cmd->cmd.pathmove->num_states,
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
#endif
usbprog_path_move(cmd->cmd.pathmove);
break;
case JTAG_SCAN:
#ifdef _DEBUG_JTAG_IO_
- DEBUG("scan end in %i", cmd->cmd.scan->end_state);
+ LOG_DEBUG("scan end in %i", cmd->cmd.scan->end_state);
#endif
if (cmd->cmd.scan->end_state != -1)
usbprog_end_state(cmd->cmd.scan->end_state);
break;
case JTAG_SLEEP:
#ifdef _DEBUG_JTAG_IO_
- DEBUG("sleep %i", cmd->cmd.sleep->us);
+ LOG_DEBUG("sleep %i", cmd->cmd.sleep->us);
#endif
jtag_sleep(cmd->cmd.sleep->us);
break;
default:
- ERROR("BUG: unknown JTAG command type encountered");
+ LOG_ERROR("BUG: unknown JTAG command type encountered");
exit(-1);
}
tms_chain_index = 0;
if (usbprog_jtag_handle == 0)
{
- ERROR("Can't find USB JTAG Interface! Please check connection and permissions.");
+ LOG_ERROR("Can't find USB JTAG Interface! Please check connection and permissions.");
return ERROR_JTAG_INIT_FAILED;
}
- INFO("USB JTAG Interface ready!");
+ LOG_INFO("USB JTAG Interface ready!");
usbprog_jtag_init(usbprog_jtag_handle);
usbprog_reset(0, 0);
end_state = state;
else
{
- ERROR("BUG: %i is not a valid end state", state);
+ LOG_ERROR("BUG: %i is not a valid end state", state);
exit(-1);
}
}
{
if (tap_transitions[cur_state].low == cmd->path[state_count])
{
- /* INFO("1"); */
+ /* LOG_INFO("1"); */
usbprog_write(0, 0, 0);
usbprog_write(1, 0, 0);
}
else if (tap_transitions[cur_state].high == cmd->path[state_count])
{
- /* INFO("2"); */
+ /* LOG_INFO("2"); */
usbprog_write(0, 1, 0);
usbprog_write(1, 1, 0);
}
else
{
- 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 i;
- /* only do a state_move when we're not already in RTI */
- if (cur_state != TAP_RTI)
+ /* only do a state_move when we're not already in IDLE */
+ if (cur_state != TAP_IDLE)
{
- usbprog_end_state(TAP_RTI);
+ usbprog_end_state(TAP_IDLE);
usbprog_state_move();
}
else
{
usbprog_jtag_tms_send(usbprog_jtag_handle);
- /* INFO("NUM CYCLES %i",num_cycles); */
+ /* LOG_INFO("NUM CYCLES %i",num_cycles); */
}
for (i = 0; i < num_cycles; i++)
enum tap_state saved_end_state = end_state;
if (ir_scan)
- usbprog_end_state(TAP_SI);
+ usbprog_end_state(TAP_IRSHIFT);
else
- usbprog_end_state(TAP_SD);
+ usbprog_end_state(TAP_DRSHIFT);
/* usbprog_jtag_tms_send(usbprog_jtag_handle); */
}
if (ir_scan)
- cur_state = TAP_PI;
+ cur_state = TAP_IRPAUSE;
else
- cur_state = TAP_PD;
+ cur_state = TAP_DRPAUSE;
if (cur_state != end_state)
usbprog_state_move();
/* (1) assert or (0) deassert reset lines */
void usbprog_reset(int trst, int srst)
{
- DEBUG("trst: %i, srst: %i", trst, srst);
+ LOG_DEBUG("trst: %i, srst: %i", trst, srst);
if (trst)
usbprog_jtag_set_bit(usbprog_jtag_handle, 5, 0);
struct usb_bus *busses;
-struct usbprog_jtag* usbprog_jtag_open()
+struct usbprog_jtag* usbprog_jtag_open(void)
{
struct usb_bus *bus;
struct usb_device *dev;
return 1;
if (res == msglen)
{
- /* INFO("HALLLLOOO %i",(int)msg[0]); */
+ /* LOG_INFO("HALLLLOOO %i",(int)msg[0]); */
res = usb_bulk_read(usbprog_jtag->usb_handle, 0x82, msg, 2, 100);
if (res > 0)
return (unsigned char)msg[1];
if (usb_bulk_write(usbprog_jtag->usb_handle, 3, tmp, 64, 1000) == 64)
{
- /* INFO("HALLLLOOO2 %i",(int)tmp[0]); */
+ /* LOG_INFO("HALLLLOOO2 %i",(int)tmp[0]); */
usleep(1);
int timeout = 0;
while (usb_bulk_read(usbprog_jtag->usb_handle, 0x82, tmp, 64, 1000) < 1)
usb_bulk_write(usbprog_jtag->usb_handle, 3, tmp, 3, 1000);
- /* INFO("HALLLLOOO3 %i",(int)tmp[0]); */
+ /* LOG_INFO("HALLLLOOO3 %i",(int)tmp[0]); */
int timeout = 0;
usleep(1);
while (usb_bulk_read(usbprog_jtag->usb_handle, 0x82, tmp, 64, 10) < 1)
void usbprog_jtag_tms_send(struct usbprog_jtag *usbprog_jtag)
{
int i;
- /* INFO("TMS SEND"); */
+ /* LOG_INFO("TMS SEND"); */
if (tms_chain_index > 0)
{
char tmp[tms_chain_index + 2];