|
Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
|
Test cases to verify device objects. More...
Data Structures | |
| struct | init_record |
Functions | |
| void | test_dummy_device (void) |
| Test device object binding. | |
| void | test_dynamic_name (void) |
| Test device binding for existing device. | |
| void | test_bogus_dynamic_name (void) |
| Test device binding for non-existing device. | |
| void | test_null_dynamic_name (void) |
| Test device binding for passing null name. | |
| static __pinned_func int | add_init_record (bool pre_kernel) |
| static __pinned_func int | pre1_fn (void) |
| static __pinned_func int | pre2_fn (void) |
| static int | post_fn (void) |
| static int | app_fn (void) |
| SYS_INIT (pre1_fn, PRE_KERNEL_1, 0) | |
| SYS_INIT (pre2_fn, PRE_KERNEL_2, 0) | |
| SYS_INIT (post_fn, POST_KERNEL, 0) | |
| SYS_INIT (app_fn, APPLICATION, 0) | |
| static int | null_driver_init (void) |
| SYS_INIT (null_driver_init, POST_KERNEL, 0) | |
| void | test_pre_kernel_detection (void) |
| Test detection of initialization before kernel services available. | |
| void | test_device_list (void) |
| Test system device list query API. | |
| static int | init_fn (void) |
| SYS_INIT (init_fn, APPLICATION, 0) | |
| SYS_INIT_NAMED (init1, init_fn, APPLICATION, 1) | |
| SYS_INIT_NAMED (init2, init_fn, APPLICATION, 2) | |
| SYS_INIT_NAMED (init3, init_fn, APPLICATION, 2) | |
| SYS_INIT_NAMED (init4, init_fn, APPLICATION, 99) | |
| SYS_INIT_NAMED (init5, init_fn, APPLICATION, 999) | |
| void | test_sys_init_multiple (void) |
| void | test_device_init_level (void) |
| Test initialization level for device driver instances. | |
| void | test_device_init_priority (void) |
| Test initialization priorities for device driver instances. | |
| void | test_device_init_sub_priority (void) |
| Test initialization sub-priorities for device driver instances. | |
| void | test_abstraction_driver_common (void) |
| Test abstraction of device drivers with common functionalities. | |
| void | test_deferred_init (void) |
| void | test_device_api (void) |
| void | test_deferred_init_user (void) |
| void * | user_setup (void) |
| void | test_mmio_single (void) |
| Test DEVICE_MMIO_* macros. | |
| void | test_mmio_multiple (void) |
| Test DEVICE_MMIO_NAMED_* macros. | |
| void | test_mmio_toplevel (void) |
| Test DEVICE_MMIO_TOPLEVEL_* macros. | |
| void | test_mmio_multireg (void) |
| Test DEVICE_MMIO_NAMED_* macros. | |
Variables | |
| static __pinned_bss struct init_record | init_records [4] |
| static __pinned_data struct init_record * | rp = init_records |
| static int | sys_init_counter |
| int | init_level_sequence [4] |
| int | init_priority_sequence [4] |
| int | init_sub_priority_sequence [3] |
| unsigned int | seq_level_cnt |
| unsigned int | seq_priority_cnt |
Test cases to verify device objects.
Verify zephyr device driver apis with different device types
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| SYS_INIT | ( | app_fn | , |
| APPLICATION | , | ||
| 0 | ) |
| SYS_INIT | ( | init_fn | , |
| APPLICATION | , | ||
| 0 | ) |
| SYS_INIT | ( | null_driver_init | , |
| POST_KERNEL | , | ||
| 0 | ) |
| SYS_INIT | ( | post_fn | , |
| POST_KERNEL | , | ||
| 0 | ) |
| SYS_INIT | ( | pre1_fn | , |
| PRE_KERNEL_1 | , | ||
| 0 | ) |
| SYS_INIT | ( | pre2_fn | , |
| PRE_KERNEL_2 | , | ||
| 0 | ) |
| SYS_INIT_NAMED | ( | init1 | , |
| init_fn | , | ||
| APPLICATION | , | ||
| 1 | ) |
| SYS_INIT_NAMED | ( | init2 | , |
| init_fn | , | ||
| APPLICATION | , | ||
| 2 | ) |
| SYS_INIT_NAMED | ( | init3 | , |
| init_fn | , | ||
| APPLICATION | , | ||
| 2 | ) |
| SYS_INIT_NAMED | ( | init4 | , |
| init_fn | , | ||
| APPLICATION | , | ||
| 99 | ) |
| SYS_INIT_NAMED | ( | init5 | , |
| init_fn | , | ||
| APPLICATION | , | ||
| 999 | ) |
| void test_abstraction_driver_common | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/device/src/main.c>
Test abstraction of device drivers with common functionalities.
Abstraction of device drivers with common functionalities shall be provided as an intermediate interface between applications and device drivers, where such interface is implemented by individual device drivers. We verify this by following step:
| void test_bogus_dynamic_name | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/device/src/main.c>
Test device binding for non-existing device.
Validates binding of a random device driver(non-defined driver) named "ANOTHER_BOGUS_NAME".
| void test_deferred_init | ( | void | ) |
| void test_deferred_init_user | ( | void | ) |
| void test_device_api | ( | void | ) |
| void test_device_init_level | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/device/src/main.c>
Test initialization level for device driver instances.
After the defined device instances have initialized, we check the sequence number that each driver stored during initialization. If the sequence of initial level stored is corresponding with our expectation, it means assigning the level for driver instance works.
| void test_device_init_priority | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/device/src/main.c>
Test initialization priorities for device driver instances.
After the defined device instances have initialized, we check the sequence number that each driver stored during initialization. If the sequence of initial priority stored is corresponding with our expectation, it means assigning the priority for driver instance works.
| void test_device_init_sub_priority | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/device/src/main.c>
Test initialization sub-priorities for device driver instances.
After the defined device instances have initialized, we check the sequence number that each driver stored during initialization. If the sequence of initial priority stored is corresponding with our expectation, it means using the devicetree for sub-priority sorting works.
| void test_device_list | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/device/src/main.c>
Test system device list query API.
It queries the list of devices in the system, used to suspend or resume the devices in PM applications.
| void test_dummy_device | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/device/src/main.c>
Test device object binding.
Validates device binding for an existing and a non-existing device object. It creates a dummy_driver device object with basic init and configuration information and validates its binding.
Validates three kinds situations of driver object:
| void test_dynamic_name | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/device/src/main.c>
Test device binding for existing device.
Validates device binding for an existing device object.
| void test_mmio_multiple | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/device/src/mmio.c>
Test DEVICE_MMIO_NAMED_* macros.
We show that we can make mapping calls and that the address returned by DEVICE_MMIO_NAMED_GET() is not NULL, indicating that the kernel mapped stuff somewhere.
We show that this works for a device instance that has two named regions, 'corge' and 'grault' that respectively come from DTS instances 1 and 2.
We also perform some checks depending on configuration:
| void test_mmio_multireg | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/device/src/mmio_multireg.c>
Test DEVICE_MMIO_NAMED_* macros.
This is the same as the test_mmio_multiple test but in this test the memory regions are created by the named DT property 'reg'.
| void test_mmio_single | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/device/src/mmio.c>
Test DEVICE_MMIO_* macros.
We show that we can make mapping calls and that the address returned by DEVICE_MMIO_GET() is not NULL, indicating that the kernel mapped stuff somewhere.
We also perform some checks depending on configuration:
| void test_mmio_toplevel | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/device/src/mmio.c>
Test DEVICE_MMIO_TOPLEVEL_* macros.
We show that we can make mapping calls and that the address returned by DEVICE_MMIO_TOPLEVEL_GET() is not NULL, indicating that the kernel mapped stuff somewhere.
We do this for two different MMIO toplevel instances; one declared statically and one not.
We also perform some checks depending on configuration:
| void test_null_dynamic_name | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/device/src/main.c>
Test device binding for passing null name.
Validates device binding for device object when given dynamic name is null.
| void test_pre_kernel_detection | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/device/src/main.c>
Test detection of initialization before kernel services available.
Confirms check is correct.
| void test_sys_init_multiple | ( | void | ) |
| void * user_setup | ( | void | ) |
|
extern |
|
extern |
|
static |
|
extern |
|
static |
|
extern |
|
extern |
|
static |