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:
Tue May 06 22:38:34 2014 +0000
Parent:
55:3d640d25a7ec
Child:
57:8caf996d7b6a
Commit message:
Stop hci event handler from locking up in the situation where the micro thinks there's an event about to happen and the cc3000 disagrees.

Changed in this revision

cc3000_event.cpp Show annotated file Show diff for this revision Revisions of this file
cc3000_socket.cpp 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_event.cpp	Tue May 06 21:22:41 2014 +0000
+++ b/cc3000_event.cpp	Tue May 06 22:38:34 2014 +0000
@@ -198,8 +198,6 @@
 #endif
 }
 
-DigitalOut led1(p3);
-
 uint8_t *cc3000_event::hci_event_handler(void *ret_param, uint8_t *from, uint8_t *fromlen) {
     uint8_t *received_data, argument_size;
     uint16_t length;
@@ -208,11 +206,16 @@
     uint32_t return_value;
     uint8_t * RecvParams;
     uint8_t *RetParams;
+    int escapeCounter;
+    escapeCounter = 100000000;
     while (1)
     {   
+        escapeCounter--;
+        if (!escapeCounter)
+            return NULL;
+            
         if (_simple_link.get_data_received_flag() != 0)
         {
-            led1=0;
             received_data = _simple_link.get_received_data();
             if (*received_data == HCI_TYPE_EVNT)
             {
@@ -406,7 +409,6 @@
                     }
 
                 }
-                led1=1;
                 if (received_op_code == _simple_link.get_op_code())
                 {
                     _simple_link.set_op_code(0);
--- a/cc3000_socket.cpp	Tue May 06 21:22:41 2014 +0000
+++ b/cc3000_socket.cpp	Tue May 06 22:38:34 2014 +0000
@@ -465,7 +465,7 @@
     else
        _event.simplelink_wait_event(HCI_EVNT_SEND, &tSocketSendEvent);
 
-    return (len);
+    return (len); 
 }
 
 int32_t cc3000_socket::send(int32_t sd, const void *buf, int32_t len, int32_t flags) {
--- a/cc3000_spi.cpp	Tue May 06 21:22:41 2014 +0000
+++ b/cc3000_spi.cpp	Tue May 06 22:38:34 2014 +0000
@@ -122,9 +122,7 @@
     // 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) {
-        // we're probably going to die anyway, if a real buffer overrun has happened.
-        // try to fix it up and go anyway. - jls
-        transmit_buffer[CC3000_TX_BUFFER_SIZE - 1] = CC3000_BUFFER_MAGIC_NUMBER;
+        NVIC_SystemReset();
     }
 
     if (_spi_info.spi_state == eSPI_STATE_POWERUP) {
@@ -242,7 +240,7 @@
                 if (received_buffer[CC3000_RX_BUFFER_SIZE - 1] != CC3000_BUFFER_MAGIC_NUMBER) {
                     // we're probably going to die anyway, if a real buffer overrun has happened.
                     // try to fix it up and go anyway. - jls
-                    received_buffer[CC3000_RX_BUFFER_SIZE - 1] = CC3000_BUFFER_MAGIC_NUMBER;
+                    NVIC_SystemReset();
                 }
 
                 _spi_info.spi_state = eSPI_STATE_IDLE;