Merge pull request #8030 from OpenNuvoton/nuvoton_fix_common_tickers_fail

Nuvoton: Fix Greentea test common_tickers failed
pull/8219/head
Martin Kojtal 2018-09-21 14:55:28 +02:00 committed by GitHub
commit ab882c3416
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 44 additions and 146 deletions

View File

@ -473,11 +473,14 @@ void ticker_speed_test(void)
/* ---- Test fire_interrupt function. ---- */
counter = NUM_OF_CALLS;
/* Disable ticker interrupt which would interfere with speed test */
core_util_critical_section_enter();
start = us_ticker_read();
while (counter--) {
intf->fire_interrupt();
}
stop = us_ticker_read();
core_util_critical_section_exit();
TEST_ASSERT(diff_us(start, stop, us_ticker_info) < (NUM_OF_CALLS * (MAX_FUNC_EXEC_TIME_US + DELTA_FUNC_EXEC_TIME_US)));
@ -569,7 +572,7 @@ utest::v1::status_t lp_ticker_teardown(const Case *const source, const size_t pa
utest::v1::status_t test_setup(const size_t number_of_cases)
{
GREENTEA_SETUP(30, "default_auto");
GREENTEA_SETUP(80, "default_auto");
return verbose_test_setup_handler(number_of_cases);
}

View File

@ -101,8 +101,6 @@ void lp_ticker_init(void)
/* By HAL spec, ticker_init allows the ticker to keep counting and disables the
* ticker interrupt. */
lp_ticker_disable_interrupt();
lp_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
return;
}
ticker_inited = 1;
@ -162,23 +160,7 @@ void lp_ticker_init(void)
void lp_ticker_free(void)
{
TIMER_T *timer_base = (TIMER_T *) NU_MODBASE(TIMER_MODINIT.modname);
/* Stop counting */
TIMER_Stop(timer_base);
wait_us((NU_US_PER_SEC / NU_TMRCLK_PER_SEC) * 3);
/* Wait for timer to stop counting and unset active flag */
while((timer_base->CTL & TIMER_CTL_ACTSTS_Msk));
/* Disable wakeup */
TIMER_DisableWakeup(timer_base);
wait_us((NU_US_PER_SEC / NU_TMRCLK_PER_SEC) * 3);
/* Disable interrupt */
TIMER_DisableInt(timer_base);
wait_us((NU_US_PER_SEC / NU_TMRCLK_PER_SEC) * 3);
NVIC_DisableIRQ(TIMER_MODINIT.irq_n);
/* Disable IP clock
@ -203,6 +185,10 @@ timestamp_t lp_ticker_read()
void lp_ticker_set_interrupt(timestamp_t timestamp)
{
/* Clear any previously pending interrupts */
lp_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
/* In continuous mode, counter will be reset to zero with the following sequence:
* 1. Stop counting
* 2. Configure new CMP value

View File

@ -75,8 +75,6 @@ void us_ticker_init(void)
/* By HAL spec, ticker_init allows the ticker to keep counting and disables the
* ticker interrupt. */
us_ticker_disable_interrupt();
us_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
return;
}
ticker_inited = 1;
@ -125,16 +123,7 @@ void us_ticker_init(void)
void us_ticker_free(void)
{
TIMER_T *timer_base = (TIMER_T *) NU_MODBASE(TIMER_MODINIT.modname);
/* Stop counting */
TIMER_Stop(timer_base);
/* Wait for timer to stop counting and unset active flag */
while((timer_base->CTL & TIMER_CTL_ACTSTS_Msk));
/* Disable interrupt */
TIMER_DisableInt(timer_base);
NVIC_DisableIRQ(TIMER_MODINIT.irq_n);
/* Disable IP clock
@ -159,6 +148,10 @@ uint32_t us_ticker_read()
void us_ticker_set_interrupt(timestamp_t timestamp)
{
/* Clear any previously pending interrupts */
us_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
/* In continuous mode, counter will be reset to zero with the following sequence:
* 1. Stop counting
* 2. Configure new CMP value

View File

@ -76,8 +76,6 @@ void lp_ticker_init(void)
/* By HAL spec, ticker_init allows the ticker to keep counting and disables the
* ticker interrupt. */
lp_ticker_disable_interrupt();
lp_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
return;
}
ticker_inited = 1;
@ -128,23 +126,7 @@ void lp_ticker_init(void)
void lp_ticker_free(void)
{
TIMER_T *timer_base = (TIMER_T *) NU_MODBASE(TIMER_MODINIT.modname);
/* Stop counting */
TIMER_Stop(timer_base);
wait_us((NU_US_PER_SEC / NU_TMRCLK_PER_SEC) * 3);
/* Wait for timer to stop counting and unset active flag */
while((timer_base->CTL & TIMER_CTL_ACTSTS_Msk));
/* Disable wakeup */
TIMER_DisableWakeup(timer_base);
wait_us((NU_US_PER_SEC / NU_TMRCLK_PER_SEC) * 3);
/* Disable interrupt */
TIMER_DisableInt(timer_base);
wait_us((NU_US_PER_SEC / NU_TMRCLK_PER_SEC) * 3);
NVIC_DisableIRQ(TIMER_MODINIT.irq_n);
/* Disable IP clock */
@ -166,6 +148,10 @@ timestamp_t lp_ticker_read()
void lp_ticker_set_interrupt(timestamp_t timestamp)
{
/* Clear any previously pending interrupts */
lp_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
/* In continuous mode, counter will be reset to zero with the following sequence:
* 1. Stop counting
* 2. Configure new CMP value

View File

@ -52,8 +52,6 @@ void us_ticker_init(void)
/* By HAL spec, ticker_init allows the ticker to keep counting and disables the
* ticker interrupt. */
us_ticker_disable_interrupt();
us_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
return;
}
ticker_inited = 1;
@ -93,16 +91,7 @@ void us_ticker_init(void)
void us_ticker_free(void)
{
TIMER_T *timer_base = (TIMER_T *) NU_MODBASE(TIMER_MODINIT.modname);
/* Stop counting */
TIMER_Stop(timer_base);
/* Wait for timer to stop counting and unset active flag */
while((timer_base->CTL & TIMER_CTL_ACTSTS_Msk));
/* Disable interrupt */
TIMER_DisableInt(timer_base);
NVIC_DisableIRQ(TIMER_MODINIT.irq_n);
/* Disable IP clock */
@ -124,6 +113,10 @@ uint32_t us_ticker_read()
void us_ticker_set_interrupt(timestamp_t timestamp)
{
/* Clear any previously pending interrupts */
us_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
/* In continuous mode, counter will be reset to zero with the following sequence:
* 1. Stop counting
* 2. Configure new CMP value

View File

@ -76,8 +76,6 @@ void lp_ticker_init(void)
/* By HAL spec, ticker_init allows the ticker to keep counting and disables the
* ticker interrupt. */
lp_ticker_disable_interrupt();
lp_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
return;
}
ticker_inited = 1;
@ -128,23 +126,7 @@ void lp_ticker_init(void)
void lp_ticker_free(void)
{
TIMER_T *timer_base = (TIMER_T *) NU_MODBASE(TIMER_MODINIT.modname);
/* Stop counting */
TIMER_Stop(timer_base);
wait_us((NU_US_PER_SEC / NU_TMRCLK_PER_SEC) * 3);
/* Wait for timer to stop counting and unset active flag */
while((timer_base->CTL & TIMER_CTL_ACTSTS_Msk));
/* Disable wakeup */
TIMER_DisableWakeup(timer_base);
wait_us((NU_US_PER_SEC / NU_TMRCLK_PER_SEC) * 3);
/* Disable interrupt */
TIMER_DisableInt(timer_base);
wait_us((NU_US_PER_SEC / NU_TMRCLK_PER_SEC) * 3);
NVIC_DisableIRQ(TIMER_MODINIT.irq_n);
/* Disable IP clock */
@ -166,6 +148,10 @@ timestamp_t lp_ticker_read()
void lp_ticker_set_interrupt(timestamp_t timestamp)
{
/* Clear any previously pending interrupts */
lp_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
/* In continuous mode, counter will be reset to zero with the following sequence:
* 1. Stop counting
* 2. Configure new CMP value

View File

@ -52,8 +52,6 @@ void us_ticker_init(void)
/* By HAL spec, ticker_init allows the ticker to keep counting and disables the
* ticker interrupt. */
us_ticker_disable_interrupt();
us_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
return;
}
ticker_inited = 1;
@ -93,16 +91,7 @@ void us_ticker_init(void)
void us_ticker_free(void)
{
TIMER_T *timer_base = (TIMER_T *) NU_MODBASE(TIMER_MODINIT.modname);
/* Stop counting */
TIMER_Stop(timer_base);
/* Wait for timer to stop counting and unset active flag */
while((timer_base->CTL & TIMER_CTL_ACTSTS_Msk));
/* Disable interrupt */
TIMER_DisableInt(timer_base);
NVIC_DisableIRQ(TIMER_MODINIT.irq_n);
/* Disable IP clock */
@ -124,6 +113,10 @@ uint32_t us_ticker_read()
void us_ticker_set_interrupt(timestamp_t timestamp)
{
/* Clear any previously pending interrupts */
us_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
/* In continuous mode, counter will be reset to zero with the following sequence:
* 1. Stop counting
* 2. Configure new CMP value

View File

@ -78,8 +78,6 @@ void lp_ticker_init(void)
/* By HAL spec, ticker_init allows the ticker to keep counting and disables the
* ticker interrupt. */
lp_ticker_disable_interrupt();
lp_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
return;
}
ticker_inited = 1;
@ -132,23 +130,7 @@ void lp_ticker_init(void)
void lp_ticker_free(void)
{
TIMER_T *timer_base = (TIMER_T *) NU_MODBASE(TIMER_MODINIT.modname);
/* Stop counting */
TIMER_Stop(timer_base);
wait_us((NU_US_PER_SEC / NU_TMRCLK_PER_SEC) * 3);
/* Wait for timer to stop counting and unset active flag */
while((timer_base->CTL & TIMER_CTL_TMR_ACT_Msk));
/* Disable wakeup */
TIMER_DisableWakeup(timer_base);
wait_us((NU_US_PER_SEC / NU_TMRCLK_PER_SEC) * 3);
/* Disable interrupt */
TIMER_DisableInt(timer_base);
wait_us((NU_US_PER_SEC / NU_TMRCLK_PER_SEC) * 3);
NVIC_DisableIRQ(TIMER_MODINIT.irq_n);
/* Disable IP clock */
@ -170,6 +152,10 @@ timestamp_t lp_ticker_read()
void lp_ticker_set_interrupt(timestamp_t timestamp)
{
/* Clear any previously pending interrupts */
lp_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
/* In continuous mode, counter will be reset to zero with the following sequence:
* 1. Stop counting
* 2. Configure new CMP value

View File

@ -54,8 +54,6 @@ void us_ticker_init(void)
/* By HAL spec, ticker_init allows the ticker to keep counting and disables the
* ticker interrupt. */
us_ticker_disable_interrupt();
us_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
return;
}
ticker_inited = 1;
@ -95,16 +93,7 @@ void us_ticker_init(void)
void us_ticker_free(void)
{
TIMER_T *timer_base = (TIMER_T *) NU_MODBASE(TIMER_MODINIT.modname);
/* Stop counting */
TIMER_Stop(timer_base);
/* Wait for timer to stop counting and unset active flag */
while((timer_base->CTL & TIMER_CTL_TMR_ACT_Msk));
/* Disable interrupt */
TIMER_DisableInt(timer_base);
NVIC_DisableIRQ(TIMER_MODINIT.irq_n);
/* Disable IP clock */
@ -126,6 +115,10 @@ uint32_t us_ticker_read()
void us_ticker_set_interrupt(timestamp_t timestamp)
{
/* Clear any previously pending interrupts */
us_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
/* In continuous mode, counter will be reset to zero with the following sequence:
* 1. Stop counting
* 2. Configure new CMP value

View File

@ -76,8 +76,6 @@ void lp_ticker_init(void)
/* By HAL spec, ticker_init allows the ticker to keep counting and disables the
* ticker interrupt. */
lp_ticker_disable_interrupt();
lp_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
return;
}
ticker_inited = 1;
@ -127,23 +125,7 @@ void lp_ticker_init(void)
void lp_ticker_free(void)
{
TIMER_T *timer_base = (TIMER_T *) NU_MODBASE(TIMER_MODINIT.modname);
/* Stop counting */
TIMER_Stop(timer_base);
wait_us((NU_US_PER_SEC / NU_TMRCLK_PER_SEC) * 3);
/* Wait for timer to stop counting and unset active flag */
while((timer_base->CTL & TIMER_CTL_ACTSTS_Msk));
/* Disable wakeup */
TIMER_DisableWakeup(timer_base);
wait_us((NU_US_PER_SEC / NU_TMRCLK_PER_SEC) * 3);
/* Disable interrupt */
TIMER_DisableInt(timer_base);
wait_us((NU_US_PER_SEC / NU_TMRCLK_PER_SEC) * 3);
NVIC_DisableIRQ(TIMER_MODINIT.irq_n);
/* Disable IP clock */
@ -165,6 +147,10 @@ timestamp_t lp_ticker_read()
void lp_ticker_set_interrupt(timestamp_t timestamp)
{
/* Clear any previously pending interrupts */
lp_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
/* In continuous mode, counter will be reset to zero with the following sequence:
* 1. Stop counting
* 2. Configure new CMP value

View File

@ -52,8 +52,6 @@ void us_ticker_init(void)
/* By HAL spec, ticker_init allows the ticker to keep counting and disables the
* ticker interrupt. */
us_ticker_disable_interrupt();
us_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
return;
}
ticker_inited = 1;
@ -92,16 +90,7 @@ void us_ticker_init(void)
void us_ticker_free(void)
{
TIMER_T *timer_base = (TIMER_T *) NU_MODBASE(TIMER_MODINIT.modname);
/* Stop counting */
TIMER_Stop(timer_base);
/* Wait for timer to stop counting and unset active flag */
while((timer_base->CTL & TIMER_CTL_ACTSTS_Msk));
/* Disable interrupt */
TIMER_DisableInt(timer_base);
NVIC_DisableIRQ(TIMER_MODINIT.irq_n);
/* Disable IP clock */
@ -123,6 +112,10 @@ uint32_t us_ticker_read()
void us_ticker_set_interrupt(timestamp_t timestamp)
{
/* Clear any previously pending interrupts */
us_ticker_clear_interrupt();
NVIC_ClearPendingIRQ(TIMER_MODINIT.irq_n);
/* In continuous mode, counter will be reset to zero with the following sequence:
* 1. Stop counting
* 2. Configure new CMP value