Lines Matching +full:lock +full:- +full:mode

4  * SPDX-License-Identifier: Apache-2.0
13 #include <zephyr/linker/linker-defs.h>
17 #include <zephyr/sys/libc-hooks.h>
29 int _open(const char *name, int mode);
43 * - HEAP_BASE base address of the heap arena
44 * - MAX_HEAP_SIZE size of the heap arena
59 /* Arena size expressed in Kconfig, due to power-of-two size/align
104 #define MAX_HEAP_SIZE (POINTER_TO_UINT(&_heap_sentry) - \
107 #define MAX_HEAP_SIZE (KB(CONFIG_SRAM_SIZE) - (HEAP_BASE - \
242 int _open(const char *name, int mode) in _open() argument
244 return -1; in _open()
250 return -1; in _close()
280 st->st_mode = S_IFCHR; in _fstat()
318 ret = (void *)-1; in _sbrk()
336 * Zephyr-side locks.
365 /* Initialise non-recursive locks */ in newlib_locks_prepare()
378 /* Create a new dynamic non-recursive lock */
379 void __retarget_lock_init(_LOCK_T *lock) in __retarget_lock_init() argument
381 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_init()
385 *lock = malloc(sizeof(struct k_sem)); in __retarget_lock_init()
387 *lock = k_object_alloc(K_OBJ_SEM); in __retarget_lock_init()
389 __ASSERT(*lock != NULL, "non-recursive lock allocation failed"); in __retarget_lock_init()
391 k_sem_init((struct k_sem *)*lock, 1, 1); in __retarget_lock_init()
393 k_object_access_all_grant(*lock); in __retarget_lock_init()
397 /* Create a new dynamic recursive lock */
398 void __retarget_lock_init_recursive(_LOCK_T *lock) in __retarget_lock_init_recursive() argument
400 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_init_recursive()
404 *lock = malloc(sizeof(struct k_mutex)); in __retarget_lock_init_recursive()
406 *lock = k_object_alloc(K_OBJ_MUTEX); in __retarget_lock_init_recursive()
408 __ASSERT(*lock != NULL, "recursive lock allocation failed"); in __retarget_lock_init_recursive()
410 k_mutex_init((struct k_mutex *)*lock); in __retarget_lock_init_recursive()
412 k_object_access_all_grant(*lock); in __retarget_lock_init_recursive()
416 /* Close dynamic non-recursive lock */
417 void __retarget_lock_close(_LOCK_T lock) in __retarget_lock_close() argument
419 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_close()
421 free(lock); in __retarget_lock_close()
423 k_object_release(lock); in __retarget_lock_close()
427 /* Close dynamic recursive lock */
428 void __retarget_lock_close_recursive(_LOCK_T lock) in __retarget_lock_close_recursive() argument
430 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_close_recursive()
432 free(lock); in __retarget_lock_close_recursive()
434 k_object_release(lock); in __retarget_lock_close_recursive()
438 /* Acquiure non-recursive lock */
439 void __retarget_lock_acquire(_LOCK_T lock) in __retarget_lock_acquire() argument
441 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_acquire()
442 k_sem_take((struct k_sem *)lock, K_FOREVER); in __retarget_lock_acquire()
445 /* Acquiure recursive lock */
446 void __retarget_lock_acquire_recursive(_LOCK_T lock) in __retarget_lock_acquire_recursive() argument
448 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_acquire_recursive()
449 k_mutex_lock((struct k_mutex *)lock, K_FOREVER); in __retarget_lock_acquire_recursive()
452 /* Try acquiring non-recursive lock */
453 int __retarget_lock_try_acquire(_LOCK_T lock) in __retarget_lock_try_acquire() argument
455 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_try_acquire()
456 return !k_sem_take((struct k_sem *)lock, K_NO_WAIT); in __retarget_lock_try_acquire()
459 /* Try acquiring recursive lock */
460 int __retarget_lock_try_acquire_recursive(_LOCK_T lock) in __retarget_lock_try_acquire_recursive() argument
462 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_try_acquire_recursive()
463 return !k_mutex_lock((struct k_mutex *)lock, K_NO_WAIT); in __retarget_lock_try_acquire_recursive()
466 /* Release non-recursive lock */
467 void __retarget_lock_release(_LOCK_T lock) in __retarget_lock_release() argument
469 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_release()
470 k_sem_give((struct k_sem *)lock); in __retarget_lock_release()
473 /* Release recursive lock */
474 void __retarget_lock_release_recursive(_LOCK_T lock) in __retarget_lock_release_recursive() argument
476 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_release_recursive()
477 k_mutex_unlock((struct k_mutex *)lock); in __retarget_lock_release_recursive()
493 _write(2, chk_fail_msg, sizeof(chk_fail_msg) - 1); in __chk_fail()
516 int _open_r(struct _reent *r, const char *name, int flags, int mode) in _open_r() argument
521 return _open(name, mode); in _open_r()
586 /* Non-posix systems should not call gettimeofday() here as it will in _gettimeofday()
589 return -1; in _gettimeofday()