CC3000 driver updates from David Sidrane

This commit is contained in:
Gregory Nutt 2013-10-30 10:50:26 -06:00
parent 8c5fc5fa88
commit 6b8c1cc480
7 changed files with 103 additions and 79 deletions

View File

@ -5911,4 +5911,6 @@
* configs/spark: Spark configuration updated by David Sidrane
(2013-10-30).
* drivers/wireless/cc3000 and include/nuttx/wireless/cc3000:
CC3000 driver updates from David Sidrane (2013-10-13).

View File

@ -54,4 +54,22 @@ config CC3000_SPI_FREQUENCY
---help---
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

View File

@ -85,13 +85,27 @@
#error "CONFIG_MQ_MAXMSGSIZE needs to be >= CC3000_RX_BUFFER_SIZE"
#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
# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif
#define NUMBER_OF_MSGS 2
#define NUMBER_OF_MSGS 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
****************************************************************************/
@ -560,14 +574,14 @@ static void * cc3000_worker(FAR void *arg)
sem_post(&priv->readysem);
while(1)
{
priv->config->probe(config,0, 1);
PROBE(0,1);
cc3000_devtake(priv);
/* Done ? */
if ((cc3000_wait_irq(priv) != -EINTR) && (priv->workertid != -1))
{
priv->config->probe(config,0, 0);
PROBE(0,0);
nllvdbg("State%d\n",priv->state);
switch (priv->state)
{
@ -694,9 +708,9 @@ static int cc3000_interrupt(int irq, FAR void *context)
/* Run the worker thread */
priv->config->probe(priv->config,1, 0);
PROBE(1,0);
sem_post(&priv->irqsem);
priv->config->probe(priv->config,1, 1);
PROBE(1,1);
/* Clear any pending interrupts and return success */
@ -781,7 +795,7 @@ static int cc3000_open(FAR struct file *filep)
}
pthread_attr_init(&tattr);
tattr.stacksize = 336;
tattr.stacksize = CONFIG_CC3000_WORKER_STACKSIZE;
param.sched_priority = SCHED_PRIORITY_MAX;
pthread_attr_setschedparam(&tattr, &param);
@ -796,7 +810,7 @@ static int cc3000_open(FAR struct file *filep)
}
pthread_attr_init(&tattr);
tattr.stacksize = 460;
tattr.stacksize = CONFIG_CC3000_SELECT_STACKSIZE;
param.sched_priority = SCHED_PRIORITY_DEFAULT+10;
pthread_attr_setschedparam(&tattr, &param);
ret = pthread_create(&priv->selecttid, &tattr, select_thread_func,

View File

@ -43,6 +43,10 @@
* Pre-processor Definitions
*****************************************************************************/
#ifndef CONFIG_CC3000_UNSOLICED_STACKSIZE
# define CONFIG_CC3000_UNSOLICED_STACKSIZE 264
#endif
#undef SPI_DEBUG /* Define to enable debug */
#undef SPI_VERBOSE /* Define to enable verbose debug */
@ -240,7 +244,7 @@ void SpiOpen(gcSpiHandleRx pfRxHandler)
pthread_attr_t attr;
struct sched_param param;
pthread_attr_init(&attr);
attr.stacksize = 292;
attr.stacksize = CONFIG_CC3000_UNSOLICED_STACKSIZE;
param.sched_priority = SCHED_PRIORITY_DEFAULT-10;
pthread_attr_setschedparam(&attr, &param);
status = pthread_create(&spiconf.unsoliced_thread, &attr,

View File

@ -176,14 +176,6 @@ static void SimpleLink_Init_Start(uint16_t usPatchesAvailableAtHost)
* sFWPatches 0 no patch or pointer to FW patches
* sDriverPatches 0 no patch or pointer to driver 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:
* None

View File

@ -64,7 +64,6 @@
#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_GETQUESEMID _WLIOC_USER(0x0001) /* arg: Address of int for number*/
@ -72,14 +71,11 @@
/****************************************************************************
* Public Types
****************************************************************************/
typedef char *(*tFWPatches)(unsigned long *usLength);
typedef char *(*tDriverPatches)(unsigned long *usLength);
typedef char *(*tBootLoaderPatches)(unsigned long *usLength);
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
@ -87,16 +83,22 @@ typedef void (*tWriteWlanPin)(unsigned char val);
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
extern "C"
{
#else
#define EXTERN extern
#endif
/*****************************************************************************
* Name: wlan_init
*
* CC3000_wlan_init
* Description:
* Initialize wlan driver
*
* @param sWlanCB Asynchronous events callback.
* WARNING: This function must be called before ANY other wlan driver function
*
* Input Parameters:
* sWlanCB Asynchronous events callback.
* 0 no event call back.
* - call back parameters:
* 1) event_type: HCI_EVNT_WLAN_UNSOL_CONNECT connect event,
@ -116,32 +118,23 @@ extern "C" {
* 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
* sFWPatches 0 no patch or pointer to FW patches
* sDriverPatches 0 no patch or pointer to driver patches
* sBootLoaderPatches 0 no patch or pointer to bootloader patches
*
* @return none
* Returned Value:
* 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,
void wlan_init(tWlanCB sWlanCB, tFWPatches sFWPatches,
tDriverPatches sDriverPatches,
tBootLoaderPatches sBootLoaderPatches);
void cc3000_wlan_init(tWlanCB sWlanCB,
tFWPatches sFWPatches,
void cc3000_wlan_init(tWlanCB sWlanCB, tFWPatches sFWPatches,
tDriverPatches sDriverPatches,
tBootLoaderPatches sBootLoaderPatches);
/************************************************************************************
* Name: wireless_archinitialize
*
@ -150,8 +143,7 @@ void cc3000_wlan_init(tWlanCB sWlanCB,
*
************************************************************************************/
int wireless_archinitialize();
int wireless_archinitialize(void);
#undef EXTERN
#ifdef __cplusplus

View File

@ -143,7 +143,9 @@ struct cc3000_config_s
void (*power_enable)(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);
#ifdef CONFIG_CC3000_PROBES
bool (*probe)(FAR struct cc3000_config_s *state, int n, bool s);
#endif
};
/****************************************************************************