X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Fapps%2Fjtag%2Fjtag.c;h=20c43601947a6c68e1af09e4dd5b6085603a1fc5;hp=af420c7095afd854aa7866dc8a082fdd24a5a4e2;hb=d7ad826230d336ad7b7bd20e47dccc26d7ad456f;hpb=dd37f96a4f842ea15233b8d0efd4ec001ad5de9c diff --git a/firmware/apps/jtag/jtag.c b/firmware/apps/jtag/jtag.c index af420c7..20c4360 100644 --- a/firmware/apps/jtag/jtag.c +++ b/firmware/apps/jtag/jtag.c @@ -1,7 +1,8 @@ -//GoodFET JTAG Application -//Handles basic I/O +/*! \file jtag.c + \author Travis Goodspeed + \brief Low-level JTAG +*/ -//Higher level left to client application. #include "platform.h" #include "command.h" @@ -13,8 +14,10 @@ void jtagsetup(){ P5DIR|=MOSI+SCK+TMS; P5DIR&=~MISO; P5OUT|=0xFFFF; + P5OUT=0; P4DIR|=TST; P2DIR|=RST; + msdelay(100); } int savedtclk=0; @@ -56,7 +59,7 @@ unsigned long jtagtransn(unsigned long word, unsigned int bitcount){ unsigned int bit; //0x8000 - unsigned long high; + unsigned long high=0x8000; if(bitcount==20) high=0x80000; @@ -99,40 +102,6 @@ unsigned long jtagtransn(unsigned long word, return word; } -/* -//! Shift 16 bits in and out. -unsigned int jtagtrans16(unsigned int word){ //REMOVEME - unsigned int bit; - SAVETCLK; - - for (bit = 0; bit < 16; bit++) { - // write MOSI on trailing edge of previous clock - if (word & 0x8000) - {SETMOSI;} - else - {CLRMOSI;} - word <<= 1; - - if(bit==15) - SETTMS;//TMS high on last bit to exit. - - CLRTCK; - SETTCK; - // read MISO on trailing edge - word |= READMISO; - } - RESTORETCLK; - - // exit state - CLRTCK; - SETTCK; - // update state - CLRTMS; - CLRTCK; - SETTCK; - - return word; -}*/ //! Stop JTAG, release pins void jtag_stop(){ @@ -203,7 +172,7 @@ unsigned char jtag_ir_shift8(unsigned char in){ //! Handles a monitor command. void jtaghandle(unsigned char app, unsigned char verb, - unsigned char len){ + unsigned long len){ switch(verb){ //START handled by specific JTAG case STOP: