Initial check in

This commit is contained in:
2026-01-03 19:05:48 +01:00
commit 1254878a31
253 changed files with 30484 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
lst
obj
bin
debug
release
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,49 @@
### uVision2 Project, (C) Keil Software
### Do not modify !
cExt (*.c)
aExt (*.a*; *.src)
oExt (*.obj)
lExt (*.lib)
tExt (*.txt)
pExt (*.plm)
CppX (*.cpp)
DaveTm { 0,0,0,0,0,0,0,0 }
Target (Target 1), 0x0000 // Tools: 'MCS-51'
GRPOPT 1,(Source Group 1),1,0,0
OPTFFF 1,1,1,0,0,327,327,0,<.\fw.c><fw.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,233,255,255,255,44,0,0,0,44,0,0,0,70,3,0,0,242,1,0,0 }
OPTFFF 1,2,2,218103808,0,3,8,0,<.\dscr.a51><dscr.a51> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,233,255,255,255,22,0,0,0,22,0,0,0,44,3,0,0,216,1,0,0 }
OPTFFF 1,3,1,419430400,0,353,369,0,<.\FX2_to_TI5416_HPI.c><FX2_to_TI5416_HPI.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,233,255,255,255,0,0,0,0,0,0,0,0,22,3,0,0,194,1,0,0 }
OPTFFF 1,4,1,0,0,1,1,0,<.\int0.c><int0.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,233,255,255,255,88,0,0,0,88,0,0,0,114,3,0,0,12,2,0,0 }
OPTFFF 1,5,3,0,0,0,0,0,<D:\Cypress\USB\Target\Lib\FX2\USBJmpTb.OBJ><USBJmpTb.OBJ>
OPTFFF 1,6,4,0,0,0,0,0,<D:\Cypress\USB\Target\Lib\FX2\Ezusb.lib><Ezusb.lib>
OPTFFF 1,7,1,989855746,0,216,232,0,<.\gpif.c><gpif.c> { 44,0,0,0,2,0,0,0,3,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,233,255,255,255,110,0,0,0,110,0,0,0,105,3,0,0,162,1,0,0 }
TARGOPT 1, (Target 1)
CLK51=48000000
OPTTT 1,1,1,0
OPTHX 0,65535,0,0,0
OPTLX 120,65,8,<.\>
OPTOX 16
OPTLT 1,1,1,0,1,1,0,1,0,0,0,0
OPTXL 1,1,1,1,1,1,1,0,0
OPTFL 1,0,1
OPTDL (S8051.DLL)()(DP51.DLL)(-pFX2)(S8051.DLL)()(TP51.DLL)(-pFX2)
OPTDBG 49150,0,()()()()()()()()()() ()()()()
OPTKEY 0,(MON51)(-S1 -B38400 -O31)
OPTWA 0,1,(Tcount)
OPTWA 1,1,(EP6BCH)
OPTWA 2,1,(EP6BCL)
OPTWA 3,1,(GPIFTRIG)
OPTWA 4,1,(GPIFTCB1)
OPTWA 5,1,(GPIFTCB0)
OPTWA 6,1,(EP6FIFOBCH)
OPTWA 7,1,(EP6FIFOBCL)
OPTDF 0x84
OPTLE <>
OPTLC <>
EndOpt
@@ -0,0 +1,109 @@
### uVision2 Project, (C) Keil Software
### Do not modify !
Target (Target 1), 0x0000 // Tools: 'MCS-51'
Group (Source Group 1)
File 1,1,<.\fw.c><fw.c>
File 1,2,<.\dscr.a51><dscr.a51>
File 1,1,<.\FX2_to_TI5416_HPI.c><FX2_to_TI5416_HPI.c>
File 1,1,<.\int0.c><int0.c>
File 1,3,<D:\Cypress\USB\Target\Lib\FX2\USBJmpTb.OBJ><USBJmpTb.OBJ>
File 1,4,<D:\Cypress\USB\Target\Lib\FX2\Ezusb.lib><Ezusb.lib>
File 1,1,<.\gpif.c><gpif.c>
Options 1,0,0 // Target 'Target 1'
Device (EZ-USB FX2 (CY7C68XXX))
Vendor (Cypress Semiconductor)
Cpu (IRAM(0 - 0xFF) XRAM(0 - 0x3FF) CLOCK(48000000) MODDP2)
Rgf (REG52.H)
Mem ()
C ()
A ()
RL ()
OH ()
UseEnv=1
EnvBin (C:\Keil\C51\BIN\)
EnvInc (c:\CYPRESS\USB\Target\Inc\;C:\Keil\C51\INC\)
EnvLib (C:\Keil\C51\LIB\)
EnvReg ()
OrgReg ()
TgStat=0
OutDir (.\)
OutName (FX2_to_TI5416_HPI)
GenApp=1
GenLib=0
GenHex=1
Debug=1
Browse=0
LstDir (.\)
HexSel=0
MG32K=0
RunUsr 0 1 <c:\cypress\usb\bin\hex2bix -i -f 0xC2 -o FX2_to_TI5416_HPI.iic FX2_to_TI5416_HPI.hex>
RunUsr 1 0 <>
SVCSID <>
MODEL5=0
RTOS5=0
ROMSZ5=2
DHOLD5=0
XHOLD5=0
T51FL=304
CBANKS5=0
XBANKS5=0
RCB51 { 0,0,0,0,0,255,255,0,0 }
RXB51 { 0,0,0,0,0,0,0,0,0 }
OCM51 { 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
OCR51 { 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
IRO51 { 0,0,0,0,0,0,0,0,0 }
IRA51 { 0,0,0,0,0,0,1,0,0 }
XRA51 { 0,0,0,0,0,0,4,0,0 }
C51FL=21597456
C51VA=0
C51MSC ()
C51DEF ()
C51UDF ()
INCC5 ()
AX51FL=4
AX51MSC ()
AX51SET ()
AX51RST ()
INCA5 ()
IncBld=1
AlwaysBuild=0
GenAsm=0
AsmAsm=0
PublicsOnly=0
StopCode=3
CustArgs ()
LibMods ()
BankNo=65535
LX51FL=288
LX51OVL ()
LX51MSC ()
LX51DWN (16)
LX51LFI ()
LX51ASN ()
LX51RES ()
LX51CCL ()
LX51UCL ()
LX51CSC ()
LX51UCS ()
LX51COB (0x80-0x0FFF)
LX51XDB (0x1000)
LX51PDB ()
LX51BIB ()
LX51DAB ()
LX51IDB ()
LX51PRC ()
LX51STK ()
LX51COS ()
LX51XDS ()
LX51BIS ()
LX51DAS ()
LX51IDS ()
OPTDL (S8051.DLL)()(DP51.DLL)(-pFX2)(S8051.DLL)()(TP51.DLL)(-pFX2)
OPTDBG 49150,0,()()()()()()()()()() ()()()()
EndOpt
@@ -0,0 +1,643 @@
#pragma NOIV // Do not generate interrupt vectors
//-----------------------------------------------------------------------------
// File: FX2_to_extsyncFIFO.c
// Contents: Hooks required to implement FX2 GPIF interface to a TI
// 5416 DSP via it's HPI (Host Port Interface)
//
// Copyright (c) 2002 Cypress Semiconductor, Inc. All rights reserved
//-----------------------------------------------------------------------------
#include "fx2.h"
#include "fx2regs.h"
#include "fx2sdly.h" // SYNCDELAY macro, see Section 15.14 of FX2 Tech.
// Ref. Manual for usage details.
#define HPI_RDY GPIFREADYSTAT & bmBIT0 // RDY0
#define LED_ALL (bmBIT0 | bmBIT1 | bmBIT2 | bmBIT3)
#define bmEP0BSY 0x01
#define bmEP1OUTBSY 0x02
#define bmEP1INBSY 0x04
#define bmHPIC 0x00 // HCNTL[1:0] = 00
#define bmHPID_AUTO 0x04 // HCNTL[1:0] = 01
#define bmHPIA 0x08 // HCNTL[1:0] = 10
#define bmHPID_MANUAL 0x0C // HCNTL[1:0] = 11
#define GPIFTRIGRD 4
#define GPIF_EP2 0
#define GPIF_EP4 1
#define GPIF_EP6 2
#define GPIF_EP8 3
extern BOOL GotSUD; // Received setup data flag
extern BOOL Sleep;
extern BOOL Rwuen;
extern BOOL Selfpwr;
BYTE Configuration; // Current configuration
BYTE AlternateSetting; // Alternate settings
static WORD xdata LED_Count = 0;
static BYTE xdata LED_Status = 0;
BOOL in_enable = FALSE; // flag to enable IN transfers
BOOL hpi_int = FALSE; // HPI interrupt flag
static WORD xdata Tcount = 0; // transaction count
BOOL enum_high_speed = FALSE; // flag to let firmware know FX2 enumerated at high speed
static WORD xFIFOBC_IN = 0x0000; // variable that contains EP6FIFOBCH/L value
//-----------------------------------------------------------------------------
// Task Dispatcher hooks
// The following hooks are called by the task dispatcher.
//-----------------------------------------------------------------------------
void LED_Off (BYTE LED_Mask);
void LED_On (BYTE LED_Mask);
void GpifInit ();
void GPIF_SingleByteWrite (BYTE gdata)
{
while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 Done bit
{
;
}
XGPIFSGLDATLX = gdata; // trigger GPIF Single Byte Write transaction
}
void TD_Init(void) // Called once at startup
{
// set the CPU clock to 48MHz
CPUCS = ((CPUCS & ~bmCLKSPD) | bmCLKSPD1);
SYNCDELAY;
EP1OUTCFG = 0xA0; // always OUT, valid, bulk
EP1INCFG = 0xA0; // always IN, valid, bulk
SYNCDELAY;
EP2CFG = 0xA0; // EP2OUT, bulk, size 512, 4x buffered
SYNCDELAY;
EP4CFG = 0x00; // EP4 not valid
SYNCDELAY;
EP6CFG = 0xE0; // EP6IN, bulk, size 512, 4x buffered
SYNCDELAY;
EP8CFG = 0x00; // EP8 not valid
SYNCDELAY;
FIFORESET = 0x80; // set NAKALL bit to NAK all transfers from host
SYNCDELAY;
FIFORESET = 0x02; // reset EP2 FIFO
SYNCDELAY;
FIFORESET = 0x06; // reset EP6 FIFO
SYNCDELAY;
FIFORESET = 0x00; // clear NAKALL bit to resume normal operation
SYNCDELAY;
EP2FIFOCFG = 0x00; // allow core to see zero to one transition of auto out bit
SYNCDELAY;
EP2FIFOCFG = 0x10; // auto out mode, disable PKTEND zero length send, byte ops
SYNCDELAY;
EP6FIFOCFG = 0x08; // auto in mode, disable PKTEND zero length send, byte ops
SYNCDELAY;
EP1OUTBC = 0x00; // arm EP1OUT by writing any value to EP1OUTBC register
GpifInit (); // initialize GPIF registers
PORTACFG = bmBIT0; // PA0 takes on INT0/ alternate function
OEA |= 0x0C; // initialize PA3 and PA2 port i/o pins as outputs
EX0 = 1; // Enable INT0/ interrupt
IT0 = 1; // Detect INT0/ on falling edge
}
void TD_Poll(void)
{
if( GPIFTRIG & 0x80 ) // if GPIF interface IDLE
{
if ( ! ( EP24FIFOFLGS & 0x02 ) ) // if there's a packet in the peripheral domain for EP2
{
IOA = bmHPID_AUTO; // select HPID register with address auto-increment
while(!HPI_RDY); // wait for HPI to complete internal portion of previous transfer
SYNCDELAY;
GPIFTCB1 = EP2FIFOBCH; // setup transaction count with number of bytes in the EP2 FIFO
SYNCDELAY;
GPIFTCB0 = EP2FIFOBCL;
SYNCDELAY;
GPIFTRIG = GPIF_EP2; // launch GPIF FIFO WRITE Transaction from EP2 FIFO
SYNCDELAY;
while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 GPIF Done bit
{
;
}
SYNCDELAY;
}
}
if(in_enable) // if IN transfers are enabled,
{
if(Tcount) // if Tcount is not zero
{
if( GPIFTRIG & 0x80 ) // if GPIF interface IDLE
{
if( !( EP68FIFOFLGS & 0x01 ) ) // if EP6 FIFO is not full
{
IOA = bmHPID_AUTO; // select HPID register with address auto-increment
while(!HPI_RDY); // wait for HPI to complete internal portion of previous transfer
SYNCDELAY;
GPIFTCB1 = MSB(Tcount); // setup transaction count with Tcount value
SYNCDELAY;
GPIFTCB0 = LSB(Tcount);
SYNCDELAY;
GPIFTRIG = GPIFTRIGRD | GPIF_EP6; // launch GPIF FIFO READ Transaction to EP6IN
SYNCDELAY;
while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 GPIF Done bit
{
;
}
SYNCDELAY;
xFIFOBC_IN = ( ( EP6FIFOBCH << 8 ) + EP6FIFOBCL ); // get EP6FIFOBCH/L value
if( xFIFOBC_IN < 0x0200 ) // if pkt is short,
{
INPKTEND = 0x06; // force a commit to the host
}
Tcount = 0; // set Tcount to zero to cease reading from DSP HPI RAM
}
}
}
}
if(!(EP01STAT & bmEP1OUTBSY))
{
// handle OUTs to EP1OUT
}
if(!(EP01STAT & bmEP1INBSY))
{
// handle INs to EP1IN
}
if (hpi_int)
{
hpi_int = FALSE; // clear HPI interrupt flag
EX0 = 1; // enable INT0 interrupt again
LED_On (bmBIT1); // turn on LED1 to alert user HPI interrupt occurred
}
// blink LED0 to indicate firmware is running
if (++LED_Count == 10000)
{
if (LED_Status)
{
LED_Off (bmBIT0);
LED_Status = 0;
}
else
{
LED_On (bmBIT0);
LED_Status = 1;
}
LED_Count = 0;
}
}
BOOL TD_Suspend(void) // Called before the device goes into suspend mode
{
return(TRUE);
}
BOOL TD_Resume(void) // Called after the device resumes
{
return(TRUE);
}
//-----------------------------------------------------------------------------
// Device Request hooks
// The following hooks are called by the end point 0 device request parser.
//-----------------------------------------------------------------------------
BOOL DR_GetDescriptor(void)
{
return(TRUE);
}
BOOL DR_SetConfiguration(void) // Called when a Set Configuration command is received
{
if( EZUSB_HIGHSPEED( ) )
{ // FX2 enumerated at high speed
SYNCDELAY;
EP6AUTOINLENH = 0x02; // set AUTOIN commit length to 512 bytes
SYNCDELAY;
EP6AUTOINLENL = 0x00;
SYNCDELAY;
enum_high_speed = TRUE;
}
else
{ // FX2 enumerated at full speed
SYNCDELAY;
EP6AUTOINLENH = 0x00; // set AUTOIN commit length to 64 bytes
SYNCDELAY;
EP6AUTOINLENL = 0x40;
SYNCDELAY;
enum_high_speed = FALSE;
}
Configuration = SETUPDAT[2];
return(TRUE); // Handled by user code
}
BOOL DR_GetConfiguration(void) // Called when a Get Configuration command is received
{
EP0BUF[0] = Configuration;
EP0BCH = 0;
EP0BCL = 1;
return(TRUE); // Handled by user code
}
BOOL DR_SetInterface(void) // Called when a Set Interface command is received
{
AlternateSetting = SETUPDAT[2];
return(TRUE); // Handled by user code
}
BOOL DR_GetInterface(void) // Called when a Set Interface command is received
{
EP0BUF[0] = AlternateSetting;
EP0BCH = 0;
EP0BCL = 1;
return(TRUE); // Handled by user code
}
BOOL DR_GetStatus(void)
{
return(TRUE);
}
BOOL DR_ClearFeature(void)
{
return(TRUE);
}
BOOL DR_SetFeature(void)
{
return(TRUE);
}
#define VX_B2 0xB2 // turn off LED1
#define VX_B3 0xB3 // enable IN transfers
#define VX_B4 0xB4 // disable IN transfers
#define VX_B5 0xB5 // set Tcount value
#define VX_B6 0xB6 // write to HPIC register
#define VX_B7 0xB7 // write to HPIA register
#define VX_B8 0xB8 // reset EP6 FIFO
#define VX_B9 0xB9 // read GPIFTRIG register
#define VX_BA 0xBA // read GPIFTC registers
BOOL DR_VendorCmnd(void)
{
switch (SETUPDAT[1])
{
case VX_B2: // turn off LED1
{
LED_Off (bmBIT1);
*EP0BUF = VX_B2;
EP0BCH = 0;
EP0BCL = 1; // Arm endpoint with # bytes to transfer
EP0CS |= bmHSNAK; // Acknowledge handshake phase of device request
break;
}
case VX_B3: // enable IN transfers
{
in_enable = TRUE;
*EP0BUF = VX_B3;
EP0BCH = 0;
EP0BCL = 1;
EP0CS |= bmHSNAK;
break;
}
case VX_B4: // disable IN transfers
{
in_enable = FALSE;
*EP0BUF = VX_B4;
EP0BCH = 0;
EP0BCL = 1;
EP0CS |= bmHSNAK;
break;
}
case VX_B5: // set Tcount value
{
EP0BCL = 0;
while(EP01STAT & bmEP0BSY); // wait until EP0 is available to be accessed by CPU
Tcount = (EP0BUF[0] << 8) + EP0BUF[1]; // load transaction count with EP0 values
break;
}
case VX_B6: // write to HPIC register
{
EP0BCL = 0; // re-arm EP0
while(EP01STAT & bmEP0BSY); // wait until EP0 is available to be accessed by CPU
while(!HPI_RDY); // wait for HPI to complete internal portion of previous transfer
IOA = bmHPIC; // select HPIC register
GPIFWFSELECT = 0x1E; // point to waveforms that write first byte of HPI protocol
GPIF_SingleByteWrite(EP0BUF[0]); // write LSB of DSP address
GPIFWFSELECT = 0x4E; // point to waveforms that write second byte of HPI protocol
GPIF_SingleByteWrite(EP0BUF[1]); // write MSB of DSP address
break;
}
case VX_B7: // write to HPIA register
{
EP0BCL = 0; // re-arm EP0
while(EP01STAT & bmEP0BSY); // wait until EP0 is available to be accessed by CPU
while(!HPI_RDY); // wait for HPI to complete internal portion of previous transfer
IOA = bmHPIA; // select HPIA register
GPIFWFSELECT = 0x1E; // point to waveforms that write first byte of HPI protocol
GPIF_SingleByteWrite(EP0BUF[0]); // write LSB of DSP address
GPIFWFSELECT = 0x4E; // point to waveforms that write second byte of HPI protocol
GPIF_SingleByteWrite(EP0BUF[1]); // write MSB of DSP address
break;
}
case VX_B8: // reset EP6 FIFO
{
FIFORESET = 0x80; // set NAKALL bit to NAK all transfers from host
SYNCDELAY;
FIFORESET = 0x06; // reset EP6 FIFO
SYNCDELAY;
FIFORESET = 0x00; // clear NAKALL bit to resume normal operation
SYNCDELAY;
*EP0BUF = VX_B8;
EP0BCH = 0;
EP0BCL = 1;
EP0CS |= bmHSNAK;
break;
}
case VX_B9: // read GPIFTRIG register
{
EP0BUF[0] = VX_B9;
EP0BUF[1] = GPIFTRIG;
EP0BCH = 0;
EP0BCL = 2;
EP0CS |= bmHSNAK;
break;
}
case VX_BA: // read GPIFTC registers
{
EP0BUF[0] = VX_BA;
EP0BUF[1] = GPIFTCB1;
EP0BUF[2] = GPIFTCB0;
EP0BCH = 0;
EP0BCL = 3;
EP0CS |= bmHSNAK;
break;
}
default:
return(TRUE);
}
return(FALSE);
}
//-----------------------------------------------------------------------------
// USB Interrupt Handlers
// The following functions are called by the USB interrupt jump table.
//-----------------------------------------------------------------------------
// Setup Data Available Interrupt Handler
void ISR_Sudav(void) interrupt 0
{
GotSUD = TRUE; // Set flag
EZUSB_IRQ_CLEAR();
USBIRQ = bmSUDAV; // Clear SUDAV IRQ
}
// Setup Token Interrupt Handler
void ISR_Sutok(void) interrupt 0
{
EZUSB_IRQ_CLEAR();
USBIRQ = bmSUTOK; // Clear SUTOK IRQ
}
void ISR_Sof(void) interrupt 0
{
EZUSB_IRQ_CLEAR();
USBIRQ = bmSOF; // Clear SOF IRQ
}
void ISR_Ures(void) interrupt 0
{
// whenever we get a USB reset, we should revert to full speed mode
pConfigDscr = pFullSpeedConfigDscr;
((CONFIGDSCR xdata *) pConfigDscr)->type = CONFIG_DSCR;
pOtherConfigDscr = pHighSpeedConfigDscr;
((CONFIGDSCR xdata *) pOtherConfigDscr)->type = OTHERSPEED_DSCR;
EZUSB_IRQ_CLEAR();
USBIRQ = bmURES; // Clear URES IRQ
}
void ISR_Susp(void) interrupt 0
{
Sleep = TRUE;
EZUSB_IRQ_CLEAR();
USBIRQ = bmSUSP;
}
void ISR_Highspeed(void) interrupt 0
{
if (EZUSB_HIGHSPEED())
{
pConfigDscr = pHighSpeedConfigDscr;
((CONFIGDSCR xdata *) pConfigDscr)->type = CONFIG_DSCR;
pOtherConfigDscr = pFullSpeedConfigDscr;
((CONFIGDSCR xdata *) pOtherConfigDscr)->type = OTHERSPEED_DSCR;
}
EZUSB_IRQ_CLEAR();
USBIRQ = bmHSGRANT;
}
void ISR_Ep0ack(void) interrupt 0
{
}
void ISR_Stub(void) interrupt 0
{
}
void ISR_Ep0in(void) interrupt 0
{
}
void ISR_Ep0out(void) interrupt 0
{
}
void ISR_Ep1in(void) interrupt 0
{
}
void ISR_Ep1out(void) interrupt 0
{
}
void ISR_Ep2inout(void) interrupt 0
{
}
void ISR_Ep4inout(void) interrupt 0
{
}
void ISR_Ep6inout(void) interrupt 0
{
}
void ISR_Ep8inout(void) interrupt 0
{
}
void ISR_Ibn(void) interrupt 0
{
}
void ISR_Ep0pingnak(void) interrupt 0
{
}
void ISR_Ep1pingnak(void) interrupt 0
{
}
void ISR_Ep2pingnak(void) interrupt 0
{
}
void ISR_Ep4pingnak(void) interrupt 0
{
}
void ISR_Ep6pingnak(void) interrupt 0
{
}
void ISR_Ep8pingnak(void) interrupt 0
{
}
void ISR_Errorlimit(void) interrupt 0
{
}
void ISR_Ep2piderror(void) interrupt 0
{
}
void ISR_Ep4piderror(void) interrupt 0
{
}
void ISR_Ep6piderror(void) interrupt 0
{
}
void ISR_Ep8piderror(void) interrupt 0
{
}
void ISR_Ep2pflag(void) interrupt 0
{
}
void ISR_Ep4pflag(void) interrupt 0
{
}
void ISR_Ep6pflag(void) interrupt 0
{
}
void ISR_Ep8pflag(void) interrupt 0
{
}
void ISR_Ep2eflag(void) interrupt 0
{
}
void ISR_Ep4eflag(void) interrupt 0
{
}
void ISR_Ep6eflag(void) interrupt 0
{
}
void ISR_Ep8eflag(void) interrupt 0
{
}
void ISR_Ep2fflag(void) interrupt 0
{
}
void ISR_Ep4fflag(void) interrupt 0
{
}
void ISR_Ep6fflag(void) interrupt 0
{
}
void ISR_Ep8fflag(void) interrupt 0
{
}
void ISR_GpifComplete(void) interrupt 0
{
}
void ISR_GpifWaveform(void) interrupt 0
{
}
// ...debug LEDs: accessed via movx reads only ( through CPLD )
// it may be worth noting here that the default monitor loads at 0xC000
xdata volatile const BYTE LED0_ON _at_ 0x8000;
xdata volatile const BYTE LED0_OFF _at_ 0x8100;
xdata volatile const BYTE LED1_ON _at_ 0x9000;
xdata volatile const BYTE LED1_OFF _at_ 0x9100;
xdata volatile const BYTE LED2_ON _at_ 0xA000;
xdata volatile const BYTE LED2_OFF _at_ 0xA100;
xdata volatile const BYTE LED3_ON _at_ 0xB000;
xdata volatile const BYTE LED3_OFF _at_ 0xB100;
// use this global variable when (de)asserting debug LEDs...
BYTE xdata ledX_rdvar = 0x00;
BYTE xdata LED_State = 0;
void LED_Off (BYTE LED_Mask)
{
if (LED_Mask & bmBIT0)
{
ledX_rdvar = LED0_OFF;
LED_State &= ~bmBIT0;
}
if (LED_Mask & bmBIT1)
{
ledX_rdvar = LED1_OFF;
LED_State &= ~bmBIT1;
}
if (LED_Mask & bmBIT2)
{
ledX_rdvar = LED2_OFF;
LED_State &= ~bmBIT2;
}
if (LED_Mask & bmBIT3)
{
ledX_rdvar = LED3_OFF;
LED_State &= ~bmBIT3;
}
}
void LED_On (BYTE LED_Mask)
{
if (LED_Mask & bmBIT0)
{
ledX_rdvar = LED0_ON;
LED_State |= bmBIT0;
}
if (LED_Mask & bmBIT1)
{
ledX_rdvar = LED1_ON;
LED_State |= bmBIT1;
}
if (LED_Mask & bmBIT2)
{
ledX_rdvar = LED2_ON;
LED_State |= bmBIT2;
}
if (LED_Mask & bmBIT3)
{
ledX_rdvar = LED3_ON;
LED_State |= bmBIT3;
}
}
Binary file not shown.
@@ -0,0 +1,300 @@
:0A0EB7000001020203030404050514
:10031900E4F513F512F511F510C203C200C202C2C9
:1003290001120C447E087F008E238F24752B0875DB
:100339002C1275210875221C752908752A4A752DF4
:1003490008752E7890E680E030E70E852125852214
:1003590026852927852A28800C852925852A268509
:100369002127852228EE54E0700302048A751400BF
:100379007515807E087F008E168F17C374FA9FFF4C
:1003890074089ECF2402CF3400FEE48F0F8E0EF541
:100399000DF50CF50BF50AF509F508AF0FAE0EAD25
:1003A9000DAC0CAB0BAA0AA909A808C3120DF6508B
:1003B9002AE515250BF582E514350AF58374CDF088
:1003C900E4FAF9F8E50B2401F50BEA350AF50AE92F
:1003D9003509F509E83508F50880C0E4F50BF50A93
:1003E900F509F508AF0FAE0EAD0DAC0CAB0BAA0AB3
:1003F900A909A808C3120DF65035AE0AAF0BE517C7
:100409002FF582E5163EF583E0FDE5152FF582E52A
:10041900143EF583EDF0E4FAF9F8EF2401F50BEA5F
:100429003EF50AE93509F509E83508F50880B58585
:10043900142385152474002480FF740834FFFEC337
:10044900E52C9FF52CE52B9EF52BC3E5269FF5267C
:10045900E5259EF525C3E5289FF528E5279EF5277F
:10046900C3E5229FF522E5219EF521C3E52A9FF5E3
:100479002AE5299EF529C3E52E9FF52EE52D9EF542
:100489002DD2E843D82090E668E04409F090E65C74
:10049900E0443DF0D2AF90E680E020E105D20712BA
:1004A90007CD90E680E054F7F0538EF8C20330018F
:1004B90005120080C201300329120ECE5024C20356
:1004C900120E0720001690E682E030E704E020E1F2
:1004D900EF90E682E030E604E020E0E4120AD4126C
:0704E9000ED012068A80C745
:0104F00022E9
:1000800090E6B9E0700302015B14700302020424DD
:10009000FE700302029924FB7003020155147003E1
:1000A00002014F147003020143147003020149243A
:1000B000056003020305120ED2400302031190E60D
:1000C000BBE024FE602C14604724FD6016146031F0
:1000D00024067065E52390E6B3F0E52490E6B4F0DD
:1000E000020311E52B90E6B3F0E52C90E6B4F002A4
:1000F0000311E52590E6B3F0E52690E6B4F002039F
:1001000011E52790E6B3F0E52890E6B4F00203117C
:1001100090E6BAE0FF120DB4AA06A9077B01EA49EE
:10012000600DEE90E6B3F0EF90E6B4F002031190AC
:10013000E6A0E04401F002031190E6A0E04401F0E3
:10014000020311120E9A020311120EC102031112C0
:100150000D04020311120E88020311120ED4400383
:1001600002031190E6B8E0247F602B14603C240267
:1001700060030201FAA200E433FF25E0FFA202E4DB
:10018000334F90E740F0E4A3F090E68AF090E68BDE
:100190007402F0020311E490E740F0A3F090E68AC5
:1001A000F090E68B7402F002031190E6BCE0547EFE
:1001B000FF7E00E0D3948040067C007D0180047CBB
:1001C000007D00EC4EFEED4F24B7F582740E3EF537
:1001D00083E493FF3395E0FEEF24A1FFEE34E68F36
:1001E00082F583E0540190E740F0E4A3F090E68AC2
:1001F000F090E68B7402F002031190E6A0E0440157
:10020000F0020311120ED6400302031190E6B8E08B
:1002100024FE601D2402600302031190E6BAE0B4DC
:100220000105C20002031190E6A0E04401F00203C0
:100230001190E6BAE0705990E6BCE0547EFF7E0073
:10024000E0D3948040067C007D0180047C007D002A
:10025000EC4EFEED4F24B7F582740E3EF583E49329
:10026000FF3395E0FEEF24A1FFEE34E68F82F583A5
:10027000E054FEF090E6BCE05480FF131313541FCB
:10028000FFE0540F2F90E683F0E04420F0020311CA
:1002900090E6A0E04401F08078120ED8507390E60A
:1002A000B8E024FE60202402706790E6BAE0B40152
:1002B00004D200805C90E6BAE06402605490E6A04C
:1002C000E04401F0804B90E6BCE0547EFF7E00E00D
:1002D000D3948040067C007D0180047C007D00EC8E
:1002E0004EFEED4F24B7F582740E3EF583E493FF86
:1002F0003395E0FEEF24A1FFEE34E68F82F583E034
:100300004401F0800C1204F1500790E6A0E0440193
:08031000F090E6A0E04480F04B
:0103180022C2
:030033000207FCC5
:0407FC0053D8EF32AD
:100800001201000200000040470502100000010232
:1008100000010A06000200000040010009022E004B
:1008200001010080320904000004FF0000000705F8
:100830000102000200070581020002000705020212
:100840000002000705860200020009022E000101D5
:100850000080320904000004FF00000007050102C7
:100860004000000705810240000007050202400029
:10087000000705860240000004030904100343003A
:100880007900700072006500730073006E0345000C
:100890005A002D0055005300420020004600580029
:1008A000320020004700500049004600200074003C
:1008B0006F00200054004900200035003400310052
:1008C00036002000480050004900200075007300E9
:1008D00069006E00670020004600490046004F0096
:1008E00020005400720061006E007300610063001C
:0C08F000740069006F006E0073000000CF
:1008FC004210B000004110AF00C104C1064210AB61
:10090C000000C105021B00004110AD004110AE00FB
:0B0EAC00E5BB30E7FB90E6F1EFF02221
:100C440090E600E054E74410F000000090E61074D1
:100C5400A0F090E611F000000090E612F000000011
:100C6400E490E613F000000090E61474E0F0000055
:100C740000E490E615F000000090E6047480F000B3
:100C840000007402F00000007406F0000000E4F0BC
:100C940000000090E618F00000007410F00000005E
:100CA40090E61A7408F0000000E490E68DF0120952
:0F0CB400D390E6707401F043B20CD2A8D288221C
:10068A00E5BB30E73FE5AB20E13A75800490E6F43C
:10069A00E070047F0180027F00EF20E0F00000009C
:1006AA0090E6ABE090E6D0F000000090E6ACE09077
:1006BA00E6D1F0000000E4F5BB000000E5BB30E73E
:1006CA00FB0000003004739010ABE07002A3E060FE
:1006DA0069E5BB30E764E5AC20E05F75800490E62D
:1006EA00F4E070047F0180027F00EF20E0F0000058
:1006FA00009010ABE090E6D0F00000009010ACE063
:10070A0090E6D1F000000075BB06000000E5BB30A2
:10071A00E7FB00000090E6AFE0FE90E6B0E07C0068
:10072A002400F51CEC3EF51BC39402500690E648E3
:10073A007406F0E49010ABF0A3F0300609C206D2BA
:10074A00A87F02120A8F9010B0E475F001120DE032
:10075A00AFF0FEBE2727BF10249010AFE0600C7FD9
:10076A0001120788E49010AFF0800B7F01120A8F04
:0E077A009010AF7401F0E49010B0F0A3F022E4
:020ECE00D3222D
:020ED000D3222B
:020ED200D32229
:100D040090E680E030E71800000090E6247402F0DA
:100D1400000000E490E625F0000000D205801600F3
:100D24000000E490E624F000000090E6257440F012
:0D0D3400000000C20590E6BAE0F51DD322D4
:100E880090E740E51DF0E490E68AF090E68B04F0E8
:020E9800D32263
:080EC10090E6BAE0F51AD32215
:100E9A0090E740E51AF0E490E68AF090E68B04F0D9
:020EAA00D32251
:020ED400D32227
:020ED600D32225
:020ED800D32223
:1004F10090E6B9E0244EB409004003020686900557
:1005010006F828287302052102054002055C020550
:100511007802059A0205D602061102063E02065C21
:100521007F0212078890E74074B2F0E490E68AF007
:1005310090E68B04F090E6A0E04480F0020688D2B9
:100541000490E74074B3F0E490E68AF090E68B04FF
:10055100F090E6A0E04480F0020688C20490E740F3
:1005610074B4F0E490E68AF090E68B04F090E6A093
:10057100E04480F0020688E490E68BF0E5BA20E0E2
:10058100FB90E740E0FEA3E07C0024009010ACF07B
:10059100EC3E9010ABF0020688E490E68BF0E5BAF1
:1005A10020E0FB90E6F4E070047F0180027F00EF21
:1005B10020E0F0E4F58090E6C0741EF090E740E0A2
:1005C100FF120EAC90E6C0744EF090E741E0FF12CE
:1005D1000EAC020688E490E68BF0E5BA20E0FB90D1
:1005E100E6F4E070047F0180027F00EF20E0F07507
:1005F100800890E6C0741EF090E740E0FF120EAC58
:1006010090E6C0744EF090E741E0FF120EAC8077A7
:1006110090E6047480F00000007406F0000000E42D
:10062100F000000090E74074B8F0E490E68AF090A2
:10063100E68B04F090E6A0E04480F0804A90E74029
:1006410074B9F0A3E5BBF0E490E68AF090E68B7410
:1006510002F090E6A0E04480F0802C90E74074BA6C
:10066100F090E6D0E090E741F090E6D1E090E742EB
:10067100F0E490E68AF090E68B7403F090E6A0E057
:090681004480F08002D322C32260
:100E2C00C0E0C083C082D2015391EF90E65D7401A3
:080E3C00F0D082D083D0E03237
:100E5C00C0E0C083C0825391EF90E65D7404F0D083
:060E6C0082D083D0E032C9
:100E7200C0E0C083C0825391EF90E65D7402F0D06F
:060E820082D083D0E032B3
:100D7E00C0E0C083C082852925852A2685268285E6
:100D8E002583A37402F08521278522288528828554
:100D9E002783A37407F05391EF90E65D7410F0D0A3
:060DAE0082D083D0E03288
:100E4400C0E0C083C082D2035391EF90E65D740882
:080E5400F0D082D083D0E0321F
:100D4100C0E0C083C08290E680E030E720852125A5
:100D5100852226852682852583A37402F08529278D
:100D6100852A28852882852783A37407F05391EF6C
:0D0D710090E65D7420F0D082D083D0E03297
:010EDA0032E5
:010EDB0032E4
:010EDC0032E3
:010EDD0032E2
:010EDE0032E1
:010EDF0032E0
:010EE00032DF
:010EE10032DE
:010EE20032DD
:010EE30032DC
:010EE40032DB
:010EE50032DA
:010EE60032D9
:010EE70032D8
:010EE80032D7
:010EE90032D6
:010EEA0032D5
:010EEB0032D4
:010EEC0032D3
:010EED0032D2
:010EEE0032D1
:010EEF0032D0
:010EF00032CF
:010EF10032CE
:010EF20032CD
:010EF30032CC
:010EF40032CB
:010EF50032CA
:010EF60032C9
:010EF70032C8
:010EF80032C7
:010EF90032C6
:010EFA0032C5
:010EFB0032C4
:010EFC0032C3
:010EFD0032C2
:10078800EF30E00D908100E09010ADF0A3E054FE52
:10079800F0EF30E10D909100E09010ADF0A3E0543F
:1007A800FDF0EF30E20D90A100E09010ADF0A3E075
:1007B80054FBF0EF30E30D90B100E09010ADF0A3E2
:0507C800E054F7F022EF
:100A8F00EF30E00D908000E09010ADF0A3E0440156
:100A9F00F0EF30E10D909000E09010ADF0A3E04446
:100AAF0002F0EF30E20D90A000E09010ADF0A3E067
:100ABF004404F0EF30E30D90B000E09010ADF0A3E0
:050ACF00E04408F022E4
:03000300020EC921
:050EC900D206C2A832B0
:03004300020B00AD
:03005300020B009D
:100B0000020E2C00020E7200020E5C00020E440067
:100B1000020D7E00020D4100020EDA00020EDB0023
:100B2000020EDC00020EDD00020EDE00020EDF000F
:100B3000020EE000020EE100020EE200020EE300EF
:100B4000020EE400020EDB00020EE500020EE600DB
:100B5000020EE700020EE800020EE900020EEA00B3
:100B6000020EEB00020EDB00020EDB00020EDB00C9
:100B7000020EEC00020EED00020EEE00020EEF007F
:100B8000020EF000020EF100020EF200020EF3005F
:100B9000020EF400020EF500020EF600020EF7003F
:100BA000020EF800020EF900020EFA00020EFB001F
:080BB000020EFC00020EFD0024
:100AD40090E682E030E004E020E60B90E682E0302D
:100AE400E119E030E71590E680E04401F07F147EE0
:0C0AF40000120CC390E680E054FEF022DB
:100E070090E682E044C0F090E681F043870100005D
:040E170000000022B5
:1007CD0030070990E680E0440AF0800790E680E06B
:1007DD004408F07FDC7E05120CC390E65D74FFF0DB
:0F07ED0090E65FF05391EF90E680E054F7F02232
:020DB400A9078D
:100DB600AE2DAF2E8F828E83A3E064037017AD0134
:100DC60019ED7001228F828E83E07C002FFDEC3EB0
:090DD600FEAF0580DF7E007F0006
:010DDF0022F1
:100CC3008E188F1990E600E05418700DE518C313C1
:100CD300F518E51913F519801590E600E05418FF8F
:100CE300BF100BE51925E0F519E51833F518E519DB
:100CF3001519AE18700215184E6005120E1B80EE02
:010D030022CD
:100E1B007400F58690FDA57C05A3E582458370F9EA
:010E2B0022A4
:10091C006080100001013F0101010107000201008C
:10092C0000000000020002020202020700000000A8
:10093C000000003F01013F0101010107000201001D
:10094C00000000000604060606060607000000006C
:10095C000000003F01010101013801070000020005
:10096C00020100000301070507070707000000004C
:10097C00002D003F010101010138010700020402B2
:10098C00040100000200060406070707000000002F
:10099C00002D003F602410870000000000000000C4
:1009AC00000000000000000000000000000000003B
:1009BC00000000000000000000000000471080E074
:0609CC00000007CE4E0002
:1009D30090E60174CEF090E6F574FFF0901080E09D
:1009E30090E6F3F0901081E090E6C3F0901082E07F
:1009F30090E6C1F0901083E090E6C2F0901085E09D
:100A030090E6C0F0901086E090E6F4F075AF0774BE
:100A130010F59A7400F59B759DE4E4F59EFF90E64E
:100A23007BE090E67CF00FBF80F490E67174FFF0FA
:100A3300F5B490E672E04480F043B680000000E431
:100A430090E6C4F000000090E6C5F0901087E090B7
:100A5300E6C6F0901088E090E6C7F0901089E09029
:100A6300E6C8F090108AE090E6C9F090108BE09011
:100A7300E6CAF090108CE090E6CBF090108DE090F9
:0B0A8300E6CCF090108EE090E6CDF085
:010A8E002245
:03000000020BB838
:0C0BB800787FE4F6D8FD75812E020BFF5B
:100DE000C5F0F8A3E028F0C5F0F8E582158270029E
:060DF0001583E038F0223B
:100DF600EB9FF5F0EA9E42F0E99D42F0E89C45F053
:010E060022C9
:100BC400020319E493A3F8E493A34003F68001F22B
:100BD40008DFF48029E493A3F85407240CC8C33332
:100BE400C4540F4420C8834004F456800146F6DF01
:100BF400E4800B01020408102040809008FCE47E8D
:100C0400019360BCA3FF543F30E509541FFEE493F5
:100C1400A360010ECF54C025E060A840B8E493A3BC
:100C2400FAE493A3F8E493A3C8C582C8CAC583CAE7
:100C3400F0A3C8C582C8CAC583CADFE9DEE780BE9F
:0109D2000024
:00000001FF
Binary file not shown.
+21
View File
@@ -0,0 +1,21 @@
<html>
<head>
<title>You need a browser that supports frame to veiw this page.</title>
<meta name="GENERATOR" content="Namo WebEditor v5.0">
<meta name="description" content="Makes a banner frame in the top, menu frame in the left, and main frame in the right. Hyperlinks in the banner frame are targeted to the menu frame.">
</head>
<frameset rows="60, 78%" cols="1*" border="0">
<frame name="banner" scrolling="no" marginwidth="10" marginheight="14" namo_target_frame="contents" src="app_note/Caption.htm">
<frameset rows="1*" cols="200, 80%">
<frame name="contents" scrolling="auto" marginwidth="10" marginheight="14" namo_target_frame="detail" src="app_note/mainmenu.htm">
<frame name="detail" scrolling="yes" marginwidth="10" marginheight="14" src="app_note/intro.htm">
</frameset>
<noframes>
<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<p>You need a browser that supports frame to veiw this page.</p>
</body>
</noframes>
</frameset>
</html>
@@ -0,0 +1,24 @@
<html>
<head>
<title>Index</title>
<base target="contents"></head>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<table cellpadding="0" cellspacing="0" width="100%" align="center">
<tr>
<td width="198" height="26">
<p align="center"><span style="font-size:12pt;"><font face="Verdana">&nbsp;</font></span></p>
</td>
<td width="441" height="26">
<p align="center"><strong><samp><font color="black" face="Verdana"><span style="font-size:12pt;">DSP
DESIGN EXAMPLE</span></font></samp></strong></p>
</td>
<td width="189" height="26">
<p align="right"><strong><samp><font color="#0000CC" face="Verdana"><span style="font-size:12pt;"><img src="images/smalllogo.gif" width="95" height="30" border="0">&nbsp;</span></font></samp></strong></p>
</td>
</tr>
</table>
<hr></body>
</html>
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

@@ -0,0 +1,266 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>GPIF</title>
<meta name="generator" content="BBEdit 6.0">
<script language="Javascript">
<!--
function changeGPIF(html)
{
descriptionGPIF.innerHTML=html
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF">
<table border="0" cellpadding="0" cellspacing="0" width="98%" align="center">
<tr valign="top">
<td colspan="1" align="left">
<p align="center"><font face="Verdana,Arial" size="2" color="#000000"><B><a name="Overview"></a></B></font><font face="verdana, arial, helvetica, sans-serif" size="2" color="#000000"><B>Interfacing to a TI 5416 DSP via the Host Port Interface (HPI)</B><br></font><font size="2" face="Verdana">
<br></font>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left">
<font face="verdana, arial, helvetica, sans-serif" size="2" color="#000000"><B>Background on the TI 5416 DSP and Overview</B></font><font face="Verdana,Arial" size="2" color="#000000">&nbsp;</font>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left">
<p>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">The Texas Instruments TI 5416 fixed-point DSP finds its home in many mid range DSP applications. It is supported by the TI 5416 DSK, which proved very
attractive as the choice for this example because it exposes the HPI on one of the three expansion headers of the DSK board. The HPI allows a host processor
access to the internal RAM of the 5416, thereby enabling the transfer of data between the host processor and the 5416.<br>
<br>
By interfacing the FX2 to the 5416's HPI, this allows developers of embedded audio and imaging applications to easily add a high
speed USB port. The FX2 can also bootload the 5416 DSP code via the HPI. In this example, users will be shown how to interface
the FX2 to the 5416 HPI using the GPIF to accomplish two things: 1) read and write to the internal RAM block of the 5416, and
2) bootload the 5416 by downloading the DSP code from the PC. For detailed information about how the HPI block of the 5416
works, please refer to the TI documentation mentioned in the references section at the end of this document. Note that the
information presented here may also be applicable to other TI DSPs that expose the HPI port.<br>
<br>
</font>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left">
<font face="verdana, arial, helvetica, sans-serif" size="2" color="#000000"><B><a name="Physical"></a>Hardware
Connections</B></font>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left">
<p>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">This section discusses the definition of the GPIF interconnect which is shown below in Figure 13.<br>
</font>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="center">
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><br>
<img src="images/dsp-ic.gif" align="center" width="525" height="300" border="0" ismap usemap="#ic_map"><br>
Figure 13. GPIF Interconnect to TI 5416 HPI<br>
<br>
</font>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left">
<ul>
<p><font face="Verdana" size="1"><b>PA3, PA2 ----&gt; HCNTL[1:0]</b><br>Port
pins PA3 and PA2 are used to provide address lines to select
either the HPIC, HPIA, or HPID registers of the HPI. The FX2
reads and writes data by accessing these registers.</font><font face="Verdana,Arial" size="1" color="#000000">&nbsp;
</font></p>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="left">
<ul>
<p><font face="Verdana" size="1"><b>FD[7:0] &lt;----&gt; HD[7:0]</b><br>The
lower portion of the GPIF data bus (FD[7:0]) is connected to
the HPI data bus (HD[7:0]). The FX2 uses this connection for
exchange of information between itself and the HPI.&nbsp;</font></p>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="left">
<ul>
<p><font face="Verdana" size="1"><b>CTL0 ----&gt; HRNW</b><br>CTL0
is connected to the HRNW signal of the HPI. If HRNW is a 1,
this indicates a read access to the HPI. If HRNW is a 0, this
indicates a write access to the HPI.&nbsp;</font></p>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="left">
<ul>
<p><font face="Verdana" size="1"><b>CTL1 ----&gt; HDS1</b><br>CTL1
is connected to the HDS1/ strobe of the HPI. The falling edge
of HDS1/ marks the beginning of the HPI access, and samples
the value of HRNW, HCNTL[1:0], and HBIL. The rising edge of
HDS1/ marks the end of the HPI access.&nbsp;</font></p>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="left">
<ul>
<p><font face="Verdana" size="1"><b>CTL2 ----&gt; HBIL</b><br>CTL2
is connected to the HBIL signal of the HPI. A complete HPI access
consists of a two byte transfer. If HBIL is 0, this indicates
to the HPI that the first byte is being transferred. To indicate
to the HPI that the second byte is being transferred, HBIL must
be 1.</font></p>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="left">
<ul>
<p><font face="Verdana" size="1"><b>RDY0 &lt;---- HRDY</b><br>RDY0
is connected to the HRDY/ signal of the HPI. HRDY/ is low when
the HPI is completing the internal portion of a complete HPI
access. Another access to the HPI must not be performed until
the internal portion of the transfer is complete. This signal
is monitored by the GPIF.</font></p>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="left">
<ul>
<p><font face="Verdana" size="1"><b>INT0 &lt;---- HINT, INT2</b><br>The
INT0/ interrupt signal on the FX2 is conected the HINT/ output
of the HPI. When the DSP is reset, the HINT/ will be asserted.
The DSP can also use this as a general purpose interrupt to
the FX2. The HINT/ signal is also tied to the 5416&amp;rsquo;s
INT2/ pin to allow the FX2 to be able to bootload the DSP code.</font></p>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="left">
<ul>
<p><font face="Verdana" size="1"><b>GND &lt;----&gt; GND</b><br>Ground</font></p>
</ul>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left">
<ul>
<p><font face="Verdana" size="1"><b>HCS, HPI_16</b><br>HPI_16
is tied to ground to make the HPI operate in 8-bit mode (HPI-8).
The HPI can operate in 16-bit mode (HPI-16) if the 5416&amp;rsquo;s
external memory interface is not used (EMIF). For most DSP applications,
the EMIF will already be used for memory expansion. Using the
HPI in 8-bit mode also simplifies the GPIF interface. HCS/ is
tied to ground to allow continuous access to the HPI.</font></p>
</ul>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left">
<ul>
<p><font face="Verdana" size="1"><b>HDS2, HAS, HPI_EN</b><br>HPI_EN
is tied to VCC to enable the HPI port. HAS/ and HDS2/ are tied
to VCC since they are not necessary for this interface (attributed
in part to the flexibility of the GPIF interface).</font></p>
</ul>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left">
<p>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">The assignment of CTL and RDY lines was optimized for the FX2 56-pin package. The connection between the TI 5416
DSK board and the FX2 development board was accomplished through the use of a ribbon cable set. The TI 5416 DSK board
exposes headers that require breakout panels (available from <A href="http://www.dspglobal.com" target="resource window">www.dspglobal.com</A>) for prototyping purposes. The ribbon cables
connect between a breakout panel installed on the DSK board's P3 and the FX2 prototype board mounted onto the FX2 development
board. Figure 14 shows a snap of the actual hardware setup.<br>
<br></font> <p align="center">
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><br><img src="images/setup.jpg" align="center" width="298" height="200" border="0"><br>Figure 14. Shot of Actual Hardware Setup<br><br>&nbsp;</font></p>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left">
<font face="verdana, arial, helvetica, sans-serif" size="2" color="#000000"><B><a name="DataFlow"></a>Application-specific Data Flow</B><br>
</font>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left">
<p>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">Now that the GPIF interconnect has been presented, it's important to understand the overall data flow for this design example.
EP2OUT (4x buffered) is the source endpoint used for data writes to the HPI and EP6IN (4x buffered) is the sink endpoint used
for data reads from the HPI. EP0, the FX2's control endpoint, is used for writes to the HPIC and HPIA registers.<br>
<br>
Before a data read or write can commence to and from a specific address in the DSP, the HPIA needs to be setup with the
appropriate source or destination address. The HPIC also needs to be setup to set the BOB bit to 1, which allows the first byte
of transfer to be the LSB and the second byte of the transfer to be the MSB (as organized in the DSP memory). Since the 5416
supports an extended address scheme, the XPHIA bit in the HPIC register needs to be set if FX2 wants to access the upper
seven bits of the HPIA register. The XPHIA bit also needs to be set if proper auto-increment of the address is to occur when
consecutive data read and write accesses are made.<br>
<br>
Figure 15 and Figure 16 show the data flow models for this example. GPIF single transactions are used to write out the data from EP0 to the
HPIC and HPIA registers. GPIF FIFO transactions are used for data reads and writes using EP6IN and EP2OUT in auto mode, respectively.<br></font>
<ul>
<ul>
<p><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><img src="images/dsp-out.gif" width="300" height="180" align="center" border="0"> <br>Figure 15. Data Flow Model in the <B>OUT</B> direction&nbsp;</font></p>
</ul>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="center">
<ul>
<ul>
<p align="left"><font face="Verdana" size="1"><br>&nbsp;</font><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><img src="images/dsp-in.gif" width="300" height="180" align="center" border="0"><br>Figure 16. Data Flow Model in the <B>IN</B> direction&nbsp;</font></p>
</ul>
</ul>
<p align="left">&nbsp;</p>
</td>
</tr>
<tr>
<td colspan="1" align="center">
<p align="left"><font face="Verdana" size="1">&nbsp;</font></p>
</td>
</tr>
<tr>
<td colspan="1" align="center">
<p align="left"><font face="Verdana" size="1">&nbsp;</font></p>
</td>
</tr>
</table>
</body>
</html>
@@ -0,0 +1,33 @@
<html>
<head>
<title>Contents</title>
<base target="detail"></head>
<body bgcolor="#CCCCCC" text="black" link="blue" vlink="purple" alink="red">
<p align="left"><font face="Verdana" size="1"><b><a href="intro.htm#Overview">Overview</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;</b><a href="intro.htm#Physical">Hardware Connections</a><br> &nbsp;&nbsp;&nbsp;<a href="intro.htm#DataFlow">App-specific
Data Flow</a><br><br> <b><a href="DSPXactions.htm#DSPXactions">GPIF
Transactions<br></a> </b>&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#WaveformDescriptors">Waveform Descriptors<br></a> &nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#FW">Firmware</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#Files">FW
Files<br></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#TD_Init(">TD_Init()
function</a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#IFCONFIG">IFCONFIG
Register</a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#WritingHPIC">Writing
HPIC and HPIA</a><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#HPIRdWr">Read
/ Write the HPI</a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#INT0">Handling
INT0</a><br>&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#Running">Running the example</a><b><br>
</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#Running">Step
1: Download FW</a><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#Step2">Step
2: Write to the&nbsp;HPI</a><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#Step3">Step
3: Read from HPI</a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#Step4">Step
4: Load DSP code</a><br>&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#Traces">Logic
Analyzer Traces</a><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#WriteHPIC1">Write
HPIC</a><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#WriteHPIC2">Write
HPIC: 1st Byte</a><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#WriteHPIC3">Write
HPIC: 2nd Byte</a><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#FIFOWrHPI1">FIFO
Write HPI</a><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#FIFOWrHPI2">FIFOWr&nbsp;HPI:
Close-up</a><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#FIFORdHPI">FIFORd&nbsp;HPI:
Close-up</a><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="DSPXactions.htm#DnLoadDSP">Download
DSP Code</a><br> </font></p>
</body>
@@ -0,0 +1,30 @@
const char xdata WaveData[128] =
{
// Wave 0
/* LenBr */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x38, 0x01, 0x07,
/* Opcode*/ 0x00, 0x00, 0x02, 0x00, 0x02, 0x01, 0x00, 0x00,
/* Output*/ 0xFB, 0xF9, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF,
/* LFun */ 0x00, 0x12, 0x12, 0x12, 0x00, 0x2D, 0x12, 0x3F,
// Wave 1
/* LenBr */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x38, 0x01, 0x07,
/* Opcode*/ 0x00, 0x02, 0x04, 0x02, 0x04, 0x01, 0x00, 0x00,
/* Output*/ 0xFA, 0xF8, 0xFE, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF,
/* LFun */ 0x00, 0x12, 0x12, 0x12, 0x00, 0x2D, 0x12, 0x3F,
// Wave 2
/* LenBr */ 0x01, 0x01, 0x3F, 0x01, 0x01, 0x01, 0x01, 0x07,
/* Opcode*/ 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
/* Output*/ 0xFE, 0xFC, 0xFE, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF,
/* LFun */ 0x00, 0x12, 0x12, 0x12, 0x00, 0x2D, 0x12, 0x3F,
// Wave 3
/* LenBr */ 0x01, 0x01, 0x3F, 0x01, 0x01, 0x01, 0x01, 0x07,
/* Opcode*/ 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
/* Output*/ 0xFA, 0xF8, 0xFA, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF,
/* LFun */ 0x00, 0x12, 0x12, 0x12, 0x00, 0x2D, 0x12, 0x3F
};
// END DO NOT EDIT
// DO NOT EDIT ...
const char xdata InitData[7] =
{
/* Regs */ 0xC0,0x80,0x00,0xFF,0x06,0xE4,0x11
};
+265
View File
@@ -0,0 +1,265 @@
;;-----------------------------------------------------------------------------
;; File: dscr.a51
;; Contents: This file contains descriptor data tables.
;;
;; Copyright (c) 2002 Cypress Semiconductor, Inc. All rights reserved
;;-----------------------------------------------------------------------------
DSCR_DEVICE equ 1 ;; Descriptor type: Device
DSCR_CONFIG equ 2 ;; Descriptor type: Configuration
DSCR_STRING equ 3 ;; Descriptor type: String
DSCR_INTRFC equ 4 ;; Descriptor type: Interface
DSCR_ENDPNT equ 5 ;; Descriptor type: Endpoint
DSCR_DEVQUAL equ 6 ;; Descriptor type: Device Qualifier
DSCR_DEVICE_LEN equ 18
DSCR_CONFIG_LEN equ 9
DSCR_INTRFC_LEN equ 9
DSCR_ENDPNT_LEN equ 7
DSCR_DEVQUAL_LEN equ 10
ET_CONTROL equ 0 ;; Endpoint type: Control
ET_ISO equ 1 ;; Endpoint type: Isochronous
ET_BULK equ 2 ;; Endpoint type: Bulk
ET_INT equ 3 ;; Endpoint type: Interrupt
public DeviceDscr, DeviceQualDscr, HighSpeedConfigDscr, FullSpeedConfigDscr, StringDscr, UserDscr
DSCR SEGMENT CODE PAGE
;;-----------------------------------------------------------------------------
;; Global Variables
;;-----------------------------------------------------------------------------
rseg DSCR ;; locate the descriptor table in on-part memory.
DeviceDscr:
db DSCR_DEVICE_LEN ;; Descriptor length
db DSCR_DEVICE ;; Decriptor type
dw 0002H ;; Specification Version (BCD)
db 00H ;; Device class
db 00H ;; Device sub-class
db 00H ;; Device sub-sub-class
db 64 ;; Maximum packet size
dw 4705H ;; Vendor ID
dw 0210H ;; Product ID (Sample Device)
dw 0000H ;; Product version ID
db 1 ;; Manufacturer string index
db 2 ;; Product string index
db 0 ;; Serial number string index
db 1 ;; Number of configurations
DeviceQualDscr:
db DSCR_DEVQUAL_LEN ;; Descriptor length
db DSCR_DEVQUAL ;; Decriptor type
dw 0002H ;; Specification Version (BCD)
db 00H ;; Device class
db 00H ;; Device sub-class
db 00H ;; Device sub-sub-class
db 64 ;; Maximum packet size
db 1 ;; Number of configurations
db 0 ;; Reserved
HighSpeedConfigDscr:
db DSCR_CONFIG_LEN ;; Descriptor length
db DSCR_CONFIG ;; Descriptor type
db (HighSpeedConfigDscrEnd-HighSpeedConfigDscr) mod 256 ;; Total Length (LSB)
db (HighSpeedConfigDscrEnd-HighSpeedConfigDscr) / 256 ;; Total Length (MSB)
db 1 ;; Number of interfaces
db 1 ;; Configuration number
db 0 ;; Configuration string
db 10000000b ;; Attributes (b7 - buspwr, b6 - selfpwr, b5 - rwu)
db 50 ;; Power requirement (div 2 ma)
;; Interface Descriptor
db DSCR_INTRFC_LEN ;; Descriptor length
db DSCR_INTRFC ;; Descriptor type
db 0 ;; Zero-based index of this interface
db 0 ;; Alternate setting
db 4 ;; Number of end points
db 0ffH ;; Interface class
db 00H ;; Interface sub class
db 00H ;; Interface sub sub class
db 0 ;; Interface descriptor string index
;; Endpoint Descriptor
db DSCR_ENDPNT_LEN ;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 01H ;; Endpoint number, and direction
db ET_BULK ;; Endpoint type
db 00H ;; Maximum packet size (LSB)
db 02H ;; Maximum packet size (MSB)
db 00H ;; Polling interval
;; Endpoint Descriptor
db DSCR_ENDPNT_LEN ;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 81H ;; Endpoint number, and direction
db ET_BULK ;; Endpoint type
db 00H ;; Maximum packet size (LSB)
db 02H ;; Maximum packet size (MSB)
db 00H ;; Polling interval
;; Endpoint Descriptor
db DSCR_ENDPNT_LEN ;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 02H ;; Endpoint number, and direction
db ET_BULK ;; Endpoint type
db 00H ;; Maximum packet size (LSB)
db 02H ;; Maximum packet size (MSB)
db 00H ;; Polling interval
;; Endpoint Descriptor
db DSCR_ENDPNT_LEN ;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 86H ;; Endpoint number, and direction
db ET_BULK ;; Endpoint type
db 00H ;; Maximum packet size (LSB)
db 02H ;; Maximum packet size (MSB)
db 00H ;; Polling interval
HighSpeedConfigDscrEnd:
FullSpeedConfigDscr:
db DSCR_CONFIG_LEN ;; Descriptor length
db DSCR_CONFIG ;; Descriptor type
db (FullSpeedConfigDscrEnd-FullSpeedConfigDscr) mod 256 ;; Total Length (LSB)
db (FullSpeedConfigDscrEnd-FullSpeedConfigDscr) / 256 ;; Total Length (MSB)
db 1 ;; Number of interfaces
db 1 ;; Configuration number
db 0 ;; Configuration string
db 10000000b ;; Attributes (b7 - buspwr, b6 - selfpwr, b5 - rwu)
db 50 ;; Power requirement (div 2 ma)
;; Interface Descriptor
db DSCR_INTRFC_LEN ;; Descriptor length
db DSCR_INTRFC ;; Descriptor type
db 0 ;; Zero-based index of this interface
db 0 ;; Alternate setting
db 4 ;; Number of end points
db 0ffH ;; Interface class
db 00H ;; Interface sub class
db 00H ;; Interface sub sub class
db 0 ;; Interface descriptor string index
;; Endpoint Descriptor
db DSCR_ENDPNT_LEN ;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 01H ;; Endpoint number, and direction
db ET_BULK ;; Endpoint type
db 40H ;; Maximum packet size (LSB)
db 00H ;; Maximum packet size (MSB)
db 00H ;; Polling interval
;; Endpoint Descriptor
db DSCR_ENDPNT_LEN ;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 81H ;; Endpoint number, and direction
db ET_BULK ;; Endpoint type
db 40H ;; Maximum packet size (LSB)
db 00H ;; Maximum packet size (MSB)
db 00H ;; Polling interval
;; Endpoint Descriptor
db DSCR_ENDPNT_LEN ;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 02H ;; Endpoint number, and direction
db ET_BULK ;; Endpoint type
db 40H ;; Maximun packet size (LSB)
db 00H ;; Maximum packet size (MSB)
db 00H ;; Polling interval
;; Endpoint Descriptor
db DSCR_ENDPNT_LEN ;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 86H ;; Endpoint number, and direction
db ET_BULK ;; Endpoint type
db 40H ;; Maximum packet size (LSB)
db 00H ;; Maximum packet size (MSB)
db 00H ;; Polling interval
FullSpeedConfigDscrEnd:
StringDscr:
StringDscr0:
db StringDscr0End-StringDscr0 ;; String descriptor length
db DSCR_STRING
db 09H,04H
StringDscr0End:
StringDscr1:
db StringDscr1End-StringDscr1 ;; String descriptor length
db DSCR_STRING
db 'C',00
db 'y',00
db 'p',00
db 'r',00
db 'e',00
db 's',00
db 's',00
StringDscr1End:
StringDscr2:
db StringDscr2End-StringDscr2 ;; Descriptor length
db DSCR_STRING
db 'E',00
db 'Z',00
db '-',00
db 'U',00
db 'S',00
db 'B',00
db ' ',00
db 'F',00
db 'X',00
db '2',00
db ' ',00
db 'G',00
db 'P',00
db 'I',00
db 'F',00
db ' ',00
db 't',00
db 'o',00
db ' ',00
db 'T',00
db 'I',00
db ' ',00
db '5',00
db '4',00
db '1',00
db '6',00
db ' ',00
db 'H',00
db 'P',00
db 'I',00
db ' ',00
db 'u',00
db 's',00
db 'i',00
db 'n',00
db 'g',00
db ' ',00
db 'F',00
db 'I',00
db 'F',00
db 'O',00
db ' ',00
db 'T',00
db 'r',00
db 'a',00
db 'n',00
db 's',00
db 'a',00
db 'c',00
db 't',00
db 'i',00
db 'o',00
db 'n',00
db 's',00
StringDscr2End:
UserDscr:
dw 0000H
end
+366
View File
@@ -0,0 +1,366 @@
//-----------------------------------------------------------------------------
// File: fw.c
// Contents: Firmware frameworks task dispatcher and device request parser
// source.
//
// indent 3. NO TABS!
//
// $Revision: 17 $
// $Date: 11/15/01 5:45p $
//
// Copyright (c) 2002 Cypress Semiconductor, Inc. All rights reserved
//-----------------------------------------------------------------------------
#include "fx2.h"
#include "fx2regs.h"
//-----------------------------------------------------------------------------
// Constants
//-----------------------------------------------------------------------------
#define DELAY_COUNT 0x9248*8L // Delay for 8 sec at 24Mhz, 4 sec at 48
#define _IFREQ 48000 // IFCLK constant for Synchronization Delay
#define _CFREQ 48000 // CLKOUT constant for Synchronization Delay
//-----------------------------------------------------------------------------
// Random Macros
//-----------------------------------------------------------------------------
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
// Registers which require a synchronization delay, see section 15.14
// FIFORESET FIFOPINPOLAR
// INPKTEND OUTPKTEND
// EPxBCH:L REVCTL
// GPIFTCB3 GPIFTCB2
// GPIFTCB1 GPIFTCB0
// EPxFIFOPFH:L EPxAUTOINLENH:L
// EPxFIFOCFG EPxGPIFFLGSEL
// PINFLAGSxx EPxFIFOIRQ
// EPxFIFOIE GPIFIRQ
// GPIFIE GPIFADRH:L
// UDMACRCH:L EPxGPIFTRIG
// GPIFTRIG
// Note: The pre-REVE EPxGPIFTCH/L register are affected, as well...
// ...these have been replaced by GPIFTC[B3:B0] registers
#include "fx2sdly.h" // Define _IFREQ and _CFREQ above this #include
//-----------------------------------------------------------------------------
// Global Variables
//-----------------------------------------------------------------------------
volatile BOOL GotSUD;
BOOL Rwuen;
BOOL Selfpwr;
volatile BOOL Sleep; // Sleep mode enable flag
WORD pDeviceDscr; // Pointer to Device Descriptor; Descriptors may be moved
WORD pDeviceQualDscr;
WORD pHighSpeedConfigDscr;
WORD pFullSpeedConfigDscr;
WORD pConfigDscr;
WORD pOtherConfigDscr;
WORD pStringDscr;
//-----------------------------------------------------------------------------
// Prototypes
//-----------------------------------------------------------------------------
void SetupCommand(void);
void TD_Init(void);
void TD_Poll(void);
BOOL TD_Suspend(void);
BOOL TD_Resume(void);
BOOL DR_GetDescriptor(void);
BOOL DR_SetConfiguration(void);
BOOL DR_GetConfiguration(void);
BOOL DR_SetInterface(void);
BOOL DR_GetInterface(void);
BOOL DR_GetStatus(void);
BOOL DR_ClearFeature(void);
BOOL DR_SetFeature(void);
BOOL DR_VendorCmnd(void);
// this table is used by the epcs macro
const char code EPCS_Offset_Lookup_Table[] =
{
0, // EP1OUT
1, // EP1IN
2, // EP2OUT
2, // EP2IN
3, // EP4OUT
3, // EP4IN
4, // EP6OUT
4, // EP6IN
5, // EP8OUT
5, // EP8IN
};
// macro for generating the address of an endpoint's control and status register (EPnCS)
#define epcs(EP) (EPCS_Offset_Lookup_Table[(EP & 0x7E) | (EP > 128)] + 0xE6A1)
//-----------------------------------------------------------------------------
// Code
//-----------------------------------------------------------------------------
// Task dispatcher
void main(void)
{
DWORD i;
WORD offset;
DWORD DevDescrLen;
DWORD j=0;
WORD IntDescrAddr;
WORD ExtDescrAddr;
// Initialize Global States
Sleep = FALSE; // Disable sleep mode
Rwuen = FALSE; // Disable remote wakeup
Selfpwr = FALSE; // Disable self powered
GotSUD = FALSE; // Clear "Got setup data" flag
// Initialize user device
TD_Init();
// The following section of code is used to relocate the descriptor table.
// Since the SUDPTRH and SUDPTRL are assigned the address of the descriptor
// table, the descriptor table must be located in on-part memory.
// The 4K demo tools locate all code sections in external memory.
// The descriptor table is relocated by the frameworks ONLY if it is found
// to be located in external memory.
pDeviceDscr = (WORD)&DeviceDscr;
pDeviceQualDscr = (WORD)&DeviceQualDscr;
pHighSpeedConfigDscr = (WORD)&HighSpeedConfigDscr;
pFullSpeedConfigDscr = (WORD)&FullSpeedConfigDscr;
pStringDscr = (WORD)&StringDscr;
if (EZUSB_HIGHSPEED())
{
pConfigDscr = pHighSpeedConfigDscr;
pOtherConfigDscr = pFullSpeedConfigDscr;
}
else
{
pConfigDscr = pFullSpeedConfigDscr;
pOtherConfigDscr = pHighSpeedConfigDscr;
}
if ((WORD)&DeviceDscr & 0xe000)
{
IntDescrAddr = INTERNAL_DSCR_ADDR;
ExtDescrAddr = (WORD)&DeviceDscr;
DevDescrLen = (WORD)&UserDscr - (WORD)&DeviceDscr + 2;
for (i = 0; i < DevDescrLen; i++)
*((BYTE xdata *)IntDescrAddr+i) = 0xCD;
for (i = 0; i < DevDescrLen; i++)
*((BYTE xdata *)IntDescrAddr+i) = *((BYTE xdata *)ExtDescrAddr+i);
pDeviceDscr = IntDescrAddr;
offset = (WORD)&DeviceDscr - INTERNAL_DSCR_ADDR;
pDeviceQualDscr -= offset;
pConfigDscr -= offset;
pOtherConfigDscr -= offset;
pHighSpeedConfigDscr -= offset;
pFullSpeedConfigDscr -= offset;
pStringDscr -= offset;
}
EZUSB_IRQ_ENABLE(); // Enable USB interrupt (INT2)
EZUSB_ENABLE_RSMIRQ(); // Wake-up interrupt
INTSETUP |= (bmAV2EN | bmAV4EN); // Enable INT 2 & 4 autovectoring
USBIE |= bmSUDAV | bmSUTOK | bmSUSP | bmURES | bmHSGRANT; // Enable selected interrupts
EA = 1; // Enable 8051 interrupts
#ifndef NO_RENUM
// Renumerate if necessary. Do this by checking the renum bit. If it
// is already set, there is no need to renumerate. The renum bit will
// already be set if this firmware was loaded from an eeprom.
if(!(USBCS & bmRENUM))
{
EZUSB_Discon(TRUE); // renumerate
}
#endif
// unconditionally re-connect. If we loaded from eeprom we are
// disconnected and need to connect. If we just renumerated this
// is not necessary but doesn't hurt anything
USBCS &=~bmDISCON;
CKCON = (CKCON&(~bmSTRETCH)) | FW_STRETCH_VALUE; // Set stretch to 0 (after renumeration)
// clear the Sleep flag.
Sleep = FALSE;
// Task Dispatcher
while(TRUE) // Main Loop
{
if(GotSUD) // Wait for SUDAV
{
SetupCommand(); // Implement setup command
GotSUD = FALSE; // Clear SUDAV flag
}
// Poll User Device
// NOTE: Idle mode stops the processor clock. There are only two
// ways out of idle mode, the WAKEUP pin, and detection of the USB
// resume state on the USB bus. The timers will stop and the
// processor will not wake up on any other interrupts.
if (Sleep)
{
if(TD_Suspend())
{
Sleep = FALSE; // Clear the "go to sleep" flag. Do it here to prevent any race condition between wakeup and the next sleep.
do
{
EZUSB_Susp(); // Place processor in idle mode.
}
while(!Rwuen && EZUSB_EXTWAKEUP());
// Must continue to go back into suspend if the host has disabled remote wakeup
// *and* the wakeup was caused by the external wakeup pin.
// 8051 activity will resume here due to USB bus or Wakeup# pin activity.
EZUSB_Resume(); // If source is the Wakeup# pin, signal the host to Resume.
TD_Resume();
}
}
TD_Poll();
}
}
// Device request parser
void SetupCommand(void)
{
void *dscr_ptr;
switch(SETUPDAT[1])
{
case SC_GET_DESCRIPTOR: // *** Get Descriptor
if(DR_GetDescriptor())
switch(SETUPDAT[3])
{
case GD_DEVICE: // Device
SUDPTRH = MSB(pDeviceDscr);
SUDPTRL = LSB(pDeviceDscr);
break;
case GD_DEVICE_QUALIFIER: // Device Qualifier
SUDPTRH = MSB(pDeviceQualDscr);
SUDPTRL = LSB(pDeviceQualDscr);
break;
case GD_CONFIGURATION: // Configuration
SUDPTRH = MSB(pConfigDscr);
SUDPTRL = LSB(pConfigDscr);
break;
case GD_OTHER_SPEED_CONFIGURATION: // Other Speed Configuration
SUDPTRH = MSB(pOtherConfigDscr);
SUDPTRL = LSB(pOtherConfigDscr);
break;
case GD_STRING: // String
if(dscr_ptr = (void *)EZUSB_GetStringDscr(SETUPDAT[2]))
{
SUDPTRH = MSB(dscr_ptr);
SUDPTRL = LSB(dscr_ptr);
}
else
EZUSB_STALL_EP0(); // Stall End Point 0
break;
default: // Invalid request
EZUSB_STALL_EP0(); // Stall End Point 0
}
break;
case SC_GET_INTERFACE: // *** Get Interface
DR_GetInterface();
break;
case SC_SET_INTERFACE: // *** Set Interface
DR_SetInterface();
break;
case SC_SET_CONFIGURATION: // *** Set Configuration
DR_SetConfiguration();
break;
case SC_GET_CONFIGURATION: // *** Get Configuration
DR_GetConfiguration();
break;
case SC_GET_STATUS: // *** Get Status
if(DR_GetStatus())
switch(SETUPDAT[0])
{
case GS_DEVICE: // Device
EP0BUF[0] = ((BYTE)Rwuen << 1) | (BYTE)Selfpwr;
EP0BUF[1] = 0;
EP0BCH = 0;
EP0BCL = 2;
break;
case GS_INTERFACE: // Interface
EP0BUF[0] = 0;
EP0BUF[1] = 0;
EP0BCH = 0;
EP0BCL = 2;
break;
case GS_ENDPOINT: // End Point
EP0BUF[0] = *(BYTE xdata *) epcs(SETUPDAT[4]) & bmEPSTALL;
EP0BUF[1] = 0;
EP0BCH = 0;
EP0BCL = 2;
break;
default: // Invalid Command
EZUSB_STALL_EP0(); // Stall End Point 0
}
break;
case SC_CLEAR_FEATURE: // *** Clear Feature
if(DR_ClearFeature())
switch(SETUPDAT[0])
{
case FT_DEVICE: // Device
if(SETUPDAT[2] == 1)
Rwuen = FALSE; // Disable Remote Wakeup
else
EZUSB_STALL_EP0(); // Stall End Point 0
break;
case FT_ENDPOINT: // End Point
if(SETUPDAT[2] == 0)
{
*(BYTE xdata *) epcs(SETUPDAT[4]) &= ~bmEPSTALL;
EZUSB_RESET_DATA_TOGGLE( SETUPDAT[4] );
}
else
EZUSB_STALL_EP0(); // Stall End Point 0
break;
}
break;
case SC_SET_FEATURE: // *** Set Feature
if(DR_SetFeature())
switch(SETUPDAT[0])
{
case FT_DEVICE: // Device
if(SETUPDAT[2] == 1)
Rwuen = TRUE; // Enable Remote Wakeup
else if(SETUPDAT[2] == 2)
// Set Feature Test Mode. The core handles this request. However, it is
// necessary for the firmware to complete the handshake phase of the
// control transfer before the chip will enter test mode. It is also
// necessary for FX2 to be physically disconnected (D+ and D-)
// from the host before it will enter test mode.
break;
else
EZUSB_STALL_EP0(); // Stall End Point 0
break;
case FT_ENDPOINT: // End Point
*(BYTE xdata *) epcs(SETUPDAT[4]) |= bmEPSTALL;
break;
}
break;
default: // *** Invalid Command
if(DR_VendorCmnd())
EZUSB_STALL_EP0(); // Stall End Point 0
}
// Acknowledge handshake phase of device request
EP0CS |= bmHSNAK;
}
// Wake-up interrupt handler
void resume_isr(void) interrupt WKUP_VECT
{
EZUSB_CLEAR_RSMIRQ();
}
+292
View File
@@ -0,0 +1,292 @@
// This program configures the General Programmable Interface (GPIF) for FX2.
// Please do not modify sections of text which are marked as "DO NOT EDIT ...".
//
// DO NOT EDIT ...
// GPIF Initialization
// Interface Timing Sync
// Internal Ready Init IntRdy=1
// CTL Out Tristate-able Binary
// SingleWrite WF Select 1
// SingleRead WF Select 0
// FifoWrite WF Select 3
// FifoRead WF Select 2
// Data Bus Idle Drive Tristate
// END DO NOT EDIT
// DO NOT EDIT ...
// GPIF Wave Names
// Wave 0 = SnglWr1
// Wave 1 = SnglWr2
// Wave 2 = FIFORd
// Wave 3 = FIFOWr
// GPIF Ctrl Outputs Level
// CTL 0 = HR/W* CMOS
// CTL 1 = HDS1* CMOS
// CTL 2 = HBIL CMOS
// CTL 3 = CTL3 CMOS
// CTL 4 = CTL4 CMOS
// CTL 5 = CTL5 CMOS
// GPIF Rdy Inputs
// RDY0 = HRDY*
// RDY1 = HDS1*
// RDY2 = HBIL
// RDY3 = RDY3
// RDY4 = RDY4
// RDY5 = TCXpire
// FIFOFlag = FIFOFlag
// IntReady = IntReady
// END DO NOT EDIT
// DO NOT EDIT ...
//
// GPIF Waveform 0: SnglWr1
//
// Interval 0 1 2 3 4 5 6 Idle (7)
// _________ _________ _________ _________ _________ _________ _________ _________
//
// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val
// DataMode NO Data Activate NO Data NO Data NO Data NO Data NO Data
// NextData SameData SameData NextData SameData SameData SameData SameData
// Int Trig No Int No Int No Int No Int No Int No Int No Int
// IF/Wait Wait 1 Wait 1 IF Wait 1 Wait 1 Wait 1 Wait 1
// Term A HRDY*
// LFunc AND
// Term B HRDY*
// Branch1 ThenIdle
// Branch0 ElseIdle
// Re-Exec No
// Sngl/CRC Default Default Default Default Default Default Default
// HR/W* 0 0 0 0 0 0 0 1
// HDS1* 1 0 1 1 1 1 1 1
// HBIL 0 0 0 0 0 0 0 1
// CTL3 0 0 0 0 0 0 0 0
// CTL4 0 0 0 0 0 0 0 0
// CTL5 0 0 0 0 0 0 0 0
//
// END DO NOT EDIT
// DO NOT EDIT ...
//
// GPIF Waveform 1: SnglWr2
//
// Interval 0 1 2 3 4 5 6 Idle (7)
// _________ _________ _________ _________ _________ _________ _________ _________
//
// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val
// DataMode NO Data Activate NO Data NO Data NO Data NO Data NO Data
// NextData SameData SameData NextData SameData SameData SameData SameData
// Int Trig No Int No Int No Int No Int No Int No Int No Int
// IF/Wait Wait 1 Wait 1 IF Wait 1 Wait 1 Wait 1 Wait 1
// Term A HRDY*
// LFunc AND
// Term B HRDY*
// Branch1 ThenIdle
// Branch0 ElseIdle
// Re-Exec No
// Sngl/CRC Default Default Default Default Default Default Default
// HR/W* 0 0 0 0 0 0 0 1
// HDS1* 1 0 1 1 1 1 1 1
// HBIL 1 1 1 1 1 1 1 1
// CTL3 0 0 0 0 0 0 0 0
// CTL4 0 0 0 0 0 0 0 0
// CTL5 0 0 0 0 0 0 0 0
//
// END DO NOT EDIT
// DO NOT EDIT ...
//
// GPIF Waveform 2: FIFORd
//
// Interval 0 1 2 3 4 5 6 Idle (7)
// _________ _________ _________ _________ _________ _________ _________ _________
//
// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val
// DataMode NO Data NO Data Activate NO Data Activate NO Data NO Data
// NextData SameData SameData SameData SameData SameData NextData SameData
// Int Trig No Int No Int No Int No Int No Int No Int No Int
// IF/Wait Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 IF Wait 1
// Term A TCXpire
// LFunc AND
// Term B TCXpire
// Branch1 ThenIdle
// Branch0 Else 0
// Re-Exec No
// Sngl/CRC Default Default Default Default Default Default Default
// HR/W* 1 1 1 1 1 1 1 1
// HDS1* 1 0 1 0 1 1 1 1
// HBIL 0 0 1 1 1 1 1 1
// CTL3 0 0 0 0 0 0 0 0
// CTL4 0 0 0 0 0 0 0 0
// CTL5 0 0 0 0 0 0 0 0
//
// END DO NOT EDIT
// DO NOT EDIT ...
//
// GPIF Waveform 3: FIFOWr
//
// Interval 0 1 2 3 4 5 6 Idle (7)
// _________ _________ _________ _________ _________ _________ _________ _________
//
// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val
// DataMode NO Data Activate NO Data Activate NO Data NO Data NO Data
// NextData SameData SameData NextData SameData NextData SameData SameData
// Int Trig No Int No Int No Int No Int No Int No Int No Int
// IF/Wait Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 IF Wait 1
// Term A TCXpire
// LFunc AND
// Term B TCXpire
// Branch1 ThenIdle
// Branch0 Else 0
// Re-Exec No
// Sngl/CRC Default Default Default Default Default Default Default
// HR/W* 0 0 0 0 0 1 1 1
// HDS1* 1 0 1 0 1 1 1 1
// HBIL 0 0 1 1 1 1 1 1
// CTL3 0 0 0 0 0 0 0 0
// CTL4 0 0 0 0 0 0 0 0
// CTL5 0 0 0 0 0 0 0 0
//
// END DO NOT EDIT
// GPIF Program Code
// DO NOT EDIT ...
#include "fx2.h"
#include "fx2regs.h"
#include "fx2sdly.h" // SYNCDELAY macro
// END DO NOT EDIT
// DO NOT EDIT ...
const char xdata WaveData[128] =
{
// Wave 0
/* LenBr */ 0x01, 0x01, 0x3F, 0x01, 0x01, 0x01, 0x01, 0x07,
/* Opcode*/ 0x00, 0x02, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
/* Output*/ 0x02, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x07,
/* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F,
// Wave 1
/* LenBr */ 0x01, 0x01, 0x3F, 0x01, 0x01, 0x01, 0x01, 0x07,
/* Opcode*/ 0x00, 0x02, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
/* Output*/ 0x06, 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07,
/* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F,
// Wave 2
/* LenBr */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x38, 0x01, 0x07,
/* Opcode*/ 0x00, 0x00, 0x02, 0x00, 0x02, 0x05, 0x00, 0x00,
/* Output*/ 0x03, 0x01, 0x07, 0x05, 0x07, 0x07, 0x07, 0x07,
/* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x2D, 0x00, 0x3F,
// Wave 3
/* LenBr */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x38, 0x01, 0x07,
/* Opcode*/ 0x00, 0x02, 0x04, 0x02, 0x04, 0x01, 0x00, 0x00,
/* Output*/ 0x02, 0x00, 0x06, 0x04, 0x06, 0x07, 0x07, 0x07,
/* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x2D, 0x00, 0x3F,
};
// END DO NOT EDIT
// DO NOT EDIT ...
const char xdata FlowStates[36] =
{
/* Wave 0 FlowStates */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/* Wave 1 FlowStates */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/* Wave 2 FlowStates */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/* Wave 3 FlowStates */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
// END DO NOT EDIT
// DO NOT EDIT ...
const char xdata InitData[7] =
{
/* Regs */ 0xE0,0x00,0x00,0x07,0xCE,0x4E,0x00
};
// END DO NOT EDIT
// TO DO: You may add additional code below.
void GpifInit( void )
{
BYTE i;
// Registers which require a synchronization delay, see section 15.14
// FIFORESET FIFOPINPOLAR
// INPKTEND OUTPKTEND
// EPxBCH:L REVCTL
// GPIFTCB3 GPIFTCB2
// GPIFTCB1 GPIFTCB0
// EPxFIFOPFH:L EPxAUTOINLENH:L
// EPxFIFOCFG EPxGPIFFLGSEL
// PINFLAGSxx EPxFIFOIRQ
// EPxFIFOIE GPIFIRQ
// GPIFIE GPIFADRH:L
// UDMACRCH:L EPxGPIFTRIG
// GPIFTRIG
// Note: The pre-REVE EPxGPIFTCH/L register are affected, as well...
// ...these have been replaced by GPIFTC[B3:B0] registers
// 8051 doesn't have access to waveform memories 'til
// the part is in GPIF mode.
IFCONFIG = 0xCE;
// IFCLKSRC=1 , FIFOs executes on internal clk source
// xMHz=1 , 48MHz internal clk rate
// IFCLKOE=0 , Don't drive IFCLK pin signal at 48MHz
// IFCLKPOL=0 , Don't invert IFCLK pin signal from internal clk
// ASYNC=1 , master samples asynchronous
// GSTATE=1 , Drive GPIF states out on PORTE[2:0], debug WF
// IFCFG[1:0]=10, FX2 in GPIF master mode
GPIFABORT = 0xFF; // abort any waveforms pending
GPIFREADYCFG = InitData[ 0 ];
GPIFCTLCFG = InitData[ 1 ];
GPIFIDLECS = InitData[ 2 ];
GPIFIDLECTL = InitData[ 3 ];
GPIFWFSELECT = InitData[ 5 ];
GPIFREADYSTAT = InitData[ 6 ];
// use dual autopointer feature...
AUTOPTRSETUP = 0x07; // inc both pointers,
// ...warning: this introduces pdata hole(s)
// ...at E67B (XAUTODAT1) and E67C (XAUTODAT2)
// source
AUTOPTRH1 = MSB( &WaveData );
AUTOPTRL1 = LSB( &WaveData );
// destination
AUTOPTRH2 = 0xE4;
AUTOPTRL2 = 0x00;
// transfer
for ( i = 0x00; i < 128; i++ )
{
EXTAUTODAT2 = EXTAUTODAT1;
}
// Configure GPIF Address pins, output initial value,
PORTCCFG = 0xFF; // [7:0] as alt. func. GPIFADR[7:0]
OEC = 0xFF; // and as outputs
PORTECFG |= 0x80; // [8] as alt. func. GPIFADR[8]
OEE |= 0x80; // and as output
// ...OR... tri-state GPIFADR[8:0] pins
// PORTCCFG = 0x00; // [7:0] as port I/O
// OEC = 0x00; // and as inputs
// PORTECFG &= 0x7F; // [8] as port I/O
// OEE &= 0x7F; // and as input
// GPIF address pins update when GPIFADRH/L written
SYNCDELAY; //
GPIFADRH = 0x00; // bits[7:1] always 0
SYNCDELAY; //
GPIFADRL = 0x00; // point to PERIPHERAL address 0x0000
// Configure GPIF FlowStates registers for Wave 0 of WaveData
FLOWSTATE = FlowStates[ 0 ];
FLOWLOGIC = FlowStates[ 1 ];
FLOWEQ0CTL = FlowStates[ 2 ];
FLOWEQ1CTL = FlowStates[ 3 ];
FLOWHOLDOFF = FlowStates[ 4 ];
FLOWSTB = FlowStates[ 5 ];
FLOWSTBEDGE = FlowStates[ 6 ];
FLOWSTBHPERIOD = FlowStates[ 7 ];
}
+10
View File
@@ -0,0 +1,10 @@
#include "fx2.h"
#include "fx2regs.h"
extern BOOL hpi_int;
void int0_isr (void) interrupt 0
{
hpi_int = TRUE; // HPI interrupted the FX2
EX0 = 0; // disable INT0/ interrupt, let foreground re-enable it
}
+6
View File
@@ -0,0 +1,6 @@
readme.txt for FX2_to_TI5416 GPIF FIFO Transactions Auto mode
-------------------------------------------------------------
see GPIF Primer section on design examples for operating instructions
and details
+292
View File
@@ -0,0 +1,292 @@
// This program configures the General Programmable Interface (GPIF) for FX2.
// Please do not modify sections of text which are marked as "DO NOT EDIT ...".
//
// DO NOT EDIT ...
// GPIF Initialization
// Interface Timing Async
// Internal Ready Init IntRdy=1
// CTL Out Tristate-able Tristate
// SingleWrite WF Select 3
// SingleRead WF Select 2
// FifoWrite WF Select 1
// FifoRead WF Select 0
// Data Bus Idle Drive Tristate
// END DO NOT EDIT
// DO NOT EDIT ...
// GPIF Wave Names
// Wave 0 = FIFORd
// Wave 1 = FIFOWr
// Wave 2 = SnglWr2
// Wave 3 = SnglWr1
// GPIF Ctrl Outputs Level
// CTL 0 = HR/W* CMOS
// CTL 1 = HDS1* CMOS
// CTL 2 = HBIL CMOS
// CTL 3 = unused CMOS
// CTL 4 = unused CMOS
// CTL 5 = unused CMOS
// GPIF Rdy Inputs
// RDY0 = HRDY*
// RDY1 = unused
// RDY2 = unused
// RDY3 = unused
// RDY4 = unused
// RDY5 = TCXpire
// FIFOFlag = FIFOFlag
// IntReady = IntReady
// END DO NOT EDIT
// DO NOT EDIT ...
//
// GPIF Waveform 0: FIFORd
//
// Interval 0 1 2 3 4 5 6 Idle (7)
// _________ _________ _________ _________ _________ _________ _________ _________
//
// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val
// DataMode NO Data NO Data Activate NO Data Activate NO Data NO Data
// NextData SameData SameData SameData SameData SameData SameData SameData
// Int Trig No Int No Int No Int No Int No Int No Int No Int
// IF/Wait Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 IF Wait 3
// Term A TCXpire
// LFunc AND
// Term B TCXpire
// Branch1 ThenIdle
// Branch0 Else 0
// Re-Exec No
// Sngl/CRC Default Default Default Default Default Default Default
// HR/W* 1 1 1 1 1 1 1 1
// HDS1* 1 0 1 0 0 0 1 1
// HBIL 0 0 1 1 1 1 1 1
// unused 1 1 1 1 1 1 1 1
// unused
// unused
//
// END DO NOT EDIT
// DO NOT EDIT ...
//
// GPIF Waveform 1: FIFOWr
//
// Interval 0 1 2 3 4 5 6 Idle (7)
// _________ _________ _________ _________ _________ _________ _________ _________
//
// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val
// DataMode NO Data Activate NO Data Activate NO Data NO Data NO Data
// NextData SameData SameData NextData SameData SameData SameData SameData
// Int Trig No Int No Int No Int No Int No Int No Int No Int
// IF/Wait Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 IF Wait 1
// Term A TCXpire
// LFunc AND
// Term B TCXpire
// Branch1 ThenIdle
// Branch0 Else 0
// Re-Exec No
// Sngl/CRC Default Default Default Default Default Default Default
// HR/W* 0 0 0 0 0 1 1 1
// HDS1* 1 0 1 0 1 1 1 1
// HBIL 0 0 1 1 1 1 1 1
// unused 1 1 1 1 1 1 1 1
// unused
// unused
//
// END DO NOT EDIT
// DO NOT EDIT ...
//
// GPIF Waveform 2: SnglWr2
//
// Interval 0 1 2 3 4 5 6 Idle (7)
// _________ _________ _________ _________ _________ _________ _________ _________
//
// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val
// DataMode NO Data Activate NO Data NO Data NO Data NO Data NO Data
// NextData SameData SameData SameData SameData SameData SameData SameData
// Int Trig No Int No Int No Int No Int No Int No Int No Int
// IF/Wait Wait 1 Wait 1 IF Wait 1 Wait 1 Wait 1 Wait 1
// Term A unused
// LFunc AND
// Term B unused
// Branch1 ThenIdle
// Branch0 ElseIdle
// Re-Exec No
// Sngl/CRC Default Default Default Default Default Default Default
// HR/W* 0 0 0 0 0 0 0 1
// HDS1* 1 0 1 0 1 1 1 1
// HBIL 1 1 1 1 1 1 1 1
// unused 1 1 1 1 1 1 1 1
// unused
// unused
//
// END DO NOT EDIT
// DO NOT EDIT ...
//
// GPIF Waveform 3: SnglWr1
//
// Interval 0 1 2 3 4 5 6 Idle (7)
// _________ _________ _________ _________ _________ _________ _________ _________
//
// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val
// DataMode NO Data Activate NO Data NO Data NO Data NO Data NO Data
// NextData SameData SameData SameData SameData SameData SameData SameData
// Int Trig No Int No Int No Int No Int No Int No Int No Int
// IF/Wait Wait 1 Wait 1 IF Wait 1 Wait 1 Wait 1 Wait 1
// Term A unused
// LFunc AND
// Term B unused
// Branch1 ThenIdle
// Branch0 ElseIdle
// Re-Exec No
// Sngl/CRC Default Default Default Default Default Default Default
// HR/W* 0 0 0 0 0 0 0 1
// HDS1* 1 0 1 0 1 1 1 1
// HBIL 0 0 0 1 1 1 1 1
// unused 1 1 1 1 1 1 1 1
// unused
// unused
//
// END DO NOT EDIT
// GPIF Program Code
// DO NOT EDIT ...
#include "fx2.h"
#include "fx2regs.h"
#include "fx2sdly.h" // SYNCDELAY macro
// END DO NOT EDIT
// DO NOT EDIT ...
const char xdata WaveData[128] =
{
// Wave 0
/* LenBr */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x38, 0x03, 0x07,
/* Opcode*/ 0x00, 0x00, 0x02, 0x00, 0x02, 0x01, 0x00, 0x00,
/* Output*/ 0xFB, 0xF9, 0xFF, 0xFD, 0xFD, 0xFD, 0xFF, 0xFF,
/* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x2D, 0x00, 0x3F,
// Wave 1
/* LenBr */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x38, 0x01, 0x07,
/* Opcode*/ 0x00, 0x02, 0x04, 0x02, 0x00, 0x01, 0x00, 0x00,
/* Output*/ 0xFA, 0xF8, 0xFE, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF,
/* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x2D, 0x00, 0x3F,
// Wave 2
/* LenBr */ 0x01, 0x01, 0x3F, 0x01, 0x01, 0x01, 0x01, 0x07,
/* Opcode*/ 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
/* Output*/ 0xFE, 0xFC, 0xFE, 0xFC, 0xFE, 0xFE, 0xFE, 0xFF,
/* LFun */ 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x3F,
// Wave 3
/* LenBr */ 0x01, 0x01, 0x3F, 0x01, 0x01, 0x01, 0x01, 0x07,
/* Opcode*/ 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
/* Output*/ 0xFA, 0xF8, 0xFA, 0xFC, 0xFE, 0xFE, 0xFE, 0xFF,
/* LFun */ 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x3F,
};
// END DO NOT EDIT
// DO NOT EDIT ...
const char xdata FlowStates[36] =
{
/* Wave 0 FlowStates */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/* Wave 1 FlowStates */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/* Wave 2 FlowStates */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/* Wave 3 FlowStates */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
// END DO NOT EDIT
// DO NOT EDIT ...
const char xdata InitData[7] =
{
/* Regs */ 0xA0,0x80,0x00,0xFF,0xEA,0xE4,0x00
};
// END DO NOT EDIT
// TO DO: You may add additional code below.
void GpifInit( void )
{
BYTE i;
// Registers which require a synchronization delay, see section 15.14
// FIFORESET FIFOPINPOLAR
// INPKTEND OUTPKTEND
// EPxBCH:L REVCTL
// GPIFTCB3 GPIFTCB2
// GPIFTCB1 GPIFTCB0
// EPxFIFOPFH:L EPxAUTOINLENH:L
// EPxFIFOCFG EPxGPIFFLGSEL
// PINFLAGSxx EPxFIFOIRQ
// EPxFIFOIE GPIFIRQ
// GPIFIE GPIFADRH:L
// UDMACRCH:L EPxGPIFTRIG
// GPIFTRIG
// Note: The pre-REVE EPxGPIFTCH/L register are affected, as well...
// ...these have been replaced by GPIFTC[B3:B0] registers
// 8051 doesn't have access to waveform memories 'til
// the part is in GPIF mode.
IFCONFIG = 0xEA;
// IFCLKSRC=1 , FIFOs executes on internal clk source
// xMHz=1 , 48MHz internal clk rate
// IFCLKOE=0 , Don't drive IFCLK pin signal at 48MHz
// IFCLKPOL=0 , Don't invert IFCLK pin signal from internal clk
// ASYNC=1 , master samples asynchronous
// GSTATE=1 , Drive GPIF states out on PORTE[2:0], debug WF
// IFCFG[1:0]=10, FX2 in GPIF master mode
GPIFABORT = 0xFF; // abort any waveforms pending
GPIFREADYCFG = InitData[ 0 ];
GPIFCTLCFG = InitData[ 1 ];
GPIFIDLECS = InitData[ 2 ];
GPIFIDLECTL = InitData[ 3 ];
GPIFWFSELECT = InitData[ 5 ];
GPIFREADYSTAT = InitData[ 6 ];
// use dual autopointer feature...
AUTOPTRSETUP = 0x07; // inc both pointers,
// ...warning: this introduces pdata hole(s)
// ...at E67B (XAUTODAT1) and E67C (XAUTODAT2)
// source
AUTOPT1RH = MSB( &WaveData );
AUTOPT1RL = LSB( &WaveData );
// destination
AUTOPTRH2 = 0xE4;
AUTOPTRL2 = 0x00;
// transfer
for ( i = 0x00; i < 128; i++ )
{
EXTAUTODAT2 = EXTAUTODAT1;
}
// Configure GPIF Address pins, output initial value,
PORTCCFG = 0xFF; // [7:0] as alt. func. GPIFADR[7:0]
OEC = 0xFF; // and as outputs
PORTECFG |= 0x80; // [8] as alt. func. GPIFADR[8]
OEE |= 0x80; // and as output
// ...OR... tri-state GPIFADR[8:0] pins
// PORTCCFG = 0x00; // [7:0] as port I/O
// OEC = 0x00; // and as inputs
// PORTECFG &= 0x7F; // [8] as port I/O
// OEE &= 0x7F; // and as input
// GPIF address pins update when GPIFADRH/L written
SYNCDELAY; //
GPIFADRH = 0x00; // bits[7:1] always 0
SYNCDELAY; //
GPIFADRL = 0x00; // point to PERIPHERAL address 0x0000
// Configure GPIF FlowStates registers for Wave 0 of WaveData
FLOWSTATE = FlowStates[ 0 ];
FLOWLOGIC = FlowStates[ 1 ];
FLOWEQ0CTL = FlowStates[ 2 ];
FLOWEQ1CTL = FlowStates[ 3 ];
FLOWHOLDOFF = FlowStates[ 4 ];
FLOWSTB = FlowStates[ 5 ];
FLOWSTBEDGE = FlowStates[ 6 ];
FLOWSTBHPERIOD = FlowStates[ 7 ];
}
@@ -0,0 +1,40 @@
### uVision2 Project, (C) Keil Software
### Do not modify !
cExt (*.c)
aExt (*.a*; *.src)
oExt (*.obj)
lExt (*.lib)
tExt (*.txt)
pExt (*.plm)
CppX (*.cpp)
DaveTm { 0,0,0,0,0,0,0,0 }
Target (Target 1), 0x0000 // Tools: 'MCS-51'
GRPOPT 1,(Source Group 1),1,0,0
OPTFFF 1,1,1,385875968,0,339,339,0,<.\fw.c><fw.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,233,255,255,255,66,0,0,0,66,0,0,0,61,3,0,0,118,1,0,0 }
OPTFFF 1,2,2,385875968,0,1,5,0,<.\dscr.a51><dscr.a51> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,233,255,255,255,44,0,0,0,44,0,0,0,70,3,0,0,224,1,0,0 }
OPTFFF 1,3,1,553648128,0,42,42,0,<.\FX2_to_extsyncFIFO.c><FX2_to_extsyncFIFO.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,233,255,255,255,0,0,0,0,0,0,0,0,22,3,0,0,176,1,0,0 }
OPTFFF 1,4,4,0,0,0,0,0,<D:\Cypress\USB\Target\Lib\FX2\Ezusb.lib><Ezusb.lib>
OPTFFF 1,5,3,0,0,0,0,0,<D:\Cypress\USB\Target\Lib\FX2\USBJmpTb.OBJ><USBJmpTb.OBJ>
OPTFFF 1,6,1,33554434,0,175,175,0,<.\gpif.c><gpif.c> { 44,0,0,0,2,0,0,0,3,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,233,255,255,255,66,0,0,0,66,0,0,0,61,3,0,0,118,1,0,0 }
TARGOPT 1, (Target 1)
CLK51=48000000
OPTTT 1,1,1,0
OPTHX 0,65535,0,0,0
OPTLX 120,65,8,<.\>
OPTOX 16
OPTLT 1,1,1,0,1,1,0,1,0,0,0,0
OPTXL 1,1,1,1,1,1,1,0,0
OPTFL 1,0,1
OPTDL (S8051.DLL)()(DP51.DLL)(-pFX2)(S8051.DLL)()(TP51.DLL)(-pFX2)
OPTDBG 49150,0,()()()()()()()()()() ()()()()
OPTKEY 0,(MON51)(-S1 -B38400 -O31)
OPTDF 0x0
OPTLE <>
OPTLC <>
EndOpt
@@ -0,0 +1,108 @@
### uVision2 Project, (C) Keil Software
### Do not modify !
Target (Target 1), 0x0000 // Tools: 'MCS-51'
Group (Source Group 1)
File 1,1,<.\fw.c><fw.c>
File 1,2,<.\dscr.a51><dscr.a51>
File 1,1,<.\FX2_to_extsyncFIFO.c><FX2_to_extsyncFIFO.c>
File 1,4,<D:\Cypress\USB\Target\Lib\FX2\Ezusb.lib><Ezusb.lib>
File 1,3,<D:\Cypress\USB\Target\Lib\FX2\USBJmpTb.OBJ><USBJmpTb.OBJ>
File 1,1,<.\gpif.c><gpif.c>
Options 1,0,0 // Target 'Target 1'
Device (EZ-USB FX2 (CY7C68XXX))
Vendor (Cypress Semiconductor)
Cpu (IRAM(0 - 0xFF) XRAM(0 - 0x3FF) CLOCK(48000000) MODDP2)
Rgf (REG52.H)
Mem ()
C ()
A ()
RL ()
OH ()
UseEnv=1
EnvBin (C:\Keil\C51\BIN\)
EnvInc (c:\CYPRESS\USB\Target\Inc\;C:\Keil\C51\INC\)
EnvLib (C:\Keil\C51\LIB\)
EnvReg ()
OrgReg ()
TgStat=0
OutDir (.\)
OutName (FX2_to_extsyncFIFO)
GenApp=1
GenLib=0
GenHex=1
Debug=1
Browse=0
LstDir (.\)
HexSel=0
MG32K=0
RunUsr 0 1 <c:\cypress\usb\bin\hex2bix -i -f 0xC2 -o FX2_to_extsyncFIFO.iic FX2_to_extsyncFIFO.hex>
RunUsr 1 0 <>
SVCSID <>
MODEL5=0
RTOS5=0
ROMSZ5=2
DHOLD5=0
XHOLD5=0
T51FL=304
CBANKS5=0
XBANKS5=0
RCB51 { 0,0,0,0,0,255,255,0,0 }
RXB51 { 0,0,0,0,0,0,0,0,0 }
OCM51 { 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
OCR51 { 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
IRO51 { 0,0,0,0,0,0,0,0,0 }
IRA51 { 0,0,0,0,0,0,1,0,0 }
XRA51 { 0,0,0,0,0,0,4,0,0 }
C51FL=21630224
C51VA=0
C51MSC ()
C51DEF ()
C51UDF ()
INCC5 ()
AX51FL=4
AX51MSC ()
AX51SET ()
AX51RST ()
INCA5 ()
IncBld=1
AlwaysBuild=0
GenAsm=0
AsmAsm=0
PublicsOnly=0
StopCode=3
CustArgs ()
LibMods ()
BankNo=65535
LX51FL=288
LX51OVL ()
LX51MSC ()
LX51DWN ()
LX51LFI ()
LX51ASN ()
LX51RES ()
LX51CCL ()
LX51UCL ()
LX51CSC ()
LX51UCS ()
LX51COB (0x0080-0x0FFF)
LX51XDB (0x1000)
LX51PDB ()
LX51BIB ()
LX51DAB ()
LX51IDB ()
LX51PRC ()
LX51STK ()
LX51COS ()
LX51XDS ()
LX51BIS ()
LX51DAS ()
LX51IDS ()
OPTDL (S8051.DLL)()(DP51.DLL)(-pFX2)(S8051.DLL)()(TP51.DLL)(-pFX2)
OPTDBG 49150,0,()()()()()()()()()() ()()()()
EndOpt
@@ -0,0 +1,528 @@
#pragma NOIV // Do not generate interrupt vectors
//-----------------------------------------------------------------------------
// File: FX2_to_extsyncFIFO.c
// Contents: Hooks required to implement FX2 GPIF to external sync. FIFO
// interface using CY4265-15AC
//
// Copyright (c) 2003 Cypress Semiconductor, Inc. All rights reserved
//-----------------------------------------------------------------------------
#include "fx2.h"
#include "fx2regs.h"
#include "fx2sdly.h" // SYNCDELAY macro, see Section 15.14 of FX2 Tech.
// Ref. Manual for usage details.
#define EXTFIFONOTFULL GPIFREADYSTAT & bmBIT1
#define EXTFIFONOTEMPTY GPIFREADYSTAT & bmBIT0
#define GPIFTRIGRD 4
#define GPIF_EP2 0
#define GPIF_EP4 1
#define GPIF_EP6 2
#define GPIF_EP8 3
extern BOOL GotSUD; // Received setup data flag
extern BOOL Sleep;
extern BOOL Rwuen;
extern BOOL Selfpwr;
BYTE Configuration; // Current configuration
BYTE AlternateSetting; // Alternate settings
BOOL in_enable = FALSE; // flag to enable IN transfers
BOOL enum_high_speed = FALSE; // flag to let firmware know FX2 enumerated at high speed
extern const char xdata FlowStates[36];
//-----------------------------------------------------------------------------
// Task Dispatcher hooks
// The following hooks are called by the task dispatcher.
//-----------------------------------------------------------------------------
void Setup_FLOWSTATE_Write ( void );
void Setup_FLOWSTATE_Read ( void );
void GpifInit ();
void TD_Init(void) // Called once at startup
{
// set the CPU clock to 48MHz
CPUCS = ((CPUCS & ~bmCLKSPD) | bmCLKSPD1);
SYNCDELAY;
EP2CFG = 0xA0; // EP2OUT, bulk, size 512, 4x buffered
SYNCDELAY;
EP4CFG = 0x00; // EP4 not valid
SYNCDELAY;
EP6CFG = 0xE0; // EP6IN, bulk, size 512, 4x buffered
SYNCDELAY;
EP8CFG = 0x00; // EP8 not valid
SYNCDELAY;
FIFORESET = 0x80; // set NAKALL bit to NAK all transfers from host
SYNCDELAY;
FIFORESET = 0x02; // reset EP2 FIFO
SYNCDELAY;
FIFORESET = 0x06; // reset EP6 FIFO
SYNCDELAY;
FIFORESET = 0x00; // clear NAKALL bit to resume normal operation
SYNCDELAY;
EP2FIFOCFG = 0x01; // allow core to see zero to one transition of auto out bit
SYNCDELAY;
EP2FIFOCFG = 0x11; // auto out mode, disable PKTEND zero length send, word ops
SYNCDELAY;
EP6FIFOCFG = 0x09; // auto in mode, disable PKTEND zero length send, word ops
SYNCDELAY;
GpifInit (); // initialize GPIF registers
SYNCDELAY;
EP2GPIFFLGSEL = 0x01; // For EP2OUT, GPIF uses EF flag
SYNCDELAY;
EP6GPIFFLGSEL = 0x02; // For EP6IN, GPIF uses FF flag
SYNCDELAY;
// global flowstate register initializations
FLOWLOGIC = FlowStates[19]; // 0011 0110b - LFUNC[1:0] = 00 (A AND B), TERMA/B[2:0]=110 (FIFO Flag)
SYNCDELAY;
FLOWSTB = FlowStates[22]; // 0000 0100b - MSTB[2:0] = 100 (CTL4), not used as strobe
SYNCDELAY;
GPIFHOLDAMOUNT = FlowStates[26]; // hold data for one half clock (10ns) assuming 48MHz IFCLK
SYNCDELAY;
FLOWSTBEDGE = FlowStates[24]; // move data on both edges of clock
SYNCDELAY;
FLOWSTBHPERIOD = FlowStates[25]; // 20.83ns half period
SYNCDELAY;
// reset the external FIFO
OEA |= 0x04; // turn on PA2 as output pin
IOA |= 0x04; // pull PA2 high initially
IOA &= 0xFB; // bring PA2 low
EZUSB_Delay (1); // keep PA2 low for ~1ms, more than enough time
IOA |= 0x04; // bring PA2 high
}
void TD_Poll(void)
{
if( GPIFTRIG & 0x80 ) // if GPIF interface IDLE
{
if ( ! ( EP24FIFOFLGS & 0x02 ) ) // if there's a packet in the peripheral domain for EP2
{
if ( EXTFIFONOTFULL ) // if the external FIFO is not full
{
if(enum_high_speed)
{
SYNCDELAY;
GPIFTCB1 = 0x01; // setup transaction count (512 bytes/2 for word wide -> 0x0100)
SYNCDELAY;
GPIFTCB0 = 0x00;
SYNCDELAY;
}
else
{
SYNCDELAY;
GPIFTCB1 = 0x00; // setup transaction count (64 bytes/2 for word wide -> 0x20)
SYNCDELAY;
GPIFTCB0 = 0x20;
SYNCDELAY;
}
Setup_FLOWSTATE_Write(); // setup FLOWSTATE registers for FIFO Write operation
SYNCDELAY;
GPIFTRIG = GPIF_EP2; // launch GPIF FIFO WRITE Transaction from EP2 FIFO
SYNCDELAY;
while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 GPIF Done bit
{
;
}
SYNCDELAY;
}
}
}
if(in_enable) // if IN transfers are enabled
{
if ( GPIFTRIG & 0x80 ) // if GPIF interface IDLE
{
if ( EXTFIFONOTEMPTY ) // if external FIFO is not empty
{
if ( !( EP68FIFOFLGS & 0x01 ) ) // if EP6 FIFO is not full
{
if(enum_high_speed)
{
SYNCDELAY;
GPIFTCB1 = 0x01; // setup transaction count (512 bytes/2 for word wide -> 0x0100)
SYNCDELAY;
GPIFTCB0 = 0x00;
SYNCDELAY;
}
else
{
SYNCDELAY;
GPIFTCB1 = 0x00; // setup transaction count (64 bytes/2 for word wide -> 0x20)
SYNCDELAY;
GPIFTCB0 = 0x20;
SYNCDELAY;
}
Setup_FLOWSTATE_Read(); // setup FLOWSTATE registers for FIFO Read operation
SYNCDELAY;
GPIFTRIG = GPIFTRIGRD | GPIF_EP6; // launch GPIF FIFO READ Transaction to EP6 FIFO
SYNCDELAY;
while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 GPIF Done bit
{
;
}
SYNCDELAY;
}
}
}
}
}
BOOL TD_Suspend(void) // Called before the device goes into suspend mode
{
return(TRUE);
}
BOOL TD_Resume(void) // Called after the device resumes
{
return(TRUE);
}
//-----------------------------------------------------------------------------
// Device Request hooks
// The following hooks are called by the end point 0 device request parser.
//-----------------------------------------------------------------------------
BOOL DR_GetDescriptor(void)
{
return(TRUE);
}
BOOL DR_SetConfiguration(void) // Called when a Set Configuration command is received
{
if( EZUSB_HIGHSPEED( ) )
{ // FX2 enumerated at high speed
SYNCDELAY; //
EP6AUTOINLENH = 0x02; // set AUTOIN commit length to 512 bytes
SYNCDELAY; //
EP6AUTOINLENL = 0x00;
SYNCDELAY;
enum_high_speed = TRUE;
}
else
{ // FX2 enumerated at full speed
SYNCDELAY;
EP6AUTOINLENH = 0x00; // set AUTOIN commit length to 64 bytes
SYNCDELAY;
EP6AUTOINLENL = 0x40;
SYNCDELAY;
enum_high_speed = FALSE;
}
Configuration = SETUPDAT[2];
return(TRUE); // Handled by user code
}
BOOL DR_GetConfiguration(void) // Called when a Get Configuration command is received
{
EP0BUF[0] = Configuration;
EP0BCH = 0;
EP0BCL = 1;
return(TRUE); // Handled by user code
}
BOOL DR_SetInterface(void) // Called when a Set Interface command is received
{
AlternateSetting = SETUPDAT[2];
return(TRUE); // Handled by user code
}
BOOL DR_GetInterface(void) // Called when a Set Interface command is received
{
EP0BUF[0] = AlternateSetting;
EP0BCH = 0;
EP0BCL = 1;
return(TRUE); // Handled by user code
}
BOOL DR_GetStatus(void)
{
return(TRUE);
}
BOOL DR_ClearFeature(void)
{
return(TRUE);
}
BOOL DR_SetFeature(void)
{
return(TRUE);
}
#define VX_B2 0xB2 // reset the external FIFO
#define VX_B3 0xB3 // enable IN transfers
#define VX_B4 0xB4 // disable IN transfers
#define VX_B5 0xB5 // read GPIFREADYSTAT register
#define VX_B6 0xB6 // read GPIFTRIG register
BOOL DR_VendorCmnd(void)
{
switch (SETUPDAT[1])
{
case VX_B2:
{
// reset the external FIFO
OEA |= 0x04; // turn on PA2 as output pin
IOA |= 0x04; // pull PA2 high initially
IOA &= 0xFB; // bring PA2 low
EZUSB_Delay (1); // keep PA2 low for ~1ms, more than enough time
IOA |= 0x04; // bring PA2 high
*EP0BUF = VX_B2;
EP0BCH = 0;
EP0BCL = 1; // Arm endpoint with # bytes to transfer
EP0CS |= bmHSNAK; // Acknowledge handshake phase of device request
break;
}
case VX_B3: // enable IN transfers
{
in_enable = TRUE;
*EP0BUF = VX_B3;
EP0BCH = 0;
EP0BCL = 1;
EP0CS |= bmHSNAK;
break;
}
case VX_B4: // disable IN transfers
{
in_enable = FALSE;
*EP0BUF = VX_B4;
EP0BCH = 0;
EP0BCL = 1;
EP0CS |= bmHSNAK;
break;
}
case VX_B5: // read GPIFREADYSTAT register
{
EP0BUF[0] = VX_B5;
SYNCDELAY;
EP0BUF[1] = GPIFREADYSTAT;
SYNCDELAY;
EP0BCH = 0;
EP0BCL = 2;
EP0CS |= bmHSNAK;
break;
}
case VX_B6: // read GPIFTRIG register
{
EP0BUF[0] = VX_B6;
SYNCDELAY;
EP0BUF[1] = GPIFTRIG;
SYNCDELAY;
EP0BCH = 0;
EP0BCL = 2;
EP0CS |= bmHSNAK;
break;
}
default:
return(TRUE);
}
return(FALSE);
}
//-----------------------------------------------------------------------------
// USB Interrupt Handlers
// The following functions are called by the USB interrupt jump table.
//-----------------------------------------------------------------------------
// Setup Data Available Interrupt Handler
void ISR_Sudav(void) interrupt 0
{
GotSUD = TRUE; // Set flag
EZUSB_IRQ_CLEAR();
USBIRQ = bmSUDAV; // Clear SUDAV IRQ
}
// Setup Token Interrupt Handler
void ISR_Sutok(void) interrupt 0
{
EZUSB_IRQ_CLEAR();
USBIRQ = bmSUTOK; // Clear SUTOK IRQ
}
void ISR_Sof(void) interrupt 0
{
EZUSB_IRQ_CLEAR();
USBIRQ = bmSOF; // Clear SOF IRQ
}
void ISR_Ures(void) interrupt 0
{
// whenever we get a USB reset, we should revert to full speed mode
pConfigDscr = pFullSpeedConfigDscr;
((CONFIGDSCR xdata *) pConfigDscr)->type = CONFIG_DSCR;
pOtherConfigDscr = pHighSpeedConfigDscr;
((CONFIGDSCR xdata *) pOtherConfigDscr)->type = OTHERSPEED_DSCR;
EZUSB_IRQ_CLEAR();
USBIRQ = bmURES; // Clear URES IRQ
}
void ISR_Susp(void) interrupt 0
{
Sleep = TRUE;
EZUSB_IRQ_CLEAR();
USBIRQ = bmSUSP;
}
void ISR_Highspeed(void) interrupt 0
{
if (EZUSB_HIGHSPEED())
{
pConfigDscr = pHighSpeedConfigDscr;
((CONFIGDSCR xdata *) pConfigDscr)->type = CONFIG_DSCR;
pOtherConfigDscr = pFullSpeedConfigDscr;
((CONFIGDSCR xdata *) pOtherConfigDscr)->type = OTHERSPEED_DSCR;
}
EZUSB_IRQ_CLEAR();
USBIRQ = bmHSGRANT;
}
void ISR_Ep0ack(void) interrupt 0
{
}
void ISR_Stub(void) interrupt 0
{
}
void ISR_Ep0in(void) interrupt 0
{
}
void ISR_Ep0out(void) interrupt 0
{
}
void ISR_Ep1in(void) interrupt 0
{
}
void ISR_Ep1out(void) interrupt 0
{
}
void ISR_Ep2inout(void) interrupt 0
{
}
void ISR_Ep4inout(void) interrupt 0
{
}
void ISR_Ep6inout(void) interrupt 0
{
}
void ISR_Ep8inout(void) interrupt 0
{
}
void ISR_Ibn(void) interrupt 0
{
}
void ISR_Ep0pingnak(void) interrupt 0
{
}
void ISR_Ep1pingnak(void) interrupt 0
{
}
void ISR_Ep2pingnak(void) interrupt 0
{
}
void ISR_Ep4pingnak(void) interrupt 0
{
}
void ISR_Ep6pingnak(void) interrupt 0
{
}
void ISR_Ep8pingnak(void) interrupt 0
{
}
void ISR_Errorlimit(void) interrupt 0
{
}
void ISR_Ep2piderror(void) interrupt 0
{
}
void ISR_Ep4piderror(void) interrupt 0
{
}
void ISR_Ep6piderror(void) interrupt 0
{
}
void ISR_Ep8piderror(void) interrupt 0
{
}
void ISR_Ep2pflag(void) interrupt 0
{
}
void ISR_Ep4pflag(void) interrupt 0
{
}
void ISR_Ep6pflag(void) interrupt 0
{
}
void ISR_Ep8pflag(void) interrupt 0
{
}
void ISR_Ep2eflag(void) interrupt 0
{
}
void ISR_Ep4eflag(void) interrupt 0
{
}
void ISR_Ep6eflag(void) interrupt 0
{
}
void ISR_Ep8eflag(void) interrupt 0
{
}
void ISR_Ep2fflag(void) interrupt 0
{
}
void ISR_Ep4fflag(void) interrupt 0
{
}
void ISR_Ep6fflag(void) interrupt 0
{
}
void ISR_Ep8fflag(void) interrupt 0
{
}
void ISR_GpifComplete(void) interrupt 0
{
}
void ISR_GpifWaveform(void) interrupt 0
{
}
void Setup_FLOWSTATE_Read ( void )
{
FLOWSTATE = FlowStates[18]; // 1000 0011b - FSE=1, FS[2:0]=003
SYNCDELAY;
FLOWEQ0CTL = FlowStates[20]; // CTL1/CTL2 = 0 when flow condition equals zero (data flows)
SYNCDELAY;
FLOWEQ1CTL = FlowStates[21]; // CTL1/CTL2 = 1 when flow condition equals one (data does not flow)
SYNCDELAY;
}
void Setup_FLOWSTATE_Write ( void )
{
FLOWSTATE = FlowStates[27]; // 1000 0001b - FSE=1, FS[2:0]=001
SYNCDELAY;
FLOWEQ0CTL = FlowStates[29]; // CTL0 = 0 when flow condition equals zero (data flows)
SYNCDELAY;
FLOWEQ1CTL = FlowStates[30]; // CTL0 = 1 when flow condition equals one (data does not flow)
SYNCDELAY;
}
Binary file not shown.
@@ -0,0 +1,275 @@
:0A04F00000010202030304040505E5
:10031900E4F513F512F511F510C203C200C202C2C9
:10032900011206B87E057F008E238F24752B057573
:100339002C1275210575221C752905752A3C752D08
:1003490005752E5C90E680E030E70E852125852233
:1003590026852927852A28800C852925852A268509
:100369002127852228EE54E0700302048A751400BF
:100379007515807E057F008E168F17C374E89FFF61
:1003890074059ECF2402CF3400FEE48F0F8E0EF544
:100399000DF50CF50BF50AF509F508AF0FAE0EAD25
:1003A9000DAC0CAB0BAA0AA909A808C3120D4D5034
:1003B9002AE515250BF582E514350AF58374CDF088
:1003C900E4FAF9F8E50B2401F50BEA350AF50AE92F
:1003D9003509F509E83508F50880C0E4F50BF50A93
:1003E900F509F508AF0FAE0EAD0DAC0CAB0BAA0AB3
:1003F900A909A808C3120D4D5035AE0AAF0BE51770
:100409002FF582E5163EF583E0FDE5152FF582E52A
:10041900143EF583EDF0E4FAF9F8EF2401F50BEA5F
:100429003EF50AE93509F509E83508F50880B58585
:10043900142385152474002480FF740534FFFEC33A
:10044900E52C9FF52CE52B9EF52BC3E5269FF5267C
:10045900E5259EF525C3E5289FF528E5279EF5277F
:10046900C3E5229FF522E5219EF521C3E52A9FF5E3
:100479002AE5299EF529C3E52E9FF52EE52D9EF542
:100489002DD2E843D82090E668E04409F090E65C74
:10049900E0443DF0D2AF90E680E020E105D20612BB
:1004A9000BDD90E680E054F7F0538EF8C20330017B
:1004B90005120080C2013003291204FE5024C20330
:1004C900120C6420001690E682E030E704E020E197
:1004D900EF90E682E030E604E020E0E4120C0C1232
:0704E90008F81209B880C7F2
:1000800090E6B9E0700302015B14700302020424DD
:10009000FE700302029924FB7003020155147003E1
:1000A00002014F147003020143147003020149243A
:1000B0000560030203051208FA400302031190E6EB
:1000C000BBE024FE602C14604724FD6016146031F0
:1000D00024067065E52390E6B3F0E52490E6B4F0DD
:1000E000020311E52B90E6B3F0E52C90E6B4F002A4
:1000F0000311E52590E6B3F0E52690E6B4F002039F
:1001000011E52790E6B3F0E52890E6B4F00203117C
:1001100090E6BAE0FF120C38AA06A9077B01EA496B
:10012000600DEE90E6B3F0EF90E6B4F002031190AC
:10013000E6A0E04401F002031190E6A0E04401F0E3
:10014000020311120D3B0203111208F002031112F7
:100150000B2D020311120D290203111208FC40039A
:1001600002031190E6B8E0247F602B14603C240267
:1001700060030201FAA200E433FF25E0FFA202E4DB
:10018000334F90E740F0E4A3F090E68AF090E68BDE
:100190007402F0020311E490E740F0A3F090E68AC5
:1001A000F090E68B7402F002031190E6BCE0547EFE
:1001B000FF7E00E0D3948040067C007D0180047CBB
:1001C000007D00EC4EFEED4F24F0F58274043EF508
:1001D00083E493FF3395E0FEEF24A1FFEE34E68F36
:1001E00082F583E0540190E740F0E4A3F090E68AC2
:1001F000F090E68B7402F002031190E6A0E0440157
:10020000F00203111208FE400302031190E6B8E069
:1002100024FE601D2402600302031190E6BAE0B4DC
:100220000105C20002031190E6A0E04401F00203C0
:100230001190E6BAE0705990E6BCE0547EFF7E0073
:10024000E0D3948040067C007D0180047C007D002A
:10025000EC4EFEED4F24F0F58274043EF583E493FA
:10026000FF3395E0FEEF24A1FFEE34E68F82F583A5
:10027000E054FEF090E6BCE05480FF131313541FCB
:10028000FFE0540F2F90E683F0E04420F0020311CA
:1002900090E6A0E04401F08078120D5E507390E685
:1002A000B8E024FE60202402706790E6BAE0B40152
:1002B00004D200805C90E6BAE06402605490E6A04C
:1002C000E04401F0804B90E6BCE0547EFF7E00E00D
:1002D000D3948040067C007D0180047C007D00EC8E
:1002E0004EFEED4F24F0F58274043EF583E493FF57
:1002F0003395E0FEEF24A1FFEE34E68F82F583E034
:100300004401F0800C1205EA500790E6A0E0440199
:08031000F090E6A0E04480F04B
:0103180022C2
:030033000204FACA
:0404FA0053D8EF32B2
:100500001201000200000040470502100000010235
:1005100000010A060002000000400100090220005C
:1005200001010080320904000002FF0000000705FD
:1005300002020002000705860200020009022000F4
:1005400001010080320904000002FF0000000705DD
:10055000020240000007058602400000040309046F
:10056000100343007900700072006500730073008F
:10057000780345005A002D0055005300420020002A
:100580004600580032002000470050004900460055
:10059000200074006F0020004500780074002000E7
:1005A0004600490046004F002000450078006100E9
:1005B0006D0070006C00650020007500730069001C
:1005C0006E00670020004600490046004F002000F2
:1005D0005400720061006E007300610063007400DB
:0A05E00069006F006E007300000058
:04083500C104C10534
:1006B80090E600E054E74410F000000090E6127461
:1006C800A0F0000000E490E613F000000090E614AB
:1006D80074E0F0000000E490E615F000000090E6F9
:1006E800047480F00000007402F00000007406F04A
:1006F800000000E4F000000090E61804F00000009C
:100708007411F000000090E61A7409F0000000125D
:10071800077900000090E6D27401F000000090E62E
:10072800E204F000000090109AE090E6C7F00000A4
:100738000090109DE090E6CBF00000009010A1E042
:1007480090E60CF000000090109FE090E6CCF000DE
:1007580000009010A0E090E6CDF000000043B20445
:100768004380045380FB7F017E00120AEC4380041F
:01077800225E
:1009B800E5BB30E74DE5AB20E14890E6F4E030E1F7
:1009C8004130051600000090E6D07401F0000000E8
:1009D800E490E6D1F00000008014000000E490E606
:1009E800D0F000000090E6D17420F0000000120C56
:1009F800AB000000E4F5BB000000E5BB30E7FB00FE
:100A08000000300452E5BB30E74D90E6F4E030E0FA
:100A180046E5AC20E04130051600000090E6D074B1
:100A280001F0000000E490E6D1F00000008014001E
:100A38000000E490E6D0F000000090E6D17420F0C9
:100A4800000000120C8900000075BB06000000E5DC
:080A5800BB30E7FB00000022A7
:0204FE00D32207
:0208F800D32209
:0208FA00D32207
:100B2D0090E680E030E71800000090E6247402F0B3
:100B3D00000000E490E625F0000000D205801600CC
:100B4D000000E490E624F000000090E6257440F0EB
:0D0B5D00000000C20590E6BAE0F51BD322AF
:100D290090E740E51BF0E490E68AF090E68B04F04A
:020D3900D322C3
:0808F00090E6BAE0F51AD322EC
:100D3B0090E740E51AF0E490E68AF090E68B04F039
:020D4B00D322B1
:0208FC00D32205
:0208FE00D32203
:020D5E00D3229E
:1005EA0090E6B9E0244D60401460581460701470AD
:1005FA0003020690240460030206B443B204438053
:10060A00045380FB7F017E00120AEC43800490E7CA
:10061A004074B2F0E490E68AF090E68B04F090E63B
:10062A00A0E04480F00206B6D20490E74074B3F02A
:10063A00E490E68AF090E68B04F090E6A0E044802D
:10064A00F08069C20490E74074B4F0E490E68AF05E
:10065A0090E68B04F090E6A0E04480F0804E90E7AC
:10066A004074B5F000000090E6F4E090E741F00035
:10067A000000E490E68AF090E68B7402F090E6A01F
:10068A00E04480F0802690E74074B6F0000000A3B2
:10069A00E5BBF0000000E490E68AF090E68B740275
:0E06AA00F090E6A0E04480F08002D322C3224C
:100CCD00C0E0C083C082D2015391EF90E65D740104
:080CDD00F0D082D083D0E03298
:100CFD00C0E0C083C0825391EF90E65D7404F0D0E4
:060D0D0082D083D0E03229
:100D1300C0E0C083C0825391EF90E65D7402F0D0CF
:060D230082D083D0E03213
:100BA700C0E0C083C082852925852A2685268285BF
:100BB7002583A37402F0852127852228852882852D
:100BC7002783A37407F05391EF90E65D7410F0D07C
:060BD70082D083D0E03261
:100CE500C0E0C083C082D2035391EF90E65D7408E3
:080CF500F0D082D083D0E03280
:100B6A00C0E0C083C08290E680E030E7208521257E
:100B7A00852226852682852583A37402F085292766
:100B8A00852A28852882852783A37407F05391EF45
:0D0B9A0090E65D7420F0D082D083D0E03270
:010D60003260
:010D6100325F
:010D6200325E
:010D6300325D
:010D6400325C
:010D6500325B
:010D6600325A
:010D67003259
:010D68003258
:010D69003257
:010D6A003256
:010D6B003255
:010D6C003254
:010D6D003253
:010D6E003252
:010D6F003251
:010D70003250
:010D7100324F
:010D7200324E
:010D7300324D
:010D7400324C
:010D7500324B
:010D7600324A
:010D77003249
:010D78003248
:010D79003247
:010D7A003246
:010D7B003245
:010D7C003244
:010D7D003243
:010D7E003242
:010D7F003241
:010D80003240
:010D8100323F
:010D8200323E
:010D8300323D
:100C8900901099E090E6C6F000000090109BE0906B
:100C9900E6C8F000000090109CE090E6C9F0000062
:020CA900002227
:100CAB009010A2E090E6C6F00000009010A4E09037
:100CBB00E6C8F00000009010A5E090E6C9F0000037
:020CCB00002205
:100C0C0090E682E030E004E020E60B90E682E030F3
:100C1C00E119E030E71590E680E04401F07F147EA6
:0C0C2C0000120AEC90E680E054FEF0227A
:100C640090E682E044C0F090E681F0438701000002
:040C7400000000225A
:100BDD0030060990E680E0440AF0800790E680E058
:100BED004408F07FDC7E05120AEC90E65D74FFF0A0
:0F0BFD0090E65FF05391EF90E680E054F7F0221E
:100AEC008E188F1990E600E05418700DE518C3139A
:100AFC00F518E51913F519801590E600E05418FF68
:100B0C00BF100BE51925E0F519E51833F518E519B3
:100B1C001519AE18700215184E6005120C7880EE7F
:010B2C0022A6
:020C3800A9070A
:100C3A00AE2DAF2E8F828E83A3E064037017AD01B1
:100C4A0019ED7001228F828E83E07C002FFDEC3E2D
:090C5A00FEAF0580DF7E007F0083
:010C6300226E
:100C78007400F58690FDA57C05A3E582458370F98F
:010C88002249
:03004300020900AF
:030053000209009F
:10090000020CCD00020D1300020CFD00020CE500EC
:10091000020BA700020B6A00020D6000020D6100CD
:10092000020D6200020D6300020D6400020D6500FD
:10093000020D6600020D6700020D6800020D6900DD
:10094000020D6A00020D6100020D6B00020D6C00C9
:10095000020D6D00020D6E00020D6F00020D7000A1
:10096000020D7100020D6100020D6100020D6100B7
:10097000020D7200020D7300020D7400020D75006D
:10098000020D7600020D7700020D7800020D79004D
:10099000020D7A00020D7B00020D7C00020D7D002D
:1009A000020D7E00020D7F00020D8000020D81000D
:0809B000020D8200020D83001C
:1008390060801000010101010101010700000000B1
:100849000000000007070707070707070000000067
:100859000000003F01010101010101070000000042
:100869000000000007070707070707070000000047
:100879000000003F0101013B0101010700000003E5
:100889000202020007050107070707070000002DFC
:100899000000003F013901010101010700030202C3
:1008A900020202000707070707070707002D0000D4
:1008B9000000003F602410870000000000000000D5
:1008C900000000000000000000008336010704005A
:1008D900030201813606070400030200471080E085
:0608E900000007EE4E00C6
:1007790090E60174EEF090E6F574FFF0901080E0D9
:1007890090E6F3F0901081E090E6C3F0901082E0DB
:1007990090E6C1F0901083E090E6C2F0901085E0F9
:1007A90090E6C0F0901086E090E6F4F075AF07741B
:1007B90010F59A7400F59B759DE4E4F59EFF90E6AB
:1007C9007BE090E67CF00FBF80F490E67174FFF057
:1007D900F5B490E672E04480F043B680000000E48E
:1007E90090E6C4F000000090E6C5F0901087E09014
:1007F900E6C6F0901088E090E6C7F0901089E09086
:10080900E6C8F090108AE090E6C9F090108BE0906D
:10081900E6CAF090108CE090E6CBF090108DE09055
:0B082900E6CCF090108EE090E6CDF0E1
:0108340022A1
:03000000020A6091
:0C0A6000787FE4F6D8FD75812E020AA70D
:100D4D00EB9FF5F0EA9E42F0E99D42F0E89C45F0FC
:010D5D002273
:100A6C00020319E493A3F8E493A34003F68001F284
:100A7C0008DFF48029E493A3F85407240CC8C3338B
:100A8C00C4540F4420C8834004F456800146F6DF5A
:100A9C00E4800B0102040810204080900835E47EAD
:100AAC00019360BCA3FF543F30E509541FFEE4934F
:100ABC00A360010ECF54C025E060A840B8E493A316
:100ACC00FAE493A3F8E493A3C8C582C8CAC583CA41
:100ADC00F0A3C8C582C8CAC583CADFE9DEE780BEF9
:0108EF000008
:00000001FF
Binary file not shown.
+21
View File
@@ -0,0 +1,21 @@
<html>
<head>
<title>You need a browser that supports frame to veiw this page.</title>
<meta name="GENERATOR" content="Namo WebEditor v5.0">
<meta name="description" content="Makes a banner frame in the top, menu frame in the left, and main frame in the right. Hyperlinks in the banner frame are targeted to the menu frame.">
</head>
<frameset rows="60, 78%" cols="1*" border="0">
<frame name="banner" scrolling="no" marginwidth="10" marginheight="14" namo_target_frame="contents" src="app_note/Caption.htm">
<frameset rows="1*" cols="200, 80%">
<frame name="contents" scrolling="auto" marginwidth="10" marginheight="14" namo_target_frame="detail" src="app_note/mainmenu.htm">
<frame name="detail" scrolling="yes" marginwidth="10" marginheight="14" src="app_note/intro.htm">
</frameset>
<noframes>
<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<p>You need a browser that supports frame to veiw this page.</p>
</body>
</noframes>
</frameset>
</html>
@@ -0,0 +1,24 @@
<html>
<head>
<title>Index</title>
<base target="contents"></head>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<table cellpadding="0" cellspacing="0" width="100%" align="center">
<tr>
<td width="198" height="26">
<p align="center"><span style="font-size:12pt;"><font face="Verdana">&nbsp;</font></span></p>
</td>
<td width="441" height="26">
<p align="center"><strong><samp><font color="black" face="Verdana"><span style="font-size:12pt;"><b>FIFO
DESIGN EXAMPLE</b></span></font></samp></strong></p>
</td>
<td width="189" height="26">
<p align="right"><strong><samp><font color="#0000CC" face="Verdana"><span style="font-size:12pt;"><img src="images/smalllogo.gif" width="95" height="30" border="0">&nbsp;</span></font></samp></strong></p>
</td>
</tr>
</table>
<hr></body>
</html>
@@ -0,0 +1,602 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>GPIF</title>
<meta name="generator" content="BBEdit 6.0">
<script language="JavaScript">
<!--
function na_preload_img()
{
var img_list = na_preload_img.arguments;
if (document.preloadlist == null)
document.preloadlist = new Array();
var top = document.preloadlist.length;
for (var i=0; i < img_list.length; i++) {
document.preloadlist[top+i] = new Image;
document.preloadlist[top+i].src = img_list[i+1];
}
}
function na_change_img_src(name, nsdoc, rpath, preload)
{
var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
if (name == '')
return;
if (img) {
img.altsrc = img.src;
img.src = rpath;
}
}
// -->
</script>
</head>
<body bgcolor="#FFFFFF" OnLoad="na_preload_img(false, 'images/cp-04.gif');">
<table border="0" cellpadding="0" cellspacing="0" width="90%" align="center">
<tr valign="top">
<td colspan="1" align="left">
<p align="center"><font face="verdana, arial, helvetica, sans-serif" size="2" color="#000000"><B><a name="SingleXactions"></a>Implementing FIFO
(multiple) Transactions</B></font>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left">
<p>
<font face="Verdana,Arial" size="1" color="#000000">A fully working external FIFO example using GPIF Single transactions has already been discussed, but the bandwidth achieved is miniscule.
This is because there is a lot of firmware overhead involved in launching GPIF Single transactions. With GPIF FIFO transactions, the GPIF engine
directly handles bursts of data, so a higher bandwidth over the physical interface is achievable.<br>
<br><a name="FlowStates"></a></font><font face="Verdana" size="1"><b>Introducing
the Flow State Feature of the GPIF<br><br> </b>In order to efficiently
handle bursts of data and meet burst access timing to the external
FIFO, the flow state feature of the GPIF was utilized for the FIFO
transaction example. The flow state feature makes its debut in the
FX2 GPIF and is a mechanism that allows the GPIF to efficiently
throttle data on and off the bus by using an independent set of
RDYn logic (flow logic) that is separate from the decision point
RDYn logic. Since the flow state feature is an advanced mode of
the GPIF, not every application will need to use the flow state.
However, handling bursts of data to and from an external FIFO shows
the simplest application of the flow state. One very advanced application
of the flow state is in the generation of UDMA waveforms for the
FX2 mass storage reference design firmware.</font>
<p><font face="Verdana" size="1">In any GPIF waveform, there can
only be one flow state, but it can be any of the available non-idle
states (S0S6). The flow state behavior is controlled by a set of
registers that are specific to the flow state feature (see the FX2
Technical Reference Manual for flow state register details). One
can think of the flow state as being “orthogonal” to one of the
GPIF waveforms states, but it is still the regular decision point
logic that is responsible for determining when the flow state should
be exited and the normal GPIF waveform behavior continues.</font></p>
<p><font face="Verdana" size="1">Another property of the flow state
is that it can be programmed to perform a different set of CTLx
logic than what is described in the GPIF waveform descriptors themselves.
This brings the level of autonomy to another notch. The idea behind
the GPIF FIFO Read and Write descriptor programming is to have the
read and write control lines assert for the duration of the transaction,
thereby allowing data to be moved on every edge of IFCLK. Therefore,
a 16-bit interface running at 48 MHz would yield an effective burst
data rate of 96 MB/s over the GPIF interface.</font></p>
<p><font face="Verdana" size="1">The main difference between this
FIFO transaction version and the single transaction version is that
waveforms 2 and 3 are used (FIFORd and FIFOWr waveforms, respectively)
instead of waveforms 0 and 1. RDY5 is used as the GPIF transaction
count (GPIF TC) internal expiration flag (TCXpire). The GPIF TC
is what is used in the waveforms decision point logic to determine
when to exit out of the flow state and terminate the waveform.<br></font></p>
<p align="center"><font face="Verdana" size="1"><img src="images/BlkDiag2.gif" width="432" height="327" border="0"><br>Figure
16. &nbsp;Block Diagram for FIFO Transactions</font><font face="Verdana,Arial" size="1" color="#000000">&nbsp;
</font></p>
<p><font face="Verdana" size="1"><b><a name="WaveformDescriptors"></a></b><i>Figure
16</i> shows the set-up of the block diagram and the naming conventions
of the CTLx and RDYn signals (same as the single transaction example).
<i>Figure 17</i> below shows waveform 3, which characterizes the behavior
of the FIFO Write waveform.<br><br></font></p>
<p align="center"><font face="Verdana" size="1"><img src="images/FifoWr.gif" width="432" height="327" border="0"><br>Figure
17. FIFO Write waveform in GPIF Designer<br></font></p>
<p><font face="Verdana" size="1">In this FIFO Write waveform (waveform
3) we see that S0 is a period of inactivity, followed by S1 which
is designated as the flow state. The decision point logic in S1
looks at the GPIF TC to determine when to terminate the waveform
by branching to the IDLE state. As previously mentioned, the flow
logic in S1 then takes over to throttle data on and off the bus
and manipulate the CTLx lines. The flow state registers are set
up by selecting the various flow state parameters, accessed by right
clicking on the S1 state trace.</font></p>
<p><font face="Verdana" size="1">In order to set up the flow state
for both FIFO reads and writes, a set of global GPIF and flow state
registers are first initialized. The values are taken from a FlowStates[36]
array in gpif.c, generated by GPIF Designer.<br></font></p>
<ul>
<p><font face="Verdana" size="1">(Note: <i>The FlowStates array,
in GPIF.c, could be re-declared as FlowStates[4][9], for simplicity.
&nbsp;The first 9 elements contain the FlowState register values
for waveform 0. &nbsp;The next 9 elements&nbsp;contain the FlowState
register values for waveform 1, etc. &nbsp;Therefore, FlowStates[19]
is the same element as FlowStates[2][1].</i>)</font></p>
<p><font face="Verdana" size="1">EP2GPIFFLGSEL = 0x01; </font><font face="Verdana" size="1" color="#009900">//
For EP2OUT, GPIF uses EF flag</font><font face="Verdana" size="1"><br>SYNCDELAY;<br>EP6GPIFFLGSEL
= 0x02; </font><font face="Verdana" size="1" color="#009900">//
For EP6IN, GPIF uses FF flag</font><font face="Verdana" size="1"><br>SYNCDELAY;<br><br>//
global flowstate register initializations<br>FLOWLOGIC = FlowStates[19];</font><font face="Verdana" size="1" color="#009900">
// 0011 0110b - LFUNC[1:0] = 00 (A AND B), TERMA/B[2:0]=110
(FIFO Flag)</font><font face="Verdana" size="1"><br>SYNCDELAY;<br>FLOWSTB
= FlowStates[22]; </font><font face="Verdana" size="1" color="#009900">//
0000 0100b - MSTB[2:0] = 100 (CTL4), not used as strobe</font><font face="Verdana" size="1"><br>SYNCDELAY;<br>GPIFHOLDAMOUNT
= FlowStates[26]; </font><font face="Verdana" size="1" color="#009900">//
hold data for one half clock (10ns) assuming 48MHz IFCLK</font><font face="Verdana" size="1"><br>SYNCDELAY;<br>FLOWSTBEDGE
= FlowStates[24]; </font><font face="Verdana" size="1" color="#009900">//
move data on both edges of clock</font><font face="Verdana" size="1"><br>SYNCDELAY;<br>FLOWSTBHPERIOD
= FlowStates[25]; </font><font face="Verdana" size="1" color="#009900">//
20.83ns half period</font><font face="Verdana" size="1"><br>SYNCDELAY;<br></font></p>
</ul>
<p><font face="Verdana" size="1">The set-up is such that when FIFO
Write transactions are launched from EP2OUT, the GPIF uses EP2s
empty flag (EF) as the FIFO Flag, and when FIFO Read transactions
are launched into EP6IN, the GPIF uses EP6s full flag (FF) as the
FIFO Flag.</font></p>
<p><font face="Verdana" size="1">Subsequently, the flow logic is
set up to use the FIFO Flag to throttle data on and off the bus,
so the flow state mechanism actually uses EP2EF and EP6FF status
to know when to keep writing to the data bus or keep reading from
the data bus, respectively.</font></p>
<p><font face="Verdana" size="1">Although CTL4 (unused) is not used
in the application, we take advantage of the fact that the flow
state can use any of the CTLx lines as a data strobe. At a 48-MHz
IFCLK, CTL4 is toggled at a half period of 20.83 ns. Since the flow
state is also programmed to move data on both edges of the data
strobe, this allows us to nicely align the data values with the
rising edge of IFCLK and achieve a 96-MB/s burst rate over the physical
interface. Note that although CTL4 is not physically exposed on
the 56-pin package, the flow state logic can still be set up to
use it as a data strobe.</font></p>
<p><font face="Verdana" size="1">Lets also examine the flow state
register set-up that is specific to FIFO Writes:<br></font></p>
<ul>
<p><font face="Verdana" size="1">void Setup_FLOWSTATE_Write
( void )<br>{<br>FLOWSTATE = FlowStates[18];</font><font face="Verdana" size="1" color="#009900">
// 1000 0001b - FSE=1, FS[2:0]=001</font><font face="Verdana" size="1"><br>SYNCDELAY;<br>FLOWEQ0CTL
= FlowStates[20]; </font><font face="Verdana" size="1" color="#009900">//
CTL0 = 0 when flow condition equals zero (data flows)</font><font face="Verdana" size="1"><br>SYNCDELAY;<br>FLOWEQ1CTL
= FlowStates[21]; </font><font face="Verdana" size="1" color="#009900">//
CTL0 = 1 when flow condition equals one (data does not flow)</font><font face="Verdana" size="1"><br>SYNCDELAY;<br>}<br></font></p>
</ul>
<p><font face="Verdana" size="1">Here we designate S1 to be the
flow state and define the state of CTL0 when the flow condition
equals zero (data flows) and when the flow condition equals one
(data does not flow). Remember that the state of the flow condition
is determined by the state of EP2EF. So when the EP2 FIFO contains
data (EP2 is not empty) the flow condition equals zero, the flow
state drops CTL0 LOW (WEN# is asserted), and data is placed on FD[15:0].</font></p>
<p><font face="Verdana" size="1"><i>Figure 18</i> below shows waveform
2, which characterizes the behavior of the FIFO Read waveform.<br></font></p>
<p align="center"><font face="Verdana" size="1"><img src="images/fiforead.gif" width="432" height="327" border="0"><br>Figure
18. FIFO Read waveform in GPIF Designer<br></font></p>
<p><font face="Verdana" size="1">In this FIFO Read waveform (waveform
2) S0 is a period of inactivity, then S1 and S2 sets up the “front
porch” of the burst transfer, followed by S3 which is designated
as the flow state. The decision point logic in S3 looks at the GPIF
TC to determine when to terminate the waveform by branching to the
IDLE state. As previously mentioned, the flow logic in S3 then takes
over to throttle data reads from the bus and manipulate the CTLx
lines.</font></p>
<p><font face="Verdana" size="1">Lets examine the flow state register
set-up that is specific to FIFO Reads:<br></font></p>
<ul>
<p><font face="Verdana" size="1">void Setup_FLOWSTATE_Read (
void )<br>{<br>FLOWSTATE = FlowStates[27]; </font><font face="Verdana" size="1" color="#009900">//
1000 0011b - FSE=1, FS[2:0]=003</font><font face="Verdana" size="1"><br>SYNCDELAY;<br>FLOWEQ0CTL
= FlowStates[29]; </font><font face="Verdana" size="1" color="#009900">//
CTL1/CTL2 = 0 when flow condition equals zero (data flows)</font><font face="Verdana" size="1"><br>SYNCDELAY;<br>FLOWEQ1CTL
= FlowStates[30]; </font><font face="Verdana" size="1" color="#009900">//
CTL1/CTL2 = 1 when flow condition equals one (data does not
flow)</font><font face="Verdana" size="1"><br>SYNCDELAY;<br>}<br></font></p>
</ul>
<p><font face="Verdana" size="1">Here we designate S3 to be the
flow state and define the state of CTL1 and CTL2 when the flow condition
equals zero (data flows) and when the flow condition equals one
(data does not flow). Remember that the state of the flow condition
is determined by the state of EP6FF. So when the EP6 FIFO has room
for data (EP6 is not full) the flow condition equals zero, the flow
state drops CTL1 and CTL2 LOW (REN and OE are asserted), and data
is read from FD[15:0].<br><br>Since there is a different flow state
register set-up for FIFO read and write operations, the firmware
has to call Setup_FLOWSTATE_Read() before launching a GPIF FIFO
read transaction, and call Setup_FLOWSTATE_Write() before launching
a GPIF FIFO write transaction.</font></p>
<p><font face="Verdana" size="1">Now that you understand how the
GPIF FIFO read and write waveforms were programmed and set up, the
firmware programming for GPIF FIFO transactions can be discussed.&nbsp;</font></p>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left" height="13">
<p>&nbsp;</p>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left">
<p align="center">
</td>
</tr>
<tr>
<td colspan="1" align="center" height="13">
<p align="left"><font face="Verdana" size="1"><b><a name="FW"></a>FIFO Transaction
Firmware<br>&nbsp;</b></font></p>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left">
<p>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">In moving from GPIF Single transactions to GPIF FIFO transactions, the only major difference really lies in the TD_Poll() code. The basic underlying
architecture of the example remains the same. In this section, the basic principles of launching a FIFO transaction are introduced. Following that
is a discussion of the TD_Poll() code that triggers the GPIF FIFO transactions.<br>&nbsp;</font> </td>
</tr>
<tr valign="top">
<td colspan="1" align="left">
<ul>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><B><a name="Triggering"></a>Triggering GPIF FIFO Transactions<br><br></B>For triggering GPIF FIFO transactions, we reiterate the concept of the GPIF transaction count (TC). Analogous to the Tcount variable in the single
transaction example, the TC is a value the GPIF engine uses to determine how many times to go through a FIFO waveform.<br><br>For example, if the user wished to burst out 512 bytes of data from the EP2OUT endpoint, the TC value would be set to 512 (for byte wide operation) or 256
(for word wide operation). The GPIF engine then decrements the TC value on every push or pop of the FIFO. When the TC value reaches zero, the waveform is
complete (a waveform completion is signified by the GPIFDONE being set in the GPIFIDLECS register). A decision point state can use the TC value as an
internal flag to determine whether or not to branch to the IDLE state. GPIFREADYCFG.5 must be set to allow the GPIF engine to use the RDY5 signal as an
internal TC expiration flag.<br>
<br>
The act of triggering a GPIF FIFO transaction is actually very simple. Writing to the R/W bit in the GPIFTRIG register sets the direction of the
transaction. If R/W=1, a FIFO Read transaction gets triggered when accessing the GPIFTRIG register. If R/W=0, a FIFO Write transaction get triggered
instead.<br><br>For example, to trigger a GPIF FIFO Read transaction to EP6IN use the following line of code:<br><br></font>
<p><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">GPIFTRIG = GPIFTRIGRD | GPIF_EP6; <font color="#339933">// launch GPIF FIFO Read transaction to EP6IN<br><br></font>To trigger a GPIF FIFO Write transaction from EP2OUT use the following line of code:<br></font>
<p><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">GPIFTRIG = GPIF_EP2; <font color="#339933">// launch GPIF FIFO Write transaction from EP2OUT<br><br></font>GPIFTRIGRD, GPIF_EP6, and GPIF_EP2 are bit masks to set the appropriate bits in the GPIFTRIG register. By setting the EP[1:0] bits in the GPIFTRIG
register to valid options of 0,1,2, or 3 (in order of the endpoints 2,4,6, and 8), this specifies which endpoint should be used in the transaction.
Source or sink direction is implied by whether the endpoint is an IN or and OUT endpoint.&nbsp;</font>
</ul>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left">
<ul>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><B><a name="TD_Init("></a>TD_Init( )&nbsp;</B></font>
</ul>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left">
<ul>
<p>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">The initialization code in <B>TD_Init( )</B> remains pretty much the same as the single transaction version. The main differences lie in the setup of the FIFOCFG
registers. To maximize the USB 2.0 bandwidth, the endpoints are placed into auto mode (AUTOOUT/AUTOIN=1). Note that the bits 1 and 0 of the REVCTL
register are not set. Therefore, it is necessary to first set AUTOOUT=0, then set AUTOOUT=1. The FX2 needs to see a 0 to 1 transition of the AUTOOUT
bit to automatically arm the endpoint buffers.&nbsp;</font>
</ul>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left">
<ul>
<p>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><font color="#339933">// set the CPU clock to 48MHz</font><br>
CPUCS = ((CPUCS &amp; ~bmCLKSPD) | bmCLKSPD1);<br>
<font color="#666666">SYNCDELAY</font>; <br>
<br>
EP2CFG = <font color="#0000CC">0xA0</font>; <font color="#339933">// EP2OUT, bulk, size 512, 4x buffered</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
EP6CFG = <font color="#0000CC">0xE0</font>; <font color="#339933">// EP6IN, bulk, size 512, 4x buffered</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
<br>
FIFORESET = <font color="#0000CC">0x80</font>; <font color="#339933">// set NAKALL bit to NAK all transfers from host</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
FIFORESET = <font color="#0000CC">0x02</font>; <font color="#339933">// reset EP2 FIFO</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
FIFORESET = <font color="#0000CC">0x06</font>; <font color="#339933">// reset EP6 FIFO</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
FIFORESET = <font color="#0000CC">0x00</font>; <font color="#339933">// clear NAKALL bit to resume normal operation</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
<br>
EP2FIFOCFG = <font color="#0000CC">0x01</font>;<br>
<font color="#666666">SYNCDELAY</font>;<br>
EP2FIFOCFG = <font color="#0000CC">0x11</font>; <font color="#339933">// auto out mode, disable PKTEND zero length send, word ops</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
EP6FIFOCFG = <font color="#0000CC">0x09</font>; <font color="#339933">// auto in mode, disable PKTEND zero length send, word ops</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
<br>
GpifInit (); <font color="#339933">// initialize GPIF registers</font><br>
<br>
<font color="#339933">// reset the external FIFO</font><br>
OEA |= <font color="#0000CC">0x04</font>; <font color="#339933">// turn on PA2 as output pin</font><br>
IOA |= <font color="#0000CC">0x04</font>; <font color="#339933">// pull PA2 high initially</font><br>
IOA &amp;= <font color="#0000CC">0xFB</font> <font color="#339933">// bring PA2 low</font><br>
EZUSB_Delay (<font color="#0000CC">1</font>); <font color="#339933">// keep PA2 low for ~1ms, more than enough time</font><br>
IOA |= <font color="#0000CC">0x04</font>; <font color="#339933">// bring PA2 high</font><br>
<br></font> </ul>
</font>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left">
<p>
<ul>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><B><a name="TD_Poll()"></a>TD_Poll()</B>&nbsp;</font>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15">
<ul>
<p align="left">
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">The first thing the OUT handling code does is it checks to see if the GPIF is IDLE. If so, it checks to see if there is at least a packet in the
peripheral domain for EP2. Since EP2 is placed into auto mode, the firmware does not need to check if the host sent a USB packet. The USB packets are
automatically committed to be used by the GPIF engine. Therefore, the firmware's job is to check if at least one packet has been committed to the
peripheral domain.<br>
<br>
Then, if the external FIFO is not full, the TC value is setup for word wide operation (256). The TC value is a 32-bit register field, but for this
application only the lower 16-bit fields are necessary. Since each GPIF FIFO Write transaction sends 512 bytes to the external FIFO over a 16-bit
interface, the number of transactions is always half the number of bytes actually contained within the endpoint buffer. The appropriate TC value is
setup for either high speed or full speed operation.<br>
<br>
The appropriate flow state registers are then setup for the FIFO Write transaction, and a write to the GPIFTRIG register with the appropriate bits
triggers the transaction from EP2OUT. The code then waits for the transaction to complete before exiting out of the &quot;if&quot; nest.<br><br><font color="#339933">// code that handles USB OUT transfers<br></font><br>
<font color="#990000">if</font>( GPIFTRIG &amp; <font color="#0000CC">0x80</font> ) <font color="#339933">// if GPIF interface IDLE</font><br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#990000">if</font> ( ! ( EP24FIFOFLGS &amp; <font color="#0000CC">0x02</font> ) ) <font color="#339933">// if there's a packet in the peripheral domain for EP2</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#990000">if</font> ( EXTFIFONOTFULL ) <font color="#339933">// if the external FIFO is not full</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#990000">if</font>(enum_high_speed)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GPIFTCB1 = <font color="#0000CC">0x01</font>; <font color="#339933">// setup transaction count (512 bytes/2 for word wide -&gt; 0x0100)</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GPIFTCB0 = 0<font color="#0000CC">x00</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#990000">else</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GPIFTCB1 = <font color="#0000CC">0x00</font>; <font color="#339933">// setup transaction count (64 bytes/2 for word wide -&gt; 0x20)</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GPIFTCB0 = <font color="#0000CC">0x20</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Setup_FLOWSTATE_Write(); <font color="#339933">// setup FLOWSTATE registers for FIFO Write operation</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GPIFTRIG = GPIF_EP2; <font color="#339933">// launch GPIF FIFO WRITE Transaction from EP2 FIFO</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#990000">while</font>( !( GPIFTRIG &amp; <font color="#0000CC">0x80</font> ) ) <font color="#339933">// poll GPIFTRIG.7 GPIF Done bit</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
}<br><br>Just like the single transaction firmware, if the in_enable flag is not set, the code will just sit there and not process the INs.<br>
<br>
If the in_enable flag is set, the code will fall through and check if the GPIF interface is IDLE. It then goes on to check if the external FIFO is
not empty. If the external FIFO has data, the code then determines if EP6 has room for at least one more data packet.<br>
<br>
If EP6 has room for at least one more data packet, the TC value is setup for word wide operation (256). The appropriate TC value is setup for either
high speed or full speed operation. The flow state registers are then setup for the FIFO Read transaction, and a write to the GPIFTRIG register with
the appropriate bits triggers the transaction to fill the EP6 FIFO. The code then waits for the transaction to complete. Since EP6 is placed into auto
mode, there is no need to explicitly write a byte count value to indicate how many bytes to send to the host. FX2 uses the EP6AUTOINLENH/L register
values set at enumeration time in the DR_SetConfiguration() function for the auto commit size.<br><br><font color="#339933">// code that handles USB IN transfers<br><br></font><font color="#990000">if</font> (in_enable) <font color="#339933">// if IN transfers are enabled</font><br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#990000">if</font> ( GPIFTRIG &amp; <font color="#0000CC">0x80</font> ) <font color="#339933">// if GPIF interface IDLE</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;{ <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#990000">if</font> ( EXTFIFONOTEMPTY ) <font color="#339933">// if external FIFO is not empty</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( !( EP68FIFOFLGS &amp; <font color="#0000CC">0x01</font> ) ) <font color="#339933">// if EP6 FIFO is not full</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#990000">if</font> (enum_high_speed)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GPIFTCB1 = <font color="#0000CC">0x01</font>; <font color="#339933">// setup transaction count (512 bytes/2 for word wide -&gt; 0x0100)</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GPIFTCB0 = <font color="#0000CC">0x00</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#990000">else</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GPIFTCB1 = <font color="#0000CC">0x00</font>; <font color="#339933">// setup transaction count (64 bytes/2 for word wide -&gt; 0x20)</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GPIFTCB0 = <font color="#0000CC">0x20</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Setup_FLOWSTATE_Read(); <font color="#339933">// setup FLOWSTATE registers for FIFO Read operation</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GPIFTRIG = GPIFTRIGRD | GPIF_EP6; <font color="#339933">// launch GPIF FIFO READ Transaction to EP6 FIFO</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#990000">while</font> ( !( GPIFTRIG &amp; <font color="#0000CC">0x80</font> ) ) /<font color="#339933">/ poll GPIFTRIG.7 GPIF Done bit</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
}<br><br>&nbsp;</font>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15">
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><B><a name="Running"></a>Running the example for GPIF FIFO Transactions<br><br></B>The procedure for running the FIFO transaction example is essentially the same as the Single transaction example. Going through steps 1 through 3 of
section 4.1.6 will allow the user to run the FIFO transaction example as well. For running this version of the example, unzip the &quot;FX2_to_extsyncFIFO GPIF
FIFO Transactions Auto mode.zip&quot; package instead.<br>
<br>
A couple of differences to note are that LED0 will no longer flash when the code is downloaded, and that a few more vendor commands were added for
debug purposes. The LED0 code was taken out of TD_Poll() to optimize the firmware execution for FIFO transactions.<br>
<br></font><font face="verdana, arial, helvetica, sans-serif" size="1" color="#666666"><b>Debug Tip:</b><br>
The use of vendor commands is a &quot;cheap&quot; way to add more debug functionality to the code without incurring unnecessary &quot;printf&quot; statements. With the use of
vendor commands, the Keil debugger is not necessary for peeking and poking register values after the fact, which is what most GPIF firmware developers will
end up doing. For example, the vendor command 0xb6 was added to the FIFO transaction firmware to read back the status of the GPIF engine. The vendor
command returns the 0xb6 request with the value of the GPIFTRIG register. If the GPIF engine has completed a FIFO read or write transaction, the GPIFDONE
bit is set, returning a value of 0x80. The screenshot below shows what the user should see in the EZ-USB Control Panel window.<br></font>
<ul>
<p align="left"><A onClick="na_change_img_src('image1', 'document', 'images/cp-04.gif', true);"><B><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><img src="images/cp-04.gif" width="450" height="400" border="0" name="image1"></font></B></A><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><B><br>&nbsp;</B></font></p>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15">
<p align="left"><font face="Verdana" size="1"><b><a name="Traces"></a>Logic
Analyzer Traces<br></b><br>These are the traces the user should
see on the logic analyzer as the FIFO transaction example runs.
&nbsp;The traces were captured using an HP1660C logic analyzer.<br><br><b>&nbsp;</b></font></p>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15">
<p align="left"><font face="Verdana,Arial" size="1" color="black"><b><a name="WriteTrace1"></a>FIFO Write</b></font><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">: Close-up view of the front porch<br><br>This trace shows that the 4 ns data setup time for the external FIFO is satisfied using the X to 0 marker as an indicator. The word
consisting of data values 0x02 and 0x03 is written into the external FIFO on the rising edge of IFCLK (the external FIFO's WCLK).
While WEN/ is held low, consecutive words are written into the external FIFO on every rising edge of IFCLK. Notice that the
GSTATE bus reflects the state of the GPIF engine as it's progressing through the GPIF FIFO Write waveform. S0 is a period of
inactivity for 1 IFCLK cycle (20.83 ns) and S1 is the flow state and is active for the entire duration of the data burst phase.<br><br></font><img src="images/law1.gif" width="544" height="364" align="center" border="0" ismap usemap="#cancel_map">
<p>&nbsp;</p>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="19">
<p align="left"><font face="Verdana,Arial" size="1" color="black"><b><a name="WriteTrace2"></a>FIFO Write</b></font><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">:
Close-up view of the back porch<br><br>Here we see the back end of the 512 byte transfer at a zoomed in level. The last word in the packet consists of data values 0xFE
and 0xFF (the end of our ramp test data). Note that a repeated word at the end is not clocked in as the setup time for the WEN/
line is not met prior to the IFCLK edge.<br><br></font><img src="images/law3.gif" width="545" height="363" align="center" border="0" ismap usemap="#ImageMap1"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">&nbsp;<br><br>&nbsp;</font> </td>
</tr>
<tr>
<td colspan="1" align="center" height="15">
<p align="left"><font face="Verdana,Arial" size="1" color="black"><b><a name="WriteTrace3"></a>FIFO Write</b></font><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">:
Time taken to transfer 512 bytes to the external FIFO<br><br>This trace shows how long it takes to write a burst of 512 bytes (256 words) into the external FIFO. At a burst rate of 96MB/s (one
word every IFCLK period), this results in a time of approximately 5.3 microseconds to transfer a payload of 512 bytes. This zoomed
out view allows us to see that indeed the GPIF FIFO Write waveform remains in the flowstate until it is done transferring 512
bytes, at which point it then transitions to the IDLE state (S7).<br><br></font><img src="images/law2.gif" width="543" height="362" align="center" border="0" ismap usemap="#ImageMap2"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">&nbsp;<br><br>&nbsp;</font> </td>
</tr>
<tr>
<td colspan="1" align="center" height="15">
<p align="left"><font face="Verdana,Arial" size="1" color="black"><b><a name="WriteTrace4"></a>FIFO Write</b></font><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">:
Inter-packet transfer time<br><br>In this trace we examine the inter-packet transfer time between consecutive OUTs sent by the host. Notice that the FX2 has
approximately 20 microseconds to spare before it has to burst out the next OUT packet. This means that the host is behind.<br><br></font><img src="images/law4.gif" width="544" height="362" align="center" border="0" ismap usemap="#ImageMap3"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">&nbsp;<br><br>&nbsp;</font> </td>
</tr>
<tr>
<td colspan="1" align="center" height="15">
<p align="left"><font face="Verdana,Arial" size="1" color="black"><b><a name="ReadTrace1"></a>FIFO Read</b></font><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">:
Close-up view of the front porch<br><br>This trace shows that the 9.2 ns data setup time for the GPIF is satisfied using the X to 0 marker as an indicator. The word
consisting of data values 0x00 and 0x01 is read from the external FIFO on the rising edge of IFCLK (the external FIFO's RCLK).
While REN/ is held low, consecutive words are read from the external FIFO on every rising edge of IFCLK. Notice that the GSTATE
bus reflects the state of the GPIF engine as it's progressing through the GPIF FIFO Read waveform. S0 is a period of inactivity
for 1 IFCLK cycle (20.83 ns). In S1, the REN/ is asserted since the external FIFO requires that the REN/ be setup t<sub>ENS</sub> before
the OE/ line is asserted. S2 asserts the OE/ line, and S3 is the flow state and is active for the entire duration of the data burst phase.<br><br></font><img src="images/law5.gif" width="546" height="364" align="center" border="0" ismap usemap="#ImageMap4"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">&nbsp;<br><br>&nbsp;</font> </td>
</tr>
<tr>
<td colspan="1" align="center" height="15">
<p align="left"><font face="Verdana,Arial" size="1" color="black"><b><a name="ReadTrace2"></a>FIFO Read</b></font><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">:
Close-up view of the back porch<br><br>Here we see the back end of the 512 byte transfer at a zoomed in level. The last word in the packet consists of data values 0xFE
and 0xFF (the end of our ramp test data). Note that a repeated word at the end is not clocked in as the setup time for the REN/
line is not met prior to the IFCLK edge.<br><br></font><img src="images/law7.gif" width="545" height="363" align="center" border="0" ismap usemap="#ImageMap5"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">&nbsp;<br><br>&nbsp;</font> </td>
</tr>
<tr>
<td colspan="1" align="center" height="15">
<p align="left"><font face="Verdana,Arial" size="1" color="black"><b><a name="ReadTrace3"></a>FIFO Read</b></font><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">:
Time taken to read 512 bytes from the external FIFO<br><br>This trace shows how long it takes to read a burst of 512 bytes from the external FIFO. At a burst rate of 96MB/s (one word every
IFCLK period), this results in a time of approximately 5.3 microseconds to transfer a payload of 512 bytes. This zoomed out view
allows us to see that indeed the GPIF FIFO Read waveform remains in the flowstate until it is done transferring 512 bytes, at
which point it then transitions to the IDLE state (S7).<br><br></font><img src="images/law6.gif" width="547" height="364" align="center" border="0" ismap usemap="#ImageMap6"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">&nbsp;<br><br>&nbsp;</font> </td>
</tr>
<tr>
<td colspan="1" align="center" height="15">
<p align="left"><font face="Verdana,Arial" size="1" color="black"><b><a name="ReadTrace4"></a>FIFO Read</b></font><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">:
Inter-packet transfer time<br><br>In this trace we examine the inter-packet transfer time between consecutive INs requested by the host. Notice that the FX2 has
approximately 20 microseconds to spare before it has to fulfill the next IN request. This means that the host is behind.<br><br></font><img src="images/law8.gif" width="544" height="362" align="center" border="0" ismap usemap="#ImageMap7"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">&nbsp;<br><br>&nbsp;</font> </td>
</tr>
<tr>
<td colspan="1" align="center" height="15">
<p align="left"><font face="Verdana,Arial" size="1" color="black"><b><a name="BulkTrace"></a>Bulk Loopback</b></font><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">:
FIFO Reads and Writes<br><br>The user will observe the above wavefrom when the bulkloop utility is exercised. This trace shows activity that includes both reads
and writes to the external FIFO. We notice here that the host judiciously schedules INs and OUTs. No favoritism is shown to either
type of transfer.<br><br></font><img src="images/law9.gif" width="543" height="362" align="center" border="0" ismap usemap="#ImageMap8"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">&nbsp;</font>
<p align="left">&nbsp;</p>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15">
<P align="left"><font size="1" face="Verdana"><b><a name="Summary"></a>Summary<br></b></font></P>
<p align="left"><font size="1" face="Verdana">This design example of a 16-bit interface to an external synchronous FIFO has
brought to the forefront many GPIF programming fundamentals, such as determining
GPIF hardware connections, creating GPIF single and FIFO waveform descriptors
using the GPIF Tool, and how to launch GPIF single and FIFO transfers in
firmware. The user should now have a firm grasp of what it takes to create a
full featured GPIF applications solution, and how to go from a simple set of
firmware that utilizes GPIF single transactions, to a more complex and robust
application that uses GPIF FIFO transfers. Also, by now the user should be aware
that the logic analyzer is a GPIF programmer's best friend. Let's extend the
basic toolset the user should already have by presenting a more </font><A
href="../../dsp/app_note.htm" target=_top><font size="1" face="Verdana">complex design example using a TI
DSP</font></A><font face="Verdana" size="1">.<BR></font></p>
</td>
</tr>
</table>
&nbsp;<map name="cancel_map">
<area shape="rect" coords="381, 5, 435, 28" onClick="parent.frames[0].location='../cFifo106.htm'; parent.frames[1].location='../nFifo106.htm';">
</map><map name="ImageMap1">
<area shape="rect" coords="392, 4, 448, 26" onClick="parent.frames[0].location='../cFifo106.htm'; parent.frames[1].location='../nFifo106.htm';">
</map><map name="ImageMap2">
<area shape="rect" coords="390, 4, 447, 26" onClick="parent.frames[0].location='../cFifo106.htm'; parent.frames[1].location='../nFifo106.htm';">
</map><map name="ImageMap3">
<area shape="rect" coords="391, 4, 448, 26" onClick="parent.frames[0].location='../cFifo106.htm'; parent.frames[1].location='../nFifo106.htm';">
</map><map name="ImageMap4">
<area shape="rect" coords="392, 4, 449, 27" onClick="parent.frames[0].location='../cFifo106.htm'; parent.frames[1].location='../nFifo106.htm';">
</map><map name="ImageMap5">
<area shape="rect" coords="392, 4, 448, 26" onClick="parent.frames[0].location='../cFifo106.htm'; parent.frames[1].location='../nFifo106.htm';">
</map><map name="ImageMap6">
<area shape="rect" coords="393, 4, 450, 27" onClick="parent.frames[0].location='../cFifo106.htm'; parent.frames[1].location='../nFifo106.htm';">
</map><map name="ImageMap7">
<area shape="rect" coords="391, 4, 448, 26" onClick="parent.frames[0].location='../cFifo106.htm'; parent.frames[1].location='../nFifo106.htm';">
</map><map name="ImageMap8">
<area shape="rect" coords="390, 4, 447, 26" onClick="parent.frames[0].location='../cFifo106.htm'; parent.frames[1].location='../nFifo106.htm';">
</map></body>
</html>
@@ -0,0 +1,846 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>GPIF</title>
<meta name="generator" content="BBEdit 6.0">
<script language="JavaScript">
<!--
function na_preload_img()
{
var img_list = na_preload_img.arguments;
if (document.preloadlist == null)
document.preloadlist = new Array();
var top = document.preloadlist.length;
for (var i=0; i < img_list.length; i++) {
document.preloadlist[top+i] = new Image;
document.preloadlist[top+i].src = img_list[i+1];
}
}
function na_change_img_src(name, nsdoc, rpath, preload)
{
var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
if (name == '')
return;
if (img) {
img.altsrc = img.src;
img.src = rpath;
}
}
// -->
</script>
</head>
<body bgcolor="#FFFFFF" OnLoad="na_preload_img(false, 'images/cp-01.gif', 'images/cp-02.gif', 'images/cp-03.gif');">
<table border="0" cellpadding="0" cellspacing="0" width="90%" align="center">
<tr valign="top">
<td colspan="1" align="left" width="744">
<p align="center"><font face="verdana, arial, helvetica, sans-serif" size="2" color="#000000"><B><a name="SingleXactions"></a>Implementing Single Transactions</B></font>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left" width="744">
<p>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">As previously mentioned, the simplest GPIF waveforms to produce are the single read and single
write waveforms. Performing this
function first not only enhances the initial user experience with the design, but also allows the design to be in fairly good shape, fairly quickly. Of
course, for high bandwidth applications the natural migration is then to create FIFO read and write transactions.
&nbsp;But, the implementation of single
transactions is the right place to start. The
first section discusses the single transaction waveforms implemented using GPIF Designer and the next section
covers the firmware that triggers them.<br>
</font><font face="Verdana,Arial" size="1" color="#000000"><br></font> <p align="center"><font face="Verdana" size="1"><img src="images/SingleBlkDiag.gif" width="432" height="327" border="0">&nbsp;<br>Figure
12. GPIF Designer Block Diagram</font></p>
<p>
<font face="Verdana" size="1">The GPIF Designer makes creating GPIF waveform
descriptors easy. Rather than having to know each bit of the waveform
descriptor opcode bytes in detail to create a waveform, the GPIF
Designer allows you to “draw” each waveform and export the waveform
descriptors to a self-contained file, typically called gpif.c. When
you open GPIF Designer, it will present you with a block diagram
view of the physical interconnect as shown in <i>Figure 12</i>. You can
then use the block diagram view to name the individual</font><font face="Verdana,Arial" size="1" color="#000000">
</font><font face="Verdana" size="1">CTLx lines and
RDYn signals. These names propagate into the waveform tabs, allowing
you to personalize each waveform and determine which signals are
being manipulated. You can also use the block diagram to configure
the clock properties of IFCLK, select different package types, and
label the external slave device.<br><br><b><a name="WaveformDescriptors"></a></b>We
can see that the naming conventions are consistent with the hardware
set-up. The single write waveform (waveform 1) is shown below in
<i>Figure 13</i>.<br></font>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="387" width="744">
<p align="center"><font face="Verdana" size="1"><img src="images/singlewr.gif" width="432" height="327" border="0"><br>&nbsp;Figure
13. &nbsp;Single Write waveform in GPIF Designer<br></font></p>
</td>
</tr>
<tr>
<td colspan="1" align="center" width="744">
<p align="left"><font face="Verdana" size="1">For the single write
waveform, data is written to the external FIFO in S0 by making CTL0
a logic LOW (WEN is asserted) and placing data on the bus (Activate
Data) for one IFCLK cycle (Wait 1). At 48 MHz, one IFCLK cycle is
20.83 ns. With the IFCLK output inverted, this provides enough set-up
and hold time for the data.</font></p>
<p align="left"><font face="Verdana" size="1">S1 is a decision-point
state that forces an unconditional branch to the IDLE state, which
terminates the waveform (no activity occurs in the IDLE state).
A decision point state allows you to pick, at most, two terms to
evaluate a logical expression. Based on the results of that evaluation,
you can control the next state the waveform goes to. See the FX2
Technical Reference Manual for more information on decision point
states. Also in S1, CTL0 is a logic HIGH (WEN is de-asserted), and
the data bus is tri-stated (De-activate Data).</font></p>
<p align="left"><font face="Verdana" size="1">Every time a single
write waveform is initiated, the GPIF engine will cycle through
S0, S1, and then IDLE (S7).<br><br>The single read waveform (waveform 0)
is very similar to the single write waveform. The single read waveform
is shown in <i>Figure 14</i>.<br></font></p>
<p align="left"><font face="Verdana" size="1">&nbsp;</font></p>
</td>
</tr>
<tr>
<td colspan="1" align="center" width="744">
<p align="center"><font face="Verdana" size="1"><img src="images/singlerd.gif" width="432" height="327" border="0"><br>Figure
14. Single Read waveform in GPIF Designer</font></p>
<p align="left"><font size="1" face="Verdana">For the single read
waveform, CTL1 starts off as a logic LOW in S0 (REN asserted) for
one IFCLK cycle. This is to account for a t ENS set-up time for
the external FIFO before OE (CTL2) is asserted. S1 then asserts
OE, and in S2 the data bus is sampled (Activate Data) and an unconditional
branch to the IDLE state is taken to terminate the waveform (no
activity occurs in the IDLE state).</font></p>
<p align="left"><font size="1" face="Verdana">Note that the data
bus is sampled in S2 when it would be tempting to sample it in S1.
At the beginning of S1, the data is not yet available from the external
FIFO, therefore the GPIF has to “catch” the data at the beginning
of S2. This is why the data bus is sampled in S2 instead of S1.</font></p>
<p align="left"><font size="1" face="Verdana">Every time a single
read waveform is initiated, the GPIF engine will cycle through S0,
S1, S2, and then IDLE (S7). Notice that waveforms 2 and 3 are unused
for the single transaction example, but will be used later for the
FIFO transaction example.<br></font></p>
<p align="left"><font size="1" face="Verdana">&nbsp;</font></p>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="13" width="744">
<p align="left"><font face="Verdana" size="1"><b><a name="FW"></a>Single Transaction
Firmware</b></font></p>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left" width="744">
<p>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">After the single transaction waveforms were implemented in the GPIF Designer, the next step was to integrate the USB portion of the
overlying firmware with the GPIF Designer output to perform write and read operations to and from the external FIFO. To do this a firmware frameworks project
was copied and the code that performed the external FIFO operations was added to the TD_Poll() function within FX2_extsyncfifo.c (note that periph.c was
renamed to something more meaningful here). Endpoint and GPIF register initialization is performed in the TD_Init() function, which is also within
FX2_extsyncfifo.c.<br><br><a name="Files"></a>When the user opens up the Keil uVision2 project for the FIFO example, the following should be the list of files shown in the Project Window:&nbsp;</font> </td>
</tr>
<tr valign="top">
<td colspan="1" align="center" width="744">
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">&nbsp;&nbsp;&nbsp;
<img src="images/keil.gif" width="253" height="140" align="center" border="0" ismap usemap="#keil_map"><br>
</font>
<ul>
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">The
contents of these files is as follows: <br>
</font></p>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<ul>
<p align="left"><font face="Verdana" size="1"><b>fw.c</b><br>Firmware
frameworks which handles USB requests and calls the task dispatcher
TD_Poll().&nbsp;</font></p>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<ul>
<p align="left"><font face="Verdana" size="1"><b>Ezusb.lib</b><br>Collection
of functions that handle suspend, resume, I2C operations, etc.&nbsp;</font></p>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<ul>
<p align="left"><font face="Verdana" size="1"><b>USBJmpTb.OBJ</b><br>Interrupt
vector jump table for USB (INT2) and GPIF/Slave FIFO (INT4)
interrupt sources.&nbsp;</font></p>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<ul>
<p align="left"><font face="Verdana" size="1"><b>dscr.a51</b><br>Device
descriptor tables for the FIFO example which report EP2OUT and
EP6IN as the available endpoints for the FX2 device.&nbsp;</font></p>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<ul>
<p align="left"><font face="Verdana" size="1"><b>FX2_to_extsyncFIFO.c</b><br>Main
user application code where TD_Poll() and TD_Init() can be found.
The user will mainly be modifying this particular file and will
not need to touch fw.c.&nbsp;</font></p>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<ul>
<p align="left"><font face="Verdana" size="1"><b>gpif.c</b><br>File
that contains the GPIF waveform descriptor tables that implement
the Single/FIFO GPIF transaction waveform behavior.<br>&nbsp;</font></p>
</ul>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left" width="744">
<ul>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><B><a name="TD_Init("></a>TD_Init( )</B>&nbsp;
</font>
</ul>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left" width="744">
<ul>
<p>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">The first task at hand was to setup the endpoints appropriately for this example. The following code switches the CPU clock
speed to 48MHz (since at power-on default it is 12MHz), and sets up EP2 as an OUT endpoint, 4x buffered of size 512, and EP6 as an IN endpoint, also
4x buffered of size 512. This setup utilizes the maximum allotted 4KB FIFO space. It also sets up the FIFOs for manual mode, word wide operation and
goes through a FIFO reset and arming sequence to ensure that they are ready for data operations.<br>
</font>
</ul>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left" width="744">
<blockquote>
<ul>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><font color="#339933">// set the CPU clock to 48MHz</font><br>
CPUCS = ((CPUCS &amp; ~bmCLKSPD) | bmCLKSPD1);<br>
<font color="#666666">SYNCDELAY</font>;<br>
<br>
EP2CFG = <font color="#0000CC">0xA0</font>; <font color="#339933">// EP2OUT, bulk, size 512, 4x buffered</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
EP4CFG = <font color="#0000CC">0x00</font>; <font color="#339933">// EP4 not valid</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
EP6CFG = <font color="#0000CC">0xE0</font>; <font color="#339933">// EP6IN, bulk, size 512, 4x buffered</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
EP8CFG = <font color="#0000CC">0x00</font>; <font color="#339933">// EP8 not valid</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
<br>
EP2FIFOCFG = <font color="#0000CC">0x01</font>; <font color="#339933">// manual mode, disable PKTEND zero length send, word ops</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
EP6FIFOCFG = <font color="#0000CC">0x01</font>; <font color="#339933">// manual mode, disable PKTEND zero length send, word ops</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
<br>
FIFORESET = <font color="#0000CC">0x80</font>; <font color="#339933">// set NAKALL bit to NAK all transfers from host</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
FIFORESET = <font color="#0000CC">0x02</font>; <font color="#339933">// reset EP2 FIFO</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
FIFORESET = <font color="#0000CC">0x06</font>; <font color="#339933">// reset EP6 FIFO</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
FIFORESET = <font color="#0000CC">0x00</font>; <font color="#339933">// clear NAKALL bit to resume normal operation</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
<br>
<font color="#339933">// out endpoints do not come up armed</font><br>
<font color="#339933">// since EP2OUT is quad buffered we must write dummy byte counts four times</font><br>
<br>
EP2BCL = <font color="#0000CC">0x80</font>; <font color="#339933">// arm EP2OUT by writing byte count w/skip.</font><br>
<font color="#666666">SYNCDELAY</font>;<br>
EP2BCL = <font color="#0000CC">0x80</font>;<br>
<font color="#666666">SYNCDELAY</font>;<br>
EP2BCL = <font color="#0000CC">0x80</font>;<br>
<font color="#666666">SYNCDELAY</font>;<br>
EP2BCL = <font color="#0000CC">0x80</font>;<br>
<font color="#666666">SYNCDELAY</font>;<br>
<br>
GpifInit (); <font color="#339933">// initialize GPIF registers</font><br>
<br></font>
</ul>
</blockquote>
</font>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left" width="744">
<ul>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><B><a name="IFCONFIG"></a>IFCONFIG Register</B><br>
</font>
</ul>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left" width="744">
<ul>
<p>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">TD_Init then calls the function GPIFInit() that resides in gpif.c. GPIFInit() is where the loading of the GPIF waveform
descriptor table into on-chip memory takes place and other GPIF registers get setup. An important register, IFCONFIG, also gets setup here to define
how the physical interface operates. Table 2 goes through the reasoning behind the setup of the IFCONFIG register for this example.
&nbsp;Note that all these bit assignments were made, automatically
by GPIF Designer as a consequence of the Block Diagram configuration.<br><br>
</font>
</ul>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="center" width="744">
<table align="center" border="1" cellspacing="0" width="90%" bordercolordark="white" bordercolorlight="black">
<tr>
<td width="38" height="15">
<p align="center"><font face="Verdana" size="1"><b>Bit
#</b></font></p>
</td>
<td width="79" height="15">
<p align="center"><font face="Verdana" size="1"><b>Bit
Label</b></font></p>
</td>
<td width="547" height="15">
<p align="center"><font face="Verdana" size="1"><b>Contents
/ Description</b></font></p>
</td>
</tr>
<tr>
<td width="38" height="13">
<p align="center"><font face="Verdana" size="1">7</font></p>
</td>
<td width="79" height="13">
<p align="center"><font face="Verdana" size="1">IFCLKSRC</font></p>
</td>
<td width="547" height="13"> <p align="left"><font face="Verdana" size="1">Set
to 1 to run the GPIF using the internal clock source</font></p>
</td>
</tr>
<tr>
<td width="38">
<p align="center"><font face="Verdana" size="1">6</font></p>
</td>
<td width="79">
<p align="center"><font face="Verdana" size="1">3048MHz</font></p>
</td>
<td width="547">
<p><font face="Verdana" size="1">Set to 1 to run the
internal clock source for the GPIF at 48MHz.</font></p>
</td>
</tr>
<tr>
<td width="38">
<p align="center"><font face="Verdana" size="1">5</font></p>
</td>
<td width="79">
<p align="center"><font face="Verdana" size="1">IFCLKOE</font></p>
</td>
<td width="547">
<p><font face="Verdana" size="1">Set to 1 to turn on
the IFCLK output to drive the WCLK and RCLK inputs of
the external FIFO.</font></p>
</td>
</tr>
<tr>
<td width="38">
<p align="center"><font face="Verdana" size="1">4</font></p>
</td>
<td width="79">
<p align="center"><font face="Verdana" size="1">IFCLPOL</font></p>
</td>
<td width="547">
<p><font face="Verdana" size="1">Set to 1 to invert
the IFCLK output to the external FIFO. This allows enough
setup time for the external FIFO.</font></p>
</td>
</tr>
<tr>
<td width="38">
<p align="center"><font face="Verdana" size="1">3</font></p>
</td>
<td width="79">
<p align="center"><font face="Verdana" size="1">ASYNC</font></p>
</td>
<td width="547">
<p><font face="Verdana" size="1">Set to 0 to operate
the GPIF at the highest rate (sync mode).</font></p>
</td>
</tr>
<tr>
<td width="38">
<p align="center"><font face="Verdana" size="1">2</font></p>
</td>
<td width="79">
<p align="center"><font face="Verdana" size="1">GSTATE</font></p>
</td>
<td width="547">
<p><font face="Verdana" size="1">Set to 1 to turn on
the debug outputs of the state machine. PE[2:0] displays
the states the GPIF engine cycles through during each
transaction (Note: PE[2:0] are only available on the
100- and 128-pin packages).</font></p>
</td>
</tr>
<tr>
<td width="38">
<p align="center"><font face="Verdana" size="1">1</font></p>
</td>
<td width="79">
<p align="center"><font face="Verdana" size="1">IFCFG1</font></p>
</td>
<td width="547">
<p><font face="Verdana" size="1">Set to 1 to put the
FX2 part into GPIF mode (internal master).</font></p>
</td>
</tr>
<tr>
<td width="38">
<p align="center"><font face="Verdana" size="1">0</font></p>
</td>
<td width="79">
<p align="center"><font face="Verdana" size="1">IFCFG0</font></p>
</td>
<td width="547">
<p><font face="Verdana" size="1">Set to 0&nbsp;to put
the FX2 part into GPIF mode (internal master).</font></p>
</td>
</tr>
</table>
<p><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">Table 2. IFCONFIG register bit settings for FIFO example<br>
<br>
</font></p>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left" width="744">
<ul>
<p>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">The next thing TD_Init() does is it resets the external FIFO by pulsing PA2. This ensures that the external FIFO is at a
ground-zero state before commencing data operations. The following code does the trick:<br>
</font>
</ul>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left" width="744">
<p>
&nbsp; <blockquote>
<ul>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><font color="#339933">// reset the external FIFO</font><br>
<br>
OEA |= <font color="#0000CC">0x04</font>; <font color="#339933">// turn on PA2 as output pin</font><br>
IOA |= <font color="#0000CC">0x04</font>; <font color="#339933">// pull PA2 high initially</font><br>
IOA &amp;= <font color="#0000CC">0xFB</font>; <font color="#339933">// bring PA2 low</font><br>
<font color="#666666">EZUSB_Delay (<font color="#0000CC">1</font>)</font>; <font color="#339933">// keep PA2 low for ~1ms, more than enough time</font><br>
IOA |= <font color="#0000CC">0x04</font>; <font color="#339933">// bring PA2 high</font><br>
</font>
</ul>
</blockquote>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<ul>
<p align="left">
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">A vendor command was also setup in the DR_VendorCmnd() function so that the user could reset the external FIFO at any time by
performing a vendor request of 0xB2 from the EZ-USB Control Panel.&nbsp;</font>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<ul>
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><B><a name="Triggering"></a>Triggering GPIF Single Transactions</B><br></font>
</ul>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left" width="744">
<ul>
<p>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">In order for the data transfers to occur across the physical interface, the CPU needs to trigger the GPIF waveforms by accessing
the registers XGPIFSGLDATH, XGPIFSGLDATLX, and XGPIFSGLDATLNOX.<br><br> In order to trigger a GPIF Single Word Write transaction, the user writes to the XGPIFSGLDATAH&lt; and XGPIFSGLDATLX in the following manner:<br><br>
XGPIFSGLDATH = <font color="#999999">&lt;</font>word_value<font color="#999999">&gt;</font> &gt;&gt; <font color="#0000CC">8</font>;<br>
XGPIFSGLDATLX = <font color="#999999">&lt;</font>word_value<font color="#999999">&gt;</font> <font color="#339933">// trigger GPIF<br><br></font>This effectively setups the MSB and LSB of the word value to be transferred, and the sheer act of writing to the XGPIFSGLDATLX register fires
off the Single Word Write transaction. To make things a little neater to follow in TD_Poll(), the following function was defined which basically
accepts a word value as an input argument and performs the GPIF Single Word Write transaction:<br></font>
<ul>
<p> <font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><font color="#339933">// reset the external FIFO</font><br>
<font color="#990000">void</font> GPIF_SingleWordWrite( WORD gdata )<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#990000">while</font>( !( GPIFTRIG &amp; <font color="#0000CC">0x80</font> ) ) <font color="#339933">// poll GPIFTRIG.7 Done bit</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#339933">// using registers in XDATA space</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;XGPIFSGLDATH = gdata;<br>
&nbsp;&nbsp;&nbsp;&nbsp;XGPIFSGLDATLX = gdata &gt;&gt; <font color="#0000CC">8</font>; <font color="#339933">// trigger GPIF Single Word Write transaction</font><br>
}</font></p>
</ul>
<p><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">This function also checks to see if the GPIF is in the IDLE state (GPIFTRIG.7 is set if GPIF is IDLE) before it launches the transaction. This is
something that is necessary before launching any GPIF transaction. Note that the access to the single transaction registers is swapped here because
the endpoint buffer is organized as a FIFO. The swapping ensures that the first byte in the endpoint buffer is written out FD[7:0], and the second
byte is written out FD[15:8].<br>
<br>
In order to trigger a GPIF Single Word Read transaction, the user performs a dummy read from the XGPIFSGLDATX register. The word value just read will
be contained in the registers XGPIFSGLDATH and XGPIFSGLDATLNOX. <br><br>To make things a little neater to follow in TD_Poll(), the following function was defined which basically accepts a word pointer for the
destination variable as an input argument and performs the GPIF Single Word Read transaction:</font></p>
<ul>
<p><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><font color="#990000">void</font> GPIF_SingleWordRead( WORD xdata *gdata )<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#990000">static</font> BYTE g_data = <font color="#0000CC">0x00</font>; <font color="#339933">// dummy variable</font><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#990000">while</font>( !( GPIFTRIG &amp; <font color="#0000CC">0x80</font> ) ) <font color="#339933">// poll GPIFTRIG.7 Done bit</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#339933">// using register in XDATA space</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;g_data = XGPIFSGLDATLX; <font color="#339933">// dummy read to trigger GPIF Single Word Read transaction</font><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#990000">while</font>( !( GPIFTRIG &amp; <font color="#0000CC">0x80</font> ) ) <font color="#339933">// poll GPIFTRIG.7 Done bit</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#339933">// using register(s) in XDATA space, retrieve word just read from external FIFO</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;*gdata = ( ( WORD )XGPIFSGLDATLNOX &lt;&lt; <font color="#0000CC">8</font> ) | ( WORD )XGPIFSGLDATH;<br>
}</font></p>
</ul>
<p><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">This function first checks to see if the GPIF is IDLE and then performs a dummy read from XGPIFSGLDATLX to fire off the GPIF Single Word Read
transaction. Then, another check is performed before accessing the registers that contain the word value.<br>
<font color="#339933">&nbsp;</font></font></p>
</ul>
</td>
</tr>
<tr valign="top">
<td colspan="1" align="left" width="744">
<p>
<ul>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><B><a name="TD_Poll()"></a>TD_Poll()</B><br>
</font>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<ul>
<p align="left">
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">The TD_Poll() function is where the main application code resides. The firmware here calls the functions GPIF_SingleWordWrite() and
GPIF_SingleWordRead to send and receive data from EP2OUT and EP6IN, respectively.<br><br>Code that handles USB OUT transfers</font>
<ul>
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><font color="#990000">if</font>(!(EP2468STAT &amp; bmEP2EMPTY) &amp;&amp; (EXTFIFONOTFULL))<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#339933">// if host sent data to EP2OUT AND external FIFO is not full</font><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;Tcount = (EP2BCH &lt;&lt; <font color="#0000CC">8</font>) + EP2BCL; <font color="#339933">// load transaction count with EP2 byte count</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;Tcount /= <font color="#0000CC">2</font>; <font color="#339933">// divide by 2 for word wide transaction</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;Source = (WORD *)(&amp;EP2FIFOBUF);<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#990000">for</font>( i = <font color="#0000CC">0x0000</font>; i &lt; Tcount; i++ )<br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#339933">// transfer data from EP2OUT buffer to external FIFO</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GPIF_SingleWordWrite (*Source);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Source++;<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;EP2BCL = <font color="#0000CC">0x80</font>; <font color="#339933">// re-arm EP2OUT</font><br>
}</font></p>
</ul>
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">The first thing the OUT handling code does is it checks to see if the host sent data to EP2OUT, and if the external FIFO is not full by accessing the
GPIFREADYSTAT register (EXTFIFONOTEMPTY is a macro for GPIFREADYSTAT &amp; bmBIT0).<br><br>If both conditions are met, the word variable Tcount is setup appropriately. Since each GPIF Single Word Write transaction sends an entire word to
the external FIFO, the number of transactions is always half the number of bytes actually contained within the endpoint buffer.<br><br>A for loop then calls the GPIF_SingleWordWrite function and indexes through the endpoint buffer values, sending a word out to the external FIFO
at a time. The last step then is to re-arm the endpoint buffer so that the next USB data packet can be accepted</font><font face="Verdana" size="1">.</font></p>
<p align="left">
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">Code that handles USB IN transfers&nbsp;</font>
<ul>
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><font color="#990000">if</font>(in_enable) <font color="#339933">// if IN transfers are enabled</font><br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#990000">if</font>(!(EP2468STAT &amp; bmEP6FULL) &amp;&amp; (EXTFIFONOTEMPTY))<br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#339933">// if EP6IN is not full AND there is data in the external FIFO</font><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;Destination = (WORD *)(&amp;EP6FIFOBUF);<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#990000">for</font>( i = <font color="#0000CC">0x0000</font>; i &lt; Tcount; i++ )<br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#339933">// transfer data from external FIFO to EP6IN buffer</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GPIF_SingleWordRead (Destination);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Destination++;<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;Tcount *= <font color="#0000CC">2</font>; <font color="#339933">// multiply by 2 to obtain byte count value</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;EP6BCH = MSB(Tcount);<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;EP6BCL = LSB(Tcount); <font color="#339933">// arm EP6IN to send data to the host</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#666666">SYNCDELAY</font>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
}</font>
</ul>
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">Another vendor command (0xB3) is setup to enable the IN transfers to occur. Otherwise, the code will just sit there and not process the INs. The
reason for the in_enable flag is so that the user can test each read and write operation independently. Otherwise, after the OUT handling code, the
IN is processed immediately. This is also useful for debugging purposes with the logic analyzer. It allows the user to capture each read/write
operation relatively easily.<br><br>If the in_enable flag is set, the code will fall through and check if the EP6IN endpoint buffer is not full, and if the external FIFO is not empty
(The CPU can check the status of the RDY signals by accessing the GPIFREADYSTAT register, so EXTFIFONOTEMPTY is a macro for GPIFREADYSTAT &amp; bmBIT1).<br><br>If both conditions are met, a for loop then calls the GPIF_SingleWordRead function and indexes through the endpoint buffer values, receiving a word from
the external FIFO at a time. The last step then is to re-arm the endpoint buffer so that the next USB data packet can be accepted. Since each GPIF
Single Word Read transaction receives an entire word from the external FIFO, the number of transactions is always half the number of bytes actually
contained within the endpoint buffer.<br><br>&nbsp;</font></p>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><B><a name="Running"></a>Running the example for GPIF Single Transactions<br>&nbsp;</B></font> </td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<p align="left">
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">Now that the user understands how this FIFO example works, the bulk loop back function can be exercised by performing the steps discussed in this section.<br><br>Step 1: Download the firmware using the EZ-USB Control Panel</font>
<ul>
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">a)
Unzip the &quot;FX2_extsyncFIFO GPIF Single Transactions.zip&quot; package in the C:\Cypress\Usb\Examples\FX2 directory.<br></font></p>
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">b)
After the user plugs-in the FX2 board, launch the EZ-USB Control Panel and ensure that the selected target is FX2.<br></font></p>
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">c)
Then, press the &quot;Download&quot; button and select the FX2_extsyncFIFO.hex file. The FX2 board renumerates as a Cypress EZ-USB Sample Device and LED0 should come up flashing.<br></font></p>
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">d)
Perform a &quot;Get Pipes&quot; and &quot;Get Dev&quot; to verify one more time that the firmware is up and running. The user should then see the following screen shown below:</font></p>
</ul>
<ul>
<p align="left"><A onClick="na_change_img_src('image2', 'document', 'images/cp-01.gif', true);"><img src="images/cp-01.gif" width="488" height="400" align="center" border="0" name="image2"></A> </ul>
<p><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><br>&nbsp;</font></p>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<p align="left">
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><a name="Step2"></a>Step 2: Setup bulk IN transfer and send 512 bytes to the external FIFO<br></font>
<ul>
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">a)
On the same line as the &quot;BulkTrans&quot; button, select Endpoint 6 IN as the &quot;Pipe&quot; and specify a &quot;Length&quot; of 512 bytes. Then click the
&quot;BulkTrans&quot; button. This will setup a bulk IN transfer of 512 bytes to read that amount from the external FIFO. Select View -&gt; Pending Ops to
see the pending bulk IN transfer.<br></font></p>
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">b)
On the same line as the &quot;FileTrans..&quot; button, select Endpoint 2 OUT as the &quot;Pipe&quot;. Press the &quot;FileTrans..&quot; button and select the 512_count.hex
file. Click on &quot;Open&quot; and this action will send out 512 bytes out to the external FIFO (the data stream is a ramp). <br></font></p>
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">c)
Even though 512 bytes have been written into the external FIFO the IN transfer is not processed. This is because the in_enable flag in the firmware has not yet been set to TRUE.<br></font></p>
</ul>
<ul>
<p align="left"><A onClick="na_change_img_src('image1', 'document', 'images/cp-02.gif', true);"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><img src="images/cp-02.gif" width="441" height="400" align="center" border="0" name="image1"></font></A> </ul>
<p>&nbsp;</p>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<p align="left">
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><a name="Step3"></a>Step 3: Complete IN transfer to read back 512 bytes from the external FIFO<br>
<br>
In order to complete the pending IN transfer and read back 512 bytes from the external FIFO, the in_enable flag must be set to TRUE (remember that
this allows the INs to be processed in the TD_Poll routine). To set the flag, on the same line as the &quot;Vend Req&quot; button, enter a value of 0xb3 in the
&quot;Req&quot; field. Then click the &quot;Vend Req&quot; button. The user should now see the 512 bytes read back from the external FIFO displayed in the window.<br></font>
<ul>
<p align="left"><A onClick="na_change_img_src('image3', 'document', 'images/cp-03.gif', true);"><img src="images/cp-03.gif" width="449" height="400" border="0" name="image3"></A></p>
</ul>
<p align="center">&nbsp;</p>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<p align="left">
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">The bulk loop back function can also be exercised by running the bulkloop.exe utility supplied with the EZ-USB development kit software. After
downloading the firmware, launch the bulkloop.exe utility found in the C:\Cypress\Usb\Bin sub-directory. The user should setup the parameters
according to the following screen:</font>
<p align="left"><img src="images/bulkexe.gif" width="544" height="361" border="0"></p>
<p align="left">
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">Prior to clicking the &quot;Start&quot; button to commence the bulk loop back transfers, the user should perform the 0xb3 vendor request to set the in_enable flag
to TRUE. By clicking the &quot;Start&quot; button, the user should see the &quot;Pass&quot; counter increment as each loop back transfer is exercised. Clicking on the &quot;Stop&quot;
button will end the loop back transfers. The data values are also checked by the bulkloop utility on each pass, so the user should see the &quot;Error&quot; count
increment if any data value does not match. The application will also stop on any error if the &quot;Stop on Error&quot; checkbox is selected.<br>
<br>
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#666666"><b>Debug Tip: </b><br>
While running this example and at any time during GPIF development, the user is strongly encouraged to connect a logic analyzer to the relevant signals
on the development kit headers. Monitoring the GPIF bus transactions aids debug sessions tremendously, and is essential for anyone seriously interested
in writing GPIF firmware. The next topic presents the waveforms the user should see on the logic analyzer as the example is run. An HP1660C Logic
Analyzer was used to capture the waveforms.<br></font></font>
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#666666">&nbsp;</font></font></p>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><B><a name="AnalyzerWaves"></a>Logic Analyzer Waveforms<br>&nbsp;</B></font> </td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<ul>
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><B><a name="SingleWr"></a>Single Write Waveform<br></B></font>
<ul>
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><img name="law" src="images/sWrite.gif" width="432" height="290" align="center" border="0"></font>&nbsp;</p>
</ul>
</ul>
<ul>
<p align="left">
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">The waveform above shows the timing generated by the GPIF engine for the Single Write waveform as defined by the GPIF tool. All the essential signals
are presented here, including GSTATE[2:0], which displays the states the GPIF engine cycles through as it performs the Single Write transaction.<br><br></font><font face="verdana, arial, helvetica, sans-serif" size="1" color="#666666"><b>Debug Tip: </b><br>
<br>
Bringing out the GSTATE signals to the logic analyzer headers allows the user to correlate between the waveforms generated by the GPIF tool, and
the actual waveforms generated on the physical interface. This also aids the debugging process because the user can see the immediate effect of
changing the waveform behavior in the GPIF tool</font><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">.</font><font face="verdana, arial, helvetica, sans-serif" size="1" color="#666666"><br><br></font><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">As expected from the GPIF tool output, S0 places the data on the bus (PORTB is FD[7:0] and PORTD is FD[15:8]), and asserts CTL0 (connected to the
external FIFO's WEN/ line). This effectively writes the 16-bit data value into the external FIFO. Note here that enough data setup time to the
rising edge of IFCLK is provided, since the minimum data setup time for the external FIFO is 4 ns (see CY4265 datasheet). S1 is a decision point
state that unconditionally branches to the IDLE state to terminate the transaction. Without the unconditional branch, the GPIF engine would
sequentially move through the remaining states until the IDLE state (S7) is reached. <br>
<br>
For every word written out in a bulk OUT transfer, the user should see the GPIF engine cycle through S0, S1, and S7. To capture the waveform, the
user should trigger the logic analyzer on the falling edge of CTL0. A sampling rate of 4 ns will give the user the same resolution shown in the
waveform above.<br>
</font><font face="verdana, arial, helvetica, sans-serif" size="1" color="#666666">&nbsp;</font>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<ul>
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><B><a name="SingleRd"></a>Single Read Waveform<br><br>&nbsp;</B></font>
<ul>
<p align="left"><font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000"><img name="law" src="images/sRead.gif" width="432" height="290" align="center" border="0"><B>&nbsp;<br></B></font>
</ul>
<p align="left">
<font face="verdana, arial, helvetica, sans-serif" size="1" color="#000000">The waveform above shows the timing generated by the GPIF engine for the Single Read waveform as defined by the GPIF tool. All the essential signals
are presented here, including GSTATE[2:0], which displays the states the GPIF engine cycles through as it performs the Single Read transaction<B>.</B><br><br>As expected from the GPIF tool output, S0 asserts CTL1 (connected to the external FIFO's REN/ line), S1 asserts CTL2 (connected to the external
FIFO's OE/ line), and S2 samples the data bus (PORTB is FD[7:0] and PORTD is FD[15:8]). This effectively reads the 16-bit data value into the
external FIFO. Note here that enough data setup time to the rising edge of IFCLK is provided, since the minimum data setup time for the external
FIFO is 4 ns (see CY4265 datasheet). S2 is a decision point state that unconditionally branches to the IDLE state to terminate the transaction.
Without the unconditional branch, the GPIF engine would sequentially move through the remaining states until the IDLE state (S7) is reached. <br>
<br>
For every word read out from the external FIFO in a bulk IN transfer, the user should see the GPIF engine cycle through S0, S1, S2, and S7. To
capture the waveform, the user should trigger the logic analyzer on the falling edge of CTL1. A sampling rate of 4 ns will give the user the same
resolution shown in the waveform above.<br>
</font>
</ul>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<p>&nbsp;</p>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<p>&nbsp;</p>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<p>&nbsp;</p>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<p>&nbsp;</p>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<p>&nbsp;</p>
</td>
</tr>
<tr>
<td colspan="1" align="center" height="15" width="744">
<p>&nbsp;</p>
</td>
</tr>
</table>
</font>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Some files were not shown because too many files have changed in this diff Show More