/Zephyr-latest/subsys/portability/cmsis_rtos_v2/ |
D | semaphore.c | 27 struct cv2_sem *semaphore; in osSemaphoreNew() local 38 (void **)&semaphore, K_MSEC(100)) == 0) { in osSemaphoreNew() 39 (void)memset(semaphore, 0, sizeof(struct cv2_sem)); in osSemaphoreNew() 44 k_sem_init(&semaphore->z_semaphore, initial_count, max_count); in osSemaphoreNew() 47 strncpy(semaphore->name, init_sema_attrs.name, in osSemaphoreNew() 48 sizeof(semaphore->name) - 1); in osSemaphoreNew() 50 strncpy(semaphore->name, attr->name, in osSemaphoreNew() 51 sizeof(semaphore->name) - 1); in osSemaphoreNew() 54 return (osSemaphoreId_t)semaphore; in osSemaphoreNew() 62 struct cv2_sem *semaphore = (struct cv2_sem *) semaphore_id; in osSemaphoreAcquire() local [all …]
|
D | CMakeLists.txt | 15 semaphore.c
|
/Zephyr-latest/subsys/portability/cmsis_rtos_v1/ |
D | cmsis_semaphore.c | 20 struct k_sem *semaphore; in osSemaphoreCreate() local 31 (void **)&semaphore, K_MSEC(100)) == 0) { in osSemaphoreCreate() 32 (void)memset(semaphore, 0, sizeof(struct k_sem)); in osSemaphoreCreate() 37 k_sem_init(semaphore, count, count); in osSemaphoreCreate() 39 return (osSemaphoreId)semaphore; in osSemaphoreCreate() 47 struct k_sem *semaphore = (struct k_sem *) semaphore_id; in osSemaphoreWait() local 59 status = k_sem_take(semaphore, K_FOREVER); in osSemaphoreWait() 61 status = k_sem_take(semaphore, K_NO_WAIT); in osSemaphoreWait() 63 status = k_sem_take(semaphore, K_MSEC(timeout)); in osSemaphoreWait() 71 return k_sem_count_get(semaphore) + 1; in osSemaphoreWait() [all …]
|
/Zephyr-latest/doc/kernel/services/synchronization/ |
D | semaphores.rst | 6 A :dfn:`semaphore` is a kernel object that implements a traditional 7 counting semaphore. 17 semaphore is referenced by its memory address. 19 A semaphore has the following key properties: 21 * A **count** that indicates the number of times the semaphore can be taken. 22 A count of zero indicates that the semaphore is unavailable. 24 * A **limit** that indicates the maximum value the semaphore's count 27 A semaphore must be initialized before it can be used. Its count must be set 30 A semaphore may be **given** by a thread or an ISR. Giving the semaphore 33 A semaphore may be **taken** by a thread. Taking the semaphore [all …]
|
/Zephyr-latest/include/zephyr/posix/ |
D | semaphore.h | 18 int sem_destroy(sem_t *semaphore); 19 int sem_getvalue(sem_t *ZRESTRICT semaphore, int *ZRESTRICT value); 20 int sem_init(sem_t *semaphore, int pshared, unsigned int value); 21 int sem_post(sem_t *semaphore); 22 int sem_timedwait(sem_t *ZRESTRICT semaphore, struct timespec *ZRESTRICT abstime); 23 int sem_trywait(sem_t *semaphore); 24 int sem_wait(sem_t *semaphore);
|
/Zephyr-latest/lib/posix/options/ |
D | semaphore.c | 84 int sem_destroy(sem_t *semaphore) in sem_destroy() argument 86 if (semaphore == NULL) { in sem_destroy() 91 if (k_sem_count_get(semaphore)) { in sem_destroy() 96 k_sem_reset(semaphore); in sem_destroy() 105 int sem_getvalue(sem_t *semaphore, int *value) in sem_getvalue() argument 107 if (semaphore == NULL) { in sem_getvalue() 112 *value = (int) k_sem_count_get(semaphore); in sem_getvalue() 121 int sem_init(sem_t *semaphore, int pshared, unsigned int value) in sem_init() argument 134 k_sem_init(semaphore, value, CONFIG_POSIX_SEM_VALUE_MAX); in sem_init() 144 int sem_post(sem_t *semaphore) in sem_post() argument [all …]
|
D | Kconfig.semaphore | 6 bool "POSIX semaphore support" 8 Enable this option for POSIX semaphore support. 13 int "Maximum semaphore value" 17 Maximum semaphore count in POSIX compliant Application. 29 int "Maximum semaphore name length" 33 Maximum length of name for a named semaphore.
|
/Zephyr-latest/tests/posix/semaphores/ |
D | Kconfig | 5 int "Number of loops in semaphore test" 9 This option is specific to semaphore.test_named_semaphore in semaphore.c
|
/Zephyr-latest/subsys/rtio/ |
D | Kconfig | 10 bool "Use a semaphore when waiting for completions in rtio_submit" 14 When calling rtio_submit a semaphore is available to sleep the calling 16 adds a small RAM overhead for a single semaphore. By default wait_for will 22 bool "Use a semaphore when waiting for completions in rtio_cqe_consume_block" 26 When calling rtio_cqe_consume_block a semaphore is available to sleep the 28 This adds a small RAM overhead for a single semaphore. By default the call
|
/Zephyr-latest/tests/kernel/semaphore/semaphore/src/ |
D | main.c | 108 void isr_sem_give(const void *semaphore) in isr_sem_give() argument 110 k_sem_give((struct k_sem *)semaphore); in isr_sem_give() 136 void isr_sem_take(const void *semaphore) in isr_sem_take() argument 138 int ret = k_sem_take((struct k_sem *)semaphore, K_NO_WAIT); in isr_sem_take() 243 ZTEST_USER(semaphore, test_k_sem_define) in ZTEST_USER() argument 255 ZTEST_USER(semaphore, test_sem_thread2thread) in ZTEST_USER() argument 270 ZTEST(semaphore, test_sem_thread2isr) in ZTEST() argument 289 ZTEST_USER(semaphore, test_k_sem_init) in ZTEST_USER() argument 308 ZTEST_USER(semaphore, test_sem_reset) in ZTEST_USER() argument 333 ZTEST_USER(semaphore, test_sem_reset_waiting) in ZTEST_USER() argument [all …]
|
/Zephyr-latest/samples/subsys/sip_svc/src/ |
D | main.c | 23 struct k_sem semaphore; member 42 k_sem_give(&(priv->semaphore)); in get_voltage_callback() 67 k_sem_init(&(priv.semaphore), 0, 1); in main() 101 err = k_sem_take(&(priv.semaphore), K_FOREVER); in main()
|
/Zephyr-latest/tests/posix/common/ |
D | Kconfig | 28 int "Number of loops in semaphore test" 32 This option is specific to semaphore.test_named_semaphore in semaphore.c
|
/Zephyr-latest/modules/hal_infineon/abstraction-rtos/source/COMPONENT_ZEPHYR/ |
D | cyabs_rtos_zephyr.c | 411 cy_rslt_t cy_rtos_init_semaphore(cy_semaphore_t *semaphore, uint32_t maxcount, uint32_t initcount) in cy_rtos_init_semaphore() argument 416 if (semaphore == NULL) { in cy_rtos_init_semaphore() 420 status_internal = k_sem_init(semaphore, initcount, maxcount); in cy_rtos_init_semaphore() 427 cy_rslt_t cy_rtos_get_semaphore(cy_semaphore_t *semaphore, cy_time_t timeout_ms, bool in_isr) in cy_rtos_get_semaphore() argument 434 if (semaphore == NULL) { in cy_rtos_get_semaphore() 452 status_internal = k_sem_take(semaphore, k_timeout); in cy_rtos_get_semaphore() 463 cy_rslt_t cy_rtos_set_semaphore(cy_semaphore_t *semaphore, bool in_isr) in cy_rtos_set_semaphore() argument 469 if (semaphore == NULL) { in cy_rtos_set_semaphore() 473 k_sem_give(semaphore); in cy_rtos_set_semaphore() 479 cy_rslt_t cy_rtos_get_count_semaphore(cy_semaphore_t *semaphore, size_t *count) in cy_rtos_get_count_semaphore() argument [all …]
|
/Zephyr-latest/tests/subsys/sip_svc/src/ |
D | main.c | 25 struct k_sem semaphore; member 44 k_sem_give(&(priv->semaphore)); in get_sync_callback() 70 k_sem_init(&(priv.semaphore), 0, 1); in sip_svc_send_sync_request() 80 err = k_sem_take(&(priv.semaphore), K_FOREVER); in sip_svc_send_sync_request() 109 k_sem_give(&(priv->semaphore)); in get_async_callback() 144 k_sem_init(&(priv.semaphore), 0, 1); in sip_svc_send_async_request() 164 err = k_sem_take(&(priv.semaphore), K_FOREVER); in sip_svc_send_async_request()
|
/Zephyr-latest/tests/benchmarks/latency_measure/ |
D | README.rst | 11 * Time to signal a semaphore then test that semaphore 12 * Time to signal a semaphore then test that semaphore with a context switch 94 …semaphore.give.immediate.kernel - Give a semaphore (no waiters) : … 95 …semaphore.take.immediate.kernel - Take a semaphore (no blocking) : … 96 …semaphore.take.blocking.k_to_k - Take a semaphore (context switch) : … 97 …semaphore.give.wake+ctx.k_to_k - Give a semaphore (context switch) : … 147 …semaphore.give.immediate.kernel - Give a semaphore (no waiters) : … 148 …semaphore.take.immediate.kernel - Take a semaphore (no blocking) : … 149 …semaphore.take.blocking.k_to_k - Take a semaphore (context switch) : … 150 …semaphore.give.wake+ctx.k_to_k - Give a semaphore (context switch) : … [all …]
|
/Zephyr-latest/samples/cpp/cpp_synchronization/src/ |
D | main.cpp | 29 class semaphore { class 50 class cpp_semaphore: public semaphore {
|
/Zephyr-latest/tests/kernel/mem_protect/sys_sem/src/ |
D | main.c | 36 static void isr_sem_give(const void *semaphore) in isr_sem_give() argument 38 sys_sem_give((struct sys_sem *)semaphore); in isr_sem_give() 41 static void isr_sem_take(const void *semaphore) in isr_sem_take() argument 43 sys_sem_take((struct sys_sem *)semaphore, K_NO_WAIT); in isr_sem_take() 46 static void sem_give_from_isr(void *semaphore) in sem_give_from_isr() argument 48 irq_offload(isr_sem_give, (const void *)semaphore); in sem_give_from_isr() 51 static void sem_take_from_isr(void *semaphore) in sem_take_from_isr() argument 53 irq_offload(isr_sem_take, (const void *)semaphore); in sem_take_from_isr()
|
/Zephyr-latest/tests/kernel/semaphore/semaphore/ |
D | CMakeLists.txt | 5 project(semaphore) project
|
/Zephyr-latest/tests/kernel/semaphore/sys_sem/ |
D | CMakeLists.txt | 5 project(semaphore) project
|
/Zephyr-latest/drivers/mbox/ |
D | Kconfig.stm32_hsem | 8 MBOX Driver for STM32 hardware semaphore
|
/Zephyr-latest/doc/kernel/services/threads/ |
D | system_threads.rst | 68 /* initialize a semaphore */ 71 /* register an ISR that gives the semaphore */ 74 /* monitor the semaphore forever */ 76 /* wait for the semaphore to be given by the ISR */
|
/Zephyr-latest/samples/cpp/cpp_synchronization/ |
D | README.rst | 36 Create semaphore 0x001042b0 37 Create semaphore 0x001042c4
|
/Zephyr-latest/subsys/sip_svc/ |
D | sip_svc_agilex_mailbox_shell.c | 21 struct k_sem semaphore; member 198 k_sem_give(&(priv->semaphore)); in cmd_send_callback() 300 k_sem_init(&(priv.semaphore), 0, 1); in cmd_send() 325 if (!k_sem_take(&(priv.semaphore), timeout)) { in cmd_send()
|
/Zephyr-latest/doc/kernel/services/ |
D | polling.rst | 25 - a semaphore becomes available 60 the poll event states that the semaphore is available, the caller of 62 ownership of the semaphore. If the semaphore is contested, there is no 145 A list of pollers is offered on each semaphore or FIFO and as many events 155 // assume there is no contention on this semaphore and FIFO 156 // -EADDRINUSE will not occur; the semaphore and/or data will be available 214 signal to a poll event. This can be seen as a lightweight binary semaphore only 218 must be attached to a k_poll_event, similar to a semaphore or FIFO. It must 322 Use a poll signal as a lightweight binary semaphore if only one thread pends on
|
/Zephyr-latest/tests/benchmarks/thread_metric/ |
D | Kconfig | 39 posting a semaphore. The thread then increments its own counter and 40 takes that semaphore. The sum total of the counters is reported 80 thread can give and take a semaphore without blocking. This number
|