summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDawid Niedzwiecki <dn@semihalf.com>2021-11-24 13:37:32 +0100
committerCommit Bot <commit-bot@chromium.org>2021-11-29 22:04:50 +0000
commitfdb111b606f2fd31dedbd8fbaed29e3ceb027683 (patch)
tree2a7ac6c806da6aa6734cf46e03c853042b4a0536
parentbec6095ba94a83af6affda9e46a5ced4eeaaeabe (diff)
downloadchrome-ec-fdb111b606f2fd31dedbd8fbaed29e3ceb027683.tar.gz
task: change task events bitmask to atomic_t
The events bitmask is used only with atomic_* functions or for reading, so change to variable type to atomic_t. It shouldn't change the generated code. It will be useful for incoming commits related to modifying atomic_t caused by a change in Zephyr upstream (atomic_t from int to long). BUG=b:207082842 TEST=make buildall && zmake testall && build_compare.sh -b all BRANCH=main Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Ia0ff4a20f9ed6c3728b1bd8b6cab3b32ebfcc36b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3300321 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
-rw-r--r--core/cortex-m/task.c4
-rw-r--r--core/cortex-m0/task.c4
-rw-r--r--core/host/task.c4
-rw-r--r--core/minute-ia/task.c2
-rw-r--r--core/minute-ia/task_defs.h3
-rw-r--r--core/nds32/task.c4
-rw-r--r--core/riscv-rv32i/task.c4
-rw-r--r--include/task.h3
-rw-r--r--zephyr/shim/src/tasks.c4
9 files changed, 17 insertions, 15 deletions
diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c
index 7d781f3661..09e13f445d 100644
--- a/core/cortex-m/task.c
+++ b/core/cortex-m/task.c
@@ -22,7 +22,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 */
};
@@ -263,7 +263,7 @@ task_id_t task_get_current(void)
return current_task - tasks;
}
-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);
return &tsk->events;
diff --git a/core/cortex-m0/task.c b/core/cortex-m0/task.c
index 71f05c442e..ab13a7a172 100644
--- a/core/cortex-m0/task.c
+++ b/core/cortex-m0/task.c
@@ -22,7 +22,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 */
};
@@ -197,7 +197,7 @@ task_id_t task_get_current(void)
return current_task - tasks;
}
-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);
return &tsk->events;
diff --git a/core/host/task.c b/core/host/task.c
index 44d8082d82..83e51fb83b 100644
--- a/core/host/task.c
+++ b/core/host/task.c
@@ -28,7 +28,7 @@
struct emu_task_t {
pthread_t thread;
pthread_cond_t resume;
- uint32_t event;
+ atomic_t event;
timestamp_t wake_time;
uint8_t started;
};
@@ -209,7 +209,7 @@ uint32_t task_set_event(task_id_t tskid, uint32_t event)
return 0;
}
-uint32_t *task_get_event_bitmap(task_id_t tskid)
+atomic_t *task_get_event_bitmap(task_id_t tskid)
{
return &tasks[tskid].event;
}
diff --git a/core/minute-ia/task.c b/core/minute-ia/task.c
index cde3d80e12..91807c8c14 100644
--- a/core/minute-ia/task.c
+++ b/core/minute-ia/task.c
@@ -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);
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
diff --git a/core/nds32/task.c b/core/nds32/task.c
index 3457af2bb5..376ba08ad7 100644
--- a/core/nds32/task.c
+++ b/core/nds32/task.c
@@ -25,7 +25,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 */
};
@@ -250,7 +250,7 @@ task_id_t task_get_current(void)
return start_called ? (current_task - tasks) : TASK_ID_INVALID;
}
-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);
return &tsk->events;
diff --git a/core/riscv-rv32i/task.c b/core/riscv-rv32i/task.c
index 89d7671fe1..b2fda7c6fb 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_;
@@ -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);
diff --git a/include/task.h b/include/task.h
index fdfae9d5c6..9d3dd661e8 100644
--- a/include/task.h
+++ b/include/task.h
@@ -8,6 +8,7 @@
#ifndef __CROS_EC_TASK_H
#define __CROS_EC_TASK_H
+#include "atomic_t.h"
#include "common.h"
#include "compile_time_macros.h"
#include <stdbool.h>
@@ -187,7 +188,7 @@ static inline bool in_deferred_context(void)
/**
* Return a pointer to the bitmap of events of the task.
*/
-uint32_t *task_get_event_bitmap(task_id_t tskid);
+atomic_t *task_get_event_bitmap(task_id_t tskid);
/**
* Wait for the next event.
diff --git a/zephyr/shim/src/tasks.c b/zephyr/shim/src/tasks.c
index 9c6f655a5c..851a179f3e 100644
--- a/zephyr/shim/src/tasks.c
+++ b/zephyr/shim/src/tasks.c
@@ -55,7 +55,7 @@ struct task_ctx_dyn {
/** A wait-able event that is raised when a new task event is posted */
struct k_poll_signal new_event;
/** The current platform/ec events set for this task/thread */
- uint32_t event_mask;
+ atomic_t event_mask;
/**
* The timer associated with this task, which can be set using
* timer_arm().
@@ -117,7 +117,7 @@ __test_only k_tid_t task_get_zephyr_tid(size_t cros_tid)
return shimmed_tasks_dyn[cros_tid].zephyr_tid;
}
-uint32_t *task_get_event_bitmap(task_id_t cros_task_id)
+atomic_t *task_get_event_bitmap(task_id_t cros_task_id)
{
struct task_ctx_dyn *const ctx = &shimmed_tasks_dyn[cros_task_id];