mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 09:38:37 +08:00
drivers/wireless: Fixes to spacing and alignement
This commit is contained in:
+10
-10
@@ -220,8 +220,7 @@
|
|||||||
|
|
||||||
#define CC1101_MCSM0_XOSC_FORCE_ON 0x01
|
#define CC1101_MCSM0_XOSC_FORCE_ON 0x01
|
||||||
|
|
||||||
/*
|
/* Chip Status Byte
|
||||||
* Chip Status Byte
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Bit fields in the chip status byte */
|
/* Bit fields in the chip status byte */
|
||||||
@@ -273,9 +272,7 @@
|
|||||||
#define CC1101_PARTNUM_VALUE 0x00
|
#define CC1101_PARTNUM_VALUE 0x00
|
||||||
#define CC1101_VERSION_VALUE 0x04
|
#define CC1101_VERSION_VALUE 0x04
|
||||||
|
|
||||||
/*
|
/* Others ... */
|
||||||
* Others ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define CC1101_LQI_CRC_OK_BM 0x80
|
#define CC1101_LQI_CRC_OK_BM 0x80
|
||||||
#define CC1101_LQI_EST_BM 0x7F
|
#define CC1101_LQI_EST_BM 0x7F
|
||||||
@@ -453,7 +450,11 @@ void cc1101_dumpregs(struct cc1101_dev_s * dev, uint8_t addr, uint8_t length)
|
|||||||
cc1101_access(dev, addr, (FAR uint8_t *)buf, length);
|
cc1101_access(dev, addr, (FAR uint8_t *)buf, length);
|
||||||
|
|
||||||
printf("CC1101[%2x]: ", addr);
|
printf("CC1101[%2x]: ", addr);
|
||||||
for (i=0; i<length; i++) printf(" %2x,", buf[i]);
|
for (i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
printf(" %2x,", buf[i]);
|
||||||
|
}
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -485,14 +486,13 @@ void cc1101_setpacketctrl(struct cc1101_dev_s * dev)
|
|||||||
values[1] = 0x00; /* Clear channel if RSSI < thr && !receiving;
|
values[1] = 0x00; /* Clear channel if RSSI < thr && !receiving;
|
||||||
* TX -> RX, RX -> RX: 0x3F */
|
* TX -> RX, RX -> RX: 0x3F */
|
||||||
values[2] = CC1101_MCSM0_VALUE; /* Calibrate on IDLE -> RX/TX, OSC Timeout = ~500 us
|
values[2] = CC1101_MCSM0_VALUE; /* Calibrate on IDLE -> RX/TX, OSC Timeout = ~500 us
|
||||||
TODO: has XOSC_FORCE_ON */
|
* TODO: has XOSC_FORCE_ON */
|
||||||
cc1101_access(dev, CC1101_MCSM2, values, -3);
|
cc1101_access(dev, CC1101_MCSM2, values, -3);
|
||||||
|
|
||||||
/* Wake-On Radio Control */
|
/* Wake-On Radio Control */
|
||||||
|
/* Not used yet. */
|
||||||
|
|
||||||
// Not used yet.
|
/* WOREVT1:WOREVT0 - 16-bit timeout register */
|
||||||
|
|
||||||
// WOREVT1:WOREVT0 - 16-bit timeout register
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -631,7 +631,7 @@ static void * cc3000_worker(FAR void *arg)
|
|||||||
|
|
||||||
ASSERT(priv != NULL && priv->config != NULL);
|
ASSERT(priv != NULL && priv->config != NULL);
|
||||||
|
|
||||||
/* We have started release our creator*/
|
/* We have started, release our creator */
|
||||||
|
|
||||||
sem_post(&priv->readysem);
|
sem_post(&priv->readysem);
|
||||||
while (1)
|
while (1)
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ uint8_t *UINT16_TO_STREAM_f(uint8_t *p, uint16_t u16)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
uint16_t STREAM_TO_UINT16_f(char* p, uint16_t offset)
|
uint16_t STREAM_TO_UINT16_f(FAR char *p, uint16_t offset)
|
||||||
{
|
{
|
||||||
return (uint16_t)((uint16_t)((uint16_t)
|
return (uint16_t)((uint16_t)((uint16_t)
|
||||||
(*(p + offset + 1)) << 8) + (uint16_t)(*(p + offset)));
|
(*(p + offset + 1)) << 8) + (uint16_t)(*(p + offset)));
|
||||||
@@ -139,7 +139,7 @@ uint16_t STREAM_TO_UINT16_f(char* p, uint16_t offset)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
unsigned long STREAM_TO_UINT32_f(char* p, uint16_t offset)
|
unsigned long STREAM_TO_UINT32_f(FAR char *p, uint16_t offset)
|
||||||
{
|
{
|
||||||
return (unsigned long)((unsigned long)((unsigned long)
|
return (unsigned long)((unsigned long)((unsigned long)
|
||||||
(*(p + offset + 3)) << 24) + (unsigned long)((unsigned long)
|
(*(p + offset + 3)) << 24) + (unsigned long)((unsigned long)
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ void cc3000_close(void)
|
|||||||
spiconf.run = false;
|
spiconf.run = false;
|
||||||
|
|
||||||
pthread_cancel(spiconf.unsoliced_thread);
|
pthread_cancel(spiconf.unsoliced_thread);
|
||||||
pthread_join(spiconf.unsoliced_thread, (pthread_addr_t*)&status);
|
pthread_join(spiconf.unsoliced_thread, (FAR pthread_addr_t *)&status);
|
||||||
|
|
||||||
close(spiconf.cc3000fd);
|
close(spiconf.cc3000fd);
|
||||||
|
|
||||||
|
|||||||
@@ -237,7 +237,8 @@ uint8_t *hci_event_handler(void *pRetParams, uint8_t *from, uint8_t *fromlen)
|
|||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (tSLInformation.usEventOrDataReceived != 0) {
|
if (tSLInformation.usEventOrDataReceived != 0)
|
||||||
|
{
|
||||||
pucReceivedData = (tSLInformation.pucReceivedData);
|
pucReceivedData = (tSLInformation.pucReceivedData);
|
||||||
|
|
||||||
if (*pucReceivedData == HCI_TYPE_EVNT)
|
if (*pucReceivedData == HCI_TYPE_EVNT)
|
||||||
@@ -623,10 +624,10 @@ long hci_unsol_event_handler(char *event_hdr)
|
|||||||
|
|
||||||
case HCI_EVNT_WLAN_UNSOL_DHCP:
|
case HCI_EVNT_WLAN_UNSOL_DHCP:
|
||||||
{
|
{
|
||||||
uint8_t params[NETAPP_IPCONFIG_MAC_OFFSET + 1]; // extra byte is for the status
|
uint8_t params[NETAPP_IPCONFIG_MAC_OFFSET + 1]; /* Extra byte is for the status */
|
||||||
uint8_t *recParams = params;
|
uint8_t *recParams = params;
|
||||||
|
|
||||||
data = (char*)(event_hdr) + HCI_EVENT_HEADER_SIZE;
|
data = (FAR char *)(event_hdr) + HCI_EVENT_HEADER_SIZE;
|
||||||
|
|
||||||
/* Read IP address */
|
/* Read IP address */
|
||||||
|
|
||||||
@@ -666,7 +667,7 @@ long hci_unsol_event_handler(char *event_hdr)
|
|||||||
case HCI_EVNT_WLAN_ASYNC_PING_REPORT:
|
case HCI_EVNT_WLAN_ASYNC_PING_REPORT:
|
||||||
{
|
{
|
||||||
netapp_pingreport_args_t params;
|
netapp_pingreport_args_t params;
|
||||||
data = (char*)(event_hdr) + HCI_EVENT_HEADER_SIZE;
|
data = (FAR char *)(event_hdr) + HCI_EVENT_HEADER_SIZE;
|
||||||
STREAM_TO_UINT32(data, NETAPP_PING_PACKETS_SENT_OFFSET, params.packets_sent);
|
STREAM_TO_UINT32(data, NETAPP_PING_PACKETS_SENT_OFFSET, params.packets_sent);
|
||||||
STREAM_TO_UINT32(data, NETAPP_PING_PACKETS_RCVD_OFFSET, params.packets_received);
|
STREAM_TO_UINT32(data, NETAPP_PING_PACKETS_RCVD_OFFSET, params.packets_received);
|
||||||
STREAM_TO_UINT32(data, NETAPP_PING_MIN_RTT_OFFSET, params.min_round_time);
|
STREAM_TO_UINT32(data, NETAPP_PING_MIN_RTT_OFFSET, params.min_round_time);
|
||||||
@@ -684,7 +685,7 @@ long hci_unsol_event_handler(char *event_hdr)
|
|||||||
{
|
{
|
||||||
int sockfd;
|
int sockfd;
|
||||||
|
|
||||||
data = (char*)(event_hdr) + HCI_EVENT_HEADER_SIZE;
|
data = (FAR char *)(event_hdr) + HCI_EVENT_HEADER_SIZE;
|
||||||
STREAM_TO_UINT32(data, NETAPP_PING_PACKETS_SENT_OFFSET, sockfd);
|
STREAM_TO_UINT32(data, NETAPP_PING_PACKETS_SENT_OFFSET, sockfd);
|
||||||
data += 4;
|
data += 4;
|
||||||
|
|
||||||
@@ -931,7 +932,8 @@ void SimpleLinkWaitEvent(uint16_t opcode, void *pRetParams)
|
|||||||
nllvdbg("cc3000_wait\n");
|
nllvdbg("cc3000_wait\n");
|
||||||
tSLInformation.pucReceivedData = cc3000_wait();
|
tSLInformation.pucReceivedData = cc3000_wait();
|
||||||
tSLInformation.usEventOrDataReceived = 1;
|
tSLInformation.usEventOrDataReceived = 1;
|
||||||
STREAM_TO_UINT16((char *)tSLInformation.pucReceivedData, HCI_EVENT_OPCODE_OFFSET,event_type);
|
STREAM_TO_UINT16((FAR char *)tSLInformation.pucReceivedData,
|
||||||
|
HCI_EVENT_OPCODE_OFFSET, event_type);
|
||||||
|
|
||||||
if (*tSLInformation.pucReceivedData == HCI_TYPE_EVNT)
|
if (*tSLInformation.pucReceivedData == HCI_TYPE_EVNT)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -241,9 +241,9 @@ uint8_t nvmem_get_mac_address(uint8_t *mac)
|
|||||||
uint8_t nvmem_write_patch(unsigned long ulFileId, unsigned long spLength,
|
uint8_t nvmem_write_patch(unsigned long ulFileId, unsigned long spLength,
|
||||||
const uint8_t *spData)
|
const uint8_t *spData)
|
||||||
{
|
{
|
||||||
|
FAR uint8_t *spDataPtr = (FAR uint8_t *)spData;
|
||||||
uint8_t status = 0;
|
uint8_t status = 0;
|
||||||
uint16_t offset = 0;
|
uint16_t offset = 0;
|
||||||
uint8_t *spDataPtr = (uint8_t*)spData;
|
|
||||||
|
|
||||||
while ((status == 0) && (spLength >= SP_PORTION_SIZE))
|
while ((status == 0) && (spLength >= SP_PORTION_SIZE))
|
||||||
{
|
{
|
||||||
@@ -349,7 +349,7 @@ signed long nvmem_create_entry(unsigned long ulFileId, unsigned long ulNewLen)
|
|||||||
ptr = tSLInformation.pucTxCommandBuffer;
|
ptr = tSLInformation.pucTxCommandBuffer;
|
||||||
args = (ptr + HEADERS_SIZE_CMD);
|
args = (ptr + HEADERS_SIZE_CMD);
|
||||||
|
|
||||||
/*( Fill in HCI packet structure */
|
/* Fill in HCI packet structure */
|
||||||
|
|
||||||
args = UINT32_TO_STREAM(args, ulFileId);
|
args = UINT32_TO_STREAM(args, ulFileId);
|
||||||
args = UINT32_TO_STREAM(args, ulNewLen);
|
args = UINT32_TO_STREAM(args, ulNewLen);
|
||||||
|
|||||||
+227
-152
File diff suppressed because it is too large
Load Diff
@@ -286,7 +286,7 @@ int cc3000_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
|
|||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cc3000_do_accept(int sockfd, addr, addrlen);;
|
return cc3000_do_accept(sockfd, addr, addrlen);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -436,8 +436,8 @@ int cc3000_connect(int sockfd, FAR const struct sockaddr *addr, socklen_t addrle
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int cc3000_select(int nfds, fd_set *readfds, fd_set *writefds,fd_set *exceptfds,
|
int cc3000_select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||||
struct timeval *timeout)
|
fd_set *exceptfds, struct timeval *timeout)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -765,8 +765,10 @@ ssize_t cc3000_sendto(int sockfd, FAR const void *buf, size_t len, int flags,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef CC3000_TINY_DRIVER
|
#ifndef CC3000_TINY_DRIVER
|
||||||
// TODO: Standard is struct hostent *gethostbyname(const char *name);
|
/* REVISIT: Standard is struct hostent *gethostbyname(const char *name); */
|
||||||
int cc3000_gethostbyname(char * hostname, uint16_t usNameLen, unsigned long* out_ip_addr)
|
|
||||||
|
int cc3000_gethostbyname(char *hostname, uint16_t usNameLen,
|
||||||
|
unsigned long *out_ip_addr)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|||||||
@@ -514,7 +514,8 @@ long cc3000_listen_impl(long sd, long backlog)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef CC3000_TINY_DRIVER
|
#ifndef CC3000_TINY_DRIVER
|
||||||
int cc3000_gethostbyname_impl(char * hostname, uint16_t usNameLen, unsigned long* out_ip_addr)
|
int cc3000_gethostbyname_impl(char *hostname, uint16_t usNameLen,
|
||||||
|
unsigned long *out_ip_addr)
|
||||||
{
|
{
|
||||||
tBsdGethostbynameParams ret;
|
tBsdGethostbynameParams ret;
|
||||||
uint8_t *ptr, *args;
|
uint8_t *ptr, *args;
|
||||||
@@ -546,7 +547,7 @@ int cc3000_gethostbyname_impl(char * hostname, uint16_t usNameLen, unsigned long
|
|||||||
|
|
||||||
set_errno(ret.retVal);
|
set_errno(ret.retVal);
|
||||||
|
|
||||||
(*((long*)out_ip_addr)) = ret.outputAddress;
|
(*((FAR long *)out_ip_addr)) = ret.outputAddress;
|
||||||
|
|
||||||
return ret.retVal;
|
return ret.retVal;
|
||||||
}
|
}
|
||||||
@@ -680,9 +681,9 @@ int cc3000_select_impl(long nfds, TICC3000fd_set *readsds, TICC3000fd_set *write
|
|||||||
args = UINT32_TO_STREAM(args, 0x00000014);
|
args = UINT32_TO_STREAM(args, 0x00000014);
|
||||||
args = UINT32_TO_STREAM(args, 0x00000014);
|
args = UINT32_TO_STREAM(args, 0x00000014);
|
||||||
args = UINT32_TO_STREAM(args, is_blocking);
|
args = UINT32_TO_STREAM(args, is_blocking);
|
||||||
args = UINT32_TO_STREAM(args, ((readsds) ? *(unsigned long*)readsds : 0));
|
args = UINT32_TO_STREAM(args, ((readsds) ? *(FAR unsigned long *)readsds : 0));
|
||||||
args = UINT32_TO_STREAM(args, ((writesds) ? *(unsigned long*)writesds : 0));
|
args = UINT32_TO_STREAM(args, ((writesds) ? *(FAR unsigned long *)writesds : 0));
|
||||||
args = UINT32_TO_STREAM(args, ((exceptsds) ? *(unsigned long*)exceptsds : 0));
|
args = UINT32_TO_STREAM(args, ((exceptsds) ? *(FAR unsigned long *)exceptsds : 0));
|
||||||
|
|
||||||
if (timeout)
|
if (timeout)
|
||||||
{
|
{
|
||||||
@@ -1119,18 +1120,18 @@ int simple_link_send(long sd, const void *buf, long len, long flags,
|
|||||||
|
|
||||||
/* Copy the data received from user into the TX Buffer */
|
/* Copy the data received from user into the TX Buffer */
|
||||||
|
|
||||||
ARRAY_TO_STREAM(pDataPtr, ((uint8_t *)buf), len);
|
ARRAY_TO_STREAM(pDataPtr, ((FAR uint8_t *)buf), len);
|
||||||
|
|
||||||
/* In case we are using SendTo, copy the to parameters */
|
/* In case we are using SendTo, copy the to parameters */
|
||||||
|
|
||||||
if (opcode == HCI_CMND_SENDTO)
|
if (opcode == HCI_CMND_SENDTO)
|
||||||
{
|
{
|
||||||
ARRAY_TO_STREAM(pDataPtr, ((uint8_t *)to), tolen);
|
ARRAY_TO_STREAM(pDataPtr, ((FAR uint8_t *)to), tolen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initiate a HCI command */
|
/* Initiate a HCI command */
|
||||||
|
|
||||||
hci_data_send(opcode, ptr, uArgSize, len,(uint8_t*)to, tolen);
|
hci_data_send(opcode, ptr, uArgSize, len, (FAR uint8_t *)to, tolen);
|
||||||
|
|
||||||
if (opcode == HCI_CMND_SENDTO)
|
if (opcode == HCI_CMND_SENDTO)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -907,7 +907,8 @@ long wlan_ioctl_set_scan_params(unsigned long uiEnable,
|
|||||||
unsigned long uiMinDwellTime,
|
unsigned long uiMinDwellTime,
|
||||||
unsigned long uiMaxDwellTime,
|
unsigned long uiMaxDwellTime,
|
||||||
unsigned long uiNumOfProbeRequests,
|
unsigned long uiNumOfProbeRequests,
|
||||||
unsigned long uiChannelMask,long iRSSIThreshold,
|
unsigned long uiChannelMask,
|
||||||
|
long iRSSIThreshold,
|
||||||
unsigned long uiSNRThreshold,
|
unsigned long uiSNRThreshold,
|
||||||
unsigned long uiDefaultTxPower,
|
unsigned long uiDefaultTxPower,
|
||||||
unsigned long *aiIntervalList)
|
unsigned long *aiIntervalList)
|
||||||
@@ -1163,7 +1164,7 @@ long wlan_smart_config_stop(void)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
long wlan_smart_config_set_prefix(char* cNewPrefix)
|
long wlan_smart_config_set_prefix(FAR char *cNewPrefix)
|
||||||
{
|
{
|
||||||
long ret;
|
long ret;
|
||||||
uint8_t *ptr;
|
uint8_t *ptr;
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ static inline void nrf24l01_configspi(FAR struct spi_dev_s *spi)
|
|||||||
* As we own the SPI bus this method is called just once.
|
* As we own the SPI bus this method is called just once.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SPI_SELECT(spi, SPIDEV_WIRELESS, true); // Useful ?
|
SPI_SELECT(spi, SPIDEV_WIRELESS, true); /* Useful ? */
|
||||||
SPI_SETMODE(spi, SPIDEV_MODE0);
|
SPI_SETMODE(spi, SPIDEV_MODE0);
|
||||||
SPI_SETBITS(spi, 8);
|
SPI_SETBITS(spi, 8);
|
||||||
SPI_SETFREQUENCY(spi, NRF24L01_SPIFREQ);
|
SPI_SETFREQUENCY(spi, NRF24L01_SPIFREQ);
|
||||||
@@ -980,7 +980,7 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case NRF24L01IOC_GETRETRCFG: /* Get retransmit params. arg: Pointer to nrf24l01_retrcfg_t */
|
case NRF24L01IOC_GETRETRCFG: /* Get retransmit params. arg: Pointer to nrf24l01_retrcfg_t */
|
||||||
result = -ENOSYS; /* TODO !*/
|
result = -ENOSYS; /* TODO */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NRF24L01IOC_SETPIPESCFG:
|
case NRF24L01IOC_SETPIPESCFG:
|
||||||
@@ -1053,7 +1053,7 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case NRF24L01IOC_GETDATARATE:
|
case NRF24L01IOC_GETDATARATE:
|
||||||
result = -ENOSYS; /* TODO !*/
|
result = -ENOSYS; /* TODO */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NRF24L01IOC_SETADDRWIDTH:
|
case NRF24L01IOC_SETADDRWIDTH:
|
||||||
@@ -1351,7 +1351,8 @@ int nrf24l01_init(FAR struct nrf24l01_dev_s *dev)
|
|||||||
|
|
||||||
/* Clear interrupt sources (useful ?) */
|
/* Clear interrupt sources (useful ?) */
|
||||||
|
|
||||||
nrf24l01_writeregbyte(dev, NRF24L01_STATUS, NRF24L01_RX_DR|NRF24L01_TX_DS|NRF24L01_MAX_RT);
|
nrf24l01_writeregbyte(dev, NRF24L01_STATUS,
|
||||||
|
NRF24L01_RX_DR | NRF24L01_TX_DS | NRF24L01_MAX_RT);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
nrf24l01_unlock(dev->spi);
|
nrf24l01_unlock(dev->spi);
|
||||||
|
|||||||
Reference in New Issue
Block a user