X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Finclude%2Fjtag.h;h=432c23d67f91b9379e0db17874d5ee4a3f7e7059;hp=a681e261a488ad3c5b3f3ce362c519e9c4439c93;hb=dd259c9289deb11e84be93647c144192e5ba10b6;hpb=3e4369fde16445c994da1b1efb332704aad0716d diff --git a/firmware/include/jtag.h b/firmware/include/jtag.h index a681e26..432c23d 100644 --- a/firmware/include/jtag.h +++ b/firmware/include/jtag.h @@ -1,3 +1,10 @@ +/*! \file jtag.h + \author Travis Goodspeed + \brief JTAG handler functions. +*/ + +#ifndef JTAG_H +#define JTAG_H #include #include @@ -16,13 +23,18 @@ extern unsigned int jtag430mode; //! Shift n bytes. unsigned long jtagtransn(unsigned long word, unsigned int bitcount); +//! Shift the address width. +unsigned long jtag_dr_shiftadr(unsigned long in); //! Shift 8 bits of the IR. unsigned char jtag_ir_shift8(unsigned char); //! Shift 16 bits of the DR. unsigned int jtag_dr_shift16(unsigned int); +//! Shift 20 bits of the DR, MSP430 specific. +unsigned long jtag_dr_shift20(unsigned long in); //! Stop JTAG, release pins void jtag_stop(); +//! Setup the JTAG pin directions. void jtagsetup(); // JTAG430 Commands @@ -97,8 +109,12 @@ extern int savedtclk; #define SAVETCLK savedtclk=P5OUT&TCLK; #define RESTORETCLK if(savedtclk) P5OUT|=TCLK; else P5OUT&=~TCLK +//Replace every "CLRTCK SETTCK" with this. +#define TCKTOCK CLRTCK,SETTCK + //16-bit MSP430 JTAG commands, bit-swapped +//Rewrite these with MSP430 prefix. #define IR_CNTRL_SIG_16BIT 0xC8 // 0x13 #define IR_CNTRL_SIG_CAPTURE 0x28 // 0x14 #define IR_CNTRL_SIG_RELEASE 0xA8 // 0x15 @@ -126,3 +142,21 @@ extern int savedtclk; #define MSP430JTAGID 0x89 //MSP430X2 only #define MSP430X2JTAGID 0x91 + +//! Syncs a POR. +unsigned int jtag430x2_syncpor(); +//! Executes an MSP430X2 POR +unsigned int jtag430x2_por(); +//! Power-On Reset +void jtag430_por(); + +//JTAG commands +#define JTAG_IR_SHIFT 0x80 +#define JTAG_DR_SHIFT 0x81 +#define JTAG_DR_SHIFT20 0x91 + + +//JTAG430 commands +#include "jtag430.h" + +#endif