summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/cortex-m/task.c12
-rw-r--r--core/cortex-m0/task.c26
-rw-r--r--core/host/task.c6
-rw-r--r--core/minute-ia/task.c9
-rw-r--r--core/nds32/task.c9
-rw-r--r--core/riscv-rv32i/task.c21
6 files changed, 38 insertions, 45 deletions
diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c
index 8cecafffa3..b88baf4511 100644
--- a/core/cortex-m/task.c
+++ b/core/cortex-m/task.c
@@ -426,7 +426,7 @@ static uint32_t __wait_evt(int timeout_us, task_id_t resched)
return evt;
}
-uint32_t task_set_event(task_id_t tskid, uint32_t event, int wait)
+uint32_t task_set_event(task_id_t tskid, uint32_t event)
{
task_ *receiver = __task_id_to_ptr(tskid);
ASSERT(receiver);
@@ -443,10 +443,7 @@ uint32_t task_set_event(task_id_t tskid, uint32_t event, int wait)
need_resched_or_profiling = 1;
#endif
} else {
- if (wait)
- return __wait_evt(-1, tskid);
- else
- __schedule(0, tskid);
+ __schedule(0, tskid);
}
return 0;
@@ -765,8 +762,7 @@ int task_reset_cleanup(void)
*/
if (notify_id < TASK_ID_COUNT)
task_set_event(notify_id,
- TASK_EVENT_RESET_DONE,
- 0);
+ TASK_EVENT_RESET_DONE);
}
}
@@ -917,7 +913,7 @@ void mutex_unlock(struct mutex *mtx)
waiters &= ~BIT(id);
/* Somebody is waiting on the mutex */
- task_set_event(id, TASK_EVENT_MUTEX, 0);
+ task_set_event(id, TASK_EVENT_MUTEX);
}
/* Ensure no event is remaining from mutex wake-up */
diff --git a/core/cortex-m0/task.c b/core/cortex-m0/task.c
index 67da26008e..16922e10eb 100644
--- a/core/cortex-m0/task.c
+++ b/core/cortex-m0/task.c
@@ -354,7 +354,7 @@ static uint32_t __wait_evt(int timeout_us, task_id_t resched)
return evt;
}
-uint32_t task_set_event(task_id_t tskid, uint32_t event, int wait)
+uint32_t task_set_event(task_id_t tskid, uint32_t event)
{
task_ *receiver = __task_id_to_ptr(tskid);
ASSERT(receiver);
@@ -374,19 +374,15 @@ uint32_t task_set_event(task_id_t tskid, uint32_t event, int wait)
CPU_SCB_ICSR = BIT(28);
}
} else {
- if (wait) {
- return __wait_evt(-1, tskid);
- } else {
- /*
- * We need to ensure that the execution priority is
- * actually decreased after the "cpsie i" in the atomic
- * operation above else the "svc" in the __schedule
- * call below will trigger a HardFault.
- * Use a barrier to force it at that point.
- */
- asm volatile("isb");
- __schedule(0, tskid);
- }
+ /*
+ * We need to ensure that the execution priority is
+ * actually decreased after the "cpsie i" in the atomic
+ * operation above else the "svc" in the __schedule
+ * call below will trigger a HardFault.
+ * Use a barrier to force it at that point.
+ */
+ asm volatile("isb");
+ __schedule(0, tskid);
}
return 0;
@@ -535,7 +531,7 @@ void mutex_unlock(struct mutex *mtx)
waiters &= ~BIT(id);
/* Somebody is waiting on the mutex */
- task_set_event(id, TASK_EVENT_MUTEX, 0);
+ task_set_event(id, TASK_EVENT_MUTEX);
}
/* Ensure no event is remaining from mutex wake-up */
diff --git a/core/host/task.c b/core/host/task.c
index d6227384e1..36cb3467c0 100644
--- a/core/host/task.c
+++ b/core/host/task.c
@@ -198,11 +198,9 @@ pthread_t task_get_thread(task_id_t tskid)
return tasks[tskid].thread;
}
-uint32_t task_set_event(task_id_t tskid, uint32_t event, int wait)
+uint32_t task_set_event(task_id_t tskid, uint32_t event)
{
atomic_or(&tasks[tskid].event, event);
- if (wait)
- return task_wait_event(-1);
return 0;
}
@@ -286,7 +284,7 @@ void mutex_unlock(struct mutex *mtx)
for (v = 31; v >= 0; --v)
if ((1ul << v) & mtx->waiters) {
mtx->waiters &= ~(1ul << v);
- task_set_event(v, TASK_EVENT_MUTEX, 0);
+ task_set_event(v, TASK_EVENT_MUTEX);
break;
}
}
diff --git a/core/minute-ia/task.c b/core/minute-ia/task.c
index 6d5be5f92d..0cdc8a41e5 100644
--- a/core/minute-ia/task.c
+++ b/core/minute-ia/task.c
@@ -331,7 +331,7 @@ static uint32_t __wait_evt(int timeout_us, task_id_t resched)
return evt;
}
-uint32_t task_set_event(task_id_t tskid, uint32_t event, int wait)
+uint32_t task_set_event(task_id_t tskid, uint32_t event)
{
task_ *receiver = __task_id_to_ptr(tskid);
@@ -352,10 +352,7 @@ uint32_t task_set_event(task_id_t tskid, uint32_t event, int wait)
/* The receiver might run again */
atomic_or(&tasks_ready, 1 << tskid);
} else {
- if (wait)
- return __wait_evt(-1, tskid);
- else
- __schedule(0, tskid);
+ __schedule(0, tskid);
}
return 0;
@@ -493,7 +490,7 @@ void mutex_unlock(struct mutex *mtx)
waiters &= ~BIT(id);
/* Somebody is waiting on the mutex */
- task_set_event(id, TASK_EVENT_MUTEX, 0);
+ task_set_event(id, TASK_EVENT_MUTEX);
}
/* Ensure no event is remaining from mutex wake-up */
diff --git a/core/nds32/task.c b/core/nds32/task.c
index f4446bdacb..9969db34bc 100644
--- a/core/nds32/task.c
+++ b/core/nds32/task.c
@@ -417,7 +417,7 @@ static uint32_t __ram_code __wait_evt(int timeout_us, task_id_t resched)
return evt;
}
-uint32_t __ram_code task_set_event(task_id_t tskid, uint32_t event, int wait)
+uint32_t __ram_code task_set_event(task_id_t tskid, uint32_t event)
{
task_ *receiver = __task_id_to_ptr(tskid);
ASSERT(receiver);
@@ -432,10 +432,7 @@ uint32_t __ram_code task_set_event(task_id_t tskid, uint32_t event, int wait)
if (start_called)
need_resched = 1;
} else {
- if (wait)
- return __wait_evt(-1, tskid);
- else
- __schedule(0, tskid, 0);
+ __schedule(0, tskid, 0);
}
return 0;
@@ -649,7 +646,7 @@ void __ram_code mutex_unlock(struct mutex *mtx)
waiters &= ~BIT(id);
/* Somebody is waiting on the mutex */
- task_set_event(id, TASK_EVENT_MUTEX, 0);
+ task_set_event(id, TASK_EVENT_MUTEX);
}
/* Ensure no event is remaining from mutex wake-up */
diff --git a/core/riscv-rv32i/task.c b/core/riscv-rv32i/task.c
index e39e854a3e..eef46efce7 100644
--- a/core/riscv-rv32i/task.c
+++ b/core/riscv-rv32i/task.c
@@ -410,7 +410,19 @@ static uint32_t __ram_code __wait_evt(int timeout_us, task_id_t resched)
return evt;
}
-uint32_t __ram_code task_set_event(task_id_t tskid, uint32_t event, int wait)
+/* TODO: Remove the remove_me function.
+ * At the moment "make BOARD=it8xxx2_evb" returns an error
+ * "relocation truncated to fit" without it.
+ */
+uint32_t __ram_code remove_me(task_id_t tskid)
+{
+ task_ *receiver = __task_id_to_ptr(tskid);
+
+ ASSERT(receiver);
+ return 0;
+}
+
+uint32_t __ram_code task_set_event(task_id_t tskid, uint32_t event)
{
task_ *receiver = __task_id_to_ptr(tskid);
@@ -426,10 +438,7 @@ uint32_t __ram_code task_set_event(task_id_t tskid, uint32_t event, int wait)
if (start_called)
need_resched = 1;
} else {
- if (wait)
- return __wait_evt(-1, tskid);
- else
- __schedule(0, tskid, 0);
+ __schedule(0, tskid, 0);
}
return 0;
@@ -594,7 +603,7 @@ void __ram_code mutex_unlock(struct mutex *mtx)
waiters &= ~BIT(id);
/* Somebody is waiting on the mutex */
- task_set_event(id, TASK_EVENT_MUTEX, 0);
+ task_set_event(id, TASK_EVENT_MUTEX);
}
/* Ensure no event is remaining from mutex wake-up */