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 9 and 17

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

Rev 9 Rev 17
Line 90... Line 90...
{
{
  ISR_DEBUG_PORT |= bmGPIF_DONE;
  ISR_DEBUG_PORT |= bmGPIF_DONE;
 
 
  clear_fifo_gpif_irq();
  clear_fifo_gpif_irq();
 
 
  if((flGPIF & bmGPIF_PENDING_DATA) == bmGPIF_PENDING_DATA) {
  /* check if there is data available for an OUT transfer */
 
  //if((flGPIF & bmGPIF_PENDING_DATA) == bmGPIF_PENDING_DATA) {
 
  if(!(EP2468STAT & bmEP2EMPTY)) {
    flGPIF &= ~bmGPIF_PENDING_DATA;
    flGPIF &= ~bmGPIF_PENDING_DATA;
    gpif_trigger_write();
    gpif_trigger_write();
  }
  }
  else {
  else {
    INPKTEND = 0x06;
    INPKTEND = USB_TMC_EP_IN;
    gpif_trigger_read();
    gpif_trigger_read();
  }
  }
 
 
  ISR_DEBUG_PORT &= ~bmGPIF_DONE;
  ISR_DEBUG_PORT &= ~bmGPIF_DONE;
}
}
Line 113... Line 115...
{
{
  ISR_DEBUG_PORT |= bmFIFO_PF;
  ISR_DEBUG_PORT |= bmFIFO_PF;
 
 
  clear_fifo_gpif_irq();
  clear_fifo_gpif_irq();
 
 
  if((GPIFIDLECTL & bmBIT3) == bmBIT3) {
  /* check if there is a active IN transfer */
    flGPIF |= bmGPIF_PENDING_DATA;
  /*if((GPIFIDLECTL & bmBIT3) == bmBIT3) {
  }
    flGPIF |= bmGPIF_PENDING_DATA;
  else {
  }
 
  else*/ {
    EA = 0;              /* disable all interrupts */
    EA = 0;              /* disable all interrupts */
    GPIFABORT = 0xFF;
    GPIFABORT = 0xFF;
    SYNCDELAY;
    SYNCDELAY;
    EA = 1;             /* global interrupt enable */
    EA = 1;             /* global interrupt enable */
 
 
Line 143... Line 146...
 
 
  /* 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;
 
 
  /*FIXME  only here for testing */
  /*FIXME  only here for testing */
  EP6AUTOINLENH = (20) >> 8;       SYNCDELAY;  /* this is the length for high speed */
  //EP6AUTOINLENH = (20) >> 8;     SYNCDELAY;  /* this is the length for high speed */
  EP6AUTOINLENL = (20) & 0xff;  SYNCDELAY;
  //EP6AUTOINLENL = (20) & 0xff;  SYNCDELAY;
 
 
 
  //REVCTL = 0;   /* set it back to 0 */
 
  //SYNCDELAY;
 
 
  /* enable autoout and autoin feature of the endpoints */
  /* enable autoout and autoin feature of the endpoints */
  EP2FIFOCFG |= bmAUTOOUT;
  EP2FIFOCFG |= bmAUTOOUT;
  SYNCDELAY;
  SYNCDELAY;
  EP6FIFOCFG |= bmAUTOIN;
  EP6FIFOCFG |= bmAUTOIN;
Line 157... Line 163...
  /* set endpoint 2 fifo (out) programmable flag to "higher or equal 3"
  /* set endpoint 2 fifo (out) programmable flag to "higher or equal 3"
   * we use the programmable flag as interrupt source to detect if data for the FPGA
   * 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 flag has to change
   * 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 transfer one word too much */
   * one cycle before the FIFO is completly empty, else we transfer one word too much */
  EP2FIFOPFH = bmDECIS;
  EP2FIFOPFH = bmDECIS;
  EP2FIFOPFL = 1;
  EP2FIFOPFL = 3;
  SYNCDELAY;
  SYNCDELAY;
 
 
  EP2GPIFFLGSEL = bmFLAG_PROGRAMMABLE;
  EP2GPIFFLGSEL = bmFLAG_PROGRAMMABLE;
  // EP2GPIFFLGSEL = bmFLAG_EMPTY;
  // EP2GPIFFLGSEL = bmFLAG_EMPTY;
  SYNCDELAY;
  SYNCDELAY;
Line 204... Line 210...
 
 
  /* due to big problems with the done interrupt, we use the WAVEFORM interrupt
  /* due to big problems with the done interrupt, we use the WAVEFORM interrupt
     to signal the firmware that the GPIF is done */
     to signal the firmware that the GPIF is done */
  hook_fgv(FGV_GPIFWF,(unsigned short) isr_gpif_done);
  hook_fgv(FGV_GPIFWF,(unsigned short) isr_gpif_done);
  hook_fgv(FGV_EP2PF,(unsigned short) isr_endpoint_out_data);
  hook_fgv(FGV_EP2PF,(unsigned short) isr_endpoint_out_data);
 
  hook_fgv(FGV_EP2PF,(unsigned short) isr_endpoint_out_data);
 
 
  EP2FIFOIE = bmFIFO_PF;
  EP2FIFOIE = bmFIFO_PF;
  GPIFIE = bmGPIFWF;
  GPIFIE = bmGPIFWF;
 
 
  EA = 1;               /* global interrupt enable */
  EA = 1;               /* global interrupt enable */
Line 235... Line 242...
  flGPIF = 0;
  flGPIF = 0;
 
 
  GPIFABORT = 0xFF;
  GPIFABORT = 0xFF;
  SYNCDELAY;
  SYNCDELAY;
  while(!(GPIFTRIG & bmGPIF_IDLE));
  while(!(GPIFTRIG & bmGPIF_IDLE));
  print_info("gpif aborted\n");
  //print_info("gpif aborted\n");
 
 
  EA = 1;               /* global interrupt enable */
  EA = 1;               /* global interrupt enable */
 
 
 
 
  gpif_trigger_read();
  gpif_trigger_read();
Line 273... Line 280...
  GPIFABORT = 0xFF; /* abort pending GPIF transaction */
  GPIFABORT = 0xFF; /* abort pending GPIF transaction */
  SYNCDELAY;
  SYNCDELAY;
 
 
  flGPIF = 0;  /* unset all internal GPIF flags */
  flGPIF = 0;  /* unset all internal GPIF flags */
 
 
 
 
 
  REVCTL = bmDYN_OUT | bmENH_PKT;   /*  restore the setting */
 
  SYNCDELAY;
 
 
#ifdef GECKO3MAIN
#ifdef GECKO3MAIN
  //EP2FIFOCFG &= ~bmOEP;
  //EP2FIFOCFG &= ~bmOEP;
  EP2FIFOCFG &= ~bmAUTOOUT;  /* disable AutoOUT feature */
  EP2FIFOCFG &= ~bmAUTOOUT;  /* disable AutoOUT feature */
  SYNCDELAY;
  SYNCDELAY;
  //EP6FIFOCFG &= ~bmINFM;
  //EP6FIFOCFG &= ~bmINFM;

powered by: WebSVN 2.1.0

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