OpenCores
URL https://opencores.org/ocsvn/gecko3/gecko3/trunk

Subversion Repositories gecko3

[/] [gecko3/] [trunk/] [GECKO3COM/] [gecko3com-fw/] [firmware/] [src/] [gecko3com_gpif.c] - Diff between revs 18 and 19

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 18 Rev 19
Line 75... Line 75...
 *  desired file for your board
 *  desired file for your board
 */
 */
extern const char InitData[7];
extern const char InitData[7];
 
 
 
 
/** private flag to signal, that the GPIF receives data from the FPGA */
//** private flag to signal, that the GPIF receives data from the FPGA */
volatile static uint8_t flGPIF;
//volatile static uint8_t flGPIF;
 
 
 
 
 
 
/**
/**
 * \brief exectuted when the gpif wafeform terminates
 * \brief exectuted when the gpif wafeform terminates
Line 88... Line 88...
void
void
isr_gpif_done (void) interrupt
isr_gpif_done (void) interrupt
{
{
  ISR_DEBUG_PORT |= bmGPIF_DONE;
  ISR_DEBUG_PORT |= bmGPIF_DONE;
 
 
  clear_fifo_gpif_irq();
 
 
 
  //EA = 0;             /* disable all interrupts */
 
 
 
  /* check if there is data available for an OUT transfer */
  /* check if there is data available for an OUT transfer */
  if((flGPIF & bmGPIF_PENDING_DATA) == bmGPIF_PENDING_DATA) {
  /*if((flGPIF & bmGPIF_PENDING_DATA) == bmGPIF_PENDING_DATA) {
  //if(!(EP2468STAT & bmEP2EMPTY)) {
    //if(!(EP2468STAT & bmEP2EMPTY)) {
    flGPIF &= ~bmGPIF_PENDING_DATA;
    flGPIF &= ~bmGPIF_PENDING_DATA;
    GPIFABORT = 0xFF;
    GPIFABORT = 0xFF;
    SYNCDELAY;
    SYNCDELAY;
    gpif_trigger_write();
    gpif_trigger_write();
  }
  }
  else {
  else*/ {
    INPKTEND = USB_TMC_EP_IN;
    /* check if this is a end of a IN transfer */
 
    //INPKTEND = USB_TMC_EP_IN;
 
    while(!(GPIFTRIG & bmGPIF_IDLE));
    gpif_trigger_read();
    gpif_trigger_read();
  }
  }
  //EA = 1;             /* global interrupt enable */
 
 
  clear_fifo_gpif_irq();
 
 
  ISR_DEBUG_PORT &= ~bmGPIF_DONE;
  ISR_DEBUG_PORT &= ~bmGPIF_DONE;
}
}
 
 
 
 
Line 118... Line 117...
void
void
isr_endpoint_out_data (void) interrupt
isr_endpoint_out_data (void) interrupt
{
{
  ISR_DEBUG_PORT |= bmFIFO_PF;
  ISR_DEBUG_PORT |= bmFIFO_PF;
 
 
  clear_fifo_gpif_irq();
 
 
 
  /* check if there is a active IN transfer */
  /* check if there is a active IN transfer */
  if((GPIFIDLECTL & bmBIT3) == bmBIT3) {
  /*if((GPIFIDLECTL & bmBIT3) == bmBIT3) {
    flGPIF |= bmGPIF_PENDING_DATA;
    flGPIF |= bmGPIF_PENDING_DATA;
  }
  }
  else {
  else*/ {
    //EA = 0;           /* disable all interrupts */
 
    GPIFABORT = 0xFF;
    GPIFABORT = 0xFF;
    SYNCDELAY;
    SYNCDELAY;
 
    while(!(GPIFTRIG & bmGPIF_IDLE));
    gpif_trigger_write();
    gpif_trigger_write();
    //EA = 1;           /* global interrupt enable */
 
  }
  }
 
 
 
  clear_fifo_gpif_irq();
 
 
  ISR_DEBUG_PORT &= ~bmFIFO_PF;
  ISR_DEBUG_PORT &= ~bmFIFO_PF;
}
}
 
 
 
 
/** \brief initialize GPIF system */
/** \brief initialize GPIF system */
void init_gpif (void)
void init_gpif (void)
{
{
  uint8_t i;
  uint8_t i;
 
 
#ifdef GECKO3MAIN
#ifdef GECKO3MAIN
  /* IFCLK is generated internally and runs at 48 MHz; GPIF "master mode" */
  /* IFCLK is generated internally and runs at 30 MHz; GPIF "master mode" */
  IFCONFIG = bmIFCLKSRC | bm3048MHZ | bmIFCLKOE | bmGSTATE | bmIFGPIF;
  //IFCONFIG = bmIFCLKSRC | bm3048MHZ | bmIFCLKOE | bmGSTATE | bmIFGPIF;
 
  IFCONFIG = bmIFCLKSRC | bmIFCLKOE | bmGSTATE | bmIFGPIF;
  SYNCDELAY;
  SYNCDELAY;
 
 
  /* we have to commit the currently processed packet BEFORE we switch to auto out mode */
  /* we have to commit the currently processed packet BEFORE we switch to auto out mode */
  OUTPKTEND = bmSKIP | USB_TMC_EP_OUT;
  OUTPKTEND = bmSKIP | USB_TMC_EP_OUT;
 
 
Line 166... Line 164...
   * we use the programmable flag as interrupt source to detect if data for the
   * we use the programmable flag as interrupt source to detect if data for the
   * FPGA is available and as GPIF flag to stop the flowstate, for this the
   * FPGA is available and as GPIF flag to stop the flowstate, for this the
   * flag has to change one cycle before the FIFO is completly empty, else we
   * flag has to change one cycle before the FIFO is completly empty, else we
   * transfer one word too much */
   * transfer one word too much */
  EP2FIFOPFH = bmDECIS;
  EP2FIFOPFH = bmDECIS;
  EP2FIFOPFL = 1;
  EP2FIFOPFL = 4;
  SYNCDELAY;
  SYNCDELAY;
 
 
  //EP2GPIFFLGSEL = bmFLAG_PROGRAMMABLE;
  EP2GPIFFLGSEL = bmFLAG_PROGRAMMABLE;
  EP2GPIFFLGSEL = bmFLAG_EMPTY;
  //EP2GPIFFLGSEL = bmFLAG_EMPTY;
  SYNCDELAY;
  SYNCDELAY;
  EP6GPIFFLGSEL = bmFLAG_FULL;
  EP6GPIFFLGSEL = bmFLAG_FULL;
  SYNCDELAY;
  SYNCDELAY;
 
 
  EP2GPIFPFSTOP = 0;
  EP2GPIFPFSTOP = 0;
Line 284... Line 282...
 
 
  flGPIF = 0;  /* unset all internal GPIF flags */
  flGPIF = 0;  /* unset all internal GPIF flags */
 
 
 
 
#ifdef GECKO3MAIN
#ifdef GECKO3MAIN
  //EP2FIFOCFG &= ~bmOEP;
 
  EP2FIFOCFG &= ~bmAUTOOUT;  /* disable AutoOUT feature */
  EP2FIFOCFG &= ~bmAUTOOUT;  /* disable AutoOUT feature */
  SYNCDELAY;
  SYNCDELAY;
  //EP6FIFOCFG &= ~bmINFM;
  //EP6FIFOCFG &= ~bmINFM;
  EP6FIFOCFG &= ~bmAUTOIN;   /* disable AutoIN feature */
  EP6FIFOCFG &= ~bmAUTOIN;   /* disable AutoIN feature */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.