Index: asp3_tinet_ecnl_arm/trunk/btstack/src/rfcomm.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/btstack/src/rfcomm.c	(revision 352)
+++ asp3_tinet_ecnl_arm/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",
