mirror of https://github.com/ARMmbed/mbed-os.git
enable common tickers & lp_tickers hal tests in baremetal mode
parent
a252b073cf
commit
3d74526fa9
|
@ -15,10 +15,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if !defined(MBED_CONF_RTOS_PRESENT)
|
||||
#error [NOT_SUPPORTED] usticker test cases require a RTOS to run
|
||||
#else
|
||||
|
||||
#include "mbed.h"
|
||||
#include "greentea-client/test_env.h"
|
||||
#include "unity.h"
|
||||
|
@ -28,6 +24,7 @@
|
|||
#include "hal/lp_ticker_api.h"
|
||||
#include "hal/mbed_lp_ticker_wrapper.h"
|
||||
|
||||
#ifdef MBED_CONF_RTOS_PRESENT
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -35,6 +32,7 @@ extern "C" {
|
|||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
#endif
|
||||
|
||||
#if !DEVICE_USTICKER
|
||||
#error [NOT_SUPPORTED] test not supported
|
||||
|
@ -520,9 +518,11 @@ utest::v1::status_t us_ticker_setup(const Case *const source, const size_t index
|
|||
{
|
||||
intf = get_us_ticker_data()->interface;
|
||||
|
||||
#ifdef MBED_CONF_RTOS_PRESENT
|
||||
/* OS, common ticker and low power ticker wrapper
|
||||
* may make use of us ticker so suspend them for this test */
|
||||
osKernelSuspend();
|
||||
#endif
|
||||
#if DEVICE_LPTICKER && (LPTICKER_DELAY_TICKS > 0)
|
||||
/* Suspend the lp ticker wrapper since it makes use of the us ticker */
|
||||
ticker_suspend(get_lp_ticker_data());
|
||||
|
@ -552,7 +552,9 @@ utest::v1::status_t us_ticker_teardown(const Case *const source, const size_t pa
|
|||
lp_ticker_wrapper_resume();
|
||||
ticker_resume(get_lp_ticker_data());
|
||||
#endif
|
||||
#ifdef MBED_CONF_RTOS_PRESENT
|
||||
osKernelResume(0);
|
||||
#endif
|
||||
|
||||
return greentea_case_teardown_handler(source, passed, failed, reason);
|
||||
}
|
||||
|
@ -562,8 +564,10 @@ utest::v1::status_t lp_ticker_setup(const Case *const source, const size_t index
|
|||
{
|
||||
intf = get_lp_ticker_data()->interface;
|
||||
|
||||
#ifdef MBED_CONF_RTOS_PRESENT
|
||||
/* OS and common ticker may make use of lp ticker so suspend them for this test */
|
||||
osKernelSuspend();
|
||||
#endif
|
||||
ticker_suspend(get_lp_ticker_data());
|
||||
|
||||
intf->init();
|
||||
|
@ -584,7 +588,9 @@ utest::v1::status_t lp_ticker_teardown(const Case *const source, const size_t pa
|
|||
prev_irq_handler = NULL;
|
||||
|
||||
ticker_resume(get_lp_ticker_data());
|
||||
#ifdef MBED_CONF_RTOS_PRESENT
|
||||
osKernelResume(0);
|
||||
#endif
|
||||
|
||||
return greentea_case_teardown_handler(source, passed, failed, reason);
|
||||
}
|
||||
|
@ -626,4 +632,3 @@ int main()
|
|||
return !Harness::run(specification);
|
||||
}
|
||||
#endif // !DEVICE_USTICKER
|
||||
#endif // !defined(MBED_CONF_RTOS_PRESENT)
|
||||
|
|
|
@ -20,10 +20,6 @@
|
|||
* freqency is valid.
|
||||
*/
|
||||
|
||||
#if !defined(MBED_CONF_RTOS_PRESENT)
|
||||
#error [NOT_SUPPORTED] common tickers frequency test cases require a RTOS to run.
|
||||
#else
|
||||
|
||||
#include "mbed.h"
|
||||
#include "greentea-client/test_env.h"
|
||||
#include "utest/utest.h"
|
||||
|
@ -187,8 +183,10 @@ Case cases[] = {
|
|||
|
||||
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
|
||||
{
|
||||
#ifdef MBED_CONF_RTOS_PRESENT
|
||||
/* Suspend RTOS Kernel so the timers are not in use. */
|
||||
osKernelSuspend();
|
||||
#endif
|
||||
|
||||
GREENTEA_SETUP(120, "timing_drift_auto");
|
||||
return greentea_test_setup_handler(number_of_cases);
|
||||
|
@ -196,7 +194,9 @@ utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
|
|||
|
||||
void greentea_test_teardown(const size_t passed, const size_t failed, const failure_t failure)
|
||||
{
|
||||
#ifdef MBED_CONF_RTOS_PRESENT
|
||||
osKernelResume(0);
|
||||
#endif
|
||||
|
||||
greentea_test_teardown_handler(passed, failed, failure);
|
||||
}
|
||||
|
@ -209,4 +209,3 @@ int main()
|
|||
}
|
||||
|
||||
#endif // defined(SKIP_TIME_DRIFT_TESTS) || !DEVICE_USTICKER
|
||||
#endif // !defined(MBED_CONF_RTOS_PRESENT)
|
||||
|
|
|
@ -15,10 +15,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if !defined(MBED_CONF_RTOS_PRESENT)
|
||||
#error [NOT_SUPPORTED] Low power timer test cases require a RTOS to run.
|
||||
#else
|
||||
|
||||
#include "mbed.h"
|
||||
#include "greentea-client/test_env.h"
|
||||
#include "unity.h"
|
||||
|
@ -167,8 +163,10 @@ void lp_ticker_glitch_test()
|
|||
#if DEVICE_LPTICKER
|
||||
utest::v1::status_t lp_ticker_deepsleep_test_setup_handler(const Case *const source, const size_t index_of_case)
|
||||
{
|
||||
#ifdef MBED_CONF_RTOS_PRESENT
|
||||
/* disable everything using the lp ticker for this test */
|
||||
osKernelSuspend();
|
||||
#endif
|
||||
ticker_suspend(get_lp_ticker_data());
|
||||
#if DEVICE_LPTICKER && (LPTICKER_DELAY_TICKS > 0)
|
||||
lp_ticker_wrapper_suspend();
|
||||
|
@ -185,7 +183,9 @@ utest::v1::status_t lp_ticker_deepsleep_test_teardown_handler(const Case *const
|
|||
lp_ticker_wrapper_resume();
|
||||
#endif
|
||||
ticker_resume(get_lp_ticker_data());
|
||||
#ifdef MBED_CONF_RTOS_PRESENT
|
||||
osKernelResume(0);
|
||||
#endif
|
||||
return greentea_case_teardown_handler(source, passed, failed, reason);
|
||||
}
|
||||
#endif
|
||||
|
@ -212,4 +212,3 @@ int main()
|
|||
}
|
||||
|
||||
#endif // !DEVICE_LPTICKER
|
||||
#endif // !defined(MBED_CONF_RTOS_PRESENT)
|
||||
|
|
|
@ -15,10 +15,6 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#if !defined(MBED_CONF_RTOS_PRESENT)
|
||||
#error [NOT_SUPPORTED] stack size unification test cases require a RTOS to run.
|
||||
#else
|
||||
|
||||
#include "mbed.h"
|
||||
#include "greentea-client/test_env.h"
|
||||
#include "unity.h"
|
||||
|
@ -30,12 +26,16 @@
|
|||
|
||||
using namespace utest::v1;
|
||||
|
||||
#ifdef MBED_CONF_RTOS_PRESENT
|
||||
extern osThreadAttr_t _main_thread_attr;
|
||||
#endif
|
||||
extern uint32_t mbed_stack_isr_size;
|
||||
|
||||
/* Exception for Nordic boards - BLE requires 2KB ISR stack. */
|
||||
#if defined(TARGET_NRF5x)
|
||||
#define EXPECTED_ISR_STACK_SIZE (2048)
|
||||
#elif !defined(MBED_CONF_RTOS_PRESENT)
|
||||
#define EXPECTED_ISR_STACK_SIZE (4096)
|
||||
#else
|
||||
#define EXPECTED_ISR_STACK_SIZE (1024)
|
||||
#endif
|
||||
|
@ -58,8 +58,10 @@ extern uint32_t mbed_stack_isr_size;
|
|||
void stack_size_unification_test()
|
||||
{
|
||||
TEST_ASSERT_EQUAL(EXPECTED_ISR_STACK_SIZE, mbed_stack_isr_size);
|
||||
#ifdef MBED_CONF_RTOS_PRESENT
|
||||
TEST_ASSERT_EQUAL(EXPECTED_MAIN_THREAD_STACK_SIZE, _main_thread_attr.stack_size);
|
||||
TEST_ASSERT_EQUAL(EXPECTED_USER_THREAD_DEFAULT_STACK_SIZE, OS_STACK_SIZE);
|
||||
#endif
|
||||
}
|
||||
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||
|
@ -80,4 +82,3 @@ int main()
|
|||
}
|
||||
|
||||
#endif // TARGET_RENESAS
|
||||
#endif // !defined(MBED_CONF_RTOS_PRESENT)
|
||||
|
|
Loading…
Reference in New Issue