Cypress Semiconductor FX2LP Información técnica Pagina 245

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 460
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 244
Chapter 10. General Programmable Interface (GPIF) Page 10-55
Figure 10-43. Initialization Code for FIFO-Write Transactions
Figure 10-44. FIFO-Write w/ AUTOOUT = 0, Committing Packets via EPxBCL
void TD_Init( void )
{
… … … … …
GpifInit(); // Configures GPIF from GPIFTool generated waveform data
// TODO: configure other endpoints, etc. here
EP2CFG = 0xA2; // EP2 is DIR=OUT, TYPE=BULK, SIZE=512, BUF=2x
SYNCDELAY;
EP2FIFOCFG = 0x00; // EP2 is AUTOOUT=0, AUTOIN=0, ZEROLEN=0, WORDWIDE=0
SYNCDELAY;
// “all” EP2 buffers automatically arm when AUTOOUT=1
// TODO: arm OUT buffer(s) here
EP2BCL = 0x80; // write BCL w/skip=1
SYNCDELAY;
EP2BCL = 0x80; // write BCL w/skip=1
SYNCDELAY;
// setup INT4 as internal source for GPIF interrupts
// using INT4CLR (SFR), automatically enabled
//INTSETUP |= 0x03; //Enable INT4 Autovectoring
//GPIFIE = 0x03; // Enable GPIFDONE and GPIFWF interrupt(s)
//EIE |= 0x04; // Enable INT4 ISR, EIE.2(EIEX4)=1
// TODO: configure GPIF interrupt(s) to meet your needs here
… … … … …
// tell peripheral we’re going into high speed xfr mode
Peripheral_SetAddress( PERIPHCS );
Peripheral_SingleByteWrite( P_HSMODE );
// configure some GPIF control registers
Peripheral_SetAddress( BURSTMODE );
}
void TD_Poll( void )
{
… … … … …
if( !( EP2468STAT & 0x01 ) )
{ // EP2EF=0 when FIFO “not” empty, host sent pkt.
EP2BCL = 0x00; // SKIP=0, pass buffer on to master
if( gpifdone_event_flag )
{
Peripheral_SetEP2GPIFTC( HSPKTSIZE );
Peripheral_FIFOWrite( GPIF_EP2 );
gpifdone_event_flag = 0;
}
}
… … … … …
}
Vista de pagina 244
1 2 ... 240 241 242 243 244 245 246 247 248 249 250 ... 459 460

Comentarios a estos manuales

Sin comentarios