summaryrefslogtreecommitdiff
path: root/core/minute-ia
diff options
context:
space:
mode:
Diffstat (limited to 'core/minute-ia')
-rw-r--r--core/minute-ia/atomic.h4
-rw-r--r--core/minute-ia/task.c31
-rw-r--r--core/minute-ia/task_defs.h3
3 files changed, 19 insertions, 19 deletions
diff --git a/core/minute-ia/atomic.h b/core/minute-ia/atomic.h
index 37a4454902..dbcd04b7de 100644
--- a/core/minute-ia/atomic.h
+++ b/core/minute-ia/atomic.h
@@ -8,12 +8,10 @@
#ifndef __CROS_EC_ATOMIC_H
#define __CROS_EC_ATOMIC_H
+#include "atomic_t.h"
#include "common.h"
#include "util.h"
-typedef int atomic_t;
-typedef atomic_t atomic_val_t;
-
static inline int bool_compare_and_swap_u32(uint32_t *var, uint32_t old_value,
uint32_t new_value)
{
diff --git a/core/minute-ia/task.c b/core/minute-ia/task.c
index cde3d80e12..3526b93dd0 100644
--- a/core/minute-ia/task.c
+++ b/core/minute-ia/task.c
@@ -60,7 +60,7 @@ static uint64_t task_start_time; /* Time task scheduling started */
static uint32_t exc_start_time; /* Time of task->exception transition */
static uint32_t exc_end_time; /* Time of exception->task transition */
static uint64_t exc_total_time; /* Total time in exceptions */
-static uint32_t svc_calls; /* Number of service calls */
+static atomic_t svc_calls; /* Number of service calls */
static uint32_t task_switches; /* Number of times active task changed */
static uint32_t irq_dist[CONFIG_IRQ_COUNT]; /* Distribution of IRQ calls */
#endif
@@ -143,13 +143,13 @@ task_ *current_task, *next_task;
* 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);
static int start_called; /* Has task swapping started */
@@ -207,7 +207,7 @@ const char *task_get_name(task_id_t tskid)
return "<< unknown >>";
}
-uint32_t *task_get_event_bitmap(task_id_t tskid)
+atomic_t *task_get_event_bitmap(task_id_t tskid)
{
task_ *tsk = __task_id_to_ptr(tskid);
@@ -521,7 +521,7 @@ void task_print_list(void)
"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;
@@ -535,14 +535,14 @@ void task_print_list(void)
char use_fpu = tasks[i].use_fpu ? 'Y' : 'N';
ccprintf("%4d %c %-16s %08x %11.6lld %3d/%3d %c\n",
- i, is_ready, task_get_name(i), tasks[i].events,
- tasks[i].runtime, stackused,
- tasks_init[i].stack_size, use_fpu);
+ i, is_ready, task_get_name(i),
+ (int)tasks[i].events, tasks[i].runtime,
+ stackused, tasks_init[i].stack_size, use_fpu);
} else {
ccprintf("%4d %c %-16s %08x %11.6lld %3d/%3d\n",
- i, is_ready, task_get_name(i), tasks[i].events,
- tasks[i].runtime, stackused,
- tasks_init[i].stack_size);
+ i, is_ready, task_get_name(i),
+ (int)tasks[i].events, tasks[i].runtime,
+ stackused, tasks_init[i].stack_size);
}
cflush();
@@ -565,8 +565,9 @@ static int command_task_info(int argc, char **argv)
total += irq_dist[i];
}
}
- ccprintf("Service calls: %11d\n", svc_calls);
- ccprintf("Total exceptions: %11d\n", total + svc_calls);
+ ccprintf("Service calls: %11d\n", (int)svc_calls);
+ ccprintf("Total exceptions: %11d\n",
+ total + (int)svc_calls);
ccprintf("Task switches: %11d\n", task_switches);
ccprintf("Task switching started: %11.6lld s\n",
task_start_time);
@@ -586,10 +587,10 @@ __maybe_unused
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);
}
diff --git a/core/minute-ia/task_defs.h b/core/minute-ia/task_defs.h
index 01632392cb..18458b1533 100644
--- a/core/minute-ia/task_defs.h
+++ b/core/minute-ia/task_defs.h
@@ -15,6 +15,7 @@
* defines for inline asm
*/
#ifndef __ASSEMBLER__
+#include "atomic.h"
#include "common.h"
#define USE_FPU_OFFSET_STR STRINGIFY(USE_FPU_OFFSET) /* "20" */
@@ -34,7 +35,7 @@ typedef union {
* 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 */
#ifdef CONFIG_FPU