Home
last modified time | relevance | path

Searched refs:semaphore (Results 1 – 25 of 73) sorted by relevance

123

/Zephyr-Core-3.7.0/subsys/portability/cmsis_rtos_v2/
Dsemaphore.c27 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 …]
DCMakeLists.txt15 semaphore.c
/Zephyr-Core-3.7.0/subsys/portability/cmsis_rtos_v1/
Dcmsis_semaphore.c20 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-Core-3.7.0/doc/kernel/services/synchronization/
Dsemaphores.rst6 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-Core-3.7.0/include/zephyr/posix/
Dsemaphore.h18 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-Core-3.7.0/lib/posix/options/
Dsemaphore.c84 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 …]
DKconfig.semaphore6 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-Core-3.7.0/subsys/rtio/
DKconfig10 bool "Use a semaphore when waiting for completions in rtio_submit"
12 When calling rtio_submit a semaphore is available to sleep the calling
14 adds a small RAM overhead for a single semaphore. By default wait_for will
18 bool "Use a semaphore when waiting for completions in rtio_cqe_consume_block"
20 When calling rtio_cqe_consume_block a semaphore is available to sleep the
22 This adds a small RAM overhead for a single semaphore. By default the call
/Zephyr-Core-3.7.0/tests/kernel/semaphore/semaphore/src/
Dmain.c100 void isr_sem_give(const void *semaphore) in isr_sem_give() argument
102 k_sem_give((struct k_sem *)semaphore); in isr_sem_give()
128 void isr_sem_take(const void *semaphore) in isr_sem_take() argument
130 int ret = k_sem_take((struct k_sem *)semaphore, K_NO_WAIT); in isr_sem_take()
235 ZTEST_USER(semaphore, test_k_sem_define) in ZTEST_USER() argument
247 ZTEST_USER(semaphore, test_sem_thread2thread) in ZTEST_USER() argument
262 ZTEST(semaphore, test_sem_thread2isr) in ZTEST() argument
281 ZTEST_USER(semaphore, test_k_sem_init) in ZTEST_USER() argument
300 ZTEST_USER(semaphore, test_sem_reset) in ZTEST_USER() argument
325 ZTEST_USER(semaphore, test_sem_reset_waiting) in ZTEST_USER() argument
[all …]
/Zephyr-Core-3.7.0/samples/subsys/sip_svc/src/
Dmain.c23 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-Core-3.7.0/tests/posix/common/
DKconfig28 int "Number of loops in semaphore test"
32 This option is specific to semaphore.test_named_semaphore in semaphore.c
/Zephyr-Core-3.7.0/tests/benchmarks/latency_measure/
DREADME.rst11 * Time to signal a semaphore then test that semaphore
12 * Time to signal a semaphore then test that semaphore with a context switch
94semaphore.give.immediate.kernel - Give a semaphore (no waiters) : …
95semaphore.take.immediate.kernel - Take a semaphore (no blocking) : …
96semaphore.take.blocking.k_to_k - Take a semaphore (context switch) : …
97semaphore.give.wake+ctx.k_to_k - Give a semaphore (context switch) : …
200semaphore.give.immediate.kernel - Give a semaphore (no waiters) : …
201semaphore.take.immediate.kernel - Take a semaphore (no blocking) : …
202semaphore.give.immediate.user - Give a semaphore (no waiters) : …
203semaphore.take.immediate.user - Take a semaphore (no blocking) : …
[all …]
/Zephyr-Core-3.7.0/modules/hal_infineon/abstraction-rtos/source/COMPONENT_ZEPHYR/
Dcyabs_rtos_zephyr.c414 cy_rslt_t cy_rtos_init_semaphore(cy_semaphore_t *semaphore, uint32_t maxcount, uint32_t initcount) in cy_rtos_init_semaphore() argument
419 if (semaphore == NULL) { in cy_rtos_init_semaphore()
423 status_internal = k_sem_init(semaphore, initcount, maxcount); in cy_rtos_init_semaphore()
430 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
437 if (semaphore == NULL) { in cy_rtos_get_semaphore()
455 status_internal = k_sem_take(semaphore, k_timeout); in cy_rtos_get_semaphore()
466 cy_rslt_t cy_rtos_set_semaphore(cy_semaphore_t *semaphore, bool in_isr) in cy_rtos_set_semaphore() argument
472 if (semaphore == NULL) { in cy_rtos_set_semaphore()
476 k_sem_give(semaphore); in cy_rtos_set_semaphore()
482 cy_rslt_t cy_rtos_get_count_semaphore(cy_semaphore_t *semaphore, size_t *count) in cy_rtos_get_count_semaphore() argument
[all …]
/Zephyr-Core-3.7.0/tests/subsys/sip_svc/src/
Dmain.c25 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-Core-3.7.0/samples/cpp/cpp_synchronization/src/
Dmain.cpp29 class semaphore { class
50 class cpp_semaphore: public semaphore {
/Zephyr-Core-3.7.0/tests/kernel/mem_protect/sys_sem/src/
Dmain.c36 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-Core-3.7.0/tests/kernel/semaphore/semaphore/
DCMakeLists.txt5 project(semaphore) project
/Zephyr-Core-3.7.0/tests/kernel/semaphore/sys_sem/
DCMakeLists.txt5 project(semaphore) project
/Zephyr-Core-3.7.0/drivers/mbox/
DKconfig.stm32_hsem8 MBOX Driver for STM32 hardware semaphore
/Zephyr-Core-3.7.0/doc/kernel/services/threads/
Dsystem_threads.rst67 /* initialize a semaphore */
70 /* register an ISR that gives the semaphore */
73 /* monitor the semaphore forever */
75 /* wait for the semaphore to be given by the ISR */
/Zephyr-Core-3.7.0/samples/cpp/cpp_synchronization/
DREADME.rst36 Create semaphore 0x001042b0
37 Create semaphore 0x001042c4
/Zephyr-Core-3.7.0/subsys/sip_svc/
Dsip_svc_agilex_mailbox_shell.c21 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()
Dsip_svc_shell.c18 struct k_sem semaphore; member
201 k_sem_give(&(priv->semaphore)); in cmd_send_callback()
317 k_sem_init(&(priv.semaphore), 0, 1); in cmd_send()
332 k_sem_take(&(priv.semaphore), K_FOREVER); in cmd_send()
/Zephyr-Core-3.7.0/doc/kernel/services/
Dpolling.rst25 - 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
211 signal to a poll event. This can be seen as a lightweight binary semaphore only
215 must be attached to a k_poll_event, similar to a semaphore or FIFO. It must
319 Use a poll signal as a lightweight binary semaphore if only one thread pends on
/Zephyr-Core-3.7.0/tests/posix/common/src/
Dsemaphore.c93 ZTEST(semaphore, test_semaphore) in ZTEST() argument
144 ZTEST(semaphore, test_named_semaphore) in ZTEST() argument
324 ZTEST_SUITE(semaphore, NULL, NULL, before, NULL, NULL);

123