Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
test_poll.c File Reference
#include <ztest.h>
#include <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_STACKSIZE)
 
#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_STACKSIZE))
 
 K_THREAD_STACK_DEFINE (test_loprio_stack,(1024+CONFIG_TEST_EXTRA_STACKSIZE))
 
void test_poll_no_wait (void)
 Test poll events with no wait. More...
 
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)
 
void test_poll_wait (void)
 Test polling with wait. More...
 
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. More...
 
void test_poll_cancel_main_low_prio (void)
 
void test_poll_cancel_main_high_prio (void)
 
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)
 
void test_poll_multi (void)
 Test polling of multiple events. More...
 
static void threadstate (void *p1, void *p2, void *p3)
 
void test_poll_threadstate (void)
 Test polling of events by manipulating polling thread state. More...
 
void test_poll_grant_access (void)
 
void test_poll_zero_events (void)
 
void polling_event (void *p1, void *p2, void *p3)
 
void test_detect_is_polling (void)
 Detect is_polling is false in signal_poll_event() More...
 

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_STACKSIZE)

◆ 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_STACKSIZE)   
)

◆ K_THREAD_STACK_DEFINE() [2/2]

K_THREAD_STACK_DEFINE ( test_stack  ,
(1024+CONFIG_TEST_EXTRA_STACKSIZE)   
)

◆ 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_wait_helper()

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

◆ polling_event()

void polling_event ( void p1,
void p2,
void p3 
)

◆ test_poll_cancel_main_high_prio()

void test_poll_cancel_main_high_prio ( void  )

◆ test_poll_cancel_main_low_prio()

void test_poll_cancel_main_low_prio ( void  )

◆ test_poll_grant_access()

void test_poll_grant_access ( void  )

◆ test_poll_zero_events()

void test_poll_zero_events ( void  )

◆ threadstate()

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

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:5382
#define K_POLL_TYPE_SIGNAL
Definition: kernel.h:5381
#define K_POLL_TYPE_FIFO_DATA_AVAILABLE
Definition: kernel.h:5384
#define K_POLL_EVENT_INITIALIZER(_event_type, _event_mode, _event_obj)
Definition: kernel.h:5462
#define K_POLL_TYPE_MSGQ_DATA_AVAILABLE
Definition: kernel.h:5385
#define K_POLL_EVENT_STATIC_INITIALIZER(_event_type, _event_mode, _event_obj, event_tag)
Definition: kernel.h:5474
#define K_POLL_TYPE_IGNORE
Definition: kernel.h:5380
@ K_POLL_MODE_NOTIFY_ONLY
Definition: kernel.h:5390
static struct k_poll_signal wait_signal
Definition: test_poll.c:183
static struct k_msgq wait_msgq
Definition: test_poll.c:178

◆ 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:5419

◆ zero_events_sem

struct k_sem zero_events_sem
static