Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
arm_interrupt.c File Reference
#include <zephyr/ztest.h>
#include <zephyr/arch/cpu.h>
#include <cmsis_core.h>
#include <zephyr/sys/barrier.h>
#include <zephyr/internal/syscall_handler.h>
#include "test_syscalls.h"
#include <zephyr/syscalls/test_arm_user_interrupt_syscall_mrsh.c>

Macros

#define MAIN_PRIORITY   7
 
#define PRIORITY   5
 

Functions

static K_THREAD_STACK_DEFINE (esf_collection_stack, 2048)
 
static int check_esf_matches_expectations (const struct arch_esf *pEsf)
 Validates that pEsf matches state from set_regs_with_known_pattern()
 
void k_sys_fatal_error_handler (unsigned int reason, const struct arch_esf *pEsf)
 Fatal error policy handler.
 
void set_regs_with_known_pattern (void *p1, void *p2, void *p3)
 Set ARM registers with a known pattern: r0-r12 are set to 0...12, respectively r13 (sp) is left untouched r14 (pc) will point to the faulting instruction (udf #90) r15 (lr) is set to 15 (since a fault takes place, we never use the value)
 
void test_arm_esf_collection (void)
 Test to verify code fault handling in ISR execution context.
 
void arm_isr_handler (const void *args)
 
void test_arm_interrupt (void)
 Test ARM Interrupt handling.
 
void test_arm_user_interrupt (void)
 Test ARM Interrupt handling in user mode.
 
void test_arm_null_pointer_exception (void)
 Test ARM Null Pointer Exception handling.
 

Variables

static volatile int test_flag
 
static volatile int expected_reason = -1
 
static volatile int run_esf_validation
 
static volatile int esf_validation_rv
 
static volatile uint32_t expected_msp
 
static struct k_thread esf_collection_thread
 

Macro Definition Documentation

◆ MAIN_PRIORITY

#define MAIN_PRIORITY   7

◆ PRIORITY

#define PRIORITY   5

Function Documentation

◆ arm_isr_handler()

void arm_isr_handler ( const void * args)

◆ check_esf_matches_expectations()

static int check_esf_matches_expectations ( const struct arch_esf * pEsf)
static

Validates that pEsf matches state from set_regs_with_known_pattern()

◆ K_THREAD_STACK_DEFINE()

static K_THREAD_STACK_DEFINE ( esf_collection_stack ,
2048  )
static

◆ set_regs_with_known_pattern()

void set_regs_with_known_pattern ( void * p1,
void * p2,
void * p3 )

Set ARM registers with a known pattern: r0-r12 are set to 0...12, respectively r13 (sp) is left untouched r14 (pc) will point to the faulting instruction (udf #90) r15 (lr) is set to 15 (since a fault takes place, we never use the value)

Note: Routine was written to be ARMV6M compatible

In k_sys_fatal_error_handler above we will check that the ESF provided as a parameter matches these expectations.

◆ test_arm_interrupt()

void test_arm_interrupt ( void )

Test ARM Interrupt handling.

◆ test_arm_user_interrupt()

void test_arm_user_interrupt ( void )

Test ARM Interrupt handling in user mode.

Variable Documentation

◆ esf_collection_thread

struct k_thread esf_collection_thread
static

◆ esf_validation_rv

volatile int esf_validation_rv
static

◆ expected_msp

volatile uint32_t expected_msp
static

◆ expected_reason

volatile int expected_reason = -1
static

◆ run_esf_validation

volatile int run_esf_validation
static

◆ test_flag

volatile int test_flag
static