mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Revision:
150:02e0a0aed4ec
Parent:
149:156823d33999
Child:
164:289d4deac6e4
--- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/sdk/wifi_emac/wifi_emac_api.cpp	Fri Oct 28 11:17:30 2016 +0100
+++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/sdk/wifi_emac/wifi_emac_api.cpp	Tue Nov 08 17:45:16 2016 +0000
@@ -266,8 +266,17 @@
 {
     (void)emac;
     // Break call chain to avoid the driver affecting stack usage for the IP stack thread too much
-    emac_stack_mem_ref(emac,buf);
-    cbMAIN_getEventQueue()->call(send_packet,emac,buf);
+    emac_stack_mem_t *new_buf = emac_stack_mem_alloc(emac, emac_stack_mem_chain_len(emac,buf),0);
+    if (new_buf != NULL) {
+        emac_stack_mem_copy(emac, new_buf, buf);
+        int id = cbMAIN_getEventQueue()->call(send_packet, emac, new_buf);
+        if (id != 0) {
+            cbMAIN_dispatchEventQueue();        
+        }
+        else {
+            emac_stack_mem_free(emac, new_buf);
+        }
+    }
     return true;
 }