void Sysdelay(unsigned int milliSec) { #ifdef DELAY_USE_INTERRUPTS unsigned int countVal = TIMER_OVERFLOW - (milliSec * TIMER_1MS_COUNT); DMTimerCounterSet(SOC_DMTIMER_7_REGS, countVal); flagIsr = FALSE; /* Enable the DMTimer interrupts */ DMTimerIntEnable(SOC_DMTIMER_7_REGS, DMTIMER_INT_OVF_EN_FLAG); /* Start the DMTimer */ DMTimerEnable(SOC_DMTIMER_7_REGS); while(FALSE == flagIsr) ; /* Disable the DMTimer interrupts */ DMTimerIntDisable(SOC_DMTIMER_7_REGS, DMTIMER_INT_OVF_EN_FLAG); #else while(milliSec != 0) { DMTimerCounterSet(SOC_DMTIMER_7_REGS, 0); DMTimerEnable(SOC_DMTIMER_7_REGS); while(DMTimerCounterGet(SOC_DMTIMER_7_REGS) < TIMER_1MS_COUNT); DMTimerDisable(SOC_DMTIMER_7_REGS); milliSec--; } #endif }
/** * This function stops the timer. */ void SysStopTimer(void) { #ifdef DELAY_USE_INTERRUPTS DMTimerDisable(SOC_DMTIMER_7_REGS); /* Disable the DMTimer interrupts */ DMTimerIntDisable(SOC_DMTIMER_7_REGS, DMTIMER_INT_OVF_EN_FLAG); #else DMTimerDisable(SOC_DMTIMER_7_REGS); #endif }
/* ** DMTimer interrupt service routine. This will send a character to serial ** console. */ static void DMTimerIsr(void) { /* Disable the DMTimer interrupts */ DMTimerIntDisable(SOC_DMTIMER_2_REGS, DMTIMER_INT_OVF_EN_FLAG); /* Clear the status of the interrupt flags */ DMTimerIntStatusClear(SOC_DMTIMER_2_REGS, DMTIMER_INT_OVF_IT_FLAG); flagIsr = 1; /* Enable the DMTimer interrupts */ DMTimerIntEnable(SOC_DMTIMER_2_REGS, DMTIMER_INT_OVF_EN_FLAG); }
static inline void rmpi_timer_interrupt_off (void) { DMTimerIntDisable(SOC_DMTIMER_4_REGS, DMTIMER_INT_OVF_EN_FLAG); DMTimerIntStatusClear(SOC_DMTIMER_4_REGS, DMTIMER_INT_OVF_IT_FLAG); }