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

[1/4] incubator-mynewt-site git commit: interim cut of sanity documentation

Repository: incubator-mynewt-site
Updated Branches:
  refs/heads/master 3b429b6c9 -> 67a4842f9


interim cut of sanity documentation


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

Branch: refs/heads/master
Commit: ac247fcb733add2b8e26ee72b81f693b3daa342e
Parents: 6dc8d74
Author: Sterling Hughes <st...@apache.org>
Authored: Fri Feb 26 17:50:47 2016 -0800
Committer: Sterling Hughes <st...@apache.org>
Committed: Fri Feb 26 17:50:47 2016 -0800

----------------------------------------------------------------------
 .../core_os/sanity/os_sanity_check_list_lock.md |   0
 .../sanity/os_sanity_check_list_unlock.md       |   0
 .../os/core_os/sanity/os_sanity_task_checkin.md |  34 ++++++
 docs/os/core_os/sanity/os_sanity_task_loop.md   |   0
 docs/os/core_os/sanity/sanity.md                | 108 ++++++++++++++++++-
 docs/os/core_os/task/os_task_sanity_checkin.md  |  34 ------
 6 files changed, 137 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/ac247fcb/docs/os/core_os/sanity/os_sanity_check_list_lock.md
----------------------------------------------------------------------
diff --git a/docs/os/core_os/sanity/os_sanity_check_list_lock.md b/docs/os/core_os/sanity/os_sanity_check_list_lock.md
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/ac247fcb/docs/os/core_os/sanity/os_sanity_check_list_unlock.md
----------------------------------------------------------------------
diff --git a/docs/os/core_os/sanity/os_sanity_check_list_unlock.md b/docs/os/core_os/sanity/os_sanity_check_list_unlock.md
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/ac247fcb/docs/os/core_os/sanity/os_sanity_task_checkin.md
----------------------------------------------------------------------
diff --git a/docs/os/core_os/sanity/os_sanity_task_checkin.md b/docs/os/core_os/sanity/os_sanity_task_checkin.md
new file mode 100644
index 0000000..6160d3d
--- /dev/null
+++ b/docs/os/core_os/sanity/os_sanity_task_checkin.md
@@ -0,0 +1,34 @@
+## <font color="F2853F" style="font-size:24pt"> os_sanity_task_checkin</font>
+
+```no-highlight
+int os_sanity_task_checkin(struct os_task *t)
+```
+Used by a task to check in to the sanity task. This informs the sanity task that 
+*task* is still alive and working normally.
+ 
+<br>
+#### Arguments
+
+| Arguments | Description | 
+|-----------|-------------| 
+| t | Pointer to task | 
+
+<br>
+#### Returned values
+
+OS_OK: sanity check-in successful
+
+All other error codes indicate an error.
+
+<br>
+#### Example
+
+```no-highlight
+    int rc;
+
+    rc = os_sanity_task_checkin(&my_task); 
+    assert(rc == OS_OK);
+
+```
+
+---------------------

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/ac247fcb/docs/os/core_os/sanity/os_sanity_task_loop.md
----------------------------------------------------------------------
diff --git a/docs/os/core_os/sanity/os_sanity_task_loop.md b/docs/os/core_os/sanity/os_sanity_task_loop.md
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/ac247fcb/docs/os/core_os/sanity/sanity.md
----------------------------------------------------------------------
diff --git a/docs/os/core_os/sanity/sanity.md b/docs/os/core_os/sanity/sanity.md
index 1e8b6c2..369b300 100644
--- a/docs/os/core_os/sanity/sanity.md
+++ b/docs/os/core_os/sanity/sanity.md
@@ -1,12 +1,112 @@
 # Sanity
 
+The Sanity task is a software watchdog task, which runs periodically to check
+system state, and ensure that everything is still operating properly.
 
-Insert synopsis here
+In a typical system design, there are multiple stages of watchdog: 
 
+* Internal Watchdog
+
+* External Watchdog 
+
+* Sanity Watchdog 
+
+The _Internal Watchdog_ is a typically a MCU watchdog, which is tickled in 
+the core of the OS.  The internal watchdog is tickled frequently, and is 
+meant to be an indicator the OS is running.
+
+The _External Watchdog_ is a watchdog that's typically run slower.  The 
+purpose of an external watchdog is to provide the system with a hard reset
+when it has lost it's mind.  
+
+The _Sanity Watchdog_ is the least frequently run watchdog, and is meant as 
+an application watchdog.  
+
+This document is about the operation of the Mynewt Sanity Watchdog.
 
 ## Description
 
-Describe OS feature here 
+### Initializing the Sanity Task
+
+The Sanity Watchdog is a task in the Mynewt OS, which when enabled, runs 
+every `sanity_seconds`.  In order to enable the Sanity Watchdog task, 
+call the `os_sanity_task_init()` function.
+
+```no-highlight
+int os_sanity_task_init(int sanity_seconds);
+```
+
+By default, every operating system task provides the frequency it will 
+check in with the sanity task, with the `sanity_itvl` parameter in the 
+`os_task_init()` function:
+
+```no-highlight
+int os_task_init(struct os_task *t, char *name, os_task_func_t func, 
+    void *arg, uint8_t prio, os_time_t sanity_itvl, os_stack_t *bottom,
+    uint16_t stack_size);
+```
+
+`sanity_itvl` is the time in OS time ticks that the task being created 
+must register in with the sanity task.  
+
+### Checking in with Sanity Task
+
+The task must then register in with the sanity task every `sanity_itvl` 
+seconds.  In order to do that, the task should call the `os_sanity_task_checkin`
+function, which will reset the sanity check associated with this task.
+Here is an example of a task that uses a callout to checkin with the 
+sanity task every 50 seconds:
+
+```no-highlight
+#define TASK1_SANITY_CHECKIN_ITVL (50 * OS_TICKS_PER_SEC) 
+struct os_eventq task1_evq;
+
+static void
+task1(void *arg)
+{
+    struct os_task *t;
+    struct os_event *ev;
+    struct os_callout c;
+    
+    /* Get current OS task */
+    t = os_sched_get_current_task();
+
+    /* Initialize the event queue. */
+    os_eventq_init(&task1_evq);
+
+    /* Initialize the callout */
+    os_callout_init(&c, &task1_evq, NULL);
+
+    /* reset the callout to checkin with the sanity task 
+     * in 50 seconds to kick off timing.
+     */
+    os_callout_reset(&c, TASK1_SANITY_CHECKIN_ITVL);
+
+    while (1) {
+        ev = os_eventq_get(&task1_evq);
+
+        /* The sanity timer has reset */
+        if (ev->ev_arg == &c) {
+            os_sanity_task_checkin(t);
+        } else {
+            /* not expecting any other events */
+            assert(0);
+        }
+    }
+    
+    /* Should never reach */
+    assert(0);
+}
+```
+
+### Registering a Custom Sanity Check
+
+
+If a particular task wants to further hook into the sanity framework, to 
+perform other checks during the sanity task's operation, it can do so by
+registering a `struct os_sanity_check` using the `os_sanity_check_register`
+function.
+
 
 ## Data structures
 
@@ -17,9 +117,7 @@ Replace this with the list of data structures used, why, any neat features
 The functions available in sanity are:
 
 * [os_sanity_check_init](os_sanity_check_init.md)
-* [os_sanity_check_list_lock](os_sanity_check_list_lock.md)
-* [os_sanity_check_list_unlock](os_sanity_check_list_unlock.md)
 * [os_sanity_check_register](os_sanity_check_register.md)
 * [os_sanity_check_reset](os_sanity_check_reset.md)
+* [os_sanity_task_checkin](os_sanity_task_checkin.md)
 * [os_sanity_task_init](os_sanity_task_init.md)
-* [os_sanity_task_loop](os_sanity_task_loop.md)

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/ac247fcb/docs/os/core_os/task/os_task_sanity_checkin.md
----------------------------------------------------------------------
diff --git a/docs/os/core_os/task/os_task_sanity_checkin.md b/docs/os/core_os/task/os_task_sanity_checkin.md
deleted file mode 100644
index 1f77a3d..0000000
--- a/docs/os/core_os/task/os_task_sanity_checkin.md
+++ /dev/null
@@ -1,34 +0,0 @@
-## <font color="F2853F" style="font-size:24pt"> os_task_sanity_checkin</font>
-
-```no-highlight
-int os_task_sanity_checkin(struct os_task *t)
-```
-Used by a task to check in to the sanity task. This informs the sanity task that 
-*task* is still alive and working normally.
- 
-<br>
-#### Arguments
-
-| Arguments | Description | 
-|-----------|-------------| 
-| t | Pointer to task | 
-
-<br>
-#### Returned values
-
-OS_OK: sanity check-in successful
-
-All other error codes indicate an error.
-
-<br>
-#### Example
-
-```no-highlight
-    int rc;
-
-    rc = os_task_sanity_checkin(&my_task); 
-    assert(rc == OS_OK);
-
-```
-
----------------------


[3/4] incubator-mynewt-site git commit: Merge branch 'sanity_docs' of https://github.com/sterlinghughes/incubator-mynewt-site

Posted by ad...@apache.org.
Merge branch 'sanity_docs' of https://github.com/sterlinghughes/incubator-mynewt-site


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

Branch: refs/heads/master
Commit: c01f867ae09462e304b661382a3599b539bbef13
Parents: 3b429b6 bc8b37b
Author: aditihilbert <ad...@runtime.io>
Authored: Sun Feb 28 13:52:33 2016 -0800
Committer: aditihilbert <ad...@runtime.io>
Committed: Sun Feb 28 13:52:33 2016 -0800

----------------------------------------------------------------------
 docs/os/core_os/sanity/os_sanity_check_init.md  |  34 ++++
 .../core_os/sanity/os_sanity_check_list_lock.md |   0
 .../sanity/os_sanity_check_list_unlock.md       |   0
 .../core_os/sanity/os_sanity_check_register.md  |  34 ++++
 docs/os/core_os/sanity/os_sanity_check_reset.md |  35 ++++
 .../os/core_os/sanity/os_sanity_task_checkin.md |  34 ++++
 docs/os/core_os/sanity/os_sanity_task_init.md   |  36 ++++
 docs/os/core_os/sanity/os_sanity_task_loop.md   |   0
 docs/os/core_os/sanity/sanity.md                | 181 ++++++++++++++++++-
 docs/os/core_os/task/os_task_sanity_checkin.md  |  34 ----
 docs/os/core_os/task/task.md                    |   1 -
 mkdocs.yml                                      |   4 +-
 12 files changed, 349 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/c01f867a/mkdocs.yml
----------------------------------------------------------------------


[4/4] incubator-mynewt-site git commit: Added doc on sanity. plus minor typo edits. This closes #14 .

Posted by ad...@apache.org.
Added doc on sanity. plus minor typo edits. This closes #14 .


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

Branch: refs/heads/master
Commit: 67a4842f9ff03a8b61a2cdb5886012b988bd5c12
Parents: c01f867
Author: aditihilbert <ad...@runtime.io>
Authored: Sun Feb 28 14:51:39 2016 -0800
Committer: aditihilbert <ad...@runtime.io>
Committed: Sun Feb 28 14:51:47 2016 -0800

----------------------------------------------------------------------
 docs/os/core_os/sanity/sanity.md | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/67a4842f/docs/os/core_os/sanity/sanity.md
----------------------------------------------------------------------
diff --git a/docs/os/core_os/sanity/sanity.md b/docs/os/core_os/sanity/sanity.md
index 2c33211..44666d6 100644
--- a/docs/os/core_os/sanity/sanity.md
+++ b/docs/os/core_os/sanity/sanity.md
@@ -11,13 +11,13 @@ In a typical system design, there are multiple stages of watchdog:
 
 * Sanity Watchdog 
 
-The _Internal Watchdog_ is a typically a MCU watchdog, which is tickled in 
+The _Internal Watchdog_ is typically an MCU watchdog, which is tickled in 
 the core of the OS.  The internal watchdog is tickled frequently, and is 
 meant to be an indicator the OS is running.
 
 The _External Watchdog_ is a watchdog that's typically run slower.  The 
 purpose of an external watchdog is to provide the system with a hard reset
-when it has lost it's mind.  
+when it has lost its mind.  
 
 The _Sanity Watchdog_ is the least frequently run watchdog, and is meant as 
 an application watchdog.  
@@ -101,7 +101,7 @@ task1(void *arg)
 
 ### Registering a Custom Sanity Check
 
-If a particular task wants to further hook into the sanity framework, to 
+If a particular task wants to further hook into the sanity framework to 
 perform other checks during the sanity task's operation, it can do so by
 registering a `struct os_sanity_check` using the `os_sanity_check_register`
 function.
@@ -147,14 +147,14 @@ err:
 
 In the above example, every time the custom sanity check 
 `mymodule_perform_sanity_check` returns successfully (0), 
-the sanity check is reset.  In the `OS_SANITY_CEHCK_SETFUNC` macro,
+the sanity check is reset.  In the `OS_SANITY_CHECK_SETFUNC` macro,
 the sanity checkin interval is specified as 50 * SANITY_TASK_INTERVAL 
 (which is the interval at which the sanity task runs.)  This means 
 that the `mymodule_perform_sanity_check()` function needs to fail
 50 times consecutively before the sanity task will crash the system.
 
 **TIP:**  When checking things like memory buffers, which can be temporarily 
-be exhausted, its a good idea to have the sanity check fail multiple 
+be exhausted, it's a good idea to have the sanity check fail multiple 
 consecutive times before crashing the system.  This will avoid crashing
 for temporary failures.
 
@@ -176,7 +176,7 @@ struct os_sanity_check {
 
 | **Element** | **Description** |
 |-----------|-------------|
-| `sc_checkin_last` | The last time this sanity check, checked in with the sanity task in OS time ticks. |
+| `sc_checkin_last` | The last time this sanity check checked in with the sanity task, in OS time ticks. |
 | `sc_checkin_itvl` | How frequently the sanity check is supposed to check in with the sanity task, in OS time ticks. |
 | `sc_func` | If not `NULL`, call this function when running the sanity task.  If the function returns 0, reset the sanity check. |
 | `sc_arg` | Argument to pass to `sc_func` when calling it. |


[2/4] incubator-mynewt-site git commit: finish sanity documentation

Posted by ad...@apache.org.
finish sanity documentation


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

Branch: refs/heads/master
Commit: bc8b37b169a514e9498841632fb89e2e9c5d1d6b
Parents: ac247fc
Author: Sterling Hughes <st...@apache.org>
Authored: Fri Feb 26 18:37:19 2016 -0800
Committer: Sterling Hughes <st...@apache.org>
Committed: Fri Feb 26 18:37:19 2016 -0800

----------------------------------------------------------------------
 docs/os/core_os/sanity/os_sanity_check_init.md  | 34 +++++++++
 .../core_os/sanity/os_sanity_check_register.md  | 34 +++++++++
 docs/os/core_os/sanity/os_sanity_check_reset.md | 35 +++++++++
 .../os/core_os/sanity/os_sanity_task_checkin.md |  4 +-
 docs/os/core_os/sanity/os_sanity_task_init.md   | 36 ++++++++++
 docs/os/core_os/sanity/sanity.md                | 75 +++++++++++++++++++-
 docs/os/core_os/task/task.md                    |  1 -
 mkdocs.yml                                      |  4 +-
 8 files changed, 215 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/bc8b37b1/docs/os/core_os/sanity/os_sanity_check_init.md
----------------------------------------------------------------------
diff --git a/docs/os/core_os/sanity/os_sanity_check_init.md b/docs/os/core_os/sanity/os_sanity_check_init.md
index e69de29..2073647 100644
--- a/docs/os/core_os/sanity/os_sanity_check_init.md
+++ b/docs/os/core_os/sanity/os_sanity_check_init.md
@@ -0,0 +1,34 @@
+## <font color="F2853F" style="font-size:24pt"> os_sanity_check_init</font>
+
+```no-highlight
+int os_sanity_check_init(struct os_sanity_check *sc)
+```
+Initialize the sanity check pointed to by `sc`.  Sets default values, and ensures
+memory is cleared out.
+ 
+<br>
+#### Arguments
+
+| Arguments | Description | 
+|-----------|-------------| 
+| `sc` | Pointer to sanity check | 
+
+<br>
+#### Returned values
+
+`OS_OK`: sanity check initialization is successful 
+
+All other error codes indicate an error.
+
+<br>
+#### Example
+
+```no-highlight
+    int rc;
+
+    rc = os_sanity_task_check_init(&my_sanity_check); 
+    assert(rc == OS_OK);
+
+```
+
+---------------------

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/bc8b37b1/docs/os/core_os/sanity/os_sanity_check_register.md
----------------------------------------------------------------------
diff --git a/docs/os/core_os/sanity/os_sanity_check_register.md b/docs/os/core_os/sanity/os_sanity_check_register.md
index e69de29..8674766 100644
--- a/docs/os/core_os/sanity/os_sanity_check_register.md
+++ b/docs/os/core_os/sanity/os_sanity_check_register.md
@@ -0,0 +1,34 @@
+## <font color="F2853F" style="font-size:24pt"> os_sanity_check_register</font>
+
+```no-highlight
+int os_sanity_check_register(struct os_sanity_check *sc)
+```
+Register the sanity check pointed to by `sc` with the sanity task.  After registration
+the sanity task will check this sanity check with every run of the sanity task.
+ 
+<br>
+#### Arguments
+
+| Arguments | Description | 
+|-----------|-------------| 
+| `sc` | Pointer to sanity check | 
+
+<br>
+#### Returned values
+
+`OS_OK`: sanity check successfully registered
+
+All other error codes indicate an error.
+
+<br>
+#### Example
+
+```no-highlight
+    int rc;
+
+    rc = os_sanity_check_register(&my_sc); 
+    assert(rc == OS_OK);
+
+```
+
+---------------------

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/bc8b37b1/docs/os/core_os/sanity/os_sanity_check_reset.md
----------------------------------------------------------------------
diff --git a/docs/os/core_os/sanity/os_sanity_check_reset.md b/docs/os/core_os/sanity/os_sanity_check_reset.md
index e69de29..f945a66 100644
--- a/docs/os/core_os/sanity/os_sanity_check_reset.md
+++ b/docs/os/core_os/sanity/os_sanity_check_reset.md
@@ -0,0 +1,35 @@
+## <font color="F2853F" style="font-size:24pt"> os_sanity_check_reset</font>
+
+```no-highlight
+int os_sanity_check_reset(struct os_sanity_check *sc)
+```
+Reset the sanity check pointed to by sc.  This tells the sanity task that 
+this sanity check is considered valid for another `sc_checkin_itvl` time 
+ticks.
+ 
+<br>
+#### Arguments
+
+| Arguments | Description | 
+|-----------|-------------| 
+| `sc` | Pointer to sanity check | 
+
+<br>
+#### Returned values
+
+`OS_OK`: sanity check reset successful
+
+All other error codes indicate an error.
+
+<br>
+#### Example
+
+```no-highlight
+    int rc;
+
+    rc = os_sanity_check_reset(&my_sc); 
+    assert(rc == OS_OK);
+
+```
+
+---------------------

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/bc8b37b1/docs/os/core_os/sanity/os_sanity_task_checkin.md
----------------------------------------------------------------------
diff --git a/docs/os/core_os/sanity/os_sanity_task_checkin.md b/docs/os/core_os/sanity/os_sanity_task_checkin.md
index 6160d3d..2d797d7 100644
--- a/docs/os/core_os/sanity/os_sanity_task_checkin.md
+++ b/docs/os/core_os/sanity/os_sanity_task_checkin.md
@@ -11,12 +11,12 @@ Used by a task to check in to the sanity task. This informs the sanity task that
 
 | Arguments | Description | 
 |-----------|-------------| 
-| t | Pointer to task | 
+| `t` | Pointer to task | 
 
 <br>
 #### Returned values
 
-OS_OK: sanity check-in successful
+`OS_OK`: sanity check-in successful
 
 All other error codes indicate an error.
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/bc8b37b1/docs/os/core_os/sanity/os_sanity_task_init.md
----------------------------------------------------------------------
diff --git a/docs/os/core_os/sanity/os_sanity_task_init.md b/docs/os/core_os/sanity/os_sanity_task_init.md
index e69de29..dce0e1a 100644
--- a/docs/os/core_os/sanity/os_sanity_task_init.md
+++ b/docs/os/core_os/sanity/os_sanity_task_init.md
@@ -0,0 +1,36 @@
+## <font color="F2853F" style="font-size:24pt"> os_sanity_task_init</font>
+
+```no-highlight
+int os_sanity_task_init(int num_secs);
+```
+Initialize the os sanity task.  `num_secs` is the number of seconds to wait
+in between runs of the sanity task.
+
+<br>
+#### Arguments
+
+| Arguments | Description | 
+|-----------|-------------| 
+| `num_secs` | Number of seconds to wait in between running sanity checks. | 
+
+<br>
+#### Returned values
+
+`OS_OK`: Sanity task was successfully created.
+
+All other error codes indicate an error.
+
+<br>
+#### Example
+
+```no-highlight
+/* Run sanity checks every 50 seconds */
+
+#define SANITY_TASK_INTERVAL (50)
+    int rc;
+
+    rc = os_sanity_task_init(SANITY_TASK_INTERVAL); 
+    assert(rc == OS_OK);
+```
+
+---------------------

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/bc8b37b1/docs/os/core_os/sanity/sanity.md
----------------------------------------------------------------------
diff --git a/docs/os/core_os/sanity/sanity.md b/docs/os/core_os/sanity/sanity.md
index 369b300..2c33211 100644
--- a/docs/os/core_os/sanity/sanity.md
+++ b/docs/os/core_os/sanity/sanity.md
@@ -101,16 +101,87 @@ task1(void *arg)
 
 ### Registering a Custom Sanity Check
 
-
 If a particular task wants to further hook into the sanity framework, to 
 perform other checks during the sanity task's operation, it can do so by
 registering a `struct os_sanity_check` using the `os_sanity_check_register`
 function.
 
+```no-highlight
+static int 
+mymodule_perform_sanity_check(struct os_sanity_check *sc, void *arg)
+{
+    /* Perform your checking here.  In this case, we check if there 
+     * are available buffers in mymodule, and return 0 (all good)
+     * if true, and -1 (error) if not.
+     */
+    if (mymodule_has_buffers()) {
+        return (0);
+    } else {
+        return (-1);
+    }
+}
+
+static int 
+mymodule_register_sanity_check(void)
+{
+    struct os_sanity_check sc;
+
+    os_sanity_check_init(&sc);
+    /* Only assert() if mymodule_perform_sanity_check() fails 50 
+     * times.  SANITY_TASK_INTERVAL is defined by the user, and 
+     * is the frequency at which the sanity_task runs in seconds.
+     */
+    OS_SANITY_CHECK_SETFUNC(&sc, mymodule_perform_sanity_check, NULL, 
+        50 * SANITY_TASK_INTERVAL);
+
+    rc = os_sanity_check_register(&sc);
+    if (rc != 0) {
+        goto err;
+    } 
+
+    return (0);
+err:
+    return (rc);
+}
+```
+
+In the above example, every time the custom sanity check 
+`mymodule_perform_sanity_check` returns successfully (0), 
+the sanity check is reset.  In the `OS_SANITY_CEHCK_SETFUNC` macro,
+the sanity checkin interval is specified as 50 * SANITY_TASK_INTERVAL 
+(which is the interval at which the sanity task runs.)  This means 
+that the `mymodule_perform_sanity_check()` function needs to fail
+50 times consecutively before the sanity task will crash the system.
+
+**TIP:**  When checking things like memory buffers, which can be temporarily 
+be exhausted, its a good idea to have the sanity check fail multiple 
+consecutive times before crashing the system.  This will avoid crashing
+for temporary failures.
 
 ## Data structures
 
-Replace this with the list of data structures used, why, any neat features
+### OS Sanity Check 
+
+```no-highlight
+struct os_sanity_check {
+    os_time_t sc_checkin_last;
+    os_time_t sc_checkin_itvl;
+    os_sanity_check_func_t sc_func;
+    void *sc_arg; 
+
+    SLIST_ENTRY(os_sanity_check) sc_next;
+};
+```
+
+
+| **Element** | **Description** |
+|-----------|-------------|
+| `sc_checkin_last` | The last time this sanity check, checked in with the sanity task in OS time ticks. |
+| `sc_checkin_itvl` | How frequently the sanity check is supposed to check in with the sanity task, in OS time ticks. |
+| `sc_func` | If not `NULL`, call this function when running the sanity task.  If the function returns 0, reset the sanity check. |
+| `sc_arg` | Argument to pass to `sc_func` when calling it. |
+| `sc_next` | Sanity checks are chained in the sanity task when `os_sanity_check_register()` is called. |
+
 
 ## List of Functions
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/bc8b37b1/docs/os/core_os/task/task.md
----------------------------------------------------------------------
diff --git a/docs/os/core_os/task/task.md b/docs/os/core_os/task/task.md
index 6a2a591..06e904b 100644
--- a/docs/os/core_os/task/task.md
+++ b/docs/os/core_os/task/task.md
@@ -224,4 +224,3 @@ The functions available in task are:
 * [os_task_init](os_task_init.md)
 * [os_task_count](os_task_count.md)
 * [os_task_info_get_next](os_task_info_get_next.md)
-* [os_task_sanity_checkin](os_task_sanity_checkin.md)

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/bc8b37b1/mkdocs.yml
----------------------------------------------------------------------
diff --git a/mkdocs.yml b/mkdocs.yml
index dd291b9..3e895c7 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -51,7 +51,6 @@ pages:
                     - 'os_task_count': 'os/core_os/task/os_task_count.md'
                     - 'os_task_info_get_next': 'os/core_os/task/os_task_info_get_next.md'
                     - 'os_task_init': 'os/core_os/task/os_task_init.md'
-                    - 'os_task_sanity_checkin': 'os/core_os/task/os_task_sanity_checkin.md'
             - Event Queues: 
                 - 'Overview': 'os/core_os/event_queue/event_queue.md'
                 - 'Functions':
@@ -119,10 +118,9 @@ pages:
                 - 'Overview': 'os/core_os/sanity/sanity.md'
                 - 'Functions': 
                     - 'os_sanity_check_init': 'os/core_os/sanity/os_sanity_check_init.md'
-                    - 'os_sanity_check_list_lock': 'os/core_os/sanity/os_sanity_check_list_lock.md'
-                    - 'os_sanity_check_list_unlock': 'os/core_os/sanity/os_sanity_check_list_unlock.md'
                     - 'os_sanity_check_register': 'os/core_os/sanity/os_sanity_check_register.md'
                     - 'os_sanity_check_reset': 'os/core_os/sanity/os_sanity_check_reset.md'
+                    - 'os_sanity_task_checkin': 'os/core_os/sanity/os_sanity_task_checkin.md'
                     - 'os_sanity_task_init': 'os/core_os/sanity/os_sanity_task_init.md'
             - Callouts: 
                 - 'Overview': 'os/core_os/callout/callout.md'