diff options
-rw-r--r-- | nuttx/ChangeLog | 2 | ||||
-rw-r--r-- | nuttx/drivers/wireless/cc3000/Kconfig | 18 | ||||
-rw-r--r-- | nuttx/drivers/wireless/cc3000/cc3000.c | 28 | ||||
-rw-r--r-- | nuttx/drivers/wireless/cc3000/spi.c | 6 | ||||
-rw-r--r-- | nuttx/drivers/wireless/cc3000/wlan.c | 8 | ||||
-rw-r--r-- | nuttx/include/nuttx/wireless/cc3000.h | 120 | ||||
-rw-r--r-- | nuttx/include/nuttx/wireless/cc3000/include/cc3000_upif.h | 2 |
7 files changed, 104 insertions, 80 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index bf685e478..26c474aae 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -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). diff --git a/nuttx/drivers/wireless/cc3000/Kconfig b/nuttx/drivers/wireless/cc3000/Kconfig index 44b285728..e9f22ed99 100644 --- a/nuttx/drivers/wireless/cc3000/Kconfig +++ b/nuttx/drivers/wireless/cc3000/Kconfig @@ -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 diff --git a/nuttx/drivers/wireless/cc3000/cc3000.c b/nuttx/drivers/wireless/cc3000/cc3000.c index 42afa00a3..ba60d3438 100644 --- a/nuttx/drivers/wireless/cc3000/cc3000.c +++ b/nuttx/drivers/wireless/cc3000/cc3000.c @@ -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, ¶m); @@ -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, ¶m); ret = pthread_create(&priv->selecttid, &tattr, select_thread_func, diff --git a/nuttx/drivers/wireless/cc3000/spi.c b/nuttx/drivers/wireless/cc3000/spi.c index a0d3b82c8..a237511ab 100644 --- a/nuttx/drivers/wireless/cc3000/spi.c +++ b/nuttx/drivers/wireless/cc3000/spi.c @@ -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, ¶m); status = pthread_create(&spiconf.unsoliced_thread, &attr, diff --git a/nuttx/drivers/wireless/cc3000/wlan.c b/nuttx/drivers/wireless/cc3000/wlan.c index 11c934b6c..ac6ba206a 100644 --- a/nuttx/drivers/wireless/cc3000/wlan.c +++ b/nuttx/drivers/wireless/cc3000/wlan.c @@ -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 diff --git a/nuttx/include/nuttx/wireless/cc3000.h b/nuttx/include/nuttx/wireless/cc3000.h index f12ceb01a..6579fd5f2 100644 --- a/nuttx/include/nuttx/wireless/cc3000.h +++ b/nuttx/include/nuttx/wireless/cc3000.h @@ -9,8 +9,8 @@ * CC30000 from Texas Instruments http://processors.wiki.ti.com/index.php/CC3000 * * See also: - * 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_Driver_Porting_Guide + * http://processors.wiki.ti.com/index.php/CC3000_Host_Programming_Guide * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -56,30 +56,26 @@ ****************************************************************************/ #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_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 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_GETQUESEMID _WLIOC_USER(0x0001) /* arg: Address of int for number*/ +#define CC3000IOC_GETQUESEMID _WLIOC_USER(0x0001) /* arg: Address of int for number*/ /**************************************************************************** * 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); +typedef void (*tWlanCB)(long event_type, char * data, unsigned char length); /**************************************************************************** * Public Function Prototypes @@ -87,60 +83,57 @@ typedef void (*tWriteWlanPin)(unsigned char val); #ifdef __cplusplus #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif - /***************************************************************************** - * - * 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); - - -void cc3000_wlan_init(tWlanCB sWlanCB, - tFWPatches sFWPatches, - tDriverPatches sDriverPatches, - tBootLoaderPatches sBootLoaderPatches); +/***************************************************************************** + * Name: wlan_init + * + * Description: + * Initialize wlan driver + * + * 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, + * 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. + * + * 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 + * + * Returned Value: + * None + * + *****************************************************************************/ +void 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 @@ -150,8 +143,7 @@ void cc3000_wlan_init(tWlanCB sWlanCB, * ************************************************************************************/ -int wireless_archinitialize(); - +int wireless_archinitialize(void); #undef EXTERN #ifdef __cplusplus diff --git a/nuttx/include/nuttx/wireless/cc3000/include/cc3000_upif.h b/nuttx/include/nuttx/wireless/cc3000/include/cc3000_upif.h index 5b7e7ebd7..6957c5115 100644 --- a/nuttx/include/nuttx/wireless/cc3000/include/cc3000_upif.h +++ b/nuttx/include/nuttx/wireless/cc3000/include/cc3000_upif.h @@ -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 }; /**************************************************************************** |