You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2016/03/08 23:22:03 UTC

[15/16] incubator-mynewt-larva git commit: This closes #14. The implementation of 'os_arch_ctx_sw_isr()' is identical to 'os_arch_ctx_sw()' for all architectures so get rid of it.

This closes #14.
The implementation of 'os_arch_ctx_sw_isr()' is identical to 'os_arch_ctx_sw()'
for all architectures so get rid of it.

Also get rid of the 'isr' parameter to 'os_sched()' since it is not relevant
anymore.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/commit/c6f7543a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/c6f7543a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/c6f7543a

Branch: refs/heads/master
Commit: c6f7543a7aac324ee29fcabed0eb6e7a76b46d66
Parents: 9a0f9af
Author: Neel Natu <ne...@nahannisys.com>
Authored: Mon Mar 7 17:41:38 2016 -0800
Committer: wes3 <wi...@micosa.io>
Committed: Mon Mar 7 21:08:19 2016 -0800

----------------------------------------------------------------------
 libs/os/include/os/arch/cortex_m0/os/os_arch.h |  1 -
 libs/os/include/os/arch/cortex_m4/os/os_arch.h |  1 -
 libs/os/include/os/arch/sim/os/os_arch.h       |  1 -
 libs/os/include/os/os_eventq.h                 |  1 -
 libs/os/include/os/os_sched.h                  |  2 +-
 libs/os/src/arch/cortex_m0/os_arch_arm.c       | 11 +----------
 libs/os/src/arch/cortex_m4/os_arch_arm.c       | 11 +----------
 libs/os/src/arch/sim/os_arch_sim.c             |  8 +-------
 libs/os/src/os_callout.c                       |  2 +-
 libs/os/src/os_eventq.c                        | 12 +++---------
 libs/os/src/os_mutex.c                         |  4 ++--
 libs/os/src/os_sched.c                         | 10 ++--------
 libs/os/src/os_sem.c                           |  4 ++--
 libs/os/src/os_time.c                          |  2 +-
 14 files changed, 15 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/c6f7543a/libs/os/include/os/arch/cortex_m0/os/os_arch.h
----------------------------------------------------------------------
diff --git a/libs/os/include/os/arch/cortex_m0/os/os_arch.h b/libs/os/include/os/arch/cortex_m0/os/os_arch.h
index 348a33a..cd583d4 100755
--- a/libs/os/include/os/arch/cortex_m0/os/os_arch.h
+++ b/libs/os/include/os/arch/cortex_m0/os/os_arch.h
@@ -58,7 +58,6 @@ typedef uint32_t os_stack_t;
 os_stack_t *os_arch_task_stack_init(struct os_task *, os_stack_t *, int);
 void timer_handler(void);
 void os_arch_ctx_sw(struct os_task *);
-void os_arch_ctx_sw_isr(struct os_task *);
 os_sr_t os_arch_save_sr(void);
 void os_arch_restore_sr(os_sr_t);
 void os_arch_init(void);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/c6f7543a/libs/os/include/os/arch/cortex_m4/os/os_arch.h
----------------------------------------------------------------------
diff --git a/libs/os/include/os/arch/cortex_m4/os/os_arch.h b/libs/os/include/os/arch/cortex_m4/os/os_arch.h
index 299d95f..a88748c 100755
--- a/libs/os/include/os/arch/cortex_m4/os/os_arch.h
+++ b/libs/os/include/os/arch/cortex_m4/os/os_arch.h
@@ -58,7 +58,6 @@ typedef uint32_t os_stack_t;
 os_stack_t *os_arch_task_stack_init(struct os_task *, os_stack_t *, int);
 void timer_handler(void);
 void os_arch_ctx_sw(struct os_task *);
-void os_arch_ctx_sw_isr(struct os_task *);
 os_sr_t os_arch_save_sr(void);
 void os_arch_restore_sr(os_sr_t);
 void os_arch_init(void);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/c6f7543a/libs/os/include/os/arch/sim/os/os_arch.h
----------------------------------------------------------------------
diff --git a/libs/os/include/os/arch/sim/os/os_arch.h b/libs/os/include/os/arch/sim/os/os_arch.h
index 0934ab1..cfe737f 100644
--- a/libs/os/include/os/arch/sim/os/os_arch.h
+++ b/libs/os/include/os/arch/sim/os/os_arch.h
@@ -52,7 +52,6 @@ void _Die(char *file, int line);
 
 os_stack_t *os_arch_task_stack_init(struct os_task *, os_stack_t *, int);
 void os_arch_ctx_sw(struct os_task *);
-void os_arch_ctx_sw_isr(struct os_task *);
 os_sr_t os_arch_save_sr(void);
 void os_arch_restore_sr(os_sr_t sr);
 os_error_t os_arch_os_init(void);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/c6f7543a/libs/os/include/os/os_eventq.h
----------------------------------------------------------------------
diff --git a/libs/os/include/os/os_eventq.h b/libs/os/include/os/os_eventq.h
index e2b0a3d..2111373 100644
--- a/libs/os/include/os/os_eventq.h
+++ b/libs/os/include/os/os_eventq.h
@@ -41,7 +41,6 @@ struct os_eventq {
 };
 
 void os_eventq_init(struct os_eventq *);
-void os_eventq_put2(struct os_eventq *, struct os_event *, int);
 void os_eventq_put(struct os_eventq *, struct os_event *);
 struct os_event *os_eventq_get(struct os_eventq *);
 void os_eventq_remove(struct os_eventq *, struct os_event *);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/c6f7543a/libs/os/include/os/os_sched.h
----------------------------------------------------------------------
diff --git a/libs/os/include/os/os_sched.h b/libs/os/include/os/os_sched.h
index ebd7eb5..1d1ba31 100644
--- a/libs/os/include/os/os_sched.h
+++ b/libs/os/include/os/os_sched.h
@@ -26,7 +26,7 @@ void os_sched_ctx_sw_hook(struct os_task *);
 struct os_task *os_sched_get_current_task(void);
 void os_sched_set_current_task(struct os_task *);
 struct os_task *os_sched_next_task(void);
-void os_sched(struct os_task *, int);
+void os_sched(struct os_task *);
 void os_sched_os_timer_exp(void);
 os_error_t os_sched_insert(struct os_task *);
 int os_sched_sleep(struct os_task *, os_time_t nticks);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/c6f7543a/libs/os/src/arch/cortex_m0/os_arch_arm.c
----------------------------------------------------------------------
diff --git a/libs/os/src/arch/cortex_m0/os_arch_arm.c b/libs/os/src/arch/cortex_m0/os_arch_arm.c
index ce5efd5..199d0a7 100755
--- a/libs/os/src/arch/cortex_m0/os_arch_arm.c
+++ b/libs/os/src/arch/cortex_m0/os_arch_arm.c
@@ -107,7 +107,7 @@ timer_handler(void)
     os_time_tick();
     os_callout_tick();
     os_sched_os_timer_exp();
-    os_sched(NULL, 1);
+    os_sched(NULL);
 }
 
 void
@@ -119,15 +119,6 @@ os_arch_ctx_sw(struct os_task *t)
     SCB->ICSR = SCB_ICSR_PENDSVSET_Msk;
 }
 
-void
-os_arch_ctx_sw_isr(struct os_task *t)
-{
-    os_sched_ctx_sw_hook(t);
-
-    /* Set PendSV interrupt pending bit to force context switch */
-    SCB->ICSR = SCB_ICSR_PENDSVSET_Msk;
-}
-
 os_sr_t
 os_arch_save_sr(void)
 {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/c6f7543a/libs/os/src/arch/cortex_m4/os_arch_arm.c
----------------------------------------------------------------------
diff --git a/libs/os/src/arch/cortex_m4/os_arch_arm.c b/libs/os/src/arch/cortex_m4/os_arch_arm.c
index 439d7e7..0e6a22a 100755
--- a/libs/os/src/arch/cortex_m4/os_arch_arm.c
+++ b/libs/os/src/arch/cortex_m4/os_arch_arm.c
@@ -96,7 +96,7 @@ timer_handler(void)
     os_time_tick();
     os_callout_tick();
     os_sched_os_timer_exp();
-    os_sched(NULL, 1);
+    os_sched(NULL);
 }
 
 void
@@ -108,15 +108,6 @@ os_arch_ctx_sw(struct os_task *t)
     SCB->ICSR = SCB_ICSR_PENDSVSET_Msk;
 }
 
-void
-os_arch_ctx_sw_isr(struct os_task *t)
-{
-    os_sched_ctx_sw_hook(t);
-
-    /* Set PendSV interrupt pending bit to force context switch */
-    SCB->ICSR = SCB_ICSR_PENDSVSET_Msk;
-}
-
 os_sr_t
 os_arch_save_sr(void)
 {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/c6f7543a/libs/os/src/arch/sim/os_arch_sim.c
----------------------------------------------------------------------
diff --git a/libs/os/src/arch/sim/os_arch_sim.c b/libs/os/src/arch/sim/os_arch_sim.c
index 9e08ea1..a0a06d9 100644
--- a/libs/os/src/arch/sim/os_arch_sim.c
+++ b/libs/os/src/arch/sim/os_arch_sim.c
@@ -124,12 +124,6 @@ os_arch_ctx_sw(struct os_task *next_t)
     sim_longjmp(sf->sf_jb, 1);
 }
 
-void
-os_arch_ctx_sw_isr(struct os_task *next_t)
-{
-    os_arch_ctx_sw(next_t);
-}
-
 /*
  * Disable signals and enter a critical section.
  *
@@ -264,7 +258,7 @@ timer_handler(int sig)
     timersub(&time_now, &time_diff, &time_last);
 
     os_sched_os_timer_exp();
-    os_sched(NULL, 1); 
+    os_sched(NULL);
 }
 
 static void

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/c6f7543a/libs/os/src/os_callout.c
----------------------------------------------------------------------
diff --git a/libs/os/src/os_callout.c b/libs/os/src/os_callout.c
index 5ffcd92..6eb37ae 100644
--- a/libs/os/src/os_callout.c
+++ b/libs/os/src/os_callout.c
@@ -125,7 +125,7 @@ os_callout_tick(void)
         OS_EXIT_CRITICAL(sr);
 
         if (c) {
-            os_eventq_put2(c->c_evq, &c->c_ev, 1);
+            os_eventq_put(c->c_evq, &c->c_ev);
         } else {
             break;
         }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/c6f7543a/libs/os/src/os_eventq.c
----------------------------------------------------------------------
diff --git a/libs/os/src/os_eventq.c b/libs/os/src/os_eventq.c
index e3fe6e5..87085ca 100644
--- a/libs/os/src/os_eventq.c
+++ b/libs/os/src/os_eventq.c
@@ -30,7 +30,7 @@ os_eventq_init(struct os_eventq *evq)
 }
 
 void
-os_eventq_put2(struct os_eventq *evq, struct os_event *ev, int isr)
+os_eventq_put(struct os_eventq *evq, struct os_event *ev)
 {
     int resched;
     os_sr_t sr;
@@ -58,16 +58,10 @@ os_eventq_put2(struct os_eventq *evq, struct os_event *ev, int isr)
     OS_EXIT_CRITICAL(sr);
 
     if (resched) {
-        os_sched(NULL, isr);
+        os_sched(NULL);
     }
 }
 
-void
-os_eventq_put(struct os_eventq *evq, struct os_event *ev)
-{
-    os_eventq_put2(evq, ev, 0);
-}
-
 struct os_event *
 os_eventq_get(struct os_eventq *evq)
 {
@@ -85,7 +79,7 @@ pull_one:
         os_sched_sleep(evq->evq_task, OS_TIMEOUT_NEVER);
         OS_EXIT_CRITICAL(sr);
 
-        os_sched(NULL, 0);
+        os_sched(NULL);
 
         OS_ENTER_CRITICAL(sr);
         evq->evq_task = NULL;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/c6f7543a/libs/os/src/os_mutex.c
----------------------------------------------------------------------
diff --git a/libs/os/src/os_mutex.c b/libs/os/src/os_mutex.c
index b54f7e5..6519292 100644
--- a/libs/os/src/os_mutex.c
+++ b/libs/os/src/os_mutex.c
@@ -122,7 +122,7 @@ os_mutex_release(struct os_mutex *mu)
 
     /* Re-schedule if needed */
     if (resched) {
-        os_sched(rdy, 0);
+        os_sched(rdy);
     }
 
     return OS_OK;
@@ -218,7 +218,7 @@ os_mutex_pend(struct os_mutex *mu, uint32_t timeout)
     os_sched_sleep(current, timeout);
     OS_EXIT_CRITICAL(sr);
 
-    os_sched(NULL, 0);
+    os_sched(NULL);
 
     OS_ENTER_CRITICAL(sr);
     current->t_flags &= ~OS_TASK_FLAG_MUTEX_WAIT;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/c6f7543a/libs/os/src/os_sched.c
----------------------------------------------------------------------
diff --git a/libs/os/src/os_sched.c b/libs/os/src/os_sched.c
index 5ffd14c..fd30a3e 100644
--- a/libs/os/src/os_sched.c
+++ b/libs/os/src/os_sched.c
@@ -124,10 +124,9 @@ os_sched_set_current_task(struct os_task *t)
  * list) or will schedule next_t as the task to run.
  * 
  * @param next_t Task to run
- * @param isr    Flag denoting whether we are inside an isr (0:no, 1:yes).
  */
 void
-os_sched(struct os_task *next_t, int isr) 
+os_sched(struct os_task *next_t)
 {
     os_sr_t sr;
 
@@ -138,12 +137,7 @@ os_sched(struct os_task *next_t, int isr)
     }
 
     if (next_t != g_current_task) {
-        if (isr) {
-            os_arch_ctx_sw_isr(next_t);
-        } else {
-            os_arch_ctx_sw(next_t);
-        }
-
+        os_arch_ctx_sw(next_t);
     }
 
     OS_EXIT_CRITICAL(sr);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/c6f7543a/libs/os/src/os_sem.c
----------------------------------------------------------------------
diff --git a/libs/os/src/os_sem.c b/libs/os/src/os_sem.c
index 0140c53..181e5de 100644
--- a/libs/os/src/os_sem.c
+++ b/libs/os/src/os_sem.c
@@ -106,7 +106,7 @@ os_sem_release(struct os_sem *sem)
 
     /* Re-schedule if needed */
     if (resched) {
-        os_sched(rdy, 0);
+        os_sched(rdy);
     }
 
     return OS_OK;
@@ -195,7 +195,7 @@ os_sem_pend(struct os_sem *sem, uint32_t timeout)
     OS_EXIT_CRITICAL(sr);
 
     if (sched) {
-        os_sched(NULL, 0);
+        os_sched(NULL);
         /* Check if we timed out or got the semaphore */
         if (current->t_flags & OS_TASK_FLAG_SEM_WAIT) {
             OS_ENTER_CRITICAL(sr);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/c6f7543a/libs/os/src/os_time.c
----------------------------------------------------------------------
diff --git a/libs/os/src/os_time.c b/libs/os/src/os_time.c
index 1b703e0..fe7de8b 100644
--- a/libs/os/src/os_time.c
+++ b/libs/os/src/os_time.c
@@ -93,7 +93,7 @@ os_time_delay(int32_t osticks)
         OS_ENTER_CRITICAL(sr);
         os_sched_sleep(os_sched_get_current_task(), (os_time_t)osticks);
         OS_EXIT_CRITICAL(sr);
-        os_sched(NULL, 0);
+        os_sched(NULL);
     }
 }