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

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

Rev 17 Rev 18
Line 90... Line 90...
{
{
  ISR_DEBUG_PORT |= bmGPIF_DONE;
  ISR_DEBUG_PORT |= bmGPIF_DONE;
 
 
  clear_fifo_gpif_irq();
  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;
 
    SYNCDELAY;
    gpif_trigger_write();
    gpif_trigger_write();
  }
  }
  else {
  else {
    INPKTEND = USB_TMC_EP_IN;
    INPKTEND = USB_TMC_EP_IN;
    gpif_trigger_read();
    gpif_trigger_read();
  }
  }
 
  //EA = 1;             /* global interrupt enable */
 
 
  ISR_DEBUG_PORT &= ~bmGPIF_DONE;
  ISR_DEBUG_PORT &= ~bmGPIF_DONE;
}
}
 
 
 
 
Line 116... Line 121...
  ISR_DEBUG_PORT |= bmFIFO_PF;
  ISR_DEBUG_PORT |= bmFIFO_PF;
 
 
  clear_fifo_gpif_irq();
  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 */
    //EA = 0;           /* disable all interrupts */
    GPIFABORT = 0xFF;
    GPIFABORT = 0xFF;
    SYNCDELAY;
    SYNCDELAY;
    EA = 1;             /* global interrupt enable */
 
 
 
    gpif_trigger_write();
    gpif_trigger_write();
 
    //EA = 1;           /* global interrupt enable */
  }
  }
 
 
  ISR_DEBUG_PORT &= ~bmFIFO_PF;
  ISR_DEBUG_PORT &= ~bmFIFO_PF;
}
}
 
 
Line 149... Line 154...
 
 
  /*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;
  SYNCDELAY;
  SYNCDELAY;
 
 
  /* 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
   * is available and as GPIF flag to stop the flowstate, for this the flag has to change
   * FPGA is available and as GPIF flag to stop the flowstate, for this the
   * one cycle before the FIFO is completly empty, else we transfer one word too much */
   * flag has to change one cycle before the FIFO is completly empty, else we
 
   * transfer one word too much */
  EP2FIFOPFH = bmDECIS;
  EP2FIFOPFH = bmDECIS;
  EP2FIFOPFL = 3;
  EP2FIFOPFL = 1;
  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 210... Line 213...
 
 
  /* 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 281... Line 283...
  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;
Line 296... Line 295...
#endif
#endif
 
 
  EA = 1;               /* global interrupt enable */
  EA = 1;               /* global interrupt enable */
 
 
 
 
  print_info("gpif deactivated\n");
  //print_info("gpif deactivated\n");
}
}
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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