mirror of https://github.com/ARMmbed/mbed-os.git
lp_ticker test - provide lp ticker glitch test case
Test that lp ticker does not glitch backwards due to an incorrectly implemented ripple counter driver.pull/7009/head
parent
b7fdf60f29
commit
f55f9d36fb
|
@ -44,7 +44,13 @@ void lp_ticker_info_test(void);
|
||||||
*/
|
*/
|
||||||
void lp_ticker_deepsleep_test(void);
|
void lp_ticker_deepsleep_test(void);
|
||||||
|
|
||||||
|
/** Test that the ticker does not glitch backwards due to an incorrectly implemented ripple counter driver.
|
||||||
|
*
|
||||||
|
* Given ticker is available.
|
||||||
|
* When ticker is enabled and counts.
|
||||||
|
* Then ticker does not glitch backwards due to an incorrectly implemented ripple counter driver.
|
||||||
|
*/
|
||||||
|
void lp_ticker_glitch_test(void);
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -86,6 +86,24 @@ void lp_ticker_deepsleep_test()
|
||||||
TEST_ASSERT_EQUAL(1, intFlag);
|
TEST_ASSERT_EQUAL(1, intFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Test that the ticker does not glitch backwards due to an incorrectly implemented ripple counter driver. */
|
||||||
|
void lp_ticker_glitch_test()
|
||||||
|
{
|
||||||
|
lp_ticker_init();
|
||||||
|
|
||||||
|
const ticker_info_t* p_ticker_info = lp_ticker_get_info();
|
||||||
|
|
||||||
|
uint32_t last = lp_ticker_read();
|
||||||
|
const uint32_t start = last;
|
||||||
|
|
||||||
|
/* Set test time to 2 sec. */
|
||||||
|
while (last < (start + p_ticker_info->frequency * 2)) {
|
||||||
|
const uint32_t cur = lp_ticker_read();
|
||||||
|
TEST_ASSERT(cur >= last);
|
||||||
|
last = cur;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
utest::v1::status_t test_setup(const size_t number_of_cases)
|
utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||||
{
|
{
|
||||||
GREENTEA_SETUP(20, "default_auto");
|
GREENTEA_SETUP(20, "default_auto");
|
||||||
|
@ -95,6 +113,7 @@ utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||||
Case cases[] = {
|
Case cases[] = {
|
||||||
Case("lp ticker info test", lp_ticker_info_test),
|
Case("lp ticker info test", lp_ticker_info_test),
|
||||||
Case("lp ticker sleep test", lp_ticker_deepsleep_test),
|
Case("lp ticker sleep test", lp_ticker_deepsleep_test),
|
||||||
|
Case("lp ticker glitch test", lp_ticker_glitch_test)
|
||||||
};
|
};
|
||||||
|
|
||||||
Specification specification(test_setup, cases);
|
Specification specification(test_setup, cases);
|
||||||
|
|
|
@ -43,6 +43,9 @@ extern "C" {
|
||||||
* * See the @ref hal_ticker_shared "ticker specification"
|
* * See the @ref hal_ticker_shared "ticker specification"
|
||||||
* * Calling any function other than lp_ticker_init after calling lp_ticker_free
|
* * Calling any function other than lp_ticker_init after calling lp_ticker_free
|
||||||
*
|
*
|
||||||
|
* # Potential bugs
|
||||||
|
* * Glitches due to ripple counter - Verified by ::lp_ticker_glitch_test
|
||||||
|
*
|
||||||
* @see hal_lp_ticker_tests
|
* @see hal_lp_ticker_tests
|
||||||
*
|
*
|
||||||
* @{
|
* @{
|
||||||
|
|
Loading…
Reference in New Issue