Lines Matching +full:off +full:- +full:on +full:- +full:delay +full:- +full:us
4 * SPDX-License-Identifier: Apache-2.0
53 #define K_PRIO_COOP(x) (-(CONFIG_NUM_COOP_PRIORITIES - (x)))
56 #define K_HIGHEST_THREAD_PRIO (-CONFIG_NUM_COOP_PRIORITIES)
60 #define K_LOWEST_APPLICATION_THREAD_PRIO (K_LOWEST_THREAD_PRIO - 1)
126 * @brief Iterate over all the threads in running on specified cpu.
129 * but it only loops through the threads running on specified cpu only.
188 * @brief Iterate over the threads in running on current cpu without locking.
192 * running on specified cpu. If CONFIG_SMP is not defined the
245 * bits, arch-specific use high bits.
289 * from within a user-provided callback they have been invoked.
290 * Effectively it serves as a tiny bit of zero-overhead TLS data.
318 * @brief FP and SSE registers are managed by context switch on x86
328 /* end - thread options */
335 * - @ref K_USER allocate a userspace thread (requires `CONFIG_USERSPACE=y`)
340 * @retval the allocated thread stack on success.
341 * @retval NULL on failure.
352 * @retval 0 on success.
353 * @retval -EBUSY if the thread stack is in use.
354 * @retval -EINVAL if @p stack is invalid.
355 * @retval -ENOSYS if dynamic thread stack allocation is disabled
371 * Thread options are architecture-specific, and can include K_ESSENTIAL,
378 * - K_THREAD_STACK_DEFINE() - For stacks that may support either user or
380 * - K_KERNEL_STACK_DEFINE() - For stacks that may support supervisor
386 * - The original size value passed to K_THREAD_STACK_DEFINE() or
388 * - The return value of K_THREAD_STACK_SIZEOF(stack) if the stack was
390 * - The return value of K_KERNEL_STACK_SIZEOF(stack) if the stack was
404 * @param delay Scheduling delay, or K_NO_WAIT (for no delay).
414 int prio, uint32_t options, k_timeout_t delay);
419 * This allows a supervisor thread to be re-used as a user thread.
424 * Any thread-local storage will be reverted to a pristine state.
429 * A common use of this function is to re-use the main thread as a user thread
430 * once all supervisor mode-only tasks have been completed.
474 thread->resource_pool = heap; in k_thread_heap_assign()
481 * User threads will need to have permission on the target thread object.
484 * If this API is called from supervisor mode, on the currently running thread,
485 * on a platform which selects @kconfig{CONFIG_NO_UNUSED_STACK_INSPECTION}, an
491 * @return 0 on success
492 * @return -EBADF Bad thread object (user mode only)
493 * @return -EPERM No permissions on thread object (user mode only)
494 * #return -ENOTSUP Forbidden by hardware policy
495 * @return -EINVAL Thread is uninitialized or exited (user mode only)
496 * @return -EFAULT Bad memory address for unused_ptr (user mode only)
509 * Use with caution, as a malicious thread could perform DoS attacks on the
522 * to being aborted, self-exiting, or taking a fatal error. This API returns
532 * @retval -EBUSY returned without waiting
533 * @retval -EAGAIN waiting period timed out
534 * @retval -EDEADLK target thread is joining on the caller, or target thread
573 * In particular, because the lower bound on the duration of a sleep is
579 * @param us Number of microseconds to sleep.
585 __syscall int32_t k_usleep(int32_t us);
593 * @note The clock used for the microsecond-resolution delay here may
596 * less time than k_sleep(K_MSEC(1)), with the offset dependent on
601 * The timer/clock used for delay processing may be disabled/inactive.
665 /* Thread-local cache of current thread ID, set in z_thread_entry() */ in k_current_get()
678 * off all kernel queues it is part of (i.e. the ready queue, the timeout
685 * running or to become runnable anywhere on the system. Normally
687 * k_thread_join()), but in interrupt context on SMP systems the
688 * implementation is required to spin for threads that are running on
712 return z_timeout_expires(&thread->base.timeout); in z_impl_k_thread_timeout_expires_ticks()
727 return z_timeout_remaining(&thread->base.timeout); in z_impl_k_thread_timeout_remaining_ticks()
756 #define Z_THREAD_INIT_DELAY(thread) SYS_TIMEOUT_MS((thread)->init_delay_ms)
759 #define Z_THREAD_INIT_DELAY(thread) (thread)->init_delay
764 prio, options, delay, tname) \ argument
776 Z_THREAD_INIT_DELAY_INITIALIZER(delay) \
781 * information on arguments.
785 prio, options, delay) \ argument
792 delay, name); \
804 * Thread options are architecture-specific, and can include K_ESSENTIAL,
820 * @param delay Scheduling delay (in milliseconds), zero for no delay.
822 * @note Static threads with zero delay should not normally have
824 * initialization handling (depending on the priority of the main
832 prio, options, delay) \ argument
835 prio, options, delay)
842 * Thread options are architecture-specific, and can include K_ESSENTIAL,
853 * @warning Depending on the architecture, the stack size (@p stack_size)
855 * or in power-of-two size (if MPU).
865 * @param delay Scheduling delay (in milliseconds), zero for no delay.
869 prio, options, delay) \ argument
872 prio, options, delay)
890 * Rescheduling can occur immediately depending on the priority @a thread is
893 * - If its priority is raised above the priority of a currently scheduled
896 * - If the caller lowers the priority of a currently scheduled preemptible
900 * Priority can be assigned in the range of -CONFIG_NUM_COOP_PRIORITIES to
901 * CONFIG_NUM_PREEMPT_PRIORITIES-1, where -CONFIG_NUM_COOP_PRIORITIES is the
927 * a signed non-negative quantity). Failure to adhere to this rule
942 * @param thread A thread on which to set the deadline
952 * This routine invokes the scheduler to force a schedule point on the current
973 * After this returns, the thread will no longer be schedulable on any
980 * @return Zero on success, otherwise error code
987 * After this returns, the thread will be schedulable on any CPU. The
994 * @return Zero on success, otherwise error code
999 * @brief Enable thread to run on specified CPU
1008 * @return Zero on success, otherwise error code
1013 * @brief Prevent thread to run on specified CPU
1022 * @return Zero on success, otherwise error code
1030 * thread on the selected CPU.
1034 * @return Zero on success, otherwise error code
1043 * the current thread. All other internal operations on @a thread are
1044 * still performed; for example, kernel objects it is waiting on are
1051 * When the target thread is active on another CPU, the caller will block until
1053 * an interrupt context, it will spin waiting for that target thread active on
1078 * If a thread was created with K_FOREVER in the delay parameter, it will
1080 * on it.
1094 * @brief Set time-slicing period and scope.
1099 * To enable time slicing, @a slice must be non-zero. The scheduler
1126 * thread. When non-zero, this timeslice will take precedence over
1130 * will be called before the thread is removed/re-added to the run
1133 * currently-executing ISR. Such a callback is free to, for example,
1142 * @note Threads with a non-zero slice time set will be timesliced
1151 * fine-grained timing decisions within this callback should use the
1156 * @param expired Callback function called on slice expiration
1172 * This routine allows the caller to customize its actions, depending on
1185 * This routine allows the caller to customize its actions, depending on
1189 * - The code is running in a thread, not at ISR.
1190 * - The thread's priority is in the preemptible range.
1191 * - The thread has not locked the scheduler.
1196 * @return Non-zero if invoked by a preemptible thread.
1201 * @brief Test whether startup is in the before-main-task phase.
1203 * This routine allows the caller to customize its actions, depending on
1208 * @return true if invoked before post-kernel initialization
1209 * @return false if invoked during/after post-kernel initialization
1234 * again becomes the current thread, its non-preemptible status is maintained.
1239 * extremely fast for non-userspace threads (just one byte
1244 * preemptible or cooperative threads running on the current CPU. It
1246 * not prevent threads from running on other CPUs when CONFIG_SMP=y.
1249 * In general this is a historical API not well-suited to modern
1270 * upon which to build thread-local storage.
1294 * @retval 0 on success
1295 * @retval -EFAULT Memory access error with supplied string
1296 * @retval -ENOSYS Thread name configuration option not enabled
1297 * @retval -EINVAL Thread name too long
1317 * @retval -ENOSPC Destination buffer too small
1318 * @retval -EFAULT Memory access error
1319 * @retval -ENOSYS Thread name feature not enabled
1349 * @brief Generate null timeout delay.
1351 * This macro generates a timeout delay that instructs a kernel API
1354 * @return Timeout delay value.
1359 * @brief Generate timeout delay from nanoseconds.
1361 * This macro generates a timeout delay that instructs a kernel API to
1368 * @return Timeout delay value.
1373 * @brief Generate timeout delay from microseconds.
1375 * This macro generates a timeout delay that instructs a kernel API
1382 * @return Timeout delay value.
1387 * @brief Generate timeout delay from cycles.
1389 * This macro generates a timeout delay that instructs a kernel API
1394 * @return Timeout delay value.
1399 * @brief Generate timeout delay from system ticks.
1401 * This macro generates a timeout delay that instructs a kernel API
1406 * @return Timeout delay value.
1411 * @brief Generate timeout delay from milliseconds.
1413 * This macro generates a timeout delay that instructs a kernel API
1418 * @return Timeout delay value.
1423 * @brief Generate timeout delay from seconds.
1425 * This macro generates a timeout delay that instructs a kernel API
1430 * @return Timeout delay value.
1435 * @brief Generate timeout delay from minutes.
1437 * This macro generates a timeout delay that instructs a kernel API
1442 * @return Timeout delay value.
1447 * @brief Generate timeout delay from hours.
1449 * This macro generates a timeout delay that instructs a kernel API
1454 * @return Timeout delay value.
1459 * @brief Generate infinite timeout delay.
1461 * This macro generates a timeout delay that instructs a kernel API
1464 * @return Timeout delay value.
1473 * This macro generates a timeout delay that represents an expiration
1479 * @return Timeout delay value
1487 * This macro generates a timeout delay that represents an expiration
1493 * @return Timeout delay value
1500 * This macro generates a timeout delay that represents an expiration
1507 * @return Timeout delay value
1514 * This macro generates a timeout delay that represents an expiration
1521 * @return Timeout delay value
1528 * This macro generates a timeout delay that represents an expiration
1535 * @return Timeout delay value
1552 * dynamic timer allocation. timeout.node is used in the double-linked
1557 /* wait queue for the (single) thread waiting on this timer */
1572 /* user-specific data, also used to support legacy features */
1625 * callable from interrupt context (isr-ok).
1686 * effect on the timer.
1714 * This routine blocks the calling thread until the timer's status is non-zero
1716 * or the timer is stopped. If the timer status is already non-zero,
1747 return z_timeout_expires(&timer->timeout); in z_impl_k_timer_expires_ticks()
1765 return z_timeout_remaining(&timer->timeout); in z_impl_k_timer_remaining_ticks()
1786 * @brief Associate user-specific data with a timer.
1805 timer->user_data = user_data; in z_impl_k_timer_user_data_set()
1809 * @brief Retrieve the user-specific data from a timer.
1819 return timer->user_data; in z_impl_k_timer_user_data_get()
1849 * not mean it has millisecond resolution. The actual resolution depends on
1860 * @brief Get system uptime (32-bit version).
1869 * interrupt blocking and 64-bit math.
1873 * not mean it has millisecond resolution. The actual resolution depends on
1912 delta = uptime - *reftime; in k_uptime_delta()
1924 * @return Current hardware clock up-counter (in cycles).
1932 * @brief Read the 64-bit hardware clock.
1934 * This routine returns the current time in 64-bits, as measured by the
1939 * @return Current hardware clock up-counter (in cycles).
1944 __ASSERT(0, "64-bit cycle counter not enabled on this platform. " in k_cycle_get_64()
1998 * @brief Cancel waiting on a queue.
2000 * This routine causes first thread pending on @a queue, if any, to
2002 * If the queue is being waited on by k_poll(), it will return with
2003 * -EINTR and K_POLL_STATE_CANCELLED state (and per above, subsequent
2016 * aligned on a word boundary, and the first word of the item is reserved
2039 * @retval 0 on success
2040 * @retval -ENOMEM if there isn't sufficient RAM in the caller's resource pool
2048 * aligned on a word boundary, and the first word of the item is reserved
2071 * @retval 0 on success
2072 * @retval -ENOMEM if there isn't sufficient RAM in the caller's resource pool
2080 * data item must be aligned on a word boundary, and the first word of
2095 * The data items must be in a singly-linked list, with the first word
2097 * NULL-terminated.
2102 * @param head Pointer to first node in singly-linked list.
2103 * @param tail Pointer to last node in singly-linked list.
2105 * @retval 0 on success
2106 * @retval -EINVAL on invalid supplied data
2115 * The data items must be in a singly-linked list implemented using a
2123 * @retval 0 on success
2124 * @retval -EINVAL on invalid data
2152 * rely on sys_slist_find_and_remove which is not a constant time operation.
2170 * relies on sys_slist_is_node_in_list which is not a constant time operation.
2191 * @return Non-zero if the queue is empty.
2198 return sys_sflist_is_empty(&queue->data_q) ? 1 : 0; in z_impl_k_queue_is_empty()
2244 * only on atomic access to shared memory. k_futex are tracked as
2256 * futex contended operation on kernel side, structure z_futex_data
2276 * @brief Pend the current thread on a futex
2279 * goes to sleep until some other thread calls k_futex_wake() on it.
2283 * will not wait on it.
2284 * @param timeout Waiting period on the futex, or one of the special values
2286 * @retval -EACCES Caller does not have read access to futex address.
2287 * @retval -EAGAIN If the futex value did not match the expected parameter.
2288 * @retval -EINVAL Futex parameter address not recognized by the kernel.
2289 * @retval -ETIMEDOUT Thread woke up due to timeout and not a futex wakeup.
2291 * should check the futex's value on wakeup to determine if it needs
2298 * @brief Wake one/all threads pending on a futex
2300 * Wake up the highest priority thread pending on the supplied futex, or
2301 * wakeup all the threads pending on the supplied futex, and the behavior
2302 * depends on wake_all.
2307 * @retval -EACCES Caller does not have access to the futex address.
2308 * @retval -EINVAL Futex parameter address not recognized by the kernel.
2359 * on the event object @a event whose waiting conditions become met by this
2376 * All tasks waiting on the event object @a event whose waiting conditions
2393 * All tasks waiting on the event object @a event whose waiting conditions
2421 * This routine waits on event object @a event until any of the specified
2423 * @a timeout has expired. A thread may wait on up to 32 distinctly numbered
2424 * events that are expressed as bits in a single 32-bit word.
2430 * @param events Set of desired events on which to wait
2445 * This routine waits on event object @a event until all of the specified
2447 * @a timeout has expired. A thread may wait on up to 32 distinctly numbered
2448 * events that are expressed as bits in a single 32-bit word.
2454 * @param events Set of desired events on which to wait
2529 k_queue_init(&(fifo)->_queue); \
2536 * @brief Cancel waiting on a FIFO queue.
2538 * This routine causes first thread pending on @a fifo, if any, to
2549 k_queue_cancel_wait(&(fifo)->_queue); \
2557 * aligned on a word boundary, and the first word of the item is reserved
2569 k_queue_append(&(fifo)->_queue, _data); \
2586 * @retval 0 on success
2587 * @retval -ENOMEM if there isn't sufficient RAM in the caller's resource pool
2593 int fap_ret = k_queue_alloc_append(&(fifo)->_queue, _data); \
2602 * The data items must be in a singly-linked list, with the first word of
2604 * NULL-terminated.
2609 * @param head Pointer to first node in singly-linked list.
2610 * @param tail Pointer to last node in singly-linked list.
2615 k_queue_append_list(&(fifo)->_queue, head, tail); \
2623 * The data items must be in a singly-linked list implemented using a
2625 * and must be re-initialized via sys_slist_init().
2635 k_queue_merge_slist(&(fifo)->_queue, list); \
2659 void *fg_ret = k_queue_get(&(fifo)->_queue, timeout); \
2674 * @return Non-zero if the FIFO queue is empty.
2678 k_queue_is_empty(&(fifo)->_queue)
2685 * on each iteration of processing, a head container will be peeked,
2696 void *fph_ret = k_queue_peek_head(&(fifo)->_queue); \
2715 void *fpt_ret = k_queue_peek_tail(&(fifo)->_queue); \
2771 k_queue_init(&(lifo)->_queue); \
2781 * aligned on a word boundary, and the first word of the item is
2793 k_queue_prepend(&(lifo)->_queue, _data); \
2810 * @retval 0 on success
2811 * @retval -ENOMEM if there isn't sufficient RAM in the caller's resource pool
2817 int lap_ret = k_queue_alloc_prepend(&(lifo)->_queue, _data); \
2842 void *lg_ret = k_queue_get(&(lifo)->_queue, timeout); \
2925 * @return -ENOMEM if memory couldn't be allocated
2939 * @retval 0 on success
2940 * @retval -EAGAIN when object is still in use
2954 * @retval 0 on success
2955 * @retval -ENOMEM if stack is full
2976 * @retval -EBUSY Returned without waiting.
2977 * @retval -EAGAIN Waiting period timed out.
3104 * @retval -EBUSY Returned without waiting.
3105 * @retval -EAGAIN Waiting period timed out.
3125 * @retval -EPERM The current thread does not own the mutex
3126 * @retval -EINVAL The mutex is not locked
3164 * @brief Signals one thread that is pending on the condition variable
3167 * @retval 0 On success
3172 * @brief Unblock all threads that are pending on the condition
3176 * @return An integer with number of woken threads on success
3181 * @brief Waits on the condition variable releasing the mutex lock
3184 * waiting on the condition variable specified by @a condvar,
3194 * @retval 0 On success
3195 * @retval -EAGAIN Waiting period timed out.
3275 * @retval -EINVAL Invalid values
3295 * @retval -EBUSY Returned without waiting.
3296 * @retval -EAGAIN Waiting period timed out,
3318 * with -EAGAIN.
3340 return sem->count; in z_impl_k_sem_count_get()
3388 /** @brief Initialize a (non-delayable) work structure.
3391 * It need not be invoked again on the same work structure. It can be
3392 * re-invoked to change the associated handler, but this must be done when the
3422 * Wrapper to determine whether a work item is in a non-idle dstate.
3431 * @return true if and only if k_work_busy_get() returns a non-zero value.
3437 * @param queue pointer to the work queue on which the item should run. If
3448 * @retval -EBUSY
3452 * @retval -EINVAL if @p queue is null and the work item has never been run.
3453 * @retval -ENODEV if @p queue has not been started.
3468 /** @brief Wait for last-submitted instance to complete.
3477 * @note Behavior is undefined if this function is invoked on @p work from a
3486 * one completes. On architectures with CONFIG_KERNEL_COHERENCE the object
3497 * This attempts to prevent a pending (non-delayable) work item from being
3522 * On return the work structure will be idle unless something submits it after
3529 * @note Behavior is undefined if this function is invoked on @p work from a
3538 * one completes. On architectures with CONFIG_KERNEL_COHERENCE the object
3551 * It need not be invoked again on the same work queue structure.
3562 * should not be re-invoked on a queue.
3620 * This releases the block on new submissions placed when k_work_queue_drain()
3629 * @retval -EALREADY if the work queue was not plugged.
3643 * @retval -EALREADY if the work queue was not started (or already stopped)
3644 * @retval -EBUSY if the work queue is actively processing work items
3645 * @retval -ETIMEDOUT if the work queue did not stop within the stipulated timeout
3652 * first time. It need not be invoked again on the same work structure. It
3653 * can be re-invoked to change the associated handler, but this must be done
3696 * Wrapper to determine whether a delayed work item is in a non-idle state.
3705 * @return true if and only if k_work_delayable_busy_get() returns a non-zero
3743 /** @brief Submit an idle work item to a queue after a delay.
3745 * Unlike k_work_reschedule_for_queue() this is a no-op if the work item is
3746 * already scheduled or submitted, even if @p delay is @c K_NO_WAIT.
3750 * @param queue the queue on which the work item should be submitted after the
3751 * delay.
3755 * @param delay the time to wait before submitting the work item. If @c
3761 * @retval 2 if @p delay is @c K_NO_WAIT and work
3763 * @retval -EBUSY if @p delay is @c K_NO_WAIT and
3765 * @retval -EINVAL if @p delay is @c K_NO_WAIT and
3767 * @retval -ENODEV if @p delay is @c K_NO_WAIT and
3772 k_timeout_t delay);
3775 * delay.
3782 * @param delay the time to wait before submitting the work item. If @c
3788 k_timeout_t delay);
3790 /** @brief Reschedule a work item to a queue after a delay.
3799 * @param queue the queue on which the work item should be submitted after the
3800 * delay.
3804 * @param delay the time to wait before submitting the work item. If @c
3808 * @note If delay is @c K_NO_WAIT ("no delay") the return values are as with
3811 * @retval 0 if delay is @c K_NO_WAIT and work was already on a queue
3813 * * delay is @c K_NO_WAIT and work was not submitted but has now been queued
3815 * * delay not @c K_NO_WAIT and work has been scheduled
3816 * @retval 2 if delay is @c K_NO_WAIT and work was running and has been queued
3818 * @retval -EBUSY if @p delay is @c K_NO_WAIT and
3820 * @retval -EINVAL if @p delay is @c K_NO_WAIT and
3822 * @retval -ENODEV if @p delay is @c K_NO_WAIT and
3827 k_timeout_t delay);
3830 * delay.
3837 * @param delay the time to wait before submitting the work item.
3842 k_timeout_t delay);
3853 * @note Behavior is undefined if this function is invoked on @p dwork from a
3862 * one completes. On architectures with CONFIG_KERNEL_COHERENCE the object
3904 * @note Behavior is undefined if this function is invoked on @p dwork from a
3913 * one completes. On architectures with CONFIG_KERNEL_COHERENCE the object
3973 * Accessed via k_work_busy_get(). May co-occur with other flags.
3979 * Accessed via k_work_busy_get(). May co-occur with other flags.
3986 * Accessed via k_work_busy_get(). May co-occur with other flags.
3993 * Accessed via k_work_busy_get(). May co-occur with other flags.
3999 * Accessed via k_work_busy_get(). May co-occur with other flags.
4016 /* The queue on which the work item was last submitted. */
4032 /** @brief A structure used to submit work after a delay. */
4037 /* Timeout used to submit work after a delay. */
4052 * @brief Initialize a statically-defined delayable work item.
4054 * This macro can be used to initialize a statically-defined delayable
4104 * operation on a work item or queue.
4112 * coherent memory; see arch_mem_coherent(). The stack on these architectures
4113 * is generally not coherent. be stack-allocated. Violations are detected by
4200 return z_timeout_expires(&dwork->timeout); in k_work_delayable_expires_get()
4206 return z_timeout_remaining(&dwork->timeout); in k_work_delayable_remaining_get()
4211 return &queue->thread; in k_work_queue_thread_get()
4257 #if defined(__cplusplus) && ((__cplusplus - 0) < 202002L)
4269 * @brief Initialize a statically-defined user work item.
4271 * This macro can be used to initialize a statically-defined user work
4315 return atomic_test_bit(&work->flags, K_WORK_USER_STATE_PENDING); in k_work_user_is_pending()
4325 * must have permission granted on the work_q parameter's queue object.
4332 * @retval -EBUSY if the work item was already in some workqueue
4333 * @retval -ENOMEM if no memory for thread resource pool allocation
4339 int ret = -EBUSY; in k_work_user_submit_to_queue()
4341 if (!atomic_test_and_set_bit(&work->flags, in k_work_user_submit_to_queue()
4343 ret = k_queue_alloc_append(&work_q->queue, work); in k_work_user_submit_to_queue()
4349 atomic_clear_bit(&work->flags, in k_work_user_submit_to_queue()
4362 * must have permissions granted on both the work_q parameter's thread and
4363 * queue objects, and the same restrictions on priority apply as
4393 return &work_q->thread; in k_work_user_queue_thread_get()
4423 * @brief Initialize a statically-defined work item.
4425 * This macro can be used to initialize a statically-defined workqueue work
4460 * to race conditions with the pre-existing triggered work item and work queue,
4479 * @retval -EINVAL Work item is being processed or has completed its work.
4480 * @retval -EADDRINUSE Work item is pending on a different workqueue.
4500 * to race conditions with the pre-existing triggered work item and work queue,
4516 * @retval -EINVAL Work item is being processed or has completed its work.
4517 * @retval -EADDRINUSE Work item is pending on a different workqueue.
4536 * @retval -EINVAL Work item is being processed or has completed its work.
4677 * @return 0 on success, -ENOMEM if there was insufficient memory in the
4678 * thread's resource pool, or -EINVAL if the size parameters cause
4691 * @retval 0 on success
4692 * @retval -EBUSY Queue not empty
4713 * @retval -ENOMSG Returned without waiting or queue purged.
4714 * @retval -EAGAIN Waiting period timed out.
4735 * @retval -ENOMSG Returned without waiting or queue purged.
4736 * @retval -EAGAIN Waiting period timed out.
4752 * @retval -ENOMSG Returned when the queue has no message.
4770 * @retval -ENOMSG Returned when the queue has no message at index.
4779 * message queue are unblocked and see an -ENOMSG error code.
4811 return msgq->max_msgs - msgq->used_msgs; in z_impl_k_msgq_num_free_get()
4827 return msgq->used_msgs; in z_impl_k_msgq_num_used_get()
4845 /** application-defined information value */
4853 /** internal use only - thread waiting on send (may be a dummy) */
4856 /** internal use only - semaphore used during asynchronous send */
4917 * receive and process it. The message data may be in a buffer or non-existent
4929 * @retval -ENOMSG Returned without waiting.
4930 * @retval -EAGAIN Waiting period timed out.
4939 * to process it. The message data may be in a buffer or non-existent
4965 * @retval -ENOMSG Returned without waiting.
4966 * @retval -EAGAIN Waiting period timed out.
5084 * @retval 0 on success
5085 * @retval -EAGAIN nothing to cleanup
5096 * This function should only be called on uninitialized pipe objects.
5101 * @retval 0 on success
5102 * @retval -ENOMEM if memory couldn't be allocated
5120 * @retval -EIO Returned without waiting; zero data bytes were written.
5121 * @retval -EAGAIN Waiting period timed out; between zero and @a min_xfer
5142 * @retval -EINVAL invalid parameters supplied
5143 * @retval -EIO Returned without waiting; zero data bytes were read.
5144 * @retval -EAGAIN Waiting period timed out; between zero and @a min_xfer
5247 * @brief Statically define and initialize a memory slab in a public (non-static) scope.
5251 * @a slab_align -byte boundary. To ensure that each memory block is similarly
5261 * If such a use-case is desired, use @ref K_MEM_SLAB_DEFINE_STATIC
5282 * @a slab_align -byte boundary. To ensure that each memory block is similarly
5306 * N-byte boundary matching a word boundary, where N is a power of 2
5307 * (i.e. 4 on 32-bit systems, 8, 16, ...).
5316 * @retval 0 on success
5317 * @retval -EINVAL invalid data supplied
5341 * @retval -ENOMEM Returned without waiting.
5342 * @retval -EAGAIN Waiting period timed out.
5343 * @retval -EINVAL Invalid data supplied
5371 return slab->info.num_used; in k_mem_slab_num_used_get()
5387 return slab->info.max_used; in k_mem_slab_max_used_get()
5406 return slab->info.num_blocks - slab->info.num_used; in k_mem_slab_num_free_get()
5418 * @retval -EINVAL Any parameter points to NULL
5432 * @retval -EINVAL Memory slab is NULL
5472 * is a multiple of the specified power-of-two alignment value in
5499 * Allocated memory is aligned on a multiple of pointer sizes.
5523 * Allocated memory is aligned on a multiple of pointer sizes.
5548 * Reallocated memory is aligned on a multiple of pointer sizes.
5577 /* Hand-calculated minimum heap sizes needed to return a successful
5578 * 1-byte allocation. See details in lib/os/heap.[ch]
5590 * Note that this macro enforces a minimum size on the memory region
5616 * Note that this macro enforces a minimum size on the memory region
5634 * Note that this macro enforces a minimum size on the memory region
5659 * difference is that k_aligned_alloc() accepts any non-zero @p size,
5665 * The aligned_alloc function (p: 347-348)
5679 * Allocated memory is aligned on a multiple of pointer sizes.
5733 /* polling API - PRIVATE */
5736 #define _INIT_OBJ_POLL_EVENT(obj) do { (obj)->poll_event = NULL; } while (false)
5741 /* private - types bit positions */
5764 #define Z_POLL_TYPE_BIT(type) (1U << ((type) - 1U))
5766 /* private - states bit positions */
5777 /* data is available to read on queue/FIFO/LIFO */
5783 /* data is available to read on a message queue */
5792 #define Z_POLL_STATE_BIT(state) (1U << ((state) - 1U))
5795 (32 - (0 \
5802 /* end of polling API - PRIVATE */
5813 /* public - values for k_poll_event.type bitfield */
5822 /* public - polling modes */
5830 /* public - values for k_poll_event.state bitfield */
5840 /* public - poll signal object */
5842 /** PRIVATE - DO NOT TOUCH */
5866 /** PRIVATE - DO NOT TOUCH */
5869 /** PRIVATE - DO NOT TOUCH */
5872 /** optional user-specified tag, opaque, untouched by the API */
5875 /** bitfield of event types (bitwise-ORed K_POLL_TYPE_xxx values) */
5878 /** bitfield of event states (bitwise-ORed K_POLL_STATE_xxx values) */
5884 /** unused bits in 32-bit word */
5887 /** per-type data */
5932 * After this routine is called on a poll event, the event it ready to be
5957 * all threads trying to acquire an object the regular way, i.e. by pending on
5958 * the object, have precedence over the thread polling on the object. This
5959 * means that the polling thread will never get the poll event on an object
5964 * When k_poll() returns 0, the caller should loop on all the events that were
5980 * @retval -EAGAIN Waiting period timed out.
5981 * @retval -EINTR Polling has been interrupted, e.g. with
5984 * words, -EINTR status means that at least one of output events is
5986 * @retval -ENOMEM Thread resource pool insufficient memory (user mode only)
5987 * @retval -EINVAL Bad parameters (user mode only)
6027 * type K_POLL_TYPE_SIGNAL. If a thread was polling on that event, it will be
6044 * @retval -EAGAIN The polling thread's timeout is in the process of expiring.
6063 * However, in some more constrained systems, such as a single-threaded system,
6079 * Enabling interrupts and entering a low-power mode will be atomic,
6081 * the processor enters a low-power mode.
6083 * After waking up from the low-power mode, the interrupt lockout state will
6192 * Some architectures apply restrictions on how the disabling of floating
6201 * @retval 0 On success.
6202 * @retval -ENOTSUP If the floating point disabling is not implemented.
6203 * -EINVAL If the floating point disabling could not be performed.
6227 * - K_FP_REGS indicates x87 FPU and MMX registers only
6228 * - K_SSE_REGS indicates SSE registers (and also x87 FPU and MMX registers)
6231 * Some architectures apply restrictions on how the enabling of floating
6241 * @retval 0 On success.
6242 * @retval -ENOTSUP If the floating point enabling is not implemented.
6243 * -EINVAL If the floating point enabling could not be performed.
6256 * @return -EINVAL if null pointers, otherwise 0
6265 * @return -EINVAL if null pointers, otherwise 0
6270 * @brief Get the runtime statistics of all threads on specified cpu
6274 * @return -EINVAL if null pointers, otherwise 0
6285 * @return -EINVAL if invalid thread ID, otherwise 0
6296 * @return -EINVAL if invalid thread ID, otherwise 0