Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
|
#include <zephyr/toolchain.h>
#include <stddef.h>
#include <zephyr/types.h>
#include <zephyr/arch/cpu.h>
#include <zephyr/irq_offload.h>
#include <zephyr/arch/syscall.h>
#include <zephyr/timing/types.h>
#include <zephyr/arch/arch_inlines.h>
Go to the source code of this file.
Typedefs | |
typedef struct z_thread_stack_element | k_thread_stack_t |
Typedef of struct z_thread_stack_element. | |
typedef void(* | k_thread_entry_t) (void *p1, void *p2, void *p3) |
Thread entry point function type. | |
typedef void(* | arch_cpustart_t) (void *data) |
Per-cpu entry function. | |
typedef bool(* | stack_trace_callback_fn) (void *cookie, unsigned long addr) |
stack_trace_callback_fn - Callback for arch_stack_walk | |
Functions | |
static uint32_t | arch_k_cycle_get_32 (void) |
Obtain the current cycle count, in units specified by CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC. | |
static uint64_t | arch_k_cycle_get_64 (void) |
As for arch_k_cycle_get_32(), but with a 64 bit return value. | |
void | arch_cpu_idle (void) |
Power save idle routine. | |
void | arch_cpu_atomic_idle (unsigned int key) |
Atomically re-enable interrupts and enter low power mode. | |
void | arch_cpu_start (int cpu_num, k_thread_stack_t *stack, int sz, arch_cpustart_t fn, void *arg) |
Start a numbered CPU on a MP-capable system. | |
bool | arch_cpu_active (int cpu_num) |
Return CPU power status. | |
static unsigned int | arch_irq_lock (void) |
Lock interrupts on the current CPU. | |
static void | arch_irq_unlock (unsigned int key) |
Unlock interrupts on the current CPU. | |
static bool | arch_irq_unlocked (unsigned int key) |
Test if calling arch_irq_unlock() with this key would unlock irqs. | |
void | arch_irq_disable (unsigned int irq) |
Disable the specified interrupt line. | |
void | arch_irq_enable (unsigned int irq) |
Enable the specified interrupt line. | |
int | arch_irq_is_enabled (unsigned int irq) |
Test if an interrupt line is enabled. | |
int | arch_irq_connect_dynamic (unsigned int irq, unsigned int priority, void(*routine)(const void *parameter), const void *parameter, uint32_t flags) |
Arch-specific hook to install a dynamic interrupt. | |
int | arch_irq_disconnect_dynamic (unsigned int irq, unsigned int priority, void(*routine)(const void *parameter), const void *parameter, uint32_t flags) |
Arch-specific hook to dynamically uninstall a shared interrupt. | |
unsigned int | arch_irq_allocate (void) |
Arch-specific hook for allocating IRQs. | |
void | arch_irq_set_used (unsigned int irq) |
Arch-specific hook for declaring an IRQ being used. | |
bool | arch_irq_is_used (unsigned int irq) |
Arch-specific hook for checking if an IRQ is being used already. | |
static struct _cpu * | arch_curr_cpu (void) |
Return the CPU struct for the currently executing CPU. | |
static uint32_t | arch_proc_id (void) |
Processor hardware ID. | |
void | arch_sched_broadcast_ipi (void) |
Broadcast an interrupt to all CPUs. | |
void | arch_sched_directed_ipi (uint32_t cpu_bitmap) |
Direct IPIs to the specified CPUs. | |
int | arch_smp_init (void) |
static unsigned int | arch_num_cpus (void) |
Returns the number of CPUs. | |
static uintptr_t | arch_syscall_invoke0 (uintptr_t call_id) |
Invoke a system call with 0 arguments. | |
static uintptr_t | arch_syscall_invoke1 (uintptr_t arg1, uintptr_t call_id) |
Invoke a system call with 1 argument. | |
static uintptr_t | arch_syscall_invoke2 (uintptr_t arg1, uintptr_t arg2, uintptr_t call_id) |
Invoke a system call with 2 arguments. | |
static uintptr_t | arch_syscall_invoke3 (uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t call_id) |
Invoke a system call with 3 arguments. | |
static uintptr_t | arch_syscall_invoke4 (uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t call_id) |
Invoke a system call with 4 arguments. | |
static uintptr_t | arch_syscall_invoke5 (uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5, uintptr_t call_id) |
Invoke a system call with 5 arguments. | |
static uintptr_t | arch_syscall_invoke6 (uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5, uintptr_t arg6, uintptr_t call_id) |
Invoke a system call with 6 arguments. | |
static bool | arch_is_user_context (void) |
Indicate whether we are currently running in user mode. | |
int | arch_mem_domain_max_partitions_get (void) |
Get the maximum number of partitions for a memory domain. | |
int | arch_buffer_validate (const void *addr, size_t size, int write) |
Check memory region permissions. | |
size_t | arch_virt_region_align (uintptr_t phys, size_t size) |
Get the optimal virtual region alignment to optimize the MMU table layout. | |
FUNC_NORETURN void | arch_user_mode_enter (k_thread_entry_t user_entry, void *p1, void *p2, void *p3) |
Perform a one-way transition from supervisor to user mode. | |
FUNC_NORETURN void | arch_syscall_oops (void *ssf) |
Induce a kernel oops that appears to come from a specific location. | |
size_t | arch_user_string_nlen (const char *s, size_t maxsize, int *err) |
Safely take the length of a potentially bad string. | |
static bool | arch_mem_coherent (void *ptr) |
Detect memory coherence type. | |
static void | arch_cohere_stacks (struct k_thread *old_thread, void *old_switch_handle, struct k_thread *new_thread) |
Ensure cache coherence prior to context switch. | |
void | arch_gdb_init (void) |
Architecture layer debug start. | |
void | arch_gdb_continue (void) |
Continue running program. | |
void | arch_gdb_step (void) |
Continue with one step. | |
size_t | arch_gdb_reg_readall (struct gdb_ctx *ctx, uint8_t *buf, size_t buflen) |
Read all registers, and outputs as hexadecimal string. | |
size_t | arch_gdb_reg_writeall (struct gdb_ctx *ctx, uint8_t *hex, size_t hexlen) |
Take a hexadecimal string and update all registers. | |
size_t | arch_gdb_reg_readone (struct gdb_ctx *ctx, uint8_t *buf, size_t buflen, uint32_t regno) |
Read one register, and outputs as hexadecimal string. | |
size_t | arch_gdb_reg_writeone (struct gdb_ctx *ctx, uint8_t *hex, size_t hexlen, uint32_t regno) |
Take a hexadecimal string and update one register. | |
int | arch_gdb_add_breakpoint (struct gdb_ctx *ctx, uint8_t type, uintptr_t addr, uint32_t kind) |
Add breakpoint or watchpoint. | |
int | arch_gdb_remove_breakpoint (struct gdb_ctx *ctx, uint8_t type, uintptr_t addr, uint32_t kind) |
Remove breakpoint or watchpoint. | |
void | arch_timing_init (void) |
Initialize the timing subsystem. | |
void | arch_timing_start (void) |
Signal the start of the timing information gathering. | |
void | arch_timing_stop (void) |
Signal the end of the timing information gathering. | |
timing_t | arch_timing_counter_get (void) |
Return timing counter. | |
uint64_t | arch_timing_cycles_get (volatile timing_t *const start, volatile timing_t *const end) |
Get number of cycles between start and end . | |
uint64_t | arch_timing_freq_get (void) |
Get frequency of counter used (in Hz). | |
uint64_t | arch_timing_cycles_to_ns (uint64_t cycles) |
Convert number of cycles into nanoseconds. | |
uint64_t | arch_timing_cycles_to_ns_avg (uint64_t cycles, uint32_t count) |
Convert number of cycles into nanoseconds with averaging. | |
uint32_t | arch_timing_freq_get_mhz (void) |
Get frequency of counter used (in MHz). | |
void | arch_spin_relax (void) |
Perform architecture specific processing within spin loops. | |
void | arch_stack_walk (stack_trace_callback_fn callback_fn, void *cookie, const struct k_thread *thread, const struct arch_esf *esf) |
Architecture-specific function to walk the stack. | |
k_thread_entry_t |
Thread entry point function type.
A thread's entry point function is invoked when the thread starts executing. Up to 3 argument values can be passed to the function.
The thread terminates execution permanently if the entry point function returns. The thread is responsible for releasing any shared resources it may own (such as mutexes and dynamically allocated memory), prior to returning.
p1 | First argument. |
p2 | Second argument. |
p3 | Third argument. |
Typedef of struct z_thread_stack_element.
stack_trace_callback_fn - Callback for arch_stack_walk
cookie | Caller supplied pointer handed back by arch_stack_walk |
addr | The stack entry address to consume |
void arch_spin_relax | ( | void | ) |
Perform architecture specific processing within spin loops.
This is invoked from busy loops with IRQs disabled such as the contended spinlock loop. The default implementation is a weak function that calls arch_nop(). Architectures may implement this function to perform extra checks or power management tricks if needed.
void arch_stack_walk | ( | stack_trace_callback_fn | callback_fn, |
void * | cookie, | ||
const struct k_thread * | thread, | ||
const struct arch_esf * | esf | ||
) |
Architecture-specific function to walk the stack.
callback_fn | Callback which is invoked by the architecture code for each entry. |
cookie | Caller supplied pointer which is handed back to callback_fn |
thread | Pointer to a k_thread struct, can be NULL |
esf | Pointer to an arch_esf struct, can be NULL |
============ ======= ============================================ thread esf ============ ======= ============================================ thread NULL Stack trace from thread (can be _current) thread esf Stack trace starting on esf ============ ======= ============================================