Cypress AN6077, FX2LP manual Syncdelay Gpiftrig = Gpiftrigrd GPIFEP6

Page 12

AN6077

//RDY0=1, when peripheral is "not empty"

//drive FIFOADDR lines

OEA = 0xC0;

IOA = 0x00;

if( EP68FIFOFLGS & 0x01 )

{

// EP6FF=1, when fifo "full"

}

else

{

//EP6FF=0, when fifo "not full", for example, buffer available

//setup GPIF transaction count

SYNCDELAY;

EP6GPIFTCH = 0x02;

SYNCDELAY;

EP6GPIFTCL = 0x00;

// trigger FIFO read transaction(s), using SFR

SYNCDELAY;

GPIFTRIG = GPIFTRIGRD GPIF_EP6;

//wait for the transaction to terminate naturally

SYNCDELAY;

while( !( GPIFTRIG & 0x80 ) )

{

; // poll GPIFTRIG.7, DONE bit

}

//AUTOOUT=1, core handles transfers

//cpu is not in the data path

//however, cpu is responsible for committing "short packets"

xFIFOTC_IN = ( ( EP6FIFOBCH << 8 ) + EP6FIFOBCL );

if( xFIFOTC_IN < enum_pkt_size )

{

//handle short packet from peripheral

SYNCDELAY;

INPKTEND = 0x06; // w/skip=0;commit however many bytes in packet.

SYNCDELAY;

}

else

{

// core commits packet via EPxAUTOINLENH/L registers

}

}

}

else

{

// master has all the data the peripheral sent

}

}

else

{

// peripheral interface busy

}

}

February 19, 2008

Document No. 001-15342 Rev. **

12

[+] Feedback

Image 12
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 CodeSyncdelay Firmware for the SlaveSummary 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