cc3000 driver with expanded buffers.
Fork of cc3000_hostdriver_mbedsocket by
Diff: cc3000.cpp
- Revision:
- 41:eb1999bd50fb
- Parent:
- 40:acb9324640c4
- Child:
- 42:bd2c631a031a
--- a/cc3000.cpp Sat Oct 12 20:51:05 2013 +0000 +++ b/cc3000.cpp Sat Oct 12 21:03:45 2013 +0000 @@ -133,12 +133,14 @@ void cc3000::usync_callback(int32_t event_type, uint8_t * data, uint8_t length) { if (event_type == HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE) { + DBG_CC("Callback : HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE"); _status.smart_config_complete = 1; _status.stop_smart_config = 1; } if (event_type == HCI_EVNT_WLAN_UNSOL_CONNECT) { + DBG_CC("Callback : HCI_EVNT_WLAN_UNSOL_CONNECT"); _status.connected = 1; // Connect message is always followed by a DHCP message, connection is not useable until then _status.dhcp = 0; @@ -146,6 +148,7 @@ if (event_type == HCI_EVNT_WLAN_UNSOL_DISCONNECT) { + DBG_CC("Callback : HCI_EVNT_WLAN_UNSOL_DISCONNECT"); _status.connected = 0; _status.dhcp = 0; _status.dhcp_configured = 0; @@ -153,35 +156,41 @@ if (event_type == HCI_EVNT_WLAN_UNSOL_DHCP) { - #ifdef CC3000_ETH_COMPAT - - inet_ntoa_r( htonl(*((uint32_t *)(&data[NETAPP_IPCONFIG_IP_OFFSET]))), ip_addr, 17); - inet_ntoa_r( htonl(*((uint32_t *)(&data[NETAPP_IPCONFIG_GW_OFFSET]))), gateway, 17); - inet_ntoa_r( htonl(*((uint32_t *)(&data[NETAPP_IPCONFIG_SUBNET_OFFSET]))), networkmask, 17); - inet_ntoa_r( htonl(*((uint32_t *)(&data[NETAPP_IPCONFIG_MAC_OFFSET]))), mac_addr, 19); - - #endif - - if ( *(data + NETAPP_IPCONFIG_MAC_OFFSET) == 0) { - _status.dhcp = 1; - } else { - _status.dhcp = 0; - } + #ifdef CC3000_ETH_COMPAT + + inet_ntoa_r( htonl(*((uint32_t *)(&data[NETAPP_IPCONFIG_IP_OFFSET]))), ip_addr, 17); + inet_ntoa_r( htonl(*((uint32_t *)(&data[NETAPP_IPCONFIG_GW_OFFSET]))), gateway, 17); + inet_ntoa_r( htonl(*((uint32_t *)(&data[NETAPP_IPCONFIG_SUBNET_OFFSET]))), networkmask, 17); + inet_ntoa_r( htonl(*((uint32_t *)(&data[NETAPP_IPCONFIG_MAC_OFFSET]))), mac_addr, 19); + + #endif + + if ( *(data + NETAPP_IPCONFIG_MAC_OFFSET) == 0) { + _status.dhcp = 1; + DBG_CC("Callback : HCI_EVNT_WLAN_UNSOL_DHCP %i.%i.%i.%i", data[3], data[2], data[1], data[0]); + } else { + DBG_CC("Callback : HCI_EVNT_WLAN_UNSOL_DHCP - Disconnected"); + _status.dhcp = 0; + } } if (event_type == HCI_EVENT_CC3000_CAN_SHUT_DOWN) { + // Note this means the moudles is idle, so it could be shutdown.. + //DBG_CC("Callback : HCI_EVENT_CC3000_CAN_SHUT_DOWN"); _status.ok_to_shut_down = 1; } if (event_type == HCI_EVNT_WLAN_ASYNC_PING_REPORT) { + DBG_CC("Callback : HCI_EVNT_WLAN_ASYNC_PING_REPORT"); memcpy(&_ping_report, data, length); } if (event_type == HCI_EVNT_BSD_TCP_CLOSE_WAIT) { uint8_t socketnum; socketnum = data[0]; + DBG_CC("Callback : HCI_EVNT_BSD_TCP_CLOSE_WAIT - Socket : %d", socketnum); if (socketnum < MAX_SOCKETS) { _closed_sockets[socketnum] = true; /* clients socket is closed */ }