projects
/
goodfet
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Dropped ugly 'blocks' kludge for a 16-bit length field.
[goodfet]
/
firmware
/
apps
/
jtag
/
jtag.c
diff --git
a/firmware/apps/jtag/jtag.c
b/firmware/apps/jtag/jtag.c
index
5abba15
..
73a6750
100644
(file)
--- 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 <travis at radiantmachines.com>
+ \brief Low-level JTAG
+*/
-//Higher level left to client application.
#include "platform.h"
#include "command.h"
#include "platform.h"
#include "command.h"
@@
-13,8
+14,10
@@
void jtagsetup(){
P5DIR|=MOSI+SCK+TMS;
P5DIR&=~MISO;
P5OUT|=0xFFFF;
P5DIR|=MOSI+SCK+TMS;
P5DIR&=~MISO;
P5OUT|=0xFFFF;
+ P5OUT=0;
P4DIR|=TST;
P2DIR|=RST;
P4DIR|=TST;
P2DIR|=RST;
+ msdelay(100);
}
int savedtclk=0;
}
int savedtclk=0;
@@
-55,14
+58,19
@@
unsigned char jtagtrans8(unsigned char byte){
unsigned long jtagtransn(unsigned long word,
unsigned int bitcount){
unsigned int bit;
unsigned long jtagtransn(unsigned long word,
unsigned int bitcount){
unsigned int bit;
- unsigned int high=(word>>16);
-
SAVETCLK
;
+ //0x8000
+
unsigned long high
;
+ if(bitcount==20)
+ high=0x80000;
+ if(bitcount==16)
+ high= 0x8000;
+ SAVETCLK;
for (bit = 0; bit < bitcount; bit++) {
/* write MOSI on trailing edge of previous clock */
for (bit = 0; bit < bitcount; bit++) {
/* write MOSI on trailing edge of previous clock */
- if (word &
0x8000
)
+ if (word &
high
)
{SETMOSI;}
else
{CLRMOSI;}
{SETMOSI;}
else
{CLRMOSI;}
@@
-137,7
+145,7
@@
void jtag_stop(){
unsigned int drwidth=20;
//! Shift all bits of the DR.
unsigned int drwidth=20;
//! Shift all bits of the DR.
-unsigned long jtag_dr_shift(unsigned long in){
+unsigned long jtag_dr_shift
20
(unsigned long in){
// idle
SETTMS;
CLRTCK;
// idle
SETTMS;
CLRTCK;
@@
-151,14
+159,26
@@
unsigned long jtag_dr_shift(unsigned long in){
SETTCK;
// shift DR, then idle
SETTCK;
// shift DR, then idle
- return(jtagtransn(in,
drwidth
));
+ return(jtagtransn(in,
20
));
}
//! Shift 16 bits of the DR.
unsigned int jtag_dr_shift16(unsigned int in){
}
//! Shift 16 bits of the DR.
unsigned int jtag_dr_shift16(unsigned int in){
- //This name is deprecated, kept around to find 16-bit dependent code.
- return jtag_dr_shift(in);
+ // idle
+ SETTMS;
+ CLRTCK;
+ SETTCK;
+ // select DR
+ CLRTMS;
+ CLRTCK;
+ SETTCK;
+ // capture IR
+ CLRTCK;
+ SETTCK;
+
+ // shift DR, then idle
+ return(jtagtransn(in,16));
}
}
@@
-186,7
+206,7
@@
unsigned char jtag_ir_shift8(unsigned char in){
//! Handles a monitor command.
void jtaghandle(unsigned char app,
unsigned char verb,
//! 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:
switch(verb){
//START handled by specific JTAG
case STOP: