This commit is contained in:
no1wudi 2017-03-16 23:07:38 +08:00
commit 812578c066
20 changed files with 137 additions and 205 deletions

32
Kconfig
View File

@ -732,6 +732,38 @@ config DEBUG_NET_INFO
endif # DEBUG_NET 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 config DEBUG_SCHED
bool "Scheduler Debug Features" bool "Scheduler Debug Features"
default n default n

View File

@ -159,16 +159,6 @@ void up_irqinitialize(void)
(void)getreg32(A1X_INTC_IRQ_PEND(i)); /* Reading status clears pending interrupts */ (void)getreg32(A1X_INTC_IRQ_PEND(i)); /* Reading status clears pending interrupts */
} }
/* Colorize the interrupt stack for debug purposes */
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
{
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
intstack_size);
}
#endif
/* Set the interrupt base address to zero. We do not use the vectored /* Set the interrupt base address to zero. We do not use the vectored
* interrupts. * interrupts.
*/ */

View File

@ -66,22 +66,11 @@
# define HAVE_KERNEL_HEAP 1 # define HAVE_KERNEL_HEAP 1
#endif #endif
/* ARM requires at least a 4-byte stack alignment. For use with EABI and /* For use with EABI and floating point, the stack must be aligned to 8-byte
* floating point, the stack must be aligned to 8-byte addresses. * addresses.
*/ */
#ifndef CONFIG_STACK_ALIGNMENT #define CONFIG_STACK_ALIGNMENT 8
/* The symbol __ARM_EABI__ is defined by GCC if EABI is being used. If you
* are not using GCC, make sure that CONFIG_STACK_ALIGNMENT is set correctly!
*/
# ifdef __ARM_EABI__
# define CONFIG_STACK_ALIGNMENT 8
# else
# define CONFIG_STACK_ALIGNMENT 4
# endif
#endif
/* Stack alignment macros */ /* Stack alignment macros */
@ -233,9 +222,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4; top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
/* The ARM stack must be aligned; 4 byte alignment for OABI and /* The ARM stack must be aligned to 8-byte alignment for EABI.
* 8-byte alignment for EABI. If necessary top_of_stack must be * If necessary top_of_stack must be rounded down to the next
* rounded down to the next boundary * boundary
*/ */
top_of_stack = STACK_ALIGN_DOWN(top_of_stack); top_of_stack = STACK_ALIGN_DOWN(top_of_stack);

View File

@ -53,22 +53,11 @@
* Pre-processor Macros * Pre-processor Macros
****************************************************************************/ ****************************************************************************/
/* ARM requires at least a 4-byte stack alignment. For use with EABI and /* For use with EABI and floating point, the stack must be aligned to 8-byte
* floating point, the stack must be aligned to 8-byte addresses. * addresses.
*/ */
#ifndef CONFIG_STACK_ALIGNMENT #define CONFIG_STACK_ALIGNMENT 8
/* The symbol __ARM_EABI__ is defined by GCC if EABI is being used. If you
* are not using GCC, make sure that CONFIG_STACK_ALIGNMENT is set correctly!
*/
# ifdef __ARM_EABI__
# define CONFIG_STACK_ALIGNMENT 8
# else
# define CONFIG_STACK_ALIGNMENT 4
# endif
#endif
/* Stack alignment macros */ /* Stack alignment macros */

View File

@ -56,22 +56,11 @@
* Pre-processor Macros * Pre-processor Macros
****************************************************************************/ ****************************************************************************/
/* ARM requires at least a 4-byte stack alignment. For use with EABI and /* For use with EABI and floating point, the stack must be aligned to 8-byte
* floating point, the stack must be aligned to 8-byte addresses. * addresses.
*/ */
#ifndef CONFIG_STACK_ALIGNMENT #define CONFIG_STACK_ALIGNMENT 8
/* The symbol __ARM_EABI__ is defined by GCC if EABI is being used. If you
* are not using GCC, make sure that CONFIG_STACK_ALIGNMENT is set correctly!
*/
# ifdef __ARM_EABI__
# define CONFIG_STACK_ALIGNMENT 8
# else
# define CONFIG_STACK_ALIGNMENT 4
# endif
#endif
/* Stack alignment macros */ /* Stack alignment macros */
@ -143,9 +132,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4; top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
/* The ARM stack must be aligned; 4 byte alignment for OABI and 8-byte /* The ARM stack must be aligned to 8-byte alignment for EABI.
* alignment for EABI. If necessary top_of_stack must be rounded down * If necessary top_of_stack must be rounded down to the next
* to the next boundary * boundary
*/ */
top_of_stack = STACK_ALIGN_DOWN(top_of_stack); top_of_stack = STACK_ALIGN_DOWN(top_of_stack);

View File

@ -56,22 +56,11 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* ARM requires at least a 4-byte stack alignment. For use with EABI and /* For use with EABI and floating point, the stack must be aligned to 8-byte
* floating point, the stack must be aligned to 8-byte addresses. * addresses.
*/ */
#ifndef CONFIG_STACK_ALIGNMENT #define CONFIG_STACK_ALIGNMENT 8
/* The symbol __ARM_EABI__ is defined by GCC if EABI is being used. If you
* are not using GCC, make sure that CONFIG_STACK_ALIGNMENT is set correctly!
*/
# ifdef __ARM_EABI__
# define CONFIG_STACK_ALIGNMENT 8
# else
# define CONFIG_STACK_ALIGNMENT 4
# endif
#endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions

View File

@ -319,16 +319,6 @@ void up_irqinitialize(void)
putreg32(0xffffffff, NVIC_IRQ_CLEAR(i)); putreg32(0xffffffff, NVIC_IRQ_CLEAR(i));
} }
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
/* Colorize the interrupt stack for debug purposes */
{
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
intstack_size);
}
#endif
/* Make sure that we are using the correct vector table. The default /* Make sure that we are using the correct vector table. The default
* vector address is 0x0000:0000 but if we are executing code that is * vector address is 0x0000:0000 but if we are executing code that is
* positioned in SRAM or in external FLASH, then we may need to reset * positioned in SRAM or in external FLASH, then we may need to reset

View File

@ -93,16 +93,6 @@ void up_irqinitialize(void)
* access to the GIC. * access to the GIC.
*/ */
/* Colorize the interrupt stack for debug purposes */
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
{
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
intstack_size);
}
#endif
/* Initialize the Generic Interrupt Controller (GIC) for CPU0 */ /* Initialize the Generic Interrupt Controller (GIC) for CPU0 */
arm_gic0_initialize(); /* Initialization unique to CPU0 */ arm_gic0_initialize(); /* Initialization unique to CPU0 */

View File

@ -385,16 +385,6 @@ void up_irqinitialize(void)
putreg32(0, regaddr); putreg32(0, regaddr);
} }
/* Colorize the interrupt stack for debug purposes */
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
{
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
intstack_size);
}
#endif
/* Make sure that we are using the correct vector table. The default /* Make sure that we are using the correct vector table. The default
* vector address is 0x0000:0000 but if we are executing code that is * vector address is 0x0000:0000 but if we are executing code that is
* positioned in SRAM or in external FLASH, then we may need to reset * positioned in SRAM or in external FLASH, then we may need to reset

View File

@ -431,16 +431,6 @@ void up_irqinitialize(void)
* access to the AIC. * access to the AIC.
*/ */
/* Colorize the interrupt stack for debug purposes */
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
{
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
intstack_size);
}
#endif
/* Redirect all interrupts to the AIC if so configured */ /* Redirect all interrupts to the AIC if so configured */
sam_aic_redirection(); sam_aic_redirection();

View File

@ -381,16 +381,6 @@ void up_irqinitialize(void)
putreg32(0, regaddr); putreg32(0, regaddr);
} }
/* Colorize the interrupt stack for debug purposes */
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
{
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
intstack_size);
}
#endif
/* Make sure that we are using the correct vector table. The default /* Make sure that we are using the correct vector table. The default
* vector address is 0x0000:0000 but if we are executing code that is * vector address is 0x0000:0000 but if we are executing code that is
* positioned in SRAM or in external FLASH, then we may need to reset * positioned in SRAM or in external FLASH, then we may need to reset

View File

@ -310,16 +310,6 @@ void up_irqinitialize(void)
putreg32(0xffffffff, NVIC_IRQ_CLEAR(i)); putreg32(0xffffffff, NVIC_IRQ_CLEAR(i));
} }
/* Colorize the interrupt stack for debug purposes */
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
{
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
intstack_size);
}
#endif
/* The standard location for the vector table is at the beginning of FLASH /* The standard location for the vector table is at the beginning of FLASH
* at address 0x0800:0000. If we are using the STMicro DFU bootloader, then * at address 0x0800:0000. If we are using the STMicro DFU bootloader, then
* the vector table will be offset to a different location in FLASH and we * the vector table will be offset to a different location in FLASH and we

View File

@ -415,16 +415,6 @@ void up_irqinitialize(void)
putreg32(0, regaddr); putreg32(0, regaddr);
} }
/* Colorize the interrupt stack for debug purposes */
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
{
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
intstack_size);
}
#endif
/* Make sure that we are using the correct vector table. The default /* Make sure that we are using the correct vector table. The default
* vector address is 0x0000:0000 but if we are executing code that is * vector address is 0x0000:0000 but if we are executing code that is
* positioned in SRAM or in external FLASH, then we may need to reset * positioned in SRAM or in external FLASH, then we may need to reset

View File

@ -304,16 +304,6 @@ void up_irqinitialize(void)
putreg32(0xffffffff, NVIC_IRQ_CLEAR(i)); putreg32(0xffffffff, NVIC_IRQ_CLEAR(i));
} }
/* Colorize the interrupt stack for debug purposes */
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
{
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
intstack_size);
}
#endif
/* The standard location for the vector table is at the beginning of FLASH /* The standard location for the vector table is at the beginning of FLASH
* at address 0x0800:0000. If we are using the STMicro DFU bootloader, then * at address 0x0800:0000. If we are using the STMicro DFU bootloader, then
* the vector table will be offset to a different location in FLASH and we * the vector table will be offset to a different location in FLASH and we

View File

@ -115,14 +115,6 @@ void up_irqinitialize(void)
FAR uintptr_t *vimram; FAR uintptr_t *vimram;
int i; int i;
/* Colorize the interrupt stack for debug purposes */
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
intstack_size);
#endif
/* Initialize VIM RAM vectors. These vectors are not used in the current /* Initialize VIM RAM vectors. These vectors are not used in the current
* interrupt handler logic. * interrupt handler logic.
*/ */

View File

@ -221,7 +221,7 @@ static uint8_t fifoget(struct nrf24l01_dev_s *dev, FAR uint8_t *buffer,
static void nrf24l01_worker(FAR void *arg); static void nrf24l01_worker(FAR void *arg);
#endif #endif
#ifdef NRF24L01_DEBUG #ifdef CONFIG_DEBUG_WIRELESS
static void binarycvt(char *deststr, const uint8_t *srcbin, size_t srclen) static void binarycvt(char *deststr, const uint8_t *srcbin, size_t srclen)
#endif #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; FAR struct nrf24l01_dev_s *dev = (FAR struct nrf24l01_dev_s *)arg;
winfo("*IRQ*\n"); wlinfo("*IRQ*\n");
#ifdef CONFIG_WL_NRF24L01_RXSUPPORT #ifdef CONFIG_WL_NRF24L01_RXSUPPORT
/* If RX is enabled we delegate the actual work to bottom-half handler */ /* 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; bool has_data = false;
#endif #endif
winfo("RX_DR is set!\n"); wlinfo("RX_DR is set!\n");
/* Read and store all received payloads */ /* 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; pipeno = (status & NRF24L01_RX_P_NO_MASK) >> NRF24L01_RX_P_NO_SHIFT;
if (pipeno >= NRF24L01_PIPE_COUNT) /* 6=invalid 7=fifo empty */ 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); nrf24l01_flush_rx(dev);
break; break;
} }
@ -703,7 +703,7 @@ static void nrf24l01_worker(FAR void *arg)
if (pktlen > NRF24L01_MAX_PAYLOAD_LEN) /* bad length */ 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); nrf24l01_flush_rx(dev);
break; break;
} }
@ -720,8 +720,8 @@ static void nrf24l01_worker(FAR void *arg)
status = nrf24l01_readreg(dev, NRF24L01_FIFO_STATUS, &fifo_status, 1); status = nrf24l01_readreg(dev, NRF24L01_FIFO_STATUS, &fifo_status, 1);
winfo("FIFO_STATUS=%02x\n", fifo_status); wlinfo("FIFO_STATUS=%02x\n", fifo_status);
winfo("STATUS=%02x\n", status); wlinfo("STATUS=%02x\n", status);
} }
while ((fifo_status & NRF24L01_RX_EMPTY) == 0); 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 */ 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); sem_post(dev->pfd->sem);
} }
#endif #endif
@ -758,7 +758,7 @@ static void nrf24l01_worker(FAR void *arg)
} }
else 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) if (result < 0)
{ {
werr("wait for irq failed\n"); wlerr("wait for irq failed\n");
nrf24l01_flush_tx(dev); nrf24l01_flush_tx(dev);
goto out; 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) dev->lastxmitcount = (obsvalue & NRF24L01_ARC_CNT_MASK)
>> NRF24L01_ARC_CNT_SHIFT; >> 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) else if (status & NRF24L01_MAX_RT)
{ {
winfo("MAX_RT! (lastxmitcount=%d)\n", dev->lastxmitcount); wlinfo("MAX_RT! (lastxmitcount=%d)\n", dev->lastxmitcount);
result = -ECOMM; result = -ECOMM;
dev->lastxmitcount = NRF24L01_XMIT_MAXRT; dev->lastxmitcount = NRF24L01_XMIT_MAXRT;
@ -906,7 +906,7 @@ static int dosend(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data,
{ {
/* Unexpected... */ /* 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; result = -EIO;
} }
@ -930,7 +930,7 @@ out:
* Name: binarycvt * Name: binarycvt
****************************************************************************/ ****************************************************************************/
#ifdef NRF24L01_DEBUG #ifdef CONFIG_DEBUG_WIRELESS
static void binarycvt(char *deststr, const uint8_t *srcbin, size_t srclen) static void binarycvt(char *deststr, const uint8_t *srcbin, size_t srclen)
{ {
int i = 0; int i = 0;
@ -958,7 +958,7 @@ static int nrf24l01_open(FAR struct file *filep)
FAR struct nrf24l01_dev_s *dev; FAR struct nrf24l01_dev_s *dev;
int result; int result;
winfo("Opening nRF24L01 dev\n"); wlinfo("Opening nRF24L01 dev\n");
DEBUGASSERT(filep); DEBUGASSERT(filep);
inode = filep->f_inode; inode = filep->f_inode;
@ -1004,7 +1004,7 @@ static int nrf24l01_close(FAR struct file *filep)
FAR struct inode *inode; FAR struct inode *inode;
FAR struct nrf24l01_dev_s *dev; FAR struct nrf24l01_dev_s *dev;
winfo("Closing nRF24L01 dev\n"); wlinfo("Closing nRF24L01 dev\n");
DEBUGASSERT(filep); DEBUGASSERT(filep);
inode = filep->f_inode; 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; FAR struct nrf24l01_dev_s *dev;
int result = OK; int result = OK;
winfo("cmd: %d arg: %ld\n", cmd, arg); wlinfo("cmd: %d arg: %ld\n", cmd, arg);
DEBUGASSERT(filep); DEBUGASSERT(filep);
inode = filep->f_inode; 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; FAR struct nrf24l01_dev_s *dev;
int result = OK; int result = OK;
winfo("setup: %d\n", (int)setup); wlinfo("setup: %d\n", (int)setup);
DEBUGASSERT(filep && fds); DEBUGASSERT(filep && fds);
inode = filep->f_inode; inode = filep->f_inode;
@ -1501,12 +1501,12 @@ int nrf24l01_register(FAR struct spi_dev_s *spi,
/* Register the device as an input device */ /* 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); result = register_driver(DEV_NAME, &nrf24l01_fops, 0666, dev);
if (result < 0) if (result < 0)
{ {
werr("ERROR: register_driver() failed: %d\n", result); wlerr("ERROR: register_driver() failed: %d\n", result);
nrf24l01_unregister(dev); 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))) 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_writereg(dev, NRF24L01_RX_ADDR_P0, destaddr,
NRF24L01_MAX_ADDR_LEN); NRF24L01_MAX_ADDR_LEN);
pipeaddrchg = true; 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_writereg(dev, NRF24L01_RX_ADDR_P0, dev->pipe0addr,
NRF24L01_MAX_ADDR_LEN); NRF24L01_MAX_ADDR_LEN);
winfo("Pipe #0 default addr restored\n"); wlinfo("Pipe #0 default addr restored\n");
} }
nrf24l01_unlock(dev->spi); nrf24l01_unlock(dev->spi);
@ -2045,7 +2045,7 @@ ssize_t nrf24l01_recv(struct nrf24l01_dev_s *dev, uint8_t *buffer,
* Name: nrf24l01_dumpregs * Name: nrf24l01_dumpregs
****************************************************************************/ ****************************************************************************/
#ifdef NRF24L01_DEBUG #ifdef CONFIG_DEBUG_WIRELESS
void nrf24l01_dumpregs(struct nrf24l01_dev_s *dev) void nrf24l01_dumpregs(struct nrf24l01_dev_s *dev)
{ {
uint8_t addr[NRF24L01_MAX_ADDR_LEN]; 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", syslog(LOG_INFO, "FEATURE: %02x\n",
nrf24l01_readregbyte(dev, NRF24L01_FEATURE)); nrf24l01_readregbyte(dev, NRF24L01_FEATURE));
} }
#endif /* NRF24L01_DEBUG */ #endif /* CONFIG_DEBUG_WIRELESS */
/**************************************************************************** /****************************************************************************
* Name: nrf24l01_dumprxfifo * 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) void nrf24l01_dumprxfifo(struct nrf24l01_dev_s *dev)
{ {
syslog(LOG_INFO, "bytes count: %d\n", dev->fifo_len); syslog(LOG_INFO, "bytes count: %d\n", dev->fifo_len);
syslog(LOG_INFO, "next read: %d, next write: %d\n", syslog(LOG_INFO, "next read: %d, next write: %d\n",
dev->nxt_read, dev-> nxt_write); dev->nxt_read, dev-> nxt_write);
} }
#endif /* NRF24L01_DEBUG && CONFIG_WL_NRF24L01_RXSUPPORT */ #endif /* CONFIG_DEBUG_WIRELESS && CONFIG_WL_NRF24L01_RXSUPPORT */

View File

@ -233,6 +233,24 @@
# define ninfo(x...) # define ninfo(x...)
#endif #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 #ifdef CONFIG_DEBUG_FS_ERROR
# define ferr(format, ...) _err(format, ##__VA_ARGS__) # define ferr(format, ...) _err(format, ##__VA_ARGS__)
#else #else
@ -777,6 +795,24 @@
# define ninfo (void) # define ninfo (void)
#endif #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 #ifdef CONFIG_DEBUG_FS_ERROR
# define ferr _err # define ferr _err
#else #else
@ -1267,6 +1303,14 @@
# define ninfodumpbuffer(m,b,n) # define ninfodumpbuffer(m,b,n)
#endif #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 #ifdef CONFIG_DEBUG_FS
# define ferrdumpbuffer(m,b,n) errdumpbuffer(m,b,n) # define ferrdumpbuffer(m,b,n) errdumpbuffer(m,b,n)
# define finfodumpbuffer(m,b,n) infodumpbuffer(m,b,n) # define finfodumpbuffer(m,b,n) infodumpbuffer(m,b,n)

View File

@ -85,7 +85,7 @@
#define _I2CBASE (0x2000) /* I2C driver commands */ #define _I2CBASE (0x2000) /* I2C driver commands */
#define _SPIBASE (0x2100) /* SPI driver commands */ #define _SPIBASE (0x2100) /* SPI driver commands */
#define _GPIOBASE (0x2200) /* GPIO driver commands */ #define _GPIOBASE (0x2200) /* GPIO driver commands */
#define _CLIOCBASE (0x1200) /* Contactless modules ioctl commands */ #define _CLIOCBASE (0x2300) /* Contactless modules ioctl commands */
/* boardctl() commands share the same number space */ /* boardctl() commands share the same number space */

View File

@ -64,8 +64,6 @@
#define NRF24L01_DYN_LENGTH 33 /* Specific length value to use to enable dynamic packet length */ #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_XMIT_MAXRT 255 /* Specific value returned by Number of available pipes */
/* #define NRF24L01_DEBUG 1 */
/* IOCTL commands */ /* IOCTL commands */
#define NRF24L01IOC_SETRETRCFG _WLIOC(NRF24L01_FIRST+0) /* arg: Pointer to nrf24l01_retrcfg_t structure */ #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_SETTXADDR WLIOC_SETADDR
#define NRF24L01IOC_GETTXADDR WLIOC_GETADDR #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 * Public Data Types
****************************************************************************/ ****************************************************************************/
@ -505,12 +493,9 @@ ssize_t nrf24l01_recv(struct nrf24l01_dev_s *dev, uint8_t *buffer,
#endif #endif
#ifdef NRF24L01_DEBUG #ifdef CONFIG_DEBUG_WIRELESS
void nrf24l01_dumpregs(FAR struct nrf24l01_dev_s *dev); void nrf24l01_dumpregs(FAR struct nrf24l01_dev_s *dev);
void nrf24l01_dumprxfifo(FAR struct nrf24l01_dev_s *dev); void nrf24l01_dumprxfifo(FAR struct nrf24l01_dev_s *dev);
#endif #endif
#undef EXTERN #undef EXTERN

View File

@ -110,6 +110,11 @@ static void lpwork_boostworker(pid_t wpid, uint8_t reqprio)
wtcb->pend_reprios[wtcb->npend_reprio] = wtcb->sched_priority; wtcb->pend_reprios[wtcb->npend_reprio] = wtcb->sched_priority;
wtcb->npend_reprio++; wtcb->npend_reprio++;
} }
else
{
serr("ERROR: CONFIG_SEM_NNESTPRIO exceeded\n");
DEBUGASSERT(wtcb->npend_reprio < CONFIG_SEM_NNESTPRIO);
}
} }
/* Raise the priority of the worker. This cannot cause a context /* Raise the priority of the worker. This cannot cause a context
@ -129,8 +134,16 @@ static void lpwork_boostworker(pid_t wpid, uint8_t reqprio)
* saved priority and not to the base priority. * saved priority and not to the base priority.
*/ */
wtcb->pend_reprios[wtcb->npend_reprio] = reqprio; if (wtcb->npend_reprio < CONFIG_SEM_NNESTPRIO)
wtcb->npend_reprio++; {
wtcb->pend_reprios[wtcb->npend_reprio] = reqprio;
wtcb->npend_reprio++;
}
else
{
serr("ERROR: CONFIG_SEM_NNESTPRIO exceeded\n");
DEBUGASSERT(wtcb->npend_reprio < CONFIG_SEM_NNESTPRIO);
}
} }
} }
#else #else