cc3000 driver with expanded buffers.
Fork of cc3000_hostdriver_mbedsocket by
Diff: cc3000.cpp
- Revision:
- 13:5e36c267e62f
- Parent:
- 11:5e3771b29385
- Child:
- 14:28c8bbbea025
--- a/cc3000.cpp Tue Oct 01 21:17:44 2013 +0000 +++ b/cc3000.cpp Wed Oct 02 15:00:07 2013 +0000 @@ -133,18 +133,17 @@ // Start the Smart Config process with AES disabled _wlan.smart_config_start(0); -#if (CC3000_DEBUG == 1) - printf("DEBUG: Waiting for smartconfig to be completed.\n"); -#endif + DBG_HCI("Waiting for smartconfig to be completed"); + // Wait for Smart config finished while (_status.smart_config_complete == 0) { wait_ms(100); } -#if (CC3000_DEBUG == 1) - printf("DEBUG: Smartconfig finished.\n"); -#endif + + DBG_HCI("Smartconfig finished"); + #ifndef CC3000_UNENCRYPTED_SMART_CONFIG // create new entry for AES encryption key _nvmem.create_entry(NVMEM_AES128_KEY_FILEID, 16); @@ -205,9 +204,9 @@ /* timeout 10 seconds */ if (t.read_ms() > 10000){ ret = false; -#if (CC3000_DEBUG == 1) - printf("Connection to AP failed.\n"); -#endif + + DBG_HCI("Connection to AP failed"); + break; } } @@ -289,9 +288,7 @@ tcp_socket = _socket.socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (tcp_socket == -1) { -#if (CC3000_DEBUG == 1) - printf("DEBUG: Failed to create new socket (tcp).\n"); -#endif + DBG_HCI("Failed to create new socket (tcp)"); return cc3000_client(*this); } @@ -304,9 +301,7 @@ socket_address.data[5] = ip_address; if (_socket.connect(tcp_socket, &socket_address, sizeof(socket_address)) == -1) { -#if (CC3000_DEBUG == 1) - printf("DEBUG: Failed to connect (tcp).\n"); -#endif + DBG_HCI("Failed to connect (tcp)"); _socket.closesocket(tcp_socket); return cc3000_client(*this); } @@ -319,9 +314,7 @@ udp_socket = _socket.socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (udp_socket == -1) { -#if (CC3000_DEBUG == 1) - printf("DEBUG: Failed to create new socket (udp).\n"); -#endif + DBG_HCI("Failed to create new socket (udp)"); return cc3000_client(*this); } @@ -334,9 +327,7 @@ socket_address.data[5] = ip_address; if (_socket.connect(udp_socket, &socket_address, sizeof(socket_address)) == -1) { -#if (CC3000_DEBUG == 1) - printf("DEBUG: Failed to connect (udp).\n"); -#endif + DBG_HCI("Failed to connect (udp)"); _socket.closesocket(udp_socket); return cc3000_client(*this); } @@ -350,9 +341,7 @@ tcp_socket = _socket.socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (tcp_socket == -1) { -#if (CC3000_DEBUG == 1) - printf("Failed to create new socket.\n"); -#endif + DBG_HCI("Failed to create new socket."); return cc3000_server(*this, socket_address); } @@ -365,15 +354,11 @@ socket_address.data[5] = ip_address; if (_socket.bind(tcp_socket, &socket_address, sizeof(socket_address)) != 0) { -#if (CC3000_DEBUG == 1) - printf("DEBUG: Failed to bind the new socket.\n"); -#endif + DBG_HCI("Failed to bind the new socket"); return cc3000_server(*this, socket_address); } if (_socket.listen(tcp_socket, 1) != 0) { /* 1 client */ -#if (CC3000_DEBUG == 1) - printf("DEBUG: Failed to listen on the new socket.\n"); -#endif + DBG_HCI("Failed to listen on the new socket"); return cc3000_server(*this, socket_address); } @@ -408,21 +393,18 @@ _ping_report.packets_received = 0; if (_netapp.ping_send(&reversed_ip, attempts, size, timeout) == -1) { -#if (CC3000_DEBUG == 1) - printf("DEBUG: Failed to send ping.\n"); -#endif + DBG_HCI("Failed to send ping"); return 0; } wait_ms(timeout*attempts*2); /* known issue of cc3000 - sent number is send + received */ -#if (CC3000_DEBUG == 1) - printf("DEBUG: Sent: %d \r\n",_ping_report.packets_sent); - printf("DEBUG: Received: %d \r\n",_ping_report.packets_received); - printf("DEBUG: Min time: %d \r\n",_ping_report.min_round_time); - printf("DEBUG: Max time: %d \r\n",_ping_report.max_round_time); - printf("DEBUG: Avg time: %d \r\n",_ping_report.avg_round_time); -#endif + // TODO : Remove the Sent/recv'd counts until ti fix the firmware issue? + DBG_HCI("Sent: %d \r\n",_ping_report.packets_sent); + DBG_HCI("Received: %d \r\n",_ping_report.packets_received); + DBG_HCI("Min time: %d \r\n",_ping_report.min_round_time); + DBG_HCI("Max time: %d \r\n",_ping_report.max_round_time); + DBG_HCI("Avg time: %d \r\n",_ping_report.avg_round_time); return _ping_report.packets_received; }