[Cbe-oss-dev] [PATCH 20/22]MARS/task: Code style cleanup
Yuji Mano
yuji.mano at am.sony.com
Fri Jan 23 12:27:10 EST 2009
This cleans up task library implementation for ease of legibility and
maintenance.
Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>
---
task/include/host/mars/task.h | 10 +++---
task/include/host/mars/task_barrier.h | 4 +-
task/include/host/mars/task_event_flag.h | 8 ++---
task/include/host/mars/task_queue.h | 8 ++---
task/include/host/mars/task_semaphore.h | 4 +-
task/include/mpu/mars/task.h | 2 -
task/include/mpu/mars/task_event_flag.h | 8 ++---
task/include/mpu/mars/task_queue.h | 4 +-
task/src/host/lib/task.c | 47 +++++++++++++++++--------------
task/src/host/lib/task_barrier.c | 11 +++----
task/src/host/lib/task_event_flag.c | 27 +++++++++--------
task/src/host/lib/task_queue.c | 41 +++++++++++++++------------
task/src/host/lib/task_semaphore.c | 11 +++----
task/src/mpu/lib/task.c | 4 +-
task/src/mpu/lib/task_barrier.c | 10 +++---
task/src/mpu/lib/task_event_flag.c | 28 +++++++++---------
task/src/mpu/lib/task_queue.c | 24 ++++++++-------
task/src/mpu/lib/task_semaphore.c | 4 +-
18 files changed, 137 insertions(+), 118 deletions(-)
--- a/task/include/host/mars/task.h
+++ b/task/include/host/mars/task.h
@@ -129,10 +129,10 @@ extern "C" {
* \n MARS_ERROR_LIMIT - task queue is currently full
*/
int mars_task_create(struct mars_context *mars,
- struct mars_task_id *id,
- const char *name,
- const void *elf_image,
- const struct mars_task_context_save_unit *save_units);
+ struct mars_task_id *id,
+ const char *name,
+ const void *elf_image,
+ const struct mars_task_context_save_unit *save_units);
/**
* \ingroup group_mars_task
@@ -159,7 +159,7 @@ int mars_task_destroy(struct mars_task_i
* \ingroup group_mars_task
*/
int mars_task_schedule(struct mars_task_id *id, struct mars_task_args *args,
- uint8_t priority);
+ uint8_t priority);
/**
* \ingroup group_mars_task
--- a/task/include/host/mars/task_barrier.h
+++ b/task/include/host/mars/task_barrier.h
@@ -78,8 +78,8 @@ extern "C" {
* \n MARS_ERROR_PARAMS - total is 0 or exceeds allowed limit
*/
int mars_task_barrier_create(struct mars_context *mars,
- uint64_t *barrier_ea,
- uint32_t total);
+ uint64_t *barrier_ea,
+ uint32_t total);
/**
* \ingroup group_mars_task_barrier
--- a/task/include/host/mars/task_event_flag.h
+++ b/task/include/host/mars/task_event_flag.h
@@ -121,15 +121,15 @@ int mars_task_event_flag_set(uint64_t ev
* \ingroup group_mars_task_event_flag
*/
int mars_task_event_flag_wait(uint64_t event_flag_ea,
- uint32_t mask, uint8_t mask_mode,
- uint32_t *bits);
+ uint32_t mask, uint8_t mask_mode,
+ uint32_t *bits);
/**
* \ingroup group_mars_task_event_flag
*/
int mars_task_event_flag_try_wait(uint64_t event_flag_ea,
- uint32_t mask, uint8_t mask_mode,
- uint32_t *bits);
+ uint32_t mask, uint8_t mask_mode,
+ uint32_t *bits);
#if defined(__cplusplus)
}
--- a/task/include/host/mars/task_queue.h
+++ b/task/include/host/mars/task_queue.h
@@ -95,10 +95,10 @@ extern "C" {
* \n MARS_ERROR_PARAMS - invalid direction specified
*/
int mars_task_queue_create(struct mars_context *mars,
- uint64_t *queue_ea,
- uint32_t size,
- uint32_t depth,
- uint8_t direction);
+ uint64_t *queue_ea,
+ uint32_t size,
+ uint32_t depth,
+ uint8_t direction);
/**
* \ingroup group_mars_task_queue
--- a/task/include/host/mars/task_semaphore.h
+++ b/task/include/host/mars/task_semaphore.h
@@ -77,8 +77,8 @@ extern "C" {
* \n MARS_ERROR_PARAMS - count exceeds allowed limit
*/
int mars_task_semaphore_create(struct mars_context *mars,
- uint64_t *semaphore_ea,
- int32_t count);
+ uint64_t *semaphore_ea,
+ int32_t count);
/**
* \ingroup group_mars_task_semaphore
--- a/task/include/mpu/mars/task.h
+++ b/task/include/mpu/mars/task.h
@@ -163,7 +163,7 @@ int mars_task_yield(void);
* \n MARS_ERROR_STATE - task is in an invalid state
*/
int mars_task_schedule(struct mars_task_id *id, struct mars_task_args *args,
- uint8_t priority);
+ uint8_t priority);
/**
* \ingroup group_mars_task
--- a/task/include/mpu/mars/task_event_flag.h
+++ b/task/include/mpu/mars/task_event_flag.h
@@ -145,8 +145,8 @@ int mars_task_event_flag_set(uint64_t ev
* \n MARS_ERROR_FORMAT - no context save area specified
*/
int mars_task_event_flag_wait(uint64_t event_flag_ea,
- uint32_t mask, uint8_t mask_mode,
- uint32_t *bits);
+ uint32_t mask, uint8_t mask_mode,
+ uint32_t *bits);
/**
* \ingroup group_mars_task_event_flag
@@ -190,8 +190,8 @@ int mars_task_event_flag_wait(uint64_t e
* \n MARS_ERROR_BUSY - event not yet received
*/
int mars_task_event_flag_try_wait(uint64_t event_flag_ea,
- uint32_t mask, uint8_t mask_mode,
- uint32_t *bits);
+ uint32_t mask, uint8_t mask_mode,
+ uint32_t *bits);
#if defined(__cplusplus)
}
--- a/task/include/mpu/mars/task_queue.h
+++ b/task/include/mpu/mars/task_queue.h
@@ -161,7 +161,7 @@ int mars_task_queue_push(uint64_t queue_
* \n MARS_ERROR_FORMAT - no context save area specified
*/
int mars_task_queue_push_begin(uint64_t queue_ea, const void *data,
- uint32_t tag);
+ uint32_t tag);
/**
* \ingroup group_mars_task_queue
@@ -255,7 +255,7 @@ int mars_task_queue_try_push(uint64_t qu
* \n MARS_ERROR_PARAMS - invalid tag
*/
int mars_task_queue_try_push_begin(uint64_t queue_ea, const void *data,
- uint32_t tag);
+ uint32_t tag);
/**
* \ingroup group_mars_task_queue
--- a/task/src/host/lib/task.c
+++ b/task/src/host/lib/task.c
@@ -64,9 +64,9 @@ static uint64_t task_exit_code_ea(uint64
}
int mars_task_create(struct mars_context *mars,
- struct mars_task_id *id_ret,
- const char *name, const void *elf_image,
- const struct mars_task_context_save_unit *context_save_unit)
+ struct mars_task_id *id_ret,
+ const char *name, const void *elf_image,
+ const struct mars_task_context_save_unit *context_save_unit)
{
int ret;
@@ -101,8 +101,8 @@ int mars_task_create(struct mars_context
((void *)ehdr_task + ehdr_task->e_phoff);
if (phdr_module->p_type != PT_LOAD || phdr_task->p_type != PT_LOAD ||
- phdr_module->p_vaddr != MARS_WORKLOAD_MODULE_BASE_ADDR ||
- phdr_task->p_vaddr != MARS_TASK_BASE_ADDR)
+ phdr_module->p_vaddr != MARS_WORKLOAD_MODULE_BASE_ADDR ||
+ phdr_task->p_vaddr != MARS_TASK_BASE_ADDR)
return MARS_ERROR_FORMAT;
/* begin process to add the task to the workload queue */
@@ -112,13 +112,14 @@ int mars_task_create(struct mars_context
/* prepare work area for task context */
task = mars_ea_work_area_get(workload_ea,
- MARS_TASK_CONTEXT_ALIGN, MARS_TASK_CONTEXT_SIZE);
+ MARS_TASK_CONTEXT_ALIGN,
+ MARS_TASK_CONTEXT_SIZE);
/* initialize the module elf parameters */
task->module.exec_size = phdr_module->p_filesz;
task->module.exec_ea =
mars_ea_map((void *)ehdr_module + phdr_module->p_offset,
- task->module.exec_size);
+ task->module.exec_size);
if (!task->module.exec_ea) {
ret = MARS_ERROR_MEMORY;
goto error_map_module;
@@ -157,8 +158,8 @@ int mars_task_create(struct mars_context
while (p->size) {
/* check for valid addr/size alignment and high addr boundary */
if (p->addr & MARS_TASK_CONTEXT_SAVE_UNIT_ADDR_ALIGN_MASK ||
- p->size & MARS_TASK_CONTEXT_SAVE_UNIT_SIZE_ALIGN_MASK ||
- p->addr + p->size > MARS_TASK_CONTEXT_SAVE_SIZE_MAX) {
+ p->size & MARS_TASK_CONTEXT_SAVE_UNIT_SIZE_ALIGN_MASK ||
+ p->addr + p->size > MARS_TASK_CONTEXT_SAVE_SIZE_MAX) {
ret = MARS_ERROR_PARAMS;
goto error_context_save_unit_addr_align;
}
@@ -180,17 +181,19 @@ int mars_task_create(struct mars_context
}
/* allocate context save unit storage */
- task->context_save_unit_ea = mars_ea_memalign(
- MARS_TASK_CONTEXT_SAVE_UNIT_ALIGN,
- context_save_unit_count * MARS_TASK_CONTEXT_SAVE_UNIT_SIZE);
+ task->context_save_unit_ea =
+ mars_ea_memalign(MARS_TASK_CONTEXT_SAVE_UNIT_ALIGN,
+ MARS_TASK_CONTEXT_SAVE_UNIT_SIZE *
+ context_save_unit_count);
if (!task->context_save_unit_ea) {
ret = MARS_ERROR_MEMORY;
goto error_malloc_context_save_unit;
}
/* allocate context save area */
- task->context_save_area_ea = mars_ea_memalign(
- MARS_TASK_CONTEXT_SAVE_ALIGN, context_save_area_size);
+ task->context_save_area_ea =
+ mars_ea_memalign(MARS_TASK_CONTEXT_SAVE_ALIGN,
+ context_save_area_size);
if (!task->context_save_area_ea) {
ret = MARS_ERROR_MEMORY;
goto error_malloc_context_save_area;
@@ -198,8 +201,8 @@ int mars_task_create(struct mars_context
/* copy the context save struct into allocated storage */
mars_ea_put(task->context_save_unit_ea,
- context_save_unit,
- context_save_unit_count * MARS_TASK_CONTEXT_SAVE_UNIT_SIZE);
+ context_save_unit,
+ context_save_unit_count * MARS_TASK_CONTEXT_SAVE_UNIT_SIZE);
done:
/* update task context on EA */
@@ -250,13 +253,14 @@ int mars_task_destroy(struct mars_task_i
/* begin process to remove the task from the workload queue */
ret = mars_workload_queue_remove_begin(mars, id->workload_id,
- &workload_ea);
+ &workload_ea);
if (ret != MARS_SUCCESS)
return ret;
/* prepare work area for task context */
task = mars_ea_work_area_get(workload_ea,
- MARS_TASK_CONTEXT_ALIGN, MARS_TASK_CONTEXT_SIZE);
+ MARS_TASK_CONTEXT_ALIGN,
+ MARS_TASK_CONTEXT_SIZE);
/* get task context from EA */
mars_ea_get(workload_ea, task, MARS_TASK_CONTEXT_SIZE);
@@ -282,7 +286,7 @@ int mars_task_destroy(struct mars_task_i
}
int mars_task_schedule(struct mars_task_id *id, struct mars_task_args *args,
- uint8_t priority)
+ uint8_t priority)
{
int ret;
struct mars_context *mars;
@@ -300,13 +304,14 @@ int mars_task_schedule(struct mars_task_
/* begin process to schedule the workload in the workload queue */
ret = mars_workload_queue_schedule_begin(mars, id->workload_id,
- priority, &workload_ea);
+ priority, &workload_ea);
if (ret != MARS_SUCCESS)
return ret;
/* prepare work area for task context */
task = mars_ea_work_area_get(workload_ea,
- MARS_TASK_CONTEXT_ALIGN, MARS_TASK_CONTEXT_SIZE);
+ MARS_TASK_CONTEXT_ALIGN,
+ MARS_TASK_CONTEXT_SIZE);
/* get task context from EA */
mars_ea_get(workload_ea, task, MARS_TASK_CONTEXT_SIZE);
--- a/task/src/host/lib/task_barrier.c
+++ b/task/src/host/lib/task_barrier.c
@@ -46,8 +46,8 @@
#include "task_barrier_internal_types.h"
int mars_task_barrier_create(struct mars_context *mars,
- uint64_t *barrier_ea_ret,
- uint32_t total)
+ uint64_t *barrier_ea_ret,
+ uint32_t total)
{
struct mars_task_barrier *barrier;
uint64_t barrier_ea;
@@ -61,14 +61,15 @@ int mars_task_barrier_create(struct mars
return MARS_ERROR_PARAMS;
/* allocate barrier instance */
- barrier_ea = mars_ea_memalign(
- MARS_TASK_BARRIER_ALIGN, MARS_TASK_BARRIER_SIZE);
+ barrier_ea = mars_ea_memalign(MARS_TASK_BARRIER_ALIGN,
+ MARS_TASK_BARRIER_SIZE);
if (!barrier_ea)
return MARS_ERROR_MEMORY;
/* prepare work area for initialization */
barrier = mars_ea_work_area_get(barrier_ea,
- MARS_TASK_BARRIER_ALIGN, MARS_TASK_BARRIER_SIZE);
+ MARS_TASK_BARRIER_ALIGN,
+ MARS_TASK_BARRIER_SIZE);
/* initialize barrier instance on work area */
barrier->mars_context_ea = mars_ptr_to_ea(mars);
--- a/task/src/host/lib/task_event_flag.c
+++ b/task/src/host/lib/task_event_flag.c
@@ -53,7 +53,7 @@
static inline uint64_t event_flag_bits_ea(uint64_t event_flag_ea)
{
return event_flag_ea +
- offsetof(struct mars_task_event_flag, bits);
+ offsetof(struct mars_task_event_flag, bits);
}
int mars_task_event_flag_create(struct mars_context *mars,
@@ -78,14 +78,15 @@ int mars_task_event_flag_create(struct m
return MARS_ERROR_PARAMS;
/* allocate event flag instance */
- event_flag_ea = mars_ea_memalign(
- MARS_TASK_EVENT_FLAG_ALIGN, MARS_TASK_EVENT_FLAG_SIZE);
+ event_flag_ea = mars_ea_memalign(MARS_TASK_EVENT_FLAG_ALIGN,
+ MARS_TASK_EVENT_FLAG_SIZE);
if (!event_flag_ea)
return MARS_ERROR_MEMORY;
/* prepare work area for initialization */
event_flag = mars_ea_work_area_get(event_flag_ea,
- MARS_TASK_EVENT_FLAG_ALIGN, MARS_TASK_EVENT_FLAG_SIZE);
+ MARS_TASK_EVENT_FLAG_ALIGN,
+ MARS_TASK_EVENT_FLAG_SIZE);
/* intialize event flag instance on work area */
event_flag->mars_context_ea = mars_ptr_to_ea(mars);
@@ -151,7 +152,8 @@ int mars_task_event_flag_set(uint64_t ev
/* prepare work area */
event_flag = mars_ea_work_area_get(event_flag_ea,
- MARS_TASK_EVENT_FLAG_ALIGN, MARS_TASK_EVENT_FLAG_SIZE);
+ MARS_TASK_EVENT_FLAG_ALIGN,
+ MARS_TASK_EVENT_FLAG_SIZE);
/* get event flag from EA */
mars_mutex_lock_get(event_flag_ea, (struct mars_mutex *)event_flag);
@@ -183,14 +185,14 @@ int mars_task_event_flag_set(uint64_t ev
break;
case MARS_TASK_EVENT_FLAG_MASK_AND:
if ((bits & event_flag->wait_mask[i]) !=
- event_flag->wait_mask[i])
+ event_flag->wait_mask[i])
continue;
break;
}
/* signal the task to go to ready state */
ret = mars_workload_queue_signal_send(mars,
- event_flag->wait_id[i]);
+ event_flag->wait_id[i]);
if (ret != MARS_SUCCESS)
goto end;
@@ -243,7 +245,8 @@ static int wait(uint64_t event_flag_ea,
/* prepare work area */
event_flag = mars_ea_work_area_get(event_flag_ea,
- MARS_TASK_EVENT_FLAG_ALIGN, MARS_TASK_EVENT_FLAG_SIZE);
+ MARS_TASK_EVENT_FLAG_ALIGN,
+ MARS_TASK_EVENT_FLAG_SIZE);
/* get event flag from EA */
mars_mutex_lock_get(event_flag_ea, (struct mars_mutex *)event_flag);
@@ -315,15 +318,15 @@ end:
}
int mars_task_event_flag_wait(uint64_t event_flag_ea,
- uint32_t mask, uint8_t mask_mode,
- uint32_t *bits)
+ uint32_t mask, uint8_t mask_mode,
+ uint32_t *bits)
{
return wait(event_flag_ea, mask, mask_mode, bits, 0);
}
int mars_task_event_flag_try_wait(uint64_t event_flag_ea,
- uint32_t mask, uint8_t mask_mode,
- uint32_t *bits)
+ uint32_t mask, uint8_t mask_mode,
+ uint32_t *bits)
{
return wait(event_flag_ea, mask, mask_mode, bits, 1);
}
--- a/task/src/host/lib/task_queue.c
+++ b/task/src/host/lib/task_queue.c
@@ -55,10 +55,10 @@ static inline uint64_t queue_count_ea(ui
}
int mars_task_queue_create(struct mars_context *mars,
- uint64_t *queue_ea_ret,
- uint32_t size,
- uint32_t depth,
- uint8_t direction)
+ uint64_t *queue_ea_ret,
+ uint32_t size,
+ uint32_t depth,
+ uint8_t direction)
{
struct mars_task_queue *queue;
uint64_t queue_ea;
@@ -74,23 +74,24 @@ int mars_task_queue_create(struct mars_c
if (size > MARS_TASK_QUEUE_ENTRY_SIZE_MAX)
return MARS_ERROR_PARAMS;
if (direction != MARS_TASK_QUEUE_HOST_TO_MPU &&
- direction != MARS_TASK_QUEUE_MPU_TO_HOST &&
- direction != MARS_TASK_QUEUE_MPU_TO_MPU)
+ direction != MARS_TASK_QUEUE_MPU_TO_HOST &&
+ direction != MARS_TASK_QUEUE_MPU_TO_MPU)
return MARS_ERROR_PARAMS;
/* allocate queue instance */
- queue_ea = mars_ea_memalign(
- MARS_TASK_QUEUE_ALIGN, MARS_TASK_QUEUE_SIZE);
+ queue_ea = mars_ea_memalign(MARS_TASK_QUEUE_ALIGN,
+ MARS_TASK_QUEUE_SIZE);
if (!queue_ea)
return MARS_ERROR_MEMORY;
/* prepare work area for initialization */
queue = mars_ea_work_area_get(queue_ea,
- MARS_TASK_QUEUE_ALIGN, MARS_TASK_QUEUE_SIZE);
+ MARS_TASK_QUEUE_ALIGN,
+ MARS_TASK_QUEUE_SIZE);
/* allocate queue buffer instance */
- buffer_ea = mars_ea_memalign(
- MARS_TASK_QUEUE_BUFFER_ALIGN, size * depth);
+ buffer_ea = mars_ea_memalign(MARS_TASK_QUEUE_BUFFER_ALIGN,
+ size * depth);
if (!buffer_ea) {
mars_ea_free(queue_ea);
return MARS_ERROR_MEMORY;
@@ -130,7 +131,8 @@ int mars_task_queue_destroy(uint64_t que
/* prepare work area */
queue = mars_ea_work_area_get(queue_ea,
- MARS_TASK_QUEUE_ALIGN, MARS_TASK_QUEUE_SIZE);
+ MARS_TASK_QUEUE_ALIGN,
+ MARS_TASK_QUEUE_SIZE);
mars_ea_get(queue_ea, queue, MARS_TASK_QUEUE_SIZE);
@@ -176,7 +178,8 @@ int mars_task_queue_clear(uint64_t queue
/* prepare work area */
queue = mars_ea_work_area_get(queue_ea,
- MARS_TASK_QUEUE_ALIGN, MARS_TASK_QUEUE_SIZE);
+ MARS_TASK_QUEUE_ALIGN,
+ MARS_TASK_QUEUE_SIZE);
mars_mutex_lock_get(queue_ea, (struct mars_mutex *)queue);
@@ -211,7 +214,8 @@ static void push_update(struct mars_task
/* flush id from pop wait list */
queue->pop_wait_count--;
- memmove(&queue->pop_wait_id[0], &queue->pop_wait_id[1],
+ memmove(&queue->pop_wait_id[0],
+ &queue->pop_wait_id[1],
sizeof(uint16_t) * queue->pop_wait_count);
}
@@ -247,7 +251,8 @@ static int push(uint64_t queue_ea, const
/* prepare work area */
queue = mars_ea_work_area_get(queue_ea,
- MARS_TASK_QUEUE_ALIGN, MARS_TASK_QUEUE_SIZE);
+ MARS_TASK_QUEUE_ALIGN,
+ MARS_TASK_QUEUE_SIZE);
mars_mutex_lock_get(queue_ea, (struct mars_mutex *)queue);
@@ -306,7 +311,8 @@ static void pop_update(struct mars_task_
/* flush id from push wait list */
queue->push_wait_count--;
- memmove(&queue->push_wait_id[0], &queue->push_wait_id[1],
+ memmove(&queue->push_wait_id[0],
+ &queue->push_wait_id[1],
sizeof(uint16_t) * queue->push_wait_count);
}
@@ -341,7 +347,8 @@ static int pop(uint64_t queue_ea, void *
/* prepare work area */
queue = mars_ea_work_area_get(queue_ea,
- MARS_TASK_QUEUE_ALIGN, MARS_TASK_QUEUE_SIZE);
+ MARS_TASK_QUEUE_ALIGN,
+ MARS_TASK_QUEUE_SIZE);
mars_mutex_lock_get(queue_ea, (struct mars_mutex *)queue);
--- a/task/src/host/lib/task_semaphore.c
+++ b/task/src/host/lib/task_semaphore.c
@@ -48,8 +48,8 @@
#include "task_semaphore_internal_types.h"
int mars_task_semaphore_create(struct mars_context *mars,
- uint64_t *semaphore_ea_ret,
- int32_t count)
+ uint64_t *semaphore_ea_ret,
+ int32_t count)
{
struct mars_task_semaphore *semaphore;
uint64_t semaphore_ea;
@@ -61,14 +61,15 @@ int mars_task_semaphore_create(struct ma
return MARS_ERROR_NULL;
/* allocate semaphore instance */
- semaphore_ea = mars_ea_memalign(
- MARS_TASK_SEMAPHORE_ALIGN, MARS_TASK_SEMAPHORE_SIZE);
+ semaphore_ea = mars_ea_memalign(MARS_TASK_SEMAPHORE_ALIGN,
+ MARS_TASK_SEMAPHORE_SIZE);
if (!semaphore_ea)
return MARS_ERROR_MEMORY;
/* prepare work area for initialization */
semaphore = mars_ea_work_area_get(semaphore_ea,
- MARS_TASK_SEMAPHORE_ALIGN, MARS_TASK_SEMAPHORE_SIZE);
+ MARS_TASK_SEMAPHORE_ALIGN,
+ MARS_TASK_SEMAPHORE_SIZE);
/* initialize semaphore instance */
semaphore->mars_context_ea = mars_ptr_to_ea(mars);
--- a/task/src/mpu/lib/task.c
+++ b/task/src/mpu/lib/task.c
@@ -48,7 +48,7 @@
const struct mars_task_module_syscalls *mars_task_module_syscalls;
int main(const struct mars_task_args *args,
- const struct mars_task_module_syscalls *module_syscalls)
+ const struct mars_task_module_syscalls *module_syscalls)
{
struct mars_task_context *task;
@@ -98,7 +98,7 @@ int mars_task_yield(void)
}
int mars_task_schedule(struct mars_task_id *id, struct mars_task_args *args,
- uint8_t priority)
+ uint8_t priority)
{
/* check function params */
if (!id)
--- a/task/src/mpu/lib/task_barrier.c
+++ b/task/src/mpu/lib/task_barrier.c
@@ -74,14 +74,14 @@ static int notify(uint64_t barrier_ea, i
/* only try so return busy */
if (try) {
mars_mutex_unlock_put(barrier_ea,
- (struct mars_mutex *)&barrier);
+ (struct mars_mutex *)&barrier);
return MARS_ERROR_BUSY;
}
/* check if barrier notify wait limit reached */
if (barrier.notify_wait_count == barrier.total) {
mars_mutex_unlock_put(barrier_ea,
- (struct mars_mutex *)&barrier);
+ (struct mars_mutex *)&barrier);
return MARS_ERROR_LIMIT;
}
@@ -151,14 +151,14 @@ static int wait(uint64_t barrier_ea, int
/* only try so return busy */
if (try) {
mars_mutex_unlock_put(barrier_ea,
- (struct mars_mutex *)&barrier);
+ (struct mars_mutex *)&barrier);
return MARS_ERROR_BUSY;
}
/* check if barrier wait limit reached */
if (barrier.wait_count == barrier.total) {
mars_mutex_unlock_put(barrier_ea,
- (struct mars_mutex *)&barrier);
+ (struct mars_mutex *)&barrier);
return MARS_ERROR_LIMIT;
}
@@ -167,7 +167,7 @@ static int wait(uint64_t barrier_ea, int
barrier.wait_count++;
mars_mutex_unlock_put(barrier_ea,
- (struct mars_mutex *)&barrier);
+ (struct mars_mutex *)&barrier);
/* wait for signal */
(*mars_task_module_syscalls->signal_wait)();
--- a/task/src/mpu/lib/task_event_flag.c
+++ b/task/src/mpu/lib/task_event_flag.c
@@ -84,9 +84,9 @@ int mars_task_event_flag_set(uint64_t ev
/* check for valid direction */
if (event_flag.direction != MARS_TASK_EVENT_FLAG_MPU_TO_HOST &&
- event_flag.direction != MARS_TASK_EVENT_FLAG_MPU_TO_MPU) {
+ event_flag.direction != MARS_TASK_EVENT_FLAG_MPU_TO_MPU) {
mars_mutex_unlock_put(event_flag_ea,
- (struct mars_mutex *)&event_flag);
+ (struct mars_mutex *)&event_flag);
return MARS_ERROR_STATE;
}
@@ -167,9 +167,9 @@ static int wait(uint64_t event_flag_ea,u
/* check for valid direction */
if (event_flag.direction != MARS_TASK_EVENT_FLAG_HOST_TO_MPU &&
- event_flag.direction != MARS_TASK_EVENT_FLAG_MPU_TO_MPU) {
+ event_flag.direction != MARS_TASK_EVENT_FLAG_MPU_TO_MPU) {
mars_mutex_unlock_put(event_flag_ea,
- (struct mars_mutex *)&event_flag);
+ (struct mars_mutex *)&event_flag);
return MARS_ERROR_STATE;
}
@@ -189,32 +189,32 @@ static int wait(uint64_t event_flag_ea,u
/* only try so return busy */
if (try) {
mars_mutex_unlock_put(event_flag_ea,
- (struct mars_mutex *)&event_flag);
+ (struct mars_mutex *)&event_flag);
return MARS_ERROR_BUSY;
}
/* check if event flag wait limit reached */
if (event_flag.wait_count == MARS_TASK_EVENT_FLAG_WAIT_MAX) {
mars_mutex_unlock_put(event_flag_ea,
- (struct mars_mutex *)&event_flag);
+ (struct mars_mutex *)&event_flag);
return MARS_ERROR_LIMIT;
}
/* add id to wait list */
- event_flag.wait_id[event_flag.wait_count]
- = task->id.workload_id;
+ event_flag.wait_id[event_flag.wait_count] =
+ task->id.workload_id;
event_flag.wait_mask[event_flag.wait_count] = mask;
event_flag.wait_mask_mode[event_flag.wait_count] = mask_mode;
event_flag.wait_count++;
mars_mutex_unlock_put(event_flag_ea,
- (struct mars_mutex *)&event_flag);
+ (struct mars_mutex *)&event_flag);
/* wait for signal */
(*mars_task_module_syscalls->signal_wait)();
mars_mutex_lock_get(event_flag_ea,
- (struct mars_mutex *)&event_flag);
+ (struct mars_mutex *)&event_flag);
}
/* return bits if requested */
@@ -231,15 +231,15 @@ static int wait(uint64_t event_flag_ea,u
}
int mars_task_event_flag_wait(uint64_t event_flag_ea,
- uint32_t mask, uint8_t mask_mode,
- uint32_t *bits)
+ uint32_t mask, uint8_t mask_mode,
+ uint32_t *bits)
{
return wait(event_flag_ea, mask, mask_mode, bits, 0);
}
int mars_task_event_flag_try_wait(uint64_t event_flag_ea,
- uint32_t mask, uint8_t mask_mode,
- uint32_t *bits)
+ uint32_t mask, uint8_t mask_mode,
+ uint32_t *bits)
{
return wait(event_flag_ea, mask, mask_mode, bits, 1);
}
--- a/task/src/mpu/lib/task_queue.c
+++ b/task/src/mpu/lib/task_queue.c
@@ -127,7 +127,8 @@ static void push_update(uint64_t queue_e
/* flush id from pop wait list */
queue.pop_wait_count--;
- memmove(&queue.pop_wait_id[0], &queue.pop_wait_id[1],
+ memmove(&queue.pop_wait_id[0],
+ &queue.pop_wait_id[1],
sizeof(uint16_t) * queue.pop_wait_count);
}
@@ -168,7 +169,7 @@ static int push(uint64_t queue_ea, const
/* check for valid direction */
if (queue.direction != MARS_TASK_QUEUE_MPU_TO_HOST &&
- queue.direction != MARS_TASK_QUEUE_MPU_TO_MPU) {
+ queue.direction != MARS_TASK_QUEUE_MPU_TO_MPU) {
mars_mutex_unlock_put(queue_ea, (struct mars_mutex *)&queue);
return MARS_ERROR_STATE;
}
@@ -178,14 +179,14 @@ static int push(uint64_t queue_ea, const
/* only try so return busy */
if (try) {
mars_mutex_unlock_put(queue_ea,
- (struct mars_mutex *)&queue);
+ (struct mars_mutex *)&queue);
return MARS_ERROR_BUSY;
}
/* check if push wait list full */
if (queue.push_wait_count == MARS_TASK_QUEUE_WAIT_MAX) {
mars_mutex_unlock_put(queue_ea,
- (struct mars_mutex *)&queue);
+ (struct mars_mutex *)&queue);
return MARS_ERROR_LIMIT;
}
@@ -226,7 +227,7 @@ int mars_task_queue_push(uint64_t queue_
}
int mars_task_queue_push_begin(uint64_t queue_ea, const void *data,
- uint32_t tag)
+ uint32_t tag)
{
return push(queue_ea, data, 0, 1, tag);
}
@@ -258,7 +259,7 @@ int mars_task_queue_try_push(uint64_t qu
}
int mars_task_queue_try_push_begin(uint64_t queue_ea, const void *data,
- uint32_t tag)
+ uint32_t tag)
{
return push(queue_ea, data, 1, 1, tag);
}
@@ -280,7 +281,8 @@ static void pop_update(uint64_t queue_ea
/* flush id from push wait list */
queue.push_wait_count--;
- memmove(&queue.push_wait_id[0], &queue.push_wait_id[1],
+ memmove(&queue.push_wait_id[0],
+ &queue.push_wait_id[1],
sizeof(uint16_t) * queue.push_wait_count);
}
@@ -296,7 +298,7 @@ static void pop_update(uint64_t queue_ea
}
static int pop(uint64_t queue_ea, void *data,
- int peek, int try, int begin, uint32_t tag)
+ int peek, int try, int begin, uint32_t tag)
{
struct mars_task_context *task;
@@ -321,7 +323,7 @@ static int pop(uint64_t queue_ea, void *
/* check for valid direction */
if (queue.direction != MARS_TASK_QUEUE_HOST_TO_MPU &&
- queue.direction != MARS_TASK_QUEUE_MPU_TO_MPU) {
+ queue.direction != MARS_TASK_QUEUE_MPU_TO_MPU) {
mars_mutex_unlock_put(queue_ea, (struct mars_mutex *)&queue);
return MARS_ERROR_STATE;
}
@@ -331,14 +333,14 @@ static int pop(uint64_t queue_ea, void *
/* only try so return busy */
if (try) {
mars_mutex_unlock_put(queue_ea,
- (struct mars_mutex *)&queue);
+ (struct mars_mutex *)&queue);
return MARS_ERROR_BUSY;
}
/* check if pop wait list full */
if (queue.pop_wait_count == MARS_TASK_QUEUE_WAIT_MAX) {
mars_mutex_unlock_put(queue_ea,
- (struct mars_mutex *)&queue);
+ (struct mars_mutex *)&queue);
return MARS_ERROR_LIMIT;
}
--- a/task/src/mpu/lib/task_semaphore.c
+++ b/task/src/mpu/lib/task_semaphore.c
@@ -74,7 +74,7 @@ int mars_task_semaphore_acquire(uint64_t
/* check if semaphore wait limit reached */
if (semaphore.wait_count == MARS_TASK_SEMAPHORE_WAIT_MAX) {
mars_mutex_unlock_put(semaphore_ea,
- (struct mars_mutex *)&semaphore);
+ (struct mars_mutex *)&semaphore);
return MARS_ERROR_LIMIT;
}
@@ -84,7 +84,7 @@ int mars_task_semaphore_acquire(uint64_t
semaphore.wait_count++;
mars_mutex_unlock_put(semaphore_ea,
- (struct mars_mutex *)&semaphore);
+ (struct mars_mutex *)&semaphore);
/* wait for signal */
(*mars_task_module_syscalls->signal_wait)();
More information about the cbe-oss-dev
mailing list