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:
Benjamin Walsh 2016-01-26 15:40:16 -05:00 committed by Anas Nashif
commit 42a97c8b1d

View file

@ -110,7 +110,7 @@ typedef struct {
/** Microkernel semaphore used for task context */ /** Microkernel semaphore used for task context */
struct _k_sem_struct _t_sem; struct _k_sem_struct _t_sem;
ksem_t t_sem; ksem_t t_sem;
bool caller_is_task; bool waiter_is_task;
#endif #endif
} device_sync_call_t; } 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.waiters = NULL;
sync->_t_sem.level = sync->_t_sem.count = 0; sync->_t_sem.level = sync->_t_sem.count = 0;
sync->t_sem = (ksem_t)&sync->_t_sem; sync->t_sem = (ksem_t)&sync->_t_sem;
sync->caller_is_task = false; sync->waiter_is_task = false;
#endif #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) && if ((sys_execution_context_type_get() == NANO_CTX_TASK) &&
(task_priority_get() < CONFIG_NUM_TASK_PRIORITIES - 1)) { (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); task_sem_take(sync->t_sem, TICKS_UNLIMITED);
} else { } else {
sync->caller_is_task = false; sync->waiter_is_task = false;
nano_sem_take(&sync->f_sem, TICKS_NONE); nano_sem_take(&sync->f_sem, TICKS_NONE);
} }
} }
/** /**
* @brief Signal the caller about synchronization completion * @brief Signal the waiter about synchronization completion
* Note: In a microkernel built this function will take care of the caller * Note: In a microkernel built this function will take care of the waiter
* context and thus use the right attribute to signale the completion. * context and thus use the right attribute to signale the completion.
* *
* @param sync A pointer to a valid device_sync_call_t * @param sync A pointer to a valid device_sync_call_t
*/ */
static inline void device_sync_call_complete(device_sync_call_t *sync) 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); task_sem_give(sync->t_sem);
} else { } else {
nano_isr_sem_give(&sync->f_sem); 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 * Note: It will simply release the internal semaphore
* *
* @param sync A pointer to a valid device_sync_call_t * @param sync A pointer to a valid device_sync_call_t