summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-10-27 18:54:10 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-10-27 18:54:10 -0600
commit6a0e1afc60ec2d118bab9b43fbfd03218b2396d4 (patch)
treecfcd944886bdcf58ed96d7ebe98601ad6578d9e8
parent28936515c4366b3e2f7849dd4280f511785bf6ef (diff)
downloadnuttx-6a0e1afc60ec2d118bab9b43fbfd03218b2396d4.tar.gz
nuttx-6a0e1afc60ec2d118bab9b43fbfd03218b2396d4.tar.bz2
nuttx-6a0e1afc60ec2d118bab9b43fbfd03218b2396d4.zip
CC3000 driver updates from David Sidrane
-rw-r--r--nuttx/drivers/wireless/cc3000/cc3000.c15
-rw-r--r--nuttx/drivers/wireless/cc3000/spi.c7
2 files changed, 13 insertions, 9 deletions
diff --git a/nuttx/drivers/wireless/cc3000/cc3000.c b/nuttx/drivers/wireless/cc3000/cc3000.c
index 69e29ff37..42afa00a3 100644
--- a/nuttx/drivers/wireless/cc3000/cc3000.c
+++ b/nuttx/drivers/wireless/cc3000/cc3000.c
@@ -77,7 +77,6 @@
#include "cc3000_socket.h"
#include "cc3000.h"
-
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -401,7 +400,7 @@ static inline int cc3000_wait_irq(FAR struct cc3000_dev_s *priv)
static inline int cc3000_wait_ready(FAR struct cc3000_dev_s *priv)
{
- return cc3000_wait(priv,&priv->readysem);
+ return cc3000_wait(priv,&priv->readysem);
}
/****************************************************************************
@@ -610,7 +609,7 @@ static void * cc3000_worker(FAR void *arg)
/* Odd so make it even */
data_to_recv++;
- }
+ }
/* Read the whole payload in at the beginning of the buffer
* Will it fit?
@@ -751,7 +750,7 @@ static int cc3000_open(FAR struct file *filep)
* on the driver.. and an opportunity to do any one-time initialization.
*/
- if (tmp==1)
+ if (tmp == 1)
{
/* Ensure the power is off so we get the falling edge of IRQ*/
@@ -782,12 +781,13 @@ static int cc3000_open(FAR struct file *filep)
}
pthread_attr_init(&tattr);
+ tattr.stacksize = 336;
param.sched_priority = SCHED_PRIORITY_MAX;
pthread_attr_setschedparam(&tattr, &param);
ret = pthread_create(&priv->workertid, &tattr, cc3000_worker,
(pthread_addr_t)priv);
- if (ret < 0)
+ if (ret != 0)
{
mq_close(priv->queue);
priv->queue = 0;
@@ -796,16 +796,16 @@ static int cc3000_open(FAR struct file *filep)
}
pthread_attr_init(&tattr);
+ tattr.stacksize = 460;
param.sched_priority = SCHED_PRIORITY_DEFAULT+10;
pthread_attr_setschedparam(&tattr, &param);
ret = pthread_create(&priv->selecttid, &tattr, select_thread_func,
(pthread_addr_t)priv);
- if (ret < 0)
+ if (ret != 0)
{
pthread_t workertid = priv->workertid;
priv->workertid = -1;
pthread_cancel(workertid);
- pthread_join(workertid,NULL);
mq_close(priv->queue);
priv->queue = 0;
ret = -errno;
@@ -1525,6 +1525,7 @@ int cc3000_accept_socket(int sd, int minor, struct sockaddr *addr,
sem_post(&priv->selectsem); /* Wake select thread if need be */
sem_wait(&priv->accepting_socket.acc.semwait); /* Wait caller on select to finish */
sem_wait(&priv->selectsem); /* Sleep select thread */
+
if (priv->accepting_socket.acc.status != CC3000_SOC_ERROR)
{
*addr = priv->accepting_socket.addr;
diff --git a/nuttx/drivers/wireless/cc3000/spi.c b/nuttx/drivers/wireless/cc3000/spi.c
index a5e190e3b..a0d3b82c8 100644
--- a/nuttx/drivers/wireless/cc3000/spi.c
+++ b/nuttx/drivers/wireless/cc3000/spi.c
@@ -72,7 +72,6 @@ static struct
uint8_t rx_buffer[CC3000_RX_BUFFER_SIZE];
mqd_t queue;
sem_t *done;
-
} spiconf;
/*****************************************************************************
@@ -195,7 +194,8 @@ static void *unsoliced_thread_func(void *parameter)
while(spiconf.run)
{
memset(spiconf.rx_buffer,0,sizeof(spiconf.rx_buffer));
- nbytes = mq_receive(spiconf.queue, spiconf.rx_buffer, CC3000_RX_BUFFER_SIZE, 0);
+ nbytes = mq_receive(spiconf.queue, spiconf.rx_buffer,
+ CC3000_RX_BUFFER_SIZE, 0);
if (nbytes > 0)
{
nlldbg("%d Processed\n",nbytes);
@@ -240,12 +240,15 @@ void SpiOpen(gcSpiHandleRx pfRxHandler)
pthread_attr_t attr;
struct sched_param param;
pthread_attr_init(&attr);
+ attr.stacksize = 292;
param.sched_priority = SCHED_PRIORITY_DEFAULT-10;
pthread_attr_setschedparam(&attr, &param);
status = pthread_create(&spiconf.unsoliced_thread, &attr,
unsoliced_thread_func, NULL);
DEBUGASSERT(status == 0)
}
+
+ DEBUGASSERT(spiconf.cc3000fd);
}
/*****************************************************************************