Added mutex for multiple SPI devices on the same SPI bus
Fork of cc3000_hostdriver_mbedsocket by
Diff: cc3000_event.cpp
- Revision:
- 45:50ab13d8f2dc
- Parent:
- 44:960b73df5981
--- a/cc3000_event.cpp Sun Oct 13 11:46:21 2013 +0200
+++ b/cc3000_event.cpp Wed Nov 06 17:56:25 2013 +0100
@@ -430,9 +430,6 @@
}
_simple_link.set_data_received_flag(0);
-
- //tWlanInterruptEnable func_pointer = (tWlanInterruptEnable)_simple_link.get_func_pointer(WLAN_INTERRUPT_ENABLE);
- //func_pointer();
_spi.wlan_irq_enable();
// Since we are going to TX - we need to handle this event after the ResumeSPi since we need interrupts
@@ -485,15 +482,8 @@
case HCI_EVNT_WLAN_UNSOL_DISCONNECT:
case HCI_EVNT_WLAN_UNSOL_INIT:
case HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE:
- // {
- // tWlanCB func_pointer = (tWlanCB)_simple_link.get_func_pointer(WLAN_CB);
- // if( func_pointer )
- // {
- // func_pointer(event_type, 0, 0);
- // }
- _cc3000.usync_callback(event_type, 0, 0);
+ _cc3000.usync_callback(event_type, 0, 0);
break;
- // }
case HCI_EVNT_WLAN_UNSOL_DHCP:
{
uint8_t params[NETAPP_IPCONFIG_MAC_OFFSET + 1]; // extra byte is for the status
@@ -517,11 +507,8 @@
// read the status
STREAM_TO_UINT8(event_hdr, HCI_EVENT_STATUS_OFFSET, *recParams);
- // tWlanCB func_pointer = (tWlanCB)_simple_link.get_func_pointer(WLAN_CB);
- // if( func_pointer )
- // {
- _cc3000.usync_callback(event_type, (uint8_t *)params, sizeof(params));
- // }
+ _cc3000.usync_callback(event_type, (uint8_t *)params, sizeof(params));
+
break;
}
case HCI_EVNT_WLAN_ASYNC_PING_REPORT:
@@ -534,20 +521,12 @@
STREAM_TO_UINT32(data, NETAPP_PING_MAX_RTT_OFFSET, params.max_round_time);
STREAM_TO_UINT32(data, NETAPP_PING_AVG_RTT_OFFSET, params.avg_round_time);
- // tWlanCB func_pointer = (tWlanCB)_simple_link.get_func_pointer(WLAN_CB);
- // if (func_pointer)
- // {
- _cc3000.usync_callback(event_type, (uint8_t *)¶ms, sizeof(params));
- // }
+ _cc3000.usync_callback(event_type, (uint8_t *)¶ms, sizeof(params));
break;
}
case HCI_EVNT_BSD_TCP_CLOSE_WAIT:
{
- // tWlanCB func_pointer = (tWlanCB)_simple_link.get_func_pointer(WLAN_CB);
- // if (func_pointer)
- // {
- _cc3000.usync_callback(event_type, NULL, 0);
- // }
+ _cc3000.usync_callback(event_type, NULL, 0);
break;
}
@@ -603,8 +582,7 @@
}
void cc3000_event::set_socket_active_status(int32_t sd, int32_t status) {
- if (M_IS_VALID_SD(sd) && M_IS_VALID_STATUS(status))
- {
+ if (M_IS_VALID_SD(sd) && M_IS_VALID_STATUS(status)) {
socket_active_status &= ~(1 << sd); /* clean socket's mask */
socket_active_status |= (status << sd); /* set new socket's mask */
}
@@ -633,7 +611,7 @@
}
int32_t cc3000_event::get_socket_active_status(int32_t sd) {
- if(M_IS_VALID_SD(sd)) {
+ if (M_IS_VALID_SD(sd)) {
return (socket_active_status & (1 << sd)) ? SOCKET_STATUS_INACTIVE : SOCKET_STATUS_ACTIVE;
} else {
return SOCKET_STATUS_INACTIVE;
@@ -646,7 +624,7 @@
STREAM_TO_UINT32(resp_params, BSD_RSP_PARAMS_SOCKET_OFFSET,sd);
STREAM_TO_UINT32(resp_params, BSD_RSP_PARAMS_STATUS_OFFSET,status);
- if(ERROR_SOCKET_INACTIVE == status) {
+ if (ERROR_SOCKET_INACTIVE == status) {
set_socket_active_status(sd, SOCKET_STATUS_INACTIVE);
}
}
@@ -666,4 +644,4 @@
}
-} /* end of cc3000 namespace */
+} // end of cc3000
