[BEETLE] Update disable dualtimer irq function

This patch updates DualTimer_DisableInterrupt to
disable the interrupt timers individually.
In addition, it updates lp_ticker accordingly.

Signed-off-by: Marc Moreno <marc.morenoberengue@arm.com>
pull/3046/head
Marc Moreno Berengue 2016-10-17 14:19:21 +01:00
parent e2efb35723
commit a3eacfd8d1
3 changed files with 42 additions and 17 deletions

View File

@ -297,18 +297,38 @@ void DualTimer_SetInterrupt_2(uint32_t timer, uint32_t time_us,
}
/*
* DualTimer_DisableInterrupt(): disables timer interrupt
* timer: timer on which interrupt is disabled
* DualTimer_DisableInterrupt(): disables timer interrupts
* dualimer: dualtimer on which interrupt is disabled
* single_timer: single timer in the dualtimer on which
* interrupt is disabled
*/
void DualTimer_DisableInterrupt(uint32_t timer)
void DualTimer_DisableInterrupt(uint32_t dualtimer,
uint32_t single_timer)
{
/* Verify if the Timer is enabled */
if (DualTimer_isEnabled(timer) == 1) {
/* Disable Interrupt */
(DualTimers[timer].dualtimer1)->TimerControl &=
CMSDK_DUALTIMER_CTRL_EN_Msk;
(DualTimers[timer].dualtimer2)->TimerControl &=
CMSDK_DUALTIMER_CTRL_EN_Msk;
if (DualTimer_isEnabled(dualtimer) == 1) {
switch(single_timer) {
case SINGLETIMER1:
/* Disable Interrupt for single timer 1 */
(DualTimers[dualtimer].dualtimer1)->TimerControl &=
CMSDK_DUALTIMER_CTRL_EN_Msk;
break;
case SINGLETIMER2:
/* Disable Interrupt for single timer 2 */
(DualTimers[dualtimer].dualtimer2)->TimerControl &=
CMSDK_DUALTIMER_CTRL_EN_Msk;
break;
case ALL_SINGLETIMERS:
/* Disable Interrupt for single timer 1 */
(DualTimers[dualtimer].dualtimer1)->TimerControl &=
CMSDK_DUALTIMER_CTRL_EN_Msk;
/* Disable Interrupt for single timer 2 */
(DualTimers[dualtimer].dualtimer2)->TimerControl &=
CMSDK_DUALTIMER_CTRL_EN_Msk;
break;
default:
break;
}
}
}

View File

@ -22,10 +22,11 @@ extern "C" {
#endif
/* Supported Number of Dual Timers */
#define NUM_DUALTIMERS 1
#define DUALTIMER0 0
#define SINGLETIMER1 1
#define SINGLETIMER2 2
#define NUM_DUALTIMERS 1
#define DUALTIMER0 0
#define SINGLETIMER1 1
#define SINGLETIMER2 2
#define ALL_SINGLETIMERS 3
/*
* DualTimer_Initialize(): Initializes a hardware timer
@ -107,10 +108,13 @@ void DualTimer_SetInterrupt_2(uint32_t timer, uint32_t time_us,
timerenable_t mode);
/*
* DualTimer_DisableInterrupt(): disables timer interrupt
* timer: timer on which interrupt is disabled
* DualTimer_DisableInterrupt(): disables timer interrupts
* dualimer: dualtimer on which interrupt is disabled
* single_timer: single timer in the dualtimer on which
* interrupt is disabled
*/
void DualTimer_DisableInterrupt(uint32_t timer);
void DualTimer_DisableInterrupt(uint32_t dualtimer,
uint32_t single_timer);
/*
* DualTimer_ClearInterrupt(): clear timer interrupt

View File

@ -142,7 +142,8 @@ void lp_ticker_set_interrupt(timestamp_t timestamp)
void lp_ticker_disable_interrupt(void)
{
/* Disable Interrupt */
DualTimer_DisableInterrupt(DUALTIMER0);
DualTimer_DisableInterrupt(DUALTIMER0,
SINGLETIMER1);
}
/**