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

[1/9] incubator-mynewt-core git commit: fixing

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop 40c072ebd -> 6e96e2673


fixing


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

Branch: refs/heads/develop
Commit: 6e96e26732cdda69e613553c7d1d5f093f26dc42
Parents: 6181514
Author: NgesBrian <ng...@gmail.com>
Authored: Mon Aug 15 23:34:51 2016 +0100
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Thu Aug 18 09:20:59 2016 -0700

----------------------------------------------------------------------
 libs/os/src/test/callout_test.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6e96e267/libs/os/src/test/callout_test.c
----------------------------------------------------------------------
diff --git a/libs/os/src/test/callout_test.c b/libs/os/src/test/callout_test.c
index a56efd5..4e3811d 100644
--- a/libs/os/src/test/callout_test.c
+++ b/libs/os/src/test/callout_test.c
@@ -121,6 +121,7 @@ callout_task_receive( void *arg)
 {
     int i;
     struct os_event *event;
+    struct os_callout_func *callout;
     os_time_t now;
     os_time_t tm;
     os_sr_t sr; 
@@ -128,6 +129,8 @@ callout_task_receive( void *arg)
     event = os_eventq_poll(&callout_func_test.cf_c.c_evq, 1, OS_WAIT_FOREVER);
     TEST_ASSERT(event->ev_type ==  OS_EVENT_T_TIMER);
     TEST_ASSERT(event->ev_arg == NULL);
+    callout = (struct os_callout_func *)event;
+    TEST_ASSERT(callout->cf_func == my_callout_func);
 
     /* Should say whether callout is armed or not */
     i = os_callout_queued(&callout_func_test.cf_c);
@@ -177,12 +180,16 @@ callout_task_stop_receive( void *arg )
 {
     int k;
     struct os_event *event;
+    struct os_callout_func *callout;
     /* Recieving using the os_eventq_poll */
     for(k=0; k<MULTI_SIZE; k++){
         event = os_eventq_poll(&callout_func_stop_test[k].cf_c.c_evq, 1,
            OS_WAIT_FOREVER);
         TEST_ASSERT(event->ev_type ==  OS_EVENT_T_TIMER);
         TEST_ASSERT(event->ev_arg == NULL);
+        callout = (struct os_callout_func *)event;
+        TEST_ASSERT(callout->cf_func == my_callout_stop_func);
+
 
      }
      
@@ -221,8 +228,13 @@ callout_task_stop_speak( void *arg )
 void
 callout_task_stop_listen( void *arg )
 {
-    os_eventq_get(callout_func_speak.cf_c.c_evq);
+    struct os_event *event;
+    struct os_callout_func *callout;
+    event = os_eventq_get(callout_func_speak.cf_c.c_evq);
     TEST_ASSERT_FATAL(0);
+    callout = (struct os_callout_func *)event;
+    TEST_ASSERT(callout->cf_func == my_callout_speak_func);
+
 }
 
 /* Test case to test the basics of the callout */
@@ -247,11 +259,9 @@ TEST_CASE(callout_test)
     /* Initialize the callout function */
     os_callout_func_init(&callout_func_test, &callout_evq,
         my_callout_func, NULL);
-    TEST_ASSERT(p == 4);
 
     /* Does not return until OS_restart is called */
     os_start();
-
 }
 
 /* Test case of the callout_task_stop */
@@ -279,8 +289,6 @@ TEST_CASE(callout_test_stop)
     for(k = 0; k<MULTI_SIZE; k++){
         os_callout_func_init(&callout_func_stop_test[k], &callout_stop_evq[k],
            my_callout_stop_func, NULL);
-         TEST_ASSERT(q == 1);
-
     }
 
     /* Does not return until OS_restart is called */
@@ -308,9 +316,7 @@ TEST_CASE(callout_test_speak)
     
     /* Initialize the callout function */
     os_callout_func_init(&callout_func_speak, &callout_evq,
-        my_callout_speak_func, NULL);
-    TEST_ASSERT(t == 2);
-    
+        my_callout_speak_func, NULL);    
     /* Does not return until OS_restart is called */
     os_start();
 


[9/9] incubator-mynewt-core git commit: just adding more code

Posted by ma...@apache.org.
just adding more code


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

Branch: refs/heads/develop
Commit: 5f85bacc6125cbf92ba524fcb8124c2a76a731c4
Parents: eacd968
Author: NgesBrian <ng...@gmail.com>
Authored: Sat Jul 30 09:16:27 2016 +0100
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Thu Aug 18 09:20:59 2016 -0700

----------------------------------------------------------------------
 libs/os/src/test/callout_test.c | 135 ++++++++++++++++++++++++++++++++---
 1 file changed, 126 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5f85bacc/libs/os/src/test/callout_test.c
----------------------------------------------------------------------
diff --git a/libs/os/src/test/callout_test.c b/libs/os/src/test/callout_test.c
index f239db7..bb1644d 100644
--- a/libs/os/src/test/callout_test.c
+++ b/libs/os/src/test/callout_test.c
@@ -40,14 +40,42 @@ struct os_callout_func callout_func_test;
 struct os_eventq callout_evq;
 struct os_event callout_ev;
 
- int i; 
+int i; 
+int j;
  
+/* The callout_stop task */
+#define SEND_STOP_CALLOUT_TASK_PRIO        (3)
+struct os_task callout_task_struct_stop_send;
+os_stack_t callout_task_stack_stop_send[CALLOUT_STACK_SIZE];
+
+#define RECEIVE_STOP_CALLOUT_TASK_PRIO        (4)
+struct os_task callout_task_struct_stop_receive;
+os_stack_t callout_task_stack_stop_receive[CALLOUT_STACK_SIZE];
+
+/* Delearing variables for callout_stop_func */
+#define MULTI_SIZE    (2)
+struct os_callout_func callout_func_stop_test[MULTI_SIZE];
+
+/* The event to be sent*/
+struct os_eventq callout_stop_evq[MULTI_SIZE];
+struct os_event callout_stop_ev;
+
 /* This is the function for callout_init*/
-void my_callout_func(void *arg)
+void
+my_callout_func(void *arg)
 {
     int p;
     p = 4;
-    TEST_ASSERT(p==4);
+    TEST_ASSERT(p == 4);
+}
+
+/* This is the function for callout_init*/
+void
+my_callout_stop_func(void *arg)
+{
+    int q;
+    q = 1;
+    TEST_ASSERT(q == 1);
 }
 
 /* This is a callout task to send data */
@@ -56,7 +84,7 @@ callout_task_send()
 {
    
     /* should say whether callout is armed or not */
-    i = os_callout_queued(&callout_func_test.cf_c);
+    i= os_callout_queued(&callout_func_test.cf_c);
     TEST_ASSERT(i == 0);
 
     /* Arm the callout */
@@ -71,14 +99,15 @@ callout_task_send()
     os_time_delay(OS_TICKS_PER_SEC );
 }
 
+/* This is the callout to receive data */
 void
 callout_task_receive(void *arg)
 {
     struct os_event *event;
     /* Recieving using the os_eventq_poll*/
-        event = os_eventq_poll(&callout_func_test.cf_c.c_evq, 1, OS_WAIT_FOREVER);
-        TEST_ASSERT(event->ev_type ==  OS_EVENT_T_TIMER);
-        TEST_ASSERT(event->ev_arg == NULL);
+    event = os_eventq_poll(&callout_func_test.cf_c.c_evq, 1, OS_WAIT_FOREVER);
+    TEST_ASSERT(event->ev_type ==  OS_EVENT_T_TIMER);
+    TEST_ASSERT(event->ev_arg == NULL);
 
     TEST_ASSERT(i == 1);
     /* should say whether callout is armed or not */
@@ -90,6 +119,61 @@ callout_task_receive(void *arg)
 
 }
 
+
+/* This is callout to send the stop_callout */
+void
+callout_task_stop_send()
+{
+     int k;
+     //os_time_t tim;
+
+     /* should say whether callout is armed or not */
+    for(k = 0; k<MULTI_SIZE; k++){
+        j = os_callout_queued(&callout_func_stop_test[k].cf_c);
+        TEST_ASSERT(j == 0);
+    }
+
+    /* show that  callout is not armed after calling callout_stop */
+    for(k = 0; k<MULTI_SIZE; k++){
+        os_callout_stop(&callout_func_stop_test[k].cf_c);
+        j = os_callout_queued(&callout_func_stop_test[k].cf_c);
+        TEST_ASSERT(j == 0);
+    }
+    /* Assigning data to send*/
+    for(k = 0; k<MULTI_SIZE; k++){
+        callout_func_stop_test[k].cf_c.c_ev.ev_type = 10+ k;
+        callout_func_stop_test[k].cf_c.c_ev.ev_arg = NULL;
+    }
+    os_time_delay(OS_TICKS_PER_SEC );
+}
+
+/* This is the callout to receive stop_callout data */
+void
+callout_task_stop_receive()
+{
+    int k;
+    struct os_event *event;
+    /* Recieving using the os_eventq_poll*/
+    for(k=0; k<MULTI_SIZE; k++){
+        event = os_eventq_poll(&callout_func_stop_test[k].cf_c.c_evq, 1,
+           OS_WAIT_FOREVER);
+        TEST_ASSERT(event->ev_type == 10+k);
+        TEST_ASSERT(event->ev_arg == NULL);
+     }
+     
+    /* Showing that event is removed from the queued after calling callout_stop */    
+    for(k=0; k<MULTI_SIZE; k++){
+        os_callout_stop(&callout_func_stop_test[k].cf_c);
+        event = os_eventq_poll(&callout_func_stop_test[k].cf_c.c_evq, MULTI_SIZE,
+            OS_WAIT_FOREVER);
+        TEST_ASSERT(event->ev_type != 10+k);
+     }
+
+    /* Finishes the test when OS has been started */
+    os_test_restart();
+
+}
+
 TEST_CASE(callout_test)
 {
 
@@ -101,7 +185,7 @@ TEST_CASE(callout_test)
         callout_task_send, NULL, SEND_CALLOUT_TASK_PRIO, OS_WAIT_FOREVER,
         callout_task_stack_send, CALLOUT_STACK_SIZE);
 
-    /* Initialize the sending task */
+    /* Initialize the receive task */
     os_task_init(&callout_task_struct_receive, "callout_task_receive",
         callout_task_receive, NULL, RECEIVE_CALLOUT_TASK_PRIO, OS_WAIT_FOREVER,
         callout_task_stack_receive, CALLOUT_STACK_SIZE);
@@ -117,7 +201,40 @@ TEST_CASE(callout_test)
 
 }
 
+/* Test case of the callout_task_stop */
+TEST_CASE(callout_test_stop)
+{
+    int k;
+    /* Initializing the OS */
+    os_init();
+
+    /* Initialize the sending task */
+    os_task_init(&callout_task_struct_stop_send, "callout_task_stop_send",
+        callout_task_stop_send, NULL, SEND_STOP_CALLOUT_TASK_PRIO, OS_WAIT_FOREVER,
+        callout_task_stack_stop_send, CALLOUT_STACK_SIZE);
+
+    /* Initialize the receiving task */
+    os_task_init(&callout_task_struct_stop_receive, "callout_task_stop_receive",
+        callout_task_stop_receive, NULL, RECEIVE_STOP_CALLOUT_TASK_PRIO,
+            OS_WAIT_FOREVER, callout_task_stack_stop_receive, CALLOUT_STACK_SIZE);
+
+    for(k = 0; k< MULTI_SIZE; k++){
+        os_eventq_init(&callout_stop_evq[k]);
+    }
+    
+    /* Initialize the callout function */
+    for(k = 0; k<MULTI_SIZE; k++){
+        os_callout_func_init(&callout_func_stop_test[k], &callout_stop_evq[k],
+           my_callout_stop_func, NULL);
+    }
+
+    /* Does not return until OS_restart is called */
+    os_start();
+
+}
+
 TEST_SUITE(os_callout_test_suite)
 {   
-    callout_test();
+    //callout_test();
+    callout_test_stop();
 }


[5/9] incubator-mynewt-core git commit: corrections in the test callout

Posted by ma...@apache.org.
corrections in the test callout


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

Branch: refs/heads/develop
Commit: 3946efd7979a370e7ad016aad9067ff71c6a8d9d
Parents: 0b7cd2f
Author: NgesBrian <ng...@gmail.com>
Authored: Wed Jul 27 21:34:10 2016 +0100
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Thu Aug 18 09:20:59 2016 -0700

----------------------------------------------------------------------
 libs/os/src/test/callout_test.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/3946efd7/libs/os/src/test/callout_test.c
----------------------------------------------------------------------
diff --git a/libs/os/src/test/callout_test.c b/libs/os/src/test/callout_test.c
index 960a7fd..27241dd 100644
--- a/libs/os/src/test/callout_test.c
+++ b/libs/os/src/test/callout_test.c
@@ -40,19 +40,21 @@ struct os_callout_func callout_func_test;
 struct os_eventq callout_evq;
 struct os_event callout_ev;
 
+ int i; 
+ 
 /* This is the function for callout_init*/
 void my_callout_func(void *arg)
 {
-    int i;
-    i = 4;
-    TEST_ASSERT(i==4);
+    int p;
+    p = 4;
+    TEST_ASSERT(p==4);
 }
 
 /* This is a callout task to send data */
 void
 callout_task_send()
 {
-    int i; 
+   
     /* should say whether os is armed or not */
     i = os_callout_queued(&callout_func_test.cf_c);
     TEST_ASSERT(i == 0);
@@ -67,24 +69,22 @@ callout_task_send()
 
     /* Send the callout */ 
     os_time_delay(OS_TICKS_PER_SEC );
-    TEST_ASSERT(i == 0);
-
-     /* should say whether os is armed or not */
-    i = os_callout_queued(&callout_func_test.cf_c);
-    TEST_ASSERT(i == 0);
-
 }
 
 void
 callout_task_receive(void *arg)
 {
     struct os_event *event;
-    os_time_delay(OS_TICKS_PER_SEC / 20);
     /* Recieving using the os_eventq_poll*/
         event = os_eventq_poll(&callout_func_test.cf_c.c_evq, 1, OS_WAIT_FOREVER);
         TEST_ASSERT(event->ev_type ==  OS_EVENT_T_TIMER);
         TEST_ASSERT(event->ev_arg == NULL);
 
+    TEST_ASSERT(i == 1);
+    /* should say whether os is armed or not */
+    i = os_callout_queued(&callout_func_test.cf_c);
+    TEST_ASSERT(i == 0);
+
     /* Finishes the test when OS has been started */
     os_test_restart();
 


[4/9] incubator-mynewt-core git commit: basic os_callout

Posted by ma...@apache.org.
basic os_callout


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

Branch: refs/heads/develop
Commit: bc4c0a83f752e0b2113f8fb1ed001ec45ddc7c5c
Parents: 40c072e
Author: NgesBrian <ng...@gmail.com>
Authored: Wed Jul 20 01:17:41 2016 +0100
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Thu Aug 18 09:20:59 2016 -0700

----------------------------------------------------------------------
 libs/os/src/test/callout_test.c | 82 ++++++++++++++++++++++++++++++++++++
 libs/os/src/test/os_test.c      |  2 +-
 libs/os/src/test/os_test_priv.h |  2 +-
 3 files changed, 84 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bc4c0a83/libs/os/src/test/callout_test.c
----------------------------------------------------------------------
diff --git a/libs/os/src/test/callout_test.c b/libs/os/src/test/callout_test.c
new file mode 100644
index 0000000..034c2f4
--- /dev/null
+++ b/libs/os/src/test/callout_test.c
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ 
+#include "testutil/testutil.h"
+#include "os/os.h"
+#include "os_test_priv.h"
+#include "os/os_eventq.h"
+#include "os/os_callout.h"
+
+/* Task 1 for sending */
+#define CALLOUT_STACK_SIZE        (5120)
+#define SEND_CALLOUT_TASK_PRIO        (1)
+struct os_task callout_task_struct_send;
+os_stack_t callout_task_stack_send[CALLOUT_STACK_SIZE];
+
+/* Initializing the callout 
+struct os_event callout_event;
+struct os_eventq callout_eventq;
+struct os_eventq callout_eventq_delivered;
+struct os_callout struct_callout;
+*/
+
+/* Delearing variables for callout_func */
+struct os_callout_func callout_func;
+struct os_eventq callout_eventq;
+void native_cputimer_cb(void *arg);
+
+/* This is a callout task to send data */
+void
+callout_task_send()
+{
+    int i;
+    /*
+    struct_callout.c_ev = callout_event;
+    struct_callout.c_evq = &callout_eventq;
+    struct_callout.c_ticks = OS_TICKS_PER_SEC / 20;
+    */
+    /* Initialize the callout
+    os_callout_init(&struct_callout, &callout_eventq_delivered, NULL);
+    */
+
+    /* Initialize the callout function */
+    os_callout_func_init(&callout_func, &callout_eventq,
+        native_cputimer_cb, NULL);
+    i = os_callout_queued((struct os_callout )callout_func);
+    TEST_ASSERT(i == 0);
+}
+
+TEST_CASE(callout_test){
+
+    /* Initializing the OS */
+    os_init();
+    
+    /* Initialize the sending task */
+    os_task_init(&callout_task_struct_send, "callout_task_send",
+        callout_task_send, NULL, SEND_CALLOUT_TASK_PRIO, OS_WAIT_FOREVER,
+        callout_task_stack_send, CALLOUT_STACK_SIZE);
+
+    /* Does not return until OS_restart is called */
+    os_start();
+
+}
+
+TEST_SUITE(os_callout_test_suite){   
+    callout_test();
+}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bc4c0a83/libs/os/src/test/os_test.c
----------------------------------------------------------------------
diff --git a/libs/os/src/test/os_test.c b/libs/os/src/test/os_test.c
index 1b3af1a..48f0720 100644
--- a/libs/os/src/test/os_test.c
+++ b/libs/os/src/test/os_test.c
@@ -31,7 +31,7 @@ os_test_all(void)
     os_sem_test_suite();
     os_mbuf_test_suite();
     os_eventq_test_suite();
-    
+    os_callout_test_suite();
 
     return tu_case_failed;
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bc4c0a83/libs/os/src/test/os_test_priv.h
----------------------------------------------------------------------
diff --git a/libs/os/src/test/os_test_priv.h b/libs/os/src/test/os_test_priv.h
index 5193c33..e923a6f 100644
--- a/libs/os/src/test/os_test_priv.h
+++ b/libs/os/src/test/os_test_priv.h
@@ -27,6 +27,6 @@ int os_mbuf_test_suite(void);
 int os_mutex_test_suite(void);
 int os_sem_test_suite(void);
 int os_eventq_test_suite(void);
-
+int os_callout_test_suite(void);
 
 #endif


[2/9] incubator-mynewt-core git commit: adding the test for os_callout

Posted by ma...@apache.org.
adding the test for os_callout


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

Branch: refs/heads/develop
Commit: f8af60da488f0bad0887d6834deebd254e9dd9cd
Parents: 5f85bac
Author: NgesBrian <ng...@gmail.com>
Authored: Sat Aug 6 11:45:08 2016 +0100
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Thu Aug 18 09:20:59 2016 -0700

----------------------------------------------------------------------
 libs/os/src/test/callout_test.c | 130 +++++++++++++++++++++++++++++------
 1 file changed, 108 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f8af60da/libs/os/src/test/callout_test.c
----------------------------------------------------------------------
diff --git a/libs/os/src/test/callout_test.c b/libs/os/src/test/callout_test.c
index bb1644d..937b170 100644
--- a/libs/os/src/test/callout_test.c
+++ b/libs/os/src/test/callout_test.c
@@ -22,6 +22,7 @@
 #include "os_test_priv.h"
 #include "os/os_eventq.h"
 #include "os/os_callout.h"
+#include "os/os_time.h"
 
 /* Task 1 for sending */
 #define CALLOUT_STACK_SIZE        (5120)
@@ -60,6 +61,18 @@ struct os_callout_func callout_func_stop_test[MULTI_SIZE];
 struct os_eventq callout_stop_evq[MULTI_SIZE];
 struct os_event callout_stop_ev;
 
+/* Declearing varables for callout_speak */
+#define SPEAK_CALLOUT_TASK_PRIO        (5)
+struct os_task callout_task_struct_speak;
+os_stack_t callout_task_stack_speak[CALLOUT_STACK_SIZE];
+
+/* Declearing varaibles for listen */
+#define LISTEN_CALLOUT_TASK_PRIO        (6)
+struct os_task callout_task_struct_listen;
+os_stack_t callout_task_stack_listen[CALLOUT_STACK_SIZE];
+
+struct os_callout_func callout_func_speak;
+
 /* This is the function for callout_init*/
 void
 my_callout_func(void *arg)
@@ -69,7 +82,7 @@ my_callout_func(void *arg)
     TEST_ASSERT(p == 4);
 }
 
-/* This is the function for callout_init*/
+/* This is the function for callout_init of stop test_case*/
 void
 my_callout_stop_func(void *arg)
 {
@@ -77,13 +90,21 @@ my_callout_stop_func(void *arg)
     q = 1;
     TEST_ASSERT(q == 1);
 }
+/* This is the function for callout_init for speak test_case*/
+void
+my_callout_speak_func(void *arg)
+{
+    int p;
+    p = 4;
+    TEST_ASSERT(p == 4);
+}
 
 /* This is a callout task to send data */
 void
-callout_task_send()
+callout_task_send(void *arg )
 {
    
-    /* should say whether callout is armed or not */
+    /* Should say whether callout is armed or not */
     i= os_callout_queued(&callout_func_test.cf_c);
     TEST_ASSERT(i == 0);
 
@@ -91,7 +112,7 @@ callout_task_send()
     i = os_callout_reset(&callout_func_test.cf_c, OS_TICKS_PER_SEC/ 50);
     TEST_ASSERT_FATAL(i == 0);
 
-    /* should say whether callout is armed or not */
+    /* Should say whether callout is armed or not */
     i = os_callout_queued(&callout_func_test.cf_c);
     TEST_ASSERT(i == 1);
 
@@ -101,59 +122,69 @@ callout_task_send()
 
 /* This is the callout to receive data */
 void
-callout_task_receive(void *arg)
+callout_task_receive( void *arg)
 {
     struct os_event *event;
-    /* Recieving using the os_eventq_poll*/
+    os_time_t now;
+    os_time_t tm;
+    os_sr_t sr; 
+    /* Recieve using the os_eventq_poll */
     event = os_eventq_poll(&callout_func_test.cf_c.c_evq, 1, OS_WAIT_FOREVER);
     TEST_ASSERT(event->ev_type ==  OS_EVENT_T_TIMER);
     TEST_ASSERT(event->ev_arg == NULL);
 
     TEST_ASSERT(i == 1);
-    /* should say whether callout is armed or not */
+    /* Should say whether callout is armed or not */
     i = os_callout_queued(&callout_func_test.cf_c);
     TEST_ASSERT(i == 0);
 
+    OS_ENTER_CRITICAL(sr);
+    now = os_time_get();
+    tm = os_callout_wakeup_ticks(now);
+    TEST_ASSERT(tm == OS_TIMEOUT_NEVER);
+    OS_EXIT_CRITICAL(sr);
+    
     /* Finishes the test when OS has been started */
     os_test_restart();
 
 }
 
-
 /* This is callout to send the stop_callout */
 void
-callout_task_stop_send()
+callout_task_stop_send( void *arg)
 {
      int k;
-     //os_time_t tim;
 
-     /* should say whether callout is armed or not */
+     /* Should say whether callout is armed or not */
     for(k = 0; k<MULTI_SIZE; k++){
         j = os_callout_queued(&callout_func_stop_test[k].cf_c);
         TEST_ASSERT(j == 0);
     }
 
-    /* show that  callout is not armed after calling callout_stop */
+    /* Show that  callout is not armed after calling callout_stop */
     for(k = 0; k<MULTI_SIZE; k++){
         os_callout_stop(&callout_func_stop_test[k].cf_c);
         j = os_callout_queued(&callout_func_stop_test[k].cf_c);
         TEST_ASSERT(j == 0);
     }
-    /* Assigning data to send*/
+    /* Assigning data to send */
     for(k = 0; k<MULTI_SIZE; k++){
         callout_func_stop_test[k].cf_c.c_ev.ev_type = 10+ k;
         callout_func_stop_test[k].cf_c.c_ev.ev_arg = NULL;
+
+         os_eventq_put(callout_func_stop_test[k].cf_c.c_evq,
+             &callout_func_stop_test[k].cf_c.c_ev);
     }
-    os_time_delay(OS_TICKS_PER_SEC );
+    os_time_delay( OS_TICKS_PER_SEC );
 }
 
 /* This is the callout to receive stop_callout data */
 void
-callout_task_stop_receive()
+callout_task_stop_receive( void *arg )
 {
     int k;
     struct os_event *event;
-    /* Recieving using the os_eventq_poll*/
+    /* Recieving using the os_eventq_poll */
     for(k=0; k<MULTI_SIZE; k++){
         event = os_eventq_poll(&callout_func_stop_test[k].cf_c.c_evq, 1,
            OS_WAIT_FOREVER);
@@ -161,19 +192,46 @@ callout_task_stop_receive()
         TEST_ASSERT(event->ev_arg == NULL);
      }
      
-    /* Showing that event is removed from the queued after calling callout_stop */    
+    /* Show that event is removed from the queued after calling callout_stop */
     for(k=0; k<MULTI_SIZE; k++){
         os_callout_stop(&callout_func_stop_test[k].cf_c);
-        event = os_eventq_poll(&callout_func_stop_test[k].cf_c.c_evq, MULTI_SIZE,
-            OS_WAIT_FOREVER);
-        TEST_ASSERT(event->ev_type != 10+k);
+        /* Testing that the event has been removed from queue */
+        TEST_ASSERT_FATAL(1); 
      }
+    /* Finishes the test when OS has been started */
+    os_test_restart();
+
+}
+
+/* This is a callout task to send data */
+void
+callout_task_stop_speak( void *arg )
+{
+    /* Arm the callout */
+    i = os_callout_reset(&callout_func_speak.cf_c, OS_TICKS_PER_SEC/ 50);
+    TEST_ASSERT_FATAL(i == 0);
 
+    /* should say whether callout is armed or not */
+    i = os_callout_queued(&callout_func_speak.cf_c);
+    TEST_ASSERT(i == 1);
+
+    os_callout_stop(&callout_func_speak.cf_c);
+    TEST_ASSERT(i == 1);
+    
+    /* Send the callout */ 
+    os_time_delay(OS_TICKS_PER_SEC/ 100 );
     /* Finishes the test when OS has been started */
     os_test_restart();
+}
 
+void
+callout_task_stop_listen( void *arg )
+{
+    os_eventq_get(callout_func_speak.cf_c.c_evq);
+    TEST_ASSERT_FATAL(0);
 }
 
+/* Test case to test the basics of the callout */
 TEST_CASE(callout_test)
 {
 
@@ -216,7 +274,7 @@ TEST_CASE(callout_test_stop)
     /* Initialize the receiving task */
     os_task_init(&callout_task_struct_stop_receive, "callout_task_stop_receive",
         callout_task_stop_receive, NULL, RECEIVE_STOP_CALLOUT_TASK_PRIO,
-            OS_WAIT_FOREVER, callout_task_stack_stop_receive, CALLOUT_STACK_SIZE);
+        OS_WAIT_FOREVER, callout_task_stack_stop_receive, CALLOUT_STACK_SIZE);
 
     for(k = 0; k< MULTI_SIZE; k++){
         os_eventq_init(&callout_stop_evq[k]);
@@ -233,8 +291,36 @@ TEST_CASE(callout_test_stop)
 
 }
 
+/* Test case to test case for speak and listen */
+TEST_CASE(callout_test_speak)
+{
+    /* Initializing the OS */
+    os_init();
+    
+    /* Initialize the sending task */
+    os_task_init(&callout_task_struct_speak, "callout_task_speak",
+        callout_task_stop_speak, NULL, SPEAK_CALLOUT_TASK_PRIO, OS_WAIT_FOREVER,
+        callout_task_stack_speak, CALLOUT_STACK_SIZE);
+
+    /* Initialize the receive task */
+    os_task_init(&callout_task_struct_listen, "callout_task_listen",
+        callout_task_stop_listen, NULL, LISTEN_CALLOUT_TASK_PRIO, OS_WAIT_FOREVER,
+        callout_task_stack_listen, CALLOUT_STACK_SIZE);
+
+    os_eventq_init(&callout_evq);
+    
+    /* Initialize the callout function */
+    os_callout_func_init(&callout_func_speak, &callout_evq,
+        my_callout_speak_func, NULL);
+
+    /* Does not return until OS_restart is called */
+    os_start();
+
+}
+
 TEST_SUITE(os_callout_test_suite)
 {   
-    //callout_test();
+    callout_test();
     callout_test_stop();
+    callout_test_speak();
 }


[6/9] incubator-mynewt-core git commit: adding the test for os_callout

Posted by ma...@apache.org.
adding the test for os_callout


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

Branch: refs/heads/develop
Commit: 3359c33c0c7ad49f0c8c4d1d3b4254c86cafee26
Parents: bc4c0a8
Author: NgesBrian <ng...@gmail.com>
Authored: Sun Jul 24 11:19:49 2016 +0100
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Thu Aug 18 09:20:59 2016 -0700

----------------------------------------------------------------------
 libs/os/src/test/callout_test.c | 71 +++++++++++++++++++++++++-----------
 1 file changed, 50 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/3359c33c/libs/os/src/test/callout_test.c
----------------------------------------------------------------------
diff --git a/libs/os/src/test/callout_test.c b/libs/os/src/test/callout_test.c
index 034c2f4..350e94d 100644
--- a/libs/os/src/test/callout_test.c
+++ b/libs/os/src/test/callout_test.c
@@ -29,40 +29,61 @@
 struct os_task callout_task_struct_send;
 os_stack_t callout_task_stack_send[CALLOUT_STACK_SIZE];
 
-/* Initializing the callout 
-struct os_event callout_event;
-struct os_eventq callout_eventq;
-struct os_eventq callout_eventq_delivered;
-struct os_callout struct_callout;
-*/
+#define RECEIVE_CALLOUT_TASK_PRIO        (2)
+struct os_task callout_task_struct_receive;
+os_stack_t callout_task_stack_receive[CALLOUT_STACK_SIZE];
 
 /* Delearing variables for callout_func */
-struct os_callout_func callout_func;
-struct os_eventq callout_eventq;
+struct os_callout_func callout_func_test;
+struct os_eventq *callout_eventq;
 void native_cputimer_cb(void *arg);
 
+/* The event to be sent*/
+struct os_eventq callout_evq;
+struct os_event callout_ev;
+
 /* This is a callout task to send data */
 void
 callout_task_send()
 {
-    int i;
-    /*
-    struct_callout.c_ev = callout_event;
-    struct_callout.c_evq = &callout_eventq;
-    struct_callout.c_ticks = OS_TICKS_PER_SEC / 20;
-    */
-    /* Initialize the callout
-    os_callout_init(&struct_callout, &callout_eventq_delivered, NULL);
-    */
+   int i;
+    /* assigning the *callout_eventq */
+    callout_eventq = &callout_evq;
 
     /* Initialize the callout function */
-    os_callout_func_init(&callout_func, &callout_eventq,
+    os_callout_func_init(&callout_func_test, callout_eventq,
         native_cputimer_cb, NULL);
-    i = os_callout_queued((struct os_callout )callout_func);
+
+    /* should say whether os is armed or not */
+    i = os_callout_queued(&callout_func_test.cf_c);
+    TEST_ASSERT(i == 0);
+    
+    /* Arm the OS */
+    os_callout_reset(&callout_func_test.cf_c, OS_TICKS_PER_SEC/ 50);
+    
+    /* Send the callout */ 
+    os_time_delay(OS_TICKS_PER_SEC / 50);
     TEST_ASSERT(i == 0);
 }
 
-TEST_CASE(callout_test){
+void
+callout_task_receive(void *arg)
+{
+    struct os_event *event;
+    os_time_delay(OS_TICKS_PER_SEC / 20);
+    /* Recieving using the os_eventq_poll*/
+        event = os_eventq_poll(&callout_func_test.cf_c.c_evq, 1, OS_WAIT_FOREVER);
+        TEST_ASSERT(event->ev_type ==  OS_EVENT_T_TIMER);
+        TEST_ASSERT(event->ev_arg == NULL);
+
+
+    /* Finishes the test when OS has been started */
+    os_test_restart();
+
+}
+
+TEST_CASE(callout_test)
+{
 
     /* Initializing the OS */
     os_init();
@@ -72,11 +93,19 @@ TEST_CASE(callout_test){
         callout_task_send, NULL, SEND_CALLOUT_TASK_PRIO, OS_WAIT_FOREVER,
         callout_task_stack_send, CALLOUT_STACK_SIZE);
 
+    /* Initialize the sending task */
+    os_task_init(&callout_task_struct_receive, "callout_task_receive",
+        callout_task_receive, NULL, RECEIVE_CALLOUT_TASK_PRIO, OS_WAIT_FOREVER,
+        callout_task_stack_receive, CALLOUT_STACK_SIZE);
+
+    os_eventq_init(callout_eventq);
+    
     /* Does not return until OS_restart is called */
     os_start();
 
 }
 
-TEST_SUITE(os_callout_test_suite){   
+TEST_SUITE(os_callout_test_suite)
+{   
     callout_test();
 }


[7/9] incubator-mynewt-core git commit: correction of comments

Posted by ma...@apache.org.
correction of comments


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

Branch: refs/heads/develop
Commit: eacd9681ba0d577fac2c30a9a68fd73436c937d5
Parents: 3946efd
Author: NgesBrian <ng...@gmail.com>
Authored: Thu Jul 28 03:49:42 2016 +0100
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Thu Aug 18 09:20:59 2016 -0700

----------------------------------------------------------------------
 libs/os/src/test/callout_test.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/eacd9681/libs/os/src/test/callout_test.c
----------------------------------------------------------------------
diff --git a/libs/os/src/test/callout_test.c b/libs/os/src/test/callout_test.c
index 27241dd..f239db7 100644
--- a/libs/os/src/test/callout_test.c
+++ b/libs/os/src/test/callout_test.c
@@ -55,15 +55,15 @@ void
 callout_task_send()
 {
    
-    /* should say whether os is armed or not */
+    /* should say whether callout is armed or not */
     i = os_callout_queued(&callout_func_test.cf_c);
     TEST_ASSERT(i == 0);
 
-    /* Arm the OS */
+    /* Arm the callout */
     i = os_callout_reset(&callout_func_test.cf_c, OS_TICKS_PER_SEC/ 50);
     TEST_ASSERT_FATAL(i == 0);
 
-    /* should say whether os is armed or not */
+    /* should say whether callout is armed or not */
     i = os_callout_queued(&callout_func_test.cf_c);
     TEST_ASSERT(i == 1);
 
@@ -81,7 +81,7 @@ callout_task_receive(void *arg)
         TEST_ASSERT(event->ev_arg == NULL);
 
     TEST_ASSERT(i == 1);
-    /* should say whether os is armed or not */
+    /* should say whether callout is armed or not */
     i = os_callout_queued(&callout_func_test.cf_c);
     TEST_ASSERT(i == 0);
 


[3/9] incubator-mynewt-core git commit: advancement in the callout

Posted by ma...@apache.org.
advancement in the callout


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

Branch: refs/heads/develop
Commit: 0b7cd2f1f01554fd795b0b9a1116939f5c3cca4e
Parents: 3359c33
Author: NgesBrian <ng...@gmail.com>
Authored: Mon Jul 25 00:14:41 2016 +0100
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Thu Aug 18 09:20:59 2016 -0700

----------------------------------------------------------------------
 libs/os/src/test/callout_test.c | 44 +++++++++++++++++++++++-------------
 1 file changed, 28 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0b7cd2f1/libs/os/src/test/callout_test.c
----------------------------------------------------------------------
diff --git a/libs/os/src/test/callout_test.c b/libs/os/src/test/callout_test.c
index 350e94d..960a7fd 100644
--- a/libs/os/src/test/callout_test.c
+++ b/libs/os/src/test/callout_test.c
@@ -35,35 +35,44 @@ os_stack_t callout_task_stack_receive[CALLOUT_STACK_SIZE];
 
 /* Delearing variables for callout_func */
 struct os_callout_func callout_func_test;
-struct os_eventq *callout_eventq;
-void native_cputimer_cb(void *arg);
 
 /* The event to be sent*/
 struct os_eventq callout_evq;
 struct os_event callout_ev;
 
+/* This is the function for callout_init*/
+void my_callout_func(void *arg)
+{
+    int i;
+    i = 4;
+    TEST_ASSERT(i==4);
+}
+
 /* This is a callout task to send data */
 void
 callout_task_send()
 {
-   int i;
-    /* assigning the *callout_eventq */
-    callout_eventq = &callout_evq;
-
-    /* Initialize the callout function */
-    os_callout_func_init(&callout_func_test, callout_eventq,
-        native_cputimer_cb, NULL);
-
+    int i; 
     /* should say whether os is armed or not */
     i = os_callout_queued(&callout_func_test.cf_c);
     TEST_ASSERT(i == 0);
-    
+
     /* Arm the OS */
-    os_callout_reset(&callout_func_test.cf_c, OS_TICKS_PER_SEC/ 50);
-    
+    i = os_callout_reset(&callout_func_test.cf_c, OS_TICKS_PER_SEC/ 50);
+    TEST_ASSERT_FATAL(i == 0);
+
+    /* should say whether os is armed or not */
+    i = os_callout_queued(&callout_func_test.cf_c);
+    TEST_ASSERT(i == 1);
+
     /* Send the callout */ 
-    os_time_delay(OS_TICKS_PER_SEC / 50);
+    os_time_delay(OS_TICKS_PER_SEC );
+    TEST_ASSERT(i == 0);
+
+     /* should say whether os is armed or not */
+    i = os_callout_queued(&callout_func_test.cf_c);
     TEST_ASSERT(i == 0);
+
 }
 
 void
@@ -76,7 +85,6 @@ callout_task_receive(void *arg)
         TEST_ASSERT(event->ev_type ==  OS_EVENT_T_TIMER);
         TEST_ASSERT(event->ev_arg == NULL);
 
-
     /* Finishes the test when OS has been started */
     os_test_restart();
 
@@ -98,8 +106,12 @@ TEST_CASE(callout_test)
         callout_task_receive, NULL, RECEIVE_CALLOUT_TASK_PRIO, OS_WAIT_FOREVER,
         callout_task_stack_receive, CALLOUT_STACK_SIZE);
 
-    os_eventq_init(callout_eventq);
+    os_eventq_init(&callout_evq);
     
+    /* Initialize the callout function */
+    os_callout_func_init(&callout_func_test, &callout_evq,
+        my_callout_func, NULL);
+
     /* Does not return until OS_restart is called */
     os_start();
 


[8/9] incubator-mynewt-core git commit: updating the code as from last comment

Posted by ma...@apache.org.
updating the code as from last comment


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

Branch: refs/heads/develop
Commit: 618151456d514f5501cd0f8c79153d6a283dc2c1
Parents: f8af60d
Author: NgesBrian <ng...@gmail.com>
Authored: Wed Aug 10 12:26:52 2016 +0100
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Thu Aug 18 09:20:59 2016 -0700

----------------------------------------------------------------------
 libs/os/src/test/callout_test.c | 44 +++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/61815145/libs/os/src/test/callout_test.c
----------------------------------------------------------------------
diff --git a/libs/os/src/test/callout_test.c b/libs/os/src/test/callout_test.c
index 937b170..a56efd5 100644
--- a/libs/os/src/test/callout_test.c
+++ b/libs/os/src/test/callout_test.c
@@ -41,9 +41,6 @@ struct os_callout_func callout_func_test;
 struct os_eventq callout_evq;
 struct os_event callout_ev;
 
-int i; 
-int j;
- 
 /* The callout_stop task */
 #define SEND_STOP_CALLOUT_TASK_PRIO        (3)
 struct os_task callout_task_struct_stop_send;
@@ -73,37 +70,35 @@ os_stack_t callout_task_stack_listen[CALLOUT_STACK_SIZE];
 
 struct os_callout_func callout_func_speak;
 
+/* Global variables to be used by the callout functions */
+int p;
+int q;
+int t;
 /* This is the function for callout_init*/
 void
 my_callout_func(void *arg)
 {
-    int p;
     p = 4;
-    TEST_ASSERT(p == 4);
 }
 
 /* This is the function for callout_init of stop test_case*/
 void
 my_callout_stop_func(void *arg)
 {
-    int q;
     q = 1;
-    TEST_ASSERT(q == 1);
 }
 /* This is the function for callout_init for speak test_case*/
 void
 my_callout_speak_func(void *arg)
 {
-    int p;
-    p = 4;
-    TEST_ASSERT(p == 4);
+    t = 2;
 }
 
 /* This is a callout task to send data */
 void
 callout_task_send(void *arg )
 {
-   
+   int i;
     /* Should say whether callout is armed or not */
     i= os_callout_queued(&callout_func_test.cf_c);
     TEST_ASSERT(i == 0);
@@ -124,6 +119,7 @@ callout_task_send(void *arg )
 void
 callout_task_receive( void *arg)
 {
+    int i;
     struct os_event *event;
     os_time_t now;
     os_time_t tm;
@@ -133,7 +129,6 @@ callout_task_receive( void *arg)
     TEST_ASSERT(event->ev_type ==  OS_EVENT_T_TIMER);
     TEST_ASSERT(event->ev_arg == NULL);
 
-    TEST_ASSERT(i == 1);
     /* Should say whether callout is armed or not */
     i = os_callout_queued(&callout_func_test.cf_c);
     TEST_ASSERT(i == 0);
@@ -153,27 +148,25 @@ callout_task_receive( void *arg)
 void
 callout_task_stop_send( void *arg)
 {
-     int k;
-
+    int k;
+    int j;    
      /* Should say whether callout is armed or not */
     for(k = 0; k<MULTI_SIZE; k++){
         j = os_callout_queued(&callout_func_stop_test[k].cf_c);
         TEST_ASSERT(j == 0);
     }
 
+
     /* Show that  callout is not armed after calling callout_stop */
     for(k = 0; k<MULTI_SIZE; k++){
         os_callout_stop(&callout_func_stop_test[k].cf_c);
         j = os_callout_queued(&callout_func_stop_test[k].cf_c);
         TEST_ASSERT(j == 0);
     }
-    /* Assigning data to send */
+    /* Arm the callout */
     for(k = 0; k<MULTI_SIZE; k++){
-        callout_func_stop_test[k].cf_c.c_ev.ev_type = 10+ k;
-        callout_func_stop_test[k].cf_c.c_ev.ev_arg = NULL;
-
-         os_eventq_put(callout_func_stop_test[k].cf_c.c_evq,
-             &callout_func_stop_test[k].cf_c.c_ev);
+        j = os_callout_reset(&callout_func_stop_test[k].cf_c, OS_TICKS_PER_SEC/ 50);
+        TEST_ASSERT_FATAL(j == 0);
     }
     os_time_delay( OS_TICKS_PER_SEC );
 }
@@ -188,8 +181,9 @@ callout_task_stop_receive( void *arg )
     for(k=0; k<MULTI_SIZE; k++){
         event = os_eventq_poll(&callout_func_stop_test[k].cf_c.c_evq, 1,
            OS_WAIT_FOREVER);
-        TEST_ASSERT(event->ev_type == 10+k);
+        TEST_ASSERT(event->ev_type ==  OS_EVENT_T_TIMER);
         TEST_ASSERT(event->ev_arg == NULL);
+
      }
      
     /* Show that event is removed from the queued after calling callout_stop */
@@ -207,6 +201,7 @@ callout_task_stop_receive( void *arg )
 void
 callout_task_stop_speak( void *arg )
 {
+    int i;
     /* Arm the callout */
     i = os_callout_reset(&callout_func_speak.cf_c, OS_TICKS_PER_SEC/ 50);
     TEST_ASSERT_FATAL(i == 0);
@@ -216,7 +211,6 @@ callout_task_stop_speak( void *arg )
     TEST_ASSERT(i == 1);
 
     os_callout_stop(&callout_func_speak.cf_c);
-    TEST_ASSERT(i == 1);
     
     /* Send the callout */ 
     os_time_delay(OS_TICKS_PER_SEC/ 100 );
@@ -253,6 +247,7 @@ TEST_CASE(callout_test)
     /* Initialize the callout function */
     os_callout_func_init(&callout_func_test, &callout_evq,
         my_callout_func, NULL);
+    TEST_ASSERT(p == 4);
 
     /* Does not return until OS_restart is called */
     os_start();
@@ -284,6 +279,8 @@ TEST_CASE(callout_test_stop)
     for(k = 0; k<MULTI_SIZE; k++){
         os_callout_func_init(&callout_func_stop_test[k], &callout_stop_evq[k],
            my_callout_stop_func, NULL);
+         TEST_ASSERT(q == 1);
+
     }
 
     /* Does not return until OS_restart is called */
@@ -312,7 +309,8 @@ TEST_CASE(callout_test_speak)
     /* Initialize the callout function */
     os_callout_func_init(&callout_func_speak, &callout_evq,
         my_callout_speak_func, NULL);
-
+    TEST_ASSERT(t == 2);
+    
     /* Does not return until OS_restart is called */
     os_start();