/* Take the ticker API semaphore (if applicable) and wait for operation complete. 
In case of synchronous ticker operation, the result is already known at entry, and semaphore is only taken if ret_cb has been updated. This is done to balance take/give counts. If *ret_cb is still TICKER_STATUS_BUSY, but ret is not, the ticker operation has failed early, and no callback will be invoked. In this case the semaphore shall not be taken. */
uint32_t ull_ticker_status_take(uint32_t ret, uint32_t volatile *ret_cb)
/* Take the ticker API semaphore (if applicable) and wait for operation complete. 
In case of synchronous ticker operation, the result is already known at entry, and semaphore is only taken if ret_cb has been updated. This is done to balance take/give counts. If *ret_cb is still TICKER_STATUS_BUSY, but ret is not, the ticker operation has failed early, and no callback will be invoked. In this case the semaphore shall not be taken. */
uint32_t ull_ticker_status_take(uint32_t ret, uint32_t volatile *ret_cb)
{
	if ((ret == TICKER_STATUS_BUSY) || (*ret_cb != TICKER_STATUS_BUSY)) {
		k_sem_take(&sem_ticker_api_cb, K_FOREVER);
		return *ret_cb;
	}
	return ret;
}