Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Renaming jtag->prog

  • Loading branch information...
commit eb575caf63076656eba8b9b4c9ed43db92604ffb 1 parent 614e41f
@makestuff authored
View
72 firmware/fx2/app.c
@@ -120,62 +120,6 @@ void mainInit(void) {
IOE = 0xFF;
OEE = 0x00;
-#ifdef BOOT
- promStartRead(false, 0x0000);
- if ( promPeekByte() == 0xC2 ) {
- promNextByte(); // VID(L)
- promNextByte(); // VID(H)
- promNextByte(); // PID(L)
- promNextByte(); // PID(H)
- promNextByte(); // DID(L)
- promNextByte(); // DID(H)
- promNextByte(); // Config byte
-
- promNextByte(); // Length(H)
- thisByte = promPeekByte();
- while ( !(thisByte & 0x80) ) {
- blockSize = thisByte;
- blockSize <<= 8;
-
- promNextByte(); // Length(L)
- blockSize |= promPeekByte();
-
- blockSize += 2; // Space taken by address
- while ( blockSize-- ) {
- promNextByte();
- }
-
- promNextByte(); // Length(H)
- thisByte = promPeekByte();
- }
- promNextByte(); // Length(L)
- promNextByte(); // Address(H)
- promNextByte(); // Address(L)
- promNextByte(); // Last byte
- promNextByte(); // First byte after the end of the firmware
- }
- jtagSetEnabled(true);
- jtagCsvfInit();
- m_diagnosticCode = jtagCsvfPlay();
- jtagSetEnabled(false);
- thisByte = promPeekByte();
- promNextByte();
- blockSize = promPeekByte();
- promNextByte();
- blockSize <<= 8;
- blockSize |= promPeekByte();
- promNextByte();
- if ( thisByte ) {
- if ( blockSize ) {
- fifoSendPromData(0x10000UL + blockSize);
- }
- } else if ( blockSize ) {
- fifoSendPromData(blockSize);
- }
- promStopRead();
- USBCS &= ~bmDISCON;
-#endif
-
#ifdef DEBUG
usartInit();
usartSendString("MakeStuff FPGALink/FX2 v1.1\r");
@@ -185,8 +129,8 @@ void mainInit(void) {
// Called repeatedly while the device is idle
//
void mainLoop(void) {
- // If there is a JTAG shift operation pending, execute it now.
- jtagShiftExecute();
+ // If there is a shift operation pending, execute it now.
+ progShiftExecute();
}
void fifoSetEnabled(bool enabled) {
@@ -248,9 +192,7 @@ uint8 handleVendorCommand(uint8 cmd) {
if ( SETUP_TYPE == (REQDIR_HOSTTODEVICE | REQTYPE_VENDOR) ) {
xdata uint16 wBits = SETUP_VALUE();
xdata uint16 wMask = SETUP_INDEX();
- if ( wMask & MODE_JTAG ) {
- // Do nothing
- } else if ( wMask & MODE_FIFO ) {
+ if ( wMask & MODE_FIFO ) {
// Enable or disable FIFO mode
fifoSetEnabled(wBits & MODE_FIFO ? true : false);
} else {
@@ -265,7 +207,7 @@ uint8 handleVendorCommand(uint8 cmd) {
EP0BUF[3] = 'I';
EP0BUF[4] = m_diagnosticCode; // Last operation diagnostic code
EP0BUF[5] = (IOA & bmBIT2) ? 0 : 1; // Flags
- EP0BUF[6] = 0x11; // NeroJTAG endpoints
+ EP0BUF[6] = 0x11; // NeroProg endpoints
EP0BUF[7] = 0x26; // CommFPGA endpoints
EP0BUF[8] = 0x00; // Reserved
EP0BUF[9] = 0x00; // Reserved
@@ -289,7 +231,7 @@ uint8 handleVendorCommand(uint8 cmd) {
if ( SETUP_TYPE == (REQDIR_HOSTTODEVICE | REQTYPE_VENDOR) ) {
EP0BCL = 0x00; // Allow host transfer in
while ( EP0CS & bmEPBUSY ); // Wait for data
- jtagShiftBegin(*((uint32 *)EP0BUF), (ProgOp)SETUPDAT[4], SETUPDAT[2]); // Init numBits & flagByte
+ progShiftBegin(*((uint32 *)EP0BUF), (ProgOp)SETUPDAT[4], SETUPDAT[2]); // Init numBits & flagByte
return true;
// Now that numBits & flagByte are set, this operation will continue in mainLoop()...
}
@@ -301,7 +243,7 @@ uint8 handleVendorCommand(uint8 cmd) {
if ( SETUP_TYPE == (REQDIR_HOSTTODEVICE | REQTYPE_VENDOR) ) {
EP0BCL = 0x00; // Allow host transfer in
while ( EP0CS & bmEPBUSY ); // Wait for data
- jtagClockFSM(*((uint32 *)EP0BUF), SETUPDAT[2]); // Bit pattern, transitionCount
+ progClockFSM(*((uint32 *)EP0BUF), SETUPDAT[2]); // Bit pattern, transitionCount
return true;
}
break;
@@ -310,7 +252,7 @@ uint8 handleVendorCommand(uint8 cmd) {
//
case CMD_JTAG_CLOCK:
if ( SETUP_TYPE == (REQDIR_HOSTTODEVICE | REQTYPE_VENDOR) ) {
- jtagClocks(*((uint32 *)(SETUPDAT+2)));
+ progClocks(*((uint32 *)(SETUPDAT+2)));
return true;
}
break;
View
47 firmware/fx2/livePatch.c
@@ -20,10 +20,10 @@
const uint16 *xdata classList[] = {tdoList, tdiList, tmsList, tckList, ioaList};
// Base address of JTAG code
-void jtagClockFSM(uint32 bitPattern, uint8 transitionCount);
+void progClockFSM(uint32 bitPattern, uint8 transitionCount);
void livePatch(uint8 patchClass, uint8 newByte) {
- xdata uint8 *xdata const codeBase = (xdata uint8 *)jtagClockFSM;
+ xdata uint8 *xdata const codeBase = (xdata uint8 *)progClockFSM;
xdata uint16 thisOffset;
const uint16 *xdata ptr = classList[patchClass];
thisOffset = *ptr++;
@@ -32,46 +32,3 @@ void livePatch(uint8 patchClass, uint8 newByte) {
thisOffset = *ptr++;
}
}
-
-void jtagPatch(
- uint8 tdoPort, uint8 tdoBit, // port and bit for TDO
- uint8 tdiPort, uint8 tdiBit, // port and bit for TDI
- uint8 tmsPort, uint8 tmsBit, // port and bit for TMS
- uint8 tckPort, uint8 tckBit // port and bit for TCK
-) {
- xdata uint8 *xdata const codeBase = (xdata uint8 *)jtagClockFSM;
- xdata uint16 thisOffset;
- const uint16 *xdata ptr;
-
- ptr = tdoList;
- thisOffset = *ptr++;
- while ( thisOffset ) {
- //*(codeBase + thisOffset) = 0x11;
- *(codeBase + thisOffset) = 0x80 + (tdoPort << 4) + tdoBit;
- thisOffset = *ptr++;
- }
-
- ptr = tdiList;
- thisOffset = *ptr++;
- while ( thisOffset ) {
- //*(codeBase + thisOffset) = 0x22;
- *(codeBase + thisOffset) = 0x80 + (tdiPort << 4) + tdiBit;
- thisOffset = *ptr++;
- }
-
- ptr = tmsList;
- thisOffset = *ptr++;
- while ( thisOffset ) {
- //*(codeBase + thisOffset) = 0x33;
- *(codeBase + thisOffset) = 0x80 + (tmsPort << 4) + tmsBit;
- thisOffset = *ptr++;
- }
-
- ptr = tckList;
- thisOffset = *ptr++;
- while ( thisOffset ) {
- //*(codeBase + thisOffset) = 0x44;
- *(codeBase + thisOffset) = 0x80 + (tckPort << 4) + tckBit;
- thisOffset = *ptr++;
- }
-}
View
15 firmware/fx2/prog.c
@@ -18,13 +18,12 @@
#include <fx2macros.h>
#include <delay.h>
#include "prog.h"
-//#include "prom.h"
#include "defs.h"
#include "../../vendorCommands.h"
#include "debug.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
-// NeroJTAG Stuff
+// NeroProg Stuff
////////////////////////////////////////////////////////////////////////////////////////////////////
static xdata uint32 m_numBits = 0UL;
@@ -36,7 +35,7 @@ static xdata uint8 m_flagByte = 0x00;
// Transition the JTAG state machine to another state: clock "transitionCount" bits from
// "bitPattern" into TMS, LSB-first.
//
-void jtagClockFSM(uint32 bitPattern, uint8 transitionCount) {
+void progClockFSM(uint32 bitPattern, uint8 transitionCount) {
while ( transitionCount-- ) {
TCK = 0;
TMS = bitPattern & 1;
@@ -253,9 +252,9 @@ static uint8 shiftInOut(uint8 c) {
return c;
}
-// Kick off a shift operation. Next time jtagExecuteShift() runs, it will execute the shift.
+// Kick off a shift operation. Next time progExecuteShift() runs, it will execute the shift.
//
-void jtagShiftBegin(uint32 numBits, ProgOp progOp, uint8 flagByte) {
+void progShiftBegin(uint32 numBits, ProgOp progOp, uint8 flagByte) {
m_numBits = numBits;
m_progOp = progOp;
m_flagByte = flagByte;
@@ -447,10 +446,10 @@ static void doProgram(bool isParallel) {
m_progOp = PROG_NOP;
}
-// Actually execute the shift operation initiated by jtagBeginShift(). This is done in a
+// Actually execute the shift operation initiated by progBeginShift(). This is done in a
// separate method because vendor commands cannot read & write to bulk endpoints.
//
-void jtagShiftExecute(void) {
+void progShiftExecute(void) {
switch ( m_progOp ) {
case PROG_JTAG_ISSENDING_ISRECEIVING:
// The host is giving us data, and is expecting a response (xdr)
@@ -482,7 +481,7 @@ void jtagShiftExecute(void) {
// Keep TMS and TDI as they are, and clock the JTAG state machine "numClocks" times.
// This is tuned to be as close to 2us per clock as possible (500kHz).
//
-void jtagClocks(uint32 numClocks) {
+void progClocks(uint32 numClocks) {
_asm
mov r2, dpl
mov r3, dph
View
15 firmware/fx2/prog.h
@@ -38,21 +38,18 @@ sbit at (0x80 + 16*JTAG_PORT + TCK_BIT) TCK; // Port bit to use for TCK
// Macros for NeroJTAG implementation
#define ENDPOINT_SIZE 64
-// Kick off a shift operation. Next time jtagExecuteShift() runs, it will execute the shift.
-void jtagShiftBegin(uint32 numBits, ProgOp progOp, uint8 flagByte);
+// Kick off a shift operation. Next time progExecuteShift() runs, it will execute the shift.
+void progShiftBegin(uint32 numBits, ProgOp progOp, uint8 flagByte);
-// Return true if there's a shift operation pending
-bool jtagIsShiftPending(void);
-
-// Actually execute the shift operation initiated by jtagBeginShift(). This is done in a
+// Actually execute the shift operation initiated by progBeginShift(). This is done in a
// separate method because vendor commands cannot read & write to bulk endpoints.
-void jtagShiftExecute(void);
+void progShiftExecute(void);
// Transition the JTAG state machine to another state: clock "transitionCount" bits from
// "bitPattern" into TMS, LSB-first.
-void jtagClockFSM(uint32 bitPattern, uint8 transitionCount);
+void progClockFSM(uint32 bitPattern, uint8 transitionCount);
// Keep TMS and TDI as they are, and clock the JTAG state machine "numClocks" times.
-void jtagClocks(uint32 numClocks);
+void progClocks(uint32 numClocks);
#endif

0 comments on commit eb575ca

Please sign in to comment.
Something went wrong with that request. Please try again.