summaryrefslogtreecommitdiff
path: root/libs/os/src
diff options
context:
space:
mode:
authorWillam San Filippo <will@micosa.io>2015-07-13 18:19:17 -0700
committerWillam San Filippo <will@micosa.io>2015-07-13 18:19:17 -0700
commit484bb370639a2fecf61da4d40ee5cd99c8aedadf (patch)
tree71a33dc20d6331b9b1e72562c97839fd29242e7c /libs/os/src
parent7c7dc7b1d501d719d86613f8b2ec571d2c46f531 (diff)
Fix incorrect push of merged files
Diffstat (limited to 'libs/os/src')
-rwxr-xr-xlibs/os/src/arch/arm/cortex-m/os_arch_arm.c10
-rw-r--r--libs/os/src/arch/sim/os_arch_sim.c7
-rw-r--r--libs/os/src/os_callout.c16
-rw-r--r--libs/os/src/os_eventq.c39
-rw-r--r--libs/os/src/os_mutex.c30
-rw-r--r--libs/os/src/os_sched.c116
-rw-r--r--libs/os/src/os_sem.c36
-rw-r--r--libs/os/src/os_task.c4
8 files changed, 0 insertions, 258 deletions
diff --git a/libs/os/src/arch/arm/cortex-m/os_arch_arm.c b/libs/os/src/arch/arm/cortex-m/os_arch_arm.c
index 8abcc60a..e00e05e9 100755
--- a/libs/os/src/arch/arm/cortex-m/os_arch_arm.c
+++ b/libs/os/src/arch/arm/cortex-m/os_arch_arm.c
@@ -89,10 +89,7 @@ timer_handler(void)
{
os_time_tick();
os_callout_tick();
-<<<<<<< HEAD
os_sched_os_timer_exp();
-=======
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
os_sched(NULL, 1);
}
@@ -102,15 +99,12 @@ os_arch_ctx_sw(struct os_task *t)
os_bsp_ctx_sw();
}
-<<<<<<< HEAD
void
os_arch_ctx_sw_isr(struct os_task *t)
{
os_bsp_ctx_sw();
}
-=======
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
os_sr_t
os_arch_save_sr(void)
{
@@ -218,11 +212,7 @@ os_arch_start(void)
struct os_task *t;
/* Get the highest priority ready to run to set the current task */
-<<<<<<< HEAD
t = os_sched_next_task();
-=======
- t = os_sched_next_task(0);
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
os_sched_set_current_task(t);
/* Adjust PSP so it looks like this task just took an exception */
diff --git a/libs/os/src/arch/sim/os_arch_sim.c b/libs/os/src/arch/sim/os_arch_sim.c
index 4bfff620..b0ad7d4d 100644
--- a/libs/os/src/arch/sim/os_arch_sim.c
+++ b/libs/os/src/arch/sim/os_arch_sim.c
@@ -273,10 +273,7 @@ timer_handler(int sig)
time_last = time_now;
g_pending_ticks = 0;
-<<<<<<< HEAD
os_sched_os_timer_exp();
-=======
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
os_sched(NULL, 1);
}
@@ -316,11 +313,7 @@ os_arch_os_start(void)
start_timer();
-<<<<<<< HEAD
t = os_sched_next_task();
-=======
- t = os_sched_next_task(0);
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
os_sched_set_current_task(t);
sf = (struct stack_frame *) t->t_stackptr;
diff --git a/libs/os/src/os_callout.c b/libs/os/src/os_callout.c
index a6389495..0c166504 100644
--- a/libs/os/src/os_callout.c
+++ b/libs/os/src/os_callout.c
@@ -109,24 +109,15 @@ os_callout_func_reset(struct os_callout_func *cf, int32_t ticks,
return (rc);
}
-<<<<<<< HEAD
void
os_callout_tick(void)
{
os_sr_t sr;
-=======
-/* XXX: assume called from interrupt context, no need to disable interrupts
- */
-void
-os_callout_tick(void)
-{
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
struct os_callout *c;
uint32_t now;
now = os_time_get();
-<<<<<<< HEAD
while (1) {
OS_ENTER_CRITICAL(sr);
c = TAILQ_FIRST(&g_callout_list);
@@ -141,13 +132,6 @@ os_callout_tick(void)
OS_EXIT_CRITICAL(sr);
if (c) {
-=======
- c = NULL;
- TAILQ_FOREACH(c, &g_callout_list, c_next) {
- if (OS_TIME_TICK_GEQ(now, c->c_ticks)) {
- TAILQ_REMOVE(&g_callout_list, c, c_next);
- c->c_flags &= ~OS_CALLOUT_F_QUEUED;
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
os_eventq_put2(c->c_evq, &c->c_ev, 1);
} else {
break;
diff --git a/libs/os/src/os_eventq.c b/libs/os/src/os_eventq.c
index bf770dff..5319c247 100644
--- a/libs/os/src/os_eventq.c
+++ b/libs/os/src/os_eventq.c
@@ -29,7 +29,6 @@ os_eventq_init(struct os_eventq *evq)
void
os_eventq_put2(struct os_eventq *evq, struct os_event *ev, int isr)
{
-<<<<<<< HEAD
int resched;
os_sr_t sr;
@@ -56,33 +55,6 @@ os_eventq_put2(struct os_eventq *evq, struct os_event *ev, int isr)
if (resched) {
os_sched(NULL, isr);
-=======
- os_sr_t sr;
-
- if (!isr) {
- OS_ENTER_CRITICAL(sr);
- }
-
- /* Do not queue if already queued */
- if (ev->ev_queued) {
- if (!isr) {
- OS_EXIT_CRITICAL(sr);
- }
- return;
- }
- ev->ev_queued = 1;
-
- TAILQ_INSERT_TAIL(&evq->evq_list, ev, ev_next);
- if (evq->evq_task) {
- if (!isr) {
- OS_EXIT_CRITICAL(sr);
- }
- os_sched_wakeup(evq->evq_task, 1, isr);
- } else {
- if (!isr) {
- OS_EXIT_CRITICAL(sr);
- }
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
}
}
@@ -106,12 +78,6 @@ pull_one:
ev->ev_queued = 0;
} else {
evq->evq_task = os_sched_get_current_task();
-<<<<<<< HEAD
-=======
- /* XXX: Is there a possible issue where we wake this task up because
- it is sleeping but no event was posted? I guess in that case we
- will end up waiting here anyway... */
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
os_sched_sleep(evq->evq_task, OS_TIMEOUT_NEVER);
OS_EXIT_CRITICAL(sr);
@@ -133,11 +99,6 @@ os_eventq_remove(struct os_eventq *evq, struct os_event *ev)
OS_ENTER_CRITICAL(sr);
TAILQ_REMOVE(&evq->evq_list, ev, ev_next);
-<<<<<<< HEAD
ev->ev_queued = 0;
OS_EXIT_CRITICAL(sr);
-=======
- OS_EXIT_CRITICAL(sr);
- ev->ev_queued = 0;
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
}
diff --git a/libs/os/src/os_mutex.c b/libs/os/src/os_mutex.c
index 8dab75b8..17d3b3b8 100644
--- a/libs/os/src/os_mutex.c
+++ b/libs/os/src/os_mutex.c
@@ -98,21 +98,7 @@ os_mutex_release(struct os_mutex *mu)
SLIST_REMOVE_HEAD(&mu->mu_head, t_obj_list);
SLIST_NEXT(rdy, t_obj_list) = NULL;
-<<<<<<< HEAD
os_sched_wakeup(rdy);
-=======
- os_sched_wakeup(rdy, 0, 0);
-
- /* XXX: I wonder if the following is possible: we are waiting on
- * a mutex or semaphore or something and os_sched_wakeup gets
- * called. Can getting a semaphore while waiting on a mutex wake
- * us up if we get the semaphore? Look at this...
- * NOTE: os_sched_wakeup() will always remove the current task from
- * the mutex list. Shouldn't only this particular call to wakeup, or
- * a timeout if waiting for a mutex for a time, be the only times that
- * this can/should happen?
- */
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
/* Set mutex internals */
mu->mu_level = 1;
@@ -124,11 +110,7 @@ os_mutex_release(struct os_mutex *mu)
/* Do we need to re-schedule? */
resched = 0;
-<<<<<<< HEAD
rdy = os_sched_next_task();
-=======
- rdy = os_sched_next_task(0);
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
if (rdy != current) {
resched = 1;
}
@@ -229,11 +211,7 @@ os_mutex_pend(struct os_mutex *mu, uint32_t timeout)
os_sched(NULL, 0);
-<<<<<<< HEAD
/* If we are owner we did not time out. */
-=======
- /* XXX: not sure if there is a better way to do this... */
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
if (mu->mu_owner == current) {
rc = OS_OK;
} else {
@@ -287,19 +265,11 @@ os_mutex_delete(struct os_mutex *mu)
rdy->t_mutex = NULL;
SLIST_REMOVE_HEAD(&mu->mu_head, t_obj_list);
SLIST_NEXT(rdy, t_obj_list) = NULL;
-<<<<<<< HEAD
os_sched_wakeup(rdy);
}
/* Is there a task that is ready that is higher priority than us? */
rdy = os_sched_next_task();
-=======
- os_sched_wakeup(rdy, 0, 0);
- }
-
- /* Is there a task that is ready that is higher priority than us? */
- rdy = os_sched_next_task(0);
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
if (rdy != current) {
/* Re-schedule */
OS_EXIT_CRITICAL(sr);
diff --git a/libs/os/src/os_sched.c b/libs/os/src/os_sched.c
index 8a7a1c9c..28985823 100644
--- a/libs/os/src/os_sched.c
+++ b/libs/os/src/os_sched.c
@@ -25,7 +25,6 @@ TAILQ_HEAD(, os_task) g_os_sleep_list = TAILQ_HEAD_INITIALIZER(g_os_sleep_list);
struct os_task *g_current_task;
-<<<<<<< HEAD
/**
* os sched insert
*
@@ -43,19 +42,6 @@ os_sched_insert(struct os_task *t)
struct os_task *entry;
os_sr_t sr;
os_error_t rc;
-=======
-
-/**
- * Insert a newly created task into the scheduler list. This causes the task to
- * be evaluated for running when os_scheduler_run() is called.
- */
-int
-os_sched_insert(struct os_task *t, int isr)
-{
- struct os_task *entry;
- os_sr_t sr;
- int rc;
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
if (t->t_state != OS_TASK_READY) {
rc = OS_EINVAL;
@@ -63,13 +49,7 @@ os_sched_insert(struct os_task *t, int isr)
}
entry = NULL;
-<<<<<<< HEAD
OS_ENTER_CRITICAL(sr);
-=======
- if (!isr) {
- OS_ENTER_CRITICAL(sr);
- }
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
TAILQ_FOREACH(entry, &g_os_run_list, t_os_list) {
if (t->t_prio < entry->t_prio) {
break;
@@ -80,20 +60,13 @@ os_sched_insert(struct os_task *t, int isr)
} else {
TAILQ_INSERT_TAIL(&g_os_run_list, (struct os_task *) t, t_os_list);
}
-<<<<<<< HEAD
OS_EXIT_CRITICAL(sr);
-=======
- if (!isr) {
- OS_EXIT_CRITICAL(sr);
- }
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
return (0);
err:
return (rc);
}
-<<<<<<< HEAD
/**
* os sched get current task
*
@@ -103,15 +76,12 @@ err:
*
* @return struct os_task*
*/
-=======
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
struct os_task *
os_sched_get_current_task(void)
{
return (g_current_task);
}
-<<<<<<< HEAD
/**
* os sched set current task
*
@@ -121,15 +91,12 @@ os_sched_get_current_task(void)
*
* @param t Pointer to currently running task.
*/
-=======
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
void
os_sched_set_current_task(struct os_task *t)
{
g_current_task = t;
}
-<<<<<<< HEAD
/**
* os sched
*
@@ -140,8 +107,6 @@ os_sched_set_current_task(struct os_task *t)
* @param next_t Task to run
* @param isr Flag denoting whether we are inside an isr (0:no, 1:yes).
*/
-=======
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
void
os_sched(struct os_task *next_t, int isr)
{
@@ -150,7 +115,6 @@ os_sched(struct os_task *next_t, int isr)
OS_ENTER_CRITICAL(sr);
if (!next_t) {
-<<<<<<< HEAD
next_t = os_sched_next_task();
}
@@ -162,45 +126,23 @@ os_sched(struct os_task *next_t, int isr)
os_arch_ctx_sw(next_t);
}
-=======
- next_t = os_sched_next_task(isr);
- }
-
- if (next_t != os_sched_get_current_task()) {
- os_arch_ctx_sw(next_t);
- OS_EXIT_CRITICAL(sr);
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
} else {
OS_EXIT_CRITICAL(sr);
}
}
-<<<<<<< HEAD
-=======
-
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
/**
* os sched sleep
*
* Removes the task from the run list and puts it on the sleep list.
-<<<<<<< HEAD
-=======
- *
- * NOTE: must be called with interrupts disabled! This function does not call
- * the scheduler
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
*
* @param t Task to put to sleep
* @param nticks Number of ticks to put task to sleep
*
-<<<<<<< HEAD
* @return int
*
* NOTE: must be called with interrupts disabled! This function does not call
* the scheduler
-=======
- * @return int
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
*/
int
os_sched_sleep(struct os_task *t, os_time_t nticks)
@@ -232,7 +174,6 @@ os_sched_sleep(struct os_task *t, os_time_t nticks)
return (0);
}
-<<<<<<< HEAD
/**
* os sched wakeup
*
@@ -250,17 +191,6 @@ os_sched_wakeup(struct os_task *t)
{
os_sr_t sr;
-=======
-int
-os_sched_wakeup(struct os_task *t, int sched_now, int isr)
-{
- os_sr_t sr;
-
- if (!isr) {
- OS_ENTER_CRITICAL(sr);
- }
-
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
/* Remove self from mutex list if waiting on one */
if (t->t_mutex) {
assert(!SLIST_EMPTY(&t->t_mutex->mu_head));
@@ -274,23 +204,11 @@ os_sched_wakeup(struct os_task *t, int sched_now, int isr)
t->t_next_wakeup = 0;
t->t_flags &= ~OS_TASK_FLAG_NO_TIMEOUT;
TAILQ_REMOVE(&g_os_sleep_list, t, t_os_list);
-<<<<<<< HEAD
os_sched_insert(t);
-=======
- os_sched_insert(t, isr);
- if (!isr) {
- OS_EXIT_CRITICAL(sr);
- }
-
- if (sched_now) {
- os_sched(NULL, isr);
- }
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
return (0);
}
-<<<<<<< HEAD
/**
* os sched os timer exp
*
@@ -302,14 +220,6 @@ os_sched_wakeup(struct os_task *t, int sched_now, int isr)
*/
void
os_sched_os_timer_exp(void)
-=======
-
-/**
- * Get the next task to run.
- */
-struct os_task *
-os_sched_next_task(int isr)
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
{
struct os_task *t;
struct os_task *next;
@@ -318,13 +228,7 @@ os_sched_next_task(int isr)
now = os_time_get();
-<<<<<<< HEAD
OS_ENTER_CRITICAL(sr);
-=======
- if (!isr) {
- OS_ENTER_CRITICAL(sr);
- }
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
/*
* Wakeup any tasks that have their sleep timer expired
@@ -337,18 +241,13 @@ os_sched_next_task(int isr)
}
next = TAILQ_NEXT(t, t_os_list);
if (OS_TIME_TICK_GEQ(now, t->t_next_wakeup)) {
-<<<<<<< HEAD
os_sched_wakeup(t);
-=======
- os_sched_wakeup(t, 0, isr);
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
} else {
break;
}
t = next;
}
-<<<<<<< HEAD
OS_EXIT_CRITICAL(sr);
}
@@ -367,17 +266,6 @@ struct os_task *
os_sched_next_task(void)
{
return (TAILQ_FIRST(&g_os_run_list));
-=======
- /*
- * Run the head of the run list
- */
- t = TAILQ_FIRST(&g_os_run_list);
- if (!isr) {
- OS_EXIT_CRITICAL(sr);
- }
-
- return (t);
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
}
/**
@@ -398,11 +286,7 @@ os_sched_resort(struct os_task *t)
{
if (t->t_state == OS_TASK_READY) {
TAILQ_REMOVE(&g_os_run_list, t, t_os_list);
-<<<<<<< HEAD
os_sched_insert(t);
-=======
- os_sched_insert(t, 0);
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
}
}
diff --git a/libs/os/src/os_sem.c b/libs/os/src/os_sem.c
index bed789c8..c116c34b 100644
--- a/libs/os/src/os_sem.c
+++ b/libs/os/src/os_sem.c
@@ -83,20 +83,11 @@ os_sem_release(struct os_sem *sem)
if (rdy) {
/* Clear flag that we are waiting on the semaphore */
rdy->t_flags &= ~OS_TASK_FLAG_SEM_WAIT;
-<<<<<<< HEAD
-=======
- /* XXX: should os_sched_wakeup clear this flag? Should it clear
- all the flags? Is this a problem? */
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
/* There is one waiting. Wake it up */
SLIST_REMOVE_HEAD(&sem->sem_head, t_obj_list);
SLIST_NEXT(rdy, t_obj_list) = NULL;
-<<<<<<< HEAD
os_sched_wakeup(rdy);
-=======
- os_sched_wakeup(rdy, 0, 0);
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
/* Schedule if waiting task higher priority */
if (current->t_prio > rdy->t_prio) {
@@ -220,10 +211,7 @@ os_sem_pend(struct os_sem *sem, uint32_t timeout)
os_error_t
os_sem_delete(struct os_sem *sem)
{
-<<<<<<< HEAD
int resched;
-=======
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
os_sr_t sr;
struct os_task *current;
struct os_task *rdy;
@@ -234,10 +222,7 @@ os_sem_delete(struct os_sem *sem)
}
/* Get currently running task */
-<<<<<<< HEAD
resched = 0;
-=======
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
current = os_sched_get_current_task();
OS_ENTER_CRITICAL(sr);
@@ -245,7 +230,6 @@ os_sem_delete(struct os_sem *sem)
/* Remove all tokens from semaphore */
sem->sem_tokens = 0;
-<<<<<<< HEAD
/* Any tasks waiting? */
rdy = SLIST_FIRST(&sem->sem_head);
if (rdy) {
@@ -268,26 +252,6 @@ os_sem_delete(struct os_sem *sem)
/* Re-schedule if needed*/
if (resched) {
os_sched(rdy, 0);
-=======
- /* Now, go through all the tasks waiting on the semaphore */
- while (!SLIST_EMPTY(&sem->sem_head)) {
- rdy = SLIST_FIRST(&sem->sem_head);
- SLIST_REMOVE_HEAD(&sem->sem_head, t_obj_list);
- SLIST_NEXT(rdy, t_obj_list) = NULL;
- os_sched_wakeup(rdy, 0, 0);
- }
-
- /* XXX: the os_sched_next_task() call is sort of heavyweight. Should
- I just check priority of first task on sem list? */
- /* Is there a task that is ready that is higher priority than us? */
- rdy = os_sched_next_task(0);
- if (rdy != current) {
- /* Re-schedule */
- OS_EXIT_CRITICAL(sr);
- os_sched(rdy, 0);
- } else {
- OS_EXIT_CRITICAL(sr);
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
}
return OS_OK;
diff --git a/libs/os/src/os_task.c b/libs/os/src/os_task.c
index ff48f959..177153e5 100644
--- a/libs/os/src/os_task.c
+++ b/libs/os/src/os_task.c
@@ -68,11 +68,7 @@ os_task_init(struct os_task *t, char *name, os_task_func_t func, void *arg,
stack_size);
/* insert this task into the scheduler list */
-<<<<<<< HEAD
rc = os_sched_insert(t);
-=======
- rc = os_sched_insert(t, 0);
->>>>>>> 5aae54c3cfdb6e772bedf9235b354855aa7f536a
if (rc != OS_OK) {
goto err;
}