Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
main.c File Reference
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/init.h>
#include <zephyr/ztest.h>
#include <zephyr/sys/printk.h>
#include <zephyr/linker/sections.h>
#include "abstract_driver.h"

Data Structures

struct  init_record
 

Macros

#define DUMMY_PORT_1   "dummy"
 
#define DUMMY_PORT_2   "dummy_driver"
 
#define DUMMY_NOINIT   "dummy_noinit"
 
#define BAD_DRIVER   "bad_driver"
 
#define MY_DRIVER_A   "my_driver_A"
 
#define MY_DRIVER_B   "my_driver_B"
 
#define FAKEDEFERDRIVER0   DEVICE_DT_GET(DT_PATH(fakedeferdriver_e7000000))
 
#define FAKEDEFERDRIVER1   DEVICE_DT_GET(DT_PATH(fakedeferdriver_e8000000))
 

Functions

 DEVICE_DT_DEFINE (DT_INST(0, fakedeferdriver), NULL, NULL, NULL, NULL, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL)
 
 DEVICE_DT_DEFINE (DT_INST(1, fakedeferdriver), NULL, NULL, NULL, NULL, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &fakedeferdriverapi)
 
 ZTEST (device, test_dummy_device)
 Test device object binding.
 
 ZTEST_USER (device, test_dynamic_name)
 Test device binding for existing device.
 
 ZTEST_USER (device, test_bogus_dynamic_name)
 Test device binding for non-existing device.
 
 ZTEST_USER (device, test_null_dynamic_name)
 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)
 
 ZTEST (device, test_pre_kernel_detection)
 Test detection of initialization before kernel services available.
 
 ZTEST (device, test_device_list)
 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)
 
 ZTEST (device, test_sys_init_multiple)
 
 ZTEST (device, test_device_init_level)
 Test initialization level for device driver instances.
 
 ZTEST (device, test_device_init_priority)
 Test initialization priorities for device driver instances.
 
 ZTEST (device, test_device_init_sub_priority)
 Test initialization sub-priorities for device driver instances.
 
 ZTEST (device, test_abstraction_driver_common)
 Test abstraction of device drivers with common functionalities.
 
 ZTEST (device, test_deferred_init)
 
 ZTEST_USER (device, test_deferred_init_user)
 
void * user_setup (void)
 
 ZTEST_SUITE (device, NULL, user_setup, NULL, NULL, NULL)
 

Variables

static const struct gpio_driver_api fakedeferdriverapi
 
static __pinned_bss struct init_record init_records [4]
 
static __pinned_data struct init_recordrp = 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
 

Macro Definition Documentation

◆ BAD_DRIVER

#define BAD_DRIVER   "bad_driver"

◆ DUMMY_NOINIT

#define DUMMY_NOINIT   "dummy_noinit"

◆ DUMMY_PORT_1

#define DUMMY_PORT_1   "dummy"

◆ DUMMY_PORT_2

#define DUMMY_PORT_2   "dummy_driver"

◆ FAKEDEFERDRIVER0

#define FAKEDEFERDRIVER0   DEVICE_DT_GET(DT_PATH(fakedeferdriver_e7000000))

◆ FAKEDEFERDRIVER1

#define FAKEDEFERDRIVER1   DEVICE_DT_GET(DT_PATH(fakedeferdriver_e8000000))

◆ MY_DRIVER_A

#define MY_DRIVER_A   "my_driver_A"

◆ MY_DRIVER_B

#define MY_DRIVER_B   "my_driver_B"

Function Documentation

◆ DEVICE_DT_DEFINE() [1/2]

DEVICE_DT_DEFINE ( DT_INST(0, fakedeferdriver)  ,
NULL  ,
NULL  ,
NULL  ,
NULL  ,
POST_KERNEL  ,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT  ,
NULL   
)

◆ DEVICE_DT_DEFINE() [2/2]

DEVICE_DT_DEFINE ( DT_INST(1, fakedeferdriver)  ,
NULL  ,
NULL  ,
NULL  ,
NULL  ,
POST_KERNEL  ,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT  ,
fakedeferdriverapi 
)

◆ ZTEST_SUITE()

ZTEST_SUITE ( device  ,
NULL  ,
user_setup  ,
NULL  ,
NULL  ,
NULL   
)

Variable Documentation

◆ fakedeferdriverapi

const struct gpio_driver_api fakedeferdriverapi
static