Mercurial > avr_jtag
changeset 7:61f27549de57
Support TRST.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sun, 22 Feb 2009 14:20:57 +0800 |
parents | 42dec3428c77 |
children | 074e860d7d31 |
files | include/cmd_proto.h include/jtag.h py_avrjtag/cmd_proto.py src/avr_jtag.c src/jtag.c |
diffstat | 5 files changed, 21 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/include/cmd_proto.h Sun Feb 22 14:12:29 2009 +0800 +++ b/include/cmd_proto.h Sun Feb 22 14:20:57 2009 +0800 @@ -9,6 +9,7 @@ CPCMD_SHIFT_TDI, CPCMD_SHIFT_TMS, CPCMD_SHIFT_TDI_TDO, + CPCMD_TRST, CPCMD_PONG, CPCMD_DATA, CPCMD_ACK,
--- a/include/jtag.h Sun Feb 22 14:12:29 2009 +0800 +++ b/include/jtag.h Sun Feb 22 14:20:57 2009 +0800 @@ -9,8 +9,10 @@ #define JTAG_TMS PINB1 #define JTAG_TDI PINB2 #define JTAG_TDO PINB3 +#define JTAG_TRST PINB4 extern void jtag_init(void); +extern void jtag_trst(void); extern void jtag_tms(char *buf, int nbits); extern void jtag_shift(char *buf, int nbits); extern void jtag_shift_inout(char *ibuf, char *obuf, int nbits);
--- a/py_avrjtag/cmd_proto.py Sun Feb 22 14:12:29 2009 +0800 +++ b/py_avrjtag/cmd_proto.py Sun Feb 22 14:20:57 2009 +0800 @@ -4,10 +4,11 @@ CPCMD_SHIFT_TDI = 2 CPCMD_SHIFT_TMS = 3 CPCMD_SHIFT_TDI_TDO = 4 -CPCMD_PONG = 5 -CPCMD_DATA = 6 -CPCMD_ACK = 7 -CPCMD_NAK = 8 +CPCMD_TRST = 5 +CPCMD_PONG = 6 +CPCMD_DATA = 7 +CPCMD_ACK = 8 +CPCMD_NAK = 9 def csum_add(csum, c): return (((csum << 3) | (csum >> 5)) ^ c) & 0xff
--- a/src/avr_jtag.c Sun Feb 22 14:12:29 2009 +0800 +++ b/src/avr_jtag.c Sun Feb 22 14:20:57 2009 +0800 @@ -120,6 +120,13 @@ send_client(client_buf, bsz); break; + case CPCMD_TRST: + jtag_trst(); + bsz = cmd_proto_cmd_fill(client_buf, cmd->seq, + CPCMD_ACK, 0); + send_client(client_buf, bsz); + break; + default: sprintf(buf, "CODE 0x%02x", cmd->code); nak(cmd->seq, buf);
--- a/src/jtag.c Sun Feb 22 14:12:29 2009 +0800 +++ b/src/jtag.c Sun Feb 22 14:20:57 2009 +0800 @@ -30,6 +30,12 @@ } while(0) #define GET_TDO() (JTAG_PIN & _BV(JTAG_TDO)) +void jtag_trst(void) { + SEND_BIT(JTAG_TRST, 1); + TCK_LO(); + pin_lo(JTAG_PORT, JTAG_TRST); +} + /*! * Before shifting registers, TAP controller must move to last state before * shift state. The state machine transite to shift state when shifting