Index: asp3_tinet_ecnl_rx/trunk/btstack/src/bnep.c
===================================================================
--- asp3_tinet_ecnl_rx/trunk/btstack/src/bnep.c	(revision 337)
+++ asp3_tinet_ecnl_rx/trunk/btstack/src/bnep.c	(revision 374)
@@ -84,8 +84,8 @@
     event[1] = sizeof(event) - 2;
     event[2] = status;
-    bt_store_16(event, 3, channel->l2cap_cid);
-    bt_store_16(event, 5, channel->uuid_source);
-    bt_store_16(event, 7, channel->uuid_dest);
-    bt_store_16(event, 9, channel->max_frame_size);
+    little_endian_store_16(event, 3, channel->l2cap_cid);
+    little_endian_store_16(event, 5, channel->uuid_source);
+    little_endian_store_16(event, 7, channel->uuid_dest);
+    little_endian_store_16(event, 9, channel->max_frame_size);
     BD_ADDR_COPY(&event[11], channel->remote_addr);
     hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
@@ -101,7 +101,7 @@
     event[0] = BNEP_EVENT_CHANNEL_TIMEOUT;
     event[1] = sizeof(event) - 2;
-    bt_store_16(event, 2, channel->l2cap_cid);
-    bt_store_16(event, 4, channel->uuid_source);
-    bt_store_16(event, 6, channel->uuid_dest);
+    little_endian_store_16(event, 2, channel->l2cap_cid);
+    little_endian_store_16(event, 4, channel->uuid_source);
+    little_endian_store_16(event, 6, channel->uuid_dest);
     BD_ADDR_COPY(&event[8], channel->remote_addr);
     event[14] = channel->state;
@@ -118,7 +118,7 @@
     event[0] = BNEP_EVENT_CHANNEL_CLOSED;
     event[1] = sizeof(event) - 2;
-    bt_store_16(event, 2, channel->l2cap_cid);
-    bt_store_16(event, 4, channel->uuid_source);
-    bt_store_16(event, 6, channel->uuid_dest);
+    little_endian_store_16(event, 2, channel->l2cap_cid);
+    little_endian_store_16(event, 4, channel->uuid_source);
+    little_endian_store_16(event, 6, channel->uuid_dest);
     BD_ADDR_COPY(&event[8], channel->remote_addr);
     hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
@@ -133,5 +133,5 @@
     event[0] = BNEP_EVENT_READY_TO_SEND;
     event[1] = sizeof(event) - 2;
-    bt_store_16(event, 2, channel->l2cap_cid);
+    little_endian_store_16(event, 2, channel->l2cap_cid);
     hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
 	(*app_packet_handler)(channel->connection, HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event));
@@ -464,5 +464,5 @@
     BD_ADDR_COPY(addr_source, &packet[pos]);
     pos += sizeof(bd_addr_t);
-    network_protocol_type = READ_NET_16(packet, pos);
+    network_protocol_type = big_endian_read_16(packet, pos);
     pos += sizeof(uint16_t);
 
@@ -475,5 +475,5 @@
         }
         /* The "real" network protocol type is 4 bytes ahead in a VLAN packet */
-		network_protocol_type = READ_NET_16(packet, pos + 2);
+		network_protocol_type = big_endian_read_16(packet, pos + 2);
 	}
 
@@ -808,16 +808,16 @@
     /* Check source and destination UUIDs for valid combinations */
     if (response_code == BNEP_RESP_SETUP_SUCCESS) {
-        channel->uuid_dest = READ_NET_16(packet, 2 + uuid_offset);
-        channel->uuid_source = READ_NET_16(packet, 2 + uuid_offset + uuid_size);
-
-        if ((channel->uuid_dest != BNEP_UUID_PANU) &&
-            (channel->uuid_dest != BNEP_UUID_NAP) &&
-            (channel->uuid_dest != BNEP_UUID_GN)) {
+        channel->uuid_dest = big_endian_read_16(packet, 2 + uuid_offset);
+        channel->uuid_source = big_endian_read_16(packet, 2 + uuid_offset + uuid_size);
+
+        if ((channel->uuid_dest != BLUETOOTH_SERVICE_CLASS_PANU) &&
+            (channel->uuid_dest != BLUETOOTH_SERVICE_CLASS_NAP) &&
+            (channel->uuid_dest != BLUETOOTH_SERVICE_CLASS_GN)) {
             log_error("BNEP_CONNECTION_REQUEST: Invalid destination service UUID: %04x", channel->uuid_dest);
             channel->uuid_dest = 0;
         }
-        if ((channel->uuid_source != BNEP_UUID_PANU) &&
-            (channel->uuid_source != BNEP_UUID_NAP) &&
-            (channel->uuid_source != BNEP_UUID_GN)) {
+        if ((channel->uuid_source != BLUETOOTH_SERVICE_CLASS_PANU) &&
+            (channel->uuid_source != BLUETOOTH_SERVICE_CLASS_NAP) &&
+            (channel->uuid_source != BLUETOOTH_SERVICE_CLASS_GN)) {
             log_error("BNEP_CONNECTION_REQUEST: Invalid source service UUID: %04x", channel->uuid_source);
             channel->uuid_source = 0;
@@ -829,5 +829,5 @@
             response_code = BNEP_RESP_SETUP_INVALID_DEST_UUID;
         } else
-        if ((channel->uuid_source != BNEP_UUID_PANU) && (channel->uuid_dest != BNEP_UUID_PANU)) {
+        if ((channel->uuid_source != BLUETOOTH_SERVICE_CLASS_PANU) && (channel->uuid_dest != BLUETOOTH_SERVICE_CLASS_PANU)) {
             response_code = BNEP_RESP_SETUP_INVALID_SOURCE_UUID;
         }
@@ -857,5 +857,5 @@
     }
 
-    response_code = READ_NET_16(packet, 1);
+    response_code = big_endian_read_16(packet, 1);
 
     if (response_code == BNEP_RESP_SETUP_SUCCESS) {
@@ -882,5 +882,5 @@
     }
 
-    list_length = READ_NET_16(packet, 1);
+    list_length = big_endian_read_16(packet, 1);
     /* Sanity check packet size again with known package size */
     if (size < 3 + list_length) {
@@ -903,6 +903,6 @@
         /* There is still enough space, copy the filters to our filter list */
         for (i = 0; i < list_length / (2 * 2); i ++) {
-            channel->net_filter[channel->net_filter_count].range_start = READ_NET_16(packet, 1 + 2 + i * 4);
-            channel->net_filter[channel->net_filter_count].range_end = READ_NET_16(packet, 1 + 2 + i * 4 + 2);
+            channel->net_filter[channel->net_filter_count].range_start = big_endian_read_16(packet, 1 + 2 + i * 4);
+            channel->net_filter[channel->net_filter_count].range_end = big_endian_read_16(packet, 1 + 2 + i * 4 + 2);
             if (channel->net_filter[channel->net_filter_count].range_start > channel->net_filter[channel->net_filter_count].range_end) {
                 /* Invalid filter range, ignore this filter rule */
@@ -945,5 +945,5 @@
     }
 
-    response_code = READ_NET_16(packet, 1);
+    response_code = big_endian_read_16(packet, 1);
 
     if (response_code == BNEP_RESP_FILTER_SUCCESS) {
@@ -966,5 +966,5 @@
     }
 
-    list_length = READ_NET_16(packet, 1);
+    list_length = big_endian_read_16(packet, 1);
     /* Sanity check packet size again with known package size */
     if (size < 3 + list_length) {
@@ -1032,5 +1032,5 @@
     }
 
-    response_code = READ_NET_16(packet, 1);
+    response_code = big_endian_read_16(packet, 1);
 
     if (response_code == BNEP_RESP_FILTER_SUCCESS) {
@@ -1169,8 +1169,8 @@
         case L2CAP_EVENT_INCOMING_CONNECTION:
             /* L2CAP event data: event(8), len(8), address(48), handle (16),  psm (16), source cid(16) dest cid(16) */
-            bt_flip_addr(event_addr, &packet[2]);
-            con_handle = READ_BT_16(packet,  8);
-            psm        = READ_BT_16(packet, 10);
-            l2cap_cid  = READ_BT_16(packet, 12);
+            reverse_bd_addr(&packet[2], event_addr);
+            con_handle = little_endian_read_16(packet,  8);
+            psm        = little_endian_read_16(packet, 10);
+            l2cap_cid  = little_endian_read_16(packet, 12);
 
             if (psm != PSM_BNEP) break;
@@ -1211,5 +1211,5 @@
         case L2CAP_EVENT_CHANNEL_OPENED:
             /* Check if the l2cap channel has been opened for PSM_BNEP */
-            if (READ_BT_16(packet, 11) != PSM_BNEP) {
+            if (little_endian_read_16(packet, 11) != PSM_BNEP) {
                 break;
             }
@@ -1219,7 +1219,7 @@
 
             /* Get the bnep channel fpr remote address */
-            con_handle = READ_BT_16(packet, 9);
-            l2cap_cid  = READ_BT_16(packet, 13);
-            bt_flip_addr(event_addr, &packet[3]);
+            con_handle = little_endian_read_16(packet, 9);
+            l2cap_cid  = little_endian_read_16(packet, 13);
+            reverse_bd_addr(&packet[3], event_addr);
             channel = bnep_channel_for_addr(&event_addr);
             if (!channel) {
@@ -1252,10 +1252,10 @@
                     channel->state = BNEP_CHANNEL_STATE_WAIT_FOR_CONNECTION_RESPONSE;
                     bnep_channel_state_add(channel, BNEP_CHANNEL_STATE_VAR_SND_CONNECTION_REQUEST);
-                    channel->max_frame_size = bnep_max_frame_size_for_l2cap_mtu(READ_BT_16(packet, 17));
+                    channel->max_frame_size = bnep_max_frame_size_for_l2cap_mtu(little_endian_read_16(packet, 17));
                     bnep_run();
                     break;
                 case BNEP_CHANNEL_STATE_WAIT_FOR_CONNECTION_REQUEST:
                     /* New information: channel mtu */
-                    channel->max_frame_size = bnep_max_frame_size_for_l2cap_mtu(READ_BT_16(packet, 17));
+                    channel->max_frame_size = bnep_max_frame_size_for_l2cap_mtu(little_endian_read_16(packet, 17));
                     break;
                 default:
@@ -1272,5 +1272,5 @@
         case L2CAP_EVENT_CHANNEL_CLOSED:
             // data: event (8), len(8), channel (16)
-            l2cap_cid   = READ_BT_16(packet, 2);
+            l2cap_cid   = little_endian_read_16(packet, 2);
             channel = bnep_channel_for_l2cap_cid(l2cap_cid);
             log_info("L2CAP_EVENT_CHANNEL_CLOSED cid 0x%0x, channel %p", l2cap_cid, channel);
@@ -1331,5 +1331,5 @@
             BD_ADDR_COPY(addr_source, &packet[pos]);
             pos += sizeof(bd_addr_t);
-            network_protocol_type = READ_NET_16(packet, pos);
+            network_protocol_type = big_endian_read_16(packet, pos);
             pos += 2;
             break;
@@ -1337,5 +1337,5 @@
             BD_ADDR_COPY(addr_dest, channel->local_addr);
             BD_ADDR_COPY(addr_source, channel->remote_addr);
-            network_protocol_type = READ_NET_16(packet, pos);
+            network_protocol_type = big_endian_read_16(packet, pos);
             pos += 2;
             break;
@@ -1344,5 +1344,5 @@
             BD_ADDR_COPY(addr_source, &packet[pos]);
             pos += sizeof(bd_addr_t);
-            network_protocol_type = READ_NET_16(packet, pos);
+            network_protocol_type = big_endian_read_16(packet, pos);
             pos += 2;
             break;
@@ -1351,5 +1351,5 @@
             pos += sizeof(bd_addr_t);
             BD_ADDR_COPY(addr_source, channel->remote_addr);
-            network_protocol_type = READ_NET_16(packet, pos);
+            network_protocol_type = big_endian_read_16(packet, pos);
             pos += 2;
             break;
@@ -1563,5 +1563,5 @@
     }
 
-    channel->uuid_source = BNEP_UUID_PANU;
+    channel->uuid_source = BLUETOOTH_SERVICE_CLASS_PANU;
     channel->uuid_dest   = uuid_dest;
 
@@ -1597,7 +1597,7 @@
 
     /* Only alow one the three service types: PANU, NAP, GN */
-    if ((service_uuid != BNEP_UUID_PANU) &&
-        (service_uuid != BNEP_UUID_NAP) &&
-        (service_uuid != BNEP_UUID_GN)) {
+    if ((service_uuid != BLUETOOTH_SERVICE_CLASS_PANU) &&
+        (service_uuid != BLUETOOTH_SERVICE_CLASS_NAP) &&
+        (service_uuid != BLUETOOTH_SERVICE_CLASS_GN)) {
         log_info("BNEP_REGISTER_SERVICE: Invalid service UUID: %04x", service_uuid);
         return BNEP_CHANNEL_NOT_CONNECTED;
Index: asp3_tinet_ecnl_rx/trunk/btstack/src/bnep.h
===================================================================
--- asp3_tinet_ecnl_rx/trunk/btstack/src/bnep.h	(revision 337)
+++ asp3_tinet_ecnl_rx/trunk/btstack/src/bnep.h	(revision 374)
@@ -72,7 +72,7 @@
 
 /* BNEP UUIDs */
-#define BNEP_UUID_PANU                                  0x1115
-#define BNEP_UUID_NAP                                   0x1116
-#define BNEP_UUID_GN                                    0x1117
+#define BLUETOOTH_SERVICE_CLASS_PANU                    0x1115
+#define BLUETOOTH_SERVICE_CLASS_NAP                     0x1116
+#define BLUETOOTH_SERVICE_CLASS_GN                      0x1117
     
 /* BNEP packet types */    
Index: asp3_tinet_ecnl_rx/trunk/btstack/src/hci.c
===================================================================
--- asp3_tinet_ecnl_rx/trunk/btstack/src/hci.c	(revision 337)
+++ asp3_tinet_ecnl_rx/trunk/btstack/src/hci.c	(revision 374)
@@ -233,5 +233,5 @@
     bd_addr_t addr;
     hci_connection_t * conn;
-    bt_flip_addr(addr, *(bd_addr_t *) bd_addr);
+    reverse_bd_addr(*(bd_addr_t *) bd_addr, addr);
     conn = hci_connection_for_bd_addr_and_type(&addr, BD_ADDR_TYPE_CLASSIC);
     if (conn) {
@@ -469,11 +469,11 @@
         // copy handle_and_flags if not first fragment and update packet boundary flags to be 01 (continuing fragmnent)
         if (acl_header_pos > 0){
-            uint16_t handle_and_flags = READ_BT_16(hci_stack->hci_packet_buffer, 0);
+            uint16_t handle_and_flags = little_endian_read_16(hci_stack->hci_packet_buffer, 0);
             handle_and_flags = (handle_and_flags & 0xcfff) | (1 << 12);
-            bt_store_16(hci_stack->hci_packet_buffer, acl_header_pos, handle_and_flags);
+            little_endian_store_16(hci_stack->hci_packet_buffer, acl_header_pos, handle_and_flags);
         }
 
         // update header len
-        bt_store_16(hci_stack->hci_packet_buffer, acl_header_pos + 2, current_acl_data_packet_length);
+        little_endian_store_16(hci_stack->hci_packet_buffer, acl_header_pos + 2, current_acl_data_packet_length);
 
         // count packet
@@ -640,5 +640,5 @@
                 conn->acl_recombination_pos    = acl_length + 4;
                 conn->acl_recombination_length = l2cap_length;
-                bt_store_16(conn->acl_recombination_buffer, HCI_INCOMING_PRE_BUFFER_SIZE + 2, l2cap_length +4);
+                little_endian_store_16(conn->acl_recombination_buffer, HCI_INCOMING_PRE_BUFFER_SIZE + 2, l2cap_length +4);
             }
             break;
@@ -793,5 +793,5 @@
     // odd: waiting for event
     if (packet[0] == HCI_EVENT_COMMAND_COMPLETE){
-        uint16_t opcode = READ_BT_16(packet,3);
+        uint16_t opcode = little_endian_read_16(packet,3);
         if (opcode == hci_stack->last_cmd_opcode){
             command_completed = 1;
@@ -803,5 +803,5 @@
     if (packet[0] == HCI_EVENT_COMMAND_STATUS){
         uint8_t  status = packet[2];
-        uint16_t opcode = READ_BT_16(packet,4);
+        uint16_t opcode = little_endian_read_16(packet,4);
         if (opcode == hci_stack->last_cmd_opcode){
             if (status){
@@ -843,5 +843,5 @@
         case 1: // SEND BAUD CHANGE
             hci_stack->control->baudrate_cmd(hci_stack->config, ((hci_uart_config_t *)hci_stack->config)->baudrate_main, hci_stack->hci_packet_buffer);
-            hci_stack->last_cmd_opcode = READ_BT_16(hci_stack->hci_packet_buffer, 0);
+            hci_stack->last_cmd_opcode = little_endian_read_16(hci_stack->hci_packet_buffer, 0);
             hci_dump_packet(HCI_COMMAND_DATA_PACKET, 0, hci_stack->hci_packet_buffer, 3 + hci_stack->hci_packet_buffer[2]);
             hci_send_cmd_packet(hci_stack->hci_packet_buffer, 3 + hci_stack->hci_packet_buffer[2]);
@@ -860,5 +860,5 @@
                 if (valid_cmd){
                     int size = 3 + hci_stack->hci_packet_buffer[2];
-                    hci_stack->last_cmd_opcode = READ_BT_16(hci_stack->hci_packet_buffer, 0);
+                    hci_stack->last_cmd_opcode = little_endian_read_16(hci_stack->hci_packet_buffer, 0);
                     hci_dump_packet(HCI_COMMAND_DATA_PACKET, 0, hci_stack->hci_packet_buffer, size);
                     hci_stack->hci_transport->send_packet(HCI_COMMAND_DATA_PACKET, hci_stack->hci_packet_buffer, size);
@@ -992,9 +992,9 @@
             hci_stack->num_cmd_packets = packet[2];
 
-            if (COMMAND_COMPLETE_EVENT(packet, hci_read_buffer_size)){
+            if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_read_buffer_size)){
                 // from offset 5
                 // status
                 // "The HC_ACL_Data_Packet_Length return parameter will be used to determine the size of the L2CAP segments contained in ACL Data Packets"
-                hci_stack->acl_data_packet_length = READ_BT_16(packet, 6);
+                hci_stack->acl_data_packet_length = little_endian_read_16(packet, 6);
                 // ignore: SCO data packet len (8)
                 hci_stack->acl_packets_total_num  = packet[9];
@@ -1010,6 +1010,6 @@
             }
 #ifdef HAVE_BLE
-            if (COMMAND_COMPLETE_EVENT(packet, hci_le_read_buffer_size)){
-                hci_stack->le_data_packets_length = READ_BT_16(packet, 6);
+            if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_le_read_buffer_size)){
+                hci_stack->le_data_packets_length = little_endian_read_16(packet, 6);
                 hci_stack->le_acl_packets_total_num  = packet[8];
                     // determine usable ACL payload size
@@ -1021,14 +1021,14 @@
 #endif
             // Dump local address
-            if (COMMAND_COMPLETE_EVENT(packet, hci_read_bd_addr)) {
-                bt_flip_addr(hci_stack->local_bd_addr, &packet[OFFSET_OF_DATA_IN_COMMAND_COMPLETE + 1]);
+            if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_read_bd_addr)) {
+                reverse_bd_addr(&packet[OFFSET_OF_DATA_IN_COMMAND_COMPLETE + 1], hci_stack->local_bd_addr);
                 log_info("Local Address, Status: 0x%02x: Addr: %s",
                     packet[OFFSET_OF_DATA_IN_COMMAND_COMPLETE], bd_addr_to_str(hci_stack->local_bd_addr));
             }
-            if (COMMAND_COMPLETE_EVENT(packet, hci_write_scan_enable)){
+            if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_write_scan_enable)){
                 hci_emit_discoverable_enabled(hci_stack->discoverable);
             }
             // Note: HCI init checks
-            if (COMMAND_COMPLETE_EVENT(packet, hci_read_local_supported_features)){
+            if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_read_local_supported_features)){
                 memcpy(hci_stack->local_supported_features, &packet[OFFSET_OF_DATA_IN_COMMAND_COMPLETE+1], 8);
                 log_info("Local Supported Features: 0x%02x%02x%02x%02x%02x%02x%02x%02x",
@@ -1057,7 +1057,7 @@
             for (i=0; i<packet[2];i++){
                 uint16_t num_packets;
-                handle = READ_BT_16(packet, offset);
+                handle = little_endian_read_16(packet, offset);
                 offset += 2;
-                num_packets = READ_BT_16(packet, offset);
+                num_packets = little_endian_read_16(packet, offset);
                 offset += 2;
 
@@ -1079,5 +1079,5 @@
         }
         case HCI_EVENT_CONNECTION_REQUEST:
-            bt_flip_addr(addr, &packet[2]);
+            reverse_bd_addr(&packet[2], addr);
             // TODO: eval COD 8-10
             link_type = packet[11];
@@ -1106,5 +1106,5 @@
         case HCI_EVENT_CONNECTION_COMPLETE:
             // Connection management
-            bt_flip_addr(addr, &packet[5]);
+            reverse_bd_addr(&packet[5], addr);
             log_info("Connection_complete (status=%u) %s", packet[2], bd_addr_to_str(addr));
             addr_type = BD_ADDR_TYPE_CLASSIC;
@@ -1113,5 +1113,5 @@
                 if (!packet[2]){
                     conn->state = OPEN;
-                    conn->con_handle = READ_BT_16(packet, 3);
+                    conn->con_handle = little_endian_read_16(packet, 3);
                     conn->bonding_flags |= BONDING_REQUEST_REMOTE_FEATURES;
 
@@ -1148,5 +1148,5 @@
 
         case HCI_EVENT_READ_REMOTE_SUPPORTED_FEATURES_COMPLETE:
-            handle = READ_BT_16(packet, 3);
+            handle = little_endian_read_16(packet, 3);
             conn = hci_connection_for_handle(handle);
             if (!conn) break;
@@ -1176,5 +1176,5 @@
         case HCI_EVENT_LINK_KEY_NOTIFICATION: {
             link_key_type_t link_key_type;
-            bt_flip_addr(addr, &packet[2]);
+            reverse_bd_addr(&packet[2], addr);
             conn = hci_connection_for_bd_addr_and_type(&addr, BD_ADDR_TYPE_CLASSIC);
             if (!conn) break;
@@ -1201,5 +1201,5 @@
             // PIN CODE REQUEST means the link key request didn't succee -> delete stored link key
             if (!hci_stack->remote_device_db) break;
-            bt_flip_addr(addr, &packet[2]);
+            reverse_bd_addr(&packet[2], addr);
             hci_stack->remote_device_db->delete_link_key(&addr);
             break;
@@ -1223,5 +1223,5 @@
 
         case HCI_EVENT_ENCRYPTION_CHANGE:
-            handle = READ_BT_16(packet, 3);
+            handle = little_endian_read_16(packet, 3);
             conn = hci_connection_for_handle(handle);
             if (!conn) break;
@@ -1237,5 +1237,5 @@
 
         case HCI_EVENT_AUTHENTICATION_COMPLETE_EVENT:
-            handle = READ_BT_16(packet, 3);
+            handle = little_endian_read_16(packet, 3);
             conn = hci_connection_for_handle(handle);
             if (!conn) break;
@@ -1262,5 +1262,5 @@
             if (!hci_stack->remote_device_db) break;
             if (packet[2]) break; // status not ok
-            bt_flip_addr(addr, &packet[3]);
+            reverse_bd_addr(&packet[3], addr);
             // fix for invalid remote names - terminate on 0xff
             for (i=0; i<248;i++){
@@ -1283,5 +1283,5 @@
             int offset = 3;
             for (i=0; i<packet[2];i++){
-                bt_flip_addr(addr, &packet[offset]);
+                reverse_bd_addr(&packet[offset], addr);
                 offset += 14; // 6 + 1 + 1 + 1 + 3 + 2;
                 if (hci_stack->remote_device_db->get_name(&addr, &device_name)){
@@ -1308,5 +1308,5 @@
         case HCI_EVENT_ROLE_CHANGE:
             if (packet[2]) break;   // status != 0
-            handle = READ_BT_16(packet, 3);
+            handle = little_endian_read_16(packet, 3);
             conn = hci_connection_for_handle(handle);
             if (!conn) break;       // no conn
@@ -1331,5 +1331,5 @@
                 case HCI_SUBEVENT_LE_CONNECTION_COMPLETE:
                     // Connection management
-                    bt_flip_addr(addr, &packet[8]);
+                    reverse_bd_addr(&packet[8], addr);
                     addr_type = (bd_addr_type_t)packet[7];
                     log_info("LE Connection_complete (status=%u) type %u, %s", packet[3], addr_type, bd_addr_to_str(addr));
@@ -1357,5 +1357,5 @@
 
                     conn->state = OPEN;
-                    conn->con_handle = READ_BT_16(packet, 4);
+                    conn->con_handle = little_endian_read_16(packet, 4);
 
                     // TODO: store - role, peer address type, conn_interval, conn_latency, supervision timeout, master clock
@@ -1370,5 +1370,5 @@
                     break;
 
-            // log_info("LE buffer size: %u, count %u", READ_BT_16(packet,6), packet[8]);
+            // log_info("LE buffer size: %u, count %u", little_endian_read_16(packet,6), packet[8]);
 
                 default:
@@ -1389,5 +1389,5 @@
     if (hci_stack->state == HCI_STATE_FALLING_ASLEEP
         && hci_stack->substate == 1
-        && COMMAND_COMPLETE_EVENT(packet, hci_write_scan_enable)){
+        && HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_write_scan_enable)){
         hci_stack->substate++;
     }
@@ -1400,5 +1400,5 @@
         if (!packet[2]){
             hci_connection_t * conn;
-            handle = READ_BT_16(packet, 3);
+            handle = little_endian_read_16(packet, 3);
             conn = hci_connection_for_handle(handle);
             if (conn) {
@@ -1793,5 +1793,5 @@
 }
 
-void hci_discoverable_control(uint8_t enable){
+void gap_discoverable_control(uint8_t enable){
     if (enable) enable = 1; // normalize argument
 
@@ -2140,5 +2140,5 @@
     // create_connection?
     if (IS_COMMAND(packet, hci_create_connection)){
-        bt_flip_addr(addr, &packet[3]);
+        reverse_bd_addr(&packet[3], addr);
         log_info("Create_connection to %s", bd_addr_to_str(addr));
 
@@ -2179,5 +2179,5 @@
     if (IS_COMMAND(packet, hci_delete_stored_link_key)){
         if (hci_stack->remote_device_db){
-            bt_flip_addr(addr, &packet[3]);
+            reverse_bd_addr(&packet[3], addr);
             hci_stack->remote_device_db->delete_link_key(&addr);
         }
@@ -2186,5 +2186,5 @@
     if (IS_COMMAND(packet, hci_pin_code_request_negative_reply)
     ||  IS_COMMAND(packet, hci_pin_code_request_reply)){
-        bt_flip_addr(addr, &packet[3]);
+        reverse_bd_addr(&packet[3], addr);
         conn = hci_connection_for_bd_addr_and_type(&addr, BD_ADDR_TYPE_CLASSIC);
         if (conn){
@@ -2197,5 +2197,5 @@
     ||  IS_COMMAND(packet, hci_user_passkey_request_negative_reply)
     ||  IS_COMMAND(packet, hci_user_passkey_request_reply)) {
-        bt_flip_addr(addr, &packet[3]);
+        reverse_bd_addr(&packet[3], addr);
         conn = hci_connection_for_bd_addr_and_type(&addr, BD_ADDR_TYPE_CLASSIC);
         if (conn){
@@ -2209,5 +2209,5 @@
     }
     if (IS_COMMAND(packet, hci_le_set_random_address)){
-        bt_flip_addr(hci_stack->adv_address, &packet[3]);
+        reverse_bd_addr(&packet[3], hci_stack->adv_address);
     }
 #endif
@@ -2303,6 +2303,6 @@
     event[1] = sizeof(event) - 2;
     event[2] = status;
-    bt_store_16(event, 3, conn->con_handle);
-    bt_flip_addr(&event[5], conn->address);
+    little_endian_store_16(event, 3, conn->con_handle);
+    reverse_bd_addr(conn->address, &event[5]);
     event[11] = 1; // ACL connection
     event[12] = 0; // encryption disabled
@@ -2317,11 +2317,11 @@
     event[2] = HCI_SUBEVENT_LE_CONNECTION_COMPLETE;
     event[3] = status;
-    bt_store_16(event, 4, conn_handle);
+    little_endian_store_16(event, 4, conn_handle);
     event[6] = 0; // TODO: role
     event[7] = address_type;
-    bt_flip_addr(&event[8], *address);
-    bt_store_16(event, 14, 0); // interval
-    bt_store_16(event, 16, 0); // latency
-    bt_store_16(event, 18, 0); // supervision timeout
+    reverse_bd_addr(*address, &event[8]);
+    little_endian_store_16(event, 14, 0); // interval
+    little_endian_store_16(event, 16, 0); // latency
+    little_endian_store_16(event, 18, 0); // supervision timeout
     event[20] = 0; // master clock accuracy
     hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event));
@@ -2334,5 +2334,5 @@
     event[1] = sizeof(event) - 2;
     event[2] = 0; // status = OK
-    bt_store_16(event, 3, handle);
+    little_endian_store_16(event, 3, handle);
     event[5] = reason;
     hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event));
@@ -2346,5 +2346,5 @@
     event[0] = L2CAP_EVENT_TIMEOUT_CHECK;
     event[1] = sizeof(event) - 2;
-    bt_store_16(event, 2, conn->con_handle);
+    little_endian_store_16(event, 2, conn->con_handle);
     hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event));
     hci_stack->packet_handler(HCI_EVENT_PACKET, event, sizeof(event));
@@ -2378,5 +2378,5 @@
     event[2] = BTSTACK_MAJOR;
     event[3] = BTSTACK_MINOR;
-    bt_store_16(event, 4, BTSTACK_REVISION);
+    little_endian_store_16(event, 4, BTSTACK_REVISION);
     hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
     hci_stack->packet_handler(HCI_EVENT_PACKET, event, sizeof(event));
@@ -2399,5 +2399,5 @@
     event[1] = sizeof(event) - 2 - 1;
     event[2] = 0;   // just to be compatible with HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE
-    bt_flip_addr(&event[3], *addr);
+    reverse_bd_addr(*addr, &event[3]);
     memcpy(&event[9], name, 248);
 
@@ -2426,5 +2426,5 @@
     event[pos++] = GAP_SECURITY_LEVEL;
     event[pos++] = sizeof(event) - 2;
-    bt_store_16(event, 2, con_handle);
+    little_endian_store_16(event, 2, con_handle);
     pos += 2;
     event[pos++] = level;
@@ -2441,5 +2441,5 @@
     event[pos++] = sizeof(event) - 2;
     event[pos++] = status;
-    bt_flip_addr( * (bd_addr_t *) &event[pos], address);
+    reverse_bd_addr(address,  * (bd_addr_t *) &event[pos]);
     pos += 6;
     hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
Index: asp3_tinet_ecnl_rx/trunk/btstack/src/hci.h
===================================================================
--- asp3_tinet_ecnl_rx/trunk/btstack/src/hci.h	(revision 337)
+++ asp3_tinet_ecnl_rx/trunk/btstack/src/hci.h	(revision 374)
@@ -234,5 +234,5 @@
 
 //
-#define IS_COMMAND(packet, command) (READ_BT_16(packet,0) == command.opcode)
+#define IS_COMMAND(packet, command) (little_endian_read_16(packet,0) == command.opcode)
 
 // data: event(8)
@@ -595,5 +595,5 @@
 
 // Allows to control if device is discoverable. OFF by default.
-void hci_discoverable_control(uint8_t enable);
+void gap_discoverable_control(uint8_t enable);
 
 // Creates and sends HCI command packets based on a template and
Index: asp3_tinet_ecnl_rx/trunk/btstack/src/hci_dump.c
===================================================================
--- asp3_tinet_ecnl_rx/trunk/btstack/src/hci_dump.c	(revision 337)
+++ asp3_tinet_ecnl_rx/trunk/btstack/src/hci_dump.c	(revision 374)
@@ -194,9 +194,9 @@
 
         case HCI_DUMP_BLUEZ:
-            bt_store_16( (uint8_t *) &header_bluez.len, 0, 1 + len);
+            little_endian_store_16( (uint8_t *) &header_bluez.len, 0, 1 + len);
             header_bluez.in  = in;
             header_bluez.pad = 0;
-            bt_store_32( (uint8_t *) &header_bluez.ts_sec,  0, curr_time.tv_sec);
-            bt_store_32( (uint8_t *) &header_bluez.ts_usec, 0, curr_time.tv_usec);
+            little_endian_store_32( (uint8_t *) &header_bluez.ts_sec,  0, curr_time.tv_sec);
+            little_endian_store_32( (uint8_t *) &header_bluez.ts_usec, 0, curr_time.tv_usec);
             header_bluez.packet_type = packet_type;
             write (dump_file, &header_bluez, sizeof(hcidump_hdr) );
Index: asp3_tinet_ecnl_rx/trunk/btstack/src/l2cap.c
===================================================================
--- asp3_tinet_ecnl_rx/trunk/btstack/src/l2cap.c	(revision 337)
+++ asp3_tinet_ecnl_rx/trunk/btstack/src/l2cap.c	(revision 374)
@@ -135,12 +135,12 @@
     event[1] = sizeof(event) - 2;
     event[2] = status;
-    bt_flip_addr(&event[3], channel->address);
-    bt_store_16(event,  9, channel->handle);
-    bt_store_16(event, 11, channel->psm);
-    bt_store_16(event, 13, channel->local_cid);
-    bt_store_16(event, 15, channel->remote_cid);
-    bt_store_16(event, 17, channel->local_mtu);
-    bt_store_16(event, 19, channel->remote_mtu);
-    bt_store_16(event, 21, channel->flush_timeout);
+    reverse_bd_addr(channel->address, &event[3]);
+    little_endian_store_16(event,  9, channel->handle);
+    little_endian_store_16(event, 11, channel->psm);
+    little_endian_store_16(event, 13, channel->local_cid);
+    little_endian_store_16(event, 15, channel->remote_cid);
+    little_endian_store_16(event, 17, channel->local_mtu);
+    little_endian_store_16(event, 19, channel->remote_mtu);
+    little_endian_store_16(event, 21, channel->flush_timeout);
     hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
     l2cap_dispatch(channel, HCI_EVENT_PACKET, event, sizeof(event));
@@ -152,5 +152,5 @@
     event[0] = L2CAP_EVENT_CHANNEL_CLOSED;
     event[1] = sizeof(event) - 2;
-    bt_store_16(event, 2, channel->local_cid);
+    little_endian_store_16(event, 2, channel->local_cid);
     hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
     l2cap_dispatch(channel, HCI_EVENT_PACKET, event, sizeof(event));
@@ -163,9 +163,9 @@
     event[0] = L2CAP_EVENT_INCOMING_CONNECTION;
     event[1] = sizeof(event) - 2;
-    bt_flip_addr(&event[2], channel->address);
-    bt_store_16(event,  8, channel->handle);
-    bt_store_16(event, 10, channel->psm);
-    bt_store_16(event, 12, channel->local_cid);
-    bt_store_16(event, 14, channel->remote_cid);
+    reverse_bd_addr(channel->address, &event[2]);
+    little_endian_store_16(event,  8, channel->handle);
+    little_endian_store_16(event, 10, channel->psm);
+    little_endian_store_16(event, 12, channel->local_cid);
+    little_endian_store_16(event, 14, channel->remote_cid);
     hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
     l2cap_dispatch(channel, HCI_EVENT_PACKET, event, sizeof(event));
@@ -176,6 +176,6 @@
     event[0] = L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_RESPONSE;
     event[1] = 4;
-    bt_store_16(event, 2, handle);
-    bt_store_16(event, 4, result);
+    little_endian_store_16(event, 2, handle);
+    little_endian_store_16(event, 4, result);
     hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
     (*packet_handler)(NULL, HCI_EVENT_PACKET, 0, event, sizeof(event));
@@ -188,5 +188,5 @@
     event[1] = sizeof(event) - 2;
     event[2] = status;
-    bt_store_16(event, 3, psm);
+    little_endian_store_16(event, 3, psm);
     hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
     (*packet_handler)(connection, HCI_EVENT_PACKET, 0, event, sizeof(event));
@@ -201,5 +201,5 @@
     event[0] = L2CAP_EVENT_CREDITS;
     event[1] = sizeof(event) - 2;
-    bt_store_16(event, 2, channel->local_cid);
+    little_endian_store_16(event, 2, channel->local_cid);
     event[4] = credits;
     hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
@@ -412,11 +412,11 @@
 
     // 0 - Connection handle : PB=pb : BC=00
-    bt_store_16(acl_buffer, 0, channel->handle | (pb << 12) | (0 << 14));
+    little_endian_store_16(acl_buffer, 0, channel->handle | (pb << 12) | (0 << 14));
     // 2 - ACL length
-    bt_store_16(acl_buffer, 2,  len + 4);
+    little_endian_store_16(acl_buffer, 2,  len + 4);
     // 4 - L2CAP packet length
-    bt_store_16(acl_buffer, 4,  len + 0);
+    little_endian_store_16(acl_buffer, 4,  len + 0);
     // 6 - L2CAP channel DEST
-    bt_store_16(acl_buffer, 6, channel->remote_cid);
+    little_endian_store_16(acl_buffer, 6, channel->remote_cid);
     // send
     err = hci_send_acl_packet_buffer(len+8);
@@ -449,11 +449,11 @@
 
     // 0 - Connection handle : PB=pb : BC=00
-    bt_store_16(acl_buffer, 0, handle | (pb << 12) | (0 << 14));
+    little_endian_store_16(acl_buffer, 0, handle | (pb << 12) | (0 << 14));
     // 2 - ACL length
-    bt_store_16(acl_buffer, 2,  len + 4);
+    little_endian_store_16(acl_buffer, 2,  len + 4);
     // 4 - L2CAP packet length
-    bt_store_16(acl_buffer, 4,  len + 0);
+    little_endian_store_16(acl_buffer, 4,  len + 0);
     // 6 - L2CAP channel DEST
-    bt_store_16(acl_buffer, 6, cid);
+    little_endian_store_16(acl_buffer, 6, cid);
     // send
     err = hci_send_acl_packet_buffer(len+8);
@@ -665,5 +665,5 @@
                         config_options[0] = 1; // MTU
                         config_options[1] = 2; // len param
-                        bt_store_16( (uint8_t*)&config_options, 2, channel->remote_mtu);
+                        little_endian_store_16( (uint8_t*)&config_options, 2, channel->remote_mtu);
                         l2cap_send_signaling_packet(channel->handle, CONFIGURE_RESPONSE, channel->remote_sig_id, channel->remote_cid, flags, 0, 4, &config_options);
                         channelStateVarClearFlag(channel,L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_MTU);
@@ -679,5 +679,5 @@
                     config_options[0] = 1; // MTU
                     config_options[1] = 2; // len param
-                    bt_store_16( (uint8_t*)&config_options, 2, channel->local_mtu);
+                    little_endian_store_16( (uint8_t*)&config_options, 2, channel->local_mtu);
                     l2cap_send_signaling_packet(channel->handle, CONFIGURE_REQUEST, channel->local_sig_id, channel->remote_cid, 0, 4, &config_options);
                     l2cap_start_rtx(channel);
@@ -893,7 +893,7 @@
         // handle connection complete events
         case HCI_EVENT_CONNECTION_COMPLETE:
-            bt_flip_addr(address, &packet[5]);
+            reverse_bd_addr(&packet[5], address);
             if (packet[2] == 0){
-                handle = READ_BT_16(packet, 3);
+                handle = little_endian_read_16(packet, 3);
                 l2cap_handle_connection_success_for_addr(address, handle);
             } else {
@@ -904,7 +904,7 @@
         // handle successful create connection cancel command
         case HCI_EVENT_COMMAND_COMPLETE:
-            if ( COMMAND_COMPLETE_EVENT(packet, hci_create_connection_cancel) ) {
+            if ( HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_create_connection_cancel) ) {
                 if (packet[5] == 0){
-                    bt_flip_addr(address, &packet[6]);
+                    reverse_bd_addr(&packet[6], address);
                     // CONNECTION TERMINATED BY LOCAL HOST (0X16)
                     l2cap_handle_connection_failed_for_addr(address, 0x16);
@@ -921,5 +921,5 @@
         case HCI_EVENT_DISCONNECTION_COMPLETE:
             // send l2cap disconnect events for all channels on this handle and free them
-            handle = READ_BT_16(packet, 3);
+            handle = little_endian_read_16(packet, 3);
             linked_list_iterator_init(&it, &l2cap_channels);
             while (linked_list_iterator_has_next(&it)){
@@ -940,5 +940,5 @@
         // HCI Connection Timeouts
         case L2CAP_EVENT_TIMEOUT_CHECK:
-            handle = READ_BT_16(packet, 2);
+            handle = little_endian_read_16(packet, 2);
             if (hci_authentication_active_for_handle(handle)) break;
             hci_con_used = 0;
@@ -971,5 +971,5 @@
 
         case HCI_EVENT_READ_REMOTE_SUPPORTED_FEATURES_COMPLETE:
-            handle = READ_BT_16(packet, 3);
+            handle = little_endian_read_16(packet, 3);
             linked_list_iterator_init(&it, &l2cap_channels);
             while (linked_list_iterator_has_next(&it)){
@@ -982,5 +982,5 @@
 
         case GAP_SECURITY_LEVEL:
-            handle = READ_BT_16(packet, 2);
+            handle = little_endian_read_16(packet, 2);
             log_info("l2cap - security level update");
             linked_list_iterator_init(&it, &l2cap_channels);
@@ -1163,5 +1163,5 @@
     channel->remote_sig_id = command[L2CAP_SIGNALING_COMMAND_SIGID_OFFSET];
 
-    flags = READ_BT_16(command, 6);
+    flags = little_endian_read_16(command, 6);
     if (flags & 1) {
         channelStateVarSetFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_CONT);
@@ -1169,5 +1169,5 @@
 
     // accept the other's configuration options
-    end_pos = 4 + READ_BT_16(command, L2CAP_SIGNALING_COMMAND_LENGTH_OFFSET);
+    end_pos = 4 + little_endian_read_16(command, L2CAP_SIGNALING_COMMAND_LENGTH_OFFSET);
     pos     = 8;
     while (pos < end_pos){
@@ -1180,5 +1180,5 @@
         // MTU { type(8): 1, len(8):2, MTU(16) }
         if (option_type == 1 && length == 2){
-            channel->remote_mtu = READ_BT_16(command, pos);
+            channel->remote_mtu = little_endian_read_16(command, pos);
             // log_info("l2cap cid 0x%02x, remote mtu %u", channel->local_cid, channel->remote_mtu);
             channelStateVarSetFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_MTU);
@@ -1186,5 +1186,5 @@
         // Flush timeout { type(8):2, len(8): 2, Flush Timeout(16)}
         if (option_type == 2 && length == 2){
-            channel->flush_timeout = READ_BT_16(command, pos);
+            channel->flush_timeout = little_endian_read_16(command, pos);
         }
         // check for unknown options
@@ -1237,9 +1237,9 @@
                 case CONNECTION_RESPONSE:
                     l2cap_stop_rtx(channel);
-                    result = READ_BT_16 (command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET+4);
+                    result = little_endian_read_16 (command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET+4);
                     switch (result) {
                         case 0:
                             // successful connection
-                            channel->remote_cid = READ_BT_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET);
+                            channel->remote_cid = little_endian_read_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET);
                             channel->state = L2CAP_STATE_CONFIG;
                             channelStateVarSetFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_REQ);
@@ -1274,5 +1274,5 @@
 
         case L2CAP_STATE_CONFIG:
-            result = READ_BT_16 (command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET+4);
+            result = little_endian_read_16 (command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET+4);
             switch (code) {
                 case CONFIGURE_REQUEST:
@@ -1353,6 +1353,6 @@
 
         case CONNECTION_REQUEST: {
-            uint16_t psm =        READ_BT_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET);
-            uint16_t source_cid = READ_BT_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET+2);
+            uint16_t psm =        little_endian_read_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET);
+            uint16_t source_cid = little_endian_read_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET+2);
             l2cap_handle_connection_request(handle, sig_id, psm, source_cid);
             return;
@@ -1364,5 +1364,5 @@
 
         case INFORMATION_REQUEST: {
-            uint16_t infoType = READ_BT_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET);
+            uint16_t infoType = little_endian_read_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET);
             l2cap_register_signaling_response(handle, code, sig_id, infoType);
             return;
@@ -1375,5 +1375,5 @@
     
     // Get potential destination CID
-    dest_cid = READ_BT_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET);
+    dest_cid = little_endian_read_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET);
 
     // Find channel for this sig_id and connection handle
@@ -1415,5 +1415,5 @@
 
                 // increment command_offset
-                command_offset += L2CAP_SIGNALING_COMMAND_DATA_OFFSET + READ_BT_16(packet, command_offset + L2CAP_SIGNALING_COMMAND_LENGTH_OFFSET);
+                command_offset += L2CAP_SIGNALING_COMMAND_DATA_OFFSET + little_endian_read_16(packet, command_offset + L2CAP_SIGNALING_COMMAND_LENGTH_OFFSET);
             }
             break;
@@ -1435,5 +1435,5 @@
             switch (packet[8]){
                 case CONNECTION_PARAMETER_UPDATE_RESPONSE: {
-                    uint16_t result = READ_BT_16(packet, 12);
+                    uint16_t result = little_endian_read_16(packet, 12);
                     l2cap_emit_connection_parameter_update_response(handle, result);
                     break;
@@ -1450,8 +1450,8 @@
                         int update_parameter = 1;
                         le_connection_parameter_range_t existing_range = gap_le_get_connection_parameter_range();
-                        uint16_t le_conn_interval_min = READ_BT_16(packet,12);
-                        uint16_t le_conn_interval_max = READ_BT_16(packet,14);
-                        uint16_t le_conn_latency = READ_BT_16(packet,16);
-                        uint16_t le_supervision_timeout = READ_BT_16(packet,18);
+                        uint16_t le_conn_interval_min = little_endian_read_16(packet,12);
+                        uint16_t le_conn_interval_max = little_endian_read_16(packet,14);
+                        uint16_t le_conn_latency = little_endian_read_16(packet,16);
+                        uint16_t le_supervision_timeout = little_endian_read_16(packet,18);
 
                         if (le_conn_interval_min < existing_range.le_conn_interval_min) update_parameter = 0;
Index: asp3_tinet_ecnl_rx/trunk/btstack/src/l2cap_signaling.c
===================================================================
--- asp3_tinet_ecnl_rx/trunk/btstack/src/l2cap_signaling.c	(revision 337)
+++ asp3_tinet_ecnl_rx/trunk/btstack/src/l2cap_signaling.c	(revision 374)
@@ -91,7 +91,7 @@
 
     // 0 - Connection handle : PB=pb : BC=00
-    bt_store_16(acl_buffer, 0, handle | (pb << 12) | (0 << 14));
+    little_endian_store_16(acl_buffer, 0, handle | (pb << 12) | (0 << 14));
     // 6 - L2CAP channel = 1
-    bt_store_16(acl_buffer, 6, cid);
+    little_endian_store_16(acl_buffer, 6, cid);
     // 8 - Code
     acl_buffer[8] = cmd;
@@ -134,9 +134,9 @@
 
     // 2 - ACL length
-    bt_store_16(acl_buffer, 2,  pos - 4);
+    little_endian_store_16(acl_buffer, 2,  pos - 4);
     // 4 - L2CAP packet length
-    bt_store_16(acl_buffer, 4,  pos - 6 - 2);
+    little_endian_store_16(acl_buffer, 4,  pos - 6 - 2);
     // 10 - L2CAP signaling parameter length
-    bt_store_16(acl_buffer, 10, pos - 12);
+    little_endian_store_16(acl_buffer, 10, pos - 12);
 
     return pos;
@@ -158,7 +158,7 @@
 
     // 0 - Connection handle : PB=pb : BC=00
-    bt_store_16(acl_buffer, 0, handle | (pb << 12) | (0 << 14));
+    little_endian_store_16(acl_buffer, 0, handle | (pb << 12) | (0 << 14));
     // 6 - L2CAP LE Signaling channel = 5
-    bt_store_16(acl_buffer, 6, 5);
+    little_endian_store_16(acl_buffer, 6, 5);
     // 8 - Code
     acl_buffer[8] = CONNECTION_PARAMETER_UPDATE_REQUEST;
@@ -166,18 +166,18 @@
     acl_buffer[9] = 1;
     uint16_t pos = 12;
-    bt_store_16(acl_buffer, pos, interval_min);
-    pos += 2;
-    bt_store_16(acl_buffer, pos, interval_max);
-    pos += 2;
-    bt_store_16(acl_buffer, pos, slave_latency);
-    pos += 2;
-    bt_store_16(acl_buffer, pos, timeout_multiplier);
+    little_endian_store_16(acl_buffer, pos, interval_min);
+    pos += 2;
+    little_endian_store_16(acl_buffer, pos, interval_max);
+    pos += 2;
+    little_endian_store_16(acl_buffer, pos, slave_latency);
+    pos += 2;
+    little_endian_store_16(acl_buffer, pos, timeout_multiplier);
     pos += 2;
     // 2 - ACL length
-    bt_store_16(acl_buffer, 2,  pos - 4);
+    little_endian_store_16(acl_buffer, 2,  pos - 4);
     // 4 - L2CAP packet length
-    bt_store_16(acl_buffer, 4,  pos - 6 - 2);
+    little_endian_store_16(acl_buffer, 4,  pos - 6 - 2);
     // 10 - L2CAP signaling parameter length
-    bt_store_16(acl_buffer, 10, pos - 12);
+    little_endian_store_16(acl_buffer, 10, pos - 12);
     return pos;
 }
@@ -188,7 +188,7 @@
 
     // 0 - Connection handle : PB=pb : BC=00
-    bt_store_16(acl_buffer, 0, handle | (pb << 12) | (0 << 14));
+    little_endian_store_16(acl_buffer, 0, handle | (pb << 12) | (0 << 14));
     // 6 - L2CAP LE Signaling channel = 5
-    bt_store_16(acl_buffer, 6, 5);
+    little_endian_store_16(acl_buffer, 6, 5);
     // 8 - Code
     acl_buffer[8] = CONNECTION_PARAMETER_UPDATE_REQUEST;
@@ -196,12 +196,12 @@
     acl_buffer[9] = 1;
     uint16_t pos = 12;
-    bt_store_16(acl_buffer, pos, response);
+    little_endian_store_16(acl_buffer, pos, response);
     pos += 2;
     // 2 - ACL length
-    bt_store_16(acl_buffer, 2,  pos - 4);
+    little_endian_store_16(acl_buffer, 2,  pos - 4);
     // 4 - L2CAP packet length
-    bt_store_16(acl_buffer, 4,  pos - 6 - 2);
+    little_endian_store_16(acl_buffer, 4,  pos - 6 - 2);
     // 10 - L2CAP signaling parameter length
-    bt_store_16(acl_buffer, 10, pos - 12);
+    little_endian_store_16(acl_buffer, 10, pos - 12);
     return pos;
 }
Index: asp3_tinet_ecnl_rx/trunk/btstack/src/pan.c
===================================================================
--- asp3_tinet_ecnl_rx/trunk/btstack/src/pan.c	(revision 337)
+++ asp3_tinet_ecnl_rx/trunk/btstack/src/pan.c	(revision 374)
@@ -80,5 +80,5 @@
 
 	// 0x0001 "Service Class ID List"
-	de_add_number(service,  DE_UINT, DE_SIZE_16, SDP_ServiceClassIDList);
+	de_add_number(service,  DE_UINT, DE_SIZE_16, BLUETOOTH_ATTRIBUTE_SERVICE_CLASS_ID_LIST);
 	attribute = de_push_sequence(service);
 	{
@@ -89,5 +89,5 @@
 
 	// 0x0004 "Protocol Descriptor List"
-	de_add_number(service,  DE_UINT, DE_SIZE_16, SDP_ProtocolDescriptorList);
+	de_add_number(service,  DE_UINT, DE_SIZE_16, BLUETOOTH_ATTRIBUTE_PROTOCOL_DESCRIPTOR_LIST);
 	attribute = de_push_sequence(service);
 	{
@@ -95,5 +95,5 @@
 		{
 			de_add_number(l2cpProtocol,  DE_UUID, DE_SIZE_16, 0x0100);
-			de_add_number(l2cpProtocol,  DE_UINT, DE_SIZE_16, SDP_BNEPProtocol);  // l2cap psm
+			de_add_number(l2cpProtocol,  DE_UINT, DE_SIZE_16, BLUETOOTH_PROTOCOL_BNEP);  // l2cap psm
 		}
 		de_pop_sequence(attribute, l2cpProtocol);
Index: asp3_tinet_ecnl_rx/trunk/btstack/src/rfcomm.c
===================================================================
--- asp3_tinet_ecnl_rx/trunk/btstack/src/rfcomm.c	(revision 337)
+++ asp3_tinet_ecnl_rx/trunk/btstack/src/rfcomm.c	(revision 374)
@@ -136,7 +136,7 @@
     event[0] = RFCOMM_EVENT_INCOMING_CONNECTION;
     event[1] = sizeof(event) - 2;
-    bt_flip_addr(&event[2], channel->multiplexer->remote_addr);
+    reverse_bd_addr(channel->multiplexer->remote_addr, &event[2]);
     event[8] = channel->dlci >> 1;
-    bt_store_16(event, 9, channel->rfcomm_cid);
+    little_endian_store_16(event, 9, channel->rfcomm_cid);
     hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event));
 	(*app_packet_handler)(channel->connection, HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event));
@@ -157,9 +157,9 @@
     event[pos++] = sizeof(event) - 2;
     event[pos++] = status;
-    bt_flip_addr(&event[pos], channel->multiplexer->remote_addr); pos += 6;
-    bt_store_16(event,  pos, channel->multiplexer->con_handle);   pos += 2;
+    reverse_bd_addr(channel->multiplexer->remote_addr, &event[pos]); pos += 6;
+    little_endian_store_16(event,  pos, channel->multiplexer->con_handle);   pos += 2;
 	event[pos++] = channel->dlci >> 1;
-	bt_store_16(event, pos, channel->rfcomm_cid); pos += 2;       // channel ID
-	bt_store_16(event, pos, channel->max_frame_size); pos += 2;   // max frame size
+	little_endian_store_16(event, pos, channel->rfcomm_cid); pos += 2;       // channel ID
+	little_endian_store_16(event, pos, channel->max_frame_size); pos += 2;   // max frame size
     hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event));
 	(*app_packet_handler)(channel->connection, HCI_EVENT_PACKET, 0, (uint8_t *) event, pos);
@@ -175,9 +175,9 @@
     event[pos++] = sizeof(event) - 2;
     event[pos++] = BTSTACK_MEMORY_ALLOC_FAILED;
-    bt_flip_addr(&event[pos], *addr); pos += 6;
-    bt_store_16(event,  pos, 0);   pos += 2;
+    reverse_bd_addr(*addr, &event[pos]); pos += 6;
+    little_endian_store_16(event,  pos, 0);   pos += 2;
 	event[pos++] = server_channel;
-	bt_store_16(event, pos, 0); pos += 2;   // channel ID
-	bt_store_16(event, pos, 0); pos += 2;   // max frame size
+	little_endian_store_16(event, pos, 0); pos += 2;   // channel ID
+	little_endian_store_16(event, pos, 0); pos += 2;   // max frame size
     hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event));
 	(*app_packet_handler)(connection, HCI_EVENT_PACKET, 0, (uint8_t *) event, pos);
@@ -204,5 +204,5 @@
     event[0] = RFCOMM_EVENT_CHANNEL_CLOSED;
     event[1] = sizeof(event) - 2;
-    bt_store_16(event, 2, channel->rfcomm_cid);
+    little_endian_store_16(event, 2, channel->rfcomm_cid);
     hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event));
 	(*app_packet_handler)(channel->connection, HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event));
@@ -214,5 +214,5 @@
     event[0] = RFCOMM_EVENT_CREDITS;
     event[1] = sizeof(event) - 2;
-    bt_store_16(event, 2, channel->rfcomm_cid);
+    little_endian_store_16(event, 2, channel->rfcomm_cid);
     event[4] = credits;
     hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event));
@@ -237,5 +237,5 @@
     event[0] = RFCOMM_EVENT_REMOTE_LINE_STATUS;
     event[1] = sizeof(event) - 2;
-    bt_store_16(event, 2, channel->rfcomm_cid);
+    little_endian_store_16(event, 2, channel->rfcomm_cid);
     event[4] = line_status;
     hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
@@ -905,8 +905,8 @@
         case L2CAP_EVENT_INCOMING_CONNECTION:
             // data: event(8), len(8), address(48), handle (16),  psm (16), source cid(16) dest cid(16)
-            bt_flip_addr(event_addr, &packet[2]);
-            con_handle = READ_BT_16(packet,  8);
-            psm        = READ_BT_16(packet, 10);
-            l2cap_cid  = READ_BT_16(packet, 12);
+            reverse_bd_addr(&packet[2], event_addr);
+            con_handle = little_endian_read_16(packet,  8);
+            psm        = little_endian_read_16(packet, 10);
+            l2cap_cid  = little_endian_read_16(packet, 12);
 
             if (psm != PSM_RFCOMM) break;
@@ -939,5 +939,5 @@
         case L2CAP_EVENT_CHANNEL_OPENED:
 
-            if (READ_BT_16(packet, 11) != PSM_RFCOMM) break;
+            if (little_endian_read_16(packet, 11) != PSM_RFCOMM) break;
 
             status = packet[2];
@@ -945,7 +945,7 @@
 
             // get multiplexer for remote addr
-            con_handle = READ_BT_16(packet, 9);
-            l2cap_cid = READ_BT_16(packet, 13);
-            bt_flip_addr(event_addr, &packet[3]);
+            con_handle = little_endian_read_16(packet, 9);
+            l2cap_cid = little_endian_read_16(packet, 13);
+            reverse_bd_addr(&packet[3], event_addr);
             multiplexer = rfcomm_multiplexer_for_addr(&event_addr);
             if (!multiplexer) {
@@ -990,5 +990,5 @@
 
                 // set max frame size based on l2cap MTU
-                multiplexer->max_frame_size = rfcomm_max_frame_size_for_l2cap_mtu(READ_BT_16(packet, 17));
+                multiplexer->max_frame_size = rfcomm_max_frame_size_for_l2cap_mtu(little_endian_read_16(packet, 17));
             }
             return 1;
@@ -998,5 +998,5 @@
         case L2CAP_EVENT_CREDITS:
             // data: event(8), len(8), local_cid(16), credits(8)
-            l2cap_cid = READ_BT_16(packet, 2);
+            l2cap_cid = little_endian_read_16(packet, 2);
             multiplexer = rfcomm_multiplexer_for_l2cap_cid(l2cap_cid);
             if (!multiplexer) break;
@@ -1019,5 +1019,5 @@
         case L2CAP_EVENT_CHANNEL_CLOSED:
             // data: event (8), len(8), channel (16)
-            l2cap_cid = READ_BT_16(packet, 2);
+            l2cap_cid = little_endian_read_16(packet, 2);
             multiplexer = rfcomm_multiplexer_for_l2cap_cid(l2cap_cid);
             log_info("L2CAP_EVENT_CHANNEL_CLOSED cid 0x%0x, mult %p", l2cap_cid, multiplexer);
@@ -1478,5 +1478,5 @@
                     event_pn.super.type = CH_EVT_RCVD_PN;
                     event_pn.priority = packet[payload_offset+4];
-                    event_pn.max_frame_size = READ_BT_16(packet, payload_offset+6);
+                    event_pn.max_frame_size = little_endian_read_16(packet, payload_offset+6);
                     event_pn.credits_outgoing = packet[payload_offset+9];
                     log_info("Received UIH Parameter Negotiation Command for #%u, credits %u",
@@ -1489,5 +1489,5 @@
                     event_pn.super.type = CH_EVT_RCVD_PN_RSP;
                     event_pn.priority = packet[payload_offset+4];
-                    event_pn.max_frame_size = READ_BT_16(packet, payload_offset+6);
+                    event_pn.max_frame_size = little_endian_read_16(packet, payload_offset+6);
                     event_pn.credits_outgoing = packet[payload_offset+9];
                     log_info("Received UIH Parameter Negotiation Response max frame %u, credits %u",
Index: asp3_tinet_ecnl_rx/trunk/btstack/src/sdp.c
===================================================================
--- asp3_tinet_ecnl_rx/trunk/btstack/src/sdp.c	(revision 337)
+++ asp3_tinet_ecnl_rx/trunk/btstack/src/sdp.c	(revision 374)
@@ -90,5 +90,5 @@
     if (de_get_element_type(serviceRecordHandleAttribute) != DE_UINT) return 0;
     if (de_get_size_type(serviceRecordHandleAttribute) != DE_SIZE_32) return 0;
-    return READ_NET_32(serviceRecordHandleAttribute, 1);
+    return big_endian_read_32(serviceRecordHandleAttribute, 1);
 }
 
@@ -100,5 +100,5 @@
     event[1] = sizeof(event) - 2;
     event[2] = status;
-    bt_store_32(event, 3, handle);
+    little_endian_store_32(event, 3, handle);
     hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event));
     (*app_packet_handler)(connection, HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event));
@@ -275,9 +275,9 @@
 
     // get request details
-    uint16_t  transaction_id = READ_NET_16(packet, 1);
-    // not used yet - uint16_t  param_len = READ_NET_16(packet, 3);
+    uint16_t  transaction_id = big_endian_read_16(packet, 1);
+    // not used yet - uint16_t  param_len = big_endian_read_16(packet, 3);
     uint8_t * serviceSearchPattern = &packet[5];
     uint16_t  serviceSearchPatternLen = de_get_len(serviceSearchPattern);
-    uint16_t  maximumServiceRecordCount = READ_NET_16(packet, 5 + serviceSearchPatternLen);
+    uint16_t  maximumServiceRecordCount = big_endian_read_16(packet, 5 + serviceSearchPatternLen);
     uint8_t * continuationState = &packet[5+serviceSearchPatternLen+2];
 
@@ -297,5 +297,5 @@
     continuation_index = 0;
     if (continuationState[0] == 2){
-        continuation_index = READ_NET_16(continuationState, 1);
+        continuation_index = big_endian_read_16(continuationState, 1);
     }
 
@@ -359,8 +359,8 @@
 
     // get request details
-    uint16_t  transaction_id = READ_NET_16(packet, 1);
-    // not used yet - uint16_t  param_len = READ_NET_16(packet, 3);
-    uint32_t  serviceRecordHandle = READ_NET_32(packet, 5);
-    uint16_t  maximumAttributeByteCount = READ_NET_16(packet, 9);
+    uint16_t  transaction_id = big_endian_read_16(packet, 1);
+    // not used yet - uint16_t  param_len = big_endian_read_16(packet, 3);
+    uint32_t  serviceRecordHandle = big_endian_read_32(packet, 5);
+    uint16_t  maximumAttributeByteCount = big_endian_read_16(packet, 9);
     uint8_t * attributeIDList = &packet[11];
     uint16_t  attributeIDListLen = de_get_len(attributeIDList);
@@ -383,5 +383,5 @@
     continuation_offset = 0;
     if (continuationState[0] == 2){
-        continuation_offset = READ_NET_16(continuationState, 1);
+        continuation_offset = big_endian_read_16(continuationState, 1);
     }
 
@@ -452,9 +452,9 @@
 
     // get request details
-    uint16_t  transaction_id = READ_NET_16(packet, 1);
-    // not used yet - uint16_t  param_len = READ_NET_16(packet, 3);
+    uint16_t  transaction_id = big_endian_read_16(packet, 1);
+    // not used yet - uint16_t  param_len = big_endian_read_16(packet, 3);
     uint8_t * serviceSearchPattern = &packet[5];
     uint16_t  serviceSearchPatternLen = de_get_len(serviceSearchPattern);
-    uint16_t  maximumAttributeByteCount = READ_NET_16(packet, 5 + serviceSearchPatternLen);
+    uint16_t  maximumAttributeByteCount = big_endian_read_16(packet, 5 + serviceSearchPatternLen);
     uint8_t * attributeIDList = &packet[5+serviceSearchPatternLen+2];
     uint16_t  attributeIDListLen = de_get_len(attributeIDList);
@@ -481,6 +481,6 @@
     continuation_offset = 0;
     if (continuationState[0] == 4){
-        continuation_service_index = READ_NET_16(continuationState, 1);
-        continuation_offset = READ_NET_16(continuationState, 3);
+        continuation_service_index = big_endian_read_16(continuationState, 1);
+        continuation_offset = big_endian_read_16(continuationState, 3);
     }
 
@@ -593,6 +593,6 @@
         case L2CAP_DATA_PACKET:
             pdu_id = (SDP_PDU_ID_t) packet[0];
-            transaction_id = READ_NET_16(packet, 1);
-            // param_len = READ_NET_16(packet, 3);
+            transaction_id = big_endian_read_16(packet, 1);
+            // param_len = big_endian_read_16(packet, 3);
             remote_mtu = l2cap_get_remote_mtu_for_local_cid(channel);
             // account for our buffer
Index: asp3_tinet_ecnl_rx/trunk/btstack/src/sdp_client.c
===================================================================
--- asp3_tinet_ecnl_rx/trunk/btstack/src/sdp_client.c	(revision 337)
+++ asp3_tinet_ecnl_rx/trunk/btstack/src/sdp_client.c	(revision 374)
@@ -151,9 +151,9 @@
 static void parse_service_search_attribute_response(uint8_t* packet){
     uint16_t offset = 3;
-    uint16_t parameterLength = READ_NET_16(packet,offset);
+    uint16_t parameterLength = big_endian_read_16(packet,offset);
     uint16_t attributeListByteCount;
     offset+=2;
     // AttributeListByteCount <= mtu
-    attributeListByteCount = READ_NET_16(packet,offset);
+    attributeListByteCount = big_endian_read_16(packet,offset);
     offset+=2;
 
@@ -185,5 +185,5 @@
     // uint16_t handle;
     if (packet_type == L2CAP_DATA_PACKET){
-        uint16_t responseTransactionID = READ_NET_16(packet,1);
+        uint16_t responseTransactionID = big_endian_read_16(packet,1);
         if ( responseTransactionID != transactionID){
             log_error("Missmatching transaction ID, expected %u, found %u.", transactionID, responseTransactionID);
@@ -247,6 +247,6 @@
             }
             sdp_cid = channel;
-            mtu = READ_BT_16(packet, 17);
-            // handle = READ_BT_16(packet, 9);
+            mtu = little_endian_read_16(packet, 17);
+            // handle = little_endian_read_16(packet, 9);
             log_info("SDP Client Connected, cid %x, mtu %u.", sdp_cid, mtu);
 
@@ -261,6 +261,6 @@
         case L2CAP_EVENT_CHANNEL_CLOSED: {
             uint8_t status;
-            if (sdp_cid != READ_BT_16(packet, 2)) {
-                // log_info("Received L2CAP_EVENT_CHANNEL_CLOSED for cid %x, current cid %x\n",  READ_BT_16(packet, 2),sdp_cid);
+            if (sdp_cid != little_endian_read_16(packet, 2)) {
+                // log_info("Received L2CAP_EVENT_CHANNEL_CLOSED for cid %x, current cid %x\n",  little_endian_read_16(packet, 2),sdp_cid);
                 break;
             }
@@ -402,13 +402,13 @@
 static void parse_service_search_response(uint8_t* packet){
     uint16_t offset = 3;
-    uint16_t parameterLength = READ_NET_16(packet,offset);
+    uint16_t parameterLength = big_endian_read_16(packet,offset);
     uint16_t totalServiceRecordCount;
     uint16_t currentServiceRecordCount;
     offset+=2;
 
-    totalServiceRecordCount = READ_NET_16(packet,offset);
-    offset+=2;
-
-    currentServiceRecordCount = READ_NET_16(packet,offset);
+    totalServiceRecordCount = big_endian_read_16(packet,offset);
+    offset+=2;
+
+    currentServiceRecordCount = big_endian_read_16(packet,offset);
     offset+=2;
     if (currentServiceRecordCount > totalServiceRecordCount){
@@ -436,10 +436,10 @@
 static void parse_service_attribute_response(uint8_t* packet){
     uint16_t offset = 3;
-    uint16_t parameterLength = READ_NET_16(packet,offset);
+    uint16_t parameterLength = big_endian_read_16(packet,offset);
 	uint16_t attributeListByteCount;
     offset+=2;
 
     // AttributeListByteCount <= mtu
-    attributeListByteCount = READ_NET_16(packet,offset);
+    attributeListByteCount = big_endian_read_16(packet,offset);
     offset+=2;
 
Index: asp3_tinet_ecnl_rx/trunk/btstack/src/sdp_parser.c
===================================================================
--- asp3_tinet_ecnl_rx/trunk/btstack/src/sdp_parser.c	(revision 337)
+++ asp3_tinet_ecnl_rx/trunk/btstack/src/sdp_parser.c	(revision 374)
@@ -166,5 +166,5 @@
             {
             sdp_query_attribute_value_event_t attribute_value_event = {
-                SDP_QUERY_ATTRIBUTE_VALUE,
+                SDP_EVENT_QUERY_ATTRIBUTE_VALUE,
                 record_counter,
                 attribute_id,
@@ -186,5 +186,5 @@
             {
             sdp_query_attribute_value_event_t attribute_value_event = {
-                SDP_QUERY_ATTRIBUTE_VALUE,
+                SDP_EVENT_QUERY_ATTRIBUTE_VALUE,
                 record_counter,
                 attribute_id,
@@ -258,5 +258,5 @@
     int i;
     for (i=0;i<record_handle_count;i++){
-        record_handle = READ_NET_32(data, i*4);
+        record_handle = big_endian_read_32(data, i*4);
         record_counter++;
 		{
@@ -275,5 +275,5 @@
 void sdp_parser_handle_done(uint8_t status){
     sdp_query_complete_event_t complete_event = {
-        SDP_QUERY_COMPLETE,
+        SDP_EVENT_QUERY_COMPLETE,
         status
     };
Index: asp3_tinet_ecnl_rx/trunk/btstack/src/sdp_query_rfcomm.c
===================================================================
--- asp3_tinet_ecnl_rx/trunk/btstack/src/sdp_query_rfcomm.c	(revision 337)
+++ asp3_tinet_ecnl_rx/trunk/btstack/src/sdp_query_rfcomm.c	(revision 374)
@@ -248,5 +248,5 @@
     sdp_query_attribute_value_event_t * ve;
     switch (event->type){
-        case SDP_QUERY_ATTRIBUTE_VALUE:
+        case SDP_EVENT_QUERY_ATTRIBUTE_VALUE:
             ve = (sdp_query_attribute_value_event_t*) event;
            // log_info("handle_sdp_parser_event [ AID, ALen, DOff, Data] : [%x, %u, %u] BYTE %02x",
@@ -254,5 +254,5 @@
 
             switch (ve->attribute_id){
-                case SDP_ProtocolDescriptorList:
+                case BLUETOOTH_ATTRIBUTE_PROTOCOL_DESCRIPTOR_LIST:
                     // find rfcomm channel
                     handleProtocolDescriptorListData(ve->attribute_length, ve->data_offset, ve->data);
@@ -267,5 +267,5 @@
             }
             break;
-        case SDP_QUERY_COMPLETE:
+        case SDP_EVENT_QUERY_COMPLETE:
             (*sdp_app_callback)(event, sdp_app_context);
             break;
Index: asp3_tinet_ecnl_rx/trunk/btstack/src/sdp_util.c
===================================================================
--- asp3_tinet_ecnl_rx/trunk/btstack/src/sdp_util.c	(revision 337)
+++ asp3_tinet_ecnl_rx/trunk/btstack/src/sdp_util.c	(revision 374)
@@ -98,8 +98,8 @@
             break;
         case DE_SIZE_VAR_16:
-            result = READ_NET_16(header,1);
+            result = big_endian_read_16(header,1);
             break;
         case DE_SIZE_VAR_32:
-            result = READ_NET_32(header,1);
+            result = big_endian_read_32(header,1);
             break;
         default:
@@ -122,5 +122,5 @@
 int de_element_get_uint16(uint8_t * element, uint16_t * value){
     if (de_get_size_type(element) != DE_SIZE_16) return 0;
-    *value = READ_NET_16(element, de_get_header_size(element));
+    *value = big_endian_read_16(element, de_get_header_size(element));
     return 1;
 }
@@ -134,8 +134,8 @@
     switch (uuidSize){
         case DE_SIZE_16:
-            shortUUID = READ_NET_16(element, 1);
+            shortUUID = big_endian_read_16(element, 1);
             break;
         case DE_SIZE_32:
-            shortUUID = READ_NET_32(element, 1);
+            shortUUID = big_endian_read_32(element, 1);
             break;
         case DE_SIZE_128:
@@ -157,5 +157,5 @@
     hasBlueoothBaseUuid = sdp_has_blueooth_base_uuid(uuid128);
     if (!hasBlueoothBaseUuid) return 0;
-    return READ_NET_32(uuid128, 0);
+    return big_endian_read_32(uuid128, 0);
 }
 
@@ -199,5 +199,5 @@
 void de_pop_sequence(uint8_t * parent, uint8_t * child){
     int child_len = de_get_len(child);
-    int data_size_parent = READ_NET_16(parent,1);
+    int data_size_parent = big_endian_read_16(parent,1);
     net_store_16(parent, 1, data_size_parent + child_len);
 }
@@ -205,5 +205,5 @@
 /* adds a single number value and 16+32 bit UUID to the sequence */
 void de_add_number(uint8_t *seq, de_type_t type, de_size_t size, uint32_t value){
-    int data_size   = READ_NET_16(seq,1);
+    int data_size   = big_endian_read_16(seq,1);
     int element_size = 1;   // e.g. for DE_TYPE_NIL
     de_store_descriptor(seq+3+data_size, type, size);
@@ -231,5 +231,5 @@
 /* add a single block of data, e.g. as DE_STRING, DE_URL */
 void de_add_data( uint8_t *seq, de_type_t type, uint16_t size, uint8_t *data){
-    int data_size   = READ_NET_16(seq,1);
+    int data_size   = big_endian_read_16(seq,1);
     if (size > 0xff) {
         // use 16-bit lengh information (3 byte header)
@@ -247,5 +247,5 @@
 
 void de_add_uuid128(uint8_t * seq, uint8_t * uuid){
-    int data_size   = READ_NET_16(seq,1);
+    int data_size   = big_endian_read_16(seq,1);
     de_store_descriptor(seq+3+data_size, DE_UUID, DE_SIZE_128);
     memcpy( seq + 4 + data_size, uuid, 16);
@@ -326,5 +326,5 @@
         uint8_t done;
         if (idType != DE_UINT || idSize != DE_SIZE_16) break; // wrong type
-        attribute_id = READ_NET_16(element, pos + 1);
+        attribute_id = big_endian_read_16(element, pos + 1);
         pos += 3;
         if (pos >= end_pos) break; // array out of bounds
@@ -349,5 +349,5 @@
     switch (size) {
         case DE_SIZE_16:
-            if (READ_NET_16(element, 1) == context->attributeID) {
+            if (big_endian_read_16(element, 1) == context->attributeID) {
                 context->result = 1;
                 return 1;
@@ -355,6 +355,6 @@
             break;
         case DE_SIZE_32:
-            if (READ_NET_16(element, 1) <= context->attributeID
-            &&  context->attributeID <= READ_NET_16(element, 3)) {
+            if (big_endian_read_16(element, 1) <= context->attributeID
+            &&  context->attributeID <= big_endian_read_16(element, 3)) {
                 context->result = 1;
                 return 1;
@@ -388,5 +388,5 @@
     if (sdp_attribute_list_constains_id(context->attributeIDList, attributeID)) {
         // DES_HEADER(3) + DES_DATA + (UINT16(3) + attribute)
-        uint16_t data_size = READ_NET_16(context->buffer, 1);
+        uint16_t data_size = big_endian_read_16(context->buffer, 1);
         int attribute_len = de_get_len(attributeValue);
         if (3 + data_size + (3 + attribute_len) <= context->maxBytes) {
@@ -662,5 +662,5 @@
                 break;
             case DE_SIZE_VAR_16:
-                len = READ_NET_16(element, 1);
+                len = big_endian_read_16(element, 1);
                 break;
             default:
@@ -678,8 +678,8 @@
                 break;
             case DE_SIZE_16:
-				value = READ_NET_16(element,pos);
+				value = big_endian_read_16(element,pos);
                 break;
             case DE_SIZE_32:
-				value = READ_NET_32(element,pos);
+				value = big_endian_read_32(element,pos);
                 break;
             default:
@@ -712,5 +712,5 @@
 
 	// 0x0001 "Service Class ID List"
-	de_add_number(service,  DE_UINT, DE_SIZE_16, SDP_ServiceClassIDList);
+	de_add_number(service,  DE_UINT, DE_SIZE_16, BLUETOOTH_ATTRIBUTE_SERVICE_CLASS_ID_LIST);
 	attribute = de_push_sequence(service);
 	{
@@ -720,5 +720,5 @@
 
 	// 0x0004 "Protocol Descriptor List"
-	de_add_number(service,  DE_UINT, DE_SIZE_16, SDP_ProtocolDescriptorList);
+	de_add_number(service,  DE_UINT, DE_SIZE_16, BLUETOOTH_ATTRIBUTE_PROTOCOL_DESCRIPTOR_LIST);
 	attribute = de_push_sequence(service);
 	{
Index: asp3_tinet_ecnl_rx/trunk/btstack/src/utils.c
===================================================================
--- asp3_tinet_ecnl_rx/trunk/btstack/src/utils.c	(revision 337)
+++ asp3_tinet_ecnl_rx/trunk/btstack/src/utils.c	(revision 374)
@@ -49,10 +49,10 @@
 #include "debug.h"
 
-void bt_store_16(uint8_t *buffer, uint16_t pos, uint16_t value){
+void little_endian_store_16(uint8_t *buffer, uint16_t pos, uint16_t value){
     buffer[pos++] = value;
     buffer[pos++] = value >> 8;
 }
 
-void bt_store_32(uint8_t *buffer, uint16_t pos, uint32_t value){
+void little_endian_store_32(uint8_t *buffer, uint16_t pos, uint32_t value){
     buffer[pos++] = value;
     buffer[pos++] = value >> 8;
@@ -73,5 +73,5 @@
 }
 
-void bt_flip_addr(bd_addr_t dest, bd_addr_t src){
+void reverse_bd_addr(bd_addr_t src, bd_addr_t dest){
     dest[0] = src[5];
     dest[1] = src[4];
