2015-10-03 01:43:18 +02:00
|
|
|
/****************************************************************************
|
2015-09-08 15:37:19 +02:00
|
|
|
* drivers/wireless/cc3000/cc3000drv.c
|
|
|
|
* Driver wrapper functions to conntect nuttx to the TI CC3000
|
2013-10-31 16:00:05 +01:00
|
|
|
*
|
|
|
|
* Port to nuttx:
|
|
|
|
* David Sidrane <david_s5@nscdg.com>
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
*
|
|
|
|
* Neither the name of Texas Instruments Incorporated nor the names of
|
|
|
|
* its contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
2015-10-03 15:25:53 +02:00
|
|
|
****************************************************************************/
|
2013-10-31 16:00:05 +01:00
|
|
|
|
2015-10-03 15:25:53 +02:00
|
|
|
/****************************************************************************
|
2013-10-31 16:00:05 +01:00
|
|
|
* Included Files
|
2015-10-03 15:25:53 +02:00
|
|
|
****************************************************************************/
|
2013-10-31 16:00:05 +01:00
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include <pthread.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <debug.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include "cc3000drv.h"
|
|
|
|
|
|
|
|
#include <nuttx/wireless/cc3000.h>
|
|
|
|
#include <nuttx/wireless/cc3000/cc3000_common.h>
|
|
|
|
|
2015-10-03 15:25:53 +02:00
|
|
|
/****************************************************************************
|
2013-10-31 16:00:05 +01:00
|
|
|
* Pre-processor Definitions
|
2015-10-03 15:25:53 +02:00
|
|
|
****************************************************************************/
|
2013-10-31 16:00:05 +01:00
|
|
|
|
|
|
|
#undef SPI_DEBUG /* Define to enable debug */
|
|
|
|
#undef SPI_VERBOSE /* Define to enable verbose debug */
|
|
|
|
|
|
|
|
#ifdef SPI_DEBUG
|
|
|
|
# define spidbg lldbg
|
|
|
|
# ifdef SPI_VERBOSE
|
|
|
|
# define spivdbg lldbg
|
|
|
|
# else
|
|
|
|
# define spivdbg(x...)
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
# undef SPI_VERBOSE
|
|
|
|
# define spidbg(x...)
|
|
|
|
# define spivdbg(x...)
|
|
|
|
#endif
|
|
|
|
|
2015-10-03 15:25:53 +02:00
|
|
|
/****************************************************************************
|
2013-10-31 16:00:05 +01:00
|
|
|
* Private Types
|
2015-10-03 15:25:53 +02:00
|
|
|
****************************************************************************/
|
2013-10-31 16:00:05 +01:00
|
|
|
|
|
|
|
static struct
|
|
|
|
{
|
|
|
|
int cc3000fd;
|
|
|
|
gcSpiHandleRx pfRxHandler;
|
|
|
|
pthread_t unsoliced_thread;
|
|
|
|
bool run;
|
2014-02-18 21:16:51 +01:00
|
|
|
cc3000_buffer_desc rx_buffer;
|
2013-10-31 16:00:05 +01:00
|
|
|
mqd_t queue;
|
|
|
|
sem_t *done;
|
2014-05-21 15:32:32 +02:00
|
|
|
sem_t unsoliced_thread_wakesem;
|
2014-11-28 15:52:52 +01:00
|
|
|
} spiconf =
|
|
|
|
{
|
|
|
|
-1,
|
|
|
|
};
|
2013-10-31 16:00:05 +01:00
|
|
|
|
2015-10-03 15:25:53 +02:00
|
|
|
/****************************************************************************
|
2013-10-31 16:00:05 +01:00
|
|
|
* Public Functions
|
2015-10-03 15:25:53 +02:00
|
|
|
****************************************************************************/
|
2013-10-31 16:00:05 +01:00
|
|
|
|
2015-10-03 15:25:53 +02:00
|
|
|
/****************************************************************************
|
2013-10-31 16:00:05 +01:00
|
|
|
* Name: cc3000_resume
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Will re enable the to deliver messages
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* None
|
|
|
|
*
|
2015-10-03 15:25:53 +02:00
|
|
|
****************************************************************************/
|
2013-10-31 16:00:05 +01:00
|
|
|
|
|
|
|
void cc3000_resume(void)
|
|
|
|
{
|
2014-11-28 15:52:52 +01:00
|
|
|
DEBUGASSERT(spiconf.cc3000fd >= 0 && spiconf.done);
|
2013-10-31 16:00:05 +01:00
|
|
|
sem_post(spiconf.done);
|
|
|
|
nllvdbg("Done\n");
|
|
|
|
}
|
|
|
|
|
2015-10-03 15:25:53 +02:00
|
|
|
/****************************************************************************
|
2013-10-31 16:00:05 +01:00
|
|
|
* Name: cc3000_write
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* This function enter point for write flow
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* pUserBuffer
|
|
|
|
* usLength
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
*
|
2015-10-03 15:25:53 +02:00
|
|
|
****************************************************************************/
|
2013-10-31 16:00:05 +01:00
|
|
|
|
|
|
|
long cc3000_write(uint8_t *pUserBuffer, uint16_t usLength)
|
|
|
|
{
|
2014-11-28 15:52:52 +01:00
|
|
|
DEBUGASSERT(spiconf.cc3000fd >= 0);
|
2015-10-10 19:51:32 +02:00
|
|
|
return write(spiconf.cc3000fd, pUserBuffer, usLength) == usLength ? 0 : -errno;
|
2013-10-31 16:00:05 +01:00
|
|
|
}
|
|
|
|
|
2015-10-03 15:25:53 +02:00
|
|
|
/****************************************************************************
|
2013-10-31 16:00:05 +01:00
|
|
|
* Name: cc3000_read
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* This function enter point for read flow. This function will block the
|
2014-11-28 15:52:52 +01:00
|
|
|
* caller until there is data available
|
2013-10-31 16:00:05 +01:00
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* pUserBuffer
|
|
|
|
* usLength
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
*
|
2015-10-03 15:25:53 +02:00
|
|
|
****************************************************************************/
|
2013-10-31 16:00:05 +01:00
|
|
|
|
|
|
|
long cc3000_read(uint8_t *pUserBuffer, uint16_t usLength)
|
|
|
|
{
|
2014-11-28 15:52:52 +01:00
|
|
|
DEBUGASSERT(spiconf.cc3000fd >= 0);
|
2015-10-10 19:51:32 +02:00
|
|
|
return read(spiconf.cc3000fd, pUserBuffer, usLength);
|
2013-10-31 16:00:05 +01:00
|
|
|
}
|
|
|
|
|
2015-10-03 15:25:53 +02:00
|
|
|
/****************************************************************************
|
2013-10-31 16:00:05 +01:00
|
|
|
* Name: cc3000_wait
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Waits on a message from the driver.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
*
|
2015-10-03 15:25:53 +02:00
|
|
|
****************************************************************************/
|
2013-10-31 16:00:05 +01:00
|
|
|
|
|
|
|
uint8_t *cc3000_wait(void)
|
|
|
|
{
|
2014-11-28 15:52:52 +01:00
|
|
|
DEBUGASSERT(spiconf.cc3000fd >= 0);
|
2013-10-31 16:00:05 +01:00
|
|
|
|
2015-09-08 15:37:19 +02:00
|
|
|
mq_receive(spiconf.queue, (FAR char *)&spiconf.rx_buffer,
|
|
|
|
sizeof(spiconf.rx_buffer), 0);
|
2014-02-18 21:16:51 +01:00
|
|
|
return spiconf.rx_buffer.pbuffer;
|
2013-10-31 16:00:05 +01:00
|
|
|
}
|
|
|
|
|
2015-10-03 15:25:53 +02:00
|
|
|
/****************************************************************************
|
2013-10-31 16:00:05 +01:00
|
|
|
* Name: unsoliced_thread_func
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* This is the thread for unsolicited events. This function will block the
|
2014-11-28 15:52:52 +01:00
|
|
|
* caller until there is data available
|
2013-10-31 16:00:05 +01:00
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* parameter
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
*
|
2015-10-03 15:25:53 +02:00
|
|
|
****************************************************************************/
|
2013-10-31 16:00:05 +01:00
|
|
|
|
|
|
|
static void *unsoliced_thread_func(void *parameter)
|
|
|
|
{
|
|
|
|
char buff[QUEUE_NAMELEN];
|
|
|
|
int status = 0;
|
|
|
|
int nbytes = 0;
|
|
|
|
int minor = 0;
|
|
|
|
|
|
|
|
ioctl(spiconf.cc3000fd, CC3000IOC_GETQUESEMID, (unsigned long)&minor);
|
|
|
|
snprintf(buff, QUEUE_NAMELEN, QUEUE_FORMAT, minor);
|
2015-09-08 15:37:19 +02:00
|
|
|
spiconf.queue = mq_open(buff, O_RDONLY);
|
2013-10-31 16:00:05 +01:00
|
|
|
DEBUGASSERT(spiconf.queue != (mqd_t) -1);
|
|
|
|
DEBUGASSERT(SEM_NAMELEN == QUEUE_NAMELEN);
|
|
|
|
snprintf(buff, SEM_NAMELEN, SEM_FORMAT, minor);
|
2015-10-10 19:51:32 +02:00
|
|
|
spiconf.done = sem_open(buff, O_RDONLY);
|
2013-10-31 16:00:05 +01:00
|
|
|
DEBUGASSERT(spiconf.done != (sem_t *)-1);
|
|
|
|
|
2014-05-21 15:32:32 +02:00
|
|
|
sem_post(&spiconf.unsoliced_thread_wakesem);
|
|
|
|
|
2014-04-12 21:09:48 +02:00
|
|
|
while (spiconf.run)
|
2013-10-31 16:00:05 +01:00
|
|
|
{
|
2015-10-10 19:51:32 +02:00
|
|
|
memset(&spiconf.rx_buffer, 0, sizeof(spiconf.rx_buffer));
|
2015-09-08 15:37:19 +02:00
|
|
|
nbytes = mq_receive(spiconf.queue, (FAR char *)&spiconf.rx_buffer,
|
2014-02-18 21:16:51 +01:00
|
|
|
sizeof(spiconf.rx_buffer), 0);
|
2013-10-31 16:00:05 +01:00
|
|
|
if (nbytes > 0)
|
|
|
|
{
|
2015-10-10 19:51:32 +02:00
|
|
|
nlldbg("%d Processed\n", nbytes);
|
2014-02-18 21:16:51 +01:00
|
|
|
spiconf.pfRxHandler(spiconf.rx_buffer.pbuffer);
|
2013-10-31 16:00:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mq_close(spiconf.queue);
|
|
|
|
sem_close(spiconf.done);
|
|
|
|
pthread_exit((pthread_addr_t)status);
|
|
|
|
return (pthread_addr_t)status;
|
|
|
|
}
|
|
|
|
|
2015-10-03 15:25:53 +02:00
|
|
|
/****************************************************************************
|
2013-10-31 16:00:05 +01:00
|
|
|
* Name: cc3000_open
|
|
|
|
*
|
|
|
|
* Description:
|
2014-11-28 15:52:52 +01:00
|
|
|
* Open the cc3000 driver
|
2013-10-31 16:00:05 +01:00
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* pfRxHandler the Rx handler for messages
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* None
|
|
|
|
*
|
2015-10-03 15:25:53 +02:00
|
|
|
****************************************************************************/
|
2013-10-31 16:00:05 +01:00
|
|
|
|
|
|
|
void cc3000_open(gcSpiHandleRx pfRxHandler)
|
|
|
|
{
|
|
|
|
int status;
|
|
|
|
int fd;
|
|
|
|
|
2014-11-28 15:52:52 +01:00
|
|
|
DEBUGASSERT(spiconf.cc3000fd == -1);
|
2013-10-31 16:00:05 +01:00
|
|
|
|
2015-10-10 19:51:32 +02:00
|
|
|
fd = open("/dev/wireless0", O_RDWR | O_BINARY);
|
2014-11-28 15:52:52 +01:00
|
|
|
if (fd >= 0)
|
2013-10-31 16:00:05 +01:00
|
|
|
{
|
|
|
|
spiconf.pfRxHandler = pfRxHandler;
|
|
|
|
spiconf.cc3000fd = fd;
|
|
|
|
spiconf.run = true;
|
|
|
|
|
2014-05-21 15:32:32 +02:00
|
|
|
sem_init(&spiconf.unsoliced_thread_wakesem, 0, 0);
|
|
|
|
|
2013-10-31 16:00:05 +01:00
|
|
|
pthread_attr_t attr;
|
|
|
|
struct sched_param param;
|
|
|
|
pthread_attr_init(&attr);
|
2013-11-01 18:40:19 +01:00
|
|
|
attr.stacksize = CONFIG_CC3000_UNSOLICED_STACKSIZE;
|
2013-10-31 16:00:05 +01:00
|
|
|
param.sched_priority = SCHED_PRIORITY_DEFAULT-10;
|
|
|
|
pthread_attr_setschedparam(&attr, ¶m);
|
|
|
|
status = pthread_create(&spiconf.unsoliced_thread, &attr,
|
|
|
|
unsoliced_thread_func, NULL);
|
2015-05-27 21:32:39 +02:00
|
|
|
DEBUGASSERT(status == 0);
|
2014-04-22 20:18:08 +02:00
|
|
|
UNUSED(status);
|
2014-05-21 15:32:32 +02:00
|
|
|
|
|
|
|
/* Wait unsoliced_thread to wake-up. */
|
|
|
|
|
|
|
|
while (sem_wait(&spiconf.unsoliced_thread_wakesem) != 0)
|
|
|
|
{
|
|
|
|
ASSERT(errno == EINTR);
|
|
|
|
}
|
2013-10-31 16:00:05 +01:00
|
|
|
}
|
|
|
|
|
2014-11-28 15:52:52 +01:00
|
|
|
DEBUGASSERT(spiconf.cc3000fd >= 0);
|
2013-10-31 16:00:05 +01:00
|
|
|
}
|
|
|
|
|
2015-10-03 15:25:53 +02:00
|
|
|
/****************************************************************************
|
2013-10-31 16:00:05 +01:00
|
|
|
* Name: cc3000_close
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Close the cc3000 driver
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* None
|
|
|
|
*
|
2015-10-03 15:25:53 +02:00
|
|
|
****************************************************************************/
|
2013-10-31 16:00:05 +01:00
|
|
|
|
|
|
|
void cc3000_close(void)
|
|
|
|
{
|
2014-11-28 15:52:52 +01:00
|
|
|
if (spiconf.cc3000fd >= 0)
|
2013-10-31 16:00:05 +01:00
|
|
|
{
|
|
|
|
int status;
|
|
|
|
spiconf.run = false;
|
|
|
|
|
|
|
|
pthread_cancel(spiconf.unsoliced_thread);
|
2015-10-10 19:51:32 +02:00
|
|
|
pthread_join(spiconf.unsoliced_thread, (FAR pthread_addr_t *)&status);
|
2013-10-31 16:00:05 +01:00
|
|
|
|
|
|
|
close(spiconf.cc3000fd);
|
2014-11-28 15:52:52 +01:00
|
|
|
|
|
|
|
memset(&spiconf, 0, sizeof(spiconf));
|
|
|
|
spiconf.cc3000fd = -1;
|
2013-10-31 16:00:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: cc3000_wait_data
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Adds this socket for monitoring for the data operation
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* sd cc3000 socket handle or -1 tp remove it
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero is returned on success. Otherwise, a -1 value is
|
|
|
|
* returned to indicate socket not found.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int cc3000_wait_data(int sockfd)
|
|
|
|
{
|
|
|
|
int rv = sockfd;
|
2014-11-28 15:52:52 +01:00
|
|
|
|
|
|
|
DEBUGASSERT(spiconf.cc3000fd >= 0);
|
2013-10-31 16:00:05 +01:00
|
|
|
ioctl(spiconf.cc3000fd, CC3000IOC_SELECTDATA, (unsigned long)&rv);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: cc3000_accept_socket
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Adds this socket for monitoring for the accept operation
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* sd cc3000 socket handle or -1 tp remove it
|
|
|
|
* minor - The input device minor number
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero is returned on success. Otherwise, a -1 value is
|
|
|
|
* returned to indicate socket not found.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2014-11-28 15:52:52 +01:00
|
|
|
|
2013-10-31 16:00:05 +01:00
|
|
|
int cc3000_accept_socket(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
|
|
|
|
{
|
2014-11-28 15:52:52 +01:00
|
|
|
DEBUGASSERT(spiconf.cc3000fd >= 0);
|
2013-10-31 16:00:05 +01:00
|
|
|
|
|
|
|
cc3000_acceptcfg cfg;
|
|
|
|
cfg.sockfd = sockfd;
|
|
|
|
cfg.addr = addr;
|
|
|
|
cfg.addrlen = addrlen;
|
|
|
|
ioctl(spiconf.cc3000fd, CC3000IOC_SELECTACCEPT, (unsigned long)&cfg);
|
|
|
|
return cfg.sockfd;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: cc3000_add_socket
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Adds a socket to the list for monitoring for long operation
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* sd cc3000 socket handle
|
|
|
|
* minor - The input device minor number
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero is returned on success. Otherwise, a -1 value is
|
|
|
|
* returned to indicate socket not found.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int cc3000_add_socket(int sockfd)
|
|
|
|
{
|
|
|
|
int rv = sockfd;
|
2014-11-28 15:52:52 +01:00
|
|
|
|
|
|
|
DEBUGASSERT(spiconf.cc3000fd >= 0);
|
2013-10-31 16:00:05 +01:00
|
|
|
ioctl(spiconf.cc3000fd, CC3000IOC_ADDSOCKET, (unsigned long)&rv);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: cc3000_remove_socket
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Removes a socket from the list of monitoring for long operation
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* sd cc3000 socket handle
|
|
|
|
* minor - The input device minor number
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero is returned on success. Otherwise, a -1 value is
|
|
|
|
* returned to indicate socket not found.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int cc3000_remove_socket(int sockfd)
|
|
|
|
{
|
|
|
|
int rv = sockfd;
|
2014-11-28 15:52:52 +01:00
|
|
|
|
|
|
|
DEBUGASSERT(spiconf.cc3000fd >= 0);
|
2013-10-31 16:00:05 +01:00
|
|
|
ioctl(spiconf.cc3000fd, CC3000IOC_REMOVESOCKET, (unsigned long)&rv);
|
|
|
|
return rv;
|
|
|
|
}
|
2014-11-28 15:52:52 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: cc3000_remote_closed_socket
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Mark socket as closed by remote host
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* sd cc3000 socket handle
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero is returned on success. Otherwise, a -1 value is
|
|
|
|
* returned to indicate socket not found.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int cc3000_remote_closed_socket(int sockfd)
|
|
|
|
{
|
|
|
|
int rv = sockfd;
|
|
|
|
|
|
|
|
DEBUGASSERT(spiconf.cc3000fd >= 0);
|
|
|
|
ioctl(spiconf.cc3000fd, CC3000IOC_REMOTECLOSEDSOCKET, (unsigned long)&rv);
|
|
|
|
return rv;
|
|
|
|
}
|