From 386bb6b2c16f5d729a49e8eb8f42bbfad6a42d10 Mon Sep 17 00:00:00 2001 From: dodge-this Date: Wed, 11 Aug 2010 17:23:45 +0000 Subject: [PATCH] cleaning up jtag, jtag430, jtag430x2, jtagarm7tdmi includes git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@690 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- firmware/apps/jtag/jtag.c | 6 +-- firmware/apps/jtag/jtag430.c | 2 +- firmware/apps/jtag/jtag430x2.c | 2 +- firmware/apps/jtag/jtagarm7tdmi.c | 8 ++-- firmware/include/jtag.h | 79 ++++--------------------------- firmware/include/jtag430.h | 7 +-- 6 files changed, 18 insertions(+), 86 deletions(-) diff --git a/firmware/apps/jtag/jtag.c b/firmware/apps/jtag/jtag.c index 415f36a..906dd14 100644 --- a/firmware/apps/jtag/jtag.c +++ b/firmware/apps/jtag/jtag.c @@ -25,10 +25,8 @@ void jtagsetup(){ /************************** JTAG Primitives ****************************/ // these have been turned into functions to save flash space void jtag_tcktock() { - //delay(1); // FIXME: Should never wait this long... CLRTCK; PLEDOUT^=PLEDPIN; - //delay(1); // FIXME: Should never wait this long... SETTCK; PLEDOUT^=PLEDPIN; } @@ -186,7 +184,7 @@ unsigned char jtagtrans8(unsigned char byte){ SAVETCLK; for (bit = 0; bit < bitcount; bit++) { - //* write MOSI on trailing edge of previous clock * + // write MOSI on trailing edge of previous clock * if (word & high) {SETMOSI;} else @@ -197,7 +195,7 @@ unsigned char jtagtrans8(unsigned char byte){ SETTMS;//TMS high on last bit to exit. TCKTOCK; - //* read MISO on trailing edge * + // read MISO on trailing edge * word |= READMISO; } diff --git a/firmware/apps/jtag/jtag430.c b/firmware/apps/jtag/jtag430.c index 52cfa71..f98cc5f 100644 --- a/firmware/apps/jtag/jtag430.c +++ b/firmware/apps/jtag/jtag430.c @@ -5,7 +5,7 @@ #include "platform.h" #include "command.h" -#include "jtag.h" +#include "jtag430.h" unsigned int jtag430mode=MSP430X2MODE; diff --git a/firmware/apps/jtag/jtag430x2.c b/firmware/apps/jtag/jtag430x2.c index db3b613..b08f739 100644 --- a/firmware/apps/jtag/jtag430x2.c +++ b/firmware/apps/jtag/jtag430x2.c @@ -5,7 +5,7 @@ #include "platform.h" #include "command.h" -#include "jtag.h" +#include "jtag430.h" unsigned char jtagid; diff --git a/firmware/apps/jtag/jtagarm7tdmi.c b/firmware/apps/jtag/jtagarm7tdmi.c index a0449ee..d4f777d 100644 --- a/firmware/apps/jtag/jtagarm7tdmi.c +++ b/firmware/apps/jtag/jtagarm7tdmi.c @@ -128,7 +128,7 @@ unsigned long jtagarmtransn(unsigned long word, unsigned char bitcount, unsigned SAVETCLK; if (lsb) { for (bit = bitcount; bit > 0; bit--) { - /* write MOSI on trailing edge of previous clock * + // write MOSI on trailing edge of previous clock * if (word & 1) {SETMOSI;} else @@ -140,14 +140,14 @@ unsigned long jtagarmtransn(unsigned long word, unsigned char bitcount, unsigned jtag_arm_tcktock(); - //* read MISO on trailing edge * + // read MISO on trailing edge * if (READMISO){ word += (high); } } } else { for (bit = bitcount; bit > 0; bit--) { - //* write MOSI on trailing edge of previous clock * + // write MOSI on trailing edge of previous clock * if (word & high) {SETMOSI;} else @@ -159,7 +159,7 @@ unsigned long jtagarmtransn(unsigned long word, unsigned char bitcount, unsigned jtag_arm_tcktock(); - //* read MISO on trailing edge * + // read MISO on trailing edge * word |= (READMISO); } } diff --git a/firmware/include/jtag.h b/firmware/include/jtag.h index aab18fe..352e044 100644 --- a/firmware/include/jtag.h +++ b/firmware/include/jtag.h @@ -10,12 +10,6 @@ #include #include -extern unsigned int drwidth; - -#define MSP430MODE 0 -#define MSP430XMODE 1 -#define MSP430X2MODE 2 -extern unsigned int jtag430mode; // Generic Commands @@ -37,31 +31,14 @@ void jtag_stop(); //! Setup the JTAG pin directions. void jtagsetup(); -// JTAG430 Commands - -//! Start JTAG, unique to the '430. -void jtag430_start(); -//! Reset the TAP state machine, check the fuse. -void jtag430_resettap(); - -//! Defined in jtag430asm.S -void jtag430_tclk_flashpulses(int); - -//High-level Macros follow -//! Write data to address. -void jtag430_writemem(unsigned int adr, unsigned int data); -//! Read data from address -unsigned int jtag430_readmem(unsigned int adr); -//! Halt the CPU -void jtag430_haltcpu(); -//! Release the CPU -void jtag430_releasecpu(); -//! Set CPU to Instruction Fetch -void jtag430_setinstrfetch(); -//! Set the program counter. -void jtag430_setpc(unsigned int adr); -//! Write data to address. -void jtag430_writeflash(unsigned int adr, unsigned int data); +//! Ratchet Clock Down and Up +void jtag_tcktock(); +//! Go to SHIFT_IR +void jtag_goto_shift_ir(); +//! Go to SHIFT_DR +void jtag_goto_shift_dr(); +//! TAP RESET +void jtag_reset_to_runtest_idle(); //Pins. Both SPI and JTAG names are acceptable. //#define SS BIT0 @@ -112,44 +89,6 @@ extern int savedtclk; //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 -// Instructions for the JTAG Fuse -#define IR_PREPARE_BLOW 0x44 // 0x22 -#define IR_EX_BLOW 0x24 // 0x24 -// Instructions for the JTAG data register -#define IR_DATA_16BIT 0x82 // 0x41 -#define IR_DATA_QUICK 0xC2 // 0x43 -// Instructions for the JTAG PSA mode -#define IR_DATA_PSA 0x22 // 0x44 -#define IR_SHIFT_OUT_PSA 0x62 // 0x46 -// Instructions for the JTAG address register -#define IR_ADDR_16BIT 0xC1 // 0x83 -#define IR_ADDR_CAPTURE 0x21 // 0x84 -#define IR_DATA_TO_ADDR 0xA1 // 0x85 -// Bypass instruction -#define IR_BYPASS 0xFF // 0xFF - -//MSP430X2 unique -#define IR_COREIP_ID 0xE8 // 0x17 -#define IR_DEVICE_ID 0xE1 // 0x87 - -//MSP430 or MSP430X -#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 @@ -162,6 +101,6 @@ void jtag430_por(); //JTAG430 commands -#include "jtag430.h" +//#include "jtag430.h" #endif diff --git a/firmware/include/jtag430.h b/firmware/include/jtag430.h index cc32fc9..7d38bc7 100644 --- a/firmware/include/jtag430.h +++ b/firmware/include/jtag430.h @@ -1,11 +1,6 @@ -/*! \file jtag.h +/*! \file jtag430.h \author Travis Goodspeed \brief JTAG handler functions. - -FIXME: Remove these when proven compiling -#include -#include -#include */ -- 2.20.1