http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/src/ble_ibeacon.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_ibeacon.c 
b/net/nimble/host/src/ble_ibeacon.c
index a12731f..2deb854 100644
--- a/net/nimble/host/src/ble_ibeacon.c
+++ b/net/nimble/host/src/ble_ibeacon.c
@@ -56,8 +56,8 @@ ble_ibeacon_set_adv_data(void *uuid128, uint16_t major, 
uint16_t minor)
     memcpy(buf + 4, uuid128, 16);
 
     /** Version number. */
-    htobe16(buf + 20, major);
-    htobe16(buf + 22, minor);
+    put_be16(buf + 20, major);
+    put_be16(buf + 22, minor);
 
     /** Last byte (tx power level) filled in after HCI exchange. */
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/src/ble_l2cap.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap.c b/net/nimble/host/src/ble_l2cap.c
index 7f66b57..fc8ecb9 100644
--- a/net/nimble/host/src/ble_l2cap.c
+++ b/net/nimble/host/src/ble_l2cap.c
@@ -113,8 +113,8 @@ ble_l2cap_parse_hdr(struct os_mbuf *om, int off,
         return BLE_HS_EMSGSIZE;
     }
 
-    l2cap_hdr->blh_len = le16toh(&l2cap_hdr->blh_len);
-    l2cap_hdr->blh_cid = le16toh(&l2cap_hdr->blh_cid);
+    l2cap_hdr->blh_len = get_le16(&l2cap_hdr->blh_len);
+    l2cap_hdr->blh_cid = get_le16(&l2cap_hdr->blh_cid);
 
     return 0;
 }
@@ -124,8 +124,8 @@ ble_l2cap_prepend_hdr(struct os_mbuf *om, uint16_t cid, 
uint16_t len)
 {
     struct ble_l2cap_hdr hdr;
 
-    htole16(&hdr.blh_len, len);
-    htole16(&hdr.blh_cid, cid);
+    put_le16(&hdr.blh_len, len);
+    put_le16(&hdr.blh_cid, cid);
 
     om = os_mbuf_prepend_pullup(om, sizeof hdr);
     if (om == NULL) {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/src/ble_sm_alg.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_sm_alg.c b/net/nimble/host/src/ble_sm_alg.c
index f8208b4..b850f24 100644
--- a/net/nimble/host/src/ble_sm_alg.c
+++ b/net/nimble/host/src/ble_sm_alg.c
@@ -405,7 +405,7 @@ ble_sm_alg_g2(uint8_t *u, uint8_t *v, uint8_t *x, uint8_t 
*y,
 
     ble_sm_alg_log_buf("res", xs, 16);
 
-    *passkey = be32toh(xs + 12) % 1000000;
+    *passkey = get_be32(xs + 12) % 1000000;
     BLE_HS_LOG(DEBUG, "    passkey=%u\n", *passkey);
 
     return 0;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/src/ble_sm_cmd.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_sm_cmd.c b/net/nimble/host/src/ble_sm_cmd.c
index 67fa1b0..99fec05 100644
--- a/net/nimble/host/src/ble_sm_cmd.c
+++ b/net/nimble/host/src/ble_sm_cmd.c
@@ -360,8 +360,8 @@ ble_sm_master_id_parse(void *payload, int len, struct 
ble_sm_master_id *cmd)
 
     u8ptr = payload;
 
-    cmd->ediv = le16toh(u8ptr);
-    cmd->rand_val = le64toh(u8ptr + 2);
+    cmd->ediv = get_le16(u8ptr);
+    cmd->rand_val = get_le64(u8ptr + 2);
 }
 
 void
@@ -374,8 +374,8 @@ ble_sm_master_id_write(void *payload, int len, struct 
ble_sm_master_id *cmd)
     u8ptr = payload;
 
     u8ptr[0] = BLE_SM_OP_MASTER_ID;
-    htole16(u8ptr + 1, cmd->ediv);
-    htole64(u8ptr + 3, cmd->rand_val);
+    put_le16(u8ptr + 1, cmd->ediv);
+    put_le64(u8ptr + 3, cmd->rand_val);
 }
 
 int
@@ -390,8 +390,8 @@ ble_sm_master_id_tx(uint16_t conn_handle, struct 
ble_sm_master_id *cmd)
     }
 
     txom->om_data[0] = BLE_SM_OP_MASTER_ID;
-    htole16(txom->om_data + 1, cmd->ediv);
-    htole64(txom->om_data + 3, cmd->rand_val);
+    put_le16(txom->om_data + 1, cmd->ediv);
+    put_le64(txom->om_data + 3, cmd->rand_val);
 
     BLE_SM_LOG_CMD(1, "master id", conn_handle, ble_sm_master_id_log, cmd);
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/src/ble_uuid.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_uuid.c b/net/nimble/host/src/ble_uuid.c
index 2399018..0a58a1a 100644
--- a/net/nimble/host/src/ble_uuid.c
+++ b/net/nimble/host/src/ble_uuid.c
@@ -55,11 +55,11 @@ ble_uuid_init_from_buf(ble_uuid_any_t *uuid, const void 
*buf, size_t len)
     switch (len) {
     case 2:
         uuid->u.type = BLE_UUID_TYPE_16;
-        uuid->u16.value = le16toh(buf);
+        uuid->u16.value = get_le16(buf);
         return 0;
     case 4:
         uuid->u.type = BLE_UUID_TYPE_32;
-        uuid->u32.value = le32toh(buf);
+        uuid->u32.value = get_le32(buf);
         return 0;
     case 16:
         uuid->u.type = BLE_UUID_TYPE_128;
@@ -199,11 +199,11 @@ ble_uuid_flat(const ble_uuid_t *uuid, void *dst)
 
     switch (uuid->type) {
     case BLE_UUID_TYPE_16:
-        htole16(dst, BLE_UUID16(uuid)->value);
+        put_le16(dst, BLE_UUID16(uuid)->value);
         break;
     case BLE_UUID_TYPE_32:
         memcpy(dst, ble_uuid_base, 16);
-        htole32(dst + 12, BLE_UUID32(uuid)->value);
+        put_le32(dst + 12, BLE_UUID32(uuid)->value);
         break;
     case BLE_UUID_TYPE_128:
         memcpy(dst, BLE_UUID128(uuid)->value, 16);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/test/src/ble_att_clt_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_att_clt_test.c 
b/net/nimble/host/test/src/ble_att_clt_test.c
index c34df53..3728557 100644
--- a/net/nimble/host/test/src/ble_att_clt_test.c
+++ b/net/nimble/host/test/src/ble_att_clt_test.c
@@ -126,7 +126,7 @@ TEST_CASE(ble_att_clt_test_rx_find_info)
     ble_att_find_info_rsp_write(buf + off, sizeof buf - off, &rsp);
     off += BLE_ATT_FIND_INFO_RSP_BASE_SZ;
 
-    htole16(buf + off, 1);
+    put_le16(buf + off, 1);
     off += 2;
     memcpy(buf + off, uuid128_1, 16);
     off += 16;
@@ -142,9 +142,9 @@ TEST_CASE(ble_att_clt_test_rx_find_info)
     ble_att_find_info_rsp_write(buf + off, sizeof buf - off, &rsp);
     off += BLE_ATT_FIND_INFO_RSP_BASE_SZ;
 
-    htole16(buf + off, 2);
+    put_le16(buf + off, 2);
     off += 2;
-    htole16(buf + off, 0x000f);
+    put_le16(buf + off, 0x000f);
     off += 2;
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn_handle, BLE_L2CAP_CID_ATT,
@@ -158,14 +158,14 @@ TEST_CASE(ble_att_clt_test_rx_find_info)
     ble_att_find_info_rsp_write(buf + off, sizeof buf - off, &rsp);
     off += BLE_ATT_FIND_INFO_RSP_BASE_SZ;
 
-    htole16(buf + off, 3);
+    put_le16(buf + off, 3);
     off += 2;
-    htole16(buf + off, 0x0010);
+    put_le16(buf + off, 0x0010);
     off += 2;
 
-    htole16(buf + off, 4);
+    put_le16(buf + off, 4);
     off += 2;
-    htole16(buf + off, 0x0011);
+    put_le16(buf + off, 0x0011);
     off += 2;
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn_handle, BLE_L2CAP_CID_ATT,
@@ -407,8 +407,8 @@ TEST_CASE(ble_att_clt_test_tx_read_mult)
     TEST_ASSERT(om->om_len == BLE_ATT_READ_MULT_REQ_BASE_SZ + 4);
 
     ble_att_read_mult_req_parse(om->om_data, om->om_len);
-    TEST_ASSERT(le16toh(om->om_data + BLE_ATT_READ_MULT_REQ_BASE_SZ) == 1);
-    TEST_ASSERT(le16toh(om->om_data + BLE_ATT_READ_MULT_REQ_BASE_SZ + 2) == 2);
+    TEST_ASSERT(get_le16(om->om_data + BLE_ATT_READ_MULT_REQ_BASE_SZ) == 1);
+    TEST_ASSERT(get_le16(om->om_data + BLE_ATT_READ_MULT_REQ_BASE_SZ + 2) == 
2);
 
     /*** Error: no handles. */
     rc = ble_att_clt_tx_read_mult(conn_handle, NULL, 0);
@@ -425,7 +425,7 @@ TEST_CASE(ble_att_clt_test_rx_read_mult)
 
     /*** Basic success. */
     ble_att_read_mult_rsp_write(buf, sizeof buf);
-    htole16(buf + BLE_ATT_READ_MULT_RSP_BASE_SZ + 0, 12);
+    put_le16(buf + BLE_ATT_READ_MULT_RSP_BASE_SZ + 0, 12);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(
         conn_handle, BLE_L2CAP_CID_ATT, buf,
@@ -433,9 +433,9 @@ TEST_CASE(ble_att_clt_test_rx_read_mult)
     TEST_ASSERT(rc == 0);
 
     /*** Larger response. */
-    htole16(buf + BLE_ATT_READ_MULT_RSP_BASE_SZ + 0, 12);
-    htole16(buf + BLE_ATT_READ_MULT_RSP_BASE_SZ + 2, 43);
-    htole16(buf + BLE_ATT_READ_MULT_RSP_BASE_SZ + 4, 91);
+    put_le16(buf + BLE_ATT_READ_MULT_RSP_BASE_SZ + 0, 12);
+    put_le16(buf + BLE_ATT_READ_MULT_RSP_BASE_SZ + 2, 43);
+    put_le16(buf + BLE_ATT_READ_MULT_RSP_BASE_SZ + 4, 91);
     rc = ble_hs_test_util_l2cap_rx_payload_flat(
         conn_handle, BLE_L2CAP_CID_ATT, buf,
         BLE_ATT_READ_MULT_RSP_BASE_SZ + 6);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/test/src/ble_att_svr_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_att_svr_test.c 
b/net/nimble/host/test/src/ble_att_svr_test.c
index 839b2b4..8ee9bc6 100644
--- a/net/nimble/host/test/src/ble_att_svr_test.c
+++ b/net/nimble/host/test/src/ble_att_svr_test.c
@@ -480,13 +480,13 @@ ble_att_svr_test_misc_verify_tx_find_type_value_rsp(
     for (entry = entries; entry->first != 0; entry++) {
         rc = os_mbuf_copydata(om, off, 2, &u16);
         TEST_ASSERT(rc == 0);
-        htole16(&u16, u16);
+        put_le16(&u16, u16);
         TEST_ASSERT(u16 == entry->first);
         off += 2;
 
         rc = os_mbuf_copydata(om, off, 2, &u16);
         TEST_ASSERT(rc == 0);
-        htole16(&u16, u16);
+        put_le16(&u16, u16);
         TEST_ASSERT(u16 == entry->last);
         off += 2;
     }
@@ -529,7 +529,7 @@ ble_att_svr_test_misc_verify_tx_read_type_rsp(
 
         rc = os_mbuf_copydata(om, off, 2, &handle);
         TEST_ASSERT(rc == 0);
-        handle = le16toh(&handle);
+        handle = get_le16(&handle);
         TEST_ASSERT(handle == entry->handle);
         off += 2;
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/test/src/ble_gap_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_gap_test.c 
b/net/nimble/host/test/src/ble_gap_test.c
index d41ae74..7b3dd54 100644
--- a/net/nimble/host/test/src/ble_gap_test.c
+++ b/net/nimble/host/test/src/ble_gap_test.c
@@ -181,8 +181,8 @@ ble_gap_test_util_verify_tx_set_scan_params(uint8_t 
own_addr_type,
                                            &param_len);
     TEST_ASSERT(param_len == BLE_HCI_SET_SCAN_PARAM_LEN);
     TEST_ASSERT(param[0] == scan_type);
-    TEST_ASSERT(le16toh(param + 1) == itvl);
-    TEST_ASSERT(le16toh(param + 3) == scan_window);
+    TEST_ASSERT(get_le16(param + 1) == itvl);
+    TEST_ASSERT(get_le16(param + 3) == scan_window);
     TEST_ASSERT(param[5] == own_addr_type);
     TEST_ASSERT(param[6] == filter_policy);
 }
@@ -223,7 +223,7 @@ ble_gap_test_util_verify_tx_disconnect(void)
                                            BLE_HCI_OCF_DISCONNECT_CMD,
                                            &param_len);
     TEST_ASSERT(param_len == BLE_HCI_DISCONNECT_CMD_LEN);
-    TEST_ASSERT(le16toh(param + 0) == 2);
+    TEST_ASSERT(get_le16(param + 0) == 2);
     TEST_ASSERT(param[2] == BLE_ERR_REM_USER_CONN_TERM);
 }
 
@@ -286,13 +286,13 @@ ble_gap_test_util_verify_tx_update_conn(struct 
ble_gap_upd_params *params)
                                            BLE_HCI_OCF_LE_CONN_UPDATE,
                                            &param_len);
     TEST_ASSERT(param_len == BLE_HCI_CONN_UPDATE_LEN);
-    TEST_ASSERT(le16toh(param + 0) == 2);
-    TEST_ASSERT(le16toh(param + 2) == params->itvl_min);
-    TEST_ASSERT(le16toh(param + 4) == params->itvl_max);
-    TEST_ASSERT(le16toh(param + 6) == params->latency);
-    TEST_ASSERT(le16toh(param + 8) == params->supervision_timeout);
-    TEST_ASSERT(le16toh(param + 10) == params->min_ce_len);
-    TEST_ASSERT(le16toh(param + 12) == params->max_ce_len);
+    TEST_ASSERT(get_le16(param + 0) == 2);
+    TEST_ASSERT(get_le16(param + 2) == params->itvl_min);
+    TEST_ASSERT(get_le16(param + 4) == params->itvl_max);
+    TEST_ASSERT(get_le16(param + 6) == params->latency);
+    TEST_ASSERT(get_le16(param + 8) == params->supervision_timeout);
+    TEST_ASSERT(get_le16(param + 10) == params->min_ce_len);
+    TEST_ASSERT(get_le16(param + 12) == params->max_ce_len);
 }
 
 static void
@@ -305,15 +305,15 @@ ble_gap_test_util_verify_tx_params_reply_pos(void)
                                            BLE_HCI_OCF_LE_REM_CONN_PARAM_RR,
                                            &param_len);
     TEST_ASSERT(param_len == BLE_HCI_CONN_PARAM_REPLY_LEN);
-    TEST_ASSERT(le16toh(param + 0) == 2);
-    TEST_ASSERT(le16toh(param + 2) == ble_gap_test_conn_self_params.itvl_min);
-    TEST_ASSERT(le16toh(param + 4) == ble_gap_test_conn_self_params.itvl_max);
-    TEST_ASSERT(le16toh(param + 6) == ble_gap_test_conn_self_params.latency);
-    TEST_ASSERT(le16toh(param + 8) ==
+    TEST_ASSERT(get_le16(param + 0) == 2);
+    TEST_ASSERT(get_le16(param + 2) == ble_gap_test_conn_self_params.itvl_min);
+    TEST_ASSERT(get_le16(param + 4) == ble_gap_test_conn_self_params.itvl_max);
+    TEST_ASSERT(get_le16(param + 6) == ble_gap_test_conn_self_params.latency);
+    TEST_ASSERT(get_le16(param + 8) ==
                 ble_gap_test_conn_self_params.supervision_timeout);
-    TEST_ASSERT(le16toh(param + 10) ==
+    TEST_ASSERT(get_le16(param + 10) ==
                 ble_gap_test_conn_self_params.min_ce_len);
-    TEST_ASSERT(le16toh(param + 12) ==
+    TEST_ASSERT(get_le16(param + 12) ==
                 ble_gap_test_conn_self_params.max_ce_len);
 }
 
@@ -327,7 +327,7 @@ ble_gap_test_util_verify_tx_params_reply_neg(uint8_t reason)
                                            BLE_HCI_OCF_LE_REM_CONN_PARAM_NRR,
                                            &param_len);
     TEST_ASSERT(param_len == BLE_HCI_CONN_PARAM_NEG_REPLY_LEN);
-    TEST_ASSERT(le16toh(param + 0) == 2);
+    TEST_ASSERT(get_le16(param + 0) == 2);
     TEST_ASSERT(param[2] == reason);
 }
 
@@ -1533,8 +1533,8 @@ ble_gap_test_util_adv_verify_dflt_params(uint8_t 
own_addr_type,
     TEST_ASSERT_FATAL(hci_buf != NULL);
     TEST_ASSERT_FATAL(hci_param_len == BLE_HCI_SET_ADV_PARAM_LEN);
 
-    hci_cmd.adv_itvl_min = le16toh(hci_buf + 0);
-    hci_cmd.adv_itvl_max = le16toh(hci_buf + 2);
+    hci_cmd.adv_itvl_min = get_le16(hci_buf + 0);
+    hci_cmd.adv_itvl_max = get_le16(hci_buf + 2);
     hci_cmd.adv_type = hci_buf[4];
     hci_cmd.own_addr_type = hci_buf[5];
     hci_cmd.peer_addr_type = hci_buf[6];

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/test/src/ble_gatt_disc_c_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_gatt_disc_c_test.c 
b/net/nimble/host/test/src/ble_gatt_disc_c_test.c
index 7ecb48e..1752247 100644
--- a/net/nimble/host/test/src/ble_gatt_disc_c_test.c
+++ b/net/nimble/host/test/src/ble_gatt_disc_c_test.c
@@ -101,13 +101,13 @@ ble_gatt_disc_c_test_misc_rx_rsp_once(
             }
         }
 
-        htole16(buf + off, chars[i].def_handle);
+        put_le16(buf + off, chars[i].def_handle);
         off += 2;
 
         buf[off] = chars[i].properties;
         off++;
 
-        htole16(buf + off, chars[i].val_handle);
+        put_le16(buf + off, chars[i].val_handle);
         off += 2;
 
         ble_uuid_flat(chars[i].uuid, buf + off);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/test/src/ble_gatt_disc_d_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_gatt_disc_d_test.c 
b/net/nimble/host/test/src/ble_gatt_disc_d_test.c
index ce3fc4e..0b3dcc6 100644
--- a/net/nimble/host/test/src/ble_gatt_disc_d_test.c
+++ b/net/nimble/host/test/src/ble_gatt_disc_d_test.c
@@ -98,7 +98,7 @@ ble_gatt_disc_d_test_misc_rx_rsp_once(
             break;
         }
 
-        htole16(buf + off, dscs[i].dsc_handle);
+        put_le16(buf + off, dscs[i].dsc_handle);
         off += 2;
 
         ble_uuid_flat(&dscs[i].dsc_uuid.u, buf + off);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/test/src/ble_gatt_disc_s_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_gatt_disc_s_test.c 
b/net/nimble/host/test/src/ble_gatt_disc_s_test.c
index 8c8bf9a..0d75b6d 100644
--- a/net/nimble/host/test/src/ble_gatt_disc_s_test.c
+++ b/net/nimble/host/test/src/ble_gatt_disc_s_test.c
@@ -101,10 +101,10 @@ ble_gatt_disc_s_test_misc_rx_all_rsp_once(
             }
         }
 
-        htole16(buf + off, services[i].start_handle);
+        put_le16(buf + off, services[i].start_handle);
         off += 2;
 
-        htole16(buf + off, services[i].end_handle);
+        put_le16(buf + off, services[i].end_handle);
         off += 2;
 
         ble_uuid_flat(services[i].uuid, buf + off);
@@ -169,10 +169,10 @@ ble_gatt_disc_s_test_misc_rx_uuid_rsp_once(
             break;
         }
 
-        htole16(buf + off, services[i].start_handle);
+        put_le16(buf + off, services[i].start_handle);
         off += 2;
 
-        htole16(buf + off, services[i].end_handle);
+        put_le16(buf + off, services[i].end_handle);
         off += 2;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/test/src/ble_gatt_find_s_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_gatt_find_s_test.c 
b/net/nimble/host/test/src/ble_gatt_find_s_test.c
index d8834f4..e6e0441 100644
--- a/net/nimble/host/test/src/ble_gatt_find_s_test.c
+++ b/net/nimble/host/test/src/ble_gatt_find_s_test.c
@@ -118,17 +118,17 @@ ble_gatt_find_s_test_misc_rx_read_type(
 
         TEST_ASSERT_FATAL(off + rsp.batp_length <= sizeof buf);
 
-        htole16(buf + off, entries[i].inc_handle);
+        put_le16(buf + off, entries[i].inc_handle);
         off += 2;
 
-        htole16(buf + off, entries[i].start_handle);
+        put_le16(buf + off, entries[i].start_handle);
         off += 2;
 
-        htole16(buf + off, entries[i].end_handle);
+        put_le16(buf + off, entries[i].end_handle);
         off += 2;
 
         if (entries[i].uuid->type == BLE_UUID_TYPE_16) {
-            htole16(buf + off, ble_uuid_u16(entries[i].uuid));
+            put_le16(buf + off, ble_uuid_u16(entries[i].uuid));
             off += 2;
         }
     }
@@ -182,7 +182,7 @@ ble_gatt_find_s_test_misc_verify_tx_read_type(uint16_t 
start_handle,
     TEST_ASSERT(req.batq_start_handle == start_handle);
     TEST_ASSERT(req.batq_end_handle == end_handle);
     TEST_ASSERT(om->om_len == BLE_ATT_READ_TYPE_REQ_BASE_SZ + 2);
-    uuid16 = le16toh(om->om_data + BLE_ATT_READ_TYPE_REQ_BASE_SZ);
+    uuid16 = get_le16(om->om_data + BLE_ATT_READ_TYPE_REQ_BASE_SZ);
     TEST_ASSERT(uuid16 == BLE_ATT_UUID_INCLUDE);
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/test/src/ble_gatt_read_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_gatt_read_test.c 
b/net/nimble/host/test/src/ble_gatt_read_test.c
index 54c8a56..835e256 100644
--- a/net/nimble/host/test/src/ble_gatt_read_test.c
+++ b/net/nimble/host/test/src/ble_gatt_read_test.c
@@ -225,7 +225,7 @@ ble_gatt_read_test_misc_uuid_rx_rsp_good(
         }
         prev_len = attrs[i].value_len;
 
-        htole16(buf + off, attrs[i].handle);
+        put_le16(buf + off, attrs[i].handle);
         off += 2;
 
         memcpy(buf + off, attrs[i].value, attrs[i].value_len);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/test/src/ble_gatts_notify_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_gatts_notify_test.c 
b/net/nimble/host/test/src/ble_gatts_notify_test.c
index 21f1afb..995520b 100644
--- a/net/nimble/host/test/src/ble_gatts_notify_test.c
+++ b/net/nimble/host/test/src/ble_gatts_notify_test.c
@@ -121,7 +121,7 @@ ble_gatts_notify_test_misc_read_notify(uint16_t conn_handle,
     TEST_ASSERT_FATAL(om->om_len == 3);
     TEST_ASSERT_FATAL(om->om_data[0] == BLE_ATT_OP_READ_RSP);
 
-    flags = le16toh(om->om_data + 1);
+    flags = get_le16(om->om_data + 1);
     return flags;
 }
 
@@ -137,7 +137,7 @@ ble_gatts_notify_test_misc_try_enable_notify(uint16_t 
conn_handle,
     req.bawq_handle = chr_def_handle + 2;
     ble_att_write_req_write(buf, sizeof buf, &req);
 
-    htole16(buf + BLE_ATT_WRITE_REQ_BASE_SZ, flags);
+    put_le16(buf + BLE_ATT_WRITE_REQ_BASE_SZ, flags);
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn_handle, BLE_L2CAP_CID_ATT,
                                                 buf, sizeof buf);
     if (fail) {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/test/src/ble_hs_adv_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_hs_adv_test.c 
b/net/nimble/host/test/src/ble_hs_adv_test.c
index b441a84..0a06374 100644
--- a/net/nimble/host/test/src/ble_hs_adv_test.c
+++ b/net/nimble/host/test/src/ble_hs_adv_test.c
@@ -33,7 +33,7 @@ ble_hs_adv_test_misc_verify_tx_adv_data_hdr(uint8_t *cmd, int 
data_len)
 {
     uint16_t opcode;
 
-    opcode = le16toh(cmd + 0);
+    opcode = get_le16(cmd + 0);
     TEST_ASSERT(BLE_HCI_OGF(opcode) == BLE_HCI_OGF_LE);
     TEST_ASSERT(BLE_HCI_OCF(opcode) == BLE_HCI_OCF_LE_SET_ADV_DATA);
 
@@ -46,7 +46,7 @@ ble_hs_adv_test_misc_verify_tx_rsp_data_hdr(uint8_t *cmd, int 
data_len)
 {
     uint16_t opcode;
 
-    opcode = le16toh(cmd + 0);
+    opcode = get_le16(cmd + 0);
     TEST_ASSERT(BLE_HCI_OGF(opcode) == BLE_HCI_OGF_LE);
     TEST_ASSERT(BLE_HCI_OCF(opcode) == BLE_HCI_OCF_LE_SET_SCAN_RSP_DATA);
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/test/src/ble_hs_hci_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_hs_hci_test.c 
b/net/nimble/host/test/src/ble_hs_hci_test.c
index 6d51346..67dadce 100644
--- a/net/nimble/host/test/src/ble_hs_hci_test.c
+++ b/net/nimble/host/test/src/ble_hs_hci_test.c
@@ -53,7 +53,7 @@ TEST_CASE(ble_hs_hci_test_rssi)
 
     /*** Success. */
     /* Connection handle. */
-    htole16(params + 0, 1);
+    put_le16(params + 0, 1);
 
     /* RSSI. */
     params[2] = -8;
@@ -65,7 +65,7 @@ TEST_CASE(ble_hs_hci_test_rssi)
     TEST_ASSERT(rssi == -8);
 
     /*** Failure: incorrect connection handle. */
-    htole16(params + 0, 99);
+    put_le16(params + 0, 99);
 
     ble_hs_test_util_set_ack_params(opcode, 0, params, sizeof params);
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/test/src/ble_hs_test_util.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_hs_test_util.c 
b/net/nimble/host/test/src/ble_hs_test_util.c
index aa3b97d..919ec9b 100644
--- a/net/nimble/host/test/src/ble_hs_test_util.c
+++ b/net/nimble/host/test/src/ble_hs_test_util.c
@@ -268,7 +268,7 @@ ble_hs_test_util_build_cmd_complete(uint8_t *dst, int len,
     dst[0] = BLE_HCI_EVCODE_COMMAND_COMPLETE;
     dst[1] = 3 + param_len;
     dst[2] = num_pkts;
-    htole16(dst + 3, opcode);
+    put_le16(dst + 3, opcode);
 }
 
 void
@@ -282,7 +282,7 @@ ble_hs_test_util_build_cmd_status(uint8_t *dst, int len,
     dst[1] = BLE_HCI_EVENT_CMD_STATUS_LEN;
     dst[2] = status;
     dst[3] = num_pkts;
-    htole16(dst + 4, opcode);
+    put_le16(dst + 4, opcode);
 }
 
 #define BLE_HS_TEST_UTIL_PHONY_ACK_MAX  64
@@ -458,7 +458,7 @@ ble_hs_test_util_verify_tx_disconnect(uint16_t handle, 
uint8_t reason)
                                            &param_len);
     TEST_ASSERT(param_len == BLE_HCI_DISCONNECT_CMD_LEN);
 
-    TEST_ASSERT(le16toh(param + 0) == handle);
+    TEST_ASSERT(get_le16(param + 0) == handle);
     TEST_ASSERT(param[2] == reason);
 }
 
@@ -473,18 +473,18 @@ ble_hs_test_util_verify_tx_create_conn(const struct 
hci_create_conn *exp)
                                            &param_len);
     TEST_ASSERT(param_len == BLE_HCI_CREATE_CONN_LEN);
 
-    TEST_ASSERT(le16toh(param + 0) == exp->scan_itvl);
-    TEST_ASSERT(le16toh(param + 2) == exp->scan_window);
+    TEST_ASSERT(get_le16(param + 0) == exp->scan_itvl);
+    TEST_ASSERT(get_le16(param + 2) == exp->scan_window);
     TEST_ASSERT(param[4] == exp->filter_policy);
     TEST_ASSERT(param[5] == exp->peer_addr_type);
     TEST_ASSERT(memcmp(param + 6, exp->peer_addr, 6) == 0);
     TEST_ASSERT(param[12] == exp->own_addr_type);
-    TEST_ASSERT(le16toh(param + 13) == exp->conn_itvl_min);
-    TEST_ASSERT(le16toh(param + 15) == exp->conn_itvl_max);
-    TEST_ASSERT(le16toh(param + 17) == exp->conn_latency);
-    TEST_ASSERT(le16toh(param + 19) == exp->supervision_timeout);
-    TEST_ASSERT(le16toh(param + 21) == exp->min_ce_len);
-    TEST_ASSERT(le16toh(param + 23) == exp->max_ce_len);
+    TEST_ASSERT(get_le16(param + 13) == exp->conn_itvl_min);
+    TEST_ASSERT(get_le16(param + 15) == exp->conn_itvl_max);
+    TEST_ASSERT(get_le16(param + 17) == exp->conn_latency);
+    TEST_ASSERT(get_le16(param + 19) == exp->supervision_timeout);
+    TEST_ASSERT(get_le16(param + 21) == exp->min_ce_len);
+    TEST_ASSERT(get_le16(param + 23) == exp->max_ce_len);
 }
 
 int
@@ -1101,7 +1101,7 @@ ble_hs_test_util_rx_att_read_mult_req(uint16_t 
conn_handle,
 
     off = BLE_ATT_READ_MULT_REQ_BASE_SZ;
     for (i = 0; i < num_handles; i++) {
-        htole16(buf + off, handles[i]);
+        put_le16(buf + off, handles[i]);
         off += 2;
     }
 
@@ -1370,11 +1370,11 @@ ble_hs_test_util_rx_num_completed_pkts_event(
 
     off = 3;
     for (i = 0; i < num_entries; i++) {
-        htole16(buf + off, entries[i].handle_id);
+        put_le16(buf + off, entries[i].handle_id);
         off += 2;
     }
     for (i = 0; i < num_entries; i++) {
-        htole16(buf + off, entries[i].num_pkts);
+        put_le16(buf + off, entries[i].num_pkts);
         off += 2;
     }
 
@@ -1391,7 +1391,7 @@ ble_hs_test_util_rx_disconn_complete_event(struct 
hci_disconn_complete *evt)
     buf[0] = BLE_HCI_EVCODE_DISCONN_CMP;
     buf[1] = BLE_HCI_EVENT_DISCONN_COMPLETE_LEN;
     buf[2] = evt->status;
-    htole16(buf + 3, evt->connection_handle);
+    put_le16(buf + 3, evt->connection_handle);
     buf[5] = evt->reason;
 
     ble_hs_test_util_rx_hci_evt(buf);
@@ -1407,7 +1407,7 @@ ble_hs_test_util_verify_tx_hci(uint8_t ogf, uint16_t ocf,
     cmd = ble_hs_test_util_get_first_hci_tx();
     TEST_ASSERT_FATAL(cmd != NULL);
 
-    opcode = le16toh(cmd);
+    opcode = get_le16(cmd);
     TEST_ASSERT(BLE_HCI_OGF(opcode) == ogf);
     TEST_ASSERT(BLE_HCI_OCF(opcode) == ocf);
 
@@ -1569,7 +1569,7 @@ ble_hs_test_util_verify_tx_find_info_rsp(
         TEST_ASSERT(rc == 0);
         off += 2;
 
-        handle = le16toh((void *)&handle);
+        handle = get_le16((void *)&handle);
         TEST_ASSERT(handle == entry->handle);
 
         if (entry->uuid->type == BLE_UUID_TYPE_16) {
@@ -1625,13 +1625,13 @@ ble_hs_test_util_verify_tx_read_group_type_rsp(
 
         rc = os_mbuf_copydata(om, off, 2, &u16);
         TEST_ASSERT(rc == 0);
-        htole16(&u16, u16);
+        put_le16(&u16, u16);
         TEST_ASSERT(u16 == entry->start_handle);
         off += 2;
 
         rc = os_mbuf_copydata(om, off, 2, &u16);
         TEST_ASSERT(rc == 0);
-        htole16(&u16, u16);
+        put_le16(&u16, u16);
         TEST_ASSERT(u16 == entry->end_handle);
         off += 2;
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/test/src/ble_l2cap_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_l2cap_test.c 
b/net/nimble/host/test/src/ble_l2cap_test.c
index 2bfdff3..526436c 100644
--- a/net/nimble/host/test/src/ble_l2cap_test.c
+++ b/net/nimble/host/test/src/ble_l2cap_test.c
@@ -86,13 +86,13 @@ ble_l2cap_test_util_verify_tx_update_conn(
                                            BLE_HCI_OCF_LE_CONN_UPDATE,
                                            &param_len);
     TEST_ASSERT(param_len == BLE_HCI_CONN_UPDATE_LEN);
-    TEST_ASSERT(le16toh(param + 0) == 2);
-    TEST_ASSERT(le16toh(param + 2) == params->itvl_min);
-    TEST_ASSERT(le16toh(param + 4) == params->itvl_max);
-    TEST_ASSERT(le16toh(param + 6) == params->latency);
-    TEST_ASSERT(le16toh(param + 8) == params->supervision_timeout);
-    TEST_ASSERT(le16toh(param + 10) == params->min_ce_len);
-    TEST_ASSERT(le16toh(param + 12) == params->max_ce_len);
+    TEST_ASSERT(get_le16(param + 0) == 2);
+    TEST_ASSERT(get_le16(param + 2) == params->itvl_min);
+    TEST_ASSERT(get_le16(param + 4) == params->itvl_max);
+    TEST_ASSERT(get_le16(param + 6) == params->latency);
+    TEST_ASSERT(get_le16(param + 8) == params->supervision_timeout);
+    TEST_ASSERT(get_le16(param + 10) == params->min_ce_len);
+    TEST_ASSERT(get_le16(param + 12) == params->max_ce_len);
 }
 
 static int

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/host/test/src/ble_sm_test_util.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_sm_test_util.c 
b/net/nimble/host/test/src/ble_sm_test_util.c
index faa38ff..b3783a0 100644
--- a/net/nimble/host/test/src/ble_sm_test_util.c
+++ b/net/nimble/host/test/src/ble_sm_test_util.c
@@ -860,7 +860,7 @@ ble_sm_test_util_verify_tx_lt_key_req_reply(uint16_t 
conn_handle, uint8_t *stk)
                                            BLE_HCI_OCF_LE_LT_KEY_REQ_REPLY,
                                            &param_len);
     TEST_ASSERT(param_len == BLE_HCI_LT_KEY_REQ_REPLY_LEN);
-    TEST_ASSERT(le16toh(param + 0) == conn_handle);
+    TEST_ASSERT(get_le16(param + 0) == conn_handle);
     TEST_ASSERT(memcmp(param + 2, stk, 16) == 0);
 }
 
@@ -874,7 +874,7 @@ ble_sm_test_util_verify_tx_lt_key_req_neg_reply(uint16_t 
conn_handle)
                                            BLE_HCI_OCF_LE_LT_KEY_REQ_NEG_REPLY,
                                            &param_len);
     TEST_ASSERT(param_len == BLE_HCI_LT_KEY_REQ_NEG_REPLY_LEN);
-    TEST_ASSERT(le16toh(param + 0) == conn_handle);
+    TEST_ASSERT(get_le16(param + 0) == conn_handle);
 }
 
 static void
@@ -883,7 +883,7 @@ ble_sm_test_util_set_lt_key_req_neg_reply_ack(uint8_t 
status,
 {
     static uint8_t params[BLE_HCI_LT_KEY_REQ_NEG_REPLY_ACK_PARAM_LEN];
 
-    htole16(params, conn_handle);
+    put_le16(params, conn_handle);
     ble_hs_test_util_set_ack_params(
         ble_hs_hci_util_opcode_join(BLE_HCI_OGF_LE,
                                     BLE_HCI_OCF_LE_LT_KEY_REQ_NEG_REPLY),
@@ -895,7 +895,7 @@ ble_sm_test_util_set_lt_key_req_reply_ack(uint8_t status, 
uint16_t conn_handle)
 {
     static uint8_t params[BLE_HCI_LT_KEY_REQ_REPLY_ACK_PARAM_LEN];
 
-    htole16(params, conn_handle);
+    put_le16(params, conn_handle);
     ble_hs_test_util_set_ack_params(
         ble_hs_hci_util_opcode_join(BLE_HCI_OGF_LE,
                                     BLE_HCI_OCF_LE_LT_KEY_REQ_REPLY),
@@ -928,9 +928,9 @@ ble_sm_test_util_verify_tx_start_enc(uint16_t conn_handle,
                                            BLE_HCI_OCF_LE_START_ENCRYPT,
                                            &param_len);
     TEST_ASSERT(param_len == BLE_HCI_LE_START_ENCRYPT_LEN);
-    TEST_ASSERT(le16toh(param + 0) == conn_handle);
-    TEST_ASSERT(le64toh(param + 2) == random_number);
-    TEST_ASSERT(le16toh(param + 10) == ediv);
+    TEST_ASSERT(get_le16(param + 0) == conn_handle);
+    TEST_ASSERT(get_le64(param + 2) == random_number);
+    TEST_ASSERT(get_le16(param + 10) == ediv);
     TEST_ASSERT(memcmp(param + 12, ltk, 16) == 0);
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/include/nimble/ble.h
----------------------------------------------------------------------
diff --git a/net/nimble/include/nimble/ble.h b/net/nimble/include/nimble/ble.h
index 29f335c..4dfa336 100644
--- a/net/nimble/include/nimble/ble.h
+++ b/net/nimble/include/nimble/ble.h
@@ -123,30 +123,18 @@ struct ble_mbuf_hdr
 extern uint8_t g_dev_addr[BLE_DEV_ADDR_LEN];
 extern uint8_t g_random_addr[BLE_DEV_ADDR_LEN];
 
-#undef htole16
-#undef htole32
-#undef htole64
-#undef le16toh
-#undef le32toh
-#undef le64toh
-#undef htobe16
-#undef htobe32
-#undef htobe64
-#undef be16toh
-#undef be32toh
-#undef be64toh
-void htole16(void *buf, uint16_t x);
-void htole32(void *buf, uint32_t x);
-void htole64(void *buf, uint64_t x);
-uint16_t le16toh(const void *buf);
-uint32_t le32toh(const void *buf);
-uint64_t le64toh(const void *buf);
-void htobe16(void *buf, uint16_t x);
-void htobe32(void *buf, uint32_t x);
-void htobe64(void *buf, uint64_t x);
-uint16_t be16toh(const void *buf);
-uint32_t be32toh(const void *buf);
-uint64_t be64toh(const void *buf);
+void put_le16(void *buf, uint16_t x);
+void put_le32(void *buf, uint32_t x);
+void put_le64(void *buf, uint64_t x);
+uint16_t get_le16(const void *buf);
+uint32_t get_le32(const void *buf);
+uint64_t get_le64(const void *buf);
+void put_be16(void *buf, uint16_t x);
+void put_be32(void *buf, uint32_t x);
+void put_be64(void *buf, uint64_t x);
+uint16_t get_be16(const void *buf);
+uint32_t get_be32(const void *buf);
+uint64_t get_be64(const void *buf);
 void swap_in_place(void *buf, int len);
 void swap_buf(uint8_t *dst, const uint8_t *src, int len);
 /* XXX */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31f894b6/net/nimble/src/util.c
----------------------------------------------------------------------
diff --git a/net/nimble/src/util.c b/net/nimble/src/util.c
index 95cae67..726a2a5 100644
--- a/net/nimble/src/util.c
+++ b/net/nimble/src/util.c
@@ -20,7 +20,7 @@
 #include "nimble/ble.h"
 
 void
-htole16(void *buf, uint16_t x)
+put_le16(void *buf, uint16_t x)
 {
     uint8_t *u8ptr;
 
@@ -30,7 +30,7 @@ htole16(void *buf, uint16_t x)
 }
 
 void
-htole32(void *buf, uint32_t x)
+put_le32(void *buf, uint32_t x)
 {
     uint8_t *u8ptr;
 
@@ -42,7 +42,7 @@ htole32(void *buf, uint32_t x)
 }
 
 void
-htole64(void *buf, uint64_t x)
+put_le64(void *buf, uint64_t x)
 {
     uint8_t *u8ptr;
 
@@ -58,7 +58,7 @@ htole64(void *buf, uint64_t x)
 }
 
 uint16_t
-le16toh(const void *buf)
+get_le16(const void *buf)
 {
     const uint8_t *u8ptr;
     uint16_t x;
@@ -71,7 +71,7 @@ le16toh(const void *buf)
 }
 
 uint32_t
-le32toh(const void *buf)
+get_le32(const void *buf)
 {
     const uint8_t *u8ptr;
     uint32_t x;
@@ -86,7 +86,7 @@ le32toh(const void *buf)
 }
 
 uint64_t
-le64toh(const void *buf)
+get_le64(const void *buf)
 {
     const uint8_t *u8ptr;
     uint64_t x;
@@ -105,7 +105,7 @@ le64toh(const void *buf)
 }
 
 void
-htobe16(void *buf, uint16_t x)
+put_be16(void *buf, uint16_t x)
 {
     uint8_t *u8ptr;
 
@@ -115,7 +115,7 @@ htobe16(void *buf, uint16_t x)
 }
 
 void
-htobe32(void *buf, uint32_t x)
+put_be32(void *buf, uint32_t x)
 {
     uint8_t *u8ptr;
 
@@ -127,7 +127,7 @@ htobe32(void *buf, uint32_t x)
 }
 
 void
-htobe64(void *buf, uint64_t x)
+put_be64(void *buf, uint64_t x)
 {
     uint8_t *u8ptr;
 
@@ -143,7 +143,7 @@ htobe64(void *buf, uint64_t x)
 }
 
 uint16_t
-be16toh(const void *buf)
+get_be16(const void *buf)
 {
     const uint8_t *u8ptr;
     uint16_t x;
@@ -156,7 +156,7 @@ be16toh(const void *buf)
 }
 
 uint32_t
-be32toh(const void *buf)
+get_be32(const void *buf)
 {
     const uint8_t *u8ptr;
     uint32_t x;
@@ -171,7 +171,7 @@ be32toh(const void *buf)
 }
 
 uint64_t
-be64toh(const void *buf)
+get_be64(const void *buf)
 {
     const uint8_t *u8ptr;
     uint64_t x;

Reply via email to