コード例 #1
0
ファイル: isr.c プロジェクト: Gnostech/gnss-sdr
/*
 * One time call to enable autovectoring for both USB and FIFO/GPIF.
 *
 * This disables all USB and FIFO/GPIF interrupts and clears
 * any pending interrupts too.  It leaves the master USB and FIFO/GPIF
 * interrupts enabled.
 */
void
setup_autovectors (void)
{
  // disable master usb and fifo/gpif interrupt enables
  EIUSB = 0;
  EIEX4 = 0;

  hook_sv (SV_INT_2, (unsigned short) _usb_autovector);
  hook_sv (SV_INT_4, (unsigned short) _fifo_gpif_autovector);

  // disable all fifo interrupt enables
  SYNCDELAY;
  EP2FIFOIE = 0;	SYNCDELAY;
  EP4FIFOIE = 0;	SYNCDELAY;
  EP6FIFOIE = 0;	SYNCDELAY;
  EP8FIFOIE = 0;	SYNCDELAY;

  // clear all pending fifo irqs	
  EP2FIFOIRQ = 0xff;	SYNCDELAY;
  EP4FIFOIRQ = 0xff;	SYNCDELAY;
  EP6FIFOIRQ = 0xff;	SYNCDELAY;
  EP8FIFOIRQ = 0xff;	SYNCDELAY;

  IBNIE  = 0;
  IBNIRQ = 0xff;
  NAKIE  = 0;
  NAKIRQ = 0xff;
  USBIE  = 0;
  USBIRQ = 0xff;
  EPIE   = 0;
  EPIRQ  = 0xff;
  SYNCDELAY;	GPIFIE = 0;		
  SYNCDELAY;	GPIFIRQ = 0xff;
  USBERRIE = 0;
  USBERRIRQ = 0xff;
  CLRERRCNT = 0;
  
  INTSETUP = bmAV2EN | bmAV4EN | bmINT4IN;

  // clear master irq's for usb and fifo/gpif
  EXIF &= ~bmEXIF_USBINT;
  EXIF &= ~bmEXIF_IE4;
  
  // enable master usb and fifo/gpif interrrupts
  EIUSB = 1;
  EIEX4 = 1;
}
コード例 #2
0
ファイル: timer.c プロジェクト: 593141477/nexys2-osx
void 
hook_timer_tick (unsigned short isr_tick_handler)
{
  ET2 = 0;			// disable timer 2 interrupts
  hook_sv (SV_TIMER_2, isr_tick_handler);
  
  RCAP2H = RELOAD_VALUE >> 8;	// setup the auto reload value
  RCAP2L = RELOAD_VALUE & 0xFF;

  T2CON = 0x04;			// interrupt on overflow; reload; run
  ET2 = 1;			// enable timer 2 interrupts
}