Exemplo n.º 1
0
void
xadapter_timer_handler(void *p)
{
	timer_callback();

	XTime_TSRClearStatusBits(XREG_TSR_CLEAR_ALL);
}
void
platform_setup_timer()
{
#ifdef XPAR_CPU_PPC440_CORE_CLOCK_FREQ_HZ
    XExc_RegisterHandler(XEXC_ID_DEC_INT, (XExceptionHandler)xadapter_timer_handler, NULL);

    /* Set DEC to interrupt every 250 mseconds */
    XTime_DECSetInterval(PIT_INTERVAL);
    XTime_TSRClearStatusBits(XREG_TSR_CLEAR_ALL);
    XTime_DECEnableAutoReload();
#else
    XExc_RegisterHandler(XEXC_ID_PIT_INT, (XExceptionHandler)xadapter_timer_handler, NULL);

    /* Set PIT to interrupt every 250 mseconds */
    XTime_PITSetInterval(PIT_INTERVAL);
    XTime_TSRClearStatusBits(XREG_TSR_CLEAR_ALL);
    XTime_PITEnableAutoReload();
    XTime_PITEnableInterrupt();
#endif
}
Exemplo n.º 3
0
//***************************************************************
//******************* INTERRUPT FUNCTIONS ***********************
//***************************************************************
void Interrupt_Init(void)
{
	//PUSH BUTTON INTERRUPT
	/* Code */
	XIntc_Initialize(&Intc, INTC_DEVICE_ID);
	XGpio_Initialize(&Gpio, GPIO_DEVICE_ID);
	XIntc_Connect(&Intc, INTR_ID, GpioIsr, &Gpio);
	
	/* Buttons are all inputs */
	XGpio_SetDataDirection(&Gpio, BUTTON_CHANNEL, GPIO_ALL_BUTTONS);
	
	XGpio_InterruptEnable(&Gpio, BUTTON_INTERRUPT);
	XGpio_InterruptGlobalEnable(&Gpio);
	
	/* Enable the Interrupt vector at the interrupt controller */
	XIntc_Enable(&Intc, INTR_ID);
	
	XExc_Init();
	
	/*****************************************************************
	* Initialize the PPC405 exception table and register the interrupt
	* controller handler with the exception table
	******************************************************************/
	XExc_RegisterHandler(XEXC_ID_NON_CRITICAL_INT, (XExceptionHandler)XIntc_InterruptHandler, &Intc);
	/* Now Register Timer Interrupt */
	XExc_RegisterHandler(XEXC_ID_PIT_INT, (XExceptionHandler)TimerIsr, (void *)0);
	
		
	/* Enable non-critical exceptions in the PowerPC */
	XExc_mEnableExceptions(XEXC_NON_CRITICAL);
	
	/*******************************************************************
	* Start the interrput controller such that interrupts are recognized
	* and handled by the processor.
	********************************************************************/
	XIntc_Start(&Intc, XIN_REAL_MODE);
	
	//TIMER INTERRUPT
	/* Set Timer Interval (1 Sec) */
	XTime_PITSetInterval(0x0F000000);
	/* Automatically Restarts Timer */
	XTime_PITEnableAutoReload();
	/* Clear Timer Reg */
	XTime_TSRClearStatusBits(XREG_TSR_CLEAR_ALL);
	/* Clear Queued Timer Interrupts */
	XTime_PITClearInterrupt();
	/* Enable Interrupt */
	XTime_PITEnableInterrupt();	
}
Exemplo n.º 4
0
void XTime_WDTClearResetStatus(void)
{
   XTime_TSRClearStatusBits(XREG_TSR_WDT_RESET_STATUS_11);
}
Exemplo n.º 5
0
void XTime_WDTEnableNextWatchdog(void)
{
   XTime_TSRClearStatusBits(XREG_TSR_WDT_ENABLE_NEXT_WATCHDOG);
}
Exemplo n.º 6
0
void XTime_WDTClearInterrupt(void)
{
   XTime_TSRClearStatusBits(XREG_TSR_WDT_INTERRUPT_STATUS);
}