cc3000 hostdriver with the mbed socket interface

Fork of cc3000_hostdriver_mbedsocket by Martin Kojtal

Revision:
51:897cfc2c7e8c
Parent:
47:a63fe1a4f568
--- a/cc3000.h	Sun Apr 05 14:25:45 2015 +0000
+++ b/cc3000.h	Mon Apr 06 18:23:37 2015 +0000
@@ -152,6 +152,13 @@
      *  \return none
      */
     ~cc3000_simple_link();
+
+    /**
+     *  \brief Init TX and RX buffers.
+     *  \return none.
+     */
+    void create_txrx_buffers(uint32_t tx_size, uint32_t rx_size);
+
     /**
      *  \brief Returns data received flag.
      *  \return Data received flag.
@@ -313,8 +320,8 @@
     uint16_t _released_packets;
     int32_t  _transmit_data_error;
     uint8_t  *_received_data;
-    uint8_t  _rx_buffer[CC3000_RX_BUFFER_SIZE];
-    uint8_t  _tx_buffer[CC3000_TX_BUFFER_SIZE];
+    uint8_t  *_rx_buffer;
+    uint8_t  *_tx_buffer;
 private:
     /* Not used currently */
     int8_t *(* _fFWPatches)(uint32_t *length);
@@ -1079,9 +1086,11 @@
      *  \param irq_port    Port for IRQ pin (needed for enable/disable interrupts)
      *  \param event       Reference to the event object.
      *  \param simple_link Reference to the simple link object.
+     *  \param max_tx      Max. TX buffer size
+     *  \param max_rx      Max. RX buffer size
      *  \return none
      */
-     cc3000_spi(PinName cc3000_irq, PinName cc3000_en, PinName cc3000_cs, SPI cc3000_spi, cc3000_event &event, cc3000_simple_link &simple_link);
+     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);
     /**
      *  \brief Dtor
      *  \param none
@@ -1177,6 +1186,8 @@
     SPI                 _wlan_spi;
     cc3000_event        &_event;
     cc3000_simple_link  &_simple_link;
+    uint32_t            _max_tx;
+    uint32_t            _max_rx;
     bool                _process_irq;
 };
 
@@ -1554,8 +1565,14 @@
      *  \param cc3000_en  Enable pin
      *  \param cc3000_cs  Chip select pin
      *  \param cc3000_spi SPI interface
+     *  \param max_tx_size  TX buffer size (optional, default = 1520)
+     *  \param max_rx_size  RX buffer size (optional, default = 512)
      */
-    cc3000(PinName cc3000_irq, PinName cc3000_en, PinName cc3000_cs, SPI cc3000_spi);
+#ifndef CC3000_TINY_DRIVER
+    cc3000(PinName cc3000_irq, PinName cc3000_en, PinName cc3000_cs, SPI cc3000_spi, uint32_t max_tx_size = 1520, uint32_t max_rx_size = 512);
+#else
+    cc3000(PinName cc3000_irq, PinName cc3000_en, PinName cc3000_cs, SPI cc3000_spi, uint32_t max_tx_size = 59, uint32_t max_rx_size = 44);
+#endif
     /**
      *  \brief Dtor.
      */
@@ -1705,8 +1722,14 @@
      *  \param phrase       Password
      *  \param sec          Security of the AP
      *  \param smart_config Smart config selection
+     *  \param max_tx_size  TX buffer size (optional, default = 1520)
+     *  \param max_rx_size  RX buffer size (optional, default = 512)
      */
-    cc3000(PinName cc3000_irq, PinName cc3000_en, PinName cc3000_cs, SPI cc3000_spi, const char *ssid, const char *phrase, Security sec, bool smart_config);
+#ifndef CC3000_TINY_DRIVER
+    cc3000(PinName cc3000_irq, PinName cc3000_en, PinName cc3000_cs, SPI cc3000_spi, const char *ssid, const char *phrase, Security sec, bool smart_config, uint32_t max_tx_size = 1520, uint32_t max_rx_size = 512);
+#else
+    cc3000(PinName cc3000_irq, PinName cc3000_en, PinName cc3000_cs, SPI cc3000_spi, const char *ssid, const char *phrase, Security sec, bool smart_config, uint32_t max_tx_size = 59, uint32_t max_rx_size = 44);
+#endif
     /**
      *  \brief Disconnect wlan device.
      *  \param none