Mistake on this page?
Report an issue in GitHub or email us
Functions

Tests to validate the proper implementation of the sleep manager. More...

Functions

void test_lock_unlock ()
 Test lock/unlock. More...
 
void test_lock_eq_ushrt_max ()
 Test lock USHRT_MAX times. More...
 
void test_sleep_auto ()
 Test sleep_auto calls sleep and deep sleep based on lock. More...
 
void test_lock_unlock_test_check ()
 Test lock/unlock test_check fun. More...
 
void sleep_manager_multithread_test ()
 Test lock/unlock is thread safe. More...
 
void sleep_manager_irq_test ()
 Test lock/unlock is IRQ safe. More...
 

Detailed Description

Tests to validate the proper implementation of the sleep manager.

To run the sleep manager hal tests use the command:

mbed test -t <toolchain> -m <target> -n tests-mbed_hal-sleep_manager*

Function Documentation

void sleep_manager_irq_test ( )

Test lock/unlock is IRQ safe.

Given a device with sleep mode support When the sleep manager API is used from IRQ and the main thread concurrently Then lock/unlock calls are IRQ safe

void sleep_manager_multithread_test ( )

Test lock/unlock is thread safe.

Given a device with sleep mode support When multiple threads are using the sleep manager API Then lock/unlock calls are thread safe

void test_lock_eq_ushrt_max ( )

Test lock USHRT_MAX times.

Given a device with sleep mode support When deep sleep mode is locked USHRT_MAX times Then the deep sleep mode is locked

When unlock is called repeatedly Then deep sleep mode stays locked until the number of unlock calls is equal to number of lock calls

void test_lock_unlock ( )

Test lock/unlock.

Given no prior calls to lock/unlock When the deep sleep status is checked Then the deep sleep is allowed

When the lock function is called Then the deep sleep is not allowed

When the unlock function is called Then the deep sleep is allowed again

void test_lock_unlock_test_check ( )

Test lock/unlock test_check fun.

Given the deep sleep has not been locked When the deep sleep status is checked Then sleep_manager_can_deep_sleep() returns true and sleep_manager_can_deep_sleep_test_check() returns true instantly.

When the deep sleep mode is locked Then sleep_manager_can_deep_sleep() returns false and sleep_manager_can_deep_sleep_test_check() returns false with 2 ms delay.

When the deep sleep mode is unlocked with a 1 ms delay Then sleep_manager_can_deep_sleep() returns false and sleep_manager_can_deep_sleep_test_check() returns true with 1 ms delay and sleep_manager_can_deep_sleep() returns true when checked again.

void test_sleep_auto ( )

Test sleep_auto calls sleep and deep sleep based on lock.

Given a device with sleep mode support When the deep sleep mode is locked Then sleep_auto uses sleep mode

When the deep sleep mode is unlocked Then sleep_auto uses deep sleep mode

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.