device: rename 'caller' field of device_sync_call_t
Rename it to 'waiter', since 'caller' is ambiguous from the point of view of the _complete() API, since it is not the 'caller' in that case. Change-Id: Ib3cadba99195935d67153023d731be26ffa58679 Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
parent
99a4f13bbc
commit
42a97c8b1d
1 changed files with 8 additions and 8 deletions
|
@ -110,7 +110,7 @@ typedef struct {
|
|||
/** Microkernel semaphore used for task context */
|
||||
struct _k_sem_struct _t_sem;
|
||||
ksem_t t_sem;
|
||||
bool caller_is_task;
|
||||
bool waiter_is_task;
|
||||
#endif
|
||||
} device_sync_call_t;
|
||||
|
||||
|
@ -127,7 +127,7 @@ static inline void device_sync_call_init(device_sync_call_t *sync)
|
|||
sync->_t_sem.waiters = NULL;
|
||||
sync->_t_sem.level = sync->_t_sem.count = 0;
|
||||
sync->t_sem = (ksem_t)&sync->_t_sem;
|
||||
sync->caller_is_task = false;
|
||||
sync->waiter_is_task = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -144,24 +144,24 @@ static inline void device_sync_call_wait(device_sync_call_t *sync)
|
|||
{
|
||||
if ((sys_execution_context_type_get() == NANO_CTX_TASK) &&
|
||||
(task_priority_get() < CONFIG_NUM_TASK_PRIORITIES - 1)) {
|
||||
sync->caller_is_task = true;
|
||||
sync->waiter_is_task = true;
|
||||
task_sem_take(sync->t_sem, TICKS_UNLIMITED);
|
||||
} else {
|
||||
sync->caller_is_task = false;
|
||||
sync->waiter_is_task = false;
|
||||
nano_sem_take(&sync->f_sem, TICKS_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Signal the caller about synchronization completion
|
||||
* Note: In a microkernel built this function will take care of the caller
|
||||
* @brief Signal the waiter about synchronization completion
|
||||
* Note: In a microkernel built this function will take care of the waiter
|
||||
* context and thus use the right attribute to signale the completion.
|
||||
*
|
||||
* @param sync A pointer to a valid device_sync_call_t
|
||||
*/
|
||||
static inline void device_sync_call_complete(device_sync_call_t *sync)
|
||||
{
|
||||
if (sync->caller_is_task) {
|
||||
if (sync->waiter_is_task) {
|
||||
task_sem_give(sync->t_sem);
|
||||
} else {
|
||||
nano_isr_sem_give(&sync->f_sem);
|
||||
|
@ -182,7 +182,7 @@ static inline void device_sync_call_wait(device_sync_call_t *sync)
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Signal the caller about synchronization completion
|
||||
* @brief Signal the waiter about synchronization completion
|
||||
* Note: It will simply release the internal semaphore
|
||||
*
|
||||
* @param sync A pointer to a valid device_sync_call_t
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue