Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
test_poll.c File Reference
#include <zephyr/ztest.h>
#include <zephyr/kernel.h>

Data Structures

struct  fifo_msg
 

Macros

#define SIGNAL_RESULT   0x1ee7d00d
 
#define FIFO_MSG_VALUE   0xdeadbeef
 
#define MSGQ_MSG_SIZE   4
 
#define MSGQ_MAX_MSGS   16
 
#define MSGQ_MSG_VALUE   {'a', 'b', 'c', 'd'}
 
#define STACK_SIZE   (1024 + CONFIG_TEST_EXTRA_STACK_SIZE)
 
#define TAG_0   10
 
#define TAG_1   11
 
#define TAG_2   12
 
#define TAG_3   13
 
#define USE_FIFO   (1 << 0)
 
#define USE_MSGQ   (1 << 1)
 

Functions

 K_THREAD_STACK_DEFINE (test_stack,(1024+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_THREAD_STACK_DEFINE (test_loprio_stack,(1024+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 ZTEST_USER (poll_api_1cpu, test_poll_no_wait)
 Test poll events with no wait.
 
static K_SEM_DEFINE (wait_sem, 0, 1)
 
static K_FIFO_DEFINE (wait_fifo)
 
static void poll_wait_helper (void *use_queuelike, void *msgq, void *p3)
 
void check_results (struct k_poll_event *events, uint32_t event_type, bool is_available)
 
 ZTEST (poll_api_1cpu, test_poll_wait)
 Test polling with wait.
 
static void poll_cancel_helper (void *p1, void *p2, void *p3)
 
void test_poll_cancel (bool is_main_low_prio)
 Test polling of cancelled fifo.
 
 ZTEST (poll_api_1cpu, test_poll_cancel_main_low_prio)
 
 ZTEST (poll_api_1cpu, test_poll_cancel_main_high_prio)
 
static K_SEM_DEFINE (multi_sem, 0, 1)
 
static void multi_lowprio (void *p1, void *p2, void *p3)
 
static K_SEM_DEFINE (multi_reply, 0, 1)
 
static void multi (void *p1, void *p2, void *p3)
 
static K_SEM_DEFINE (multi_ready_sem, 1, 1)
 
 ZTEST (poll_api, test_poll_multi)
 Test polling of multiple events.
 
static void threadstate (void *p1, void *p2, void *p3)
 
 ZTEST (poll_api_1cpu, test_poll_threadstate)
 Test polling of events by manipulating polling thread state.
 
void poll_test_grant_access (void)
 
 ZTEST (poll_api_1cpu, test_poll_zero_events)
 

Variables

static struct k_sem no_wait_sem
 
static struct k_fifo no_wait_fifo
 
static struct k_poll_signal no_wait_signal
 
static struct k_poll_signal test_signal
 
static struct k_sem zero_events_sem
 
static struct k_thread test_thread
 
static struct k_thread test_loprio_thread
 
static struct k_msgq wait_msgq
 
static struct k_msgqwait_msgq_ptr
 
static struct k_poll_signal wait_signal
 
struct fifo_msg wait_msg = { NULL, 0xdeadbeef }
 
struct k_poll_event wait_events []
 
static struct k_fifo cancel_fifo
 
static struct k_fifo non_cancel_fifo
 
static struct k_poll_signal signal
 

Macro Definition Documentation

◆ FIFO_MSG_VALUE

#define FIFO_MSG_VALUE   0xdeadbeef

◆ MSGQ_MAX_MSGS

#define MSGQ_MAX_MSGS   16

◆ MSGQ_MSG_SIZE

#define MSGQ_MSG_SIZE   4

◆ MSGQ_MSG_VALUE

#define MSGQ_MSG_VALUE   {'a', 'b', 'c', 'd'}

◆ SIGNAL_RESULT

#define SIGNAL_RESULT   0x1ee7d00d

◆ STACK_SIZE

#define STACK_SIZE   (1024 + CONFIG_TEST_EXTRA_STACK_SIZE)

◆ TAG_0

#define TAG_0   10

◆ TAG_1

#define TAG_1   11

◆ TAG_2

#define TAG_2   12

◆ TAG_3

#define TAG_3   13

◆ USE_FIFO

#define USE_FIFO   (1 << 0)

◆ USE_MSGQ

#define USE_MSGQ   (1 << 1)

Function Documentation

◆ check_results()

void check_results ( struct k_poll_event events,
uint32_t  event_type,
bool  is_available 
)

◆ K_FIFO_DEFINE()

static K_FIFO_DEFINE ( wait_fifo  )
static

◆ K_SEM_DEFINE() [1/4]

static K_SEM_DEFINE ( multi_ready_sem  ,
,
 
)
static

◆ K_SEM_DEFINE() [2/4]

static K_SEM_DEFINE ( multi_reply  ,
,
 
)
static

◆ K_SEM_DEFINE() [3/4]

static K_SEM_DEFINE ( multi_sem  ,
,
 
)
static

◆ K_SEM_DEFINE() [4/4]

static K_SEM_DEFINE ( wait_sem  ,
,
 
)
static

◆ K_THREAD_STACK_DEFINE() [1/2]

K_THREAD_STACK_DEFINE ( test_loprio_stack  ,
(1024+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_THREAD_STACK_DEFINE() [2/2]

K_THREAD_STACK_DEFINE ( test_stack  ,
(1024+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ multi()

static void multi ( void *  p1,
void *  p2,
void *  p3 
)
static

◆ multi_lowprio()

static void multi_lowprio ( void *  p1,
void *  p2,
void *  p3 
)
static

◆ poll_cancel_helper()

static void poll_cancel_helper ( void *  p1,
void *  p2,
void *  p3 
)
static

◆ poll_test_grant_access()

void poll_test_grant_access ( void  )

◆ poll_wait_helper()

static void poll_wait_helper ( void *  use_queuelike,
void *  msgq,
void *  p3 
)
static

◆ threadstate()

static void threadstate ( void *  p1,
void *  p2,
void *  p3 
)
static

◆ ZTEST() [1/3]

ZTEST ( poll_api_1cpu  ,
test_poll_cancel_main_high_prio   
)

◆ ZTEST() [2/3]

ZTEST ( poll_api_1cpu  ,
test_poll_cancel_main_low_prio   
)

◆ ZTEST() [3/3]

ZTEST ( poll_api_1cpu  ,
test_poll_zero_events   
)

Variable Documentation

◆ cancel_fifo

struct k_fifo cancel_fifo
static

◆ no_wait_fifo

struct k_fifo no_wait_fifo
static

◆ no_wait_sem

struct k_sem no_wait_sem
static

◆ no_wait_signal

struct k_poll_signal no_wait_signal
static

◆ non_cancel_fifo

struct k_fifo non_cancel_fifo
static

◆ signal

struct k_poll_signal signal
static

◆ test_loprio_thread

struct k_thread test_loprio_thread
static

◆ test_signal

struct k_poll_signal test_signal
static

◆ test_thread

struct k_thread test_thread
static

◆ wait_events

struct k_poll_event wait_events[]
Initial value:
= {
&wait_sem, 10 ),
&wait_fifo, 11 ),
&wait_signal, 12 ),
NULL),
&wait_msgq, 13 ),
}
#define K_POLL_TYPE_SEM_AVAILABLE
Definition kernel.h:5666
#define K_POLL_TYPE_SIGNAL
Definition kernel.h:5665
#define K_POLL_TYPE_FIFO_DATA_AVAILABLE
Definition kernel.h:5668
#define K_POLL_EVENT_INITIALIZER(_event_type, _event_mode, _event_obj)
Definition kernel.h:5754
#define K_POLL_TYPE_MSGQ_DATA_AVAILABLE
Definition kernel.h:5669
#define K_POLL_EVENT_STATIC_INITIALIZER(_event_type, _event_mode, _event_obj, event_tag)
Definition kernel.h:5766
#define K_POLL_TYPE_IGNORE
Definition kernel.h:5664
@ K_POLL_MODE_NOTIFY_ONLY
Definition kernel.h:5675
static struct k_poll_signal wait_signal
Definition test_poll.c:186
static struct k_msgq wait_msgq
Definition test_poll.c:181

◆ wait_msg

struct fifo_msg wait_msg = { NULL, 0xdeadbeef }

◆ wait_msgq

struct k_msgq wait_msgq
static

◆ wait_msgq_ptr

struct k_msgq* wait_msgq_ptr
static

◆ wait_signal

struct k_poll_signal wait_signal
static
Initial value:
=
#define K_POLL_SIGNAL_INITIALIZER(obj)
Definition kernel.h:5705

◆ zero_events_sem

struct k_sem zero_events_sem
static