cc3000 driver with expanded buffers.

Fork of cc3000_hostdriver_mbedsocket by Martin Kojtal

Files at this revision

API Documentation at this revision

Comitter:
heroic
Date:
Wed May 07 02:53:08 2014 +0000
Parent:
56:9ab991c1d2db
Commit message:
Yet more debugging.

Changed in this revision

cc3000.h Show annotated file Show diff for this revision Revisions of this file
cc3000_common.h Show annotated file Show diff for this revision Revisions of this file
cc3000_spi.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/cc3000.h	Tue May 06 22:38:34 2014 +0000
+++ b/cc3000.h	Wed May 07 02:53:08 2014 +0000
@@ -49,9 +49,10 @@
 #include "cc3000_nvmem.h"
 #include "cc3000_socket.h"
 
-#define MAX_SOCKETS 2
+#define MAX_SOCKETS 4
 // cc3000 Ethernet Interface - enabled by default
 #define CC3000_ETH_COMPAT   1
+#define SEND_NON_BLOCKING 1
 
 /** Enable debug messages - set 1  */
 // Debug - Socket interface messages
--- a/cc3000_common.h	Tue May 06 22:38:34 2014 +0000
+++ b/cc3000_common.h	Wed May 07 02:53:08 2014 +0000
@@ -103,7 +103,7 @@
   The 1 is used for the overrun detection */
 
 #define CC3000_MINIMAL_TX_SIZE      (118 + 1)
-#define CC3000_MAXIMAL_TX_SIZE      (576 + 1)
+#define CC3000_MAXIMAL_TX_SIZE      (1519 + 1)
 
 //TX and RX buffer size - allow to receive and transmit maximum data at lengh 8.
 #ifdef CC3000_TINY_DRIVER
@@ -121,7 +121,7 @@
 
     #define CC3000_RX_BUFFER_SIZE   (CC3000_MAXIMAL_RX_SIZE)
     #define CC3000_TX_BUFFER_SIZE   (CC3000_MAXIMAL_TX_SIZE)
-    #define SP_PORTION_SIZE         1500
+    #define SP_PORTION_SIZE         512
 
 //TINY DRIVER: We use smaller rx and tx buffers in order to minimize RAM consumption
 #else
--- a/cc3000_spi.cpp	Tue May 06 22:38:34 2014 +0000
+++ b/cc3000_spi.cpp	Wed May 07 02:53:08 2014 +0000
@@ -106,6 +106,7 @@
 
 uint32_t cc3000_spi::write(uint8_t *buffer, uint16_t length) {
     uint8_t pad = 0;
+    uint32_t escapeCounter;
     // check the total length of the packet in order to figure out if padding is necessary
     if(!(length & 0x0001)) {
       pad++;
@@ -126,7 +127,12 @@
     }
 
     if (_spi_info.spi_state == eSPI_STATE_POWERUP) {
-        while (_spi_info.spi_state != eSPI_STATE_INITIALIZED);
+        escapeCounter = 100000000;
+        while (_spi_info.spi_state != eSPI_STATE_INITIALIZED) {
+            escapeCounter--;
+            if (!escapeCounter)
+                break;
+        }
     }
 
     if (_spi_info.spi_state == eSPI_STATE_INITIALIZED) {
@@ -137,7 +143,12 @@
         // device, so the state will move to IDLE and once again to not IDLE due to IRQ
         wlan_irq_disable();
 
-        while (_spi_info.spi_state != eSPI_STATE_IDLE);
+        escapeCounter = 100000000;
+        while (_spi_info.spi_state != eSPI_STATE_IDLE){
+            escapeCounter--;
+            if (!escapeCounter)
+                break;
+        }
 
         _spi_info.spi_state = eSPI_STATE_WRITE_IRQ;
         //_spi_info.pTxPacket = buffer;
@@ -150,8 +161,12 @@
     }
 
     // Wait until the transaction ends
-    while (_spi_info.spi_state != eSPI_STATE_IDLE);
-
+    escapeCounter = 100000000;
+    while (_spi_info.spi_state != eSPI_STATE_IDLE) {
+        escapeCounter--;
+        if (!escapeCounter)
+            break;
+    }
     return 0;
 }