summaryrefslogtreecommitdiff
path: root/core/riscv-rv32i/task.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/riscv-rv32i/task.c')
-rw-r--r--core/riscv-rv32i/task.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/core/riscv-rv32i/task.c b/core/riscv-rv32i/task.c
index 89d7671fe1..204e58432d 100644
--- a/core/riscv-rv32i/task.c
+++ b/core/riscv-rv32i/task.c
@@ -20,7 +20,7 @@ typedef struct {
* for __switchto() to work.
*/
uint32_t sp; /* Saved stack pointer for context switch */
- uint32_t events; /* Bitmaps of received events */
+ atomic_t events; /* Bitmaps of received events */
uint64_t runtime; /* Time spent in task */
uint32_t *stack; /* Start of stack */
} task_;
@@ -154,13 +154,13 @@ int need_resched;
* can do their init within a task switching context. The hooks task will then
* make a call to enable all tasks.
*/
-static uint32_t tasks_ready = BIT(TASK_ID_HOOKS);
+static atomic_t tasks_ready = BIT(TASK_ID_HOOKS);
/*
* Initially allow only the HOOKS and IDLE task to run, regardless of ready
* status, in order for HOOK_INIT to complete before other tasks.
* task_enable_all_tasks() will open the flood gates.
*/
-static uint32_t tasks_enabled = BIT(TASK_ID_HOOKS) | BIT(TASK_ID_IDLE);
+static atomic_t tasks_enabled = BIT(TASK_ID_HOOKS) | BIT(TASK_ID_IDLE);
int start_called; /* Has task swapping started */
@@ -229,7 +229,7 @@ task_id_t __ram_code task_get_current(void)
return current_task - tasks;
}
-uint32_t * __ram_code task_get_event_bitmap(task_id_t tskid)
+atomic_t * __ram_code task_get_event_bitmap(task_id_t tskid)
{
task_ *tsk = __task_id_to_ptr(tskid);
@@ -603,7 +603,7 @@ void task_print_list(void)
ccputs("Task Ready Name Events Time (s) StkUsed\n");
for (i = 0; i < TASK_ID_COUNT; i++) {
- char is_ready = (tasks_ready & (1<<i)) ? 'R' : ' ';
+ char is_ready = ((uint32_t)tasks_ready & BIT(i)) ? 'R' : ' ';
uint32_t *sp;
int stackused = tasks_init[i].stack_size;
@@ -614,7 +614,7 @@ void task_print_list(void)
stackused -= sizeof(uint32_t);
ccprintf("%4d %c %-16s %08x %11.6lld %3d/%3d\n", i, is_ready,
- task_names[i], tasks[i].events, tasks[i].runtime,
+ task_names[i], (int)tasks[i].events, tasks[i].runtime,
stackused, tasks_init[i].stack_size);
cflush();
}
@@ -657,10 +657,10 @@ DECLARE_CONSOLE_COMMAND(taskinfo, command_task_info,
static int command_task_ready(int argc, char **argv)
{
if (argc < 2) {
- ccprintf("tasks_ready: 0x%08x\n", tasks_ready);
+ ccprintf("tasks_ready: 0x%08x\n", (int)tasks_ready);
} else {
tasks_ready = strtoi(argv[1], NULL, 16);
- ccprintf("Setting tasks_ready to 0x%08x\n", tasks_ready);
+ ccprintf("Setting tasks_ready to 0x%08x\n", (int)tasks_ready);
__schedule(0, 0, 0);
}