CPLD JTAG GPIO

This commit is contained in:
Michael Ossmann
2013-02-14 17:23:45 -07:00
parent de69b1f290
commit 907325aa12
3 changed files with 34 additions and 6 deletions

View File

@ -234,6 +234,7 @@ extern "C"
#define BOOT2_STATE GPIO_STATE(GPIO5, PIN_BOOT2) #define BOOT2_STATE GPIO_STATE(GPIO5, PIN_BOOT2)
#define BOOT3_STATE GPIO_STATE(GPIO1, PIN_BOOT3) #define BOOT3_STATE GPIO_STATE(GPIO1, PIN_BOOT3)
#define MIXER_SDATA_STATE GPIO_STATE(PORT_MIXER_SDATA, PIN_MIXER_SDATA) #define MIXER_SDATA_STATE GPIO_STATE(PORT_MIXER_SDATA, PIN_MIXER_SDATA)
#define CPLD_TDO_STATE GPIO_STATE(PORT_CPLD_TDO, PIN_CPLD_TDO)
/* TODO add other Pins */ /* TODO add other Pins */

View File

@ -1,4 +1,4 @@
The code in this directory is taken from: The code in this directory was originally is taken from:
http://www.xilinx.com/support/documentation/application_notes/xapp058.zip http://www.xilinx.com/support/documentation/application_notes/xapp058.zip
(v.5.01) (v.5.01)
@ -8,3 +8,5 @@ what you want, no warranty. (BSD I guess...)"
Refer to XAPP058 for more information: Refer to XAPP058 for more information:
http://www.xilinx.com/support/documentation/application_notes/xapp058.pdf http://www.xilinx.com/support/documentation/application_notes/xapp058.pdf
This software has been modified for HackRF.

View File

@ -12,11 +12,13 @@
#include "ports.h" #include "ports.h"
/*#include "prgispx.h"*/ /*#include "prgispx.h"*/
#include "stdio.h" //#include "stdio.h"
#include "hackrf_core.h"
extern FILE *in; extern FILE *in;
static int g_iTCK = 0; /* For xapp058_example .exe */ //static int g_iTCK = 0; /* For xapp058_example .exe */
static int g_iTMS = 0; /* For xapp058_example .exe */ //static int g_iTMS = 0; /* For xapp058_example .exe */
static int g_iTDI = 0; /* For xapp058_example .exe */ //static int g_iTDI = 0; /* For xapp058_example .exe */
#ifdef WIN95PP #ifdef WIN95PP
#include "conio.h" #include "conio.h"
@ -95,6 +97,7 @@ void setPort(short p,short val)
/* Printing code for the xapp058_example.exe. You must set the specified /* Printing code for the xapp058_example.exe. You must set the specified
JTAG signal (p) to the new value (v). See the above, old Win95 code JTAG signal (p) to the new value (v). See the above, old Win95 code
as an implementation example. */ as an implementation example. */
/*
if (p==TMS) if (p==TMS)
g_iTMS = val; g_iTMS = val;
if (p==TDI) if (p==TDI)
@ -103,6 +106,25 @@ void setPort(short p,short val)
g_iTCK = val; g_iTCK = val;
printf( "TCK = %d; TMS = %d; TDI = %d\n", g_iTCK, g_iTMS, g_iTDI ); printf( "TCK = %d; TMS = %d; TDI = %d\n", g_iTCK, g_iTMS, g_iTDI );
} }
*/
if (p==TMS)
if (val)
gpio_set(PORT_CPLD_TMS, PIN_CPLD_TMS);
else
gpio_clear(PORT_CPLD_TMS, PIN_CPLD_TMS);
if (p==TDI)
if (val)
gpio_set(PORT_CPLD_TDI, PIN_CPLD_TDI);
else
gpio_clear(PORT_CPLD_TDI, PIN_CPLD_TDI);
if (p==TCK)
if (val)
gpio_set(PORT_CPLD_TCK, PIN_CPLD_TCK);
else
gpio_clear(PORT_CPLD_TCK, PIN_CPLD_TCK);
/* conservative delay */
delay(20000);
} }
@ -139,7 +161,10 @@ unsigned char readTDOBit()
} }
#endif #endif
/* You must return the current value of the JTAG TDO signal. */ /* You must return the current value of the JTAG TDO signal. */
return( (unsigned char) 0 ); //return( (unsigned char) 0 );
delay(2000);
return CPLD_TDO_STATE;
} }
/* waitTime: Implement as follows: */ /* waitTime: Implement as follows: */