CC3000 driver updates from David Sidrane
This commit is contained in:
parent
8c5fc5fa88
commit
6b8c1cc480
@ -5911,4 +5911,6 @@
|
|||||||
|
|
||||||
* configs/spark: Spark configuration updated by David Sidrane
|
* configs/spark: Spark configuration updated by David Sidrane
|
||||||
(2013-10-30).
|
(2013-10-30).
|
||||||
|
* drivers/wireless/cc3000 and include/nuttx/wireless/cc3000:
|
||||||
|
CC3000 driver updates from David Sidrane (2013-10-13).
|
||||||
|
|
||||||
|
@ -54,4 +54,22 @@ config CC3000_SPI_FREQUENCY
|
|||||||
---help---
|
---help---
|
||||||
Define to use a different SPI bus frequency.
|
Define to use a different SPI bus frequency.
|
||||||
|
|
||||||
|
config CC3000_WORKER_STACKSIZE
|
||||||
|
int "Worker thread stack size"
|
||||||
|
default 240
|
||||||
|
|
||||||
|
config CC3000_SELECT_STACKSIZE
|
||||||
|
int "Select thread stack size"
|
||||||
|
default 368
|
||||||
|
|
||||||
|
config CC3000_UNSOLICED_STACKSIZE
|
||||||
|
int "Unsolicited thread stack size"
|
||||||
|
default 264
|
||||||
|
|
||||||
|
config CC3000_PROBES
|
||||||
|
bool "Thread probes"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Select to use DO and D1 to indicate worker thread and ISR
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
@ -85,13 +85,27 @@
|
|||||||
#error "CONFIG_MQ_MAXMSGSIZE needs to be >= CC3000_RX_BUFFER_SIZE"
|
#error "CONFIG_MQ_MAXMSGSIZE needs to be >= CC3000_RX_BUFFER_SIZE"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_CC3000_WORKER_STACKSIZE
|
||||||
|
# define CONFIG_CC3000_WORKER_STACKSIZE 240
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_CC3000_SELECT_STACKSIZE
|
||||||
|
# define CONFIG_CC3000_SELECT_STACKSIZE 368
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef ARRAY_SIZE
|
#ifndef ARRAY_SIZE
|
||||||
# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||||
#endif
|
#endif
|
||||||
#define NUMBER_OF_MSGS 2
|
#define NUMBER_OF_MSGS 1
|
||||||
|
|
||||||
#define FREE_SLOT -1
|
#define FREE_SLOT -1
|
||||||
|
|
||||||
|
#if defined(CONFIG_CC3000_PROBES)
|
||||||
|
#define PROBE(pin,state) priv->config->probe(priv->config,pin, state)
|
||||||
|
#else
|
||||||
|
#define PROBE(pin,state)
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -560,14 +574,14 @@ static void * cc3000_worker(FAR void *arg)
|
|||||||
sem_post(&priv->readysem);
|
sem_post(&priv->readysem);
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
priv->config->probe(config,0, 1);
|
PROBE(0,1);
|
||||||
cc3000_devtake(priv);
|
cc3000_devtake(priv);
|
||||||
|
|
||||||
/* Done ? */
|
/* Done ? */
|
||||||
|
|
||||||
if ((cc3000_wait_irq(priv) != -EINTR) && (priv->workertid != -1))
|
if ((cc3000_wait_irq(priv) != -EINTR) && (priv->workertid != -1))
|
||||||
{
|
{
|
||||||
priv->config->probe(config,0, 0);
|
PROBE(0,0);
|
||||||
nllvdbg("State%d\n",priv->state);
|
nllvdbg("State%d\n",priv->state);
|
||||||
switch (priv->state)
|
switch (priv->state)
|
||||||
{
|
{
|
||||||
@ -694,9 +708,9 @@ static int cc3000_interrupt(int irq, FAR void *context)
|
|||||||
|
|
||||||
/* Run the worker thread */
|
/* Run the worker thread */
|
||||||
|
|
||||||
priv->config->probe(priv->config,1, 0);
|
PROBE(1,0);
|
||||||
sem_post(&priv->irqsem);
|
sem_post(&priv->irqsem);
|
||||||
priv->config->probe(priv->config,1, 1);
|
PROBE(1,1);
|
||||||
|
|
||||||
/* Clear any pending interrupts and return success */
|
/* Clear any pending interrupts and return success */
|
||||||
|
|
||||||
@ -781,7 +795,7 @@ static int cc3000_open(FAR struct file *filep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pthread_attr_init(&tattr);
|
pthread_attr_init(&tattr);
|
||||||
tattr.stacksize = 336;
|
tattr.stacksize = CONFIG_CC3000_WORKER_STACKSIZE;
|
||||||
param.sched_priority = SCHED_PRIORITY_MAX;
|
param.sched_priority = SCHED_PRIORITY_MAX;
|
||||||
pthread_attr_setschedparam(&tattr, ¶m);
|
pthread_attr_setschedparam(&tattr, ¶m);
|
||||||
|
|
||||||
@ -796,7 +810,7 @@ static int cc3000_open(FAR struct file *filep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pthread_attr_init(&tattr);
|
pthread_attr_init(&tattr);
|
||||||
tattr.stacksize = 460;
|
tattr.stacksize = CONFIG_CC3000_SELECT_STACKSIZE;
|
||||||
param.sched_priority = SCHED_PRIORITY_DEFAULT+10;
|
param.sched_priority = SCHED_PRIORITY_DEFAULT+10;
|
||||||
pthread_attr_setschedparam(&tattr, ¶m);
|
pthread_attr_setschedparam(&tattr, ¶m);
|
||||||
ret = pthread_create(&priv->selecttid, &tattr, select_thread_func,
|
ret = pthread_create(&priv->selecttid, &tattr, select_thread_func,
|
||||||
|
@ -43,6 +43,10 @@
|
|||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef CONFIG_CC3000_UNSOLICED_STACKSIZE
|
||||||
|
# define CONFIG_CC3000_UNSOLICED_STACKSIZE 264
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef SPI_DEBUG /* Define to enable debug */
|
#undef SPI_DEBUG /* Define to enable debug */
|
||||||
#undef SPI_VERBOSE /* Define to enable verbose debug */
|
#undef SPI_VERBOSE /* Define to enable verbose debug */
|
||||||
|
|
||||||
@ -240,7 +244,7 @@ void SpiOpen(gcSpiHandleRx pfRxHandler)
|
|||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
struct sched_param param;
|
struct sched_param param;
|
||||||
pthread_attr_init(&attr);
|
pthread_attr_init(&attr);
|
||||||
attr.stacksize = 292;
|
attr.stacksize = CONFIG_CC3000_UNSOLICED_STACKSIZE;
|
||||||
param.sched_priority = SCHED_PRIORITY_DEFAULT-10;
|
param.sched_priority = SCHED_PRIORITY_DEFAULT-10;
|
||||||
pthread_attr_setschedparam(&attr, ¶m);
|
pthread_attr_setschedparam(&attr, ¶m);
|
||||||
status = pthread_create(&spiconf.unsoliced_thread, &attr,
|
status = pthread_create(&spiconf.unsoliced_thread, &attr,
|
||||||
|
@ -176,14 +176,6 @@ static void SimpleLink_Init_Start(uint16_t usPatchesAvailableAtHost)
|
|||||||
* sFWPatches 0 no patch or pointer to FW patches
|
* sFWPatches 0 no patch or pointer to FW patches
|
||||||
* sDriverPatches 0 no patch or pointer to driver patches
|
* sDriverPatches 0 no patch or pointer to driver patches
|
||||||
* sBootLoaderPatches 0 no patch or pointer to bootloader patches
|
* sBootLoaderPatches 0 no patch or pointer to bootloader patches
|
||||||
* sReadWlanInterruptPin init callback. the callback read wlan
|
|
||||||
* interrupt status.
|
|
||||||
* sWlanInterruptEnable init callback. the callback enable wlan
|
|
||||||
* interrupt.
|
|
||||||
* sWlanInterruptDisable init callback. the callback disable wlan
|
|
||||||
* interrupt.
|
|
||||||
* sWriteWlanPin init callback. the callback write value
|
|
||||||
* to device pin.
|
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* None
|
* None
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
* CC30000 from Texas Instruments http://processors.wiki.ti.com/index.php/CC3000
|
* CC30000 from Texas Instruments http://processors.wiki.ti.com/index.php/CC3000
|
||||||
*
|
*
|
||||||
* See also:
|
* See also:
|
||||||
* http://processors.wiki.ti.com/index.php/CC3000_Host_Driver_Porting_Guide
|
* http://processors.wiki.ti.com/index.php/CC3000_Host_Driver_Porting_Guide
|
||||||
* http://processors.wiki.ti.com/index.php/CC3000_Host_Programming_Guide
|
* http://processors.wiki.ti.com/index.php/CC3000_Host_Programming_Guide
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@ -56,30 +56,26 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define DEV_FORMAT "/dev/wireless%d" /* The device Name*/
|
#define DEV_FORMAT "/dev/wireless%d" /* The device Name*/
|
||||||
#define DEV_NAMELEN 17 /* The buffer size to hold formatted string*/
|
#define DEV_NAMELEN 17 /* The buffer size to hold formatted string*/
|
||||||
|
|
||||||
#define QUEUE_FORMAT "wlq%d" /* The Queue name */
|
#define QUEUE_FORMAT "wlq%d" /* The Queue name */
|
||||||
#define QUEUE_NAMELEN 8 /* The buffer size to hold formatted string*/
|
#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*/
|
|
||||||
|
|
||||||
|
#define SEM_FORMAT "wls%d" /* The Spi Resume Senaphore name*/
|
||||||
|
#define SEM_NAMELEN 8 /* The buffer size to hold formatted string*/
|
||||||
|
|
||||||
/* IOCTL commands */
|
/* IOCTL commands */
|
||||||
|
|
||||||
#define CC3000IOC_GETQUESEMID _WLIOC_USER(0x0001) /* arg: Address of int for number*/
|
#define CC3000IOC_GETQUESEMID _WLIOC_USER(0x0001) /* arg: Address of int for number*/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
typedef char *(*tFWPatches)(unsigned long *usLength);
|
typedef char *(*tFWPatches)(unsigned long *usLength);
|
||||||
typedef char *(*tDriverPatches)(unsigned long *usLength);
|
typedef char *(*tDriverPatches)(unsigned long *usLength);
|
||||||
typedef char *(*tBootLoaderPatches)(unsigned long *usLength);
|
typedef char *(*tBootLoaderPatches)(unsigned long *usLength);
|
||||||
typedef void (*tWlanCB)(long event_type, char * data, unsigned char length );
|
typedef void (*tWlanCB)(long event_type, char * data, unsigned char length);
|
||||||
typedef long (*tWlanReadInteruptPin)(void);
|
|
||||||
typedef void (*tWlanInterruptEnable)(void);
|
|
||||||
typedef void (*tWlanInterruptDisable)(void);
|
|
||||||
typedef void (*tWriteWlanPin)(unsigned char val);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
@ -87,60 +83,57 @@ typedef void (*tWriteWlanPin)(unsigned char val);
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define EXTERN extern "C"
|
#define EXTERN extern "C"
|
||||||
extern "C" {
|
extern "C"
|
||||||
|
{
|
||||||
#else
|
#else
|
||||||
#define EXTERN extern
|
#define EXTERN extern
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
* Name: wlan_init
|
||||||
* CC3000_wlan_init
|
*
|
||||||
*
|
* Description:
|
||||||
* @param sWlanCB Asynchronous events callback.
|
* Initialize wlan driver
|
||||||
* 0 no event call back.
|
*
|
||||||
* -call back parameters:
|
* WARNING: This function must be called before ANY other wlan driver function
|
||||||
* 1) event_type: HCI_EVNT_WLAN_UNSOL_CONNECT connect event,
|
*
|
||||||
* HCI_EVNT_WLAN_UNSOL_DISCONNECT disconnect event,
|
* Input Parameters:
|
||||||
* HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE config done,
|
* sWlanCB Asynchronous events callback.
|
||||||
* HCI_EVNT_WLAN_UNSOL_DHCP dhcp report,
|
* 0 no event call back.
|
||||||
* HCI_EVNT_WLAN_ASYNC_PING_REPORT ping report OR
|
* - call back parameters:
|
||||||
* HCI_EVNT_WLAN_KEEPALIVE keepalive.
|
* 1) event_type: HCI_EVNT_WLAN_UNSOL_CONNECT connect event,
|
||||||
* 2) data: pointer to extra data that received by the event
|
* HCI_EVNT_WLAN_UNSOL_DISCONNECT disconnect event,
|
||||||
* (NULL no data).
|
* HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE config done,
|
||||||
* 3) length: data length.
|
* HCI_EVNT_WLAN_UNSOL_DHCP dhcp report,
|
||||||
* -Events with extra data:
|
* HCI_EVNT_WLAN_ASYNC_PING_REPORT ping report OR
|
||||||
* HCI_EVNT_WLAN_UNSOL_DHCP: 4 bytes IP, 4 bytes Mask,
|
* HCI_EVNT_WLAN_KEEPALIVE keepalive.
|
||||||
* 4 bytes default gateway, 4 bytes DHCP server and 4 bytes
|
* 2) data: pointer to extra data that received by the event
|
||||||
* for DNS server.
|
* (NULL no data).
|
||||||
* HCI_EVNT_WLAN_ASYNC_PING_REPORT: 4 bytes Packets sent,
|
* 3) length: data length.
|
||||||
* 4 bytes Packets received, 4 bytes Min round time,
|
* - Events with extra data:
|
||||||
* 4 bytes Max round time and 4 bytes for Avg round time.
|
* HCI_EVNT_WLAN_UNSOL_DHCP: 4 bytes IP, 4 bytes Mask,
|
||||||
*
|
* 4 bytes default gateway, 4 bytes DHCP server and 4 bytes
|
||||||
* @param sFWPatches 0 no patch or pointer to FW patches
|
* for DNS server.
|
||||||
* @param sDriverPatches 0 no patch or pointer to driver patches
|
* HCI_EVNT_WLAN_ASYNC_PING_REPORT: 4 bytes Packets sent,
|
||||||
* @param sBootLoaderPatches 0 no patch or pointer to bootloader patches
|
* 4 bytes Packets received, 4 bytes Min round time,
|
||||||
*
|
* 4 bytes Max round time and 4 bytes for Avg round time.
|
||||||
* @return none
|
*
|
||||||
*
|
* sFWPatches 0 no patch or pointer to FW patches
|
||||||
* @sa wlan_set_event_mask , wlan_start , wlan_stop
|
* sDriverPatches 0 no patch or pointer to driver patches
|
||||||
*
|
* sBootLoaderPatches 0 no patch or pointer to bootloader patches
|
||||||
* @brief Initialize wlan driver
|
*
|
||||||
*
|
* Returned Value:
|
||||||
* @warning This function must be called before ANY other wlan driver function
|
* None
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
void wlan_init( tWlanCB sWlanCB,
|
void wlan_init(tWlanCB sWlanCB, tFWPatches sFWPatches,
|
||||||
tFWPatches sFWPatches,
|
tDriverPatches sDriverPatches,
|
||||||
tDriverPatches sDriverPatches,
|
tBootLoaderPatches sBootLoaderPatches);
|
||||||
tBootLoaderPatches sBootLoaderPatches);
|
|
||||||
|
|
||||||
|
|
||||||
void cc3000_wlan_init(tWlanCB sWlanCB,
|
|
||||||
tFWPatches sFWPatches,
|
|
||||||
tDriverPatches sDriverPatches,
|
|
||||||
tBootLoaderPatches sBootLoaderPatches);
|
|
||||||
|
|
||||||
|
void cc3000_wlan_init(tWlanCB sWlanCB, tFWPatches sFWPatches,
|
||||||
|
tDriverPatches sDriverPatches,
|
||||||
|
tBootLoaderPatches sBootLoaderPatches);
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: wireless_archinitialize
|
* Name: wireless_archinitialize
|
||||||
@ -150,8 +143,7 @@ void cc3000_wlan_init(tWlanCB sWlanCB,
|
|||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
int wireless_archinitialize();
|
int wireless_archinitialize(void);
|
||||||
|
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -143,7 +143,9 @@ struct cc3000_config_s
|
|||||||
void (*power_enable)(FAR struct cc3000_config_s *state,bool enable);
|
void (*power_enable)(FAR struct cc3000_config_s *state,bool enable);
|
||||||
void (*chip_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 (*irq_read)(FAR struct cc3000_config_s *state);
|
||||||
|
#ifdef CONFIG_CC3000_PROBES
|
||||||
bool (*probe)(FAR struct cc3000_config_s *state, int n, bool s);
|
bool (*probe)(FAR struct cc3000_config_s *state, int n, bool s);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
Loading…
x
Reference in New Issue
Block a user