cc3000 hostdriver with the mbed socket interface

Fork of cc3000_hostdriver_mbedsocket by Martin Kojtal

Revision:
51:897cfc2c7e8c
Parent:
49:aee80f12ccca
--- a/cc3000_spi.cpp	Sun Apr 05 14:25:45 2015 +0000
+++ b/cc3000_spi.cpp	Mon Apr 06 18:23:37 2015 +0000
@@ -43,8 +43,8 @@
 
 namespace mbed_cc3000 {
 
-cc3000_spi::cc3000_spi(PinName cc3000_irq, PinName cc3000_en, PinName cc3000_cs, SPI cc3000_spi, cc3000_event &event, cc3000_simple_link &simple_link)
-  : _wlan_irq(cc3000_irq), _wlan_en(cc3000_en), _wlan_cs(cc3000_cs), _wlan_spi(cc3000_spi), _event(event), _simple_link(simple_link) {
+cc3000_spi::cc3000_spi(PinName cc3000_irq, PinName cc3000_en, PinName cc3000_cs, SPI cc3000_spi, cc3000_event &event, cc3000_simple_link &simple_link, uint32_t max_tx, uint32_t max_rx)
+  : _wlan_irq(cc3000_irq), _wlan_en(cc3000_en), _wlan_cs(cc3000_cs), _wlan_spi(cc3000_spi), _event(event), _simple_link(simple_link), _max_tx(max_tx), _max_rx(max_rx) {
 
     _wlan_spi.format(8,1);
     _wlan_spi.frequency(12000000);
@@ -121,8 +121,8 @@
     // The magic number resides at the end of the TX/RX buffer (1 byte after the allocated size)
     // If the magic number is overwitten - buffer overrun occurred - we will be stuck here forever!
     uint8_t *transmit_buffer = _simple_link.get_transmit_buffer();
-    if (transmit_buffer[CC3000_TX_BUFFER_SIZE - 1] != CC3000_BUFFER_MAGIC_NUMBER) {
-        DBG_CC("System halted - TX buffer overflow detected (buffer size: %d).", CC3000_TX_BUFFER_SIZE);
+    if (transmit_buffer[_max_tx - 1] != CC3000_BUFFER_MAGIC_NUMBER) {
+        DBG_CC("System halted - TX buffer overflow detected (buffer size: %d).", _max_tx);
         while (1);
     }
 
@@ -238,8 +238,8 @@
                 // The magic number resides at the end of the TX/RX buffer (1 byte after the allocated size)
                 // If the magic number is overwitten - buffer overrun occurred - we will be stuck here forever!
                 uint8_t *received_buffer = _simple_link.get_received_buffer();
-                if (received_buffer[CC3000_RX_BUFFER_SIZE - 1] != CC3000_BUFFER_MAGIC_NUMBER) {
-                    DBG_CC("System halted - RX buffer overflow detected (buffer size: %d).", CC3000_RX_BUFFER_SIZE);
+                if (received_buffer[_max_rx - 1] != CC3000_BUFFER_MAGIC_NUMBER) {
+                    DBG_CC("System halted - RX buffer overflow detected (buffer size: %d).", _max_rx);
                     while (1);
                 }