/Zephyr-Core-3.6.0/samples/kernel/condition_variables/simple/ |
D | README.rst | 11 to signal changing states (conditions) from worker thread to the main 12 thread. Main thread uses a condition variable to wait for a condition to 13 become true. Main thread and the worker thread alternate between their 14 execution based on when the worker thread signals the main thread that is 38 [thread 0] working (0/5) 39 [thread 1] working (0/5) 40 [thread 2] working (0/5) 41 [thread 3] working (0/5) 42 [thread 4] working (0/5) 43 [thread 5] working (0/5) [all …]
|
/Zephyr-Core-3.6.0/kernel/ |
D | sched.c | 42 struct k_thread *thread); 44 struct k_thread *thread); 60 static void halt_thread(struct k_thread *thread, uint8_t new_state); 61 static void add_to_waitq_locked(struct k_thread *thread, _wait_q_t *wait_q); 64 static inline int is_preempt(struct k_thread *thread) in is_preempt() argument 67 return thread->base.preempt <= _PREEMPT_THRESHOLD; in is_preempt() 75 static inline int is_metairq(struct k_thread *thread) in is_metairq() argument 78 return (thread->base.prio - K_HIGHEST_THREAD_PRIO) in is_metairq() 81 ARG_UNUSED(thread); in is_metairq() 87 static inline bool is_thread_dummy(struct k_thread *thread) in is_thread_dummy() argument [all …]
|
D | usage.c | 61 static void sched_thread_update_usage(struct k_thread *thread, uint32_t cycles) in sched_thread_update_usage() argument 63 thread->base.usage.total += cycles; in sched_thread_update_usage() 66 thread->base.usage.current += cycles; in sched_thread_update_usage() 68 if (thread->base.usage.longest < thread->base.usage.current) { in sched_thread_update_usage() 69 thread->base.usage.longest = thread->base.usage.current; in sched_thread_update_usage() 74 void z_sched_usage_start(struct k_thread *thread) in z_sched_usage_start() argument 83 if (thread->base.usage.track_usage) { in z_sched_usage_start() 84 thread->base.usage.num_windows++; in z_sched_usage_start() 85 thread->base.usage.current = 0; in z_sched_usage_start() 173 void z_sched_thread_usage(struct k_thread *thread, in z_sched_thread_usage() argument [all …]
|
D | thread.c | 86 struct k_thread *thread; in k_thread_foreach() local 101 for (thread = _kernel.threads; thread; thread = thread->next_thread) { in k_thread_foreach() 102 user_cb(thread, user_data); in k_thread_foreach() 117 struct k_thread *thread; in k_thread_foreach_unlocked() local 126 for (thread = _kernel.threads; thread; thread = thread->next_thread) { in k_thread_foreach_unlocked() 128 user_cb(thread, user_data); in k_thread_foreach_unlocked() 209 void z_thread_monitor_exit(struct k_thread *thread) in z_thread_monitor_exit() argument 213 if (thread == _kernel.threads) { in z_thread_monitor_exit() 220 (thread != prev_thread->next_thread)) { in z_thread_monitor_exit() 224 prev_thread->next_thread = thread->next_thread; in z_thread_monitor_exit() [all …]
|
/Zephyr-Core-3.6.0/subsys/tracing/user/ |
D | tracing_user.c | 11 void __weak sys_trace_thread_create_user(struct k_thread *thread) {} in sys_trace_thread_create_user() argument 12 void __weak sys_trace_thread_abort_user(struct k_thread *thread) {} in sys_trace_thread_abort_user() argument 13 void __weak sys_trace_thread_suspend_user(struct k_thread *thread) {} in sys_trace_thread_suspend_user() argument 14 void __weak sys_trace_thread_resume_user(struct k_thread *thread) {} in sys_trace_thread_resume_user() argument 15 void __weak sys_trace_thread_name_set_user(struct k_thread *thread) {} in sys_trace_thread_name_set_user() argument 18 void __weak sys_trace_thread_info_user(struct k_thread *thread) {} in sys_trace_thread_info_user() argument 19 void __weak sys_trace_thread_sched_ready_user(struct k_thread *thread) {} in sys_trace_thread_sched_ready_user() argument 20 void __weak sys_trace_thread_pend_user(struct k_thread *thread) {} in sys_trace_thread_pend_user() argument 21 void __weak sys_trace_thread_priority_set_user(struct k_thread *thread, int prio) {} in sys_trace_thread_priority_set_user() argument 26 void sys_trace_thread_create(struct k_thread *thread) in sys_trace_thread_create() argument [all …]
|
D | tracing_user.h | 16 void sys_trace_thread_create_user(struct k_thread *thread); 17 void sys_trace_thread_abort_user(struct k_thread *thread); 18 void sys_trace_thread_suspend_user(struct k_thread *thread); 19 void sys_trace_thread_resume_user(struct k_thread *thread); 20 void sys_trace_thread_name_set_user(struct k_thread *thread); 23 void sys_trace_thread_info_user(struct k_thread *thread); 24 void sys_trace_thread_priority_set_user(struct k_thread *thread, int prio); 25 void sys_trace_thread_sched_ready_user(struct k_thread *thread); 26 void sys_trace_thread_pend_user(struct k_thread *thread); 31 void sys_trace_thread_create(struct k_thread *thread); [all …]
|
/Zephyr-Core-3.6.0/kernel/include/ |
D | ksched.h | 42 void z_move_thread_to_end_of_prio_q(struct k_thread *thread); 43 int z_is_thread_time_slicing(struct k_thread *thread); 44 void z_unpend_thread_no_timeout(struct k_thread *thread); 49 void z_pend_thread(struct k_thread *thread, _wait_q_t *wait_q, 54 void z_unpend_thread(struct k_thread *thread); 56 void z_thread_priority_set(struct k_thread *thread, int prio); 57 bool z_set_prio(struct k_thread *thread, int prio); 62 void z_sched_abort(struct k_thread *thread); 64 void z_sched_start(struct k_thread *thread); 65 void z_ready_thread(struct k_thread *thread); [all …]
|
/Zephyr-Core-3.6.0/arch/arc/core/ |
D | thread.c | 45 static bool is_user(struct k_thread *thread) in is_user() argument 47 return (thread->base.user_options & K_USER) != 0; in is_user() 52 static void setup_stack_vars(struct k_thread *thread) in setup_stack_vars() argument 55 if (is_user(thread)) { in setup_stack_vars() 57 thread->arch.priv_stack_start = in setup_stack_vars() 58 (uint32_t)z_priv_stack_find(thread->stack_obj); in setup_stack_vars() 60 thread->arch.priv_stack_start = (uint32_t)(thread->stack_obj); in setup_stack_vars() 62 thread->arch.priv_stack_start += Z_ARC_STACK_GUARD_SIZE; in setup_stack_vars() 64 thread->arch.priv_stack_start = 0; in setup_stack_vars() 70 if (is_user(thread)) { in setup_stack_vars() [all …]
|
/Zephyr-Core-3.6.0/arch/x86/core/intel64/ |
D | thread.c | 13 extern void x86_sse_init(struct k_thread *thread); /* in locore.S */ 28 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument 39 switch_entry = z_x86_userspace_prepare_thread(thread); in arch_new_thread() 40 thread->arch.cs = X86_KERNEL_CS; in arch_new_thread() 41 thread->arch.ss = X86_KERNEL_DS; in arch_new_thread() 47 thread->callee_saved.rsp = (long) iframe; in arch_new_thread() 48 thread->callee_saved.rip = (long) switch_entry; in arch_new_thread() 49 thread->callee_saved.rflags = EFLAGS_INITIAL; in arch_new_thread() 54 thread->arch.rdi = (long) entry; in arch_new_thread() 55 thread->arch.rsi = (long) p1; in arch_new_thread() [all …]
|
/Zephyr-Core-3.6.0/subsys/tracing/sysview/ |
D | sysview_config.c | 20 static void set_thread_name(char *name, struct k_thread *thread) in set_thread_name() argument 22 const char *tname = k_thread_name_get(thread); in set_thread_name() 29 thread, &thread->entry); in set_thread_name() 33 void sys_trace_thread_info(struct k_thread *thread) in sys_trace_thread_info() argument 37 set_thread_name(name, thread); in sys_trace_thread_info() 41 Info.TaskID = (uint32_t)(uintptr_t)thread; in sys_trace_thread_info() 43 Info.Prio = thread->base.prio; in sys_trace_thread_info() 44 Info.StackBase = thread->stack_info.size; in sys_trace_thread_info() 45 Info.StackSize = thread->stack_info.start; in sys_trace_thread_info() 60 struct k_thread *thread; in send_task_list_cb() local [all …]
|
/Zephyr-Core-3.6.0/arch/arm/core/cortex_a_r/ |
D | thread.c | 51 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument 63 thread->stack_info.start += MPU_GUARD_ALIGN_AND_SIZE; in arch_new_thread() 64 thread->stack_info.size -= MPU_GUARD_ALIGN_AND_SIZE; in arch_new_thread() 68 if ((thread->base.user_options & K_FP_REGS) != 0) { in arch_new_thread() 74 thread->stack_info.start += FP_GUARD_EXTRA_SIZE; in arch_new_thread() 75 thread->stack_info.size -= FP_GUARD_EXTRA_SIZE; in arch_new_thread() 82 if ((thread->base.user_options & K_USER) != 0) { in arch_new_thread() 107 thread->callee_saved.psp = (uint32_t)iframe; in arch_new_thread() 108 thread->arch.basepri = 0; in arch_new_thread() 111 thread->arch.mode = 0; in arch_new_thread() [all …]
|
/Zephyr-Core-3.6.0/arch/arm/core/cortex_m/ |
D | thread.c | 59 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument 71 thread->stack_info.start += MPU_GUARD_ALIGN_AND_SIZE; in arch_new_thread() 72 thread->stack_info.size -= MPU_GUARD_ALIGN_AND_SIZE; in arch_new_thread() 76 if ((thread->base.user_options & K_FP_REGS) != 0) { in arch_new_thread() 82 thread->stack_info.start += FP_GUARD_EXTRA_SIZE; in arch_new_thread() 83 thread->stack_info.size -= FP_GUARD_EXTRA_SIZE; in arch_new_thread() 90 if ((thread->base.user_options & K_USER) != 0) { in arch_new_thread() 109 thread->callee_saved.psp = (uint32_t)iframe; in arch_new_thread() 110 thread->arch.basepri = 0; in arch_new_thread() 113 thread->arch.mode = 0; in arch_new_thread() [all …]
|
/Zephyr-Core-3.6.0/subsys/tracing/ctf/ |
D | ctf_top.c | 13 static void _get_thread_name(struct k_thread *thread, in _get_thread_name() argument 16 const char *tname = k_thread_name_get(thread); in _get_thread_name() 28 struct k_thread *thread; in sys_trace_k_thread_switched_out() local 30 thread = k_sched_current_thread_query(); in sys_trace_k_thread_switched_out() 31 _get_thread_name(thread, &name); in sys_trace_k_thread_switched_out() 33 ctf_top_thread_switched_out((uint32_t)(uintptr_t)thread, name); in sys_trace_k_thread_switched_out() 38 struct k_thread *thread; in sys_trace_k_thread_switched_in() local 41 thread = k_sched_current_thread_query(); in sys_trace_k_thread_switched_in() 42 _get_thread_name(thread, &name); in sys_trace_k_thread_switched_in() 44 ctf_top_thread_switched_in((uint32_t)(uintptr_t)thread, name); in sys_trace_k_thread_switched_in() [all …]
|
/Zephyr-Core-3.6.0/arch/sparc/core/ |
D | thread.c | 10 void z_thread_entry_wrapper(k_thread_entry_t thread, 31 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument 40 thread->callee_saved.i0 = (uint32_t) entry; in arch_new_thread() 41 thread->callee_saved.i1 = (uint32_t) p1; in arch_new_thread() 42 thread->callee_saved.i2 = (uint32_t) p2; in arch_new_thread() 43 thread->callee_saved.i3 = (uint32_t) p3; in arch_new_thread() 44 thread->callee_saved.i6 = 0; /* frame pointer */ in arch_new_thread() 45 thread->callee_saved.o6 = (uint32_t) iframe; /* stack pointer */ in arch_new_thread() 46 thread->callee_saved.o7 = (uint32_t) z_thread_entry_wrapper - 8; in arch_new_thread() 47 thread->callee_saved.psr = PSR_S | PSR_PS | PSR_ET; in arch_new_thread() [all …]
|
/Zephyr-Core-3.6.0/arch/x86/core/ia32/ |
D | float.c | 131 static void FpCtxSave(struct k_thread *thread) in FpCtxSave() argument 134 if ((thread->base.user_options & K_SSE_REGS) != 0) { in FpCtxSave() 135 z_do_fp_and_sse_regs_save(&thread->arch.preempFloatReg); in FpCtxSave() 139 z_do_fp_regs_save(&thread->arch.preempFloatReg); in FpCtxSave() 148 static inline void FpCtxInit(struct k_thread *thread) in FpCtxInit() argument 152 if ((thread->base.user_options & K_SSE_REGS) != 0) { in FpCtxInit() 167 void z_float_enable(struct k_thread *thread, unsigned int options) in z_float_enable() argument 172 if (!thread) { in z_float_enable() 182 thread->base.user_options |= (uint8_t)options; in z_float_enable() 206 FpCtxInit(thread); in z_float_enable() [all …]
|
D | thread.c | 52 extern int z_float_disable(struct k_thread *thread); 54 int arch_float_disable(struct k_thread *thread) in arch_float_disable() argument 57 return z_float_disable(thread); in arch_float_disable() 63 extern int z_float_enable(struct k_thread *thread, unsigned int options); 65 int arch_float_enable(struct k_thread *thread, unsigned int options) in arch_float_enable() argument 68 return z_float_enable(thread, options); in arch_float_enable() 75 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument 87 swap_entry = z_x86_userspace_prepare_thread(thread); in arch_new_thread() 112 thread->callee_saved.esp = (unsigned long)initial_frame; in arch_new_thread() 114 thread->arch.excNestCount = 0; in arch_new_thread() [all …]
|
/Zephyr-Core-3.6.0/samples/kernel/condition_variables/condvar/ |
D | README.rst | 12 to signal changing states (conditions) from one thread to another 13 thread. A thread uses a condition variable to wait for a condition to 15 function execution based on when they signal the other thread that is 39 Starting watch_count: thread 1 40 watch_count: thread 1 Count= 0. Going into wait... 41 inc_count: thread 2, count = 1, unlocking mutex 42 inc_count: thread 3, count = 2, unlocking mutex 43 inc_count: thread 2, count = 3, unlocking mutex 44 inc_count: thread 3, count = 4, unlocking mutex 45 inc_count: thread 2, count = 5, unlocking mutex [all …]
|
/Zephyr-Core-3.6.0/subsys/tracing/test/ |
D | tracing_string_format_test.c | 16 struct k_thread *thread; in sys_trace_k_thread_switched_out() local 18 thread = k_current_get(); in sys_trace_k_thread_switched_out() 19 TRACING_STRING("%s: %p\n", __func__, thread); in sys_trace_k_thread_switched_out() 24 struct k_thread *thread; in sys_trace_k_thread_switched_in() local 26 thread = k_current_get(); in sys_trace_k_thread_switched_in() 27 TRACING_STRING("%s: %p\n", __func__, thread); in sys_trace_k_thread_switched_in() 30 void sys_trace_k_thread_priority_set(struct k_thread *thread) in sys_trace_k_thread_priority_set() argument 32 TRACING_STRING("%s: %p\n", __func__, thread); in sys_trace_k_thread_priority_set() 35 void sys_trace_k_thread_create(struct k_thread *thread, size_t stack_size, in sys_trace_k_thread_create() argument 38 TRACING_STRING("%s: %p\n", __func__, thread); in sys_trace_k_thread_create() [all …]
|
/Zephyr-Core-3.6.0/arch/riscv/core/ |
D | pmp.c | 293 #define PMP_M_MODE(thread) \ argument 294 thread->arch.m_mode_pmpaddr_regs, \ 295 thread->arch.m_mode_pmpcfg_regs, \ 296 ARRAY_SIZE(thread->arch.m_mode_pmpaddr_regs) 302 #define PMP_U_MODE(thread) \ argument 303 thread->arch.u_mode_pmpaddr_regs, \ 304 thread->arch.u_mode_pmpcfg_regs, \ 305 ARRAY_SIZE(thread->arch.u_mode_pmpaddr_regs) 415 void z_riscv_pmp_stackguard_prepare(struct k_thread *thread) in z_riscv_pmp_stackguard_prepare() argument 417 unsigned int index = z_riscv_pmp_thread_init(PMP_M_MODE(thread)); in z_riscv_pmp_stackguard_prepare() [all …]
|
/Zephyr-Core-3.6.0/doc/kernel/services/threads/ |
D | system_threads.rst | 10 A :dfn:`system thread` is a thread that the kernel spawns automatically 15 **Main thread** 16 This thread performs kernel initialization, then calls the application's 19 By default, the main thread uses the highest configured preemptible thread 21 threads, the main thread uses the lowest configured cooperative thread 24 The main thread is an essential thread while it is performing kernel 26 this means a fatal system error is raised if the thread aborts. If 28 return, the main thread terminates normally and no error is raised. 30 **Idle thread** 31 This thread executes when there is no other work for the system to do. [all …]
|
D | index.rst | 16 A :dfn:`thread` is a kernel object that is used for application processing 20 available RAM). Each thread is referenced by a :dfn:`thread id` that is assigned 21 when the thread is spawned. 23 A thread has the following key properties: 25 * A **stack area**, which is a region of memory used for the thread's stack. 27 of the thread's processing. Special macros exist to create and work with 30 * A **thread control block** for private kernel bookkeeping of the thread's 33 * An **entry point function**, which is invoked when the thread is started. 37 allocate CPU time to the thread. (See :ref:`scheduling_v2`.) 39 * A set of **thread options**, which allow the thread to receive special [all …]
|
/Zephyr-Core-3.6.0/tests/kernel/context/ |
D | README.txt | 12 - start a helper thread to help with k_yield() tests 13 - start a thread to test thread related functionality 16 - Called by a higher priority thread when there is another thread 17 - Called by an equal priority thread when there is another thread 18 - Called by a lower priority thread when there is another thread 22 - Called from an ISR (interrupted a thread) 24 - Called from a thread 28 - Called from an ISR that interrupted a thread 30 - Called from a thread 81 tc_start() - Test kernel CPU and thread routines [all …]
|
/Zephyr-Core-3.6.0/samples/userspace/syscall_perf/ |
D | README.rst | 7 user thread has to go through a system call compared to a supervisor thread that 14 This application creates a supervisor and a user thread. 16 current thread. The user thread has to go through a system call. 27 User thread: 18012 cycles 748 instructions 28 Supervisor thread: 7 cycles 4 instructions 29 User thread: 20136 cycles 748 instructions 30 Supervisor thread: 7 cycles 4 instructions 31 User thread: 18014 cycles 748 instructions 32 Supervisor thread: 7 cycles 4 instructions
|
/Zephyr-Core-3.6.0/arch/arm64/core/ |
D | thread.c | 79 static bool is_user(struct k_thread *thread) in is_user() argument 81 return (thread->base.user_options & K_USER) != 0; in is_user() 85 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument 96 memset(&thread->arch, 0, sizeof(thread->arch)); in arch_new_thread() 123 if (is_user(thread)) { in arch_new_thread() 137 thread->arch.exception_depth = 1; in arch_new_thread() 144 thread->callee_saved.sp_elx = (uint64_t)pInitCtx; in arch_new_thread() 145 thread->callee_saved.lr = (uint64_t)z_arm64_exit_exc; in arch_new_thread() 147 thread->switch_handle = thread; in arch_new_thread() 149 thread->arch.stack_limit = (uint64_t)stack + Z_ARM64_STACK_GUARD_SIZE; in arch_new_thread() [all …]
|
/Zephyr-Core-3.6.0/tests/subsys/tracing/tracing_api/src/ |
D | main.c | 119 struct k_thread thread; in ZTEST() local 130 sys_trace_k_thread_priority_set(&thread); in ZTEST() 131 sys_trace_k_thread_sched_set_priority(&thread, prio); in ZTEST() 132 sys_trace_k_thread_create(&thread, stack, prio); in ZTEST() 133 sys_trace_k_thread_start(&thread); in ZTEST() 134 sys_trace_k_thread_abort(&thread); in ZTEST() 135 sys_trace_k_thread_suspend(&thread); in ZTEST() 136 sys_trace_k_thread_resume(&thread); in ZTEST() 137 sys_trace_k_thread_ready(&thread); in ZTEST() 138 sys_trace_k_thread_sched_ready(&thread); in ZTEST() [all …]
|