Lines Matching refs:lock
359 void __retarget_lock_init(_LOCK_T *lock) in __retarget_lock_init() argument
361 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_init()
365 *lock = malloc(sizeof(struct k_sem)); in __retarget_lock_init()
367 *lock = k_object_alloc(K_OBJ_SEM); in __retarget_lock_init()
369 __ASSERT(*lock != NULL, "non-recursive lock allocation failed"); in __retarget_lock_init()
371 k_sem_init((struct k_sem *)*lock, 1, 1); in __retarget_lock_init()
375 void __retarget_lock_init_recursive(_LOCK_T *lock) in __retarget_lock_init_recursive() argument
377 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_init_recursive()
381 *lock = malloc(sizeof(struct k_mutex)); in __retarget_lock_init_recursive()
383 *lock = k_object_alloc(K_OBJ_MUTEX); in __retarget_lock_init_recursive()
385 __ASSERT(*lock != NULL, "recursive lock allocation failed"); in __retarget_lock_init_recursive()
387 k_mutex_init((struct k_mutex *)*lock); in __retarget_lock_init_recursive()
391 void __retarget_lock_close(_LOCK_T lock) in __retarget_lock_close() argument
393 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_close()
395 free(lock); in __retarget_lock_close()
397 k_object_release(lock); in __retarget_lock_close()
402 void __retarget_lock_close_recursive(_LOCK_T lock) in __retarget_lock_close_recursive() argument
404 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_close_recursive()
406 free(lock); in __retarget_lock_close_recursive()
408 k_object_release(lock); in __retarget_lock_close_recursive()
413 void __retarget_lock_acquire(_LOCK_T lock) in __retarget_lock_acquire() argument
415 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_acquire()
416 k_sem_take((struct k_sem *)lock, K_FOREVER); in __retarget_lock_acquire()
420 void __retarget_lock_acquire_recursive(_LOCK_T lock) in __retarget_lock_acquire_recursive() argument
422 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_acquire_recursive()
423 k_mutex_lock((struct k_mutex *)lock, K_FOREVER); in __retarget_lock_acquire_recursive()
427 int __retarget_lock_try_acquire(_LOCK_T lock) in __retarget_lock_try_acquire() argument
429 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_try_acquire()
430 return !k_sem_take((struct k_sem *)lock, K_NO_WAIT); in __retarget_lock_try_acquire()
434 int __retarget_lock_try_acquire_recursive(_LOCK_T lock) in __retarget_lock_try_acquire_recursive() argument
436 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_try_acquire_recursive()
437 return !k_mutex_lock((struct k_mutex *)lock, K_NO_WAIT); in __retarget_lock_try_acquire_recursive()
441 void __retarget_lock_release(_LOCK_T lock) in __retarget_lock_release() argument
443 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_release()
444 k_sem_give((struct k_sem *)lock); in __retarget_lock_release()
448 void __retarget_lock_release_recursive(_LOCK_T lock) in __retarget_lock_release_recursive() argument
450 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_release_recursive()
451 k_mutex_unlock((struct k_mutex *)lock); in __retarget_lock_release_recursive()