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 19 and 20

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

Rev 19 Rev 20
Line 81... Line 81...
//volatile static uint8_t flGPIF;
//volatile static uint8_t flGPIF;
 
 
 
 
 
 
/**
/**
 * \brief exectuted when the gpif wafeform terminates
 * \brief exectuted when the gpif waveform terminates
 */
 */
void
void
isr_gpif_done (void) interrupt
isr_gpif_done (void) interrupt
{
{
  ISR_DEBUG_PORT |= bmGPIF_DONE;
  ISR_DEBUG_PORT |= bmGPIF_DONE;
 
 
  /* 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;
 
    GPIFABORT = 0xFF;
 
    SYNCDELAY;
 
    gpif_trigger_write();
 
  }
 
  else*/ {
 
    /* check if this is a end of a IN transfer */
    /* check if this is a end of a IN transfer */
    //INPKTEND = USB_TMC_EP_IN;
  if((flGPIF & bmGPIF_READ_IN_PROGRESS) == bmGPIF_READ_IN_PROGRESS){
 
    INPKTEND = USB_TMC_EP_IN;
 
  }
 
 
    while(!(GPIFTRIG & bmGPIF_IDLE));
    while(!(GPIFTRIG & bmGPIF_IDLE));
 
 
 
  /* 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;
 
 
 
    gpif_trigger_write();
 
    flGPIF &= ~bmGPIF_READ_IN_PROGRESS;
 
  }
 
  else {
    gpif_trigger_read();
    gpif_trigger_read();
 
    flGPIF |= bmGPIF_READ_IN_PROGRESS;
  }
  }
 
 
  clear_fifo_gpif_irq();
  clear_fifo_gpif_irq();
 
 
  ISR_DEBUG_PORT &= ~bmGPIF_DONE;
  ISR_DEBUG_PORT &= ~bmGPIF_DONE;
Line 118... Line 123...
isr_endpoint_out_data (void) interrupt
isr_endpoint_out_data (void) interrupt
{
{
  ISR_DEBUG_PORT |= bmFIFO_PF;
  ISR_DEBUG_PORT |= bmFIFO_PF;
 
 
  /* check if there is a active IN transfer */
  /* check if there is a active IN transfer */
  /*if((GPIFIDLECTL & bmBIT3) == bmBIT3) {
  if((GPIFREADYSTAT & bmWRX) == bmWRX) {
    flGPIF |= bmGPIF_PENDING_DATA;
    flGPIF |= bmGPIF_PENDING_DATA;
  }
  }
  else*/ {
  else {
    GPIFABORT = 0xFF;
    GPIFABORT = 0xFF;
    SYNCDELAY;
    SYNCDELAY;
    while(!(GPIFTRIG & bmGPIF_IDLE));
    while(!(GPIFTRIG & bmGPIF_IDLE));
    gpif_trigger_write();
    gpif_trigger_write();
 
    flGPIF &= ~bmGPIF_READ_IN_PROGRESS;
  }
  }
 
 
  clear_fifo_gpif_irq();
  clear_fifo_gpif_irq();
 
 
  ISR_DEBUG_PORT &= ~bmFIFO_PF;
  ISR_DEBUG_PORT &= ~bmFIFO_PF;
Line 227... Line 233...
 
 
 
 
/** \brief aborts any gpif running gpif transaction  */
/** \brief aborts any gpif running gpif transaction  */
void abort_gpif(void) {
void abort_gpif(void) {
 
 
#ifdef GECKO3MAIN
 
 
 
  /* signal an abort condition to the FPGA */
 
  //if(!(GPIFTRIG & bmGPIF_IDLE)) {
 
  //GPIFREADYCFG &= ~bmINTRDY;
 
  //udelay(10);
 
  //}
 
#endif
 
  EA = 0;                /* disable all interrupts */
  EA = 0;                /* disable all interrupts */
 
 
  flGPIF = 0;
  flGPIF = 0;
 
 
 
  /* abort the current GPIF waveform */
  GPIFABORT = 0xFF;
  GPIFABORT = 0xFF;
  SYNCDELAY;
  SYNCDELAY;
  while(!(GPIFTRIG & bmGPIF_IDLE));
  while(!(GPIFTRIG & bmGPIF_IDLE));
  //print_info("gpif aborted\n");
 
 
 
  EA = 1;               /* global interrupt enable */
  EA = 1;               /* global interrupt enable */
 
 
 
  //print_info("gpif aborted\n");
 
 
 
#ifdef GECKO3MAIN
 
  /* signal an abort condition to the FPGA (both WRU and RDYU high) */
 
  GPIFIDLECTL |= bmRDYU | bmWRU;
 
  udelay(10);
 
  GPIFIDLECTL = InitData[ 3 ]; /* restore original state */
 
#endif
 
 
  gpif_trigger_read();
  gpif_trigger_read();
 
  flGPIF |= bmGPIF_READ_IN_PROGRESS;
}
}
 
 
 
 
/** \brief disables gpif system */
/** \brief disables gpif system */
void deactivate_gpif(void) {
void deactivate_gpif(void) {
 
 
#ifdef GECKO3MAIN
 
 
 
  /* signal an abort condition to the FPGA */
 
  //if(!(GPIFTRIG & bmGPIF_IDLE)) {
 
  //GPIFREADYCFG &= ~bmINTRDY;
 
  //udelay(10);
 
  //}
 
#endif
 
 
 
 
 
  EA = 0;                /* disable all interrupts */
  EA = 0;                /* disable all interrupts */
 
 
  EP2FIFOIE = 0;  /* disable FIFO interrupt */
  EP2FIFOIE = 0;  /* disable FIFO interrupt */
  SYNCDELAY;
  SYNCDELAY;
  GPIFIE = 0;     /* disable all GPIF interrupts */
  GPIFIE = 0;     /* disable all GPIF interrupts */
Line 280... Line 277...
  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 */
 
 
 
  EA = 1;               /* global interrupt enable */
 
 
 
  while(!(GPIFTRIG & bmGPIF_IDLE));
 
 
#ifdef GECKO3MAIN
#ifdef GECKO3MAIN
 
  /* signal an abort condition to the FPGA (both WRU and RDYU high) */
 
  GPIFIDLECTL |= bmRDYU | bmWRU;
 
  udelay(10);
 
  GPIFIDLECTL = InitData[ 3 ]; /* restore original state */
 
 
  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 */
 
 
#endif
#endif
 
 
  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.