Cypress FX2LP, AN6077 manual Trigger Fifo write transactions, using SFR

Page 11

AN6077

//setup GPIF transaction count

SYNCDELAY;

EP2GPIFTCH = EP2FIFOBCH; SYNCDELAY;

EP2GPIFTCL = EP2FIFOBCL;

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

SYNCDELAY;

GPIFTRIG = GPIFTRIGWR GPIF_EP2;

//once master (GPIF) drains OUT packet, it (re)arms to usb domain

//this path is always auto, meaning core handles it

if( xFIFOTC_OUT < enum_pkt_size )

{

//handle short packet to peripheral

//wait for the transaction to terminate naturally while( !( GPIFTRIG & 0x80 ) )

{

; // poll GPIFTRIG.7, DONE bit...

}

//signal short packet to peripheral here

//in this implementation CTL2 is tied to PKTEND of slave

//strobe PKTEND of slave

GPIFIDLECTL = 0x04;

GPIFIDLECTL &= 0xFB;

GPIFIDLECTL = 0x04;

}

else

{

//was max packet size

//let transaction terminate naturally

}

}

else

{

// RDY1=0, when peripheral is FULL

}

}

}

else

{

// DONE=0 when GPIF is "not" IDLE

}

//Handle IN data

//is the GPIF idle if( GPIFTRIG & 0x80 )

{

//check if peripheral is "not empty" if( GPIFREADYSTAT & 0x01 )

{

February 19, 2008

Document No. 001-15342 Rev. **

11

[+] Feedback

Image 11
Contents Introduction Application Note AbstractCreating Gpif Waveforms Gpif Master Pin DescriptionsSlave Fifo Pin Descriptions Fifowr Firmware Architecture Firmware Programming MasterExpanded Master OUT Code Psuedocode for Master OUTPsuedocode for Master Expanded Master in Code Syncdelay Gpiftrig = Gpiftrigwr GPIFEP2Gpiftrig = Gpiftrigrd GPIFEP6 SyncdelayFirmware for the Slave SummaryCode 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 Usbirq = TrueEzusbirqclear Clear Ures IRQ + Feedback Code Listing for the Slave Side AUTOOUT=0, WORDWIDE=0 Syncdelay AUTOIN=1, ZEROLENIN=1, WORDWIDE=0 AUTOOUT=1, WORDWIDE=0EP0BCH EP0BCL Clear Ures IRQ + Feedback + Feedback