Zephyr Project API 3.7.0
A Scalable Open Source RTOS
|
#include <stdlib.h>
#include <zephyr/ztest.h>
#include <zephyr/kernel_structs.h>
#include <zephyr/arch/cpu.h>
#include <zephyr/irq_offload.h>
#include <zephyr/sys_clock.h>
Data Structures | |
struct | ISR_INFO |
struct | timeout_order |
Macros | |
#define | THREAD_STACKSIZE (512 + CONFIG_TEST_EXTRA_STACK_SIZE) |
#define | THREAD_STACKSIZE2 (384 + CONFIG_TEST_EXTRA_STACK_SIZE) |
#define | THREAD_PRIORITY 4 |
#define | THREAD_SELF_CMD 0 |
#define | EXEC_CTX_TYPE_CMD 1 |
#define | UNKNOWN_COMMAND -1 |
#define | INVALID_BEHAVIOUR -2 |
#define | TICK_IRQ (z_sys_timer_irq_for_test) |
#define | HAS_POWERSAVE_INSTRUCTION |
#define | NUM_TIMEOUT_THREADS ARRAY_SIZE(timeouts) |
Typedefs | |
typedef int(* | disable_int_func) (int) |
typedef void(* | enable_int_func) (int) |
Functions | |
static | K_THREAD_STACK_DEFINE (thread_stack1,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) |
static | K_THREAD_STACK_DEFINE (thread_stack2,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) |
static | K_THREAD_STACK_DEFINE (thread_stack3,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) |
static void | isr_handler (const void *data) |
Handler to perform various actions from within an ISR context. | |
static void | isr_handler_trigger (void) |
static void | kernel_init_objects (void) |
Initialize kernel objects. | |
int | irq_lock_wrapper (int unused) |
A wrapper for irq_lock() | |
void | irq_unlock_wrapper (int imask) |
A wrapper for irq_unlock() | |
int | irq_disable_wrapper (int irq) |
A wrapper for irq_disable() | |
void | irq_enable_wrapper (int irq) |
A wrapper for irq_enable() | |
ZTEST (context_cpu_idle, test_cpu_idle_atomic) | |
Test cpu idle function. | |
ZTEST (context_cpu_idle, test_cpu_idle) | |
Test cpu idle function. | |
ZTEST (context, test_interrupts) | |
Test routines for disabling and enabling interrupts. | |
ZTEST (context_one_cpu, test_timer_interrupts) | |
Test routines for disabling and enabling interrupts (disable timer) | |
ZTEST (context, test_ctx_thread) | |
Test some context routines. | |
static void | thread_helper (void *arg1, void *arg2, void *arg3) |
Entry point to the thread's helper. | |
static void | k_yield_entry (void *arg0, void *arg1, void *arg2) |
Entry point to thread started by another thread. | |
static void | kernel_thread_entry (void *_thread_id, void *arg1, void *arg2) |
static | K_THREAD_STACK_ARRAY_DEFINE (timeout_stacks, ARRAY_SIZE(timeouts),(384+CONFIG_TEST_EXTRA_STACK_SIZE)) |
static void | busy_wait_thread (void *mseconds, void *arg2, void *arg3) |
static void | thread_sleep (void *delta, void *arg2, void *arg3) |
static void | delayed_thread (void *num, void *arg2, void *arg3) |
ZTEST (context_one_cpu, test_busy_wait) | |
Test timeouts. | |
ZTEST (context_one_cpu, test_k_sleep) | |
Test timeouts. | |
ZTEST (context_one_cpu, test_k_yield) | |
Test the k_yield() routine. | |
ZTEST (context_one_cpu, test_thread) | |
Test kernel thread creation. | |
static void * | context_setup (void) |
ZTEST_SUITE (context_cpu_idle, NULL, context_setup, NULL, NULL, NULL) | |
ZTEST_SUITE (context, NULL, context_setup, NULL, NULL, NULL) | |
ZTEST_SUITE (context_one_cpu, NULL, context_setup, ztest_simple_1cpu_before, ztest_simple_1cpu_after, NULL) | |
Variables | |
static struct k_sem | sem_thread |
static struct k_timer | timer |
static struct k_sem | reply_timeout |
struct k_fifo | timeout_order_fifo |
static int | thread_evidence |
static struct k_thread | thread_data1 |
static struct k_thread | thread_data2 |
static struct k_thread | thread_data3 |
static ISR_INFO | isr_info |
struct timeout_order | timeouts [] |
static struct k_thread | timeout_threads [ARRAY_SIZE(timeouts)] |
#define EXEC_CTX_TYPE_CMD 1 |
#define HAS_POWERSAVE_INSTRUCTION |
#define INVALID_BEHAVIOUR -2 |
#define NUM_TIMEOUT_THREADS ARRAY_SIZE(timeouts) |
#define THREAD_PRIORITY 4 |
#define THREAD_SELF_CMD 0 |
#define THREAD_STACKSIZE (512 + CONFIG_TEST_EXTRA_STACK_SIZE) |
#define THREAD_STACKSIZE2 (384 + CONFIG_TEST_EXTRA_STACK_SIZE) |
#define TICK_IRQ (z_sys_timer_irq_for_test) |
#define UNKNOWN_COMMAND -1 |
typedef int(* disable_int_func) (int) |
typedef void(* enable_int_func) (int) |
|
static |
|
static |
|
static |
int irq_disable_wrapper | ( | int | irq | ) |
A wrapper for irq_disable()
void irq_enable_wrapper | ( | int | irq | ) |
A wrapper for irq_enable()
int irq_lock_wrapper | ( | int | unused | ) |
A wrapper for irq_lock()
void irq_unlock_wrapper | ( | int | imask | ) |
A wrapper for irq_unlock()
|
static |
Handler to perform various actions from within an ISR context.
This routine is the ISR handler for isr_handler_trigger(). It performs the command requested in <isr_info.command>.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Entry point to thread started by another thread.
This routine is the entry point to the thread started by the thread.
|
static |
Initialize kernel objects.
This routine initializes the kernel objects used in this module's tests.
|
static |
|
static |
Entry point to the thread's helper.
This routine is the entry point to the thread's helper thread. It is used to help test the behavior of the k_yield() routine.
arg1 | unused |
arg2 | unused |
arg3 | unused |
|
static |
ZTEST | ( | context | , |
test_ctx_thread | |||
) |
Test some context routines.
Test Objective:
Testing techniques
Prerequisite Condition:
Input Specifications:
Test Procedure:
Expected Test Result:
Pass/Fail criteria:
Assumptions and Constraints
ZTEST | ( | context | , |
test_interrupts | |||
) |
Test routines for disabling and enabling interrupts.
Test Objective:
Testing techniques:
Prerequisite Conditions:
Input Specifications:
Test Procedure:
Expected Test Result:
Pass/Fail Criteria:
Assumptions and Constraints:
ZTEST | ( | context_cpu_idle | , |
test_cpu_idle | |||
) |
Test cpu idle function.
Test Objective:
Testing techniques
Prerequisite Condition:
Input Specifications:
Test Procedure:
Expected Test Result:
Pass/Fail criteria:
Assumptions and Constraints
ZTEST | ( | context_cpu_idle | , |
test_cpu_idle_atomic | |||
) |
Test cpu idle function.
Test Objective:
Testing techniques
Prerequisite Condition:
Input Specifications:
Test Procedure:
Expected Test Result:
Pass/Fail criteria:
Assumptions and Constraints
ZTEST | ( | context_one_cpu | , |
test_busy_wait | |||
) |
Test timeouts.
ZTEST | ( | context_one_cpu | , |
test_k_sleep | |||
) |
Test timeouts.
ZTEST | ( | context_one_cpu | , |
test_k_yield | |||
) |
Test the k_yield() routine.
Tests the k_yield() routine. It starts another thread (thus also testing k_thread_create()) and checks that behavior of k_yield() against the a higher priority thread, a lower priority thread, and another thread of equal priority.
ZTEST | ( | context_one_cpu | , |
test_thread | |||
) |
Test kernel thread creation.
ZTEST | ( | context_one_cpu | , |
test_timer_interrupts | |||
) |
Test routines for disabling and enabling interrupts (disable timer)
Test Objective:
Testing techniques:
Prerequisite Conditions:
Input Specifications:
Test Procedure:
Expected Test Result:
Pass/Fail Criteria:
Assumptions and Constraints:
ZTEST_SUITE | ( | context | , |
NULL | , | ||
context_setup | , | ||
NULL | , | ||
NULL | , | ||
NULL | |||
) |
ZTEST_SUITE | ( | context_cpu_idle | , |
NULL | , | ||
context_setup | , | ||
NULL | , | ||
NULL | , | ||
NULL | |||
) |
ZTEST_SUITE | ( | context_one_cpu | , |
NULL | , | ||
context_setup | , | ||
ztest_simple_1cpu_before | , | ||
ztest_simple_1cpu_after | , | ||
NULL | |||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
struct k_fifo timeout_order_fifo |
|
static |
struct timeout_order timeouts[] |
|
static |