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/03/13 23:58:16 UTC

[1/4] incubator-mynewt-site git commit: added syntax highlighting to os_core docs

Repository: incubator-mynewt-site
Updated Branches:
  refs/heads/asf-site 95e9034c6 -> 1fd93d7e2


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/memory_pool/os_memblock_put/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/memory_pool/os_memblock_put/index.html b/os/core_os/memory_pool/os_memblock_put/index.html
index 0a1d756..7f58bc2 100644
--- a/os/core_os/memory_pool/os_memblock_put/index.html
+++ b/os/core_os/memory_pool/os_memblock_put/index.html
@@ -737,7 +737,7 @@
                         </div>
                         
                             <h2 id="os_memblock_put"><font color="#F2853F" style="font-size:24pt">os_memblock_put</font><a class="headerlink" href="#os_memblock_put" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">os_error_t os_memblock_put(struct os_mempool *mp, void *block_addr)
+<pre><code class="c">os_error_t os_memblock_put(struct os_mempool *mp, void *block_addr)
 </code></pre>
 
 <p>Releases previously allocated element back to the pool.  </p>
@@ -768,7 +768,7 @@ OS_INVALID_PARAM: If either mp or block_addr were NULL, or the block being freed
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">    if (file != NULL) {
+<pre><code class="c">    if (file != NULL) {
         rc = os_memblock_put(&amp;nffs_file_pool, file);
         if (rc != 0) {
             /* Error freeing memory block */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/memory_pool/os_mempool_init/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/memory_pool/os_mempool_init/index.html b/os/core_os/memory_pool/os_mempool_init/index.html
index d8bdfdd..0aa1dc8 100644
--- a/os/core_os/memory_pool/os_mempool_init/index.html
+++ b/os/core_os/memory_pool/os_mempool_init/index.html
@@ -737,7 +737,7 @@
                         </div>
                         
                             <h2 id="os_mempool_init"><font color="F2853F" style="font-size:24pt"> os_mempool_init</font><a class="headerlink" href="#os_mempool_init" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">os_error_t os_mempool_init(struct os_mempool *mp, int blocks, int block_size, void *membuf, char *name)
+<pre><code class="c">os_error_t os_mempool_init(struct os_mempool *mp, int blocks, int block_size, void *membuf, char *name)
 </code></pre>
 
 <p>Initializes the memory pool. Memory pointed to by <em>membuf</em> is divided into <em>blocks</em> number of elements of size OS_ALIGN(<em>block_size</em>). The <em>name</em> is optional, and names the memory pool.</p>
@@ -783,7 +783,7 @@ OS_MEM_NOT_ALIGNED: membuf was not aligned on correct byte boundary.</p>
 <p>It's recommended that you use <em>OS_MEMPOOL_BYTES()</em> or <em>OS_MEMPOOL_SIZE()</em> to figure out how much memory to allocate for the pool.</p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">    void *nffs_file_mem;
+<pre><code class="c">    void *nffs_file_mem;
 
     nffs_file_mem = malloc(OS_MEMPOOL_BYTES(nffs_config.nc_num_files, sizeof (struct nffs_file)));
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mqueue/mqueue/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mqueue/mqueue/index.html b/os/core_os/mqueue/mqueue/index.html
index 73a3f81..827e79f 100644
--- a/os/core_os/mqueue/mqueue/index.html
+++ b/os/core_os/mqueue/mqueue/index.html
@@ -724,7 +724,7 @@
 <h3 id="using-mqueue">Using Mqueue<a class="headerlink" href="#using-mqueue" title="Permanent link">&para;</a></h3>
 <p>The following code sample will demonstrate how to use an mqueue. This is a simple example where packets are put on a "receive queue" and a task processes that "receive queue" by incrementing the total number of packet received and then freeing the packet. Not shown in the code example is a call my_task_rx_data_func. Presumably, some other code will call this API. </p>
 <p><br></p>
-<pre><code class="no-highlight">uint32_t pkts_rxd;
+<pre><code class="c">uint32_t pkts_rxd;
 struct os_mqueue rxpkt_q;
 struct os_eventq my_task_evq;
 
@@ -784,7 +784,7 @@ my_task_handler(void *arg)
 </code></pre>
 
 <h3 id="data-structures">Data Structures<a class="headerlink" href="#data-structures" title="Permanent link">&para;</a></h3>
-<pre><code class="no-highlight">struct os_mqueue {
+<pre><code class="c">struct os_mqueue {
     STAILQ_HEAD(, os_mbuf_pkthdr) mq_head;
     struct os_event mq_ev;
 };

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mqueue/os_mqueue_get/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mqueue/os_mqueue_get/index.html b/os/core_os/mqueue/os_mqueue_get/index.html
index ae2fdad..70fd6cc 100644
--- a/os/core_os/mqueue/os_mqueue_get/index.html
+++ b/os/core_os/mqueue/os_mqueue_get/index.html
@@ -754,7 +754,7 @@
                         </div>
                         
                             <h2 id="os_mqueue_get"><font color="#F2853F" style="font-size:24pt">os_mqueue_get</font><a class="headerlink" href="#os_mqueue_get" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">struct os_mbuf *os_mqueue_get(struct os_mqueue *mq)
+<pre><code class="c">struct os_mbuf *os_mqueue_get(struct os_mqueue *mq)
 </code></pre>
 
 <p>Retrieves a packet off an Mqueue. Returns a pointer to the mbuf at the head of the mbuf chain. NULL if no packets are on the queue.</p>
@@ -779,7 +779,7 @@
 <p>The packet at the head of the queue or NULL if no packets are on the queue.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">uint32_t pkts_rxd;
+<pre><code class="c">uint32_t pkts_rxd;
 struct os_mqueue rxpkt_q;
 
 void

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mqueue/os_mqueue_init/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mqueue/os_mqueue_init/index.html b/os/core_os/mqueue/os_mqueue_init/index.html
index 56b80b9..2c3ea3d 100644
--- a/os/core_os/mqueue/os_mqueue_init/index.html
+++ b/os/core_os/mqueue/os_mqueue_init/index.html
@@ -754,7 +754,7 @@
                         </div>
                         
                             <h2 id="os_mqueue_init"><font color="#F2853F" style="font-size:24pt">os_mqueue_init</font><a class="headerlink" href="#os_mqueue_init" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int os_mqueue_init(struct os_mqueue *mq, void *arg)
+<pre><code class="c">int os_mqueue_init(struct os_mqueue *mq, void *arg)
 </code></pre>
 
 <p>Initializes an queue. Sets the event argument in the os event of the mqueue to <em>arg</em>. Sets type of event to OS_EVENT_T_MQUEUE_DATA.</p>
@@ -783,7 +783,7 @@
 <p>0: success. All other values indicate an error</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">/* Declare mqueue */
+<pre><code class="c">/* Declare mqueue */
 struct os_mqueue rxpkt_q;
 
 /* Initialize mqueue */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mqueue/os_mqueue_put/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mqueue/os_mqueue_put/index.html b/os/core_os/mqueue/os_mqueue_put/index.html
index 4c9ec23..6b75629 100644
--- a/os/core_os/mqueue/os_mqueue_put/index.html
+++ b/os/core_os/mqueue/os_mqueue_put/index.html
@@ -754,7 +754,7 @@
                         </div>
                         
                             <h2 id="os_mqueue_put"><font color="#F2853F" style="font-size:24pt">os_mqueue_put</font><a class="headerlink" href="#os_mqueue_put" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int os_mqueue_put(struct os_mqueue *mq, struct os_eventq *evq, struct os_mbuf *m)
+<pre><code class="c">int os_mqueue_put(struct os_mqueue *mq, struct os_eventq *evq, struct os_mbuf *m)
 </code></pre>
 
 <p>Adds a packet (i.e. packet header mbuf) to an mqueue. Post event to <em>evq</em>. </p>
@@ -788,7 +788,7 @@
 <p>OS_EINVAL: the mbuf is not a packet header mbuf.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">int
+<pre><code class="c">int
 my_task_rx_data_func(struct os_mbuf *om)
 {
     int rc;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/msys/os_msys_get/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/msys/os_msys_get/index.html b/os/core_os/msys/os_msys_get/index.html
index 4ec158c..9e0d2d3 100644
--- a/os/core_os/msys/os_msys_get/index.html
+++ b/os/core_os/msys/os_msys_get/index.html
@@ -764,7 +764,7 @@
                         </div>
                         
                             <h2 id="os_msys_get"><font color="#F2853F" style="font-size:24pt">os_msys_get</font><a class="headerlink" href="#os_msys_get" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">struct os_mbuf *os_msys_get(uint16_t dsize, uint16_t leadingspace)
+<pre><code class="c">struct os_mbuf *os_msys_get(uint16_t dsize, uint16_t leadingspace)
 </code></pre>
 
 <p>Retrieve an mbuf from the system mbuf pools with <em>leadingspace</em> bytes available in the mbuf.</p>
@@ -797,7 +797,7 @@
 <p>This API will not return an mbuf from a larger mbuf pool if the appropriate msys mbuf pool is empty. See the overview for more information.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    struct os_mbuf *om;
+<pre><code class="c">    struct os_mbuf *om;
 
     /* Allocate an mbuf with hopefully at least 100 bytes in its user data buffer */
     om = os_msys_get(100, 0);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/msys/os_msys_get_pkthdr/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/msys/os_msys_get_pkthdr/index.html b/os/core_os/msys/os_msys_get_pkthdr/index.html
index ded1d78..1d79963 100644
--- a/os/core_os/msys/os_msys_get_pkthdr/index.html
+++ b/os/core_os/msys/os_msys_get_pkthdr/index.html
@@ -764,7 +764,7 @@
                         </div>
                         
                             <h2 id="os_msys_get_pkthdr"><font color="#F2853F" style="font-size:24pt">os_msys_get_pkthdr</font><a class="headerlink" href="#os_msys_get_pkthdr" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">struct os_mbuf *os_msys_get_pkthdr(uint16_t dsize, uint16_t user_hdr_len)
+<pre><code class="c">struct os_mbuf *os_msys_get_pkthdr(uint16_t dsize, uint16_t user_hdr_len)
 </code></pre>
 
 <p>Retrieve a packet header mbuf from the system mbuf pools with <em>user_hdr_len</em> bytes available for the user header in the mbuf.</p>
@@ -796,7 +796,7 @@
 <p>The same notes apply to this API as to <code>os_msys_get()</code>.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    struct os_mbuf *om;
+<pre><code class="c">    struct os_mbuf *om;
     struct my_user_hdr_struct my_usr_hdr;
 
     /*

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/msys/os_msys_register/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/msys/os_msys_register/index.html b/os/core_os/msys/os_msys_register/index.html
index ce2210e..4d278ff 100644
--- a/os/core_os/msys/os_msys_register/index.html
+++ b/os/core_os/msys/os_msys_register/index.html
@@ -764,7 +764,7 @@
                         </div>
                         
                             <h2 id="os_msys_register"><font color="#F2853F" style="font-size:24pt">os_msys_register</font><a class="headerlink" href="#os_msys_register" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int os_msys_register(struct os_mbuf_pool *new_pool) 
+<pre><code class="c">int os_msys_register(struct os_mbuf_pool *new_pool) 
 </code></pre>
 
 <p>Register an mbuf pool for use as a system mbuf pool. The pool should be initialized prior to registration.</p>
@@ -789,7 +789,7 @@
 <p>0 on success; all other values indicate an error.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    rc = os_msys_register(&amp;g_mbuf_pool);
+<pre><code class="c">    rc = os_msys_register(&amp;g_mbuf_pool);
     assert(rc == 0);
 </code></pre>
                         

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/msys/os_msys_reset/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/msys/os_msys_reset/index.html b/os/core_os/msys/os_msys_reset/index.html
index 101c2f5..0078c28 100644
--- a/os/core_os/msys/os_msys_reset/index.html
+++ b/os/core_os/msys/os_msys_reset/index.html
@@ -764,7 +764,7 @@
                         </div>
                         
                             <h2 id="os_msys_reset"><font color="#F2853F" style="font-size:24pt">os_msys_reset</font><a class="headerlink" href="#os_msys_reset" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void os_msys_reset(void) 
+<pre><code class="c">void os_msys_reset(void) 
 </code></pre>
 
 <p>Resets msys module. This de-registers all pools from msys but does nothing to the pools themselves (they still exist as mbuf pools).</p>
@@ -776,7 +776,7 @@
 <p>None</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    os_msys_reset(); 
+<pre><code class="c">    os_msys_reset(); 
 </code></pre>
                         
                         <div class="row">

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mutex/mutex/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mutex/mutex/index.html b/os/core_os/mutex/mutex/index.html
index e2b7ce6..1211659 100644
--- a/os/core_os/mutex/mutex/index.html
+++ b/os/core_os/mutex/mutex/index.html
@@ -688,7 +688,7 @@
 <p>The following example will illustrate how priority inheritance works. In this example, the task number is the same as its priority. Remember that the lower the number, the higher the priority (i.e. priority 0 is higher priority than priority 1). Suppose that task 5 gets ownership of a mutex but is preempted by task 4. Task 4 attempts to gain ownership of the mutex but cannot as it is owned by task 5. Task 4 is put to sleep and task 5 is temporarily raised to priority 4. Before task 5 can release the mutex, task 3 runs and attempts to acquire the mutex. At this point, both task 3 and task 4 are waiting on the mutex (sleeping). Task 5 now runs at priority 3 (the highest priority of all the tasks waiting on the mutex). When task 5 finally releases the mutex it will be preempted as two higher priority tasks are waiting for it. </p>
 <p>Note that when multiple tasks are waiting on a mutex owned by another task, once the mutex is released the highest priority task waiting on the mutex is run. </p>
 <h3 id="data-structures">Data structures<a class="headerlink" href="#data-structures" title="Permanent link">&para;</a></h3>
-<pre><code class="no-highlight">struct os_mutex
+<pre><code class="c">struct os_mutex
 {
     SLIST_HEAD(, os_task) mu_head;
     uint8_t     _pad;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mutex/os_mutex_pend/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mutex/os_mutex_pend/index.html b/os/core_os/mutex/os_mutex_pend/index.html
index 3eb9e4d..91bd244 100644
--- a/os/core_os/mutex/os_mutex_pend/index.html
+++ b/os/core_os/mutex/os_mutex_pend/index.html
@@ -707,7 +707,7 @@
                         </div>
                         
                             <h2 id="os_mutex_pend"><font color="#F2853F" style="font-size:24pt">os_mutex_pend </font><a class="headerlink" href="#os_mutex_pend" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">os_error_t os_mutex_pend(struct os_mutex *mu, uint32_t timeout) 
+<pre><code class="c">os_error_t os_mutex_pend(struct os_mutex *mu, uint32_t timeout) 
 </code></pre>
 
 <p>Acquire ownership of a mutex.</p>
@@ -738,7 +738,7 @@
 <h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">&para;</a></h4>
 <p>If the mutex is owned by another task and the timeout is 0 the function returns immediately with the error code OS_TIMEOUT. The calling task <em>does not</em> own the mutex when this occurs.</p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">struct os_mutex g_mutex1;
+<pre><code class="c">struct os_mutex g_mutex1;
 os_error_t err;
 
 err = os_mutex_pend(&amp;g_mutex1, 0);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mutex/os_mutex_release/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mutex/os_mutex_release/index.html b/os/core_os/mutex/os_mutex_release/index.html
index b61a156..91dc3db 100644
--- a/os/core_os/mutex/os_mutex_release/index.html
+++ b/os/core_os/mutex/os_mutex_release/index.html
@@ -707,7 +707,7 @@
                         </div>
                         
                             <h2 id="os_mutex_release"><font color="#F2853F" style="font-size:24pt">os_mutex_release</font><a class="headerlink" href="#os_mutex_release" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">os_error_t os_mutex_release(struct os_mutex *mu)
+<pre><code class="c">os_error_t os_mutex_release(struct os_mutex *mu)
 </code></pre>
 
 <p>Release ownership of a mutex</p>
@@ -732,7 +732,7 @@
 <p>OS_BAD_MUTEX: The mutex was not owned by the task attempting to release it.</p>
 <p>OS_NOT_STARTED: Attempt to release a mutex before the os has been started.</p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">struct os_mutex g_mutex1;
+<pre><code class="c">struct os_mutex g_mutex1;
 os_error_t err;
 
 err = os_mutex_pend(&amp;g_mutex1, 0);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mynewt_os/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mynewt_os/index.html b/os/core_os/mynewt_os/index.html
index 8cdfcab..9aab8b1 100644
--- a/os/core_os/mynewt_os/index.html
+++ b/os/core_os/mynewt_os/index.html
@@ -691,9 +691,7 @@
 <h3 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h3>
 <p>One way to avoid initialization issues like the one described above is to perform task initializations prior to starting the OS. The code example shown below illustrates this concept. The application initializes the OS, calls an application specific "task initialization" function, and then starts the OS. The application task initialization function is responsible for initializing all the data objects that each task exposes to the other tasks. The tasks themselves are also initialized at this time (by calling <code>os_task_init()</code>). </p>
 <p>In the example, each task works in a ping-pong like fashion: task 1 wakes up, adds a token to semaphore 1 and then waits for a token from semaphore 2. Task 2 waits for a token on semaphore 1 and once it gets it, adds a token to semaphore 2. Notice that the semaphores are initialized by the application specific task initialization functions and not inside the task handler functions. If task 2 (being lower in priority than task 1) had called os_sem_init() for task2_sem inside task2_handler(), task 1 would have called os_sem_pend() using task2_sem before task2_sem was initialized.</p>
-<p><br></p>
-<pre><code class="no-highlight">
-/* Task 1 handler function */
+<pre><code>/* Task 1 handler function */
 void
 task1_handler(void *arg)
 {
@@ -753,10 +751,10 @@ init_app_tasks(void)
      * Initialize tasks 1 and 2. Note that the task handlers are not called yet; they will
      * be called when the OS is started.
      */
-    os_task_init(&amp;task1, &quot;task1&quot;, task1_handler, NULL, TASK1_PRIO, 
+    os_task_init(&amp;task1, "task1", task1_handler, NULL, TASK1_PRIO, 
                  OS_WAIT_FOREVER, task1_stack, TASK1_STACK_SIZE);
 
-    os_task_init(&amp;task2, &quot;task2&quot;, task2_handler, NULL, TASK2_PRIO, 
+    os_task_init(&amp;task2, "task2", task2_handler, NULL, TASK2_PRIO, 
                  OS_WAIT_FOREVER, task2_stack, TASK2_STACK_SIZE);
 
     /* Call task specific initialization functions. */
@@ -794,9 +792,7 @@ main(void)
 
     return rc;
 }
-
 </code></pre>
-
 <h3 id="os-functions">OS Functions<a class="headerlink" href="#os-functions" title="Permanent link">&para;</a></h3>
 <p>The functions available at the OS level are:</p>
 <ul>

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/porting/port_bsp/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/porting/port_bsp/index.html b/os/core_os/porting/port_bsp/index.html
index 2093ffd..f83b0a6 100644
--- a/os/core_os/porting/port_bsp/index.html
+++ b/os/core_os/porting/port_bsp/index.html
@@ -583,7 +583,7 @@ name that describes the board/system you are creating.</p>
 <p>It is recommended that you use a simple <code>project</code> like <code>blinky</code> to minimize time to get a working Mynewt system.  For this document, we will assume the <code>target</code> is called <code>myboard_blinky</code> and uses project <code>blinky</code>.  </p>
 <p>Set the <code>bsp</code> of the project to <code>/hw/bsp/myboard</code>. While creating your target, you will need to specify your <code>arch</code>and <code>compiler</code>. If your platform requires an architecture or compiler that are not defined in Mynewt, you will need to add them first.  To add a CPU architecture see <a href="../port_cpu/">CPU Porting</a>.</p>
 <p>When you are complete, your <code>target</code> may look similar to this.</p>
-<pre><code class="no-highlight">    $newt target show 
+<pre><code class="c">    $newt target show 
         myboard_blinky
             arch=cortex_m0
             bsp=hw/bsp/myboard
@@ -667,7 +667,7 @@ name that describes the board/system you are creating.</p>
 <h3 id="fill-out-your-package-file">Fill Out your Package File<a class="headerlink" href="#fill-out-your-package-file" title="Permanent link">&para;</a></h3>
 <p>Edit the package file to describe your BSP. </p>
 <p>The package file must contain:</p>
-<pre><code class="no-highlight">    pkg.name: &quot;hw/bsp/myboard&quot;
+<pre><code class="c">    pkg.name: &quot;hw/bsp/myboard&quot;
     pkg.linkerscript: &quot;myboard.ld&quot;
 </code></pre>
 
@@ -691,7 +691,7 @@ name that describes the board/system you are creating.</p>
 </table>
 <p>The linker script is a key component of the BSP and specifies where each section of code and data are stored within your CPU which can vary with the BSP depending on your chosen memory layout.  For a tutorial on writing linker scripts, see <a href="#create-or-copy-linker-script">Create or Copy Linker Script(s)</a>.</p>
 <p>The package file typically contains:</p>
-<pre><code class="no-highlight">    pkg.linkerscript.bootloader.OVERWRITE: &quot;myboard_boot.ld&quot;
+<pre><code class="c">    pkg.linkerscript.bootloader.OVERWRITE: &quot;myboard_boot.ld&quot;
     pkg.downloadscript: &quot;myboard_download.sh&quot;
     pkg.debugscript: &quot;myboard_debug.sh&quot;
     pkg.deps: 
@@ -728,7 +728,7 @@ name that describes the board/system you are creating.</p>
 </table>
 <p>The BSP will invariably depend upon an MCU ( in this sample it's <code>hw/mcu/mymcu/variant</code>) since the Mynewt OS runs on an MCU within your target.  If your MCU is not supported by Mynewt, see <a href="../port_mcu/">MCU Porting</a> for details on how to create an MCU in Mynewt.</p>
 <p>The package file may also contain:</p>
-<pre><code class="no-highlight">    pkg.cflags: -D__MY_SPECIAL_BSP_OPTIONS_
+<pre><code class="c">    pkg.cflags: -D__MY_SPECIAL_BSP_OPTIONS_
     pkg.deps:
     - libs/cmsis-core
 
@@ -840,7 +840,7 @@ name that describes the board/system you are creating.</p>
 </ul>
 <p><code>os_bsp_init</code> should initialize anything required by the OS by the BSP. Typically this is a very small set.  </p>
 <p>NOTE: Currently we are making calls to <code>_sbrk()</code> and <code>close(0)</code> from <code>os_bsp_init</code> to get around a linker issue where some of libc is not getting included.  Please include this in your <code>os_bsp_init</code>.</p>
-<pre><code class="no-highlight">    /*
+<pre><code class="c">    /*
      * XXX these references are here to keep the functions in for libc to find.
      */
     _sbrk(0);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/sanity/os_sanity_check_init/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/sanity/os_sanity_check_init/index.html b/os/core_os/sanity/os_sanity_check_init/index.html
index 3260e91..c420650 100644
--- a/os/core_os/sanity/os_sanity_check_init/index.html
+++ b/os/core_os/sanity/os_sanity_check_init/index.html
@@ -737,7 +737,7 @@
                         </div>
                         
                             <h2 id="os_sanity_check_init"><font color="F2853F" style="font-size:24pt"> os_sanity_check_init</font><a class="headerlink" href="#os_sanity_check_init" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int os_sanity_check_init(struct os_sanity_check *sc)
+<pre><code class="c">int os_sanity_check_init(struct os_sanity_check *sc)
 </code></pre>
 
 <p>Initialize the sanity check pointed to by <code>sc</code>.  Sets default values, and ensures
@@ -764,7 +764,7 @@ memory is cleared out.</p>
 <p>All other error codes indicate an error.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    int rc;
+<pre><code class="c">    int rc;
 
     rc = os_sanity_task_check_init(&amp;my_sanity_check); 
     assert(rc == OS_OK);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/sanity/os_sanity_check_register/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/sanity/os_sanity_check_register/index.html b/os/core_os/sanity/os_sanity_check_register/index.html
index 70ce9c5..6441ad9 100644
--- a/os/core_os/sanity/os_sanity_check_register/index.html
+++ b/os/core_os/sanity/os_sanity_check_register/index.html
@@ -737,7 +737,7 @@
                         </div>
                         
                             <h2 id="os_sanity_check_register"><font color="F2853F" style="font-size:24pt"> os_sanity_check_register</font><a class="headerlink" href="#os_sanity_check_register" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int os_sanity_check_register(struct os_sanity_check *sc)
+<pre><code class="c">int os_sanity_check_register(struct os_sanity_check *sc)
 </code></pre>
 
 <p>Register the sanity check pointed to by <code>sc</code> with the sanity task.  After registration
@@ -764,7 +764,7 @@ the sanity task will check this sanity check with every run of the sanity task.<
 <p>All other error codes indicate an error.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    int rc;
+<pre><code class="c">    int rc;
 
     rc = os_sanity_check_register(&amp;my_sc); 
     assert(rc == OS_OK);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/sanity/os_sanity_check_reset/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/sanity/os_sanity_check_reset/index.html b/os/core_os/sanity/os_sanity_check_reset/index.html
index 5355ecc..bb69205 100644
--- a/os/core_os/sanity/os_sanity_check_reset/index.html
+++ b/os/core_os/sanity/os_sanity_check_reset/index.html
@@ -737,7 +737,7 @@
                         </div>
                         
                             <h2 id="os_sanity_check_reset"><font color="F2853F" style="font-size:24pt"> os_sanity_check_reset</font><a class="headerlink" href="#os_sanity_check_reset" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int os_sanity_check_reset(struct os_sanity_check *sc)
+<pre><code class="c">int os_sanity_check_reset(struct os_sanity_check *sc)
 </code></pre>
 
 <p>Reset the sanity check pointed to by sc.  This tells the sanity task that 
@@ -765,7 +765,7 @@ ticks.</p>
 <p>All other error codes indicate an error.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    int rc;
+<pre><code class="c">    int rc;
 
     rc = os_sanity_check_reset(&amp;my_sc); 
     assert(rc == OS_OK);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/sanity/os_sanity_task_checkin/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/sanity/os_sanity_task_checkin/index.html b/os/core_os/sanity/os_sanity_task_checkin/index.html
index eb9e4ed..10863a5 100644
--- a/os/core_os/sanity/os_sanity_task_checkin/index.html
+++ b/os/core_os/sanity/os_sanity_task_checkin/index.html
@@ -737,7 +737,7 @@
                         </div>
                         
                             <h2 id="os_sanity_task_checkin"><font color="F2853F" style="font-size:24pt"> os_sanity_task_checkin</font><a class="headerlink" href="#os_sanity_task_checkin" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int os_sanity_task_checkin(struct os_task *t)
+<pre><code class="c">int os_sanity_task_checkin(struct os_task *t)
 </code></pre>
 
 <p>Used by a task to check in to the sanity task. This informs the sanity task that 
@@ -764,7 +764,7 @@
 <p>All other error codes indicate an error.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    int rc;
+<pre><code class="c">    int rc;
 
     rc = os_sanity_task_checkin(&amp;my_task); 
     assert(rc == OS_OK);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/sanity/os_sanity_task_init/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/sanity/os_sanity_task_init/index.html b/os/core_os/sanity/os_sanity_task_init/index.html
index fa7a029..3be75f5 100644
--- a/os/core_os/sanity/os_sanity_task_init/index.html
+++ b/os/core_os/sanity/os_sanity_task_init/index.html
@@ -737,7 +737,7 @@
                         </div>
                         
                             <h2 id="os_sanity_task_init"><font color="F2853F" style="font-size:24pt"> os_sanity_task_init</font><a class="headerlink" href="#os_sanity_task_init" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int os_sanity_task_init(int num_secs);
+<pre><code class="c">int os_sanity_task_init(int num_secs);
 </code></pre>
 
 <p>Initialize the os sanity task.  <code>num_secs</code> is the number of seconds to wait
@@ -764,7 +764,7 @@ in between runs of the sanity task.</p>
 <p>All other error codes indicate an error.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">/* Run sanity checks every 50 seconds */
+<pre><code class="c">/* Run sanity checks every 50 seconds */
 
 #define SANITY_TASK_INTERVAL (50)
     int rc;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/sanity/sanity/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/sanity/sanity/index.html b/os/core_os/sanity/sanity/index.html
index 25f29ba..69771c4 100644
--- a/os/core_os/sanity/sanity/index.html
+++ b/os/core_os/sanity/sanity/index.html
@@ -709,13 +709,13 @@ an application watchdog.  </p>
 <p>The Sanity Watchdog is a task in the Mynewt OS, which when enabled, runs 
 every <code>sanity_seconds</code>.  In order to enable the Sanity Watchdog task, 
 call the <code>os_sanity_task_init()</code> function.</p>
-<pre><code class="no-highlight">int os_sanity_task_init(int sanity_seconds);
+<pre><code class="c">int os_sanity_task_init(int sanity_seconds);
 </code></pre>
 
 <p>By default, every operating system task provides the frequency it will 
 check in with the sanity task, with the <code>sanity_itvl</code> parameter in the 
 <code>os_task_init()</code> function:</p>
-<pre><code class="no-highlight">int os_task_init(struct os_task *t, char *name, os_task_func_t func, 
+<pre><code class="c">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);
 </code></pre>
@@ -728,7 +728,7 @@ seconds.  In order to do that, the task should call the <code>os_sanity_task_che
 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:</p>
-<pre><code class="no-highlight">#define TASK1_SANITY_CHECKIN_ITVL (50 * OS_TICKS_PER_SEC) 
+<pre><code class="c">#define TASK1_SANITY_CHECKIN_ITVL (50 * OS_TICKS_PER_SEC) 
 struct os_eventq task1_evq;
 
 static void
@@ -774,7 +774,7 @@ task1(void *arg)
 perform other checks during the sanity task's operation, it can do so by
 registering a <code>struct os_sanity_check</code> using the <code>os_sanity_check_register</code>
 function.</p>
-<pre><code class="no-highlight">static int 
+<pre><code class="c">static int 
 mymodule_perform_sanity_check(struct os_sanity_check *sc, void *arg)
 {
     /* Perform your checking here.  In this case, we check if there 
@@ -825,7 +825,7 @@ consecutive times before crashing the system.  This will avoid crashing
 for temporary failures.</p>
 <h2 id="data-structures">Data structures<a class="headerlink" href="#data-structures" title="Permanent link">&para;</a></h2>
 <h3 id="os-sanity-check">OS Sanity Check<a class="headerlink" href="#os-sanity-check" title="Permanent link">&para;</a></h3>
-<pre><code class="no-highlight">struct os_sanity_check {
+<pre><code class="c">struct os_sanity_check {
     os_time_t sc_checkin_last;
     os_time_t sc_checkin_itvl;
     os_sanity_check_func_t sc_func;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/semaphore/os_sem_init/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/semaphore/os_sem_init/index.html b/os/core_os/semaphore/os_sem_init/index.html
index 1e6fc83..d3c93fa 100644
--- a/os/core_os/semaphore/os_sem_init/index.html
+++ b/os/core_os/semaphore/os_sem_init/index.html
@@ -717,7 +717,7 @@
                         </div>
                         
                             <h2 id="os_sem_init"><font color="F2853F" style="font-size:24pt"> os_sem_init</font><a class="headerlink" href="#os_sem_init" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">os_error_t os_sem_init(struct os_sem *sem, uint16_t tokens)    
+<pre><code class="c">os_error_t os_sem_init(struct os_sem *sem, uint16_t tokens)    
 </code></pre>
 
 <p>Initialize a semaphore with a given number of tokens. Should be called before the semaphore is used.</p>
@@ -749,7 +749,7 @@ Does it need to be used with some other specific functions?
 Any caveats to be careful about (e.g. high memory requirements).></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p>The following example shows how to initialize a semaphore used for exclusive access.</p>
-<pre><code class="no-highlight">struct os_mutex g_os_sem;
+<pre><code class="c">struct os_mutex g_os_sem;
 os_error_t err;
 
 err = os_sem_init(&amp;g_os_sem, 1);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/semaphore/os_sem_pend/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/semaphore/os_sem_pend/index.html b/os/core_os/semaphore/os_sem_pend/index.html
index b0f6486..4a9e472 100644
--- a/os/core_os/semaphore/os_sem_pend/index.html
+++ b/os/core_os/semaphore/os_sem_pend/index.html
@@ -717,7 +717,7 @@
                         </div>
                         
                             <h2 id="os_sem_pend"><font color="#F2853F" style="font-size:24pt"> os_sem_pend </font><a class="headerlink" href="#os_sem_pend" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">os_error_t os_sem_pend(struct os_sem *sem, uint32_t timeout)
+<pre><code class="c">os_error_t os_sem_pend(struct os_sem *sem, uint32_t timeout)
 </code></pre>
 
 <p>Wait for a semaphore for a given amount of time.</p>
@@ -748,7 +748,7 @@
 <h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">&para;</a></h4>
 <p>If a timeout of 0 is used and the function returns OS_TIMEOUT, the semaphore was not available and was not acquired. No release of the semaphore should occur and the calling task does not own the semaphore.</p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">struct os_sem g_os_sem;
+<pre><code class="c">struct os_sem g_os_sem;
 os_error_t err;
 
 err = os_sem_pend(&amp;g_os_sem, OS_TIMEOUT_NEVER);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/semaphore/os_sem_release/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/semaphore/os_sem_release/index.html b/os/core_os/semaphore/os_sem_release/index.html
index bcb3eaf..0b31b1b 100644
--- a/os/core_os/semaphore/os_sem_release/index.html
+++ b/os/core_os/semaphore/os_sem_release/index.html
@@ -717,7 +717,7 @@
                         </div>
                         
                             <h2 id="os_sem_release"><font color="#F2853F" style="font-size:24pt"> os_sem_release </font><a class="headerlink" href="#os_sem_release" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">os_error_t os_sem_release(struct os_sem *sem)
+<pre><code class="c">os_error_t os_sem_release(struct os_sem *sem)
 </code></pre>
 
 <p>Release a semaphore that you are holding. This adds a token to the semaphore.</p>
@@ -742,7 +742,7 @@
 <p>OS_OK: semaphore released successfully.</p>
 <h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">&para;</a></h4>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">struct os_sem g_os_sem;
+<pre><code class="c">struct os_sem g_os_sem;
 os_error_t err;
 
 err = os_sem_pend(&amp;g_os_sem, OS_TIMEOUT_NEVER);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/semaphore/semaphore/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/semaphore/semaphore/index.html b/os/core_os/semaphore/semaphore/index.html
index 6c827b6..ba0c46a 100644
--- a/os/core_os/semaphore/semaphore/index.html
+++ b/os/core_os/semaphore/semaphore/index.html
@@ -688,7 +688,7 @@
 <p>Semaphores can also be used for task synchronization. A simple example of this would be the following. A task creates a semaphore and initializes it with no tokens. The task then waits on the semaphore, and since there are no tokens, the task is put to sleep. When other tasks want to wake up the sleeping task they simply add a token by calling <em>os_sem_release</em>. This will cause the sleeping task to wake up (instantly if no other higher priority tasks want to run).</p>
 <p>The other common use of a counting semaphore is in what is commonly called a "producer/consumer" relationship. The producer adds tokens (by calling <em>os_sem_release</em>) and the consumer consumes them by calling <em>os_sem_pend</em>. In this relationship, the producer has work for the consumer to do. Each token added to the semaphore will cause the consumer to do whatever work is required. A simple example could be the following: every time a button is pressed there is some work to do (ring a bell). Each button press causes the producer to add a token. Each token consumed rings the bell. There will exactly the same number of bell rings as there are button presses. In other words, each call to <em>os_sem_pend</em> subtracts exactly one token and each call to <em>os_sem_release</em> adds exactly one token.</p>
 <h3 id="data-structures">Data structures<a class="headerlink" href="#data-structures" title="Permanent link">&para;</a></h3>
-<pre><code class="no-highlight">struct os_sem
+<pre><code class="c">struct os_sem
 {
     SLIST_HEAD(, os_task) sem_head;     /* chain of waiting tasks */
     uint16_t    _pad;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/task/os_task_count/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/task/os_task_count/index.html b/os/core_os/task/os_task_count/index.html
index 1aa2bb9..3dd5cd9 100644
--- a/os/core_os/task/os_task_count/index.html
+++ b/os/core_os/task/os_task_count/index.html
@@ -717,7 +717,7 @@
                         </div>
                         
                             <h2 id="os_task_count"><font color="F2853F" style="font-size:24pt"> os_task_count</font><a class="headerlink" href="#os_task_count" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">uint8_t os_task_count(void);
+<pre><code class="c">uint8_t os_task_count(void);
 </code></pre>
 
 <p>Returns the number of tasks that have been created. </p>
@@ -729,7 +729,7 @@
 <p>unsigned 8-bit integer representing number of tasks created</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">
+<pre><code class="c">
     uint8_t num_tasks;
 
     num_tasks = os_task_count();

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/task/os_task_info_get_next/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/task/os_task_info_get_next/index.html b/os/core_os/task/os_task_info_get_next/index.html
index dc04ffd..0f92e6b 100644
--- a/os/core_os/task/os_task_info_get_next/index.html
+++ b/os/core_os/task/os_task_info_get_next/index.html
@@ -717,7 +717,7 @@
                         </div>
                         
                             <h2 id="os_task_info_get_next"><font color="F2853F" style="font-size:24pt"> os_task_info_get_next</font><a class="headerlink" href="#os_task_info_get_next" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">struct os_task *os_task_info_get_next(const struct os_task *prev, struct os_task_info *oti);
+<pre><code class="c">struct os_task *os_task_info_get_next(const struct os_task *prev, struct os_task_info *oti);
 </code></pre>
 
 <p>Populates the os task info structure pointed to by <em>oti</em> with task information. 
@@ -752,7 +752,7 @@ structure used to populate <em>oti</em> is returned.</p>
 information structure. NULL means that no tasks were created.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">
+<pre><code class="c">
 void 
 get_task_info(void)
 {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/task/os_task_init/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/task/os_task_init/index.html b/os/core_os/task/os_task_init/index.html
index 18b0f34..c7e2869 100644
--- a/os/core_os/task/os_task_init/index.html
+++ b/os/core_os/task/os_task_init/index.html
@@ -717,7 +717,7 @@
                         </div>
                         
                             <h2 id="os_task_init"><font color="F2853F" style="font-size:24pt"> os_task_init</font><a class="headerlink" href="#os_task_init" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int os_task_init(struct os_task *t, char *name, os_task_func_t func, void *arg, 
+<pre><code class="c">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 *stack_bottom, 
                  uint16_t stack_size)
 </code></pre>
@@ -774,7 +774,7 @@ tasks.</p>
 <p>All other error codes indicate an internal error.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">
+<pre><code class="c">
     /* Create the task */ 
     int rc;
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/task/task/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/task/task/index.html b/os/core_os/task/task/index.html
index 8faaab4..4f184bd 100644
--- a/os/core_os/task/task/index.html
+++ b/os/core_os/task/task/index.html
@@ -730,7 +730,7 @@ API. Developers can walk the list of tasks to obtain information on all created
 tasks. This information is of type <code>os_task_info</code> and is described below.</p>
 <p>The following is a very simple example showing a single application task. This 
 task simply toggles an LED at a one second interval.</p>
-<pre><code class="no-highlight">/* Create a simple &quot;project&quot; with a task that blinks a LED every second */
+<pre><code class="c">/* Create a simple &quot;project&quot; with a task that blinks a LED every second */
 
 /* Define task stack and task object */
 #define MY_TASK_PRI         (OS_TASK_PRI_HIGHEST) 
@@ -775,7 +775,7 @@ int main(void) {
 </code></pre>
 
 <h2 id="data-structures">Data structures<a class="headerlink" href="#data-structures" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">/* The highest and lowest task priorities */
+<pre><code class="c">/* The highest and lowest task priorities */
 #define OS_TASK_PRI_HIGHEST         (0)
 #define OS_TASK_PRI_LOWEST          (0xff)
 
@@ -796,7 +796,7 @@ typedef void (*os_task_func_t)(void *);
 </code></pre>
 
 <p><br></p>
-<pre><code class="no-highlight">struct os_task {
+<pre><code class="c">struct os_task {
     os_stack_t *t_stackptr;
     os_stack_t *t_stacktop;
 
@@ -914,7 +914,7 @@ typedef void (*os_task_func_t)(void *);
 </tbody>
 </table>
 <p><br></p>
-<pre><code class="no-highlight">struct os_task_info {
+<pre><code class="c">struct os_task_info {
     uint8_t oti_prio;
     uint8_t oti_taskid;
     uint8_t oti_state;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/time/os_gettimeofday/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/time/os_gettimeofday/index.html b/os/core_os/time/os_gettimeofday/index.html
index 8218491..24fd641 100644
--- a/os/core_os/time/os_gettimeofday/index.html
+++ b/os/core_os/time/os_gettimeofday/index.html
@@ -737,7 +737,7 @@
                         </div>
                         
                             <h2 id="os_gettimeofday"><font color="F2853F" style="font-size:24pt">os_gettimeofday</font><a class="headerlink" href="#os_gettimeofday" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int os_gettimeofday(struct os_timeval *utctime, struct os_timezone *timezone); 
+<pre><code class="c">int os_gettimeofday(struct os_timeval *utctime, struct os_timezone *timezone); 
 </code></pre>
 
 <h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">&para;</a></h4>
@@ -766,7 +766,7 @@
 <p>The function is a no-op if both <code>utctime</code> and <code>timezone</code> are NULL.</p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">    /*
+<pre><code class="c">    /*
      * Display wallclock time on the console.
      */
     int rc;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/time/os_settimeofday/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/time/os_settimeofday/index.html b/os/core_os/time/os_settimeofday/index.html
index c01eb0e..b826cfb 100644
--- a/os/core_os/time/os_settimeofday/index.html
+++ b/os/core_os/time/os_settimeofday/index.html
@@ -737,7 +737,7 @@
                         </div>
                         
                             <h2 id="os_settimeofday"><font color="F2853F" style="font-size:24pt">os_settimeofday</font><a class="headerlink" href="#os_settimeofday" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int os_settimeofday(struct os_timeval *utctime, struct os_timezone *timezone);
+<pre><code class="c">int os_settimeofday(struct os_timeval *utctime, struct os_timezone *timezone);
 </code></pre>
 
 <h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">&para;</a></h4>
@@ -767,7 +767,7 @@
 <p>The function is a no-op if both <code>utctime</code> and <code>timezone</code> are NULL.</p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">    int rc;
+<pre><code class="c">    int rc;
     parse_datetime(datestr, &amp;utctime, &amp;tz);
     rc = os_settimeofday(&amp;utctime, &amp;tz);
     if (rc == 0) {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/time/os_time_delay/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/time/os_time_delay/index.html b/os/core_os/time/os_time_delay/index.html
index 221cab3..856bb5d 100644
--- a/os/core_os/time/os_time_delay/index.html
+++ b/os/core_os/time/os_time_delay/index.html
@@ -737,7 +737,7 @@
                         </div>
                         
                             <h2 id="os_time_delay"><font color="F2853F" style="font-size:24pt">os_time_delay</font><a class="headerlink" href="#os_time_delay" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void os_time_delay(int32_t ticks) 
+<pre><code class="c">void os_time_delay(int32_t ticks) 
 </code></pre>
 
 <h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">&para;</a></h4>
@@ -761,7 +761,7 @@
 <p>Passing <code>OS_TIMEOUT_NEVER</code> to this function will not block indefinitely but will return immediately.  Passing delays larger than 1/2 the OS time epoch should be avoided; behavior is unpredictable.</p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">    /* delay 3 seconds */
+<pre><code class="c">    /* delay 3 seconds */
     int32_t delay = OS_TICKS_PER_SEC * 3;
     os_time_delay(delay);
 </code></pre>

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/time/os_time_get/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/time/os_time_get/index.html b/os/core_os/time/os_time_get/index.html
index 97264b2..108a135 100644
--- a/os/core_os/time/os_time_get/index.html
+++ b/os/core_os/time/os_time_get/index.html
@@ -737,7 +737,7 @@
                         </div>
                         
                             <h2 id="os_time_get"><font color="F2853F" style="font-size:24pt">os_time_get</font><a class="headerlink" href="#os_time_get" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">os_time_t os_time_get(void) 
+<pre><code class="c">os_time_t os_time_get(void) 
 </code></pre>
 
 <h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">&para;</a></h4>
@@ -748,7 +748,7 @@
 <p>See the <a href="../os_time">Special Notes</a> on OS time epoch and comparison</p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">   os_time_t now = os_time_get();
+<pre><code class="c">   os_time_t now = os_time_get();
 </code></pre>
                         
                         <div class="row">

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/time/os_time_tick/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/time/os_time_tick/index.html b/os/core_os/time/os_time_tick/index.html
index 55cef19..ae0edd2 100644
--- a/os/core_os/time/os_time_tick/index.html
+++ b/os/core_os/time/os_time_tick/index.html
@@ -737,7 +737,7 @@
                         </div>
                         
                             <h2 id="os_time_tick"><font color="F2853F" style="font-size:24pt">os_time_tick</font><a class="headerlink" href="#os_time_tick" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void os_time_tick(void) 
+<pre><code class="c">void os_time_tick(void) 
 </code></pre>
 
 <p>Increments the OS time tick for the system.  Typically, this is called in one place by the architecture specific OS code (<code>libs/os/arch</code>) <code>timer_handler</code> which is in turn called by the BSP specific code assigned to drive the OS timer tick. See <a href="../../port_os">Porting Mynewt OS</a> for details.</p>
@@ -749,7 +749,7 @@
 <p>Called for every single tick by the architecture specific functions.</p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">   os_time_tick();
+<pre><code class="c">   os_time_tick();
 </code></pre>
                         
                         <div class="row">

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/get_started/project1/index.html
----------------------------------------------------------------------
diff --git a/os/get_started/project1/index.html b/os/get_started/project1/index.html
index 09b4755..de51526 100644
--- a/os/get_started/project1/index.html
+++ b/os/get_started/project1/index.html
@@ -420,7 +420,7 @@
 <ul>
 <li>Install gcc/libc that will produce 32-bit executables, using <em>brew</em>. </li>
 </ul>
-<pre><code class="no-highlight">        $ brew install gcc
+<pre><code>        $ brew install gcc
         ...
         ...
         ==&gt; Summary

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/tutorials/air_quality_sensor/index.html
----------------------------------------------------------------------
diff --git a/os/tutorials/air_quality_sensor/index.html b/os/tutorials/air_quality_sensor/index.html
index e56b6e2..d056b1a 100644
--- a/os/tutorials/air_quality_sensor/index.html
+++ b/os/tutorials/air_quality_sensor/index.html
@@ -1173,7 +1173,8 @@ senseair_init(int uartno)
 </code></pre>
 
 <p>And you modified your main() for senseair driver init.</p>
-<pre><code class="no-highlight">int
+<pre><code>:::c
+int
 main(int argc, char **argv)
 {
     ....
@@ -1181,7 +1182,6 @@ main(int argc, char **argv)
     ....
 }
 </code></pre>
-
 <p>You can see from the code that you are using the HAL interface to open a UART port, and using OS semaphore as a way of blocking the task when waiting for read response to come back from the sensor.</p>
                         
                         <div class="row">

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/sitemap.xml
----------------------------------------------------------------------
diff --git a/sitemap.xml b/sitemap.xml
index fe70b6b..1db10f3 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -4,7 +4,7 @@
     
     <url>
      <loc>http://mynewt.apache.org/</loc>
-     <lastmod>2016-03-09</lastmod>
+     <lastmod>2016-03-13</lastmod>
      <changefreq>daily</changefreq>
     </url>
     
@@ -12,7 +12,7 @@
     
     <url>
      <loc>http://mynewt.apache.org/about/</loc>
-     <lastmod>2016-03-09</lastmod>
+     <lastmod>2016-03-13</lastmod>
      <changefreq>daily</changefreq>
     </url>
     
@@ -20,7 +20,7 @@
     
     <url>
      <loc>http://mynewt.apache.org/documentation/</loc>
-     <lastmod>2016-03-09</lastmod>
+     <lastmod>2016-03-13</lastmod>
      <changefreq>daily</changefreq>
     </url>
     
@@ -28,7 +28,7 @@
     
     <url>
      <loc>http://mynewt.apache.org/download/</loc>
-     <lastmod>2016-03-09</lastmod>
+     <lastmod>2016-03-13</lastmod>
      <changefreq>daily</changefreq>
     </url>
     
@@ -36,7 +36,7 @@
     
     <url>
      <loc>http://mynewt.apache.org/community/</loc>
-     <lastmod>2016-03-09</lastmod>
+     <lastmod>2016-03-13</lastmod>
      <changefreq>daily</changefreq>
     </url>
     
@@ -44,7 +44,7 @@
     
     <url>
      <loc>http://mynewt.apache.org/events/</loc>
-     <lastmod>2016-03-09</lastmod>
+     <lastmod>2016-03-13</lastmod>
      <changefreq>daily</changefreq>
     </url>
     
@@ -53,7 +53,7 @@
         
     <url>
      <loc>http://mynewt.apache.org/os/get_started/introduction/</loc>
-     <lastmod>2016-03-09</lastmod>
+     <lastmod>2016-03-13</lastmod>
      <changefreq>daily</changefreq>
     </url>
         
@@ -93,7 +93,7 @@
         
     <url>
      <loc>http://mynewt.apache.org/newt/newt_intro/</loc>
-     <lastmod>2016-03-09</lastmod>
+     <lastmod>2016-03-13</lastmod>
      <changefreq>daily</changefreq>
     </url>
         
@@ -115,7 +115,7 @@
         
     <url>
      <loc>http://mynewt.apache.org/newtmgr/overview/</loc>
-     <lastmod>2016-03-09</lastmod>
+     <lastmod>2016-03-13</lastmod>
      <changefreq>daily</changefreq>
     </url>
         
@@ -137,7 +137,7 @@
         
     <url>
      <loc>http://mynewt.apache.org/faq/answers/</loc>
-     <lastmod>2016-03-09</lastmod>
+     <lastmod>2016-03-13</lastmod>
      <changefreq>daily</changefreq>
     </url>
         


[3/4] incubator-mynewt-site git commit: added syntax highlighting to os_core docs

Posted by ad...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/mkdocs/search_index.json
----------------------------------------------------------------------
diff --git a/mkdocs/search_index.json b/mkdocs/search_index.json
index b4b6700..06a8d6d 100644
--- a/mkdocs/search_index.json
+++ b/mkdocs/search_index.json
@@ -357,7 +357,7 @@
         }, 
         {
             "location": "/os/tutorials/air_quality_sensor/", 
-            "text": "Air quality sensor project\n\n\nSetting up source tree for stuff you need\n\n\nTo start with, you need to create a new app under which you will do this development. So you type in:\n\n\n$ mkdir $HOME/src\n$ cd $HOME/src\n$ newt new air_quality\n\n\n\n\nLet's say you are using STM32F3discovery board for this project. You know you need the board support package for that hardware. You can look up its location in the repository, fetch the package list from there, and install the egg for the BSP.\n\n\n[user@IsMyLaptop:~/src/air_quality]$ newt app add-pkg-list mynewt_stm32f3 https://github.com/runtimeinc/mynewt_stm32f3.git\nDownloading pkg-list.yml from https://github.com/runtimeinc/mynewt_stm32f3.git/master... ok!\nVerifying pkg-list.yml format...\n ok!\nPackage list mynewt_stm32f3 successfully installed to application.\n[user@IsMyLaptop:~/src/air_quality]$ newt pkg install hw/bsp/stm32f3discovery\nDownloading mynewt_stm32f3 from https://github.com/runtimeinc/mynewt_
 stm32f3.git/master... ok!\nInstalling hw/bsp/stm32f3discovery\nInstalling hw/mcu/stm/stm32f3xx\nError: No package libs/cmsis-core found\n\n\n\n\nOoops. You forgot to bring in the package list for larva itself. That's the one with most of the packages. Including libs/cmsis-core.\n\n\nThis time you need the latest and greatest from larva, so you want to bring in the 'develop' branch. Note that normally the use of the more stable master branch is recommended. In that case you would drop the '-b develop' from command line.\n\n\nHowever, you want to bring in the packages from develop branch. To make that happen you say:\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ newt app add-pkg-list -b develop larva https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva.git\nDownloading pkg-list.yml from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva.git/develop... ok!\nVerifying pkg-list.yml format...\n ok!\nPackage list larva successfully installed to application.\n[marko@IsMyL
 aptop:~/src/air_quality]$ newt pkg install libs/cmsis-core          Downloading larva from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/develop... ok!\nInstalling libs/cmsis-core\nInstallation was a success!\n\n\n\n\nThat's better. You want to make sure you have all the needed bits for supporting your board; so you decide to build the blinky project for it first.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ newt pkg install project/blinky\nDownloading larva from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/develop... ok!\nInstalling project/blinky\nInstalling libs/console/full\nInstalling libs/newtmgr\nInstalling libs/json\nInstalling libs/shell\nInstalling sys/config\nInstalling sys/log\nInstalling sys/stats\nInstallation was a success!\n[marko@IsMyLaptop:~/src/air_quality]$ newt pkg install compiler/arm-none-eabi-m4\nDownloading larva from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/develop... ok!\nInstalling compiler/arm-none-e
 abi-m4\nInstallation was a success!\n\n\n\n\nAs you can see, this brought in quite a few other dependencies as well.\n\n\nNow create a target for it and build it.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ newt target create blink_f3\nCreating target blink_f3\nTarget blink_f3 successfully created!\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 arch=cortex_m4\nTarget blink_f3 successfully set arch to cortex_m4\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 bsp=hw/bsp/stm32f3discovery\nTarget blink_f3 successfully set bsp to hw/bsp/stm32f3discovery\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 compiler=arm-none-eabi-m4\nTarget blink_f3 successfully set compiler to arm-none-eabi-m4\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 compiler_def=debug\nTarget blink_f3 successfully set compiler_def to debug\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 project=blinky\nTarget blink_f3 successfully set proje
 ct to blinky\n[marko@IsMyLaptop:~/src/air_quality]$ newt target build blink_f3\nBuilding target blink_f3 (project = blinky)\n ...\n[marko@IsMyLaptop:~/src/air_quality]$ newt target build blink_f3\nBuilding target blink_f3 (project = blinky)\nBuilding project blinky\nLinking blinky.elf\n/usr/local/Cellar/gcc-arm-none-eabi-49/20150609/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld: /Users/marko/src/air_quality/project/blinky//bin/blink_f3/blinky.elf section `.text' will not fit in region `FLASH'\n/usr/local/Cellar/gcc-arm-none-eabi-49/20150609/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld: region `FLASH' overflowed by 5180 bytes\ncollect2: error: ld returned 1 exit status\n\n\n\n\nThe error indicates that the images need to be smaller for this board, so you decide to switch over to using baselibc instead of libc.\n\n\nTo do that, you modify the project's egg file project/blinky/pkg.yml. And add \nlibs/baselibc\n to list of package dependencie
 s (pkg.deps).\n\n\nNow:\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ newt target build blink_f3\nBuilding target blink_f3 (project = blinky)\n....\nArchiving libstm32f3discovery.a\nCompiling main.c\nBuilding project blinky\nLinking blinky.elf\nSuccessfully run!\n\n\n\n\nThat's better.\n\n\nYou know that this platform uses bootloader, which means you have to create a target for that too. And download the bootloader package.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ newt target create boot_f3\nCreating target boot_f3\nTarget boot_f3 successfully created!\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 arch=cortex_m4\nnewTarget boot_f3 successfully set arch to cortex_m4\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 bsp=hw/bsp/stm32f3discovery\nnewtTarget boot_f3 successfully set bsp to hw/bsp/stm32f3discovery\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 compiler=arm-none-eabi-m4\nTarget boot_f3 successfully set compiler to arm-none-eabi-
 m4\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 compiler_def=optimized\nTarget boot_f3 successfully set compiler_def to optimized\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 project=boot\nTarget boot_f3 successfully set project to boot\n[marko@IsMyLaptop:~/src/air_quality]$ newt pkg install project/boot\nDownloading larva from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/develop... ok!\nInstalling project/boot\nInstalling fs/nffs\nInstalling fs/fs\nInstalling libs/bootutil\nInstalling libs/mbedtls\nInstalling libs/console/stub\nInstallation was a success!\n\n\n\n\nAnd then build it:\n\n\nnewt target build boot_f3\n....\nLinking boot.elf\nSuccessfully run!\n\n\n\n\nNext you must download the targets to board, and see that the LED actually blinks. You plug in the STM32F3 discovery board to your laptop, and say:\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ newt target download blink_f3\nDownloading with /Users/marko/src/air_quality/h
 w/bsp/stm32f3discovery/stm32f3discovery_download.sh\nDownloading /Users/marko/src/air_quality/project/blinky/bin/blink_f3/blinky.img to 0x08008000\nOpen On-Chip Debugger 0.9.0 (2015-05-28-12:05)\n...\ntarget state: halted\ntarget halted due to debug-request, current mode: Thread \nxPSR: 0x01000000 pc: 0x0800026c msp: 0x10002000\nauto erase enabled\nError: couldn't open /Users/marko/src/air_quality/project/blinky/bin/blink_f3/blinky.img\n\nError: exit status 1\nexit status 1\n\n\n\n\nAh. Forgot to create an image out of the blinky binary.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ newt target create-image blink_f3 0.0.1\nBuilding target blink_f3 (project = blinky)\nCompiling hal_flash.c\nArchiving libhal.a\nCompiling cons_tty.c\nArchiving libfull.a\nCompiling hal_uart.c\nArchiving libstm32f3xx.a\nCompiling hal_bsp.c\nArchiving libstm32f3discovery.a\nCompiling main.c\nBuilding project blinky\nLinking blinky.elf\n[marko@IsMyLaptop:~/src/air_quality]$ newt target download blink_f3\nDown
 loading with /Users/marko/src/air_quality/hw/bsp/stm32f3discovery/stm32f3discovery_download.sh\n\n\n\n\nAnd it's blinking.\n\n\nCreate test project\n\n\nNow that you have your system setup, you can start creating your own stuff.\nFirst you want to create a project for yourself - you can start by getting project template from blinky, as it pretty much has what you want.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ mkdir project/air_quality\n[marko@IsMyLaptop:~/src/air_quality]$ cp project/blinky/pkg.yml project/air_quality/\n[marko@IsMyLaptop:~/src/air_quality]$ mkdir project/air_quality/src\n[marko@IsMyLaptop:~/src/air_quality]$ cp project/blinky/src/main.c project/air_quality/src/\n\n\n\n\nThen you modify the project/air_quality/pkg.yml for air_quality in order to change the \npkg.name\n to be \nproject/air_quality\n.\n\n\nAnd create a target for it:\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ newt target create air_q\nnewt targCreating target air_q\nTarget air_q successfully created!
 \n[marko@IsMyLaptop:~/src/air_quality]$ newt target set air_q arch=cortex_m4\nTarget air_q successfully set arch to cortex_m4\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set air_q bsp=hw/bsp/stm32f3discovery\nTarget air_q successfully set bsp to hw/bsp/stm32f3discovery\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set air_q compiler=arm-none-eabi-m4\nTarget air_q successfully set compiler to arm-none-eabi-m4\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set air_q compiler_def=debug\nTarget air_q successfully set compiler_def to debug\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set air_q project=air_quality\nTarget air_q successfully set project to air_quality\n[marko@IsMyLaptop:~/src/air_quality]$ newt target build air_q\n   ....\nSuccessfully run!\n\n\n\n\nCreate packages for drivers\n\n\nOne of the sensors you want to enable is SenseAir K30, which will connect to the board over serial port.\nTo start development of the driver, you first need to create a pac
 kage description for it, and add stubs for sources.\n\n\nSo you add few files. pkg.yml to describe the driver, and then header stub followed by source stub.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/pkg.yml\n#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership.  The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \nLicense\n); you may not use this file except in compliance\n# with the License.  You may obtain a copy of the License at\n# \n#  http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \nAS IS\n BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing pe
 rmissions and limitations\n# under the License.\n#\npkg.name: libs/my_drivers/senseair\npkg.deps:\n    - hw/hal\n\n\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/include/senseair/senseair.h\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership.  The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \nLicense\n); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n * \n *  http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \nAS IS\n BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permiss
 ions and limitations\n * under the License.\n*/\n#ifndef _SENSEAIR_H_\n#define _SENSEAIR_H_\n\nvoid senseair_init(void);\n\n#endif /* _SENSEAIR_H_ */\n\n\n\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/src/senseair.c\n/**\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership.  The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \nLicense\n); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n * \n *  http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \nAS IS\n BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specifi
 c language governing permissions and limitations\n * under the License.\n */\n\nvoid\nsenseair_init(void)\n{\n}\n\n\n\n\nAnd add dependency to this package in my project yml file.\n\n\nHere's from project/air_quality/pkg.yml\n\n\npkg.name: project/air_quality\npkg.vers: 0.8.0\npkg.description: Basic example application which blinks an LED.\npkg.author: Marko Kiiskila \nmarko@runtime.io\n\npkg.homepage: http://mynewt.apache.org/os/get_acclimated/project2/\npkg.repository: https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva\npkg.keywords:\n\n\npkg.deps:\n    - libs/console/full\n    - libs/newtmgr\n    - libs/os\n    - libs/shell\n    - libs/baselibc\n    - sys/config\n    - sys/log\n    - sys/stats\n    - libs/my_drivers/senseair\n\n\n\n\nAnd add a call to your main() to initialize this driver.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ diff project/blinky/src/main.c project/air_quality/src/main.c\n28a29\n\n #include \nsenseair/senseair.h\n\n190a192\n\n     senseair_init()
 ;\n[marko@IsMyLaptop:~/src/air_quality\n\n\n\n\nAnd then build it to make sure all goes well.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ newt target build air_q\nBuilding target air_q (project = air_quality)\nBuilding project air_quality\nSuccessfully run!\n\n\n\n\nAll looks good.\n\n\nAdd CLI commands for testing drivers\n\n\nWhile developing the driver, you want to issue operations from console asking it to do stuff. The way to do this is to register your command handler with shell. Whenever your custom command is issued, you can respond to it.\n\n\nThe way you do this is first adding a dependency to shell package for your senseair driver. So you change libs/my_drivers/senseair/pkg.yml to have the following:\n\n\npkg.name: libs/my_drivers/senseair\npkg.deps:\n    - hw/hal\n    - libs/shell\n\n\n\n\nAnd then register your shell command in \nsenseair_init()\n.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/src/senseair.c\n ....\n\n#include \nshell/shell.h\n\
 n#include \nconsole/console.h\n\n\nstatic int senseair_shell_func(int argc, char **argv);\nstatic struct shell_cmd senseair_cmd = {\n    .sc_cmd = \nsenseair\n,\n    .sc_cmd_func = senseair_shell_func,\n};\n\nvoid\nsenseair_init(void)\n{\n    int rc;\n\n    rc = shell_cmd_register(\nsenseair_cmd);\n    assert(rc == 0);\n}\n\nstatic int\nsenseair_shell_func(int argc, char **argv)\n{\n    console_printf(\nYay! Somebody called!\\n\n);\n    return 0;\n}\n\n\n\n\nThen you build this, download to target, and start minicom on your console port.\n\n\n[marko@IsMyLaptop:~]$ minicom -D /dev/tty.usbserial-AH02MIE2\n\n\nWelcome to minicom 2.7\n\nOPTIONS: \nCompiled on Oct 12 2015, 07:48:30.\nPort /dev/tty.usbserial-AH02MIE2, 13:44:40\n\nPress CTRL-X Z for help on special keys\n\n?\n141964:Unknown command ?\n?\n143804:config   log     echo    ?       tasks   mempools \n143806:stat     senseair \nsenseair\n150644:Yay! Somebody called!\n\n\n\n\nNow that's great. You can connect the hardware to boar
 d and start developing code for the driver itself.\n\n\nUse of HAL for drivers\n\n\nThe sensor has a serial port connection, and that's how you are going to connect to it. Your original BSP, hw/bsp/stm32f3discovery, has only one UART set up (as specified in src/hal_bsp.c, include/hal/bsp.h). Therefore, you need to create your own bsp which has configuration for this added hardware.\n\n\nSo in the shell you make a copy of the original BSP, and then change the package file a little.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ cp -R hw/bsp/stm32f3discovery hw/bsp/stm32f3discovery_with_senseair\n\n\n\n\nThen you modify the pkg.yml in the copied BSP to assign name for this package.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ grep pkg.name hw/bsp/stm32f3discovery_with_senseair/pkg.yml\npkg.name: \nhw/bsp/stm32f3discovery_with_senseair\n\n\n\n\n\nAnd you want to use this BSP with my target. So you change the BSP in the target definition.\n\n\nHere's your new target.\n\n\n[marko@IsMyLaptop:~/
 src/air_quality]$ newt target show air_q                    air_q\n    arch=cortex_m4\n    bsp=hw/bsp/stm32f3discovery_with_senseair\n    compiler=arm-none-eabi-m4\n    compiler_def=debug\n    name=air_q\n    project=air_quality\n    vers=0.0.1\n\n\n\n\nYou add the 2nd serial port to my new BSP.\n\n\nModify the include/hal/bsp.h to increase UART_CNT to 2, and add a definition of the 2nd logical UART. You will use this in your sensor driver.\n\n\nstatic const struct stm32f3_uart_cfg uart_cfg[UART_CNT] = {\n    [0] = {\n        .suc_uart = USART1,\n        .suc_rcc_cmd = RCC_APB2PeriphClockCmd,\n        .suc_rcc_dev = RCC_APB2Periph_USART1,\n        .suc_pin_tx = 9,\n        .suc_pin_rx = 10,\n        .suc_pin_rts = 12,\n        .suc_pin_cts = 11,\n        .suc_pin_af = GPIO_AF_7,\n        .suc_irqn = USART1_IRQn\n    },\n    [1] = {\n        .suc_uart = USART2,\n        .suc_rcc_cmd = RCC_APB1PeriphClockCmd,\n        .suc_rcc_dev = RCC_APB1Periph_USART2,\n        .suc_pin_tx = 19, /*
  PB3 */\n        .suc_pin_rx = 20, /* PB4 */\n        .suc_pin_rts = 1,\n        .suc_pin_cts = 0,\n        .suc_pin_af = GPIO_AF_7,\n        .suc_irqn = USART2_IRQn\n    }\n};\n\n\n\n\nWith this in place, you can refer to serial port where your SenseAir sensor is by a logical number. This makes the code more platform independent - you could connect this sensor to another board, like Olimex. You will also use the HAL UART abstraction to do the UART port setup and data transfer. That way you don't need to have any platform dependent pieces within your little driver.\n\n\nYou will now see what the driver code ends up looking like. Here's the header file, filled in from stub you created earlier.\n\n\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership.  The ASF licenses this file\n * to you under the Apache License, V
 ersion 2.0 (the\n * \nLicense\n); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n * \n *  http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \nAS IS\n BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n*/\n#ifndef _SENSEAIR_H_\n#define _SENSEAIR_H_\n\nenum senseair_read_type {\n        SENSEAIR_CO2,\n        SENSEAIR_TEMPERATURE,\n        SENSEAIR_HUMIDITY\n};\n\nint senseair_init(int uartno);\n\nint senseair_read(enum senseair_read_type);\n\n#endif /* _SENSEAIR_H_ */\n\n\n\n\nAs you can see, logical UART number has been added to the init routine. A 'read' function has been added, which is a blocking read. If you were making a commercial product, you would
  probably have a callback for reporting the results.\n\n\nAnd here is the source for the driver.\n\n\n/**\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership.  The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \nLicense\n); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *  http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \nAS IS\n BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n#include \nstring.h\n\n\n#include \nshell/shell.h\n\n#include \nc
 onsole/console.h\n\n#include \nos/os.h\n\n\n#include \nhal/hal_uart.h\n\n\n#include \nsenseair/senseair.h\n\n\nstatic const uint8_t cmd_read_co2[] = {\n    0xFE, 0X44, 0X00, 0X08, 0X02, 0X9F, 0X25\n};\nstatic const uint8_t cmd_read_temp[] = {\n    0xFE, 0X44, 0X00, 0X12, 0X02, 0X94, 0X45\n};\nstatic const uint8_t cmd_read_humidity[] = {\n    0xFE, 0x44, 0x00, 0x14, 0x02, 0x97, 0xE5\n};\n\nstatic int senseair_shell_func(int argc, char **argv);\nstatic struct shell_cmd senseair_cmd = {\n    .sc_cmd = \nsenseair\n,\n    .sc_cmd_func = senseair_shell_func,\n};\n\nstruct senseair {\n    int uart;\n    struct os_sem sema;\n    const uint8_t *tx_data;\n    int tx_off;\n    int tx_len;\n    uint8_t rx_data[32]; /* XXX what's the max? */\n    int rx_off;\n    int value;\n} senseair;\n\nstatic int\nsenseair_tx_char(void *arg)\n{\n    struct senseair *s = \nsenseair;\n    int rc;\n\n    if (s-\ntx_off \n= s-\ntx_len) {\n        /*\n         * Command tx finished.\n         */\n        s-\ntx_d
 ata = NULL;\n        return -1;\n    }\n\n    rc = s-\ntx_data[s-\ntx_off];\n    s-\ntx_off++;\n    return rc;\n}\n\n/*\n * CRC for modbus over serial port.\n */\nstatic const uint16_t mb_crc_tbl[] = {\n    0x0000, 0xcc01, 0xd801, 0x1400, 0xf001, 0x3c00, 0x2800, 0xe401,\n    0xa001, 0x6c00, 0x7800, 0xb401, 0x5000, 0x9c01, 0x8801, 0x4400\n};\n\nstatic uint16_t\nmb_crc(const uint8_t *data, int len, uint16_t crc)\n{\n    while (len-- \n 0) {\n        crc ^= *data++;\n        crc = (crc \n 4) ^ mb_crc_tbl[crc \n 0xf];\n        crc = (crc \n 4) ^ mb_crc_tbl[crc \n 0xf];\n    }\n    return crc;\n}\n\nstatic int\nmb_crc_check(const void *pkt, int len)\n{\n    uint16_t crc, cmp;\n    uint8_t *bp = (uint8_t *)pkt;\n\n    if (len \n sizeof(crc) + 1) {\n        return -1;\n    }\n    crc = mb_crc(pkt, len - 2, 0xffff);\n    cmp = bp[len - 2] | (bp[len - 1] \n 8);\n    if (crc != cmp) {\n        return -1;\n    } else {\n        return 0;\n    }\n}\n\nstatic int\nsenseair_rx_char(void *arg, uin
 t8_t data)\n{\n    struct senseair *s = (struct senseair *)arg;\n    int rc;\n\n    if (s-\nrx_off \n= sizeof(s-\nrx_data)) {\n        s-\nrx_off = 0;\n    }\n    s-\nrx_data[s-\nrx_off] = data;\n    s-\nrx_off++;\n\n    if (s-\nrx_off == 7) {\n        rc = mb_crc_check(s-\nrx_data, s-\nrx_off);\n        if (rc == 0) {\n            s-\nvalue = s-\nrx_data[3] * 256 + s-\nrx_data[4];\n            os_sem_release(\ns-\nsema);\n        }\n    }\n    return 0;\n}\n\nvoid\nsenseair_tx(struct senseair *s, const uint8_t *tx_data, int data_len)\n{\n    s-\ntx_data = tx_data;\n    s-\ntx_len = data_len;\n    s-\ntx_off = 0;\n    s-\nrx_off = 0;\n\n    hal_uart_start_tx(s-\nuart);\n}\n\nint\nsenseair_read(enum senseair_read_type type)\n{\n    struct senseair *s = \nsenseair;\n    const uint8_t *cmd;\n    int cmd_len;\n    int rc;\n\n    if (s-\ntx_data) {\n        /*\n         * busy\n         */\n        return -1;\n    }\n    switch (type) {\n    case SENSEAIR_CO2:\n        cmd = cmd_read_co2
 ;\n        cmd_len = sizeof(cmd_read_co2);\n        break;\n    case SENSEAIR_TEMPERATURE:\n        cmd = cmd_read_temp;\n        cmd_len = sizeof(cmd_read_temp);\n        break;\n    case SENSEAIR_HUMIDITY:\n        cmd = cmd_read_humidity;\n        cmd_len = sizeof(cmd_read_humidity);\n        break;\n    default:\n        return -1;\n    }\n    senseair_tx(s, cmd, cmd_len);\n    rc = os_sem_pend(\ns-\nsema, OS_TICKS_PER_SEC / 2);\n    if (rc == OS_TIMEOUT) {\n        /*\n         * timeout\n         */\n        return -2;\n    }\n    return s-\nvalue;\n}\n\nstatic int\nsenseair_shell_func(int argc, char **argv)\n{\n    int value;\n    enum senseair_read_type type;\n\n    if (argc \n 2) {\nusage:\n        console_printf(\n%s \nco2|temp|humidity\n\\n\n, argv[0]);\n        return 0;\n    }\n    if (!strcmp(argv[1], \nco2\n)) {\n        type = SENSEAIR_CO2;\n    } else if (!strcmp(argv[1], \ntemp\n)) {\n        type = SENSEAIR_TEMPERATURE;\n    } else if (!strcmp(argv[1], \nhumidity\
 n)) {\n        /*\n         * timeout\n         */\n        return -2;\n    }\n    return s-\nvalue;\n}\n\nstatic int\nsenseair_shell_func(int argc, char **argv)\n{\n    int value;\n    enum senseair_read_type type;\n\n    if (argc \n 2) {\nusage:\n        console_printf(\n%s \nco2|temp|humidity\n\\n\n, argv[0]);\n        return 0;\n    }\n    if (!strcmp(argv[1], \nco2\n)) {\n        type = SENSEAIR_CO2;\n    } else if (!strcmp(argv[1], \ntemp\n)) {\n        type = SENSEAIR_TEMPERATURE;\n    } else if (!strcmp(argv[1], \nhumidity\n)) {\n        type = SENSEAIR_HUMIDITY;\n    } else {\n        goto usage;\n    }\n    value = senseair_read(type);\n    if (value \n= 0) {\n        console_printf(\nGot %d\\n\n, value);\n    } else {\n        console_printf(\nError while reading: %d\\n\n, value);\n    }\n    return 0;\n}\n\nint\nsenseair_init(int uartno)\n{\n    int rc;\n    struct senseair *s = \nsenseair;\n\n    rc = shell_cmd_register(\nsenseair_cmd);\n    if (rc) {\n        return rc
 ;\n    }\n\n    rc = os_sem_init(\ns-\nsema, 1);\n    if (rc) {\n        return rc;\n    }\n    rc = hal_uart_init_cbs(uartno, senseair_tx_char, NULL,\n      senseair_rx_char, \nsenseair);\n    if (rc) {\n        return rc;\n    }\n    rc = hal_uart_config(uartno, 9600, 8, 1, HAL_UART_PARITY_NONE,\n      HAL_UART_FLOW_CTL_NONE);\n    if (rc) {\n        return rc;\n    }\n    s-\nuart = uartno;\n\n    return 0;\n}\n\n\n\n\nAnd you modified your main() for senseair driver init.\n\n\nint\nmain(int argc, char **argv)\n{\n    ....\n    senseair_init(1);\n    ....\n}\n\n\n\n\nYou can see from the code that you are using the HAL interface to open a UART port, and using OS semaphore as a way of blocking the task when waiting for read response to come back from the sensor.", 
+            "text": "Air quality sensor project\n\n\nSetting up source tree for stuff you need\n\n\nTo start with, you need to create a new app under which you will do this development. So you type in:\n\n\n$ mkdir $HOME/src\n$ cd $HOME/src\n$ newt new air_quality\n\n\n\n\nLet's say you are using STM32F3discovery board for this project. You know you need the board support package for that hardware. You can look up its location in the repository, fetch the package list from there, and install the egg for the BSP.\n\n\n[user@IsMyLaptop:~/src/air_quality]$ newt app add-pkg-list mynewt_stm32f3 https://github.com/runtimeinc/mynewt_stm32f3.git\nDownloading pkg-list.yml from https://github.com/runtimeinc/mynewt_stm32f3.git/master... ok!\nVerifying pkg-list.yml format...\n ok!\nPackage list mynewt_stm32f3 successfully installed to application.\n[user@IsMyLaptop:~/src/air_quality]$ newt pkg install hw/bsp/stm32f3discovery\nDownloading mynewt_stm32f3 from https://github.com/runtimeinc/mynewt_
 stm32f3.git/master... ok!\nInstalling hw/bsp/stm32f3discovery\nInstalling hw/mcu/stm/stm32f3xx\nError: No package libs/cmsis-core found\n\n\n\n\nOoops. You forgot to bring in the package list for larva itself. That's the one with most of the packages. Including libs/cmsis-core.\n\n\nThis time you need the latest and greatest from larva, so you want to bring in the 'develop' branch. Note that normally the use of the more stable master branch is recommended. In that case you would drop the '-b develop' from command line.\n\n\nHowever, you want to bring in the packages from develop branch. To make that happen you say:\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ newt app add-pkg-list -b develop larva https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva.git\nDownloading pkg-list.yml from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva.git/develop... ok!\nVerifying pkg-list.yml format...\n ok!\nPackage list larva successfully installed to application.\n[marko@IsMyL
 aptop:~/src/air_quality]$ newt pkg install libs/cmsis-core          Downloading larva from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/develop... ok!\nInstalling libs/cmsis-core\nInstallation was a success!\n\n\n\n\nThat's better. You want to make sure you have all the needed bits for supporting your board; so you decide to build the blinky project for it first.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ newt pkg install project/blinky\nDownloading larva from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/develop... ok!\nInstalling project/blinky\nInstalling libs/console/full\nInstalling libs/newtmgr\nInstalling libs/json\nInstalling libs/shell\nInstalling sys/config\nInstalling sys/log\nInstalling sys/stats\nInstallation was a success!\n[marko@IsMyLaptop:~/src/air_quality]$ newt pkg install compiler/arm-none-eabi-m4\nDownloading larva from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/develop... ok!\nInstalling compiler/arm-none-e
 abi-m4\nInstallation was a success!\n\n\n\n\nAs you can see, this brought in quite a few other dependencies as well.\n\n\nNow create a target for it and build it.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ newt target create blink_f3\nCreating target blink_f3\nTarget blink_f3 successfully created!\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 arch=cortex_m4\nTarget blink_f3 successfully set arch to cortex_m4\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 bsp=hw/bsp/stm32f3discovery\nTarget blink_f3 successfully set bsp to hw/bsp/stm32f3discovery\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 compiler=arm-none-eabi-m4\nTarget blink_f3 successfully set compiler to arm-none-eabi-m4\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 compiler_def=debug\nTarget blink_f3 successfully set compiler_def to debug\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 project=blinky\nTarget blink_f3 successfully set proje
 ct to blinky\n[marko@IsMyLaptop:~/src/air_quality]$ newt target build blink_f3\nBuilding target blink_f3 (project = blinky)\n ...\n[marko@IsMyLaptop:~/src/air_quality]$ newt target build blink_f3\nBuilding target blink_f3 (project = blinky)\nBuilding project blinky\nLinking blinky.elf\n/usr/local/Cellar/gcc-arm-none-eabi-49/20150609/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld: /Users/marko/src/air_quality/project/blinky//bin/blink_f3/blinky.elf section `.text' will not fit in region `FLASH'\n/usr/local/Cellar/gcc-arm-none-eabi-49/20150609/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld: region `FLASH' overflowed by 5180 bytes\ncollect2: error: ld returned 1 exit status\n\n\n\n\nThe error indicates that the images need to be smaller for this board, so you decide to switch over to using baselibc instead of libc.\n\n\nTo do that, you modify the project's egg file project/blinky/pkg.yml. And add \nlibs/baselibc\n to list of package dependencie
 s (pkg.deps).\n\n\nNow:\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ newt target build blink_f3\nBuilding target blink_f3 (project = blinky)\n....\nArchiving libstm32f3discovery.a\nCompiling main.c\nBuilding project blinky\nLinking blinky.elf\nSuccessfully run!\n\n\n\n\nThat's better.\n\n\nYou know that this platform uses bootloader, which means you have to create a target for that too. And download the bootloader package.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ newt target create boot_f3\nCreating target boot_f3\nTarget boot_f3 successfully created!\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 arch=cortex_m4\nnewTarget boot_f3 successfully set arch to cortex_m4\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 bsp=hw/bsp/stm32f3discovery\nnewtTarget boot_f3 successfully set bsp to hw/bsp/stm32f3discovery\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 compiler=arm-none-eabi-m4\nTarget boot_f3 successfully set compiler to arm-none-eabi-
 m4\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 compiler_def=optimized\nTarget boot_f3 successfully set compiler_def to optimized\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 project=boot\nTarget boot_f3 successfully set project to boot\n[marko@IsMyLaptop:~/src/air_quality]$ newt pkg install project/boot\nDownloading larva from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/develop... ok!\nInstalling project/boot\nInstalling fs/nffs\nInstalling fs/fs\nInstalling libs/bootutil\nInstalling libs/mbedtls\nInstalling libs/console/stub\nInstallation was a success!\n\n\n\n\nAnd then build it:\n\n\nnewt target build boot_f3\n....\nLinking boot.elf\nSuccessfully run!\n\n\n\n\nNext you must download the targets to board, and see that the LED actually blinks. You plug in the STM32F3 discovery board to your laptop, and say:\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ newt target download blink_f3\nDownloading with /Users/marko/src/air_quality/h
 w/bsp/stm32f3discovery/stm32f3discovery_download.sh\nDownloading /Users/marko/src/air_quality/project/blinky/bin/blink_f3/blinky.img to 0x08008000\nOpen On-Chip Debugger 0.9.0 (2015-05-28-12:05)\n...\ntarget state: halted\ntarget halted due to debug-request, current mode: Thread \nxPSR: 0x01000000 pc: 0x0800026c msp: 0x10002000\nauto erase enabled\nError: couldn't open /Users/marko/src/air_quality/project/blinky/bin/blink_f3/blinky.img\n\nError: exit status 1\nexit status 1\n\n\n\n\nAh. Forgot to create an image out of the blinky binary.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ newt target create-image blink_f3 0.0.1\nBuilding target blink_f3 (project = blinky)\nCompiling hal_flash.c\nArchiving libhal.a\nCompiling cons_tty.c\nArchiving libfull.a\nCompiling hal_uart.c\nArchiving libstm32f3xx.a\nCompiling hal_bsp.c\nArchiving libstm32f3discovery.a\nCompiling main.c\nBuilding project blinky\nLinking blinky.elf\n[marko@IsMyLaptop:~/src/air_quality]$ newt target download blink_f3\nDown
 loading with /Users/marko/src/air_quality/hw/bsp/stm32f3discovery/stm32f3discovery_download.sh\n\n\n\n\nAnd it's blinking.\n\n\nCreate test project\n\n\nNow that you have your system setup, you can start creating your own stuff.\nFirst you want to create a project for yourself - you can start by getting project template from blinky, as it pretty much has what you want.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ mkdir project/air_quality\n[marko@IsMyLaptop:~/src/air_quality]$ cp project/blinky/pkg.yml project/air_quality/\n[marko@IsMyLaptop:~/src/air_quality]$ mkdir project/air_quality/src\n[marko@IsMyLaptop:~/src/air_quality]$ cp project/blinky/src/main.c project/air_quality/src/\n\n\n\n\nThen you modify the project/air_quality/pkg.yml for air_quality in order to change the \npkg.name\n to be \nproject/air_quality\n.\n\n\nAnd create a target for it:\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ newt target create air_q\nnewt targCreating target air_q\nTarget air_q successfully created!
 \n[marko@IsMyLaptop:~/src/air_quality]$ newt target set air_q arch=cortex_m4\nTarget air_q successfully set arch to cortex_m4\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set air_q bsp=hw/bsp/stm32f3discovery\nTarget air_q successfully set bsp to hw/bsp/stm32f3discovery\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set air_q compiler=arm-none-eabi-m4\nTarget air_q successfully set compiler to arm-none-eabi-m4\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set air_q compiler_def=debug\nTarget air_q successfully set compiler_def to debug\n[marko@IsMyLaptop:~/src/air_quality]$ newt target set air_q project=air_quality\nTarget air_q successfully set project to air_quality\n[marko@IsMyLaptop:~/src/air_quality]$ newt target build air_q\n   ....\nSuccessfully run!\n\n\n\n\nCreate packages for drivers\n\n\nOne of the sensors you want to enable is SenseAir K30, which will connect to the board over serial port.\nTo start development of the driver, you first need to create a pac
 kage description for it, and add stubs for sources.\n\n\nSo you add few files. pkg.yml to describe the driver, and then header stub followed by source stub.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/pkg.yml\n#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership.  The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \nLicense\n); you may not use this file except in compliance\n# with the License.  You may obtain a copy of the License at\n# \n#  http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \nAS IS\n BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing pe
 rmissions and limitations\n# under the License.\n#\npkg.name: libs/my_drivers/senseair\npkg.deps:\n    - hw/hal\n\n\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/include/senseair/senseair.h\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership.  The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \nLicense\n); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n * \n *  http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \nAS IS\n BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permiss
 ions and limitations\n * under the License.\n*/\n#ifndef _SENSEAIR_H_\n#define _SENSEAIR_H_\n\nvoid senseair_init(void);\n\n#endif /* _SENSEAIR_H_ */\n\n\n\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/src/senseair.c\n/**\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership.  The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \nLicense\n); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n * \n *  http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \nAS IS\n BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specifi
 c language governing permissions and limitations\n * under the License.\n */\n\nvoid\nsenseair_init(void)\n{\n}\n\n\n\n\nAnd add dependency to this package in my project yml file.\n\n\nHere's from project/air_quality/pkg.yml\n\n\npkg.name: project/air_quality\npkg.vers: 0.8.0\npkg.description: Basic example application which blinks an LED.\npkg.author: Marko Kiiskila \nmarko@runtime.io\n\npkg.homepage: http://mynewt.apache.org/os/get_acclimated/project2/\npkg.repository: https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva\npkg.keywords:\n\n\npkg.deps:\n    - libs/console/full\n    - libs/newtmgr\n    - libs/os\n    - libs/shell\n    - libs/baselibc\n    - sys/config\n    - sys/log\n    - sys/stats\n    - libs/my_drivers/senseair\n\n\n\n\nAnd add a call to your main() to initialize this driver.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ diff project/blinky/src/main.c project/air_quality/src/main.c\n28a29\n\n #include \nsenseair/senseair.h\n\n190a192\n\n     senseair_init()
 ;\n[marko@IsMyLaptop:~/src/air_quality\n\n\n\n\nAnd then build it to make sure all goes well.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ newt target build air_q\nBuilding target air_q (project = air_quality)\nBuilding project air_quality\nSuccessfully run!\n\n\n\n\nAll looks good.\n\n\nAdd CLI commands for testing drivers\n\n\nWhile developing the driver, you want to issue operations from console asking it to do stuff. The way to do this is to register your command handler with shell. Whenever your custom command is issued, you can respond to it.\n\n\nThe way you do this is first adding a dependency to shell package for your senseair driver. So you change libs/my_drivers/senseair/pkg.yml to have the following:\n\n\npkg.name: libs/my_drivers/senseair\npkg.deps:\n    - hw/hal\n    - libs/shell\n\n\n\n\nAnd then register your shell command in \nsenseair_init()\n.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/src/senseair.c\n ....\n\n#include \nshell/shell.h\n\
 n#include \nconsole/console.h\n\n\nstatic int senseair_shell_func(int argc, char **argv);\nstatic struct shell_cmd senseair_cmd = {\n    .sc_cmd = \nsenseair\n,\n    .sc_cmd_func = senseair_shell_func,\n};\n\nvoid\nsenseair_init(void)\n{\n    int rc;\n\n    rc = shell_cmd_register(\nsenseair_cmd);\n    assert(rc == 0);\n}\n\nstatic int\nsenseair_shell_func(int argc, char **argv)\n{\n    console_printf(\nYay! Somebody called!\\n\n);\n    return 0;\n}\n\n\n\n\nThen you build this, download to target, and start minicom on your console port.\n\n\n[marko@IsMyLaptop:~]$ minicom -D /dev/tty.usbserial-AH02MIE2\n\n\nWelcome to minicom 2.7\n\nOPTIONS: \nCompiled on Oct 12 2015, 07:48:30.\nPort /dev/tty.usbserial-AH02MIE2, 13:44:40\n\nPress CTRL-X Z for help on special keys\n\n?\n141964:Unknown command ?\n?\n143804:config   log     echo    ?       tasks   mempools \n143806:stat     senseair \nsenseair\n150644:Yay! Somebody called!\n\n\n\n\nNow that's great. You can connect the hardware to boar
 d and start developing code for the driver itself.\n\n\nUse of HAL for drivers\n\n\nThe sensor has a serial port connection, and that's how you are going to connect to it. Your original BSP, hw/bsp/stm32f3discovery, has only one UART set up (as specified in src/hal_bsp.c, include/hal/bsp.h). Therefore, you need to create your own bsp which has configuration for this added hardware.\n\n\nSo in the shell you make a copy of the original BSP, and then change the package file a little.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ cp -R hw/bsp/stm32f3discovery hw/bsp/stm32f3discovery_with_senseair\n\n\n\n\nThen you modify the pkg.yml in the copied BSP to assign name for this package.\n\n\n[marko@IsMyLaptop:~/src/air_quality]$ grep pkg.name hw/bsp/stm32f3discovery_with_senseair/pkg.yml\npkg.name: \nhw/bsp/stm32f3discovery_with_senseair\n\n\n\n\n\nAnd you want to use this BSP with my target. So you change the BSP in the target definition.\n\n\nHere's your new target.\n\n\n[marko@IsMyLaptop:~/
 src/air_quality]$ newt target show air_q                    air_q\n    arch=cortex_m4\n    bsp=hw/bsp/stm32f3discovery_with_senseair\n    compiler=arm-none-eabi-m4\n    compiler_def=debug\n    name=air_q\n    project=air_quality\n    vers=0.0.1\n\n\n\n\nYou add the 2nd serial port to my new BSP.\n\n\nModify the include/hal/bsp.h to increase UART_CNT to 2, and add a definition of the 2nd logical UART. You will use this in your sensor driver.\n\n\nstatic const struct stm32f3_uart_cfg uart_cfg[UART_CNT] = {\n    [0] = {\n        .suc_uart = USART1,\n        .suc_rcc_cmd = RCC_APB2PeriphClockCmd,\n        .suc_rcc_dev = RCC_APB2Periph_USART1,\n        .suc_pin_tx = 9,\n        .suc_pin_rx = 10,\n        .suc_pin_rts = 12,\n        .suc_pin_cts = 11,\n        .suc_pin_af = GPIO_AF_7,\n        .suc_irqn = USART1_IRQn\n    },\n    [1] = {\n        .suc_uart = USART2,\n        .suc_rcc_cmd = RCC_APB1PeriphClockCmd,\n        .suc_rcc_dev = RCC_APB1Periph_USART2,\n        .suc_pin_tx = 19, /*
  PB3 */\n        .suc_pin_rx = 20, /* PB4 */\n        .suc_pin_rts = 1,\n        .suc_pin_cts = 0,\n        .suc_pin_af = GPIO_AF_7,\n        .suc_irqn = USART2_IRQn\n    }\n};\n\n\n\n\nWith this in place, you can refer to serial port where your SenseAir sensor is by a logical number. This makes the code more platform independent - you could connect this sensor to another board, like Olimex. You will also use the HAL UART abstraction to do the UART port setup and data transfer. That way you don't need to have any platform dependent pieces within your little driver.\n\n\nYou will now see what the driver code ends up looking like. Here's the header file, filled in from stub you created earlier.\n\n\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership.  The ASF licenses this file\n * to you under the Apache License, V
 ersion 2.0 (the\n * \nLicense\n); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n * \n *  http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \nAS IS\n BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n*/\n#ifndef _SENSEAIR_H_\n#define _SENSEAIR_H_\n\nenum senseair_read_type {\n        SENSEAIR_CO2,\n        SENSEAIR_TEMPERATURE,\n        SENSEAIR_HUMIDITY\n};\n\nint senseair_init(int uartno);\n\nint senseair_read(enum senseair_read_type);\n\n#endif /* _SENSEAIR_H_ */\n\n\n\n\nAs you can see, logical UART number has been added to the init routine. A 'read' function has been added, which is a blocking read. If you were making a commercial product, you would
  probably have a callback for reporting the results.\n\n\nAnd here is the source for the driver.\n\n\n/**\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership.  The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \nLicense\n); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *  http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \nAS IS\n BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n#include \nstring.h\n\n\n#include \nshell/shell.h\n\n#include \nc
 onsole/console.h\n\n#include \nos/os.h\n\n\n#include \nhal/hal_uart.h\n\n\n#include \nsenseair/senseair.h\n\n\nstatic const uint8_t cmd_read_co2[] = {\n    0xFE, 0X44, 0X00, 0X08, 0X02, 0X9F, 0X25\n};\nstatic const uint8_t cmd_read_temp[] = {\n    0xFE, 0X44, 0X00, 0X12, 0X02, 0X94, 0X45\n};\nstatic const uint8_t cmd_read_humidity[] = {\n    0xFE, 0x44, 0x00, 0x14, 0x02, 0x97, 0xE5\n};\n\nstatic int senseair_shell_func(int argc, char **argv);\nstatic struct shell_cmd senseair_cmd = {\n    .sc_cmd = \nsenseair\n,\n    .sc_cmd_func = senseair_shell_func,\n};\n\nstruct senseair {\n    int uart;\n    struct os_sem sema;\n    const uint8_t *tx_data;\n    int tx_off;\n    int tx_len;\n    uint8_t rx_data[32]; /* XXX what's the max? */\n    int rx_off;\n    int value;\n} senseair;\n\nstatic int\nsenseair_tx_char(void *arg)\n{\n    struct senseair *s = \nsenseair;\n    int rc;\n\n    if (s-\ntx_off \n= s-\ntx_len) {\n        /*\n         * Command tx finished.\n         */\n        s-\ntx_d
 ata = NULL;\n        return -1;\n    }\n\n    rc = s-\ntx_data[s-\ntx_off];\n    s-\ntx_off++;\n    return rc;\n}\n\n/*\n * CRC for modbus over serial port.\n */\nstatic const uint16_t mb_crc_tbl[] = {\n    0x0000, 0xcc01, 0xd801, 0x1400, 0xf001, 0x3c00, 0x2800, 0xe401,\n    0xa001, 0x6c00, 0x7800, 0xb401, 0x5000, 0x9c01, 0x8801, 0x4400\n};\n\nstatic uint16_t\nmb_crc(const uint8_t *data, int len, uint16_t crc)\n{\n    while (len-- \n 0) {\n        crc ^= *data++;\n        crc = (crc \n 4) ^ mb_crc_tbl[crc \n 0xf];\n        crc = (crc \n 4) ^ mb_crc_tbl[crc \n 0xf];\n    }\n    return crc;\n}\n\nstatic int\nmb_crc_check(const void *pkt, int len)\n{\n    uint16_t crc, cmp;\n    uint8_t *bp = (uint8_t *)pkt;\n\n    if (len \n sizeof(crc) + 1) {\n        return -1;\n    }\n    crc = mb_crc(pkt, len - 2, 0xffff);\n    cmp = bp[len - 2] | (bp[len - 1] \n 8);\n    if (crc != cmp) {\n        return -1;\n    } else {\n        return 0;\n    }\n}\n\nstatic int\nsenseair_rx_char(void *arg, uin
 t8_t data)\n{\n    struct senseair *s = (struct senseair *)arg;\n    int rc;\n\n    if (s-\nrx_off \n= sizeof(s-\nrx_data)) {\n        s-\nrx_off = 0;\n    }\n    s-\nrx_data[s-\nrx_off] = data;\n    s-\nrx_off++;\n\n    if (s-\nrx_off == 7) {\n        rc = mb_crc_check(s-\nrx_data, s-\nrx_off);\n        if (rc == 0) {\n            s-\nvalue = s-\nrx_data[3] * 256 + s-\nrx_data[4];\n            os_sem_release(\ns-\nsema);\n        }\n    }\n    return 0;\n}\n\nvoid\nsenseair_tx(struct senseair *s, const uint8_t *tx_data, int data_len)\n{\n    s-\ntx_data = tx_data;\n    s-\ntx_len = data_len;\n    s-\ntx_off = 0;\n    s-\nrx_off = 0;\n\n    hal_uart_start_tx(s-\nuart);\n}\n\nint\nsenseair_read(enum senseair_read_type type)\n{\n    struct senseair *s = \nsenseair;\n    const uint8_t *cmd;\n    int cmd_len;\n    int rc;\n\n    if (s-\ntx_data) {\n        /*\n         * busy\n         */\n        return -1;\n    }\n    switch (type) {\n    case SENSEAIR_CO2:\n        cmd = cmd_read_co2
 ;\n        cmd_len = sizeof(cmd_read_co2);\n        break;\n    case SENSEAIR_TEMPERATURE:\n        cmd = cmd_read_temp;\n        cmd_len = sizeof(cmd_read_temp);\n        break;\n    case SENSEAIR_HUMIDITY:\n        cmd = cmd_read_humidity;\n        cmd_len = sizeof(cmd_read_humidity);\n        break;\n    default:\n        return -1;\n    }\n    senseair_tx(s, cmd, cmd_len);\n    rc = os_sem_pend(\ns-\nsema, OS_TICKS_PER_SEC / 2);\n    if (rc == OS_TIMEOUT) {\n        /*\n         * timeout\n         */\n        return -2;\n    }\n    return s-\nvalue;\n}\n\nstatic int\nsenseair_shell_func(int argc, char **argv)\n{\n    int value;\n    enum senseair_read_type type;\n\n    if (argc \n 2) {\nusage:\n        console_printf(\n%s \nco2|temp|humidity\n\\n\n, argv[0]);\n        return 0;\n    }\n    if (!strcmp(argv[1], \nco2\n)) {\n        type = SENSEAIR_CO2;\n    } else if (!strcmp(argv[1], \ntemp\n)) {\n        type = SENSEAIR_TEMPERATURE;\n    } else if (!strcmp(argv[1], \nhumidity\
 n)) {\n        /*\n         * timeout\n         */\n        return -2;\n    }\n    return s-\nvalue;\n}\n\nstatic int\nsenseair_shell_func(int argc, char **argv)\n{\n    int value;\n    enum senseair_read_type type;\n\n    if (argc \n 2) {\nusage:\n        console_printf(\n%s \nco2|temp|humidity\n\\n\n, argv[0]);\n        return 0;\n    }\n    if (!strcmp(argv[1], \nco2\n)) {\n        type = SENSEAIR_CO2;\n    } else if (!strcmp(argv[1], \ntemp\n)) {\n        type = SENSEAIR_TEMPERATURE;\n    } else if (!strcmp(argv[1], \nhumidity\n)) {\n        type = SENSEAIR_HUMIDITY;\n    } else {\n        goto usage;\n    }\n    value = senseair_read(type);\n    if (value \n= 0) {\n        console_printf(\nGot %d\\n\n, value);\n    } else {\n        console_printf(\nError while reading: %d\\n\n, value);\n    }\n    return 0;\n}\n\nint\nsenseair_init(int uartno)\n{\n    int rc;\n    struct senseair *s = \nsenseair;\n\n    rc = shell_cmd_register(\nsenseair_cmd);\n    if (rc) {\n        return rc
 ;\n    }\n\n    rc = os_sem_init(\ns-\nsema, 1);\n    if (rc) {\n        return rc;\n    }\n    rc = hal_uart_init_cbs(uartno, senseair_tx_char, NULL,\n      senseair_rx_char, \nsenseair);\n    if (rc) {\n        return rc;\n    }\n    rc = hal_uart_config(uartno, 9600, 8, 1, HAL_UART_PARITY_NONE,\n      HAL_UART_FLOW_CTL_NONE);\n    if (rc) {\n        return rc;\n    }\n    s-\nuart = uartno;\n\n    return 0;\n}\n\n\n\n\nAnd you modified your main() for senseair driver init.\n\n\n:::c\nint\nmain(int argc, char **argv)\n{\n    ....\n    senseair_init(1);\n    ....\n}\n\n\n\nYou can see from the code that you are using the HAL interface to open a UART port, and using OS semaphore as a way of blocking the task when waiting for read response to come back from the sensor.", 
             "title": "Adding an air-quality sensor"
         }, 
         {
@@ -387,7 +387,7 @@
         }, 
         {
             "location": "/os/tutorials/air_quality_sensor/#use-of-hal-for-drivers", 
-            "text": "The sensor has a serial port connection, and that's how you are going to connect to it. Your original BSP, hw/bsp/stm32f3discovery, has only one UART set up (as specified in src/hal_bsp.c, include/hal/bsp.h). Therefore, you need to create your own bsp which has configuration for this added hardware.  So in the shell you make a copy of the original BSP, and then change the package file a little.  [marko@IsMyLaptop:~/src/air_quality]$ cp -R hw/bsp/stm32f3discovery hw/bsp/stm32f3discovery_with_senseair  Then you modify the pkg.yml in the copied BSP to assign name for this package.  [marko@IsMyLaptop:~/src/air_quality]$ grep pkg.name hw/bsp/stm32f3discovery_with_senseair/pkg.yml\npkg.name:  hw/bsp/stm32f3discovery_with_senseair   And you want to use this BSP with my target. So you change the BSP in the target definition.  Here's your new target.  [marko@IsMyLaptop:~/src/air_quality]$ newt target show air_q                    air_q\n    arch=cortex_m4\n    bsp=hw/bsp
 /stm32f3discovery_with_senseair\n    compiler=arm-none-eabi-m4\n    compiler_def=debug\n    name=air_q\n    project=air_quality\n    vers=0.0.1  You add the 2nd serial port to my new BSP.  Modify the include/hal/bsp.h to increase UART_CNT to 2, and add a definition of the 2nd logical UART. You will use this in your sensor driver.  static const struct stm32f3_uart_cfg uart_cfg[UART_CNT] = {\n    [0] = {\n        .suc_uart = USART1,\n        .suc_rcc_cmd = RCC_APB2PeriphClockCmd,\n        .suc_rcc_dev = RCC_APB2Periph_USART1,\n        .suc_pin_tx = 9,\n        .suc_pin_rx = 10,\n        .suc_pin_rts = 12,\n        .suc_pin_cts = 11,\n        .suc_pin_af = GPIO_AF_7,\n        .suc_irqn = USART1_IRQn\n    },\n    [1] = {\n        .suc_uart = USART2,\n        .suc_rcc_cmd = RCC_APB1PeriphClockCmd,\n        .suc_rcc_dev = RCC_APB1Periph_USART2,\n        .suc_pin_tx = 19, /* PB3 */\n        .suc_pin_rx = 20, /* PB4 */\n        .suc_pin_rts = 1,\n        .suc_pin_cts = 0,\n        .suc_pin_
 af = GPIO_AF_7,\n        .suc_irqn = USART2_IRQn\n    }\n};  With this in place, you can refer to serial port where your SenseAir sensor is by a logical number. This makes the code more platform independent - you could connect this sensor to another board, like Olimex. You will also use the HAL UART abstraction to do the UART port setup and data transfer. That way you don't need to have any platform dependent pieces within your little driver.  You will now see what the driver code ends up looking like. Here's the header file, filled in from stub you created earlier.  /*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership.  The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n *  License ); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the Li
 cense at\n * \n *  http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n *  AS IS  BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n*/\n#ifndef _SENSEAIR_H_\n#define _SENSEAIR_H_\n\nenum senseair_read_type {\n        SENSEAIR_CO2,\n        SENSEAIR_TEMPERATURE,\n        SENSEAIR_HUMIDITY\n};\n\nint senseair_init(int uartno);\n\nint senseair_read(enum senseair_read_type);\n\n#endif /* _SENSEAIR_H_ */  As you can see, logical UART number has been added to the init routine. A 'read' function has been added, which is a blocking read. If you were making a commercial product, you would probably have a callback for reporting the results.  And here is the source for the driver.  /**\n * Licensed to the Apache Software Foundation 
 (ASF) under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership.  The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n *  License ); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *  http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n *  AS IS  BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n#include  string.h \n\n#include  shell/shell.h \n#include  console/console.h \n#include  os/os.h \n\n#include  hal/hal_uart.h \n\n#include  senseair/senseair.h \n\nstatic const uint8_t cmd_read_co2[] = {\n    0xFE, 0X44, 0
 X00, 0X08, 0X02, 0X9F, 0X25\n};\nstatic const uint8_t cmd_read_temp[] = {\n    0xFE, 0X44, 0X00, 0X12, 0X02, 0X94, 0X45\n};\nstatic const uint8_t cmd_read_humidity[] = {\n    0xFE, 0x44, 0x00, 0x14, 0x02, 0x97, 0xE5\n};\n\nstatic int senseair_shell_func(int argc, char **argv);\nstatic struct shell_cmd senseair_cmd = {\n    .sc_cmd =  senseair ,\n    .sc_cmd_func = senseair_shell_func,\n};\n\nstruct senseair {\n    int uart;\n    struct os_sem sema;\n    const uint8_t *tx_data;\n    int tx_off;\n    int tx_len;\n    uint8_t rx_data[32]; /* XXX what's the max? */\n    int rx_off;\n    int value;\n} senseair;\n\nstatic int\nsenseair_tx_char(void *arg)\n{\n    struct senseair *s =  senseair;\n    int rc;\n\n    if (s- tx_off  = s- tx_len) {\n        /*\n         * Command tx finished.\n         */\n        s- tx_data = NULL;\n        return -1;\n    }\n\n    rc = s- tx_data[s- tx_off];\n    s- tx_off++;\n    return rc;\n}\n\n/*\n * CRC for modbus over serial port.\n */\nstatic const uin
 t16_t mb_crc_tbl[] = {\n    0x0000, 0xcc01, 0xd801, 0x1400, 0xf001, 0x3c00, 0x2800, 0xe401,\n    0xa001, 0x6c00, 0x7800, 0xb401, 0x5000, 0x9c01, 0x8801, 0x4400\n};\n\nstatic uint16_t\nmb_crc(const uint8_t *data, int len, uint16_t crc)\n{\n    while (len--   0) {\n        crc ^= *data++;\n        crc = (crc   4) ^ mb_crc_tbl[crc   0xf];\n        crc = (crc   4) ^ mb_crc_tbl[crc   0xf];\n    }\n    return crc;\n}\n\nstatic int\nmb_crc_check(const void *pkt, int len)\n{\n    uint16_t crc, cmp;\n    uint8_t *bp = (uint8_t *)pkt;\n\n    if (len   sizeof(crc) + 1) {\n        return -1;\n    }\n    crc = mb_crc(pkt, len - 2, 0xffff);\n    cmp = bp[len - 2] | (bp[len - 1]   8);\n    if (crc != cmp) {\n        return -1;\n    } else {\n        return 0;\n    }\n}\n\nstatic int\nsenseair_rx_char(void *arg, uint8_t data)\n{\n    struct senseair *s = (struct senseair *)arg;\n    int rc;\n\n    if (s- rx_off  = sizeof(s- rx_data)) {\n        s- rx_off = 0;\n    }\n    s- rx_data[s- rx_off] = dat
 a;\n    s- rx_off++;\n\n    if (s- rx_off == 7) {\n        rc = mb_crc_check(s- rx_data, s- rx_off);\n        if (rc == 0) {\n            s- value = s- rx_data[3] * 256 + s- rx_data[4];\n            os_sem_release( s- sema);\n        }\n    }\n    return 0;\n}\n\nvoid\nsenseair_tx(struct senseair *s, const uint8_t *tx_data, int data_len)\n{\n    s- tx_data = tx_data;\n    s- tx_len = data_len;\n    s- tx_off = 0;\n    s- rx_off = 0;\n\n    hal_uart_start_tx(s- uart);\n}\n\nint\nsenseair_read(enum senseair_read_type type)\n{\n    struct senseair *s =  senseair;\n    const uint8_t *cmd;\n    int cmd_len;\n    int rc;\n\n    if (s- tx_data) {\n        /*\n         * busy\n         */\n        return -1;\n    }\n    switch (type) {\n    case SENSEAIR_CO2:\n        cmd = cmd_read_co2;\n        cmd_len = sizeof(cmd_read_co2);\n        break;\n    case SENSEAIR_TEMPERATURE:\n        cmd = cmd_read_temp;\n        cmd_len = sizeof(cmd_read_temp);\n        break;\n    case SENSEAIR_HUMIDITY:\
 n        cmd = cmd_read_humidity;\n        cmd_len = sizeof(cmd_read_humidity);\n        break;\n    default:\n        return -1;\n    }\n    senseair_tx(s, cmd, cmd_len);\n    rc = os_sem_pend( s- sema, OS_TICKS_PER_SEC / 2);\n    if (rc == OS_TIMEOUT) {\n        /*\n         * timeout\n         */\n        return -2;\n    }\n    return s- value;\n}\n\nstatic int\nsenseair_shell_func(int argc, char **argv)\n{\n    int value;\n    enum senseair_read_type type;\n\n    if (argc   2) {\nusage:\n        console_printf( %s  co2|temp|humidity \\n , argv[0]);\n        return 0;\n    }\n    if (!strcmp(argv[1],  co2 )) {\n        type = SENSEAIR_CO2;\n    } else if (!strcmp(argv[1],  temp )) {\n        type = SENSEAIR_TEMPERATURE;\n    } else if (!strcmp(argv[1],  humidity )) {\n        /*\n         * timeout\n         */\n        return -2;\n    }\n    return s- value;\n}\n\nstatic int\nsenseair_shell_func(int argc, char **argv)\n{\n    int value;\n    enum senseair_read_type type;\n\n    
 if (argc   2) {\nusage:\n        console_printf( %s  co2|temp|humidity \\n , argv[0]);\n        return 0;\n    }\n    if (!strcmp(argv[1],  co2 )) {\n        type = SENSEAIR_CO2;\n    } else if (!strcmp(argv[1],  temp )) {\n        type = SENSEAIR_TEMPERATURE;\n    } else if (!strcmp(argv[1],  humidity )) {\n        type = SENSEAIR_HUMIDITY;\n    } else {\n        goto usage;\n    }\n    value = senseair_read(type);\n    if (value  = 0) {\n        console_printf( Got %d\\n , value);\n    } else {\n        console_printf( Error while reading: %d\\n , value);\n    }\n    return 0;\n}\n\nint\nsenseair_init(int uartno)\n{\n    int rc;\n    struct senseair *s =  senseair;\n\n    rc = shell_cmd_register( senseair_cmd);\n    if (rc) {\n        return rc;\n    }\n\n    rc = os_sem_init( s- sema, 1);\n    if (rc) {\n        return rc;\n    }\n    rc = hal_uart_init_cbs(uartno, senseair_tx_char, NULL,\n      senseair_rx_char,  senseair);\n    if (rc) {\n        return rc;\n    }\n    rc = hal
 _uart_config(uartno, 9600, 8, 1, HAL_UART_PARITY_NONE,\n      HAL_UART_FLOW_CTL_NONE);\n    if (rc) {\n        return rc;\n    }\n    s- uart = uartno;\n\n    return 0;\n}  And you modified your main() for senseair driver init.  int\nmain(int argc, char **argv)\n{\n    ....\n    senseair_init(1);\n    ....\n}  You can see from the code that you are using the HAL interface to open a UART port, and using OS semaphore as a way of blocking the task when waiting for read response to come back from the sensor.", 
+            "text": "The sensor has a serial port connection, and that's how you are going to connect to it. Your original BSP, hw/bsp/stm32f3discovery, has only one UART set up (as specified in src/hal_bsp.c, include/hal/bsp.h). Therefore, you need to create your own bsp which has configuration for this added hardware.  So in the shell you make a copy of the original BSP, and then change the package file a little.  [marko@IsMyLaptop:~/src/air_quality]$ cp -R hw/bsp/stm32f3discovery hw/bsp/stm32f3discovery_with_senseair  Then you modify the pkg.yml in the copied BSP to assign name for this package.  [marko@IsMyLaptop:~/src/air_quality]$ grep pkg.name hw/bsp/stm32f3discovery_with_senseair/pkg.yml\npkg.name:  hw/bsp/stm32f3discovery_with_senseair   And you want to use this BSP with my target. So you change the BSP in the target definition.  Here's your new target.  [marko@IsMyLaptop:~/src/air_quality]$ newt target show air_q                    air_q\n    arch=cortex_m4\n    bsp=hw/bsp
 /stm32f3discovery_with_senseair\n    compiler=arm-none-eabi-m4\n    compiler_def=debug\n    name=air_q\n    project=air_quality\n    vers=0.0.1  You add the 2nd serial port to my new BSP.  Modify the include/hal/bsp.h to increase UART_CNT to 2, and add a definition of the 2nd logical UART. You will use this in your sensor driver.  static const struct stm32f3_uart_cfg uart_cfg[UART_CNT] = {\n    [0] = {\n        .suc_uart = USART1,\n        .suc_rcc_cmd = RCC_APB2PeriphClockCmd,\n        .suc_rcc_dev = RCC_APB2Periph_USART1,\n        .suc_pin_tx = 9,\n        .suc_pin_rx = 10,\n        .suc_pin_rts = 12,\n        .suc_pin_cts = 11,\n        .suc_pin_af = GPIO_AF_7,\n        .suc_irqn = USART1_IRQn\n    },\n    [1] = {\n        .suc_uart = USART2,\n        .suc_rcc_cmd = RCC_APB1PeriphClockCmd,\n        .suc_rcc_dev = RCC_APB1Periph_USART2,\n        .suc_pin_tx = 19, /* PB3 */\n        .suc_pin_rx = 20, /* PB4 */\n        .suc_pin_rts = 1,\n        .suc_pin_cts = 0,\n        .suc_pin_
 af = GPIO_AF_7,\n        .suc_irqn = USART2_IRQn\n    }\n};  With this in place, you can refer to serial port where your SenseAir sensor is by a logical number. This makes the code more platform independent - you could connect this sensor to another board, like Olimex. You will also use the HAL UART abstraction to do the UART port setup and data transfer. That way you don't need to have any platform dependent pieces within your little driver.  You will now see what the driver code ends up looking like. Here's the header file, filled in from stub you created earlier.  /*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership.  The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n *  License ); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the Li
 cense at\n * \n *  http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n *  AS IS  BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n*/\n#ifndef _SENSEAIR_H_\n#define _SENSEAIR_H_\n\nenum senseair_read_type {\n        SENSEAIR_CO2,\n        SENSEAIR_TEMPERATURE,\n        SENSEAIR_HUMIDITY\n};\n\nint senseair_init(int uartno);\n\nint senseair_read(enum senseair_read_type);\n\n#endif /* _SENSEAIR_H_ */  As you can see, logical UART number has been added to the init routine. A 'read' function has been added, which is a blocking read. If you were making a commercial product, you would probably have a callback for reporting the results.  And here is the source for the driver.  /**\n * Licensed to the Apache Software Foundation 
 (ASF) under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership.  The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n *  License ); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *  http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n *  AS IS  BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n#include  string.h \n\n#include  shell/shell.h \n#include  console/console.h \n#include  os/os.h \n\n#include  hal/hal_uart.h \n\n#include  senseair/senseair.h \n\nstatic const uint8_t cmd_read_co2[] = {\n    0xFE, 0X44, 0
 X00, 0X08, 0X02, 0X9F, 0X25\n};\nstatic const uint8_t cmd_read_temp[] = {\n    0xFE, 0X44, 0X00, 0X12, 0X02, 0X94, 0X45\n};\nstatic const uint8_t cmd_read_humidity[] = {\n    0xFE, 0x44, 0x00, 0x14, 0x02, 0x97, 0xE5\n};\n\nstatic int senseair_shell_func(int argc, char **argv);\nstatic struct shell_cmd senseair_cmd = {\n    .sc_cmd =  senseair ,\n    .sc_cmd_func = senseair_shell_func,\n};\n\nstruct senseair {\n    int uart;\n    struct os_sem sema;\n    const uint8_t *tx_data;\n    int tx_off;\n    int tx_len;\n    uint8_t rx_data[32]; /* XXX what's the max? */\n    int rx_off;\n    int value;\n} senseair;\n\nstatic int\nsenseair_tx_char(void *arg)\n{\n    struct senseair *s =  senseair;\n    int rc;\n\n    if (s- tx_off  = s- tx_len) {\n        /*\n         * Command tx finished.\n         */\n        s- tx_data = NULL;\n        return -1;\n    }\n\n    rc = s- tx_data[s- tx_off];\n    s- tx_off++;\n    return rc;\n}\n\n/*\n * CRC for modbus over serial port.\n */\nstatic const uin
 t16_t mb_crc_tbl[] = {\n    0x0000, 0xcc01, 0xd801, 0x1400, 0xf001, 0x3c00, 0x2800, 0xe401,\n    0xa001, 0x6c00, 0x7800, 0xb401, 0x5000, 0x9c01, 0x8801, 0x4400\n};\n\nstatic uint16_t\nmb_crc(const uint8_t *data, int len, uint16_t crc)\n{\n    while (len--   0) {\n        crc ^= *data++;\n        crc = (crc   4) ^ mb_crc_tbl[crc   0xf];\n        crc = (crc   4) ^ mb_crc_tbl[crc   0xf];\n    }\n    return crc;\n}\n\nstatic int\nmb_crc_check(const void *pkt, int len)\n{\n    uint16_t crc, cmp;\n    uint8_t *bp = (uint8_t *)pkt;\n\n    if (len   sizeof(crc) + 1) {\n        return -1;\n    }\n    crc = mb_crc(pkt, len - 2, 0xffff);\n    cmp = bp[len - 2] | (bp[len - 1]   8);\n    if (crc != cmp) {\n        return -1;\n    } else {\n        return 0;\n    }\n}\n\nstatic int\nsenseair_rx_char(void *arg, uint8_t data)\n{\n    struct senseair *s = (struct senseair *)arg;\n    int rc;\n\n    if (s- rx_off  = sizeof(s- rx_data)) {\n        s- rx_off = 0;\n    }\n    s- rx_data[s- rx_off] = dat
 a;\n    s- rx_off++;\n\n    if (s- rx_off == 7) {\n        rc = mb_crc_check(s- rx_data, s- rx_off);\n        if (rc == 0) {\n            s- value = s- rx_data[3] * 256 + s- rx_data[4];\n            os_sem_release( s- sema);\n        }\n    }\n    return 0;\n}\n\nvoid\nsenseair_tx(struct senseair *s, const uint8_t *tx_data, int data_len)\n{\n    s- tx_data = tx_data;\n    s- tx_len = data_len;\n    s- tx_off = 0;\n    s- rx_off = 0;\n\n    hal_uart_start_tx(s- uart);\n}\n\nint\nsenseair_read(enum senseair_read_type type)\n{\n    struct senseair *s =  senseair;\n    const uint8_t *cmd;\n    int cmd_len;\n    int rc;\n\n    if (s- tx_data) {\n        /*\n         * busy\n         */\n        return -1;\n    }\n    switch (type) {\n    case SENSEAIR_CO2:\n        cmd = cmd_read_co2;\n        cmd_len = sizeof(cmd_read_co2);\n        break;\n    case SENSEAIR_TEMPERATURE:\n        cmd = cmd_read_temp;\n        cmd_len = sizeof(cmd_read_temp);\n        break;\n    case SENSEAIR_HUMIDITY:\
 n        cmd = cmd_read_humidity;\n        cmd_len = sizeof(cmd_read_humidity);\n        break;\n    default:\n        return -1;\n    }\n    senseair_tx(s, cmd, cmd_len);\n    rc = os_sem_pend( s- sema, OS_TICKS_PER_SEC / 2);\n    if (rc == OS_TIMEOUT) {\n        /*\n         * timeout\n         */\n        return -2;\n    }\n    return s- value;\n}\n\nstatic int\nsenseair_shell_func(int argc, char **argv)\n{\n    int value;\n    enum senseair_read_type type;\n\n    if (argc   2) {\nusage:\n        console_printf( %s  co2|temp|humidity \\n , argv[0]);\n        return 0;\n    }\n    if (!strcmp(argv[1],  co2 )) {\n        type = SENSEAIR_CO2;\n    } else if (!strcmp(argv[1],  temp )) {\n        type = SENSEAIR_TEMPERATURE;\n    } else if (!strcmp(argv[1],  humidity )) {\n        /*\n         * timeout\n         */\n        return -2;\n    }\n    return s- value;\n}\n\nstatic int\nsenseair_shell_func(int argc, char **argv)\n{\n    int value;\n    enum senseair_read_type type;\n\n    
 if (argc   2) {\nusage:\n        console_printf( %s  co2|temp|humidity \\n , argv[0]);\n        return 0;\n    }\n    if (!strcmp(argv[1],  co2 )) {\n        type = SENSEAIR_CO2;\n    } else if (!strcmp(argv[1],  temp )) {\n        type = SENSEAIR_TEMPERATURE;\n    } else if (!strcmp(argv[1],  humidity )) {\n        type = SENSEAIR_HUMIDITY;\n    } else {\n        goto usage;\n    }\n    value = senseair_read(type);\n    if (value  = 0) {\n        console_printf( Got %d\\n , value);\n    } else {\n        console_printf( Error while reading: %d\\n , value);\n    }\n    return 0;\n}\n\nint\nsenseair_init(int uartno)\n{\n    int rc;\n    struct senseair *s =  senseair;\n\n    rc = shell_cmd_register( senseair_cmd);\n    if (rc) {\n        return rc;\n    }\n\n    rc = os_sem_init( s- sema, 1);\n    if (rc) {\n        return rc;\n    }\n    rc = hal_uart_init_cbs(uartno, senseair_tx_char, NULL,\n      senseair_rx_char,  senseair);\n    if (rc) {\n        return rc;\n    }\n    rc = hal
 _uart_config(uartno, 9600, 8, 1, HAL_UART_PARITY_NONE,\n      HAL_UART_FLOW_CTL_NONE);\n    if (rc) {\n        return rc;\n    }\n    s- uart = uartno;\n\n    return 0;\n}  And you modified your main() for senseair driver init.  :::c\nint\nmain(int argc, char **argv)\n{\n    ....\n    senseair_init(1);\n    ....\n}  You can see from the code that you are using the HAL interface to open a UART port, and using OS semaphore as a way of blocking the task when waiting for read response to come back from the sensor.", 
             "title": "Use of HAL for drivers"
         }, 
         {
@@ -457,7 +457,7 @@
         }, 
         {
             "location": "/os/core_os/mynewt_os/", 
-            "text": "Mynewt Core OS\n\n\nThe Mynewt Core OS is a multitasking, preemptive real-time operating system combining a scheduler with typical RTOS features such as mutexes, semaphores, memory pools, etc. The Mynewt Core OS also provides a number of useful utilities such as a task watchdog, networking stack memory buffers and time management API. Each of these features is described in detail in its own section of the manual.\n\n\nA multitasking, preemptive operating system is one in which a number of different tasks can be instantiated and assigned a priority, with higher priority tasks running before lower priority tasks. Furthermore, if a lower priority task is running and a higher priority task wants to run, the lower priority task is halted and the higher priority task is allowed to run. In other words, the lower priority task is preempted by the higher priority task.\n\n\nWhy use an OS?\n\n\nYou may ask yourself \"why do I need a multitasking preemptive OS\"? The answe
 r may indeed be that you do not. Some applications are simple and only require a polling loop. Others are more complex and may require that certain jobs are executed in a timely manner or before other jobs are executed. If you have a simple polling loop, you cannot move on to service a job until the current job is done being serviced. With the Mynewt OS, the application developer need not worry about certain jobs taking too long or not executing in a timely fashion; the OS provides mechanisms to deal with these situations. Another benefit of using an OS is that it helps shield application developers from other application code being written; the developer does not have to worry (or has to worry less) about other application code behaving badly and causing undesirable behavior or preventing their code from executing properly. Other benefits of using an OS (and the Mynewt OS in particular) is that it also provides features that the developer would otherwise need to create on his/her o
 wn. \n\n\nCore OS Features\n\n\n\n\n\n\nScheduler/context switching\n\n\nTime\n\n\nTasks\n\n\nEvent queues/callouts\n\n\nSemaphores\n\n\nMutexes\n\n\nMemory pools\n\n\nHeap\n\n\nMbufs\n\n\nSanity\n\n\nCallouts\n\n\nPorting OS to other platforms\n\n\n\n\nBasic OS Application Creation\n\n\nCreating an application using the Mynewt Core OS is a relatively simple task: once you have installed the basic Newt Tool structure (build structure) for your application and created your BSP (Board Support Package), the developer initializes the OS by calling \nos_init()\n, performs application specific initializations, and then starts the os by calling \nos_start()\n. \n\n\nThe \nos_init()\n API performs two basic functions: calls architecture and bsp specific setup and initializes the idle task of the OS. This is required before the OS is started. The OS start API initializes the OS time tick interrupt and starts the highest priority task running (i.e starts the scheduler). Note that \nos_start()
 \n never returns; once called the device is either running in an application task context or in idle task context.\n\n\nInitializing application modules and tasks can get somewhat complicated with RTOS's similar to Mynewt. Care must be taken that the API provided by a task are initialized prior to being called by another (higher priority) task. \n\n\nFor example, take a simple application with two tasks (tasks 1 and 2, with task 1 higher priority than task 2). Task 2 provides an API which has a semaphore lock and this semaphore is initialized by task 2 when the task handler for task 2 is called. Task 1 is expected to call this API.\n\n\nConsider the sequence of events when the OS is started. The scheduler starts running and picks the highest priority task (task 1 in this case). The task handler function for task 1 is called and will keep running until it yields execution. Before yielding, code in the task 1 handler function calls the API provided by task 2. The semaphore being acces
 sed in the task 2 API has yet to be initialized since the task 2 handler function has not had a chance to run! This will lead to undesirable behavior and will need to be addressed by the application developer. Note that the Mynewt OS does guard against internal API being called before the OS has started (they will return error) but it does not safeguard application defined objects from access prior to initialization.\n\n\nExample\n\n\nOne way to avoid initialization issues like the one described above is to perform task initializations prior to starting the OS. The code example shown below illustrates this concept. The application initializes the OS, calls an application specific \"task initialization\" function, and then starts the OS. The application task initialization function is responsible for initializing all the data objects that each task exposes to the other tasks. The tasks themselves are also initialized at this time (by calling \nos_task_init()\n). \n\n\nIn the example,
  each task works in a ping-pong like fashion: task 1 wakes up, adds a token to semaphore 1 and then waits for a token from semaphore 2. Task 2 waits for a token on semaphore 1 and once it gets it, adds a token to semaphore 2. Notice that the semaphores are initialized by the application specific task initialization functions and not inside the task handler functions. If task 2 (being lower in priority than task 1) had called os_sem_init() for task2_sem inside task2_handler(), task 1 would have called os_sem_pend() using task2_sem before task2_sem was initialized.\n\n\n\n\n\n/* Task 1 handler function */\nvoid\ntask1_handler(void *arg)\n{\n    while (1) {\n        /* Release semaphore to task 2 */\n        os_sem_release(\ntask1_sem);\n\n        /* Wait for semaphore from task 2 */\n        os_sem_pend(\ntask2_sem, OS_TIMEOUT_NEVER);\n    }\n}\n\n/* Task 2 handler function */\nvoid\ntask2_handler(void *arg)\n{\n    struct os_task *t;\n\n    while (1) {\n        /* Wait for semaphore 
 from task1 */\n        os_sem_pend(\ntask1_sem, OS_TIMEOUT_NEVER);\n\n        /* Release task2 semaphore */\n        os_sem_release(\ntask2_sem);\n    }\n}\n\n\n/* Initialize task 1 exposed data objects */\nvoid\ntask1_init(void)\n{\n    /* Initialize task1 semaphore */\n    os_sem_init(\ntask1_sem, 0);\n}\n\n/* Initialize task 2 exposed data objects */\nvoid\ntask2_init(void)\n{\n    /* Initialize task1 semaphore */\n    os_sem_init(\ntask2_sem, 0);\n}\n\n/**\n * init_app_tasks\n *  \n * Called by main.c after os_init(). This function performs initializations \n * that are required before tasks are running. \n *  \n * @return int 0 success; error otherwise.\n */\nstatic int\ninit_app_tasks(void)\n{\n    /*\n     * Initialize tasks 1 and 2. Note that the task handlers are not called yet; they will\n     * be called when the OS is started.\n     */\n    os_task_init(\ntask1, \ntask1\n, task1_handler, NULL, TASK1_PRIO, \n                 OS_WAIT_FOREVER, task1_stack, TASK1_STACK_SIZE)
 ;\n\n    os_task_init(\ntask2, \ntask2\n, task2_handler, NULL, TASK2_PRIO, \n                 OS_WAIT_FOREVER, task2_stack, TASK2_STACK_SIZE);\n\n    /* Call task specific initialization functions. */\n    task1_init();\n    task2_init();\n\n    return 0;\n}\n\n/**\n * main\n *  \n * The main function for the application. This function initializes the os, calls \n * the application specific task initialization function. then starts the \n * OS. We should not return from os start! \n */\nint\nmain(void)\n{\n    int i;\n    int rc;\n    uint32_t seed;\n\n    /* Initialize OS */\n    os_init();\n\n    /* Initialize application specific tasks */\n    init_app_tasks();\n\n    /* Start the OS */\n    os_start();\n\n    /* os start should never return. If it does, this should be an error */\n    assert(0);\n\n    return rc;\n}\n\n\n\n\n\nOS Functions\n\n\nThe functions available at the OS level are:\n\n\n\n\nos_init\n\n\nos_start\n\n\nos_started", 
+            "text": "Mynewt Core OS\n\n\nThe Mynewt Core OS is a multitasking, preemptive real-time operating system combining a scheduler with typical RTOS features such as mutexes, semaphores, memory pools, etc. The Mynewt Core OS also provides a number of useful utilities such as a task watchdog, networking stack memory buffers and time management API. Each of these features is described in detail in its own section of the manual.\n\n\nA multitasking, preemptive operating system is one in which a number of different tasks can be instantiated and assigned a priority, with higher priority tasks running before lower priority tasks. Furthermore, if a lower priority task is running and a higher priority task wants to run, the lower priority task is halted and the higher priority task is allowed to run. In other words, the lower priority task is preempted by the higher priority task.\n\n\nWhy use an OS?\n\n\nYou may ask yourself \"why do I need a multitasking preemptive OS\"? The answe
 r may indeed be that you do not. Some applications are simple and only require a polling loop. Others are more complex and may require that certain jobs are executed in a timely manner or before other jobs are executed. If you have a simple polling loop, you cannot move on to service a job until the current job is done being serviced. With the Mynewt OS, the application developer need not worry about certain jobs taking too long or not executing in a timely fashion; the OS provides mechanisms to deal with these situations. Another benefit of using an OS is that it helps shield application developers from other application code being written; the developer does not have to worry (or has to worry less) about other application code behaving badly and causing undesirable behavior or preventing their code from executing properly. Other benefits of using an OS (and the Mynewt OS in particular) is that it also provides features that the developer would otherwise need to create on his/her o
 wn. \n\n\nCore OS Features\n\n\n\n\n\n\nScheduler/context switching\n\n\nTime\n\n\nTasks\n\n\nEvent queues/callouts\n\n\nSemaphores\n\n\nMutexes\n\n\nMemory pools\n\n\nHeap\n\n\nMbufs\n\n\nSanity\n\n\nCallouts\n\n\nPorting OS to other platforms\n\n\n\n\nBasic OS Application Creation\n\n\nCreating an application using the Mynewt Core OS is a relatively simple task: once you have installed the basic Newt Tool structure (build structure) for your application and created your BSP (Board Support Package), the developer initializes the OS by calling \nos_init()\n, performs application specific initializations, and then starts the os by calling \nos_start()\n. \n\n\nThe \nos_init()\n API performs two basic functions: calls architecture and bsp specific setup and initializes the idle task of the OS. This is required before the OS is started. The OS start API initializes the OS time tick interrupt and starts the highest priority task running (i.e starts the scheduler). Note that \nos_start()
 \n never returns; once called the device is either running in an application task context or in idle task context.\n\n\nInitializing application modules and tasks can get somewhat complicated with RTOS's similar to Mynewt. Care must be taken that the API provided by a task are initialized prior to being called by another (higher priority) task. \n\n\nFor example, take a simple application with two tasks (tasks 1 and 2, with task 1 higher priority than task 2). Task 2 provides an API which has a semaphore lock and this semaphore is initialized by task 2 when the task handler for task 2 is called. Task 1 is expected to call this API.\n\n\nConsider the sequence of events when the OS is started. The scheduler starts running and picks the highest priority task (task 1 in this case). The task handler function for task 1 is called and will keep running until it yields execution. Before yielding, code in the task 1 handler function calls the API provided by task 2. The semaphore being acces
 sed in the task 2 API has yet to be initialized since the task 2 handler function has not had a chance to run! This will lead to undesirable behavior and will need to be addressed by the application developer. Note that the Mynewt OS does guard against internal API being called before the OS has started (they will return error) but it does not safeguard application defined objects from access prior to initialization.\n\n\nExample\n\n\nOne way to avoid initialization issues like the one described above is to perform task initializations prior to starting the OS. The code example shown below illustrates this concept. The application initializes the OS, calls an application specific \"task initialization\" function, and then starts the OS. The application task initialization function is responsible for initializing all the data objects that each task exposes to the other tasks. The tasks themselves are also initialized at this time (by calling \nos_task_init()\n). \n\n\nIn the example,
  each task works in a ping-pong like fashion: task 1 wakes up, adds a token to semaphore 1 and then waits for a token from semaphore 2. Task 2 waits for a token on semaphore 1 and once it gets it, adds a token to semaphore 2. Notice that the semaphores are initialized by the application specific task initialization functions and not inside the task handler functions. If task 2 (being lower in priority than task 1) had called os_sem_init() for task2_sem inside task2_handler(), task 1 would have called os_sem_pend() using task2_sem before task2_sem was initialized.\n\n\n/* Task 1 handler function */\nvoid\ntask1_handler(void *arg)\n{\n    while (1) {\n        /* Release semaphore to task 2 */\n        os_sem_release(\ntask1_sem);\n\n        /* Wait for semaphore from task 2 */\n        os_sem_pend(\ntask2_sem, OS_TIMEOUT_NEVER);\n    }\n}\n\n/* Task 2 handler function */\nvoid\ntask2_handler(void *arg)\n{\n    struct os_task *t;\n\n    while (1) {\n        /* Wait for semaphore from t
 ask1 */\n        os_sem_pend(\ntask1_sem, OS_TIMEOUT_NEVER);\n\n        /* Release task2 semaphore */\n        os_sem_release(\ntask2_sem);\n    }\n}\n\n\n/* Initialize task 1 exposed data objects */\nvoid\ntask1_init(void)\n{\n    /* Initialize task1 semaphore */\n    os_sem_init(\ntask1_sem, 0);\n}\n\n/* Initialize task 2 exposed data objects */\nvoid\ntask2_init(void)\n{\n  

<TRUNCATED>


[2/4] incubator-mynewt-site git commit: added syntax highlighting to os_core docs

Posted by ad...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/newt/newt_linux/index.html
----------------------------------------------------------------------
diff --git a/newt/newt_linux/index.html b/newt/newt_linux/index.html
index a367f75..ae8950e 100644
--- a/newt/newt_linux/index.html
+++ b/newt/newt_linux/index.html
@@ -408,19 +408,19 @@
 <ul>
 <li>Download the <em>newt</em> tool repository by using Go to copy the directory (currently the ASF incubator directory). Be patient as it may take a minute or two. Check the directories installed.</li>
 </ul>
-<pre><code class="no-highlight">        $ go get git-wip-us.apache.org/repos/asf/incubator-mynewt-newt.git/newt
+<pre><code class="no-highlight">        $ go get mynewt.apache.org/newt/...
         $ ls
          bin    pkg    src
         $ ls src
-        git-wip-us.apache.org   github.com      gopkg.in
+        github.com      golang.org      gopkg.in     mynewt.apache.org
 </code></pre>
 
 <ul>
 <li>Check that newt is in place.</li>
 </ul>
-<pre><code class="no-highlight">        $ ls $GOPATH/src/git-wip-us.apache.org/repos/asf/incubator-mynewt-newt.git/newt 
-        Godeps          README.md       coding_style.txt    newt.go
-        LICENSE         cli             design.txt
+<pre><code class="no-highlight">        $ ls $GOPATH/src/mynewt.apache.org/newt
+        DISCLAIMER  NOTICE      newt        newtvm      viper
+        LICENSE     README.md   newtmgr     util        yaml
 </code></pre>
 
 <h4 id="3-build-the-newt-tool">3. Build the newt tool<a class="headerlink" href="#3-build-the-newt-tool" title="Permanent link">&para;</a></h4>

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/newt/newt_mac/index.html
----------------------------------------------------------------------
diff --git a/newt/newt_mac/index.html b/newt/newt_mac/index.html
index 7b64659..297420c 100644
--- a/newt/newt_mac/index.html
+++ b/newt/newt_mac/index.html
@@ -432,9 +432,9 @@
 <ul>
 <li>Check that newt.go is in place.</li>
 </ul>
-<pre><code class="no-highlight">        $ ls $GOPATH/src/git-wip-us.apache.org/repos/asf/incubator-mynewt-newt.git/newt  
-        Godeps          README.md       coding_style.txt    newt.go
-        LICENSE         cli             design.txt
+<pre><code class="no-highlight">        $ ls $GOPATH/src/mynewt.apache.org/newt
+        DISCLAIMER  NOTICE      newt        newtvm      viper
+        LICENSE     README.md   newtmgr     util        yaml
 </code></pre>
 
 <h4 id="4-build-the-newt-tool">4. Build the Newt tool<a class="headerlink" href="#4-build-the-newt-tool" title="Permanent link">&para;</a></h4>
@@ -443,7 +443,6 @@
 </ul>
 <pre><code class="no-highlight">        $ cd $GOPATH/src/mynewt.apache.org/newt/newt
         $ go install
-        $
         $ ls &quot;$GOPATH&quot;/bin/
         newt newtmgr newtvm
 </code></pre>

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/callout/callout/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/callout/callout/index.html b/os/core_os/callout/callout/index.html
index 5cee161..93f8824 100644
--- a/os/core_os/callout/callout/index.html
+++ b/os/core_os/callout/callout/index.html
@@ -691,14 +691,13 @@
 <p>Time unit when arming the timer is OS ticks. This rate of this ticker depends on the platform this is running on. You should use OS define <em>OS_TICKS_PER_SEC</em> to convert wallclock time to OS  ticks.</p>
 <p>Callout timer fires out just once. For periodic timer type of operation you need to rearm it once it fires.</p>
 <h3 id="data-structures">Data structures<a class="headerlink" href="#data-structures" title="Permanent link">&para;</a></h3>
-<pre><code class="no-highlight">struct os_callout {
+<pre><code>struct os_callout {
     struct os_event c_ev;
     struct os_eventq *c_evq;
     uint32_t c_ticks;
     TAILQ_ENTRY(os_callout) c_next;
 };
 </code></pre>
-
 <table>
 <thead>
 <tr>
@@ -725,13 +724,12 @@
 </tr>
 </tbody>
 </table>
-<pre><code class="no-highlight">struct os_callout_func {
+<pre><code>struct os_callout_func {
     struct os_callout cf_c;
     os_callout_func_t cf_func;
     void *cf_arg;
 };
 </code></pre>
-
 <table>
 <thead>
 <tr>

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/callout/os_callout_func_init/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/callout/os_callout_func_init/index.html b/os/core_os/callout/os_callout_func_init/index.html
index 696c2cb..3e68ba2 100644
--- a/os/core_os/callout/os_callout_func_init/index.html
+++ b/os/core_os/callout/os_callout_func_init/index.html
@@ -737,9 +737,8 @@
                         </div>
                         
                             <h2 id="os_callout_func_init"><font color="#F2853F" style="font-size:24pt"> os_callout_func_init </font><a class="headerlink" href="#os_callout_func_init" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void os_callout_func_init(struct os_callout_func *cf, struct os_eventq *evq, os_callout_func_t timo_func, void *ev_arg)
+<pre><code>void os_callout_func_init(struct os_callout_func *cf, struct os_eventq *evq, os_callout_func_t timo_func, void *ev_arg)
 </code></pre>
-
 <p>Initializes the given <em>struct os_callout_func</em>. Data structure is filled in with elements given as argument.</p>
 <h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">&para;</a></h4>
 <table>
@@ -774,16 +773,15 @@
 <p>The same notes as with <em>os_callout_init()</em>.</p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">struct os_callout_func g_native_cputimer;
+<pre><code>struct os_callout_func g_native_cputimer;
 struct os_eventq g_native_cputime_evq;
 void native_cputimer_cb(void *arg);
 
     /* Initialize the callout function */
     os_callout_func_init(&amp;g_native_cputimer,
-                         &amp;g_native_cputime_evq,
-                         native_cputimer_cb,
-                         NULL);
-
+                     &amp;g_native_cputime_evq,
+                     native_cputimer_cb,
+                     NULL);
 </code></pre>
                         
                         <div class="row">

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/callout/os_callout_init/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/callout/os_callout_init/index.html b/os/core_os/callout/os_callout_init/index.html
index 0dde7ee..a607269 100644
--- a/os/core_os/callout/os_callout_init/index.html
+++ b/os/core_os/callout/os_callout_init/index.html
@@ -737,9 +737,8 @@
                         </div>
                         
                             <h2 id="os_callout_init"><font color="#F2853F" style="font-size:24pt">os_callout_init </font><a class="headerlink" href="#os_callout_init" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void os_callout_init(struct os_callout *c, struct os_eventq *evq, void *ev_arg)
+<pre><code>void os_callout_init(struct os_callout *c, struct os_eventq *evq, void *ev_arg)
 </code></pre>
-
 <p>Initializes <em>struct os_callout</em>. Event type will be set to <em>OS_EVENT_T_TIMER</em>.</p>
 <h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">&para;</a></h4>
 <table>
@@ -771,12 +770,12 @@
 Or if the timer has already fired, it will mess up the event queue where the callout was delivered to.</p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">struct os_eventq my_evq;
+<pre><code>struct os_eventq my_evq;
 struct os_callout my_callouts[8];
 
     for (i = 0; i &lt; 8; i++) {
         os_callout_init(&amp;my_callouts[i], &amp;my_evq, (void *)i);
-    }
+}
 </code></pre>
                         
                         <div class="row">

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/callout/os_callout_queued/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/callout/os_callout_queued/index.html b/os/core_os/callout/os_callout_queued/index.html
index 0e84abf..a99c3f2 100644
--- a/os/core_os/callout/os_callout_queued/index.html
+++ b/os/core_os/callout/os_callout_queued/index.html
@@ -737,9 +737,8 @@
                         </div>
                         
                             <h2 id="os_callout_queued"><font color="#F2853F" style="font-size:24pt">os_callout_queued</font><a class="headerlink" href="#os_callout_queued" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int os_callout_queued(struct os_callout *c)
+<pre><code>int os_callout_queued(struct os_callout *c)
 </code></pre>
-
 <p>Tells whether the callout has been armed or not.</p>
 <h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">&para;</a></h4>
 <table>
@@ -759,11 +758,6 @@
 <h4 id="returned-values">Returned values<a class="headerlink" href="#returned-values" title="Permanent link">&para;</a></h4>
 <p>0: timer is not armed
 non-zero: timer is armed</p>
-<h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">&para;</a></h4>
-<h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">&lt;Insert the code snippet here&gt;
-</code></pre>
                         
                         <div class="row">
                             <footer>

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/callout/os_callout_reset/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/callout/os_callout_reset/index.html b/os/core_os/callout/os_callout_reset/index.html
index 2eaf22b..24864e1 100644
--- a/os/core_os/callout/os_callout_reset/index.html
+++ b/os/core_os/callout/os_callout_reset/index.html
@@ -737,9 +737,8 @@
                         </div>
                         
                             <h2 id="os_callout_reset"><font color="#F2853F" style="font-size:24pt"> os_callout_reset </font><a class="headerlink" href="#os_callout_reset" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void os_callout_reset(struct os_callout *c, int32_t timo)
+<pre><code>void os_callout_reset(struct os_callout *c, int32_t timo)
 </code></pre>
-
 <p>Resets the callout to happen <em>timo</em> in OS ticks.</p>
 <h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">&para;</a></h4>
 <table>
@@ -765,8 +764,8 @@
 <h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">&para;</a></h4>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">    /* Re-start the timer (run every 50 msecs) */
-    os_callout_reset(&amp;g_bletest_timer.cf_c, OS_TICKS_PER_SEC / 20);
+<pre><code>/* Re-start the timer (run every 50 msecs) */
+os_callout_reset(&amp;g_bletest_timer.cf_c, OS_TICKS_PER_SEC / 20);
 </code></pre>
                         
                         <div class="row">

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/callout/os_callout_stop/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/callout/os_callout_stop/index.html b/os/core_os/callout/os_callout_stop/index.html
index e9c26af..da7b8be 100644
--- a/os/core_os/callout/os_callout_stop/index.html
+++ b/os/core_os/callout/os_callout_stop/index.html
@@ -737,9 +737,8 @@
                         </div>
                         
                             <h2 id="os_callout_stop"><font color="#F2853F" style="font-size:24pt"> os_callout_stop </font><a class="headerlink" href="#os_callout_stop" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void os_callout_stop(struct os_callout *c)
+<pre><code>void os_callout_stop(struct os_callout *c)
 </code></pre>
-
 <p>Disarms a timer.</p>
 <h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">&para;</a></h4>
 <table>
@@ -758,10 +757,8 @@
 </table>
 <h4 id="returned-values">Returned values<a class="headerlink" href="#returned-values" title="Permanent link">&para;</a></h4>
 <p>N/A</p>
-<h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">&para;</a></h4>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">struct os_callout_func g_native_cputimer;
+<pre><code>struct os_callout_func g_native_cputimer;
 
      os_callout_stop(&amp;g_native_cputimer.cf_c);
 </code></pre>

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/context_switch/context_switch/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/context_switch/index.html b/os/core_os/context_switch/context_switch/index.html
index d5b7e37..c7845a1 100644
--- a/os/core_os/context_switch/context_switch/index.html
+++ b/os/core_os/context_switch/context_switch/index.html
@@ -691,7 +691,6 @@
 <p>Tasks which are either <em>running</em> or <em>ready to run</em> are kept in linked list <code>g_os_run_list</code>. This list is ordered by priority.</p>
 <p>Tasks which are <em>sleeping</em> are kept in linked list <code>g_os_sleep_list</code>.</p>
 <p>Scheduler has a CPU architecture specific component; this code is responsible for swapping in the task which should be <em>running</em>. This process is called context switch. During context switching the state of the CPU (e.g. registers) for the currently <em>running</em> task is stored and the new task is swapped in.</p>
-<h2 id="data-structures">Data structures<a class="headerlink" href="#data-structures" title="Permanent link">&para;</a></h2>
 <h2 id="list-of-functions">List of Functions<a class="headerlink" href="#list-of-functions" title="Permanent link">&para;</a></h2>
 <p>The functions available in context_switch are:</p>
 <ul>

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/context_switch/os_arch_ctx_sw/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_arch_ctx_sw/index.html b/os/core_os/context_switch/os_arch_ctx_sw/index.html
index ff96bf9..8780e77 100644
--- a/os/core_os/context_switch/os_arch_ctx_sw/index.html
+++ b/os/core_os/context_switch/os_arch_ctx_sw/index.html
@@ -797,9 +797,7 @@
                         </div>
                         
                             <h2 id="os_arch_ctx_sw"><font color="#F2853F" style="font-size:24pt"> os_arch_ctx_sw </font><a class="headerlink" href="#os_arch_ctx_sw" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void os_arch_ctx_sw(struct os_task *next_t)
-</code></pre>
-
+<p>void os_arch_ctx_sw(struct os_task *next_t)</p>
 <p>Change the state of task pointed by <em>next_t</em> to be <em>running</em>.</p>
 <h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">&para;</a></h4>
 <table>
@@ -822,23 +820,23 @@
 <p>This would get called from another task's context.</p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">void
-os_sched(struct os_task *next_t)
-{
-    os_sr_t sr;
+<pre><code class="c">void
+    os_sched(struct os_task *next_t)
+    {
+        os_sr_t sr;
 
-    OS_ENTER_CRITICAL(sr);
+        OS_ENTER_CRITICAL(sr);
 
-    if (!next_t) {
-        next_t = os_sched_next_task();
-    }
+        if (!next_t) {
+            next_t = os_sched_next_task();
+        }
 
-    if (next_t != g_current_task) {
-        os_arch_ctx_sw(next_t);
-    }
+        if (next_t != g_current_task) {
+            os_arch_ctx_sw(next_t);
+        }
 
-    OS_EXIT_CRITICAL(sr);
-}
+        OS_EXIT_CRITICAL(sr);
+    }
 </code></pre>
                         
                         <div class="row">

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/context_switch/os_sched/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_sched/index.html b/os/core_os/context_switch/os_sched/index.html
index b066394..f54f1f1 100644
--- a/os/core_os/context_switch/os_sched/index.html
+++ b/os/core_os/context_switch/os_sched/index.html
@@ -797,7 +797,7 @@
                         </div>
                         
                             <h2 id="os_sched"><font color="#F2853F" style="font-size:24pt"> os_sched </font><a class="headerlink" href="#os_sched" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void os_sched(struct os_task *next_t)
+<pre><code class="c">void os_sched(struct os_task *next_t)
 </code></pre>
 
 <p>Performs context switch if needed. If <em>next_t</em> is set, that task will be made <em>running</em>. If <em>next_t</em> is NULL, highest priority <em>ready to run</em> is swapped in. This function can be called when new tasks were made <em>ready to run</em> or if the current task is moved to <em>sleeping</em> state.</p>
@@ -823,7 +823,7 @@
 <p>Interrupts must be disabled when calling this.</p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">os_error_t
+<pre><code class="c">os_error_t
 os_mutex_release(struct os_mutex *mu)
 {
     ...

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/context_switch/os_sched_ctx_sw_hook/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_sched_ctx_sw_hook/index.html b/os/core_os/context_switch/os_sched_ctx_sw_hook/index.html
index b6cae67..19e485d 100644
--- a/os/core_os/context_switch/os_sched_ctx_sw_hook/index.html
+++ b/os/core_os/context_switch/os_sched_ctx_sw_hook/index.html
@@ -797,7 +797,7 @@
                         </div>
                         
                             <h2 id="os_sched_ctx_sw_hook"><font color="#F2853F" style="font-size:24pt"> os_sched_ctx_sw_hook </font><a class="headerlink" href="#os_sched_ctx_sw_hook" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void os_sched_ctx_sw_hook(struct os_task *next_t)
+<pre><code class="c">void os_sched_ctx_sw_hook(struct os_task *next_t)
 </code></pre>
 
 <p>Performs task accounting when context switching.</p>
@@ -809,7 +809,7 @@
 <h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">&para;</a></h4>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">void
+<pre><code class="c">void
 os_arch_ctx_sw(struct os_task *t)
 {
     os_sched_ctx_sw_hook(t);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/context_switch/os_sched_get_current_task/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_sched_get_current_task/index.html b/os/core_os/context_switch/os_sched_get_current_task/index.html
index 572d66a..e6d21ae 100644
--- a/os/core_os/context_switch/os_sched_get_current_task/index.html
+++ b/os/core_os/context_switch/os_sched_get_current_task/index.html
@@ -797,7 +797,7 @@
                         </div>
                         
                             <h2 id="os_sched_get_current_task"><font color="#F2853F" style="font-size:24pt"> os_sched_get_current_task </font><a class="headerlink" href="#os_sched_get_current_task" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">struct os_task *os_sched_get_current_task(void)
+<pre><code class="c">struct os_task *os_sched_get_current_task(void)
 </code></pre>
 
 <p>Returns the pointer to task which is currently <em>running</em>.</p>
@@ -808,7 +808,7 @@
 <h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">&para;</a></h4>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">void
+<pre><code class="c">void
 os_time_delay(int32_t osticks)
 {
     os_sr_t sr;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/context_switch/os_sched_insert/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_sched_insert/index.html b/os/core_os/context_switch/os_sched_insert/index.html
index 4f27542..e1849e5 100644
--- a/os/core_os/context_switch/os_sched_insert/index.html
+++ b/os/core_os/context_switch/os_sched_insert/index.html
@@ -797,7 +797,7 @@
                         </div>
                         
                             <h2 id="os_sched_insert"><font color="#F2853F" style="font-size:24pt"> os_sched_insert </font><a class="headerlink" href="#os_sched_insert" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">os_error_t
+<pre><code class="c">os_error_t
 os_sched_insert(struct os_task *t)
 </code></pre>
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/context_switch/os_sched_next_task/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_sched_next_task/index.html b/os/core_os/context_switch/os_sched_next_task/index.html
index 338280f..c85c28a 100644
--- a/os/core_os/context_switch/os_sched_next_task/index.html
+++ b/os/core_os/context_switch/os_sched_next_task/index.html
@@ -797,7 +797,7 @@
                         </div>
                         
                             <h2 id="os_sched_next_task"><font color="#F2853F" style="font-size:24pt"> os_sched_next_task </font><a class="headerlink" href="#os_sched_next_task" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">struct os_task *os_sched_next_task(void)
+<pre><code class="c">struct os_task *os_sched_next_task(void)
 </code></pre>
 
 <p>Returns the pointer to highest priority task from the list which are <em>ready to run</em>.</p>

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/context_switch/os_sched_os_timer_exp/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_sched_os_timer_exp/index.html b/os/core_os/context_switch/os_sched_os_timer_exp/index.html
index b9c994d..d0def16 100644
--- a/os/core_os/context_switch/os_sched_os_timer_exp/index.html
+++ b/os/core_os/context_switch/os_sched_os_timer_exp/index.html
@@ -797,7 +797,7 @@
                         </div>
                         
                             <h2 id="os_sched_os_timer_exp"><font color="#F2853F" style="font-size:24pt"> os_sched_os_timer_exp </font><a class="headerlink" href="#os_sched_os_timer_exp" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void os_sched_os_timer_exp(void)
+<pre><code class="c">void os_sched_os_timer_exp(void)
 </code></pre>
 
 <p>Inform scheduler that OS time has moved forward, and it should inspect tasks which are <em>sleeping</em> to check whether they should be moved to <em>g_run_list</em> or not.</p>
@@ -809,7 +809,7 @@
 <h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">&para;</a></h4>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">void
+<pre><code class="c">void
 timer_handler(void)
 {
     os_time_tick();

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/context_switch/os_sched_resort/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_sched_resort/index.html b/os/core_os/context_switch/os_sched_resort/index.html
index de14802..4e18441 100644
--- a/os/core_os/context_switch/os_sched_resort/index.html
+++ b/os/core_os/context_switch/os_sched_resort/index.html
@@ -797,7 +797,7 @@
                         </div>
                         
                             <h2 id="os_sched_resort"><font color="#F2853F" style="font-size:24pt"> os_sched_resort </font><a class="headerlink" href="#os_sched_resort" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void os_sched_resort(struct os_task *t)
+<pre><code class="c">void os_sched_resort(struct os_task *t)
 </code></pre>
 
 <p>Inform scheduler that the priority of the task <em>t</em> has changed (e.g. in order to avoid priority inversion), and the <em>ready to run</em> list should be re-sorted.</p>
@@ -822,7 +822,7 @@
 <p><em>t</em> must be <em>ready to run</em> before calling this.</p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">os_error_t
+<pre><code class="c">os_error_t
 os_mutex_pend(struct os_mutex *mu, uint32_t timeout)
 {
     ....

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/context_switch/os_sched_set_current_task/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_sched_set_current_task/index.html b/os/core_os/context_switch/os_sched_set_current_task/index.html
index deda51c..4692e6e 100644
--- a/os/core_os/context_switch/os_sched_set_current_task/index.html
+++ b/os/core_os/context_switch/os_sched_set_current_task/index.html
@@ -797,7 +797,7 @@
                         </div>
                         
                             <h2 id="os_sched_set_current_task"><font color="#F2853F" style="font-size:24pt"> os_sched_set_current_task </font><a class="headerlink" href="#os_sched_set_current_task" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void 
+<pre><code class="c">void 
 os_sched_set_current_task(struct os_task *t)
 </code></pre>
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/context_switch/os_sched_sleep/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_sched_sleep/index.html b/os/core_os/context_switch/os_sched_sleep/index.html
index 197085a..14d66b5 100644
--- a/os/core_os/context_switch/os_sched_sleep/index.html
+++ b/os/core_os/context_switch/os_sched_sleep/index.html
@@ -797,7 +797,7 @@
                         </div>
                         
                             <h2 id="os_sched_sleep"><font color="#F2853F" style="font-size:24pt"> os_sched_sleep </font><a class="headerlink" href="#os_sched_sleep" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int
+<pre><code class="c">int
 os_sched_sleep(struct os_task *t, os_time_t nticks)
 </code></pre>
 
@@ -829,7 +829,7 @@ os_sched_sleep(struct os_task *t, os_time_t nticks)
 <p>Must be called with interrupts disabled.</p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">struct os_event *
+<pre><code class="c">struct os_event *
 os_eventq_get(struct os_eventq *evq)
 {
     struct os_event *ev;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/context_switch/os_sched_wakeup/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_sched_wakeup/index.html b/os/core_os/context_switch/os_sched_wakeup/index.html
index f0df8ab..007ec85 100644
--- a/os/core_os/context_switch/os_sched_wakeup/index.html
+++ b/os/core_os/context_switch/os_sched_wakeup/index.html
@@ -797,7 +797,7 @@
                         </div>
                         
                             <h2 id="os_sched_wakeup"><font color="#F2853F" style="font-size:24pt"> os_sched_wakeup </font><a class="headerlink" href="#os_sched_wakeup" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int
+<pre><code class="c">int
 os_sched_wakeup(struct os_task *t)
 </code></pre>
 
@@ -822,7 +822,7 @@ os_sched_wakeup(struct os_task *t)
 <h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">&para;</a></h4>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">void
+<pre><code class="c">void
 os_eventq_put(struct os_eventq *evq, struct os_event *ev)
 {
     ....

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/event_queue/event_queue/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/event_queue/event_queue/index.html b/os/core_os/event_queue/event_queue/index.html
index 5573d25..aefe2b8 100644
--- a/os/core_os/event_queue/event_queue/index.html
+++ b/os/core_os/event_queue/event_queue/index.html
@@ -693,7 +693,7 @@ Processing task would then act according to event type.</p>
 <p>It is assumed that there is only one task consuming events from an event queue. Only one task should be sleeping on a particular <em>os_eventq</em> at a time.</p>
 <p>Note that os_callout subsystem assumes that event queue is used as the wakeup mechanism.</p>
 <h3 id="data-structures">Data structures<a class="headerlink" href="#data-structures" title="Permanent link">&para;</a></h3>
-<pre><code class="no-highlight">struct os_event {
+<pre><code class="c">struct os_event {
     uint8_t ev_queued;
     uint8_t ev_type;
     void *ev_arg;
@@ -727,7 +727,7 @@ Processing task would then act according to event type.</p>
 </tr>
 </tbody>
 </table>
-<pre><code class="no-highlight">struct os_eventq {
+<pre><code class="c">struct os_eventq {
     struct os_task *evq_task;
     STAILQ_HEAD(, os_event) evq_list;
 };

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/event_queue/os_eventq_get/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/event_queue/os_eventq_get/index.html b/os/core_os/event_queue/os_eventq_get/index.html
index 9682416..cafb621 100644
--- a/os/core_os/event_queue/os_eventq_get/index.html
+++ b/os/core_os/event_queue/os_eventq_get/index.html
@@ -727,7 +727,7 @@
                         </div>
                         
                             <h2 id="os_eventq_get"><font color="#F2853F" style="font-size:24pt"> os_eventq_get</font><a class="headerlink" href="#os_eventq_get" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void
+<pre><code class="c">void
 os_eventq_get(struct os_eventq *evq)
 </code></pre>
 
@@ -752,7 +752,7 @@ os_eventq_get(struct os_eventq *evq)
 <h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">&para;</a></h4>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p>Main loop of an example task.</p>
-<pre><code class="no-highlight">    while (1) {
+<pre><code class="c">    while (1) {
         ev = os_eventq_get(&amp;task1_evq);
         assert(ev);
         if (ev-&gt;ev_type == CONS_EV_TYPE) {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/event_queue/os_eventq_init/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/event_queue/os_eventq_init/index.html b/os/core_os/event_queue/os_eventq_init/index.html
index 2ec4d09..b864e83 100644
--- a/os/core_os/event_queue/os_eventq_init/index.html
+++ b/os/core_os/event_queue/os_eventq_init/index.html
@@ -727,7 +727,7 @@
                         </div>
                         
                             <h2 id="os_eventq_init"><font color="F2853F" style="font-size:24pt"> os_eventq_init</font><a class="headerlink" href="#os_eventq_init" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">   void
+<pre><code class="c">   void
     os_eventq_init(struct os_eventq *evq)
 </code></pre>
 
@@ -754,7 +754,7 @@
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here>
 This initializes event queue used by newtmgr task.</p>
-<pre><code class="no-highlight">struct os_eventq g_nmgr_evq;
+<pre><code class="c">struct os_eventq g_nmgr_evq;
 
 int
 nmgr_task_init(uint8_t prio, os_stack_t *stack_ptr, uint16_t stack_len)

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/event_queue/os_eventq_put/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/event_queue/os_eventq_put/index.html b/os/core_os/event_queue/os_eventq_put/index.html
index 7a01184..07bd755 100644
--- a/os/core_os/event_queue/os_eventq_put/index.html
+++ b/os/core_os/event_queue/os_eventq_put/index.html
@@ -727,7 +727,7 @@
                         </div>
                         
                             <h2 id="os_eventq_put"><font color="#F2853F" style="font-size:24pt"> os_eventq_put</font><a class="headerlink" href="#os_eventq_put" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void
+<pre><code class="c">void
 os_eventq_put(struct os_eventq *evq, struct os_event *ev)
 </code></pre>
 
@@ -756,7 +756,7 @@ os_eventq_put(struct os_eventq *evq, struct os_event *ev)
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here>
 This is used to pass info about an event to a task handling it.</p>
-<pre><code class="no-highlight">    /* Get an event structure off the queue */
+<pre><code class="c">    /* Get an event structure off the queue */
     ev = (struct os_event *)os_memblock_get(&amp;g_hci_os_event_pool);
     if (!ev) {
         err = os_memblock_put(&amp;g_hci_cmd_pool, hci_ev);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/event_queue/os_eventq_remove/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/event_queue/os_eventq_remove/index.html b/os/core_os/event_queue/os_eventq_remove/index.html
index e2ab1cb..197bb7b 100644
--- a/os/core_os/event_queue/os_eventq_remove/index.html
+++ b/os/core_os/event_queue/os_eventq_remove/index.html
@@ -727,7 +727,7 @@
                         </div>
                         
                             <h2 id="os_eventq_remove"><font color="#F2853F" style="font-size:24pt"> os_eventq_remove</font><a class="headerlink" href="#os_eventq_remove" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void
+<pre><code class="c">void
 os_eventq_remove(struct os_eventq *evq, struct os_event *ev)
 </code></pre>
 
@@ -757,7 +757,7 @@ os_eventq_remove(struct os_eventq *evq, struct os_event *ev)
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here>
 This is from os_callout_stop(). User wants to stop a callout from getting passed to a task. If the event has already been queued, then remove it before it is seen.</p>
-<pre><code class="no-highlight">    if (c-&gt;c_evq) {
+<pre><code class="c">    if (c-&gt;c_evq) {
         os_eventq_remove(c-&gt;c_evq, &amp;c-&gt;c_ev);
     }
 </code></pre>

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/heap/os_free/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/heap/os_free/index.html b/os/core_os/heap/os_free/index.html
index 7531cfe..5e59a80 100644
--- a/os/core_os/heap/os_free/index.html
+++ b/os/core_os/heap/os_free/index.html
@@ -717,7 +717,7 @@
                         </div>
                         
                             <h2 id="os_free"><font color="F2853F" style="font-size:24pt">os_free</font><a class="headerlink" href="#os_free" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void os_free(void *mem)
+<pre><code class="c">void os_free(void *mem)
 </code></pre>
 
 <p>Frees previously allocated memory back to the heap.</p>
@@ -742,7 +742,7 @@
 <p>Calls C-library <em>free()</em> behind the covers.</p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">   os_free(info);
+<pre><code class="c">   os_free(info);
 </code></pre>
                         
                         <div class="row">

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/heap/os_malloc/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/heap/os_malloc/index.html b/os/core_os/heap/os_malloc/index.html
index 0e12eed..6a22043 100644
--- a/os/core_os/heap/os_malloc/index.html
+++ b/os/core_os/heap/os_malloc/index.html
@@ -717,7 +717,7 @@
                         </div>
                         
                             <h2 id="os_malloc"><font color="F2853F" style="font-size:24pt"> os_malloc</font><a class="headerlink" href="#os_malloc" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void *os_malloc(size_t size)
+<pre><code class="c">void *os_malloc(size_t size)
 </code></pre>
 
 <p>Allocates <em>size</em> number of bytes from heap and returns a pointer to it.</p>
@@ -744,7 +744,7 @@ NULL: not enough memory available.</p>
 Depending on which C-library you use, you might have to do the heap setup differently. Most often <em>malloc()</em> implementation will maintain a list of allocated and then freed memory blocks. If user asks for memory which cannot be satisfied from free list, they'll call platform's <em>sbrk()</em>, which then tries to grow the heap.</p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">    info = (struct os_task_info *) os_malloc(
+<pre><code class="c">    info = (struct os_task_info *) os_malloc(
             sizeof(struct os_task_info) * tcount);
     if (!info) {
         rc = -1;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/heap/os_realloc/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/heap/os_realloc/index.html b/os/core_os/heap/os_realloc/index.html
index 51f647b..020c8f8 100644
--- a/os/core_os/heap/os_realloc/index.html
+++ b/os/core_os/heap/os_realloc/index.html
@@ -717,7 +717,7 @@
                         </div>
                         
                             <h2 id="os_realloc"><font color="F2853F" style="font-size:24pt">os_realloc</font><a class="headerlink" href="#os_realloc" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void *os_realloc(void *ptr, size_t size)
+<pre><code class="c">void *os_realloc(void *ptr, size_t size)
 </code></pre>
 
 <p>Tries to resize previously allocated memory block, and returns pointer to resized memory.
@@ -747,7 +747,7 @@ ptr: pointer to new start of memory block</p>
 <h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">&para;</a></h4>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">&lt;Insert the code snippet here&gt;
+<pre><code class="c">&lt;Insert the code snippet here&gt;
 </code></pre>
                         
                         <div class="row">

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/OS_MBUF_DATA/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/OS_MBUF_DATA/index.html b/os/core_os/mbuf/OS_MBUF_DATA/index.html
index ccfa8be..1a2746c 100644
--- a/os/core_os/mbuf/OS_MBUF_DATA/index.html
+++ b/os/core_os/mbuf/OS_MBUF_DATA/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_data"><font color="#F2853F" style="font-size:24pt">OS_MBUF_DATA</font><a class="headerlink" href="#os_mbuf_data" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">OS_MBUF_DATA(__om, __type)
+<pre><code class="c">OS_MBUF_DATA(__om, __type)
 </code></pre>
 
 <p>Macro used to cast the data pointer of an mbuf to a given type.</p>
@@ -980,7 +980,7 @@
 </table>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    struct os_mbuf *om
+<pre><code class="c">    struct os_mbuf *om
     uint8_t *rxbuf;
 
     rxbuf = OS_MBUF_DATA(om, uint8_t *);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/OS_MBUF_LEADINGSPACE/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/OS_MBUF_LEADINGSPACE/index.html b/os/core_os/mbuf/OS_MBUF_LEADINGSPACE/index.html
index 291f914..86e8465 100644
--- a/os/core_os/mbuf/OS_MBUF_LEADINGSPACE/index.html
+++ b/os/core_os/mbuf/OS_MBUF_LEADINGSPACE/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_leadingspace"><font color="#F2853F" style="font-size:24pt">OS_MBUF_LEADINGSPACE</font><a class="headerlink" href="#os_mbuf_leadingspace" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">OS_MBUF_LEADINGSPACE(__om)
+<pre><code class="c">OS_MBUF_LEADINGSPACE(__om)
 </code></pre>
 
 <p>Macro used to get the amount of leading space in an mbuf (in bytes).</p>
@@ -979,7 +979,7 @@
 <p>This macro works on both normal mbufs and packet header mbufs. The amount of leading space is the number of bytes between the current om_data pointer of the mbuf and the start of the mbuf user data buffer.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    uint8_t *dptr;
+<pre><code class="c">    uint8_t *dptr;
     uint16_t space;
     struct os_mbuf *om;
     struct my_data_struct my_data;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/OS_MBUF_PKTHDR/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/OS_MBUF_PKTHDR/index.html b/os/core_os/mbuf/OS_MBUF_PKTHDR/index.html
index a37ff90..a91f76d 100644
--- a/os/core_os/mbuf/OS_MBUF_PKTHDR/index.html
+++ b/os/core_os/mbuf/OS_MBUF_PKTHDR/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_pkthdr"><font color="#F2853F" style="font-size:24pt">OS_MBUF_PKTHDR</font><a class="headerlink" href="#os_mbuf_pkthdr" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">OS_MBUF_PKTHDR(__om)
+<pre><code class="c">OS_MBUF_PKTHDR(__om)
 </code></pre>
 
 <p>Macro used to get a pointer to the os mbuf packet header of an mbuf.</p>
@@ -976,7 +976,7 @@
 </table>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">int
+<pre><code class="c">int
 does_packet_have_data(struct os_mbuf *om)
 {
     struct os_mbuf_pkthdr *hdr;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/OS_MBUF_PKTHDR_TO_MBUF/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/OS_MBUF_PKTHDR_TO_MBUF/index.html b/os/core_os/mbuf/OS_MBUF_PKTHDR_TO_MBUF/index.html
index d2708b2..7a752e2 100644
--- a/os/core_os/mbuf/OS_MBUF_PKTHDR_TO_MBUF/index.html
+++ b/os/core_os/mbuf/OS_MBUF_PKTHDR_TO_MBUF/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_pkthdr_to_mbuf"><font color="#F2853F" style="font-size:24pt">OS_MBUF_PKTHDR_TO_MBUF</font><a class="headerlink" href="#os_mbuf_pkthdr_to_mbuf" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">OS_MBUF_PKTHDR_TO_MBUF(__hdr)
+<pre><code class="c">OS_MBUF_PKTHDR_TO_MBUF(__hdr)
 </code></pre>
 
 <p>Macro used to get a pointer to the mbuf given a pointer to the os mbuf packet header</p>
@@ -976,7 +976,7 @@
 </table>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    struct os_mbuf *om;
+<pre><code class="c">    struct os_mbuf *om;
     struct os_mbuf_pkthdr *hdr;
 
     om = OS_MBUF_PKTHDR_TO_MBUF(hdr);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/OS_MBUF_PKTLEN/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/OS_MBUF_PKTLEN/index.html b/os/core_os/mbuf/OS_MBUF_PKTLEN/index.html
index 56a3436..a79553d 100644
--- a/os/core_os/mbuf/OS_MBUF_PKTLEN/index.html
+++ b/os/core_os/mbuf/OS_MBUF_PKTLEN/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_pktlen"><font color="#F2853F" style="font-size:24pt">OS_MBUF_PKTLEN</font><a class="headerlink" href="#os_mbuf_pktlen" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">OS_MBUF_PKTLEN(__om)
+<pre><code class="c">OS_MBUF_PKTLEN(__om)
 </code></pre>
 
 <p>Macro used to get the length of an entire mbuf chain.</p>
@@ -976,7 +976,7 @@
 </table>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    uint16_t pktlen;
+<pre><code class="c">    uint16_t pktlen;
     struct os_mbuf *om;
 
     /* Check if there is any data in the mbuf chain */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/OS_MBUF_TRAILINGSPACE/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/OS_MBUF_TRAILINGSPACE/index.html b/os/core_os/mbuf/OS_MBUF_TRAILINGSPACE/index.html
index 499c06a..f18ea80 100644
--- a/os/core_os/mbuf/OS_MBUF_TRAILINGSPACE/index.html
+++ b/os/core_os/mbuf/OS_MBUF_TRAILINGSPACE/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_trailingspace"><font color="#F2853F" style="font-size:24pt">OS_MBUF_TRAILINGSPACE</font><a class="headerlink" href="#os_mbuf_trailingspace" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">OS_MBUF_TRAILINGSPACE(__om)
+<pre><code class="c">OS_MBUF_TRAILINGSPACE(__om)
 </code></pre>
 
 <p>Macro used to get the amount of trailing space in an mbuf (in bytes).</p>
@@ -979,7 +979,7 @@
 <p>This macro works on both normal mbufs and packet header mbufs. The amount of trailing space is the number of bytes between the current om_data pointer of the mbuf and the end of the mbuf.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    uint16_t space;
+<pre><code class="c">    uint16_t space;
     struct os_mbuf *om;
     struct my_data_struct my_data;
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/OS_MBUF_USRHDR/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/OS_MBUF_USRHDR/index.html b/os/core_os/mbuf/OS_MBUF_USRHDR/index.html
index 6564d92..8708a39 100644
--- a/os/core_os/mbuf/OS_MBUF_USRHDR/index.html
+++ b/os/core_os/mbuf/OS_MBUF_USRHDR/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_usrhdr"><font color="#F2853F" style="font-size:24pt">OS_MBUF_USRHDR</font><a class="headerlink" href="#os_mbuf_usrhdr" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">OS_MBUF_USRHDR(__om)
+<pre><code class="c">OS_MBUF_USRHDR(__om)
 </code></pre>
 
 <p>Macro used to get a pointer to the user packet header of an mbuf.</p>
@@ -976,7 +976,7 @@
 </table>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    struct os_mbuf *om
+<pre><code class="c">    struct os_mbuf *om
     struct user_header *hdr;
 
     hdr = OS_MBUF_USRHDR(om);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/OS_MBUF_USRHDR_LEN/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/OS_MBUF_USRHDR_LEN/index.html b/os/core_os/mbuf/OS_MBUF_USRHDR_LEN/index.html
index 3df7298..6ad50a6 100644
--- a/os/core_os/mbuf/OS_MBUF_USRHDR_LEN/index.html
+++ b/os/core_os/mbuf/OS_MBUF_USRHDR_LEN/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_usrhdr_len"><font color="#F2853F" style="font-size:24pt">OS_MBUF_USRHDR_LEN</font><a class="headerlink" href="#os_mbuf_usrhdr_len" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">OS_MBUF_USRHDR_LEN(__om)
+<pre><code class="c">OS_MBUF_USRHDR_LEN(__om)
 </code></pre>
 
 <p>Macro used to retrieve the length of the user packet header in an mbuf.</p>
@@ -976,7 +976,7 @@
 </table>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    uint16_t user_length;
+<pre><code class="c">    uint16_t user_length;
     struct os_mbuf *om
     struct user_header *hdr;
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/mbuf/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/mbuf/index.html b/os/core_os/mbuf/mbuf/index.html
index 1adcbef..4f3f455 100644
--- a/os/core_os/mbuf/mbuf/index.html
+++ b/os/core_os/mbuf/mbuf/index.html
@@ -743,7 +743,7 @@
 <p>Mbufs are collected into "mbuf pools" much like memory blocks. The mbuf pool itself contains a pointer to a memory pool. The memory blocks in this memory pool are the actual mbufs; both normal and packet header mbufs. Thus, the memory block (and corresponding memory pool) must be sized correctly. In other words, the memory blocks which make up the memory pool used by the mbuf pool must be at least: sizeof(struct os_mbuf) + sizeof(struct os_mbuf_pkthdr) + sizeof(struct user_defined_header) + desired minimum data buffer length. For example, if the developer wants mbufs to contain at least 64 bytes of user data and they have a user header of 12 bytes, the size of the memory block would be (at least): 64 + 12 + 16 + 8, or 100 bytes. Yes, this is a fair amount of overhead. However, the flexibility provided by the mbuf library usually outweighs overhead concerns.</p>
 <h3 id="create-mbuf-pool">Create mbuf pool<a class="headerlink" href="#create-mbuf-pool" title="Permanent link">&para;</a></h3>
 <p>Creating an mbuf pool is fairly simple: create a memory pool and then create the mbuf pool using that memory pool. Once the developer has determined the size of the user data needed per mbuf (this is based on the application/networking stack and is outside the scope of this discussion) and the size of the user header (if any), the memory blocks can be sized. In the example shown below, the application requires 64 bytes of user data per mbuf and also allocates a user header (called struct user_hdr). Note that we do not show the user header data structure as there really is no need; all we need to do is to account for it when creating the memory pool. In the example, we use the macro <em>MBUF_PKTHDR_OVERHEAD</em> to denote the amount of packet header overhead per mbuf and <em>MBUF_MEMBLOCK_OVERHEAD</em> to denote the total amount of overhead required per memory block. The macro <em>MBUF_BUF_SIZE</em> is used to denote the amount of payload that the application requires (aligned on 
 a 32-bit boundary in this case). All this leads to the total memory block size required, denoted by the macro <em>MBUF_MEMBLOCK_OVERHEAD</em>.</p>
-<pre><code class="no-highlight">
+<pre><code class="c">
 #define MBUF_PKTHDR_OVERHEAD    sizeof(struct os_mbuf_pkthdr) + sizeof(struct user_hdr)
 #define MBUF_MEMBLOCK_OVERHEAD  sizeof(struct os_mbuf) + MBUF_PKTHDR_OVERHEAD
 
@@ -776,7 +776,7 @@ create_mbuf_pool(void)
 <h3 id="using-mbufs">Using mbufs<a class="headerlink" href="#using-mbufs" title="Permanent link">&para;</a></h3>
 <p>The following examples illustrate typical mbuf usage. There are two basic mbuf allocation API: <code>os_mbuf_get()</code> and <code>os_mbuf_get_pkthdr()</code>. The first API obtains a normal mbuf whereas the latter obtains a packet header mbuf. Typically, application developers use <code>os_mbuf_get_pkthdr()</code> and rarely, if ever, need to call <code>os_mbuf_get()</code> as the rest of the mbuf API (e.g. <code>os_mbuf_append()</code>, <code>os_mbuf_copyinto()</code>, etc.) typically deal with allocating and chaining mbufs. It is recommended to use the provided API to copy data into/out of mbuf chains and/or manipulate mbufs.</p>
 <p>In <code>example1</code>, the developer creates a packet and then sends the packet to a networking interface. The code sample also provides an example of copying data out of an mbuf as well as use of the "pullup" api (another very common mbuf api).</p>
-<pre><code class="no-highlight">
+<pre><code class="c">
 void
 mbuf_usage_example1(uint8_t *mydata, int mydata_length)
 {
@@ -807,7 +807,7 @@ mbuf_usage_example1(uint8_t *mydata, int mydata_length)
 <p>Another common pitfall occurs around endianness. A network protocol may be little endian or big endian; it all depends on the protocol specification. Processors also have an endianness; this means that the developer has to be careful that the processor endianness and the protocol endianness are handled correctly. In <code>example2</code>, some common networking functions are used: <code>ntohs()</code> and <code>ntohl()</code>. These are shorthand for "network order to host order, short" and "network order to host order, long". Basically, these functions convert data of a certain size (i.e. 16 bits, 32 bits, etc) to the endianness of the host. Network byte order is big-endian (most significant byte first), so these functions convert big-endian byte order to host order (thus, the implementation of these functions is host dependent). Note that the BLE networking stack "on the air" format is least signigicant byte first (i.e. little endian), so a "bletoh" function would have to take 
 little endian format and convert to host format.</p>
 <p>A long story short: the developer must take care when copying structure data to/from mbufs and flat buffers!</p>
 <p>A final note: these examples assume the same mbuf struture and definitions used in the first example. </p>
-<pre><code class="no-highlight">void
+<pre><code class="c">void
 mbuf_usage_example2(struct mbuf *rxpkt)
 {
     int rc;
@@ -848,7 +848,7 @@ mbuf_usage_example2(struct mbuf *rxpkt)
 
 <p><br></p>
 <h3 id="data-structures">Data Structures<a class="headerlink" href="#data-structures" title="Permanent link">&para;</a></h3>
-<pre><code class="no-highlight">struct os_mbuf_pool {
+<pre><code class="c">struct os_mbuf_pool {
     uint16_t omp_databuf_len;
     uint16_t omp_mbuf_count;
     struct os_mempool *omp_pool;
@@ -883,7 +883,7 @@ mbuf_usage_example2(struct mbuf *rxpkt)
 </tbody>
 </table>
 <p><br></p>
-<pre><code class="no-highlight">struct os_mbuf_pkthdr {
+<pre><code class="c">struct os_mbuf_pkthdr {
     uint16_t omp_len;
     uint16_t omp_flags;
     STAILQ_ENTRY(os_mbuf_pkthdr) omp_next;
@@ -913,7 +913,7 @@ mbuf_usage_example2(struct mbuf *rxpkt)
 </tbody>
 </table>
 <p><br></p>
-<pre><code class="no-highlight">struct os_mbuf {
+<pre><code class="c">struct os_mbuf {
     uint8_t *om_data;
     uint8_t om_flags;
     uint8_t om_pkthdr_len;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/os_mbuf_adj/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/os_mbuf_adj/index.html b/os/core_os/mbuf/os_mbuf_adj/index.html
index 3cd93f8..9f92f36 100644
--- a/os/core_os/mbuf/os_mbuf_adj/index.html
+++ b/os/core_os/mbuf/os_mbuf_adj/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_adj"><font color="#F2853F" style="font-size:24pt"> os_mbuf_adj</font><a class="headerlink" href="#os_mbuf_adj" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void os_mbuf_adj(struct os_mbuf *mp, int req_len);
+<pre><code class="c">void os_mbuf_adj(struct os_mbuf *mp, int req_len);
 </code></pre>
 
 <p>Trims <em>req_len</em> bytes from either the head (if positive) or tail (if negative) of an mbuf chain. Adjusts the packet length of the mbuf chain if <em>mp</em> points to a packet header mbuf. When trimming from the head, no mbufs are freed. When trimming from the tail, any mbufs of zero length left at the end of the chain are freed.</p>
@@ -983,7 +983,7 @@
 <p>None</p>
 <h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">&para;</a></h4>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    uint16_t pktlen;
+<pre><code class="c">    uint16_t pktlen;
     struct os_mbuf *om;
     struct my_pkt_header hdr;
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/os_mbuf_append/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/os_mbuf_append/index.html b/os/core_os/mbuf/os_mbuf_append/index.html
index 5b415ab..9c9c336 100644
--- a/os/core_os/mbuf/os_mbuf_append/index.html
+++ b/os/core_os/mbuf/os_mbuf_append/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_append"><font color="#F2853F" style="font-size:24pt"> os_mbuf_append</font><a class="headerlink" href="#os_mbuf_append" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int os_mbuf_append(struct os_mbuf *om, const void *data,  uint16_t len)
+<pre><code class="c">int os_mbuf_append(struct os_mbuf *om, const void *data,  uint16_t len)
 </code></pre>
 
 <p>Appends a data buffer of length <em>len</em> to the end of an mbuf chain, adjusting packet length if <em>om</em> is a packet header mbuf. If not enough trailing space exists at the end of the mbuf chain, mbufs are allocated to hold the data.</p>
@@ -994,7 +994,7 @@ OS_EINVAL: <em>om</em> was NULL on entry.</p>
 <p>If any mbufs are allocated, they are allocated from the same pool as <em>om</em></p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    int rc;
+<pre><code class="c">    int rc;
     uint16_t pktlen;
     struct os_mbuf *om;
     struct my_data_struct my_data;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/os_mbuf_concat/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/os_mbuf_concat/index.html b/os/core_os/mbuf/os_mbuf_concat/index.html
index ededbed..6247325 100644
--- a/os/core_os/mbuf/os_mbuf_concat/index.html
+++ b/os/core_os/mbuf/os_mbuf_concat/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_concat"><font color="#F2853F" style="font-size:24pt"> os_mbuf_concat</font><a class="headerlink" href="#os_mbuf_concat" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void os_mbuf_concat(struct os_mbuf *first, struct os_mbuf *second)
+<pre><code class="c">void os_mbuf_concat(struct os_mbuf *first, struct os_mbuf *second)
 </code></pre>
 
 <p>Attaches a second mbuf chain onto the end of the first. If the first chain contains a packet header, the header's length is updated.  If the second chain has a packet header, its header is cleared.</p>
@@ -986,7 +986,7 @@
 <p>No data is copied or moved nor are any mbufs freed.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    uint16_t pktlen1;
+<pre><code class="c">    uint16_t pktlen1;
     uint16_t pktlen2;
     struct os_mbuf *pkt1;
     struct os_mbuf *pkt2;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/os_mbuf_copydata/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/os_mbuf_copydata/index.html b/os/core_os/mbuf/os_mbuf_copydata/index.html
index d48b2d5..7e8df4e 100644
--- a/os/core_os/mbuf/os_mbuf_copydata/index.html
+++ b/os/core_os/mbuf/os_mbuf_copydata/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_copydata"><font color="#F2853F" style="font-size:24pt"> os_mbuf_copydata</font><a class="headerlink" href="#os_mbuf_copydata" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int os_mbuf_copydata(const struct os_mbuf *m, int off, int len, void *dst)
+<pre><code class="c">int os_mbuf_copydata(const struct os_mbuf *m, int off, int len, void *dst)
 </code></pre>
 
 <p>Copy data from an mbuf chain starting <em>off</em> bytes from the beginning, continuing for <em>len</em> bytes, into the indicated buffer.</p>
@@ -992,7 +992,7 @@
 -1: The mbuf does not contain enough data</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    int rc;
+<pre><code class="c">    int rc;
     struct os_mbuf *om;
     struct my_hdr_1 my_hdr1;    
     struct my_hdr_2 my_hdr2;    

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/os_mbuf_copyinto/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/os_mbuf_copyinto/index.html b/os/core_os/mbuf/os_mbuf_copyinto/index.html
index 132625f..dae2e55 100644
--- a/os/core_os/mbuf/os_mbuf_copyinto/index.html
+++ b/os/core_os/mbuf/os_mbuf_copyinto/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_copyinto"><font color="#F2853F" style="font-size:24pt"> os_mbuf_copyinto</font><a class="headerlink" href="#os_mbuf_copyinto" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int os_mbuf_copyinto(struct os_mbuf *om, int off, const void *src, int len);
+<pre><code class="c">int os_mbuf_copyinto(struct os_mbuf *om, int off, const void *src, int len);
 </code></pre>
 
 <p>Copies the contents of a flat buffer into an mbuf chain, starting at the specified destination offset.  If the mbuf is too small for the source data, it is extended as necessary.  If the destination mbuf contains a packet header, the header length is updated.</p>
@@ -992,7 +992,7 @@
 All other values indicate an error.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    int rc;
+<pre><code class="c">    int rc;
     uint16_t pktlen;
     struct os_mbuf *om;
     struct my_data_struct my_data;  

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/os_mbuf_dup/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/os_mbuf_dup/index.html b/os/core_os/mbuf/os_mbuf_dup/index.html
index 79473aa..824e3d2 100644
--- a/os/core_os/mbuf/os_mbuf_dup/index.html
+++ b/os/core_os/mbuf/os_mbuf_dup/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_dup"><font color="#F2853F" style="font-size:24pt"> os_mbuf_dup</font><a class="headerlink" href="#os_mbuf_dup" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">struct os_mbuf *os_mbuf_dup(struct os_mbuf *om)
+<pre><code class="c">struct os_mbuf *os_mbuf_dup(struct os_mbuf *om)
 </code></pre>
 
 <p>Duplicate a chain of mbufs.  Return the start of the duplicated chain.</p>
@@ -979,7 +979,7 @@
 <p>Pointer to the duplicated chain or NULL if not enough mbufs were available to duplicate the chain.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    struct os_mbuf *om;
+<pre><code class="c">    struct os_mbuf *om;
     struct os_mbuf *new_om;
 
     /* Make a copy of om, returning -1 if not able to duplicate om */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/os_mbuf_extend/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/os_mbuf_extend/index.html b/os/core_os/mbuf/os_mbuf_extend/index.html
index 302ef8a..f2d3687 100644
--- a/os/core_os/mbuf/os_mbuf_extend/index.html
+++ b/os/core_os/mbuf/os_mbuf_extend/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_extend"><font color="#F2853F" style="font-size:24pt"> os_mbuf_extend</font><a class="headerlink" href="#os_mbuf_extend" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void *os_mbuf_extend(struct os_mbuf *om, uint16_t len);
+<pre><code class="c">void *os_mbuf_extend(struct os_mbuf *om, uint16_t len);
 </code></pre>
 
 <p>Increases the length of an mbuf chain by the specified amount.  If there is not sufficient room in the last buffer, a new buffer is allocated and appended to the chain.  It is an error to request more data than can fit in a single buffer.</p>
@@ -984,7 +984,7 @@
 <p>Returns NULL if extension fails due to insufficient mbufs or <em>len</em> too large.
 <br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    uint8_t *dptr;
+<pre><code class="c">    uint8_t *dptr;
     struct os_mbuf *om;
     struct my_data_struct my_data;  
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/os_mbuf_free_chain/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/os_mbuf_free_chain/index.html b/os/core_os/mbuf/os_mbuf_free_chain/index.html
index 3709595..138deb5 100644
--- a/os/core_os/mbuf/os_mbuf_free_chain/index.html
+++ b/os/core_os/mbuf/os_mbuf_free_chain/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_free_chain"><font color="#F2853F" style="font-size:24pt"> os_mbuf_free_chain</font><a class="headerlink" href="#os_mbuf_free_chain" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int os_mbuf_free_chain(struct os_mbuf *om);
+<pre><code class="c">int os_mbuf_free_chain(struct os_mbuf *om);
 </code></pre>
 
 <p>Frees a chain of mbufs</p>
@@ -983,7 +983,7 @@ Any other value indicates error</p>
 <p>Note that for each mbuf in the chain, <code>os_mbuf_free()</code> is called.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    int rc;
+<pre><code class="c">    int rc;
     struct os_mbuf *om;
 
     /* Free mbuf chain */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/os_mbuf_get/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/os_mbuf_get/index.html b/os/core_os/mbuf/os_mbuf_get/index.html
index ce6c90e..e5aa36a 100644
--- a/os/core_os/mbuf/os_mbuf_get/index.html
+++ b/os/core_os/mbuf/os_mbuf_get/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_get"><font color="#F2853F" style="font-size:24pt">os_mbuf_get</font><a class="headerlink" href="#os_mbuf_get" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">struct os_mbuf *os_mbuf_get(struct os_mbuf_pool *omp, uint16_t leadingspace)
+<pre><code class="c">struct os_mbuf *os_mbuf_get(struct os_mbuf_pool *omp, uint16_t leadingspace)
 </code></pre>
 
 <p>Get an mbuf from the mbuf pool. The mbuf is allocated, and initialized prior to being returned. The <em>leadingspace</em> parameter allows the user to specify the amount of leading space in the allocated mbuf.</p>
@@ -986,7 +986,7 @@
 <p>In most typical applications, the application developer does not need to call <code>os_mbuf_get()</code>; the other API will do this automatically. However, this API is provided for convenience as mbufs can also be a simple way to allocate temporary chunks of memory.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    struct os_mbuf *om;
+<pre><code class="c">    struct os_mbuf *om;
 
     /* Get an mbuf */
     om = os_mbuf_get(&amp;g_mbuf_pool, 0);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/os_mbuf_get_pkthdr/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/os_mbuf_get_pkthdr/index.html b/os/core_os/mbuf/os_mbuf_get_pkthdr/index.html
index d073948..c47d6f2 100644
--- a/os/core_os/mbuf/os_mbuf_get_pkthdr/index.html
+++ b/os/core_os/mbuf/os_mbuf_get_pkthdr/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_get_pkthdr"><font color="#F2853F" style="font-size:24pt">os_mbuf_get_pkthdr</font><a class="headerlink" href="#os_mbuf_get_pkthdr" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">struct os_mbuf *os_mbuf_get_pkthdr(struct os_mbuf_pool *omp, uint8_t pkthdr_len);
+<pre><code class="c">struct os_mbuf *os_mbuf_get_pkthdr(struct os_mbuf_pool *omp, uint8_t pkthdr_len);
 </code></pre>
 
 <p>Allocates a packet header mbuf from the mbuf pool pointed to by <em>omp</em>. Adds a user header of length <em>pkthdr_len</em> to packet header mbuf.</p>
@@ -986,7 +986,7 @@
 <p>The packet header mbuf returned will have its data pointer incremented by the sizeof(struct os_mbuf_pkthdr) as well as the amount of user header data (i.e. <em>pkthdr_len</em>). In other words, the data pointer is offset from the start of the mbuf by: sizeof(struct os_mbuf) + sizeof(struct os_mbuf_pkthdr) + pkthdr_len. The <code>om_pkthdr_len</code> element in the allocated mbuf is set to: sizeof(struct os_mbuf_pkthdr) + pkthdr_len.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    struct os_mbuf *om;
+<pre><code class="c">    struct os_mbuf *om;
     struct my_user_header my_hdr;
 
     /* Get a packet header mbuf with a user header in it */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/os_mbuf_memcmp/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/os_mbuf_memcmp/index.html b/os/core_os/mbuf/os_mbuf_memcmp/index.html
index ca012dc..9a7c6d1 100644
--- a/os/core_os/mbuf/os_mbuf_memcmp/index.html
+++ b/os/core_os/mbuf/os_mbuf_memcmp/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_memcmp"><font color="#F2853F" style="font-size:24pt">os_mbuf_memcmp</font><a class="headerlink" href="#os_mbuf_memcmp" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int os_mbuf_memcmp(const struct os_mbuf *om, int off, const void *data, int len)
+<pre><code class="c">int os_mbuf_memcmp(const struct os_mbuf *om, int off, const void *data, int len)
 </code></pre>
 
 <p>Performs a memory compare of the specified region of an mbuf chain against a flat buffer.</p>
@@ -994,7 +994,7 @@
 <p>This function will compare bytes starting from <em>off</em> bytes from the start of the mbuf chain with a data buffer.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    int rc;
+<pre><code class="c">    int rc;
     struct os_mbuf *om;
     uint8_t my_data_buffer[32];
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/os_mbuf_off/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/os_mbuf_off/index.html b/os/core_os/mbuf/os_mbuf_off/index.html
index c206c02..82c530f 100644
--- a/os/core_os/mbuf/os_mbuf_off/index.html
+++ b/os/core_os/mbuf/os_mbuf_off/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_off"><font color="#F2853F" style="font-size:24pt">os_mbuf_off</font><a class="headerlink" href="#os_mbuf_off" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">struct os_mbuf *os_mbuf_off(struct os_mbuf *om, int off, int *out_off)
+<pre><code class="c">struct os_mbuf *os_mbuf_off(struct os_mbuf *om, int off, int *out_off)
 </code></pre>
 
 <p>Given an offset in the packet (i.e. user data byte offset in the mbuf chain), return the mbuf and the offset in that mbuf where byte 'off' is located. Note that the offset is 'returned' in <em>out_off</em>.</p>
@@ -991,7 +991,7 @@
 <p>While this api is provided to the user, other API are expected to be used by the applciation developer (i.e. <code>os_mbuf_append()</code> or <code>os_mbuf_copyinto()</code>).
 <br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    int relative_offset;
+<pre><code class="c">    int relative_offset;
     uint16_t pktlen;
     struct os_mbuf *om;
     struct os_mbuf *tmp;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/os_mbuf_pool_init/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/os_mbuf_pool_init/index.html b/os/core_os/mbuf/os_mbuf_pool_init/index.html
index 521ed27..64a728e 100644
--- a/os/core_os/mbuf/os_mbuf_pool_init/index.html
+++ b/os/core_os/mbuf/os_mbuf_pool_init/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_pool_init"><font color="#F2853F" style="font-size:24pt">os_mbuf_pool_init</font><a class="headerlink" href="#os_mbuf_pool_init" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">int os_mbuf_pool_init(struct os_mbuf_pool *omp, struct os_mempool *mp, uint16_t buf_len, 
+<pre><code class="c">int os_mbuf_pool_init(struct os_mbuf_pool *omp, struct os_mempool *mp, uint16_t buf_len, 
                       uint16_t nbufs)
 </code></pre>
 
@@ -995,7 +995,7 @@
 <p>The parameter <em>buf_len</em> is the total size of the memory block. This must accommodate the os_mbuf structure, the os_mbuf_pkthdr structure, any user headers plus the desired amount of user data.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">#define MBUF_PKTHDR_OVERHEAD    sizeof(struct os_mbuf_pkthdr) + sizeof(struct user_hdr)
+<pre><code class="c">#define MBUF_PKTHDR_OVERHEAD    sizeof(struct os_mbuf_pkthdr) + sizeof(struct user_hdr)
 #define MBUF_MEMBLOCK_OVERHEAD  sizeof(struct os_mbuf) + MBUF_PKTHDR_OVERHEAD
 
 #define MBUF_NUM_MBUFS      (32)

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/os_mbuf_prepend/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/os_mbuf_prepend/index.html b/os/core_os/mbuf/os_mbuf_prepend/index.html
index 27d67eb..2e30b5a 100644
--- a/os/core_os/mbuf/os_mbuf_prepend/index.html
+++ b/os/core_os/mbuf/os_mbuf_prepend/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_prepend"><font color="#F2853F" style="font-size:24pt">os_mbuf_prepend</font><a class="headerlink" href="#os_mbuf_prepend" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">struct os_mbuf *os_mbuf_prepend(struct os_mbuf *om, int len)
+<pre><code class="c">struct os_mbuf *os_mbuf_prepend(struct os_mbuf *om, int len)
 </code></pre>
 
 <p>Increases the length of an mbuf chain by adding data to the front.  If there is insufficient room in the leading mbuf, additional mbufs are allocated and prepended as necessary.  If this function fails to allocate an mbuf, the entire chain is freed.</p>
@@ -986,7 +986,7 @@
 <p>If <em>om</em> is a packet header mbuf, the total length of the packet is adjusted by <em>len</em>. Note that the returned mbuf may not point to <em>om</em> if insufficient leading space was available in <em>om</em>.</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    uint16_t pktlen;
+<pre><code class="c">    uint16_t pktlen;
     struct os_mbuf *om;
     struct os_mbuf *tmp;
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/mbuf/os_mbuf_pullup/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/mbuf/os_mbuf_pullup/index.html b/os/core_os/mbuf/os_mbuf_pullup/index.html
index 32e698b..1833600 100644
--- a/os/core_os/mbuf/os_mbuf_pullup/index.html
+++ b/os/core_os/mbuf/os_mbuf_pullup/index.html
@@ -954,7 +954,7 @@
                         </div>
                         
                             <h2 id="os_mbuf_pullup"><font color="#F2853F" style="font-size:24pt">os_mbuf_pullup</font><a class="headerlink" href="#os_mbuf_pullup" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">struct os_mbuf *os_mbuf_pullup(struct os_mbuf *om, uint16_t len)
+<pre><code class="c">struct os_mbuf *os_mbuf_pullup(struct os_mbuf *om, uint16_t len)
 </code></pre>
 
 <p>Rearrange an mbuf chain so that len bytes are contiguous, and in the data area of an mbuf (so that OS_MBUF_DATA() will  work on a structure of size len.)  Returns the resulting mbuf chain on success, free's it and returns NULL on failure.</p>
@@ -987,7 +987,7 @@
 <p>The mbuf that is being pulled up into does not need to be a packet header mbuf; it can be a normal mbuf. The user should note that the maximum pullup length does depend on the type of mbuf being pulled up into (a packet header or normal mbuf).</p>
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
-<pre><code class="no-highlight">    struct os_mbuf *om;
+<pre><code class="c">    struct os_mbuf *om;
     struct os_mbuf *tmp;
     struct my_header_struct my_header;
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/memory_pool/OS_MEMPOOL_BYTES/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/memory_pool/OS_MEMPOOL_BYTES/index.html b/os/core_os/memory_pool/OS_MEMPOOL_BYTES/index.html
index cf542fb..58057cb 100644
--- a/os/core_os/memory_pool/OS_MEMPOOL_BYTES/index.html
+++ b/os/core_os/memory_pool/OS_MEMPOOL_BYTES/index.html
@@ -737,7 +737,7 @@
                         </div>
                         
                             <h2 id="os_mempool_bytes"><font color="#F2853F" style="font-size:24pt">OS_MEMPOOL_BYTES</font><a class="headerlink" href="#os_mempool_bytes" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">OS_MEMPOOL_BYTES(n,blksize)
+<pre><code class="c">OS_MEMPOOL_BYTES(n,blksize)
 </code></pre>
 
 <p>Calculates how many bytes of memory is used by <em>n</em> number of elements, when individual element size is <em>blksize</em> bytes.</p>
@@ -769,7 +769,7 @@
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p>Here we allocate memory to be used as a pool.</p>
-<pre><code class="no-highlight">    void *nffs_file_mem;
+<pre><code class="c">    void *nffs_file_mem;
 
     nffs_file_mem = malloc(OS_MEMPOOL_BYTES(nffs_config.nc_num_files, sizeof (struct nffs_file)));
     if (nffs_file_mem == NULL) {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/memory_pool/OS_MEMPOOL_SIZE/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/memory_pool/OS_MEMPOOL_SIZE/index.html b/os/core_os/memory_pool/OS_MEMPOOL_SIZE/index.html
index cd2eab6..b9da59d 100644
--- a/os/core_os/memory_pool/OS_MEMPOOL_SIZE/index.html
+++ b/os/core_os/memory_pool/OS_MEMPOOL_SIZE/index.html
@@ -737,7 +737,7 @@
                         </div>
                         
                             <h2 id="os_mempool_size"><font color="#F2853F" style="font-size:24pt">OS_MEMPOOL_SIZE</font><a class="headerlink" href="#os_mempool_size" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">OS_MEMPOOL_SIZE(n,blksize)
+<pre><code class="c">OS_MEMPOOL_SIZE(n,blksize)
 </code></pre>
 
 <p>Calculates the number of os_membuf_t elements used by <em>n</em> blocks of size <em>blksize</em> bytes.</p>
@@ -771,7 +771,7 @@
 <p><br></p>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p>Here we define a memory buffer to be used by a memory pool using OS_MEMPOOL_SIZE</p>
-<pre><code class="no-highlight">#define NUM_BLOCKS      (16)
+<pre><code class="c">#define NUM_BLOCKS      (16)
 #define BLOCK_SIZE      (32)
 
 os_membuf_t my_pool_memory[OS_MEMPOOL_SIZE(NUM_BLOCKS, BLOCK_SIZE)]

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/memory_pool/memory_pool/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/memory_pool/memory_pool/index.html b/os/core_os/memory_pool/memory_pool/index.html
index 5708ade..9db1948 100644
--- a/os/core_os/memory_pool/memory_pool/index.html
+++ b/os/core_os/memory_pool/memory_pool/index.html
@@ -684,30 +684,30 @@
 <p>A memory pool is a collection of fixed sized elements called memory blocks. Generally, memory pools are used when the developer wants to allocate a certain amount of memory to a given feature. Unlike the heap, where a code module is at the mercy of other code modules to insure there is sufficient memory, memory pools can insure sufficient memory allocation.</p>
 <h3 id="description">Description<a class="headerlink" href="#description" title="Permanent link">&para;</a></h3>
 <p>In order to create a memory pool the developer needs to do a few things. The first task is to define the memory pool itself. This is a data structure which contains information about the pool itself (i.e. number of blocks, size of the blocks, etc).</p>
-<pre><code class="no-highlight">struct os_mempool my_pool;
+<pre><code class="c">struct os_mempool my_pool;
 </code></pre>
 
 <p><br>
 The next order of business is to allocate the memory used by the memory pool. This memory can either be statically allocated (i.e. a global variable) or dynamically allocated (i.e. from the heap). When determining the amount of memory required for the memory pool, simply multiplying the number of blocks by the size of each block is not sufficient as the OS may have alignment requirements. The alignment size definition is named <code>OS_ALIGNMENT</code> and can be found in os_arch.h as it is architecture specific. The memory block alignment is usually for efficiency but may be due to other reasons. Generally, blocks are aligned on 32-bit boundaries. Note that memory blocks must also be of sufficient size to hold a list pointer as this is needed to chain memory blocks on the free list.</p>
 <p>In order to simplify this for the user two macros have been provided: <code>OS_MEMPOOL_BYTES(n, blksize)</code> and <code>OS_MEMPOOL_SIZE(n, blksize)</code>. The first macro returns the number of bytes needed for the memory pool while the second returns the number of <code>os_membuf_t</code> elements required by the memory pool. The <code>os_membuf_t</code> type is used to guarantee that the memory buffer used by the memory pool is aligned on the correct boundary. </p>
 <p>Here are some examples. Note that if a custom malloc implementation is used it must guarantee that the memory buffer used by the pool is allocated on the correct boundary (i.e. OS_ALIGNMENT).</p>
-<pre><code class="no-highlight">void *my_memory_buffer;
+<pre><code class="c">void *my_memory_buffer;
 my_memory_buffer = malloc(OS_MEMPOOL_BYTES(NUM_BLOCKS, BLOCK_SIZE));
 </code></pre>
 
-<pre><code class="no-highlight">os_membuf_t my_memory_buffer[OS_MEMPOOL_SIZE(NUM_BLOCKS, BLOCK_SIZE)];
+<pre><code class="c">os_membuf_t my_memory_buffer[OS_MEMPOOL_SIZE(NUM_BLOCKS, BLOCK_SIZE)];
 </code></pre>
 
 <p><br>
 Now that the memory pool has been defined as well as the memory required for the memory blocks which make up the pool the user needs to initialize the memory pool by calling <code>os_mempool_init</code>.</p>
-<pre><code class="no-highlight">os_mempool_init(&amp;my_pool, NUM_BLOCKS, BLOCK_SIZE, my_memory_buffer,
+<pre><code class="c">os_mempool_init(&amp;my_pool, NUM_BLOCKS, BLOCK_SIZE, my_memory_buffer,
                          &quot;MyPool&quot;);
 </code></pre>
 
 <p><br>
 Once the memory pool has been initialized the developer can allocate memory blocks from the pool by calling <code>os_memblock_get</code>. When the memory block is no longer needed the memory can be freed by calling <code>os_memblock_put</code>. </p>
 <h3 id="data-structures">Data structures<a class="headerlink" href="#data-structures" title="Permanent link">&para;</a></h3>
-<pre><code class="no-highlight">struct os_mempool {
+<pre><code class="c">struct os_mempool {
     int mp_block_size;
     int mp_num_blocks;
     int mp_num_free;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/os/core_os/memory_pool/os_memblock_get/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/memory_pool/os_memblock_get/index.html b/os/core_os/memory_pool/os_memblock_get/index.html
index 8a341e1..db57415 100644
--- a/os/core_os/memory_pool/os_memblock_get/index.html
+++ b/os/core_os/memory_pool/os_memblock_get/index.html
@@ -737,7 +737,7 @@
                         </div>
                         
                             <h2 id="os_memblock_get"><font color="#F2853F" style="font-size:24pt"> os_memblock_get</font><a class="headerlink" href="#os_memblock_get" title="Permanent link">&para;</a></h2>
-<pre><code class="no-highlight">void *os_memblock_get(struct os_mempool *mp)
+<pre><code class="c">void *os_memblock_get(struct os_mempool *mp)
 </code></pre>
 
 <p>Allocate an element from the memory pool. If succesful, you'll get a pointer to allocated element. If there are no elements available, you'll get NULL as response.</p>
@@ -762,7 +762,7 @@
 <h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">&para;</a></h4>
 <h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h4>
 <p><Add text to set up the context for the example here></p>
-<pre><code class="no-highlight">    struct nffs_file *file;
+<pre><code class="c">    struct nffs_file *file;
 
     file = os_memblock_get(&amp;nffs_file_pool);
     if (file != NULL) {



[4/4] incubator-mynewt-site git commit: added syntax highlighting to os_core docs

Posted by ad...@apache.org.
added syntax highlighting to os_core docs


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/1fd93d7e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/1fd93d7e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/1fd93d7e

Branch: refs/heads/asf-site
Commit: 1fd93d7e2def8ae99707ead1ef7277e8ce7b7f5d
Parents: 95e9034
Author: aditihilbert <ad...@runtime.io>
Authored: Sun Mar 13 15:58:08 2016 -0700
Committer: aditihilbert <ad...@runtime.io>
Committed: Sun Mar 13 15:58:08 2016 -0700

----------------------------------------------------------------------
 community/index.html                            |  3 +-
 mkdocs/search_index.json                        | 62 +++++++-------------
 newt/newt_linux/index.html                      | 10 ++--
 newt/newt_mac/index.html                        |  7 +--
 os/core_os/callout/callout/index.html           |  6 +-
 .../callout/os_callout_func_init/index.html     | 12 ++--
 os/core_os/callout/os_callout_init/index.html   |  7 +--
 os/core_os/callout/os_callout_queued/index.html |  8 +--
 os/core_os/callout/os_callout_reset/index.html  |  7 +--
 os/core_os/callout/os_callout_stop/index.html   |  7 +--
 .../context_switch/context_switch/index.html    |  1 -
 .../context_switch/os_arch_ctx_sw/index.html    | 30 +++++-----
 os/core_os/context_switch/os_sched/index.html   |  4 +-
 .../os_sched_ctx_sw_hook/index.html             |  4 +-
 .../os_sched_get_current_task/index.html        |  4 +-
 .../context_switch/os_sched_insert/index.html   |  2 +-
 .../os_sched_next_task/index.html               |  2 +-
 .../os_sched_os_timer_exp/index.html            |  4 +-
 .../context_switch/os_sched_resort/index.html   |  4 +-
 .../os_sched_set_current_task/index.html        |  2 +-
 .../context_switch/os_sched_sleep/index.html    |  4 +-
 .../context_switch/os_sched_wakeup/index.html   |  4 +-
 os/core_os/event_queue/event_queue/index.html   |  4 +-
 os/core_os/event_queue/os_eventq_get/index.html |  4 +-
 .../event_queue/os_eventq_init/index.html       |  4 +-
 os/core_os/event_queue/os_eventq_put/index.html |  4 +-
 .../event_queue/os_eventq_remove/index.html     |  4 +-
 os/core_os/heap/os_free/index.html              |  4 +-
 os/core_os/heap/os_malloc/index.html            |  4 +-
 os/core_os/heap/os_realloc/index.html           |  4 +-
 os/core_os/mbuf/OS_MBUF_DATA/index.html         |  4 +-
 os/core_os/mbuf/OS_MBUF_LEADINGSPACE/index.html |  4 +-
 os/core_os/mbuf/OS_MBUF_PKTHDR/index.html       |  4 +-
 .../mbuf/OS_MBUF_PKTHDR_TO_MBUF/index.html      |  4 +-
 os/core_os/mbuf/OS_MBUF_PKTLEN/index.html       |  4 +-
 .../mbuf/OS_MBUF_TRAILINGSPACE/index.html       |  4 +-
 os/core_os/mbuf/OS_MBUF_USRHDR/index.html       |  4 +-
 os/core_os/mbuf/OS_MBUF_USRHDR_LEN/index.html   |  4 +-
 os/core_os/mbuf/mbuf/index.html                 | 12 ++--
 os/core_os/mbuf/os_mbuf_adj/index.html          |  4 +-
 os/core_os/mbuf/os_mbuf_append/index.html       |  4 +-
 os/core_os/mbuf/os_mbuf_concat/index.html       |  4 +-
 os/core_os/mbuf/os_mbuf_copydata/index.html     |  4 +-
 os/core_os/mbuf/os_mbuf_copyinto/index.html     |  4 +-
 os/core_os/mbuf/os_mbuf_dup/index.html          |  4 +-
 os/core_os/mbuf/os_mbuf_extend/index.html       |  4 +-
 os/core_os/mbuf/os_mbuf_free_chain/index.html   |  4 +-
 os/core_os/mbuf/os_mbuf_get/index.html          |  4 +-
 os/core_os/mbuf/os_mbuf_get_pkthdr/index.html   |  4 +-
 os/core_os/mbuf/os_mbuf_memcmp/index.html       |  4 +-
 os/core_os/mbuf/os_mbuf_off/index.html          |  4 +-
 os/core_os/mbuf/os_mbuf_pool_init/index.html    |  4 +-
 os/core_os/mbuf/os_mbuf_prepend/index.html      |  4 +-
 os/core_os/mbuf/os_mbuf_pullup/index.html       |  4 +-
 .../memory_pool/OS_MEMPOOL_BYTES/index.html     |  4 +-
 .../memory_pool/OS_MEMPOOL_SIZE/index.html      |  4 +-
 os/core_os/memory_pool/memory_pool/index.html   | 10 ++--
 .../memory_pool/os_memblock_get/index.html      |  4 +-
 .../memory_pool/os_memblock_put/index.html      |  4 +-
 .../memory_pool/os_mempool_init/index.html      |  4 +-
 os/core_os/mqueue/mqueue/index.html             |  4 +-
 os/core_os/mqueue/os_mqueue_get/index.html      |  4 +-
 os/core_os/mqueue/os_mqueue_init/index.html     |  4 +-
 os/core_os/mqueue/os_mqueue_put/index.html      |  4 +-
 os/core_os/msys/os_msys_get/index.html          |  4 +-
 os/core_os/msys/os_msys_get_pkthdr/index.html   |  4 +-
 os/core_os/msys/os_msys_register/index.html     |  4 +-
 os/core_os/msys/os_msys_reset/index.html        |  4 +-
 os/core_os/mutex/mutex/index.html               |  2 +-
 os/core_os/mutex/os_mutex_pend/index.html       |  4 +-
 os/core_os/mutex/os_mutex_release/index.html    |  4 +-
 os/core_os/mynewt_os/index.html                 | 10 +---
 os/core_os/porting/port_bsp/index.html          | 10 ++--
 .../sanity/os_sanity_check_init/index.html      |  4 +-
 .../sanity/os_sanity_check_register/index.html  |  4 +-
 .../sanity/os_sanity_check_reset/index.html     |  4 +-
 .../sanity/os_sanity_task_checkin/index.html    |  4 +-
 .../sanity/os_sanity_task_init/index.html       |  4 +-
 os/core_os/sanity/sanity/index.html             | 10 ++--
 os/core_os/semaphore/os_sem_init/index.html     |  4 +-
 os/core_os/semaphore/os_sem_pend/index.html     |  4 +-
 os/core_os/semaphore/os_sem_release/index.html  |  4 +-
 os/core_os/semaphore/semaphore/index.html       |  2 +-
 os/core_os/task/os_task_count/index.html        |  4 +-
 .../task/os_task_info_get_next/index.html       |  4 +-
 os/core_os/task/os_task_init/index.html         |  4 +-
 os/core_os/task/task/index.html                 |  8 +--
 os/core_os/time/os_gettimeofday/index.html      |  4 +-
 os/core_os/time/os_settimeofday/index.html      |  4 +-
 os/core_os/time/os_time_delay/index.html        |  4 +-
 os/core_os/time/os_time_get/index.html          |  4 +-
 os/core_os/time/os_time_tick/index.html         |  4 +-
 os/get_started/project1/index.html              |  2 +-
 os/tutorials/air_quality_sensor/index.html      |  4 +-
 sitemap.xml                                     | 20 +++----
 95 files changed, 245 insertions(+), 287 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/1fd93d7e/community/index.html
----------------------------------------------------------------------
diff --git a/community/index.html b/community/index.html
index 5413a5d..9470415 100644
--- a/community/index.html
+++ b/community/index.html
@@ -235,7 +235,8 @@
                 <a href="https://issues.apache.org/jira/browse/Mynewt/">ASF JIRA</a> </p>
                 </li>
                 <p>
-                Sign up for an account on JIRA and submit a request to the @dev mailing list for your JIRA username to be added to the Apache Mynewt (MYNEWT) project. You can view the issues on JIRA for the MYNEWT project without an account but you need to log in for reporting a bug, getting a task assigned to you, or updating a ticket. Once you have a JIRA account, log in and report a bug by choosing the "MYNEWT" project, clicking on the "Create" button, and creating a ticket with an appropriate Issue Type (e.g. Bug, Wish).  
+                Sign up for an account on JIRA and submit a request to the dev@ mailing list for your JIRA username to be added to the Apache Mynewt (MYNEWT) project. You can view the issues on JIRA for the MYNEWT project without an account but you need to log in for reporting a bug, getting a task assigned to you, or updating a ticket. Once you have a JIRA account, log in and report a bug by choosing the "MYNEWT" project, clicking on the "Create" button, and creating a ticket with an appropriate Issue Type (e.g. Bug, Wish).  </p>
+                <p> If you are a contributor and wish to work on a change, open a JIRA ticket first. It's always a good idea to introduce the change in the dev@ mailing list and refer to that ticket. When you generate a pull request into the github mirror for your change, always reference the JIRA ticket number in the title. JIRA is set up to resolve the ticket when your code is merged into the ASF git repository and the pull request closed.
             </div>
         </div>
     </div>