zephyr/tests/kernel/common/src/boot_delay.c
Ioannis Glaropoulos 6a3d460916 tests: kernel: common: re-enabled test-cases for Qemu Cortex-M0
After the Qemu Cortex-M0 timer driver rework, we may
re-enable the test-cases that had been skipped for this
platform.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-06-24 18:04:17 -07:00

35 lines
716 B
C

/*
* Copyright (c) 2018 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <ztest.h>
#define NSEC_PER_MSEC (uint64_t)(NSEC_PER_USEC * USEC_PER_MSEC)
/**
* @brief Test delay during boot
* @defgroup kernel_init_tests Init
* @ingroup all_tests
* @{
*/
/**
* @brief This module verifies the delay specified during boot.
*/
void test_bootdelay(void)
{
uint32_t current_cycles = k_cycle_get_32();
/* compare this with the boot delay specified */
zassert_true(k_cyc_to_ns_floor64(current_cycles) >=
(NSEC_PER_MSEC * CONFIG_BOOT_DELAY),
"boot delay not executed: %d < %d",
(uint32_t)k_cyc_to_ns_floor64(current_cycles),
(NSEC_PER_MSEC * CONFIG_BOOT_DELAY));
}
/**
* @}
*/