Lines Matching refs:lock
374 void __retarget_lock_init(_LOCK_T *lock) in __retarget_lock_init() argument
376 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_init()
380 *lock = malloc(sizeof(struct k_sem)); in __retarget_lock_init()
382 *lock = k_object_alloc(K_OBJ_SEM); in __retarget_lock_init()
384 __ASSERT(*lock != NULL, "non-recursive lock allocation failed"); in __retarget_lock_init()
386 k_sem_init((struct k_sem *)*lock, 1, 1); in __retarget_lock_init()
388 k_object_access_all_grant(*lock); in __retarget_lock_init()
393 void __retarget_lock_init_recursive(_LOCK_T *lock) in __retarget_lock_init_recursive() argument
395 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_init_recursive()
399 *lock = malloc(sizeof(struct k_mutex)); in __retarget_lock_init_recursive()
401 *lock = k_object_alloc(K_OBJ_MUTEX); in __retarget_lock_init_recursive()
403 __ASSERT(*lock != NULL, "recursive lock allocation failed"); in __retarget_lock_init_recursive()
405 k_mutex_init((struct k_mutex *)*lock); in __retarget_lock_init_recursive()
407 k_object_access_all_grant(*lock); in __retarget_lock_init_recursive()
412 void __retarget_lock_close(_LOCK_T lock) in __retarget_lock_close() argument
414 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_close()
416 free(lock); in __retarget_lock_close()
418 k_object_release(lock); in __retarget_lock_close()
423 void __retarget_lock_close_recursive(_LOCK_T lock) in __retarget_lock_close_recursive() argument
425 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_close_recursive()
427 free(lock); in __retarget_lock_close_recursive()
429 k_object_release(lock); in __retarget_lock_close_recursive()
434 void __retarget_lock_acquire(_LOCK_T lock) in __retarget_lock_acquire() argument
436 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_acquire()
437 k_sem_take((struct k_sem *)lock, K_FOREVER); in __retarget_lock_acquire()
441 void __retarget_lock_acquire_recursive(_LOCK_T lock) in __retarget_lock_acquire_recursive() argument
443 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_acquire_recursive()
444 k_mutex_lock((struct k_mutex *)lock, K_FOREVER); in __retarget_lock_acquire_recursive()
448 int __retarget_lock_try_acquire(_LOCK_T lock) in __retarget_lock_try_acquire() argument
450 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_try_acquire()
451 return !k_sem_take((struct k_sem *)lock, K_NO_WAIT); in __retarget_lock_try_acquire()
455 int __retarget_lock_try_acquire_recursive(_LOCK_T lock) in __retarget_lock_try_acquire_recursive() argument
457 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_try_acquire_recursive()
458 return !k_mutex_lock((struct k_mutex *)lock, K_NO_WAIT); in __retarget_lock_try_acquire_recursive()
462 void __retarget_lock_release(_LOCK_T lock) in __retarget_lock_release() argument
464 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_release()
465 k_sem_give((struct k_sem *)lock); in __retarget_lock_release()
469 void __retarget_lock_release_recursive(_LOCK_T lock) in __retarget_lock_release_recursive() argument
471 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_release_recursive()
472 k_mutex_unlock((struct k_mutex *)lock); in __retarget_lock_release_recursive()