123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- #ifndef ZEPHYR_KERNEL_INCLUDE_KERNEL_INTERNAL_H_
- #define ZEPHYR_KERNEL_INCLUDE_KERNEL_INTERNAL_H_
- #include <kernel.h>
- #include <kernel_arch_interface.h>
- #include <string.h>
- #ifndef _ASMLANGUAGE
- #ifdef __cplusplus
- extern "C" {
- #endif
- void z_bss_zero(void);
- #ifdef CONFIG_XIP
- void z_data_copy(void);
- #else
- static inline void z_data_copy(void)
- {
-
- }
- #endif
- #ifdef CONFIG_LINKER_USE_BOOT_SECTION
- void z_bss_zero_boot(void);
- #else
- static inline void z_bss_zero_boot(void)
- {
-
- }
- #endif
- #ifdef CONFIG_LINKER_USE_PINNED_SECTION
- void z_bss_zero_pinned(void);
- #else
- static inline void z_bss_zero_pinned(void)
- {
-
- }
- #endif
- FUNC_NORETURN void z_cstart(void);
- void z_device_state_init(void);
- extern FUNC_NORETURN void z_thread_entry(k_thread_entry_t entry,
- void *p1, void *p2, void *p3);
- extern char *z_setup_new_thread(struct k_thread *new_thread,
- k_thread_stack_t *stack, size_t stack_size,
- k_thread_entry_t entry,
- void *p1, void *p2, void *p3,
- int prio, uint32_t options, const char *name);
- void *z_thread_aligned_alloc(size_t align, size_t size);
- static inline void *z_thread_malloc(size_t size)
- {
- return z_thread_aligned_alloc(0, size);
- }
- extern void z_thread_essential_set(void);
- extern void z_thread_essential_clear(void);
- #if defined(CONFIG_THREAD_MONITOR)
- extern void z_thread_monitor_exit(struct k_thread *thread);
- #else
- #define z_thread_monitor_exit(thread) \
- do { \
- } while (false)
- #endif
- #ifdef CONFIG_USE_SWITCH
- static ALWAYS_INLINE void
- arch_thread_return_value_set(struct k_thread *thread, unsigned int value)
- {
- thread->swap_retval = value;
- }
- #endif
- static ALWAYS_INLINE void
- z_thread_return_value_set_with_data(struct k_thread *thread,
- unsigned int value,
- void *data)
- {
- arch_thread_return_value_set(thread, value);
- thread->base.swap_data = data;
- }
- #ifdef CONFIG_SMP
- extern void z_smp_init(void);
- extern void smp_timer_init(void);
- #endif
- extern void z_early_boot_rand_get(uint8_t *buf, size_t length);
- #if CONFIG_STACK_POINTER_RANDOM
- extern int z_stack_adjust_initialized;
- #endif
- extern struct k_thread z_main_thread;
- #ifdef CONFIG_MULTITHREADING
- extern struct k_thread z_idle_threads[CONFIG_MP_NUM_CPUS];
- #endif
- K_KERNEL_PINNED_STACK_ARRAY_EXTERN(z_interrupt_stacks, CONFIG_MP_NUM_CPUS,
- CONFIG_ISR_STACK_SIZE);
- #ifdef CONFIG_GEN_PRIV_STACKS
- extern uint8_t *z_priv_stack_find(k_thread_stack_t *stack);
- #endif
- #ifdef CONFIG_USERSPACE
- bool z_stack_is_user_capable(k_thread_stack_t *stack);
- void z_mem_domain_init_thread(struct k_thread *thread);
- void z_mem_domain_exit_thread(struct k_thread *thread);
- extern struct k_spinlock z_mem_domain_lock;
- #endif
- #ifdef CONFIG_GDBSTUB
- struct gdb_ctx;
- extern int z_gdb_main_loop(struct gdb_ctx *ctx, bool start);
- #endif
- #ifdef CONFIG_INSTRUMENT_THREAD_SWITCHING
- void z_thread_mark_switched_in(void);
- void z_thread_mark_switched_out(void);
- #else
- #define z_thread_mark_switched_in()
- #define z_thread_mark_switched_out()
- #endif
- void z_mem_manage_init(void);
- void z_mem_manage_boot_finish(void);
- #define LOCKED(lck) for (k_spinlock_key_t __i = {}, \
- __key = k_spin_lock(lck); \
- !__i.key; \
- k_spin_unlock(lck, __key), __i.key = 1)
- #ifdef CONFIG_PM
- enum pm_state pm_system_suspend(int32_t ticks);
- void pm_system_resume(void);
- #endif
- #ifdef CONFIG_DEMAND_PAGING_TIMING_HISTOGRAM
- void z_paging_histogram_init(void);
- void z_paging_histogram_inc(struct k_mem_paging_histogram_t *hist,
- uint32_t cycles);
- #endif
- #ifdef __cplusplus
- }
- #endif
- #endif
- #endif
|