Skip to content
Snippets Groups Projects
Commit 6b8c1cc4 authored by Gregory Nutt's avatar Gregory Nutt
Browse files

CC3000 driver updates from David Sidrane

parent 8c5fc5fa
Branches
Tags
No related merge requests found
......@@ -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).
......@@ -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
......@@ -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,
......
......@@ -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,
......
......@@ -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
......
......@@ -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
......
......@@ -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
};
/****************************************************************************
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment