Add option to enable wireless debug output.
This commit is contained in:
parent
89717094eb
commit
57a1360c84
32
Kconfig
32
Kconfig
@ -732,6 +732,38 @@ config DEBUG_NET_INFO
|
||||
|
||||
endif # DEBUG_NET
|
||||
|
||||
config DEBUG_WIRELESS
|
||||
bool "Wireless Debug Features"
|
||||
default n
|
||||
depends on WIRELESS | DRIVERS_WIRELESS
|
||||
---help---
|
||||
Enable DEBUG_WIRELESS debug features.
|
||||
|
||||
if DEBUG_WIRELESS
|
||||
|
||||
config DEBUG_WIRELESS_ERROR
|
||||
bool "Wireless Error Output"
|
||||
default n
|
||||
depends on DEBUG_ERROR
|
||||
---help---
|
||||
Enable wireless error output to SYSLOG.
|
||||
|
||||
config DEBUG_WIRELESS_WARN
|
||||
bool "Wireless Warnings Output"
|
||||
default n
|
||||
depends on DEBUG_WARN
|
||||
---help---
|
||||
Enable wireless warning output to SYSLOG.
|
||||
|
||||
config DEBUG_WIRELESS_INFO
|
||||
bool "Wireless Informational Output"
|
||||
default n
|
||||
depends on DEBUG_INFO
|
||||
---help---
|
||||
Enable wireless informational output to SYSLOG.
|
||||
|
||||
endif # DEBUG_WIRELESS
|
||||
|
||||
config DEBUG_SCHED
|
||||
bool "Scheduler Debug Features"
|
||||
default n
|
||||
|
@ -221,7 +221,7 @@ static uint8_t fifoget(struct nrf24l01_dev_s *dev, FAR uint8_t *buffer,
|
||||
static void nrf24l01_worker(FAR void *arg);
|
||||
#endif
|
||||
|
||||
#ifdef NRF24L01_DEBUG
|
||||
#ifdef CONFIG_DEBUG_WIRELESS
|
||||
static void binarycvt(char *deststr, const uint8_t *srcbin, size_t srclen)
|
||||
#endif
|
||||
|
||||
@ -595,7 +595,7 @@ static int nrf24l01_irqhandler(int irq, FAR void *context, FAR void *arg)
|
||||
{
|
||||
FAR struct nrf24l01_dev_s *dev = (FAR struct nrf24l01_dev_s *)arg;
|
||||
|
||||
winfo("*IRQ*\n");
|
||||
wlinfo("*IRQ*\n");
|
||||
|
||||
#ifdef CONFIG_WL_NRF24L01_RXSUPPORT
|
||||
/* If RX is enabled we delegate the actual work to bottom-half handler */
|
||||
@ -667,7 +667,7 @@ static void nrf24l01_worker(FAR void *arg)
|
||||
bool has_data = false;
|
||||
#endif
|
||||
|
||||
winfo("RX_DR is set!\n");
|
||||
wlinfo("RX_DR is set!\n");
|
||||
|
||||
/* Read and store all received payloads */
|
||||
|
||||
@ -686,7 +686,7 @@ static void nrf24l01_worker(FAR void *arg)
|
||||
pipeno = (status & NRF24L01_RX_P_NO_MASK) >> NRF24L01_RX_P_NO_SHIFT;
|
||||
if (pipeno >= NRF24L01_PIPE_COUNT) /* 6=invalid 7=fifo empty */
|
||||
{
|
||||
werr("invalid pipe rx: %d\n", (int)pipeno);
|
||||
wlerr("invalid pipe rx: %d\n", (int)pipeno);
|
||||
nrf24l01_flush_rx(dev);
|
||||
break;
|
||||
}
|
||||
@ -703,7 +703,7 @@ static void nrf24l01_worker(FAR void *arg)
|
||||
|
||||
if (pktlen > NRF24L01_MAX_PAYLOAD_LEN) /* bad length */
|
||||
{
|
||||
werr("invalid length in rx: %d\n", (int)pktlen);
|
||||
wlerr("invalid length in rx: %d\n", (int)pktlen);
|
||||
nrf24l01_flush_rx(dev);
|
||||
break;
|
||||
}
|
||||
@ -720,8 +720,8 @@ static void nrf24l01_worker(FAR void *arg)
|
||||
|
||||
status = nrf24l01_readreg(dev, NRF24L01_FIFO_STATUS, &fifo_status, 1);
|
||||
|
||||
winfo("FIFO_STATUS=%02x\n", fifo_status);
|
||||
winfo("STATUS=%02x\n", status);
|
||||
wlinfo("FIFO_STATUS=%02x\n", fifo_status);
|
||||
wlinfo("STATUS=%02x\n", status);
|
||||
}
|
||||
while ((fifo_status & NRF24L01_RX_EMPTY) == 0);
|
||||
|
||||
@ -730,7 +730,7 @@ static void nrf24l01_worker(FAR void *arg)
|
||||
{
|
||||
dev->pfd->revents |= POLLIN; /* Data available for input */
|
||||
|
||||
winfo("Wake up polled fd\n");
|
||||
wlinfo("Wake up polled fd\n");
|
||||
sem_post(dev->pfd->sem);
|
||||
}
|
||||
#endif
|
||||
@ -758,7 +758,7 @@ static void nrf24l01_worker(FAR void *arg)
|
||||
}
|
||||
else
|
||||
{
|
||||
werr("invalid length in rx: %d\n", (int)pktlen);
|
||||
wlerr("invalid length in rx: %d\n", (int)pktlen);
|
||||
}
|
||||
}
|
||||
|
||||
@ -874,7 +874,7 @@ static int dosend(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data,
|
||||
|
||||
if (result < 0)
|
||||
{
|
||||
werr("wait for irq failed\n");
|
||||
wlerr("wait for irq failed\n");
|
||||
nrf24l01_flush_tx(dev);
|
||||
goto out;
|
||||
}
|
||||
@ -888,11 +888,11 @@ static int dosend(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data,
|
||||
dev->lastxmitcount = (obsvalue & NRF24L01_ARC_CNT_MASK)
|
||||
>> NRF24L01_ARC_CNT_SHIFT;
|
||||
|
||||
winfo("Transmission OK (lastxmitcount=%d)\n", dev->lastxmitcount);
|
||||
wlinfo("Transmission OK (lastxmitcount=%d)\n", dev->lastxmitcount);
|
||||
}
|
||||
else if (status & NRF24L01_MAX_RT)
|
||||
{
|
||||
winfo("MAX_RT! (lastxmitcount=%d)\n", dev->lastxmitcount);
|
||||
wlinfo("MAX_RT! (lastxmitcount=%d)\n", dev->lastxmitcount);
|
||||
result = -ECOMM;
|
||||
dev->lastxmitcount = NRF24L01_XMIT_MAXRT;
|
||||
|
||||
@ -906,7 +906,7 @@ static int dosend(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data,
|
||||
{
|
||||
/* Unexpected... */
|
||||
|
||||
werr("ERROR: No TX_DS nor MAX_RT bit set in STATUS reg!\n");
|
||||
wlerr("ERROR: No TX_DS nor MAX_RT bit set in STATUS reg!\n");
|
||||
result = -EIO;
|
||||
}
|
||||
|
||||
@ -930,7 +930,7 @@ out:
|
||||
* Name: binarycvt
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef NRF24L01_DEBUG
|
||||
#ifdef CONFIG_DEBUG_WIRELESS
|
||||
static void binarycvt(char *deststr, const uint8_t *srcbin, size_t srclen)
|
||||
{
|
||||
int i = 0;
|
||||
@ -958,7 +958,7 @@ static int nrf24l01_open(FAR struct file *filep)
|
||||
FAR struct nrf24l01_dev_s *dev;
|
||||
int result;
|
||||
|
||||
winfo("Opening nRF24L01 dev\n");
|
||||
wlinfo("Opening nRF24L01 dev\n");
|
||||
|
||||
DEBUGASSERT(filep);
|
||||
inode = filep->f_inode;
|
||||
@ -1004,7 +1004,7 @@ static int nrf24l01_close(FAR struct file *filep)
|
||||
FAR struct inode *inode;
|
||||
FAR struct nrf24l01_dev_s *dev;
|
||||
|
||||
winfo("Closing nRF24L01 dev\n");
|
||||
wlinfo("Closing nRF24L01 dev\n");
|
||||
DEBUGASSERT(filep);
|
||||
inode = filep->f_inode;
|
||||
|
||||
@ -1103,7 +1103,7 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR struct nrf24l01_dev_s *dev;
|
||||
int result = OK;
|
||||
|
||||
winfo("cmd: %d arg: %ld\n", cmd, arg);
|
||||
wlinfo("cmd: %d arg: %ld\n", cmd, arg);
|
||||
DEBUGASSERT(filep);
|
||||
inode = filep->f_inode;
|
||||
|
||||
@ -1347,7 +1347,7 @@ static int nrf24l01_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
||||
FAR struct nrf24l01_dev_s *dev;
|
||||
int result = OK;
|
||||
|
||||
winfo("setup: %d\n", (int)setup);
|
||||
wlinfo("setup: %d\n", (int)setup);
|
||||
DEBUGASSERT(filep && fds);
|
||||
inode = filep->f_inode;
|
||||
|
||||
@ -1501,12 +1501,12 @@ int nrf24l01_register(FAR struct spi_dev_s *spi,
|
||||
|
||||
/* Register the device as an input device */
|
||||
|
||||
winfo("Registering " DEV_NAME "\n");
|
||||
wlinfo("Registering " DEV_NAME "\n");
|
||||
|
||||
result = register_driver(DEV_NAME, &nrf24l01_fops, 0666, dev);
|
||||
if (result < 0)
|
||||
{
|
||||
werr("ERROR: register_driver() failed: %d\n", result);
|
||||
wlerr("ERROR: register_driver() failed: %d\n", result);
|
||||
nrf24l01_unregister(dev);
|
||||
}
|
||||
|
||||
@ -1990,7 +1990,7 @@ int nrf24l01_sendto(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data,
|
||||
|
||||
if ((dev->en_aa & 1) && (memcmp(destaddr, dev->pipe0addr, dev->addrlen)))
|
||||
{
|
||||
winfo("Change pipe #0 addr to dest addr\n");
|
||||
wlinfo("Change pipe #0 addr to dest addr\n");
|
||||
nrf24l01_writereg(dev, NRF24L01_RX_ADDR_P0, destaddr,
|
||||
NRF24L01_MAX_ADDR_LEN);
|
||||
pipeaddrchg = true;
|
||||
@ -2004,7 +2004,7 @@ int nrf24l01_sendto(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data,
|
||||
|
||||
nrf24l01_writereg(dev, NRF24L01_RX_ADDR_P0, dev->pipe0addr,
|
||||
NRF24L01_MAX_ADDR_LEN);
|
||||
winfo("Pipe #0 default addr restored\n");
|
||||
wlinfo("Pipe #0 default addr restored\n");
|
||||
}
|
||||
|
||||
nrf24l01_unlock(dev->spi);
|
||||
@ -2045,7 +2045,7 @@ ssize_t nrf24l01_recv(struct nrf24l01_dev_s *dev, uint8_t *buffer,
|
||||
* Name: nrf24l01_dumpregs
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef NRF24L01_DEBUG
|
||||
#ifdef CONFIG_DEBUG_WIRELESS
|
||||
void nrf24l01_dumpregs(struct nrf24l01_dev_s *dev)
|
||||
{
|
||||
uint8_t addr[NRF24L01_MAX_ADDR_LEN];
|
||||
@ -2097,17 +2097,17 @@ void nrf24l01_dumpregs(struct nrf24l01_dev_s *dev)
|
||||
syslog(LOG_INFO, "FEATURE: %02x\n",
|
||||
nrf24l01_readregbyte(dev, NRF24L01_FEATURE));
|
||||
}
|
||||
#endif /* NRF24L01_DEBUG */
|
||||
#endif /* CONFIG_DEBUG_WIRELESS */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nrf24l01_dumprxfifo
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(NRF24L01_DEBUG) && defined(CONFIG_WL_NRF24L01_RXSUPPORT)
|
||||
#if defined(CONFIG_DEBUG_WIRELESS) && defined(CONFIG_WL_NRF24L01_RXSUPPORT)
|
||||
void nrf24l01_dumprxfifo(struct nrf24l01_dev_s *dev)
|
||||
{
|
||||
syslog(LOG_INFO, "bytes count: %d\n", dev->fifo_len);
|
||||
syslog(LOG_INFO, "next read: %d, next write: %d\n",
|
||||
dev->nxt_read, dev-> nxt_write);
|
||||
}
|
||||
#endif /* NRF24L01_DEBUG && CONFIG_WL_NRF24L01_RXSUPPORT */
|
||||
#endif /* CONFIG_DEBUG_WIRELESS && CONFIG_WL_NRF24L01_RXSUPPORT */
|
||||
|
@ -233,6 +233,24 @@
|
||||
# define ninfo(x...)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_WIRELESS_ERROR
|
||||
# define wlerr(format, ...) _err(format, ##__VA_ARGS__)
|
||||
#else
|
||||
# define wlerr(x...)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_WIRELESS_WARN
|
||||
# define wlwarn(format, ...) _warn(format, ##__VA_ARGS__)
|
||||
#else
|
||||
# define wlwarn(x...)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_WIRELESS_INFO
|
||||
# define wlinfo(format, ...) _info(format, ##__VA_ARGS__)
|
||||
#else
|
||||
# define wlinfo(x...)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS_ERROR
|
||||
# define ferr(format, ...) _err(format, ##__VA_ARGS__)
|
||||
#else
|
||||
@ -777,6 +795,24 @@
|
||||
# define ninfo (void)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_WIRELESS_ERROR
|
||||
# define wlerr _err
|
||||
#else
|
||||
# define wlerr (void)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_WIRELESS_WARN
|
||||
# define wlwarn _warn
|
||||
#else
|
||||
# define wlwarn (void)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_WIRELESS_INFO
|
||||
# define wlinfo _info
|
||||
#else
|
||||
# define wlinfo (void)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS_ERROR
|
||||
# define ferr _err
|
||||
#else
|
||||
@ -1267,6 +1303,14 @@
|
||||
# define ninfodumpbuffer(m,b,n)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_WIRELESS
|
||||
# define wlerrdumpbuffer(m,b,n) errdumpbuffer(m,b,n)
|
||||
# define wlinfodumpbuffer(m,b,n) infodumpbuffer(m,b,n)
|
||||
#else
|
||||
# define wlerrdumpbuffer(m,b,n)
|
||||
# define wlinfodumpbuffer(m,b,n)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
# define ferrdumpbuffer(m,b,n) errdumpbuffer(m,b,n)
|
||||
# define finfodumpbuffer(m,b,n) infodumpbuffer(m,b,n)
|
||||
|
@ -64,8 +64,6 @@
|
||||
#define NRF24L01_DYN_LENGTH 33 /* Specific length value to use to enable dynamic packet length */
|
||||
#define NRF24L01_XMIT_MAXRT 255 /* Specific value returned by Number of available pipes */
|
||||
|
||||
/* #define NRF24L01_DEBUG 1 */
|
||||
|
||||
/* IOCTL commands */
|
||||
|
||||
#define NRF24L01IOC_SETRETRCFG _WLIOC(NRF24L01_FIRST+0) /* arg: Pointer to nrf24l01_retrcfg_t structure */
|
||||
@ -88,16 +86,6 @@
|
||||
#define NRF24L01IOC_SETTXADDR WLIOC_SETADDR
|
||||
#define NRF24L01IOC_GETTXADDR WLIOC_GETADDR
|
||||
|
||||
/* NRF24L01 debug */
|
||||
|
||||
#ifdef NRF24L01_DEBUG
|
||||
# define werr(format, ...) _err(format, ##__VA_ARGS__)
|
||||
# define winfo(format, ...) _info(format, ##__VA_ARGS__)
|
||||
#else
|
||||
# define werr(x...)
|
||||
# define winfo(x...)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data Types
|
||||
****************************************************************************/
|
||||
@ -505,12 +493,9 @@ ssize_t nrf24l01_recv(struct nrf24l01_dev_s *dev, uint8_t *buffer,
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef NRF24L01_DEBUG
|
||||
|
||||
#ifdef CONFIG_DEBUG_WIRELESS
|
||||
void nrf24l01_dumpregs(FAR struct nrf24l01_dev_s *dev);
|
||||
|
||||
void nrf24l01_dumprxfifo(FAR struct nrf24l01_dev_s *dev);
|
||||
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
|
Loading…
Reference in New Issue
Block a user