Cypress AN6077, FX2LP manual Gpifirq, AUTOOUT=0, WORDWIDE=0 Syncdelay

Page 18

AN6077

// PINFLAGSxx

EPxFIFOIRQ

// EPxFIFOIE

GPIFIRQ

//

GPIFIE

GPIFADRH:L

//

UDMACRCH:L

EPxGPIFTRIG

// GPIFTRIG

 

 

 

SYNCDELAY;

//

activate NAK-ALL to avoid race conditions

 

FIFORESET = 0x80;

 

SYNCDELAY;

//

see TRM section 15.14

 

FIFORESET = 0x82;

//

reset, FIFO 2

 

SYNCDELAY;

//

reset, FIFO 4

 

FIFORESET = 0x84;

//

 

SYNCDELAY;

//

reset, FIFO 6

 

FIFORESET = 0x86;

//

 

SYNCDELAY;

//

reset, FIFO 8

 

FIFORESET = 0x88;

//

 

SYNCDELAY;

//

deactivate NAK-ALL

 

FIFORESET = 0x00;

//

 

SYNCDELAY;

//

FLAGA - fixed EP8FF, FLAGB - fixed EP6FF

 

PINFLAGSAB = 0xEF;

 

SYNCDELAY;

//

FLAGC - fixed EP2EF, FLAGD - fixed EP4EF

 

PINFLAGSCD = 0x98;

 

SYNCDELAY;

//

FLAGD, set alt. func. of PA7 pin

 

PORTACFG = 0x80;

 

SYNCDELAY;

//

all signals active low

 

FIFOPINPOLAR = 0x00;

 

SYNCDELAY;

 

 

 

EP2CFG = 0xA0;

 

 

 

SYNCDELAY;

 

 

 

EP6CFG = 0xE0;

 

 

 

// EP4 and EP8 are not used in this implementation

 

SYNCDELAY;

//

clear valid bit

 

EP4CFG = 0x20;

//

 

SYNCDELAY;

//

clear valid bit

 

EP8CFG = 0x60;

//

 

// handle the case where we were

already in AUTO mode

 

EP2FIFOCFG = 0x00;

//

AUTOOUT=0, WORDWIDE=0

 

SYNCDELAY;

 

 

 

SYNCDELAY;

//

arm first buffer

 

EP2BCL = 0x00;

//

 

SYNCDELAY;

//

arm second buffer

 

EP2BCL = 0x00;

//

 

SYNCDELAY;

//

arm third buffer

 

EP2BCL = 0x00;

//

 

SYNCDELAY;

//

arm fourth buffer

 

EP2BCL = 0x00;

//

 

SYNCDELAY;

//

 

 

SYNCDELAY;

 

 

 

OUTPKTEND = 0x02;

 

 

 

SYNCDELAY;

 

 

 

OUTPKTEND = 0x02;

 

 

 

SYNCDELAY;

 

 

 

OUTPKTEND = 0x02;

 

 

 

SYNCDELAY;

 

 

 

OUTPKTEND = 0x02;

 

 

 

SYNCDELAY;

 

 

 

February 19, 2008

Document No. 001-15342 Rev. **

18

Image 18
Contents Application Note Abstract IntroductionGpif Master Pin Descriptions Slave Fifo Pin DescriptionsCreating Gpif Waveforms Fifowr Firmware Programming Master Firmware ArchitecturePsuedocode for Master OUT Psuedocode for MasterExpanded Master OUT Code Syncdelay Gpiftrig = Gpiftrigwr GPIFEP2 Expanded Master in CodeSummary SyncdelayFirmware for the Slave Gpiftrig = Gpiftrigrd GPIFEP6Code Listing for Master Side EP4 and EP8 are not used in this implementation Gpiftrig Trigger Fifo write transactions, using SFR Syncdelay Gpiftrig = Gpiftrigrd GPIFEP6 Setupdat = True EzusbirqclearUsbirq Clear Ures IRQ + Feedback Code Listing for the Slave Side AUTOOUT=0, WORDWIDE=0 Syncdelay AUTOOUT=1, WORDWIDE=0 AUTOIN=1, ZEROLENIN=1, WORDWIDE=0EP0BCH EP0BCL Clear Ures IRQ + Feedback + Feedback