CC3000 driver update from David Sidrane (part 2 of 2)

This commit is contained in:
Gregory Nutt
2013-10-25 16:39:27 -06:00
parent 607acec781
commit 8c094aeda8
7 changed files with 507 additions and 635 deletions
+2
View File
@@ -5884,4 +5884,6 @@
(2015-10-25).
* configs/spark: Spark configuration updated by David Sidrane
(2013-10-25).
* drivers/wireless/cc3000 and include/nuttx/wireless/cc3000:
CC3000 driver update from David Sidrane (2013-10-25).
+54 -53
View File
@@ -54,16 +54,20 @@
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
#define DEV_FORMAT "/dev/wireless%d"
#define DEV_NAMELEN 16
#define QUEUE_FORMAT "wlq%d"
#define QUEUE_NAMELEN 6
#define DEV_FORMAT "/dev/wireless%d" /* The device Name*/
#define DEV_NAMELEN 17 /* The buffer size to hold formatted string*/
#define QUEUE_FORMAT "wlq%d" /* The Queue name */
#define QUEUE_NAMELEN 8 /* The buffer size to hold formatted string*/
#define SEM_FORMAT "wls%d" /* The Spi Resume Senaphore name*/
#define SEM_NAMELEN 8 /* The buffer size to hold formatted string*/
/* IOCTL commands */
#define CC3000IOC_GETQUEID _WLIOC_USER(0x0001) /* arg: Address of int for number*/
#define CC3000IOC_COMPLETE _WLIOC_USER(0x0002) /* arg: none resumes the Event WL Asynchronous events */
#define CC3000IOC_GETQUESEMID _WLIOC_USER(0x0001) /* arg: Address of int for number*/
/****************************************************************************
* Public Types
@@ -88,57 +92,54 @@ extern "C" {
#define EXTERN extern
#endif
EXTERN void wlan_init( tWlanCB sWlanCB,
/*****************************************************************************
*
* CC3000_wlan_init
*
* @param sWlanCB Asynchronous events callback.
* 0 no event call back.
* -call back parameters:
* 1) event_type: HCI_EVNT_WLAN_UNSOL_CONNECT connect event,
* HCI_EVNT_WLAN_UNSOL_DISCONNECT disconnect event,
* HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE config done,
* HCI_EVNT_WLAN_UNSOL_DHCP dhcp report,
* HCI_EVNT_WLAN_ASYNC_PING_REPORT ping report OR
* HCI_EVNT_WLAN_KEEPALIVE keepalive.
* 2) data: pointer to extra data that received by the event
* (NULL no data).
* 3) length: data length.
* -Events with extra data:
* HCI_EVNT_WLAN_UNSOL_DHCP: 4 bytes IP, 4 bytes Mask,
* 4 bytes default gateway, 4 bytes DHCP server and 4 bytes
* for DNS server.
* HCI_EVNT_WLAN_ASYNC_PING_REPORT: 4 bytes Packets sent,
* 4 bytes Packets received, 4 bytes Min round time,
* 4 bytes Max round time and 4 bytes for Avg round time.
*
* @param sFWPatches 0 no patch or pointer to FW patches
* @param sDriverPatches 0 no patch or pointer to driver patches
* @param sBootLoaderPatches 0 no patch or pointer to bootloader patches
*
* @return none
*
* @sa wlan_set_event_mask , wlan_start , wlan_stop
*
* @brief Initialize wlan driver
*
* @warning This function must be called before ANY other wlan driver function
*
****************************************************************************/
void wlan_init( tWlanCB sWlanCB,
tFWPatches sFWPatches,
tDriverPatches sDriverPatches,
tBootLoaderPatches sBootLoaderPatches,
tWlanReadInteruptPin sReadWlanInterruptPin,
tWlanInterruptEnable sWlanInterruptEnable,
tWlanInterruptDisable sWlanInterruptDisable,
tWriteWlanPin sWriteWlanPin);
tBootLoaderPatches sBootLoaderPatches);
/*****************************************************************************
*
* CC3000_wlan_init
*
* @param sWlanCB Asynchronous events callback.
* 0 no event call back.
* -call back parameters:
* 1) event_type: HCI_EVNT_WLAN_UNSOL_CONNECT connect event,
* HCI_EVNT_WLAN_UNSOL_DISCONNECT disconnect event,
* HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE config done,
* HCI_EVNT_WLAN_UNSOL_DHCP dhcp report,
* HCI_EVNT_WLAN_ASYNC_PING_REPORT ping report OR
* HCI_EVNT_WLAN_KEEPALIVE keepalive.
* 2) data: pointer to extra data that received by the event
* (NULL no data).
* 3) length: data length.
* -Events with extra data:
* HCI_EVNT_WLAN_UNSOL_DHCP: 4 bytes IP, 4 bytes Mask,
* 4 bytes default gateway, 4 bytes DHCP server and 4 bytes
* for DNS server.
* HCI_EVNT_WLAN_ASYNC_PING_REPORT: 4 bytes Packets sent,
* 4 bytes Packets received, 4 bytes Min round time,
* 4 bytes Max round time and 4 bytes for Avg round time.
*
* @param sFWPatches 0 no patch or pointer to FW patches
* @param sDriverPatches 0 no patch or pointer to driver patches
* @param sBootLoaderPatches 0 no patch or pointer to bootloader patches
*
* @return none
*
* @sa wlan_set_event_mask , wlan_start , wlan_stop
*
* @brief Initialize wlan driver
*
* @warning This function must be called before ANY other wlan driver function
*
****************************************************************************/
EXTERN void CC3000_wlan_init(tWlanCB sWlanCB,
tFWPatches sFWPatches,
tDriverPatches sDriverPatches,
tBootLoaderPatches sBootLoaderPatches);
void cc3000_wlan_init(tWlanCB sWlanCB,
tFWPatches sFWPatches,
tDriverPatches sDriverPatches,
tBootLoaderPatches sBootLoaderPatches);
/************************************************************************************
@@ -230,10 +230,6 @@ typedef struct
tDriverPatches sDriverPatches;
tBootLoaderPatches sBootLoaderPatches;
tWlanCB sWlanCB;
tWlanReadInteruptPin ReadWlanInterruptPin;
tWlanInterruptEnable WlanInterruptEnable;
tWlanInterruptDisable WlanInterruptDisable;
tWriteWlanPin WriteWlanPin;
signed long slTransmitDataError;
uint16_t usNumberOfFreeBuffers;
+118 -105
View File
@@ -12,156 +12,169 @@
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#ifndef _INCLUDE_NUTTX_WIRELESS_CC3000_EVENT_HANDLER_H
#define _INCLUDE_NUTTX_WIRELESS_CC3000_EVENT_HANDLER_H
#ifndef __INCLUDE_NUTTX_WIRELESS_CC3000_EVENT_HANDLER_H
#define __INCLUDE_NUTTX_WIRELESS_CC3000_EVENT_HANDLER_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/wireless/cc3000/hci.h>
#include <nuttx/wireless/cc3000/include/sys/socket.h>
#include <sys/socket.h>
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C" {
#endif
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
//*****************************************************************************
//
// Prototypes for the APIs.
//
//*****************************************************************************
//*****************************************************************************
//
//! hci_event_handler
//!
//! @param pRetParams incoming data buffer
//! @param from from information (in case of data received)
//! @param fromlen from information length (in case of data received)
//!
//! @return none
//!
//! @brief Parse the incoming events packets and issues corresponding
//! event handler from global array of handlers pointers
//
//*****************************************************************************
extern uint8_t *hci_event_handler(void *pRetParams, uint8_t *from, uint8_t *fromlen);
//*****************************************************************************
//
//! hci_unsol_event_handler
//!
//! @param event_hdr event header
//!
//! @return 1 if event supported and handled
//! 0 if event is not supported
//!
//! @brief Handle unsolicited events
//
//*****************************************************************************
extern long hci_unsol_event_handler(char *event_hdr);
//*****************************************************************************
//
//! hci_unsolicited_event_handler
//!
//! @param None
//!
//! @return ESUCCESS if successful, EFAIL if an error occurred
//!
//! @brief Parse the incoming unsolicited event packets and issues
//! corresponding event handler.
//
//*****************************************************************************
extern long hci_unsolicited_event_handler(void);
#define M_BSD_RESP_PARAMS_OFFSET(hci_event_hdr)((char *)(hci_event_hdr) + HCI_EVENT_HEADER_SIZE)
#define M_BSD_RESP_PARAMS_OFFSET(hci_event_hdr)\
((char *)(hci_event_hdr) + HCI_EVENT_HEADER_SIZE)
#define SOCKET_STATUS_ACTIVE 0
#define SOCKET_STATUS_INACTIVE 1
/* Init socket_active_status = 'all ones': init all sockets with SOCKET_STATUS_INACTIVE.
Will be changed by 'set_socket_active_status' upon 'connect' and 'accept' calls */
/* Init socket_active_status = 'all ones': init all sockets with
* SOCKET_STATUS_INACTIVE. Will be changed by 'set_socket_active_status' upon
* 'connect' and 'accept' calls
*/
#define SOCKET_STATUS_INIT_VAL 0xFFFF
#define M_IS_VALID_SD(sd) ((0 <= (sd)) && ((sd) <= 7))
#define M_IS_VALID_STATUS(status) (((status) == SOCKET_STATUS_ACTIVE)||((status) == SOCKET_STATUS_INACTIVE))
#define M_IS_VALID_STATUS(status) \
(((status) == SOCKET_STATUS_ACTIVE)||((status) == SOCKET_STATUS_INACTIVE))
extern unsigned long socket_active_status;
#define BSD_RECV_FROM_FROMLEN_OFFSET (4)
#define BSD_RECV_FROM_FROM_OFFSET (16)
extern void set_socket_active_status(long Sd, long Status);
extern long get_socket_active_status(long Sd);
/****************************************************************************
* Public Types
****************************************************************************/
typedef struct _bsd_accept_return_t
{
long iSocketDescriptor;
long iStatus;
sockaddr tSocketAddress;
long iSocketDescriptor;
long iStatus;
struct sockaddr tSocketAddress;
} tBsdReturnParams;
typedef struct _bsd_read_return_t
{
long iSocketDescriptor;
long iNumberOfBytes;
unsigned long uiFlags;
long iSocketDescriptor;
long iNumberOfBytes;
unsigned long uiFlags;
} tBsdReadReturnParams;
#define BSD_RECV_FROM_FROMLEN_OFFSET (4)
#define BSD_RECV_FROM_FROM_OFFSET (16)
typedef struct _bsd_select_return_t
{
long iStatus;
unsigned long uiRdfd;
unsigned long uiWrfd;
unsigned long uiExfd;
long iStatus;
unsigned long uiRdfd;
unsigned long uiWrfd;
unsigned long uiExfd;
} tBsdSelectRecvParams;
typedef struct _bsd_getsockopt_return_t
{
uint8_t ucOptValue[4];
char iStatus;
uint8_t ucOptValue[4];
char iStatus;
} tBsdGetSockOptReturnParams;
typedef struct _bsd_gethostbyname_return_t
{
long retVal;
long outputAddress;
long retVal;
long outputAddress;
} tBsdGethostbynameParams;
//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
/****************************************************************************
* Public Data
****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
extern unsigned long socket_active_status;
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: hci_event_handler
*
* Description:
* Parse the incoming events packets and issues corresponding event
* handler from global array of handlers pointers
*
* Input Parameters:
* pRetParams incoming data buffer
* from from information (in case of data received)
* fromlen from information length (in case of data received)
*
* Returned Values:
* None
*
****************************************************************************/
uint8_t *hci_event_handler(void *pRetParams, uint8_t *from, uint8_t *fromlen);
/****************************************************************************
* Name: hci_unsol_event_handler
*
* Description:
* Handle unsolicited events
*
* Input Parameters:
* event_hdr event header
*
* Returned Values:
* 1 if event supported and handled; 0 if event is not supported
*
****************************************************************************/
long hci_unsol_event_handler(char *event_hdr);
/****************************************************************************
* Name: hci_unsolicited_event_handler
*
* Description:
* Parse the incoming unsolicited event packets and issues corresponding
* event handler.
*
* Input Parameters:
* None
*
* Returned Values:
* ESUCCESS if successful, EFAIL if an error occurred
*
****************************************************************************/
long hci_unsolicited_event_handler(void);
void set_socket_active_status(long Sd, long Status);
long get_socket_active_status(long Sd);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // _INCLUDE_NUTTX_WIRELESS_CC3000_EVENT_HANDLER_H
#endif // __INCLUDE_NUTTX_WIRELESS_CC3000_EVENT_HANDLER_H
@@ -141,7 +141,7 @@ struct cc3000_config_s
void (*irq_enable)(FAR struct cc3000_config_s *state, bool enable);
void (*irq_clear)(FAR struct cc3000_config_s *state);
void (*power_enable)(FAR struct cc3000_config_s *state,bool enable);
void (*chip_select)(FAR struct cc3000_config_s *state,bool enable);
void (*chip_chip_select)(FAR struct cc3000_config_s *state,bool enable);
bool (*irq_read)(FAR struct cc3000_config_s *state);
bool (*probe)(FAR struct cc3000_config_s *state, int n, bool s);
};
File diff suppressed because it is too large Load Diff
+12 -17
View File
@@ -13,29 +13,29 @@
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#ifndef _INCLUDE_NUTTX_WIRELESS_CC3000_WLAN_H
#define _INCLUDE_NUTTX_WIRELESS_CC3000_WLAN_H
#ifndef __INCLUDE_NUTTX_WIRELESS_CC3000_WLAN_H
#define __INCLUDE_NUTTX_WIRELESS_CC3000_WLAN_H
/*****************************************************************************
* Included Files
@@ -112,12 +112,7 @@ extern "C" {
void wlan_init(tWlanCB sWlanCB, tFWPatches sFWPatches,
tDriverPatches sDriverPatches,
tBootLoaderPatches sBootLoaderPatches,
tWlanReadInteruptPin sReadWlanInterruptPin,
tWlanInterruptEnable sWlanInterruptEnable,
tWlanInterruptDisable sWlanInterruptDisable,
tWriteWlanPin sWriteWlanPin);
tBootLoaderPatches sBootLoaderPatches);
/*****************************************************************************
* Name: wlan_start
@@ -514,4 +509,4 @@ long wlan_smart_config_process(void);
}
#endif // __cplusplus
#endif // _INCLUDE_NUTTX_WIRELESS_CC3000_WLAN_H
#endif // __INCLUDE_NUTTX_WIRELESS_CC3000_WLAN_H