You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2016/04/12 07:26:51 UTC

[4/4] incubator-mynewt-core git commit: Remove space at end of line

Remove space at end of line


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

Branch: refs/heads/develop
Commit: bfcc17d5bc220d3ff86faaea37bf9ff83e0e7cf7
Parents: fde7d82
Author: William San Filippo <wi...@runtime.io>
Authored: Mon Apr 11 22:26:26 2016 -0700
Committer: William San Filippo <wi...@runtime.io>
Committed: Mon Apr 11 22:26:26 2016 -0700

----------------------------------------------------------------------
 apps/bletest/src/main.c                         |  82 +--
 .../controller/include/controller/ble_ll.h      |  50 +-
 .../controller/include/controller/ble_ll_adv.h  |  38 +-
 .../controller/include/controller/ble_ll_conn.h |  14 +-
 .../controller/include/controller/ble_ll_ctrl.h |  28 +-
 .../controller/include/controller/ble_ll_hci.h  |   4 +-
 .../controller/include/controller/ble_ll_scan.h |  18 +-
 .../include/controller/ble_ll_sched.h           |  22 +-
 .../include/controller/ble_ll_whitelist.h       |   2 +-
 .../controller/include/controller/ble_phy.h     |   6 +-
 net/nimble/controller/src/ble_ll.c              | 230 +++----
 net/nimble/controller/src/ble_ll_adv.c          | 358 +++++------
 net/nimble/controller/src/ble_ll_conn.c         | 644 +++++++++----------
 net/nimble/controller/src/ble_ll_conn_hci.c     | 218 +++----
 net/nimble/controller/src/ble_ll_conn_priv.h    |  14 +-
 net/nimble/controller/src/ble_ll_ctrl.c         | 362 +++++------
 net/nimble/controller/src/ble_ll_hci.c          | 242 +++----
 net/nimble/controller/src/ble_ll_hci_ev.c       |  12 +-
 net/nimble/controller/src/ble_ll_rand.c         |  18 +-
 net/nimble/controller/src/ble_ll_rng.c          |   2 +-
 net/nimble/controller/src/ble_ll_scan.c         | 256 ++++----
 net/nimble/controller/src/ble_ll_sched.c        |  96 +--
 net/nimble/controller/src/ble_ll_supp_cmd.c     |  28 +-
 net/nimble/controller/src/ble_ll_whitelist.c    |  60 +-
 net/nimble/drivers/native/src/ble_phy.c         |  82 +--
 net/nimble/drivers/nrf51/src/ble_phy.c          | 120 ++--
 net/nimble/drivers/nrf52/src/ble_phy.c          | 120 ++--
 net/nimble/include/nimble/ble.h                 |  10 +-
 28 files changed, 1568 insertions(+), 1568 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bfcc17d5/apps/bletest/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bletest/src/main.c b/apps/bletest/src/main.c
index afae2c9..4c51add 100755
--- a/apps/bletest/src/main.c
+++ b/apps/bletest/src/main.c
@@ -6,7 +6,7 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
@@ -82,7 +82,7 @@ uint8_t g_host_adv_len;
 #define MBUF_MEMBLOCK_SIZE  (MBUF_BUF_SIZE + BLE_MBUF_MEMBLOCK_OVERHEAD)
 #define MBUF_MEMPOOL_SIZE   OS_MEMPOOL_SIZE(MBUF_NUM_MBUFS, MBUF_MEMBLOCK_SIZE)
 
-struct os_mbuf_pool g_mbuf_pool; 
+struct os_mbuf_pool g_mbuf_pool;
 struct os_mempool g_mbuf_mempool;
 os_membuf_t g_mbuf_buffer[MBUF_MEMPOOL_SIZE];
 
@@ -103,11 +103,11 @@ os_membuf_t g_mbuf_buffer[MBUF_MEMPOOL_SIZE];
 #define BLETEST_CFG_SCAN_WINDOW         (700000 / BLE_HCI_SCAN_ITVL)
 #define BLETEST_CFG_SCAN_TYPE           (BLE_HCI_SCAN_TYPE_ACTIVE)
 #define BLETEST_CFG_SCAN_FILT_POLICY    (BLE_HCI_SCAN_FILT_NO_WL)
-#define BLETEST_CFG_CONN_ITVL           (128)  /* in 1.25 msec increments */           
+#define BLETEST_CFG_CONN_ITVL           (128)  /* in 1.25 msec increments */
 #define BLETEST_CFG_SLAVE_LATENCY       (0)
 #define BLETEST_CFG_INIT_FILTER_POLICY  (BLE_HCI_CONN_FILT_NO_WL)
 #define BLETEST_CFG_CONN_SPVN_TMO       (1000)  /* 20 seconds */
-#define BLETEST_CFG_MIN_CE_LEN          (6)    
+#define BLETEST_CFG_MIN_CE_LEN          (6)
 #define BLETEST_CFG_MAX_CE_LEN          (BLETEST_CFG_CONN_ITVL)
 #define BLETEST_CFG_CONN_PEER_ADDR_TYPE (BLE_HCI_CONN_PEER_ADDR_PUBLIC)
 #define BLETEST_CFG_CONN_OWN_ADDR_TYPE  (BLE_HCI_ADV_OWN_ADDR_PUBLIC)
@@ -146,23 +146,23 @@ uint16_t g_bletest_outstanding_pkts;
 
 /* --- For LE encryption testing --- */
 /* Key: 0x4C68384139F574D836BCF34E9DFB01BF */
-const uint8_t g_ble_ll_encrypt_test_key[16] = 
+const uint8_t g_ble_ll_encrypt_test_key[16] =
 {
     0x4c, 0x68, 0x38, 0x41, 0x39, 0xf5, 0x74, 0xd8,
     0x36, 0xbc, 0xf3, 0x4e, 0x9d, 0xfb, 0x01, 0xbf
 };
 
 /* Plaint text: 0x0213243546576879acbdcedfe0f10213 */
-const uint8_t g_ble_ll_encrypt_test_plain_text[16] = 
+const uint8_t g_ble_ll_encrypt_test_plain_text[16] =
 {
-    0x02, 0x13, 0x24, 0x35, 0x46, 0x57, 0x68, 0x79, 
+    0x02, 0x13, 0x24, 0x35, 0x46, 0x57, 0x68, 0x79,
     0xac, 0xbd, 0xce, 0xdf, 0xe0, 0xf1, 0x02, 0x13
 };
 
 /* Encrypted data: 0x99ad1b5226a37e3e058e3b8e27c2c666 */
-const uint8_t g_ble_ll_encrypt_test_encrypted_data[16] = 
+const uint8_t g_ble_ll_encrypt_test_encrypted_data[16] =
 {
-    0x99, 0xad, 0x1b, 0x52, 0x26, 0xa3, 0x7e, 0x3e, 
+    0x99, 0xad, 0x1b, 0x52, 0x26, 0xa3, 0x7e, 0x3e,
     0x05, 0x8e, 0x3b, 0x8e, 0x27, 0xc2, 0xc6, 0x66
 };
 
@@ -219,7 +219,7 @@ bletest_send_conn_update(uint16_t handle)
     struct hci_conn_update hcu;
 
     hcu.conn_latency = 4;
-    hcu.supervision_timeout = 2000; 
+    hcu.supervision_timeout = 2000;
     hcu.conn_itvl_min = 1000;
     hcu.conn_itvl_max = 1000;
     hcu.handle = handle;
@@ -459,7 +459,7 @@ bletest_execute_initiator(void)
     uint16_t handle;
     uint8_t new_chan_map[5];
 
-    /* 
+    /*
      * Determine if there is an active connection for the current handle
      * we are trying to create. If so, start looking for the next one
      */
@@ -499,7 +499,7 @@ bletest_execute_initiator(void)
                     if (ble_ll_conn_find_active_conn(i + 1)) {
                         host_hci_cmd_le_rd_chanmap(i+1);
                         host_hci_outstanding_opcode = 0;
-                    }   
+                    }
                 }
             } else if (g_bletest_state == 2) {
                 new_chan_map[0] = 0;
@@ -514,7 +514,7 @@ bletest_execute_initiator(void)
                     if (ble_ll_conn_find_active_conn(i + 1)) {
                         host_hci_cmd_read_rssi(i+1);
                         host_hci_outstanding_opcode = 0;
-                    }   
+                    }
                 }
             }
             ++g_bletest_state;
@@ -525,10 +525,10 @@ bletest_execute_initiator(void)
 #endif
 
 #if (BLETEST_CFG_ROLE == BLETEST_ROLE_ADVERTISER)
-/* 
+/*
  * Test wrapper to get packets. Only get a packet if we have more than half
  * left
- */ 
+ */
 static struct os_mbuf *
 bletest_get_packet(void)
 {
@@ -536,7 +536,7 @@ bletest_get_packet(void)
 
     om = NULL;
     if (g_mbuf_pool.omp_pool->mp_num_free >= 5) {
-        om = os_msys_get_pkthdr(BLE_MBUF_PAYLOAD_SIZE, 
+        om = os_msys_get_pkthdr(BLE_MBUF_PAYLOAD_SIZE,
                                 sizeof(struct ble_mbuf_hdr));
     }
     return om;
@@ -622,7 +622,7 @@ bletest_execute_advertiser(void)
     if ((int32_t)(os_time_get() - g_next_os_time) >= 0) {
         if (g_bletest_current_conns) {
             for (i = 0; i < g_bletest_current_conns; ++i) {
-                if ((g_last_handle_used == 0) || 
+                if ((g_last_handle_used == 0) ||
                     (g_last_handle_used > g_bletest_current_conns)) {
                     g_last_handle_used = 1;
                 }
@@ -715,11 +715,11 @@ bletest_execute_advertiser(void)
     }
 #endif /* XXX: throughput test */
 }
-#endif 
+#endif
 
 /**
  * Main bletest function. Called by the task timer every 50 msecs.
- * 
+ *
  */
 void
 bletest_execute(void)
@@ -741,9 +741,9 @@ bletest_execute(void)
 }
 
 /**
- * Callback when BLE test timer expires. 
- * 
- * @param arg 
+ * Callback when BLE test timer expires.
+ *
+ * @param arg
  */
 void
 bletest_timer_cb(void *arg)
@@ -756,9 +756,9 @@ bletest_timer_cb(void *arg)
 }
 
 /**
- * BLE test task 
- * 
- * @param arg 
+ * BLE test task
+ *
+ * @param arg
  */
 void
 bletest_task_handler(void *arg)
@@ -872,7 +872,7 @@ bletest_task_handler(void *arg)
 
 
     /* Encrypt a block */
-    rc = host_hci_cmd_le_encrypt((uint8_t *)g_ble_ll_encrypt_test_key, 
+    rc = host_hci_cmd_le_encrypt((uint8_t *)g_ble_ll_encrypt_test_key,
                                  (uint8_t *)g_ble_ll_encrypt_test_plain_text);
     assert(rc == 0);
     host_hci_outstanding_opcode = 0;
@@ -914,10 +914,10 @@ bletest_task_handler(void *arg)
 
 /**
  * init_tasks
- *  
- * Called by main.c after os_init(). This function performs initializations 
- * that are required before tasks are running. 
- *  
+ *
+ * Called by main.c after os_init(). This function performs initializations
+ * that are required before tasks are running.
+ *
  * @return int 0 success; error otherwise.
  */
 static int
@@ -925,8 +925,8 @@ init_tasks(void)
 {
     int rc;
 
-    os_task_init(&bletest_task, "bletest", bletest_task_handler, NULL, 
-                 BLETEST_TASK_PRIO, OS_WAIT_FOREVER, bletest_stack, 
+    os_task_init(&bletest_task, "bletest", bletest_task_handler, NULL,
+                 BLETEST_TASK_PRIO, OS_WAIT_FOREVER, bletest_stack,
                  BLETEST_STACK_SIZE);
 
     /* Initialize host HCI */
@@ -942,11 +942,11 @@ init_tasks(void)
 
 /**
  * main
- *  
- * The main function for the project. This function initializes the os, calls 
- * init_tasks to initialize tasks (and possibly other objects), then starts the 
- * OS. We should not return from os start. 
- *  
+ *
+ * The main function for the project. This function initializes the os, calls
+ * init_tasks to initialize tasks (and possibly other objects), then starts the
+ * OS. We should not return from os start.
+ *
  * @return int NOTE: this function should never return!
  */
 int
@@ -967,11 +967,11 @@ main(void)
     rc = cputime_init(1000000);
     assert(rc == 0);
 
-    rc = os_mempool_init(&g_mbuf_mempool, MBUF_NUM_MBUFS, 
+    rc = os_mempool_init(&g_mbuf_mempool, MBUF_NUM_MBUFS,
             MBUF_MEMBLOCK_SIZE, &g_mbuf_buffer[0], "mbuf_pool");
     assert(rc == 0);
 
-    rc = os_mbuf_pool_init(&g_mbuf_pool, &g_mbuf_mempool, MBUF_MEMBLOCK_SIZE, 
+    rc = os_mbuf_pool_init(&g_mbuf_pool, &g_mbuf_mempool, MBUF_MEMBLOCK_SIZE,
                            MBUF_NUM_MBUFS);
     assert(rc == 0);
 
@@ -1009,10 +1009,10 @@ main(void)
     g_bletest_cur_peer_addr[5] = 0x08;
 #endif
 
-    /* 
+    /*
      * Seed random number generator with least significant bytes of device
      * address.
-     */ 
+     */
     seed = 0;
     for (i = 0; i < 4; ++i) {
         seed |= g_dev_addr[i];

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bfcc17d5/net/nimble/controller/include/controller/ble_ll.h
----------------------------------------------------------------------
diff --git a/net/nimble/controller/include/controller/ble_ll.h b/net/nimble/controller/include/controller/ble_ll.h
index 1d6c928..71a2316 100644
--- a/net/nimble/controller/include/controller/ble_ll.h
+++ b/net/nimble/controller/include/controller/ble_ll.h
@@ -6,7 +6,7 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
@@ -36,12 +36,12 @@
 /* Controller revision. */
 #define BLE_LL_SUB_VERS_NR      (0x0000)
 
-/* 
+/*
  * The amount of time that we will wait to hear the start of a receive
  * packet after we have transmitted a packet. This time is at least
- * an IFS time plus the time to receive the preamble and access address (which 
+ * an IFS time plus the time to receive the preamble and access address (which
  * is 40 usecs). We add an additional 32 usecs just to be safe.
- * 
+ *
  * XXX: move this definition and figure out how we determine the worst-case
  * jitter (spec. should have this).
  */
@@ -50,7 +50,7 @@
 /* Packet queue header definition */
 STAILQ_HEAD(ble_ll_pkt_q, os_mbuf_pkthdr);
 
-/* 
+/*
  * Global Link Layer data object. There is only one Link Layer data object
  * per controller although there may be many instances of the link layer state
  * machine running.
@@ -151,7 +151,7 @@ extern STATS_SECT_DECL(ble_ll_stats) ble_ll_stats;
 /* LL timing */
 #define BLE_LL_IFS                  (150)       /* usecs */
 
-/* 
+/*
  * BLE LL device address. Note that element 0 of the array is the LSB and
  * is sent over the air first. Byte 5 is the MSB and is the last one sent over
  * the air.
@@ -167,9 +167,9 @@ struct ble_dev_addr
 #define BLE_IS_DEV_ADDR_RESOLVABLE(addr)    ((addr->u8[5] & 0xc0) == 0x40)
 #define BLE_IS_DEV_ADDR_UNRESOLVABLE(addr)  ((addr->u8[5] & 0xc0) == 0x00)
 
-/* 
+/*
  * LL packet format
- * 
+ *
  *  -> Preamble         (1 byte)
  *  -> Access Address   (4 bytes)
  *  -> PDU              (2 to 257 octets)
@@ -187,15 +187,15 @@ struct ble_dev_addr
 #define BLE_LL_PDU_OVERHEAD     (BLE_LL_OVERHEAD_LEN + BLE_LL_PDU_HDR_LEN)
 
 /**
- * ll pdu tx time get 
- *  
+ * ll pdu tx time get
+ *
  * Returns the number of usecs it will take to transmit a PDU of payload
- * length 'len' bytes. Each byte takes 8 usecs. This routine includes the LL 
- * overhead: preamble (1), access addr (4) and crc (3) and the PDU header (2) 
- * for a total of 10 bytes. 
- * 
- * @param len The length of the PDU payload (does not include include header). 
- * 
+ * length 'len' bytes. Each byte takes 8 usecs. This routine includes the LL
+ * overhead: preamble (1), access addr (4) and crc (3) and the PDU header (2)
+ * for a total of 10 bytes.
+ *
+ * @param len The length of the PDU payload (does not include include header).
+ *
  * @return uint16_t The number of usecs it will take to transmit a PDU of
  *                  length 'len' bytes.
  */
@@ -204,12 +204,12 @@ struct ble_dev_addr
 /* Access address for advertising channels */
 #define BLE_ACCESS_ADDR_ADV             (0x8E89BED6)
 
-/* 
+/*
  * Advertising PDU format:
  * -> 2 byte header
  *      -> LSB contains pdu type, txadd and rxadd bits.
  *      -> MSB contains length (6 bits). Length is length of payload. Does
- *         not include the header length itself. 
+ *         not include the header length itself.
  * -> Payload (max 37 bytes)
  */
 #define BLE_ADV_PDU_HDR_TYPE_MASK           (0x0F)
@@ -226,7 +226,7 @@ struct ble_dev_addr
 #define BLE_ADV_PDU_TYPE_CONNECT_REQ        (5)
 #define BLE_ADV_PDU_TYPE_ADV_SCAN_IND       (6)
 
-/* 
+/*
  * TxAdd and RxAdd bit definitions. A 0 is a public address; a 1 is a
  * random address.
  */
@@ -235,7 +235,7 @@ struct ble_dev_addr
 
 /*
  * Data Channel format
- * 
+ *
  *  -> Header (2 bytes)
  *      -> LSB contains llid, nesn, sn and md
  *      -> MSB contains length (8 bits)
@@ -270,7 +270,7 @@ struct ble_dev_addr
  *          -> Channel Map (5 bytes)
  *          -> Hop Increment (5 bits)
  *          -> SCA (3 bits)
- * 
+ *
  *  InitA is the initiators public (TxAdd=0) or random (TxAdd=1) address.
  *  AdvaA is the advertisers public (RxAdd=0) or random (RxAdd=1) address.
  *  LLData contains connection request data.
@@ -310,8 +310,8 @@ int ble_ll_is_resolvable_priv_addr(uint8_t *addr);
 int ble_ll_is_our_devaddr(uint8_t *addr, int addr_type);
 
 /**
- * Called to put a packet on the Link Layer transmit packet queue. 
- * 
+ * Called to put a packet on the Link Layer transmit packet queue.
+ *
  * @param txpdu Pointer to transmit packet
  */
 void ble_ll_acl_data_in(struct os_mbuf *txpkt);
@@ -361,10 +361,10 @@ void ble_ll_rand_sample(uint8_t rnum);
 int ble_ll_rand_data_get(uint8_t *buf, uint8_t len);
 int ble_ll_rand_start(void);
 
-/* 
+/*
  * XXX: temporary LL debug log. Will get removed once we transition to real
  * log
- */ 
+ */
 #undef BLE_LL_LOG
 
 #define BLE_LL_LOG_ID_PHY_SETCHAN       (1)

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bfcc17d5/net/nimble/controller/include/controller/ble_ll_adv.h
----------------------------------------------------------------------
diff --git a/net/nimble/controller/include/controller/ble_ll_adv.h b/net/nimble/controller/include/controller/ble_ll_adv.h
index 3435a97..5a5d607 100644
--- a/net/nimble/controller/include/controller/ble_ll_adv.h
+++ b/net/nimble/controller/include/controller/ble_ll_adv.h
@@ -6,7 +6,7 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
@@ -20,13 +20,13 @@
 #ifndef H_BLE_LL_ADV_
 #define H_BLE_LL_ADV_
 
-/* 
+/*
  * ADV event timing
  *      T_advEvent = advInterval + advDelay
- * 
+ *
  *      advInterval: increments of 625 usecs
  *      advDelay: RAND[0, 10] msecs
- * 
+ *
  */
 #define BLE_LL_ADV_ITVL                 (625)           /* usecs */
 #define BLE_LL_ADV_ITVL_MIN             (32)            /* units */
@@ -46,39 +46,39 @@
 /* Maximum advertisement data length */
 #define BLE_ADV_DATA_MAX_LEN            (31)
 
-/* 
+/*
  * ADV_IND
  *      -> AdvA     (6 bytes)
  *      -> AdvData  (0 - 31 bytes)
- * 
- *  The advertising address (AdvA) is a public address (TxAdd=0) or random 
+ *
+ *  The advertising address (AdvA) is a public address (TxAdd=0) or random
  *  address (TxAdd = 1)
  */
 #define BLE_ADV_IND_MIN_LEN             (6)
 #define BLE_ADV_IND_MAX_LEN             (37)
 
-/* 
+/*
  * ADV_DIRECT_IND
  *      -> AdvA     (6 bytes)
  *      -> InitA    (6 bytes)
- * 
+ *
  *  AdvA is the advertisers public address (TxAdd=0) or random address
  *  (TxAdd = 1).
- * 
+ *
  *  InitA is the initiators public or random address. This is the address
  *  to which this packet is addressed.
- * 
+ *
  */
 #define BLE_ADV_DIRECT_IND_LEN          (12)
 
 /*
- * ADV_NONCONN_IND 
+ * ADV_NONCONN_IND
  *      -> AdvA     (6 bytes)
  *      -> AdvData  (0 - 31 bytes)
- * 
- *  The advertising address (AdvA) is a public address (TxAdd=0) or random 
+ *
+ *  The advertising address (AdvA) is a public address (TxAdd=0) or random
  *  address (TxAdd = 1)
- * 
+ *
  */
 #define BLE_ADV_NONCONN_IND_MIN_LEN     (6)
 #define BLE_ADV_NONCONN_IND_MAX_LEN     (37)
@@ -87,17 +87,17 @@
  * ADV_SCAN_IND
  *      -> AdvA     (6 bytes)
  *      -> AdvData  (0 - 31 bytes)
- * 
- *  The advertising address (AdvA) is a public address (TxAdd=0) or random 
+ *
+ *  The advertising address (AdvA) is a public address (TxAdd=0) or random
  *  address (TxAdd = 1)
- * 
+ *
  */
 #define BLE_ADV_SCAN_IND_MIN_LEN        (6)
 #define BLE_ADV_SCAN_IND_MAX_LEN        (37)
 
 /*---- HCI ----*/
 /* Start an advertiser */
-int ble_ll_adv_start_req(uint8_t adv_chanmask, uint8_t adv_type, 
+int ble_ll_adv_start_req(uint8_t adv_chanmask, uint8_t adv_type,
                          uint8_t *init_addr, uint16_t adv_itvl, void *handle);
 
 /* Start or stop advertising */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bfcc17d5/net/nimble/controller/include/controller/ble_ll_conn.h
----------------------------------------------------------------------
diff --git a/net/nimble/controller/include/controller/ble_ll_conn.h b/net/nimble/controller/include/controller/ble_ll_conn.h
index a813c81..dad8356 100644
--- a/net/nimble/controller/include/controller/ble_ll_conn.h
+++ b/net/nimble/controller/include/controller/ble_ll_conn.h
@@ -6,7 +6,7 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
@@ -53,12 +53,12 @@
 /* Definition for RSSI when the RSSI is unknown */
 #define BLE_LL_CONN_UNKNOWN_RSSI        (127)
 
-/* 
+/*
  * Length of empty pdu mbuf. Each connection state machine contains an
  * empty pdu since we dont want to allocate a full mbuf for an empty pdu
  * and we always want to have one available. The empty pdu length is of
  * type uint32_t so we have 4 byte alignment.
- */ 
+ */
 #define BLE_LL_EMPTY_PDU_MBUF_SIZE  (BLE_MBUF_MEMBLOCK_OVERHEAD / 4)
 
 /* Connection state machine flags. */
@@ -198,10 +198,10 @@ struct ble_ll_conn_sm
     struct ble_ll_sched_item conn_sch;
 
     /* XXX: ifdef this by feature? */
-    /* 
+    /*
      * For connection update procedure. XXX: can make this a pointer and
      * malloc it if we want to save space.
-     */ 
+     */
     struct hci_conn_update conn_param_req;
 
     /* For connection update procedure */
@@ -216,10 +216,10 @@ struct ble_ll_conn_sm
 #define CONN_F_EMPTY_PDU_TXD(csm)   (csm->csmflags.cfbit.conn_empty_pdu_txd)
 #define CONN_F_LAST_TXD_MD(csm)     (csm->csmflags.cfbit.last_txd_md)
 
-/* 
+/*
  * Given a handle, returns an active connection state machine (or NULL if the
  * handle does not exist
- * 
+ *
  */
 struct ble_ll_conn_sm *ble_ll_conn_find_active_conn(uint16_t handle);
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bfcc17d5/net/nimble/controller/include/controller/ble_ll_ctrl.h
----------------------------------------------------------------------
diff --git a/net/nimble/controller/include/controller/ble_ll_ctrl.h b/net/nimble/controller/include/controller/ble_ll_ctrl.h
index c501044..e1a5881 100644
--- a/net/nimble/controller/include/controller/ble_ll_ctrl.h
+++ b/net/nimble/controller/include/controller/ble_ll_ctrl.h
@@ -6,7 +6,7 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
@@ -20,7 +20,7 @@
 #ifndef H_BLE_LL_CTRL_
 #define H_BLE_LL_CTRL_
 
-/* 
+/*
  * LL control procedures. This "enumeration" is not in the specification;
  * It is used to determine which LL control procedure is currently running
  * in a connection and which ones may be pending.
@@ -44,7 +44,7 @@
 /* LL control procedure timeout */
 #define BLE_LL_CTRL_PROC_TIMEOUT        (40)    /* in secs */
 
-/* 
+/*
  * LL CTRL PDU format
  *  -> Opcode   (1 byte)
  *  -> Data     (0 - 26 bytes)
@@ -101,9 +101,9 @@ struct ble_ll_chan_map_req
 };
 #define BLE_LL_CTRL_CHAN_MAP_LEN            (7)
 
-/* 
+/*
  * LL control terminate ind
- *  -> error code (1 byte)                         
+ *  -> error code (1 byte)
  */
 #define BLE_LL_CTRL_TERMINATE_IND_LEN      (1)
 
@@ -127,17 +127,17 @@ struct ble_ll_enc_rsp
 
 #define BLE_LL_CTRL_ENC_RSP_LEN             (12)
 
-/* LL control start enc req and start enc rsp have no data */ 
+/* LL control start enc req and start enc rsp have no data */
 #define BLE_LL_CTRL_START_ENC_LEN           (0)
 
-/* 
+/*
  * LL control unknown response
  *  -> 1 byte which contains the unknown or un-supported opcode.
  */
 #define BLE_LL_CTRL_UNK_RSP_LEN             (1)
 
 /*
- * LL control feature req and LL control feature rsp 
+ * LL control feature req and LL control feature rsp
  *  -> 8 bytes of data containing features supported by device.
  */
 #define BLE_LL_CTRL_FEATURE_LEN             (8)
@@ -145,8 +145,8 @@ struct ble_ll_enc_rsp
 /* LL control pause enc req and pause enc rsp have no data */
 #define BLE_LL_CTRL_PAUSE_ENC_LEN           (0)
 
-/* 
- * LL control version ind 
+/*
+ * LL control version ind
  *  -> version (1 byte):
  *      Contains the version number of the bluetooth controller specification.
  *  -> comp_id (2 bytes)
@@ -163,7 +163,7 @@ struct ble_ll_version_ind
 
 #define BLE_LL_CTRL_VERSION_IND_LEN         (5)
 
-/* 
+/*
  * LL control reject ind
  *  -> error code (1 byte): contains reason why request was rejected.
  */
@@ -206,7 +206,7 @@ struct ble_ll_reject_ind_ext
 /* LL control ping req and ping rsp (contain no data) */
 #define BLE_LL_CTRL_PING_LEN            (0)
 
-/* 
+/*
  * LL control length req and length rsp
  *  -> max_rx_bytes (2 bytes): defines connMaxRxOctets. Range 27 to 251
  *  -> max_rx_time (2 bytes): defines connMaxRxTime. Range 328 to 2120 usecs.
@@ -232,7 +232,7 @@ void ble_ll_ctrl_chk_proc_start(struct ble_ll_conn_sm *connsm);
 void ble_ll_ctrl_terminate_start(struct ble_ll_conn_sm *connsm);
 int ble_ll_ctrl_is_terminate_ind(uint8_t hdr, uint8_t opcode);
 int ble_ll_ctrl_is_reject_ind_ext(uint8_t hdr, uint8_t opcode);
-uint8_t ble_ll_ctrl_conn_param_reply(struct ble_ll_conn_sm *connsm, 
+uint8_t ble_ll_ctrl_conn_param_reply(struct ble_ll_conn_sm *connsm,
                                      uint8_t *rsp,
                                      struct ble_ll_conn_params *req);
 int ble_ll_ctrl_reject_ind_ext_send(struct ble_ll_conn_sm *connsm,
@@ -242,7 +242,7 @@ void ble_ll_hci_ev_datalen_chg(struct ble_ll_conn_sm *connsm);
 void ble_ll_hci_ev_rem_conn_parm_req(struct ble_ll_conn_sm *connsm,
                                      struct ble_ll_conn_params *cp);
 void ble_ll_hci_ev_conn_update(struct ble_ll_conn_sm *connsm, uint8_t status);
-void ble_ll_hci_ev_rd_rem_used_feat(struct ble_ll_conn_sm *connsm, 
+void ble_ll_hci_ev_rd_rem_used_feat(struct ble_ll_conn_sm *connsm,
                                       uint8_t status);
 void ble_ll_hci_ev_rd_rem_ver(struct ble_ll_conn_sm *connsm, uint8_t status);
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bfcc17d5/net/nimble/controller/include/controller/ble_ll_hci.h
----------------------------------------------------------------------
diff --git a/net/nimble/controller/include/controller/ble_ll_hci.h b/net/nimble/controller/include/controller/ble_ll_hci.h
index 2e43745..47daa76 100644
--- a/net/nimble/controller/include/controller/ble_ll_hci.h
+++ b/net/nimble/controller/include/controller/ble_ll_hci.h
@@ -6,7 +6,7 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
@@ -24,7 +24,7 @@
 #define BLE_LL_SUPP_CMD_LEN (36)
 extern const uint8_t g_ble_ll_supp_cmds[BLE_LL_SUPP_CMD_LEN];
 
-/* 
+/*
  * This determines the number of outstanding commands allowed from the
  * host to the controller.
  */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bfcc17d5/net/nimble/controller/include/controller/ble_ll_scan.h
----------------------------------------------------------------------
diff --git a/net/nimble/controller/include/controller/ble_ll_scan.h b/net/nimble/controller/include/controller/ble_ll_scan.h
index 6967a1a..8323138 100644
--- a/net/nimble/controller/include/controller/ble_ll_scan.h
+++ b/net/nimble/controller/include/controller/ble_ll_scan.h
@@ -6,7 +6,7 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
@@ -24,13 +24,13 @@
 #include "hal/hal_cputime.h"
 
 /*
- * SCAN_REQ 
+ * SCAN_REQ
  *      -> ScanA    (6 bytes)
  *      -> AdvA     (6 bytes)
- * 
+ *
  *  ScanA is the scanners public (TxAdd=0) or random (TxAdd = 1) address
  *  AdvaA is the advertisers public (RxAdd=0) or random (RxAdd=1) address.
- * 
+ *
  * Sent by the LL in the Scanning state; received by the LL in the advertising
  * state. The advertising address is the intended recipient of this frame.
  */
@@ -39,13 +39,13 @@
 /*
  * SCAN_RSP
  *      -> AdvA         (6 bytes)
- *      -> ScanRspData  (0 - 31 bytes) 
- * 
+ *      -> ScanRspData  (0 - 31 bytes)
+ *
  *  AdvaA is the advertisers public (TxAdd=0) or random (TxAdd=1) address.
  *  ScanRspData may contain any data from the advertisers host.
- * 
+ *
  * Sent by the LL in the advertising state; received by the LL in the
- * scanning state. 
+ * scanning state.
  */
 #define BLE_SCAN_RSP_DATA_MAX_LEN       (31)
 
@@ -100,7 +100,7 @@ int ble_ll_scan_rx_isr_start(uint8_t pdu_type, struct os_mbuf *rxpdu);
 int ble_ll_scan_rx_isr_end(struct os_mbuf *rxpdu, uint8_t crcok);
 
 /* Process a scan response PDU */
-void ble_ll_scan_rx_pkt_in(uint8_t pdu_type, uint8_t *rxbuf, 
+void ble_ll_scan_rx_pkt_in(uint8_t pdu_type, uint8_t *rxbuf,
                            struct ble_mbuf_hdr *hdr);
 
 /* Boolean function denoting whether or not the whitelist can be changed */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bfcc17d5/net/nimble/controller/include/controller/ble_ll_sched.h
----------------------------------------------------------------------
diff --git a/net/nimble/controller/include/controller/ble_ll_sched.h b/net/nimble/controller/include/controller/ble_ll_sched.h
index 00a2c6b..8539e84 100644
--- a/net/nimble/controller/include/controller/ble_ll_sched.h
+++ b/net/nimble/controller/include/controller/ble_ll_sched.h
@@ -6,7 +6,7 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
@@ -23,11 +23,11 @@
 /* Time per BLE scheduler slot */
 #define BLE_LL_SCHED_USECS_PER_SLOT (1250)
 
-/* 
+/*
  * This is the number of slots needed to transmit and receive a maximum
  * size PDU, including an IFS time before each. The actual time is
  * 2120 usecs for tx/rx and 150 for IFS = 4540 usecs.
- */ 
+ */
 #define BLE_LL_SCHED_MAX_TXRX_SLOT  (4 * BLE_LL_SCHED_USECS_PER_SLOT)
 
 /* BLE scheduler errors */
@@ -71,7 +71,7 @@ void ble_ll_sched_free_item(struct ble_ll_sched_item *sch);
 
 /* Schedule a new master connection */
 struct ble_ll_conn_sm;
-int ble_ll_sched_master_new(struct ble_ll_conn_sm *connsm, uint32_t adv_rxend, 
+int ble_ll_sched_master_new(struct ble_ll_conn_sm *connsm, uint32_t adv_rxend,
                             uint8_t req_slots);
 
 /* Schedule a new slave connection */
@@ -87,14 +87,14 @@ int ble_ll_sched_adv_reschedule(struct ble_ll_sched_item *sch);
 int ble_ll_sched_conn_reschedule(struct ble_ll_conn_sm * connsm);
 
 /**
- * Called to determine when the next scheduled event will occur. 
- *  
- * If there are not scheduled events this function returns 0; otherwise it 
- * returns 1 and *next_event_time is set to the start time of the next event. 
- * 
+ * Called to determine when the next scheduled event will occur.
+ *
+ * If there are not scheduled events this function returns 0; otherwise it
+ * returns 1 and *next_event_time is set to the start time of the next event.
+ *
  * @param next_event_time cputime at which next scheduled event will occur
- * 
- * @return int 0: No events are scheduled 1: there is an upcoming event 
+ *
+ * @return int 0: No events are scheduled 1: there is an upcoming event
  */
 int ble_ll_sched_next_time(uint32_t *next_event_time);
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bfcc17d5/net/nimble/controller/include/controller/ble_ll_whitelist.h
----------------------------------------------------------------------
diff --git a/net/nimble/controller/include/controller/ble_ll_whitelist.h b/net/nimble/controller/include/controller/ble_ll_whitelist.h
index f8f4331..f62ab27 100644
--- a/net/nimble/controller/include/controller/ble_ll_whitelist.h
+++ b/net/nimble/controller/include/controller/ble_ll_whitelist.h
@@ -6,7 +6,7 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bfcc17d5/net/nimble/controller/include/controller/ble_phy.h
----------------------------------------------------------------------
diff --git a/net/nimble/controller/include/controller/ble_phy.h b/net/nimble/controller/include/controller/ble_phy.h
index 6800483..06f22d2 100644
--- a/net/nimble/controller/include/controller/ble_phy.h
+++ b/net/nimble/controller/include/controller/ble_phy.h
@@ -6,7 +6,7 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
@@ -23,10 +23,10 @@
 /* Forward declarations */
 struct os_mbuf;
 
-/* 
+/*
  * XXX: Transceiver definitions. These dont belong here and will be moved
  * once we finalize transceiver specific support.
- */ 
+ */
 #define XCVR_RX_START_DELAY_USECS     (140)
 #define XCVR_TX_START_DELAY_USECS     (140)
 #define XCVR_PROC_DELAY_USECS         (50)

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bfcc17d5/net/nimble/controller/src/ble_ll.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll.c b/net/nimble/controller/src/ble_ll.c
index 8790479..87993b4 100644
--- a/net/nimble/controller/src/ble_ll.c
+++ b/net/nimble/controller/src/ble_ll.c
@@ -6,7 +6,7 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
@@ -37,7 +37,7 @@
 #include "hal/hal_cputime.h"
 
 /* XXX:
- * 
+ *
  * 1) use the sanity task!
  * 2) Need to figure out what to do with packets that we hand up that did
  * not pass the filter policy for the given state. Currently I count all
@@ -219,11 +219,11 @@ ble_ll_log(uint8_t id, uint8_t arg8, uint16_t arg16, uint32_t arg32)
 #endif
 
 /**
- * Counts the number of advertising PDU's received, by type. For advertising 
- * PDU's that contain a destination address, we still count these packets even 
- * if they are not for us. 
- * 
- * @param pdu_type 
+ * Counts the number of advertising PDU's received, by type. For advertising
+ * PDU's that contain a destination address, we still count these packets even
+ * if they are not for us.
+ *
+ * @param pdu_type
  */
 static void
 ble_ll_count_rx_adv_pdus(uint8_t pdu_type)
@@ -261,7 +261,7 @@ ble_ll_chk_txrx_octets(uint16_t octets)
 {
     int rc;
 
-    if ((octets < BLE_LL_CONN_SUPP_BYTES_MIN) || 
+    if ((octets < BLE_LL_CONN_SUPP_BYTES_MIN) ||
         (octets > BLE_LL_CONN_SUPP_BYTES_MAX)) {
         rc = 0;
     } else {
@@ -276,7 +276,7 @@ ble_ll_chk_txrx_time(uint16_t time)
 {
     int rc;
 
-    if ((time < BLE_LL_CONN_SUPP_TIME_MIN) || 
+    if ((time < BLE_LL_CONN_SUPP_TIME_MIN) ||
         (time > BLE_LL_CONN_SUPP_TIME_MAX)) {
         rc = 0;
     } else {
@@ -338,13 +338,13 @@ ble_ll_is_valid_random_addr(uint8_t *addr)
 }
 
 /**
- * Called from the HCI command parser when the set random address command 
- * is received. 
- *  
- * Context: Link Layer task (HCI command parser) 
- * 
+ * Called from the HCI command parser when the set random address command
+ * is received.
+ *
+ * Context: Link Layer task (HCI command parser)
+ *
  * @param addr Pointer to address
- * 
+ *
  * @return int 0: success
  */
 int
@@ -362,13 +362,13 @@ ble_ll_set_random_addr(uint8_t *addr)
 }
 
 /**
- * Checks to see if an address is our device address (either public or 
- * random) 
- * 
- * @param addr 
- * @param addr_type 
- * 
- * @return int 
+ * Checks to see if an address is our device address (either public or
+ * random)
+ *
+ * @param addr
+ * @param addr_type
+ *
+ * @return int
  */
 int
 ble_ll_is_our_devaddr(uint8_t *addr, int addr_type)
@@ -391,11 +391,11 @@ ble_ll_is_our_devaddr(uint8_t *addr, int addr_type)
 }
 
 /**
- * Wait for response timeout function 
- *  
- * Context: interrupt (ble scheduler) 
- * 
- * @param arg 
+ * Wait for response timeout function
+ *
+ * Context: interrupt (ble scheduler)
+ *
+ * @param arg
  */
 void
 ble_ll_wfr_timer_exp(void *arg)
@@ -429,13 +429,13 @@ ble_ll_wfr_timer_exp(void *arg)
 }
 
 /**
- * Enable the wait for response timer. 
- *  
- * Context: Interrupt. 
- * 
- * @param cputime 
- * @param wfr_cb 
- * @param arg 
+ * Enable the wait for response timer.
+ *
+ * Context: Interrupt.
+ *
+ * @param cputime
+ * @param wfr_cb
+ * @param arg
  */
 void
 ble_ll_wfr_enable(uint32_t cputime)
@@ -454,11 +454,11 @@ ble_ll_wfr_disable(void)
 
 /**
  * ll tx pkt in proc
- *  
+ *
  * Process ACL data packet input from host
- *  
+ *
  * Context: Link layer task
- *  
+ *
  */
 static void
 ble_ll_tx_pkt_in(void)
@@ -498,12 +498,12 @@ ble_ll_tx_pkt_in(void)
 }
 
 /**
- * Count Link Layer statistics for received PDUs 
- *  
+ * Count Link Layer statistics for received PDUs
+ *
  * Context: Link layer task
- * 
- * @param hdr 
- * @param len 
+ *
+ * @param hdr
+ * @param len
  */
 static void
 ble_ll_count_rx_stats(struct ble_mbuf_hdr *hdr, uint16_t len, uint8_t pdu_type)
@@ -535,11 +535,11 @@ ble_ll_count_rx_stats(struct ble_mbuf_hdr *hdr, uint16_t len, uint8_t pdu_type)
 
 /**
  * ll rx pkt in
- *  
+ *
  * Process received packet from PHY.
- *  
+ *
  * Context: Link layer task
- *  
+ *
  */
 static void
 ble_ll_rx_pkt_in(void)
@@ -563,7 +563,7 @@ ble_ll_rx_pkt_in(void)
         OS_EXIT_CRITICAL(sr);
 
         /* Note: pdu type wont get used unless this is an advertising pdu */
-        ble_hdr = BLE_MBUF_HDR_PTR(m); 
+        ble_hdr = BLE_MBUF_HDR_PTR(m);
         rxbuf = m->om_data;
         pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
         ble_ll_count_rx_stats(ble_hdr, pkthdr->omp_len, pdu_type);
@@ -596,8 +596,8 @@ ble_ll_rx_pkt_in(void)
 }
 
 /**
- * Called to put a packet on the Link Layer receive packet queue. 
- * 
+ * Called to put a packet on the Link Layer receive packet queue.
+ *
  * @param rxpdu Pointer to received PDU
  */
 void
@@ -611,8 +611,8 @@ ble_ll_rx_pdu_in(struct os_mbuf *rxpdu)
 }
 
 /**
- * Called to put a packet on the Link Layer transmit packet queue. 
- * 
+ * Called to put a packet on the Link Layer transmit packet queue.
+ *
  * @param txpdu Pointer to transmit packet
  */
 void
@@ -628,15 +628,15 @@ ble_ll_acl_data_in(struct os_mbuf *txpkt)
     os_eventq_put(&g_ble_ll_data.ll_evq, &g_ble_ll_data.ll_tx_pkt_ev);
 }
 
-/** 
- * Called upon start of received PDU 
- *  
- * Context: Interrupt 
- * 
- * @param rxpdu 
- *        chan 
- * 
- * @return int 
+/**
+ * Called upon start of received PDU
+ *
+ * Context: Interrupt
+ *
+ * @param rxpdu
+ *        chan
+ *
+ * @return int
  *   < 0: A frame we dont want to receive.
  *   = 0: Continue to receive frame. Dont go from rx to tx
  *   > 0: Continue to receive frame and go from rx to tx when done
@@ -653,7 +653,7 @@ ble_ll_rx_start(struct os_mbuf *rxpdu, uint8_t chan)
     /* Check channel type */
     rxbuf = rxpdu->om_data;
     if (chan < BLE_PHY_NUM_DATA_CHANS) {
-        /* 
+        /*
          * Data channel pdu. We should be in CONNECTION state with an
          * ongoing connection
          */
@@ -668,7 +668,7 @@ ble_ll_rx_start(struct os_mbuf *rxpdu, uint8_t chan)
             rc = 0;
         }
         return rc;
-    } 
+    }
 
     /* Advertising channel PDU */
     pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
@@ -704,14 +704,14 @@ ble_ll_rx_start(struct os_mbuf *rxpdu, uint8_t chan)
 }
 
 /**
- * Called by the PHY when a receive packet has ended. 
- *  
+ * Called by the PHY when a receive packet has ended.
+ *
  * NOTE: Called from interrupt context!
- * 
- * @param rxpdu Pointer to received PDU 
- *        ble_hdr Pointer to BLE header of received mbuf 
- * 
- * @return int 
+ *
+ * @param rxpdu Pointer to received PDU
+ *        ble_hdr Pointer to BLE header of received mbuf
+ *
+ * @return int
  *       < 0: Disable the phy after reception.
  *      == 0: Success. Do not disable the PHY.
  *       > 0: Do not disable PHY as that has already been done.
@@ -735,9 +735,9 @@ ble_ll_rx_end(struct os_mbuf *rxpdu, struct ble_mbuf_hdr *ble_hdr)
     chan = ble_hdr->rxinfo.channel;
     crcok = BLE_MBUF_HDR_CRC_OK(ble_hdr);
 
-    ble_ll_log(BLE_LL_LOG_ID_RX_END, 
-               chan, 
-               ((uint16_t)crcok << 8) | rxbuf[1], 
+    ble_ll_log(BLE_LL_LOG_ID_RX_END,
+               chan,
+               ((uint16_t)crcok << 8) | rxbuf[1],
                (BLE_MBUF_HDR_PTR(rxpdu))->end_cputime);
 
     /* Check channel type */
@@ -747,7 +747,7 @@ ble_ll_rx_end(struct os_mbuf *rxpdu, struct ble_mbuf_hdr *ble_hdr)
         OS_MBUF_PKTHDR(rxpdu)->omp_len = mblen;
         rxpdu->om_len = mblen;
 
-        /* 
+        /*
          * NOTE: this looks a bit odd, and it is, but for now we place the
          * received PDU on the Link Layer task before calling the rx end
          * function. We do this to guarantee connection event end ordering
@@ -755,13 +755,13 @@ ble_ll_rx_end(struct os_mbuf *rxpdu, struct ble_mbuf_hdr *ble_hdr)
          */
         ble_ll_rx_pdu_in(rxpdu);
 
-        /* 
+        /*
          * Data channel pdu. We should be in CONNECTION state with an
          * ongoing connection.
          */
         rc = ble_ll_conn_rx_isr_end(rxpdu, ble_phy_access_addr_get());
         return rc;
-    } 
+    }
 
     /* Get advertising PDU type and length */
     pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
@@ -838,11 +838,11 @@ ble_ll_rx_end(struct os_mbuf *rxpdu, struct ble_mbuf_hdr *ble_hdr)
 }
 
 /**
- * Link Layer task. 
- *  
- * This is the task that runs the Link Layer. 
- * 
- * @param arg 
+ * Link Layer task.
+ *
+ * This is the task that runs the Link Layer.
+ *
+ * @param arg
  */
 void
 ble_ll_task(void *arg)
@@ -901,12 +901,12 @@ ble_ll_task(void *arg)
 
 /**
  * ble ll state set
- *  
- * Called to set the current link layer state. 
- *  
+ *
+ * Called to set the current link layer state.
+ *
  * Context: Interrupt and Link Layer task
- * 
- * @param ll_state 
+ *
+ * @param ll_state
  */
 void
 ble_ll_state_set(uint8_t ll_state)
@@ -916,12 +916,12 @@ ble_ll_state_set(uint8_t ll_state)
 
 /**
  * ble ll state get
- *  
- * Called to get the current link layer state. 
- *  
+ *
+ * Called to get the current link layer state.
+ *
  * Context: Link Layer task (can be called from interrupt context though).
- * 
- * @return ll_state 
+ *
+ * @return ll_state
  */
 uint8_t
 ble_ll_state_get(void)
@@ -931,9 +931,9 @@ ble_ll_state_get(void)
 
 /**
  * ble ll event send
- *  
- * Send an event to the Link Layer task 
- * 
+ *
+ * Send an event to the Link Layer task
+ *
  * @param ev Event to add to the Link Layer event queue.
  */
 void
@@ -966,8 +966,8 @@ ble_ll_read_supp_features(void)
 
 /**
  * Flush a link layer packet queue.
- * 
- * @param pktq 
+ *
+ * @param pktq
  */
 static void
 ble_ll_flush_pkt_queue(struct ble_ll_pkt_q *pktq)
@@ -989,10 +989,10 @@ ble_ll_flush_pkt_queue(struct ble_ll_pkt_q *pktq)
 
 /**
  * Called to initialize a mbuf used by the controller
- * 
- * @param m 
- * @param pdulen 
- * @param hdr 
+ *
+ * @param m
+ * @param pdulen
+ * @param hdr
  */
 void
 ble_ll_mbuf_init(struct os_mbuf *m, uint8_t pdulen, uint8_t hdr)
@@ -1012,14 +1012,14 @@ ble_ll_mbuf_init(struct os_mbuf *m, uint8_t pdulen, uint8_t hdr)
 }
 
 /**
- * Called to reset the controller. This performs a "software reset" of the link 
- * layer; it does not perform a HW reset of the controller nor does it reset 
- * the HCI interface. 
- * 
- * Context: Link Layer task (HCI command) 
- *  
- * @return int The ble error code to place in the command complete event that 
- * is returned when this command is issued. 
+ * Called to reset the controller. This performs a "software reset" of the link
+ * layer; it does not perform a HW reset of the controller nor does it reset
+ * the HCI interface.
+ *
+ * Context: Link Layer task (HCI command)
+ *
+ * @return int The ble error code to place in the command complete event that
+ * is returned when this command is issued.
  */
 int
 ble_ll_reset(void)
@@ -1047,7 +1047,7 @@ ble_ll_reset(void)
     ble_ll_flush_pkt_queue(&g_ble_ll_data.ll_rx_pkt_q);
 
     /* Reset LL stats */
-    memset((uint8_t *)&ble_ll_stats + sizeof(struct stats_hdr), 0, 
+    memset((uint8_t *)&ble_ll_stats + sizeof(struct stats_hdr), 0,
            sizeof(struct stats_ble_ll_stats) - sizeof(struct stats_hdr));
 
 #ifdef BLE_LL_LOG
@@ -1074,9 +1074,9 @@ ble_ll_reset(void)
 }
 
 /**
- * Initialize the Link Layer. Should be called only once 
- * 
- * @return int 
+ * Initialize the Link Layer. Should be called only once
+ *
+ * @return int
  */
 int
 ble_ll_init(uint8_t ll_task_prio, uint8_t num_acl_pkts, uint16_t acl_pkt_size)
@@ -1104,7 +1104,7 @@ ble_ll_init(uint8_t ll_task_prio, uint8_t num_acl_pkts, uint16_t acl_pkt_size)
     lldata->ll_tx_pkt_ev.ev_type = BLE_LL_EVENT_TX_PKT_IN;
 
     /* Initialize wait for response timer */
-    cputime_timer_init(&g_ble_ll_data.ll_wfr_timer, ble_ll_wfr_timer_exp, 
+    cputime_timer_init(&g_ble_ll_data.ll_wfr_timer, ble_ll_wfr_timer_exp,
                        NULL);
 
     /* Initialize LL HCI */
@@ -1144,12 +1144,12 @@ ble_ll_init(uint8_t ll_task_prio, uint8_t num_acl_pkts, uint16_t acl_pkt_size)
     lldata->ll_supp_features = features;
 
     /* Initialize the LL task */
-    os_task_init(&g_ble_ll_task, "ble_ll", ble_ll_task, NULL, ll_task_prio, 
+    os_task_init(&g_ble_ll_task, "ble_ll", ble_ll_task, NULL, ll_task_prio,
                  OS_WAIT_FOREVER, g_ble_ll_stack, BLE_LL_STACK_SIZE);
 
-    rc = stats_init_and_reg(STATS_HDR(ble_ll_stats), 
-                            STATS_SIZE_INIT_PARMS(ble_ll_stats, STATS_SIZE_32), 
-                            STATS_NAME_INIT_PARMS(ble_ll_stats), 
+    rc = stats_init_and_reg(STATS_HDR(ble_ll_stats),
+                            STATS_SIZE_INIT_PARMS(ble_ll_stats, STATS_SIZE_32),
+                            STATS_NAME_INIT_PARMS(ble_ll_stats),
                             "ble_ll");
     return rc;
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bfcc17d5/net/nimble/controller/src/ble_ll_adv.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_adv.c b/net/nimble/controller/src/ble_ll_adv.c
index 6d49494..a74d07e 100644
--- a/net/nimble/controller/src/ble_ll_adv.c
+++ b/net/nimble/controller/src/ble_ll_adv.c
@@ -6,7 +6,7 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
@@ -47,11 +47,11 @@
  * that currently.
  */
 
-/* 
- * Advertising state machine 
- * 
+/*
+ * Advertising state machine
+ *
  * The advertising state machine data structure.
- * 
+ *
  *  adv_pdu_len
  *      The length of the advertising PDU that will be sent. This does not
  *      include the preamble, access address and CRC.
@@ -86,18 +86,18 @@ struct ble_ll_adv_sm
 /* The advertising state machine global object */
 struct ble_ll_adv_sm g_ble_ll_adv_sm;
 
-/* 
+/*
  * Worst case time needed for scheduled advertising item. This is the longest
  * possible time to receive a scan request and send a scan response (with the
  * appropriate IFS time between them). This number is calculated using the
  * following formula: IFS + SCAN_REQ + IFS + SCAN_RSP = 150 + 176 + 150 + 376.
  * Note: worst case time to tx adv, rx scan req and send scan rsp is 1228 usecs.
  * This assumes maximum sized advertising PDU and scan response PDU.
- * 
+ *
  * For connectable advertising events no scan request is allowed. In this case
  * we just need to receive a connect request PDU: IFS + CONNECT_REQ = 150 + 352.
  * Note: worst-case is 376 + 150 + 352 = 878 usecs
- * 
+ *
  * NOTE: The advertising PDU transmit time is NOT included here since we know
  * how long that will take (worst-case is 376 usecs).
  */
@@ -105,11 +105,11 @@ struct ble_ll_adv_sm g_ble_ll_adv_sm;
 #define BLE_LL_ADV_DIRECT_SCHED_MAX_USECS   (502)
 
 /**
- * Calculate the first channel that we should advertise upon when we start 
- * an advertising event. 
- * 
- * @param advsm 
- * 
+ * Calculate the first channel that we should advertise upon when we start
+ * an advertising event.
+ *
+ * @param advsm
+ *
  * @return uint8_t The number of the first channel usable for advertising.
  */
 static uint8_t
@@ -130,11 +130,11 @@ ble_ll_adv_first_chan(struct ble_ll_adv_sm *advsm)
 }
 
 /**
- * Compares the advertiser address in an advertising PDU (scan request or 
+ * Compares the advertiser address in an advertising PDU (scan request or
  * connect request) with our address to see if there is a match
- * 
+ *
  * @param rxbuf Pointer to received PDU
- * 
+ *
  * @return int Returns memcmp return values (0 = match).
  */
 static int
@@ -160,8 +160,8 @@ ble_ll_adv_addr_cmp(uint8_t *rxbuf)
 }
 
 /**
- * Create the advertising PDU 
- * 
+ * Create the advertising PDU
+ *
  * @param advsm Pointer to advertisement state machine
  */
 static void
@@ -255,9 +255,9 @@ ble_ll_adv_pdu_make(struct ble_ll_adv_sm *advsm)
 }
 
 /**
- * Create a scan response PDU 
- * 
- * @param advsm 
+ * Create a scan response PDU
+ *
+ * @param advsm
  */
 static void
 ble_ll_adv_scan_rsp_pdu_make(struct ble_ll_adv_sm *advsm)
@@ -309,11 +309,11 @@ ble_ll_adv_scan_rsp_pdu_make(struct ble_ll_adv_sm *advsm)
 
 /**
  * Called to indicate the advertising event is over.
- *  
- * Context: Interrupt 
- * 
- * @param advsm 
- * 
+ *
+ * Context: Interrupt
+ *
+ * @param advsm
+ *
  */
 static void
 ble_ll_adv_tx_done(void *arg)
@@ -329,14 +329,14 @@ ble_ll_adv_tx_done(void *arg)
 }
 
 /**
- * This is the scheduler callback (called from interrupt context) which 
- * transmits an advertisement. 
- *  
- * Context: Interrupt (scheduler) 
- *  
- * @param sch 
- * 
- * @return int 
+ * This is the scheduler callback (called from interrupt context) which
+ * transmits an advertisement.
+ *
+ * Context: Interrupt (scheduler)
+ *
+ * @param sch
+ *
+ * @return int
  */
 static int
 ble_ll_adv_tx_start_cb(struct ble_ll_sched_item *sch)
@@ -425,14 +425,14 @@ ble_ll_adv_set_sched(struct ble_ll_adv_sm *advsm, int sched_new)
         break;
     }
 
-    /* 
+    /*
      * XXX: For now, just schedule some additional time so we insure we have
      * enough time to do everything we want.
      */
     max_usecs += XCVR_PROC_DELAY_USECS;
 
     if (sched_new) {
-        /* 
+        /*
          * We have to add the scheduling delay and tx start delay to the max
          * time of the event since the pdu does not start at the scheduled start.
          */
@@ -440,18 +440,18 @@ ble_ll_adv_set_sched(struct ble_ll_adv_sm *advsm, int sched_new)
         sch->start_time = cputime_get32();
         sch->end_time = sch->start_time + cputime_usecs_to_ticks(max_usecs);
     } else {
-        sch->start_time = advsm->adv_pdu_start_time - 
+        sch->start_time = advsm->adv_pdu_start_time -
             cputime_usecs_to_ticks(XCVR_TX_SCHED_DELAY_USECS);
-        sch->end_time = advsm->adv_pdu_start_time + 
+        sch->end_time = advsm->adv_pdu_start_time +
             cputime_usecs_to_ticks(max_usecs);
     }
 }
 
 /**
- * Called when advertising need to be halted. This normally should not be called 
- * and is only called when a scheduled item executes but advertising is still 
- * running. 
- * 
+ * Called when advertising need to be halted. This normally should not be called
+ * and is only called when a scheduled item executes but advertising is still
+ * running.
+ *
  */
 void
 ble_ll_adv_halt(void)
@@ -460,14 +460,14 @@ ble_ll_adv_halt(void)
 }
 
 /**
- * Called by the HCI command parser when a set advertising parameters command 
- * has been received. 
- *  
- * Context: Link Layer task (HCI command parser) 
- * 
- * @param cmd 
- * 
- * @return int 
+ * Called by the HCI command parser when a set advertising parameters command
+ * has been received.
+ *
+ * Context: Link Layer task (HCI command parser)
+ *
+ * @param cmd
+ *
+ * @return int
  */
 int
 ble_ll_adv_set_adv_params(uint8_t *cmd)
@@ -493,7 +493,7 @@ ble_ll_adv_set_adv_params(uint8_t *cmd)
     adv_itvl_max = le16toh(cmd + 2);
     adv_type = cmd[4];
 
-    /* 
+    /*
      * Get the filter policy now since we will ignore it if we are doing
      * directed advertising
      */
@@ -527,8 +527,8 @@ ble_ll_adv_set_adv_params(uint8_t *cmd)
     }
 
     /* Make sure interval minimum is valid for the advertising type */
-    if ((adv_itvl_min > adv_itvl_max) || (adv_itvl_min < min_itvl) || 
-        (adv_itvl_min > BLE_HCI_ADV_ITVL_MAX) || 
+    if ((adv_itvl_min > adv_itvl_max) || (adv_itvl_min < min_itvl) ||
+        (adv_itvl_min > BLE_HCI_ADV_ITVL_MAX) ||
         (adv_itvl_max > BLE_HCI_ADV_ITVL_MAX)) {
         return BLE_ERR_INV_HCI_CMD_PARMS;
     }
@@ -542,10 +542,10 @@ ble_ll_adv_set_adv_params(uint8_t *cmd)
         return BLE_ERR_INV_HCI_CMD_PARMS;
     }
 
-    /* 
+    /*
      * XXX: return unsupported feature if own is address is not public or
      * static random as we have not implemented non-static random addresses.
-     */ 
+     */
     if (own_addr_type > BLE_HCI_ADV_OWN_ADDR_RANDOM) {
         return BLE_ERR_UNSUPPORTED;
     }
@@ -574,11 +574,11 @@ ble_ll_adv_set_adv_params(uint8_t *cmd)
 }
 
 /**
- * Stop advertising state machine 
- *  
+ * Stop advertising state machine
+ *
  * Context: Link Layer task.
- * 
- * @param advsm 
+ *
+ * @param advsm
  */
 static void
 ble_ll_adv_sm_stop(struct ble_ll_adv_sm *advsm)
@@ -604,28 +604,28 @@ ble_ll_adv_sm_stop(struct ble_ll_adv_sm *advsm)
 }
 
 /**
- * Start the advertising state machine. This is called when the host sends 
- * the "enable advertising" command and is not called again while in the 
- * advertising state. 
- *  
- * Context: Link-layer task. 
- * 
+ * Start the advertising state machine. This is called when the host sends
+ * the "enable advertising" command and is not called again while in the
+ * advertising state.
+ *
+ * Context: Link-layer task.
+ *
  * @param advsm Pointer to advertising state machine
- * 
- * @return int 
+ *
+ * @return int
  */
 static int
 ble_ll_adv_sm_start(struct ble_ll_adv_sm *advsm)
 {
     uint8_t adv_chan;
 
-    /* 
+    /*
      * This is not in the specification. I will reject the command with a
      * command disallowed error if no random address has been sent by the
      * host. All the parameter errors refer to the command
      * parameter (which in this case is just enable or disable) so that
      * is why I chose command disallowed.
-     */ 
+     */
     if (advsm->own_addr_type == BLE_HCI_ADV_OWN_ADDR_RANDOM) {
         if (!ble_ll_is_valid_random_addr(g_random_addr)) {
             return BLE_ERR_CMD_DISALLOWED;
@@ -656,7 +656,7 @@ ble_ll_adv_sm_start(struct ble_ll_adv_sm *advsm)
     adv_chan = ble_ll_adv_first_chan(advsm);
     advsm->adv_chan = adv_chan;
 
-    /* 
+    /*
      * Schedule advertising. We set the initial schedule start and end
      * times to the earliest possible start/end.
      */
@@ -679,7 +679,7 @@ ble_ll_adv_scheduled(uint32_t sch_start)
 
     advsm->adv_pdu_start_time = advsm->adv_event_start_time;
 
-    /* 
+    /*
      * Set the time at which we must end directed, high-duty cycle advertising.
      * Does not matter that we calculate this value if we are not doing high
      * duty cycle advertising.
@@ -689,12 +689,12 @@ ble_ll_adv_scheduled(uint32_t sch_start)
 }
 
 /**
- * Called when the LE HCI command read advertising channel tx power command 
- * has been received. Returns the current advertising transmit power. 
- *  
- * Context: Link Layer task (HCI command parser) 
- * 
- * @return int 
+ * Called when the LE HCI command read advertising channel tx power command
+ * has been received. Returns the current advertising transmit power.
+ *
+ * Context: Link Layer task (HCI command parser)
+ *
+ * @return int
  */
 int
 ble_ll_adv_read_txpwr(uint8_t *rspbuf, uint8_t *rsplen)
@@ -705,13 +705,13 @@ ble_ll_adv_read_txpwr(uint8_t *rspbuf, uint8_t *rsplen)
 }
 
 /**
- * Turn advertising on/off. 
- *  
- * Context: Link Layer task 
- * 
- * @param cmd 
- * 
- * @return int 
+ * Turn advertising on/off.
+ *
+ * Context: Link Layer task
+ *
+ * @param cmd
+ *
+ * @return int
  */
 int
 ble_ll_adv_set_enable(uint8_t *cmd)
@@ -741,11 +741,11 @@ ble_ll_adv_set_enable(uint8_t *cmd)
 
 /**
  * Set the scan response data that the controller will send.
- * 
- * @param cmd 
- * @param len 
- * 
- * @return int 
+ *
+ * @param cmd
+ * @param len
+ *
+ * @return int
  */
 int
 ble_ll_adv_set_scan_rsp_data(uint8_t *cmd, uint8_t len)
@@ -767,10 +767,10 @@ ble_ll_adv_set_scan_rsp_data(uint8_t *cmd, uint8_t len)
 
     /* Re-make the scan response PDU since data may have changed */
     OS_ENTER_CRITICAL(sr);
-    /* 
+    /*
      * XXX: there is a chance, even with interrupts disabled, that
      * we are transmitting the scan response PDU while writing to it.
-     */ 
+     */
     ble_ll_adv_scan_rsp_pdu_make(advsm);
     OS_EXIT_CRITICAL(sr);
 
@@ -778,12 +778,12 @@ ble_ll_adv_set_scan_rsp_data(uint8_t *cmd, uint8_t len)
 }
 
 /**
- * Called by the LL HCI command parser when a set advertising 
- * data command has been sent from the host to the controller. 
- * 
+ * Called by the LL HCI command parser when a set advertising
+ * data command has been sent from the host to the controller.
+ *
  * @param cmd Pointer to command data
  * @param len Length of command data
- * 
+ *
  * @return int 0: success; BLE_ERR_INV_HCI_CMD_PARMS otherwise.
  */
 int
@@ -806,7 +806,7 @@ ble_ll_adv_set_adv_data(uint8_t *cmd, uint8_t len)
 
     /* If the state machine is enabled, we need to re-make the adv PDU */
     if (advsm->enabled) {
-        /* 
+        /*
          * XXX: currently, even with interrupts disabled, there is a chance
          * that we are transmitting the advertising PDU while writing into
          * it.
@@ -821,12 +821,12 @@ ble_ll_adv_set_adv_data(uint8_t *cmd, uint8_t len)
 
 /**
  * Called when the LL receives a scan request or connection request
- *  
- * Context: Called from interrupt context. 
- * 
- * @param rxbuf 
- * 
- * @return -1: request not for us or is a connect request. 
+ *
+ * Context: Called from interrupt context.
+ *
+ * @param rxbuf
+ *
+ * @return -1: request not for us or is a connect request.
  *          0: request (scan) is for us and we successfully went from rx to tx.
  *        > 0: PHY error attempting to go from rx to tx.
  */
@@ -874,7 +874,7 @@ ble_ll_adv_rx_req(uint8_t pdu_type, struct os_mbuf *rxpdu)
     rc = -1;
     if (pdu_type == BLE_ADV_PDU_TYPE_SCAN_REQ) {
         ble_phy_set_txend_cb(ble_ll_adv_tx_done, &g_ble_ll_adv_sm);
-        rc = ble_phy_tx(advsm->scan_rsp_pdu, BLE_PHY_TRANSITION_RX_TX, 
+        rc = ble_phy_tx(advsm->scan_rsp_pdu, BLE_PHY_TRANSITION_RX_TX,
                         BLE_PHY_TRANSITION_NONE);
         if (!rc) {
             ble_hdr->rxinfo.flags |= BLE_MBUF_HDR_F_SCAN_RSP_TXD;
@@ -886,14 +886,14 @@ ble_ll_adv_rx_req(uint8_t pdu_type, struct os_mbuf *rxpdu)
 }
 
 /**
- * Called when a connect request has been received. 
- *  
- * Context: Link Layer 
- * 
- * @param rxbuf 
- * @param flags 
- *  
- * @return 0: no connection started. 1: connection started 
+ * Called when a connect request has been received.
+ *
+ * Context: Link Layer
+ *
+ * @param rxbuf
+ * @param flags
+ *
+ * @return 0: no connection started. 1: connection started
  */
 int
 ble_ll_adv_conn_req_rxd(uint8_t *rxbuf, struct ble_mbuf_hdr *hdr)
@@ -913,9 +913,9 @@ ble_ll_adv_conn_req_rxd(uint8_t *rxbuf, struct ble_mbuf_hdr *hdr)
     } else {
         /* If this is for us? */
         if (!ble_ll_adv_addr_cmp(rxbuf)) {
-            /* 
+            /*
              * Only accept connect requests from the desired address if we
-             * are doing directed advertising 
+             * are doing directed advertising
              */
             if ((advsm->adv_type == BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD) ||
                 (advsm->adv_type == BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_LD)) {
@@ -943,22 +943,22 @@ ble_ll_adv_conn_req_rxd(uint8_t *rxbuf, struct ble_mbuf_hdr *hdr)
 }
 
 /**
- * Called on phy rx pdu end when in advertising state. 
- *  
- * There are only two pdu types we care about in this state: scan requests 
- * and connection requests. When we receive a scan request we must determine if 
+ * Called on phy rx pdu end when in advertising state.
+ *
+ * There are only two pdu types we care about in this state: scan requests
+ * and connection requests. When we receive a scan request we must determine if
  * we need to send a scan response and that needs to be acted on within T_IFS.
- *  
- * When we receive a connection request, we need to determine if we will allow 
- * this device to start a connection with us. However, no immediate response is 
- * sent so we handle this at the link layer task. 
- * 
- * Context: Interrupt 
- *  
+ *
+ * When we receive a connection request, we need to determine if we will allow
+ * this device to start a connection with us. However, no immediate response is
+ * sent so we handle this at the link layer task.
+ *
+ * Context: Interrupt
+ *
  * @param pdu_type Type of pdu received.
  * @param rxpdu Pointer to received PDU
- *  
- * @return int 
+ *
+ * @return int
  *       < 0: Disable the phy after reception.
  *      == 0: Do not disable the PHY
  *       > 0: Do not disable PHY as that has already been done.
@@ -989,24 +989,24 @@ ble_ll_adv_rx_isr_end(uint8_t pdu_type, struct os_mbuf *rxpdu, int crcok)
 }
 
 /**
- * Process a received packet at the link layer task when in the advertising 
- * state 
- *  
- * Context: Link Layer 
- * 
- * 
- * @param ptype 
- * @param rxbuf 
- * @param hdr 
- * 
- * @return int 
+ * Process a received packet at the link layer task when in the advertising
+ * state
+ *
+ * Context: Link Layer
+ *
+ *
+ * @param ptype
+ * @param rxbuf
+ * @param hdr
+ *
+ * @return int
  */
 void
 ble_ll_adv_rx_pkt_in(uint8_t ptype, uint8_t *rxbuf, struct ble_mbuf_hdr *hdr)
 {
     int adv_event_over;
 
-    /* 
+    /*
      * If we have received a scan request and we are transmitting a response
      * or we have received a valid connect request, dont "end" the advertising
      * event. In the case of a connect request we will stop advertising. In
@@ -1033,14 +1033,14 @@ ble_ll_adv_rx_pkt_in(uint8_t ptype, uint8_t *rxbuf, struct ble_mbuf_hdr *hdr)
 }
 
 /**
- * Called when a receive PDU has started and we are advertising. 
- *  
- * Context: interrupt 
- * 
- * @param pdu_type 
- * @param rxpdu 
- * 
- * @return int 
+ * Called when a receive PDU has started and we are advertising.
+ *
+ * Context: interrupt
+ *
+ * @param pdu_type
+ * @param rxpdu
+ *
+ * @return int
  *   < 0: A frame we dont want to receive.
  *   = 0: Continue to receive frame. Dont go from rx to tx
  *   > 0: Continue to receive frame and go from rx to tx when done
@@ -1058,22 +1058,22 @@ ble_ll_adv_rx_isr_start(uint8_t pdu_type)
     advsm = &g_ble_ll_adv_sm;
     if (pdu_type == BLE_ADV_PDU_TYPE_SCAN_REQ) {
         /* Only accept scan requests if we are indirect adv or scan adv */
-        if ((advsm->adv_type == BLE_HCI_ADV_TYPE_ADV_SCAN_IND) || 
+        if ((advsm->adv_type == BLE_HCI_ADV_TYPE_ADV_SCAN_IND) ||
             (advsm->adv_type == BLE_HCI_ADV_TYPE_ADV_IND)) {
             rc = 1;
-        } 
+        }
     } else {
         /* Only accept connect requests if connectable advertising event */
         if (pdu_type == BLE_ADV_PDU_TYPE_CONNECT_REQ) {
-            if ((advsm->adv_type == BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD) || 
+            if ((advsm->adv_type == BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD) ||
                 (advsm->adv_type == BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_LD) ||
                 (advsm->adv_type == BLE_HCI_ADV_TYPE_ADV_IND)) {
                 rc = 0;
-            } 
+            }
         }
     }
 
-    /* 
+    /*
      * If we abort the frame, we need to post the LL task to check if the
      * advertising event is over.
      */
@@ -1086,9 +1086,9 @@ ble_ll_adv_rx_isr_start(uint8_t pdu_type)
 
 /**
  * Called when an advertising event is over.
- *  
- * Context: Link Layer task. 
- * 
+ *
+ * Context: Link Layer task.
+ *
  * @param arg Pointer to advertising state machine.
  */
 void
@@ -1109,7 +1109,7 @@ ble_ll_adv_event_done(void *arg)
     ble_ll_sched_rmv_elem(&advsm->adv_sch);
     os_eventq_remove(&g_ble_ll_data.ll_evq, &advsm->adv_txdone_ev);
 
-    /* 
+    /*
      * Check if we have ended our advertising event. If our last advertising
      * packet was sent on the last channel, it means we are done with this
      * event.
@@ -1137,11 +1137,11 @@ ble_ll_adv_event_done(void *arg)
         advsm->adv_event_start_time += cputime_usecs_to_ticks(itvl);
         advsm->adv_pdu_start_time = advsm->adv_event_start_time;
 
-        /* 
+        /*
          * The scheduled time better be in the future! If it is not, we will
          * just keep advancing until we the time is in the future
          */
-        start_time = advsm->adv_pdu_start_time - 
+        start_time = advsm->adv_pdu_start_time -
             cputime_usecs_to_ticks(XCVR_TX_SCHED_DELAY_USECS);
 
         delta_t = (int32_t)(start_time - cputime_get32());
@@ -1159,7 +1159,7 @@ ble_ll_adv_event_done(void *arg)
             }
         }
     } else {
-        /* 
+        /*
          * Move to next advertising channel. If not in the mask, just
          * increment by 1. We can do this because we already checked if we
          * just transmitted on the last advertising channel
@@ -1170,18 +1170,18 @@ ble_ll_adv_event_done(void *arg)
             ++advsm->adv_chan;
         }
 
-        /* 
+        /*
          * We will transmit right away. Set next pdu start time to now
          * plus a xcvr start delay just so we dont count late adv starts
-         */ 
-        advsm->adv_pdu_start_time = cputime_get32() + 
+         */
+        advsm->adv_pdu_start_time = cputime_get32() +
             cputime_usecs_to_ticks(XCVR_TX_SCHED_DELAY_USECS);
     }
 
-    /* 
+    /*
      * Stop high duty cycle directed advertising if we have been doing
      * it for more than 1.28 seconds
-     */ 
+     */
     if (advsm->adv_type == BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD) {
         if (advsm->adv_pdu_start_time >= advsm->adv_dir_hd_end_time) {
             /* Disable advertising */
@@ -1195,20 +1195,20 @@ ble_ll_adv_event_done(void *arg)
     /* Schedule advertising transmit */
     ble_ll_adv_set_sched(advsm, 0);
 
-    /* 
+    /*
      * In the unlikely event we cant reschedule this, just post a done
      * event and we will reschedule the next advertising event
-     */ 
+     */
     if (ble_ll_sched_adv_reschedule(&advsm->adv_sch)) {
         os_eventq_put(&g_ble_ll_data.ll_evq, &advsm->adv_txdone_ev);
     }
 }
 
 /**
- * Checks if the controller can change the whitelist. If advertising is enabled 
- * and is using the whitelist the controller is not allowed to change the 
- * whitelist. 
- * 
+ * Checks if the controller can change the whitelist. If advertising is enabled
+ * and is using the whitelist the controller is not allowed to change the
+ * whitelist.
+ *
  * @return int 0: not allowed to change whitelist; 1: change allowed.
  */
 int
@@ -1228,9 +1228,9 @@ ble_ll_adv_can_chg_whitelist(void)
 }
 
 /**
- * Called when the LL wait for response timer expires while in the advertising 
- * state. Disables the phy and 
- * 
+ * Called when the LL wait for response timer expires while in the advertising
+ * state. Disables the phy and
+ *
  */
 void
 ble_ll_adv_wfr_timer_exp(void)
@@ -1240,10 +1240,10 @@ ble_ll_adv_wfr_timer_exp(void)
 }
 
 /**
- * Reset the advertising state machine. 
- *  
- * Context: Link Layer task 
- * 
+ * Reset the advertising state machine.
+ *
+ * Context: Link Layer task
+ *
  */
 void
 ble_ll_adv_reset(void)
@@ -1270,7 +1270,7 @@ ble_ll_adv_enabled(void)
 }
 
 /**
- * Initialize the advertising functionality of a BLE device. This should 
+ * Initialize the advertising functionality of a BLE device. This should
  * be called once on initialization
  */
 void
@@ -1291,12 +1291,12 @@ ble_ll_adv_init(void)
     advsm->adv_txdone_ev.ev_arg = advsm;
 
     /* Get an advertising mbuf (packet header) and attach to state machine */
-    advsm->adv_pdu = os_msys_get_pkthdr(BLE_MBUF_PAYLOAD_SIZE, 
+    advsm->adv_pdu = os_msys_get_pkthdr(BLE_MBUF_PAYLOAD_SIZE,
                                         sizeof(struct ble_mbuf_hdr));
     assert(advsm->adv_pdu != NULL);
 
     /* Get a scan response mbuf (packet header) and attach to state machine */
-    advsm->scan_rsp_pdu = os_msys_get_pkthdr(BLE_MBUF_PAYLOAD_SIZE, 
+    advsm->scan_rsp_pdu = os_msys_get_pkthdr(BLE_MBUF_PAYLOAD_SIZE,
                                              sizeof(struct ble_mbuf_hdr));
     assert(advsm->scan_rsp_pdu != NULL);
 }