/Zephyr-latest/doc/kernel/services/synchronization/ |
D | mutexes.rst | 21 A mutex has the following key properties: 23 * A **lock count** that indicates the number of times the mutex has been locked 24 by the thread that has locked it. A count of zero indicates that the mutex 27 * An **owning thread** that identifies the thread that has locked the mutex, 30 A mutex must be initialized before it can be used. This sets its lock count 39 for as long as needed; however, it is considered good practice to hold the lock 45 When the mutex becomes unlocked it is then locked by the highest-priority 46 thread that has waited the longest. 54 A thread is permitted to lock a mutex it has already locked. 65 The thread that has locked a mutex is eligible for :dfn:`priority inheritance`. [all …]
|
/Zephyr-latest/doc/connectivity/bluetooth/shell/audio/ |
D | csip.rst | 12 The client will typically be a resource-rich device, such as a smartphone 13 or a laptop. The client is able to lock and release members of a coordinated 14 set. While the coordinated set is locked, no other clients may lock the set. 16 To lock a set, the client must connect to each of the set members it wants to 17 lock. This implementation will always try to connect to all the members of 28 When the Bluetooth stack has been initialized (:code:`bt init`), 29 and a set member device has been connected, the call control client can be 34 Once the client has connected and discovered the handles, then it can 37 all the members has been connected to, it can lock and release the set. 43 .. code-block:: console [all …]
|
/Zephyr-latest/kernel/ |
D | pipes.c | 4 * SPDX-License-Identifier: Apache-2.0 41 pipe->buffer = buffer; in k_pipe_init() 42 pipe->size = size; in k_pipe_init() 43 pipe->bytes_used = 0U; in k_pipe_init() 44 pipe->read_index = 0U; in k_pipe_init() 45 pipe->write_index = 0U; in k_pipe_init() 46 pipe->lock = (struct k_spinlock){}; in k_pipe_init() 47 z_waitq_init(&pipe->wait_q.writers); in k_pipe_init() 48 z_waitq_init(&pipe->wait_q.readers); in k_pipe_init() 51 pipe->flags = 0; in k_pipe_init() [all …]
|
D | work.c | 4 * SPDX-License-Identifier: Apache-2.0 60 /* Lock to protect the internal state of all work items, work queues, 63 static struct k_spinlock lock; variable 70 struct k_work *work = &flusher->work; in init_flusher() 71 k_sem_init(&flusher->sem, 0, 1); in init_flusher() 72 k_work_init(&flusher->work, handle_flush); in init_flusher() 73 flag_set(&work->flags, K_WORK_FLUSHING_BIT); in init_flusher() 82 * Invoked with work lock held. 90 k_sem_init(&canceler->sem, 0, 1); in init_work_cancel() 91 canceler->work = work; in init_work_cancel() [all …]
|
D | timer.c | 2 * Copyright (c) 1997-2016 Wind River Systems, Inc. 4 * SPDX-License-Identifier: Apache-2.0 16 static struct k_spinlock lock; variable 31 k_spinlock_key_t key = k_spin_lock(&lock); in z_timer_expiration_handler() 40 * interrupt context that has a priority higher than the system timer in z_timer_expiration_handler() 46 if (sys_dnode_is_linked(&t->node)) { in z_timer_expiration_handler() 47 k_spin_unlock(&lock, key); in z_timer_expiration_handler() 55 if (!K_TIMEOUT_EQ(timer->period, K_NO_WAIT) && in z_timer_expiration_handler() 56 !K_TIMEOUT_EQ(timer->period, K_FOREVER)) { in z_timer_expiration_handler() 57 k_timeout_t next = timer->period; in z_timer_expiration_handler() [all …]
|
D | sem.c | 2 * Copyright (c) 2010-2016 Wind River Systems, Inc. 4 * SPDX-License-Identifier: Apache-2.0 32 /* We use a system-wide lock to synchronize semaphores, which has 33 * unfortunate performance impact vs. using a per-object lock 34 * (semaphores are *very* widely used). But per-object locks require 35 * significant extra RAM. A properly spin-aware semaphore 39 static struct k_spinlock lock; variable 52 SYS_PORT_TRACING_OBJ_FUNC(k_sem, init, sem, -EINVAL); in z_impl_k_sem_init() 54 return -EINVAL; in z_impl_k_sem_init() 57 sem->count = initial_count; in z_impl_k_sem_init() [all …]
|
D | Kconfig.smp | 2 # SPDX-License-Identifier: Apache-2.0 15 bool "Use new-style _arch_switch instead of arch_swap" 20 for an SMP-aware scheduler, or if the architecture does not 46 Maximum number of multiprocessing-capable cores available to the 75 to check if schedule IPI has called or not, for testing 92 IPIs to specific CPUs then this has the potential to significantly 105 where all shared data is placed in multiprocessor-coherent 109 running on cache-incoherent architectures only. Note that 117 bool "Ticket spinlocks for lock acquisition fairness [EXPERIMENTAL]" 124 in a live-lock. [all …]
|
/Zephyr-latest/include/zephyr/sys/ |
D | mutex.h | 4 * SPDX-License-Identifier: Apache-2.0 72 /* Nothing to do, kernel-side data structures are initialized at in sys_mutex_init() 83 * @brief Lock a mutex. 89 * A thread is permitted to lock a mutex it has already locked. The operation 90 * completes immediately and the lock count is increased by 1. 93 * @param timeout Waiting period to lock the mutex, 97 * @retval -EBUSY Returned without waiting. 98 * @retval -EAGAIN Waiting period timed out. 99 * @retval -EACCES Caller has no access to provided mutex address 100 * @retval -EINVAL Provided mutex not recognized by the kernel [all …]
|
/Zephyr-latest/include/zephyr/bluetooth/audio/ |
D | csip.h | 7 * Copyright (c) 2021-2024 Nordic Semiconductor ASA 9 * SPDX-License-Identifier: Apache-2.0 78 /** Invalid lock value */ 80 /** SIRK only available out-of-band */ 82 /** Client is already owner of the lock */ 101 * @brief Callback whenever the lock changes on the server. 103 * @param conn The connection to the client that changed the lock. 108 * @param locked Whether the lock was locked or released. 152 * Setting this to false will disable the lock characteristic. 246 * @param rsi Pointer to the 6-octet newly generated RSI data in little-endian. [all …]
|
/Zephyr-latest/doc/kernel/services/threads/ |
D | workqueue.rst | 13 used by an ISR or a high-priority thread to offload non-urgent processing 14 to a lower-priority thread so it does not impact time-sensitive processing. 19 A workqueue has the following key properties: 46 * The ability to wait until a work item has completed or a queue has been 76 to the workqueue's queue. Once the workqueue's thread has processed all of 88 if it started running before a thread has requested that it be cancelled. 119 A handler function is permitted to re-submit its work item argument 125 A pending work item *must not* be altered until the item has been processed 126 by the workqueue thread. This means a work item must not be re-initialized 129 the handler function has finished executing. [all …]
|
/Zephyr-latest/lib/os/zvfs/ |
D | zvfs_eventfd.c | 6 * SPDX-License-Identifier: Apache-2.0 23 struct k_spinlock lock; member 37 return (efd->flags & ZVFS_EFD_IN_USE) != 0; in zvfs_eventfd_is_in_use() 42 return (efd->flags & ZVFS_EFD_SEMAPHORE) != 0; in zvfs_eventfd_is_semaphore() 47 return (efd->flags & ZVFS_EFD_NONBLOCK) == 0; in zvfs_eventfd_is_blocking() 55 if (pfd->events & ZSOCK_POLLIN) { in zvfs_eventfd_poll_prepare() 58 return -1; in zvfs_eventfd_poll_prepare() 61 (*pev)->obj = &efd->read_sig; in zvfs_eventfd_poll_prepare() 62 (*pev)->type = K_POLL_TYPE_SIGNAL; in zvfs_eventfd_poll_prepare() 63 (*pev)->mode = K_POLL_MODE_NOTIFY_ONLY; in zvfs_eventfd_poll_prepare() [all …]
|
/Zephyr-latest/include/zephyr/ |
D | irq.h | 4 * SPDX-License-Identifier: Apache-2.0 14 /* Pull in the arch-specific implementations */ 39 * Although this routine is invoked at run-time, all of its arguments must be 46 * @param flags_p Architecture-specific IRQ configuration flags.. 60 * @param flags Arch-specific IRQ configuration flags 85 * @param flags Arch-specific IRQ configuration flags 105 * These ISRs are designed for performance-critical interrupt handling and do 112 * This type of interrupt currently has a few limitations compared to normal 114 * - No parameters are passed to the ISR. 115 * - No stack switch is done, the ISR will run on the interrupted context's [all …]
|
/Zephyr-latest/tests/kernel/sched/schedule_api/src/ |
D | test_sched_is_preempt_thread.c | 4 * SPDX-License-Identifier: Apache-2.0 26 /** TESTPOINT: The thread has locked the scheduler. */ in tpreempt_ctx() 29 /** TESTPOINT: The thread has not locked the scheduler. */ in tpreempt_ctx() 45 /** TESTPOINT: The thread has locked the scheduler. */ in tcoop_ctx() 48 /** TESTPOINT: The thread has not locked the scheduler. */ in tcoop_ctx() 58 * @details Create a preemptive thread, lock the scheduler 61 * thread and lock the scheduler k_is_preempt_thread() and
|
/Zephyr-latest/drivers/dma/ |
D | Kconfig.xilinx_axi_dma | 4 # SPDX-License-Identifier: Apache-2.0 15 bool "Disable data cache while accessing Scatter-Gather Descriptors." 19 Disable dcache while operating on Scatter-Gather descriptors. 29 The Xilinx AXI DMA uses a ring of in-memory DMA descriptors which reference 43 prompt "IRQs to lock when manipulating per-channel data structures during dma_start." 48 bool "Lock all IRQs" 50 Lock all interrupts (including, e.g., timers and scheduler) when modifying channel data 56 bool "Lock TX and RX IRQs" 58 Lock all interrupts of this DMA device when modifying channel data during dma_start. 63 bool "Lock IRQs of the DMA channel" [all …]
|
/Zephyr-latest/drivers/timer/ |
D | cortex_m_systick.c | 4 * SPDX-License-Identifier: Apache-2.0 20 #define MAX_TICKS ((k_ticks_t)(COUNTER_MAX / CYC_PER_TICK) - 1) 25 * reliably" -- it becomes the minimum value of the LOAD register, and 34 static struct k_spinlock lock; variable 61 * Additions/subtractions/comparisons of 64-bits values on 32-bits systems 63 * cycle_count and announced_cycles is stored in a 32-bit variable before 83 * It is used for chips that has to use a separate idle timer in such 84 * case because the Cortex-m SysTick is not clocked in the low power 100 * elapsed since the last time the absolute HW cycles counter has been 102 * re-program the SysTick.LOAD register, in sys_clock_set_timeout(). [all …]
|
D | arm_arch_timer.c | 4 * SPDX-License-Identifier: Apache-2.0 24 /* When interactively debugging, the cycle diff can overflow 32-bit variable */ 65 static struct k_spinlock lock; variable 78 k_spinlock_key_t key = k_spin_lock(&lock); in arm_arch_timer_compare_isr() 82 * Workaround required for Cortex-A9 MPCore erratum 740657 in arm_arch_timer_compare_isr() 83 * comp. ARM Cortex-A9 processors Software Developers Errata Notice, in arm_arch_timer_compare_isr() 93 k_spin_unlock(&lock, key); in arm_arch_timer_compare_isr() 99 uint64_t delta_cycles = curr_cycle - last_cycle; in arm_arch_timer_compare_isr() 127 * after this ISR has been executed) the error will be detected by the in arm_arch_timer_compare_isr() 128 * check performed upon entry of the ISR -> the event flag is not set, in arm_arch_timer_compare_isr() [all …]
|
D | arcv2_timer0.c | 2 * Copyright (c) 2014-2015 Wind River Systems, Inc. 5 * SPDX-License-Identifier: Apache-2.0 43 /* arc timer has 32 bit, here use 31 bit to avoid the possible 51 #define MAX_TICKS ((COUNTER_MAX / CYC_PER_TICK) - 1) 61 static struct k_spinlock lock; variable 159 * elapsed since the last time the absolute HW cycles counter has been 168 * - reprogramming of LIMIT must be clearing the COUNT 169 * - ISR must be clearing the 'overflow_cycles' counter. 170 * - no more than one counter-wrap has occurred between 171 * - the timer reset or the last time the function was called [all …]
|
D | mcux_gpt_timer.c | 4 * SPDX-License-Identifier: Apache-2.0 27 #define MAX_TICKS ((COUNTER_MAX / CYC_PER_TICK) - 1) 34 * Stores the current number of cycles the system has had announced to it, 49 /* Lock on shared variables */ 50 static struct k_spinlock lock; variable 59 GPT_SetOutputCompareValue(base, kGPT_OutputCompare_Channel2, next - 1); in gpt_set_safe() 70 if (unlikely(((int32_t)(next - now)) <= 1)) { in gpt_set_safe() 78 kGPT_OutputCompare_Channel2, next - 1); in gpt_set_safe() 80 } while ((((int32_t)(next - now)) <= 1) && (next < MAX_CYCLES)); in gpt_set_safe() 91 key = k_spin_lock(&lock); in mcux_imx_gpt_isr() [all …]
|
/Zephyr-latest/drivers/serial/ |
D | uart_altera.c | 4 * SPDX-License-Identifier: Apache-2.0 74 * indicate that the device has a fixed baud rate; i.e. if this flag is set 92 struct k_spinlock lock; member 134 * This is a non-blocking function. 139 * @return 0 if a character arrived, -1 if input buffer is empty. 140 * -EINVAL if p_char is null pointer 144 const struct uart_altera_device_config *config = dev->config; in uart_altera_poll_in() 145 struct uart_altera_device_data *data = dev->data; in uart_altera_poll_in() 146 int ret_val = -1; in uart_altera_poll_in() 154 return -EINVAL; in uart_altera_poll_in() [all …]
|
/Zephyr-latest/tests/kernel/spinlock/src/ |
D | main.c | 4 * SPDX-License-Identifier: Apache-2.0 51 zassert_true(z_spin_is_locked(&l), "Spinlock failed to lock"); in ZTEST() 64 /* Take the lock, check last owner and release if it was us. in bounce_once() 65 * Wait for us to get the lock "after" another CPU in bounce_once() 71 if (ret == -EBUSY) { in bounce_once() 93 zassert_true(locked, "Other cpu did not get lock in 10000 tries"); in bounce_once() 105 /* Release the lock */ in bounce_once() 150 * - Spinlocks can be initialized at run-time. 151 * - Spinlocks in uniprocessor context should achieve mutual exclusion using 168 zassert_true(z_spin_is_locked(&lock_runtime), "Spinlock failed to lock"); in ZTEST() [all …]
|
/Zephyr-latest/tests/boards/espressif/cache_coex/src/ |
D | cache_coex.c | 4 * SPDX-License-Identifier: Apache-2.0 39 static struct k_spinlock lock; variable 52 k_spinlock_key_t key = k_spin_lock(&lock); in buffer_fill() 56 k_spin_unlock(&lock, key); in buffer_fill() 84 TC_ERROR("flash erase has failed\n"); in do_erase() 121 TC_ERROR("flash read back has failed\n"); in page_read() 207 TC_ERROR("SPIRAM allocation has failed\n"); in psram_init() 227 k_spinlock_key_t key = k_spin_lock(&lock); in flash_test() 231 k_spin_unlock(&lock, key); in flash_test()
|
/Zephyr-latest/doc/kernel/services/smp/ |
D | smp.rst | 26 non-Zephyr code). 36 At the lowest level, however, Zephyr code has often used the 50 also atomically validates that a shared lock variable has been 52 needed to wait for the other CPU to exit the lock. The default Zephyr 54 on top of the pre-existing :c:struct:`atomic_` layer (itself usually 59 earlier API was naturally recursive: the lock was global, so it was 60 legal to acquire a nested lock inside of a critical section. 64 used recursively. Code that holds a specific lock must not try to 65 re-acquire it or it will deadlock (it is perfectly legal to nest 70 (the atomic lock variable) is unnecessary and elided. Except for the [all …]
|
/Zephyr-latest/subsys/pm/ |
D | device_runtime.c | 5 * SPDX-License-Identifier: Apache-2.0 17 (_pm)->domain 30 * @note Asynchronous operations are not supported when in pre-kernel mode. In 40 * @retval 0 If device has been suspended or queued for suspend. 41 * @retval -EALREADY If device is already suspended (can only happen if get/put 43 * @retval -EBUSY If the device is busy. 44 * @retval -errno Other negative errno, result of the action callback. 50 struct pm_device *pm = dev->pm; in runtime_suspend() 55 if (!atomic_test_bit(&pm->base.flags, PM_DEVICE_FLAG_RUNTIME_ENABLED)) { in runtime_suspend() 62 ret = k_sem_take(&pm->lock, k_is_in_isr() ? K_NO_WAIT : K_FOREVER); in runtime_suspend() [all …]
|
/Zephyr-latest/subsys/net/ip/ |
D | ipv4_acd.c | 6 * SPDX-License-Identifier: Apache-2.0 28 static K_MUTEX_DEFINE(lock); 96 struct net_if *iface = net_if_get_by_index(ifaddr->ifindex); in ipv4_acd_send_probe() 100 pkt = ipv4_acd_prepare_arp(iface, &unspecified, &ifaddr->address.in_addr); in ipv4_acd_send_probe() 113 struct net_if *iface = net_if_get_by_index(ifaddr->ifindex); in ipv4_acd_send_announcement() 116 pkt = ipv4_acd_prepare_arp(iface, &ifaddr->address.in_addr, in ipv4_acd_send_announcement() 117 &ifaddr->address.in_addr); in ipv4_acd_send_announcement() 138 if (sys_timepoint_cmp(ifaddr->acd_timeout, expiry) < 0) { in acd_timer_reschedule() 139 expiry = ifaddr->acd_timeout; in acd_timer_reschedule() 154 switch (ifaddr->acd_state) { in ipv4_acd_manage_timeout() [all …]
|
/Zephyr-latest/lib/os/ |
D | p4wq.c | 4 * SPDX-License-Identifier: Apache-2.0 22 th->base.prio = item->priority; in set_prio() 23 th->base.prio_deadline = item->deadline; in set_prio() 31 if (aw->priority != bw->priority) { in rb_lessthan() 32 return aw->priority > bw->priority; in rb_lessthan() 35 if (aw->deadline != bw->deadline) { in rb_lessthan() 36 return aw->deadline - bw->deadline > 0; in rb_lessthan() 44 th->base.user_options |= K_CALLBACK_STATE; in thread_set_requeued() 49 th->base.user_options &= ~K_CALLBACK_STATE; in thread_clear_requeued() 54 return !!(th->base.user_options & K_CALLBACK_STATE); in thread_was_requeued() [all …]
|