Merge remote-tracking branch 'origin/master' into xmc4

This commit is contained in:
Gregory Nutt 2017-03-18 06:48:37 -06:00
commit 3f0c4871c8
32 changed files with 2620 additions and 243 deletions

32
Kconfig
View File

@ -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

View File

@ -164,7 +164,7 @@ config ARCH_CHIP_NUC1XX
select ARCH_CORTEXM0
select ARCH_HAVE_CMNVECTOR
---help---
NPX LPC43XX architectures (ARM Cortex-M4).
Nuvoton NUC100/120 architectures (ARM Cortex-M0).
config ARCH_CHIP_SAMA5
bool "Atmel SAMA5"

View File

@ -159,16 +159,6 @@ void up_irqinitialize(void)
(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
* interrupts.
*/

View File

@ -66,22 +66,11 @@
# define HAVE_KERNEL_HEAP 1
#endif
/* ARM requires at least a 4-byte stack alignment. For use with EABI and
* floating point, the stack must be aligned to 8-byte addresses.
/* For use with EABI and floating point, the stack must be aligned to 8-byte
* addresses.
*/
#ifndef CONFIG_STACK_ALIGNMENT
/* 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
#define CONFIG_STACK_ALIGNMENT 8
/* 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;
/* The ARM stack must be aligned; 4 byte alignment for OABI and
* 8-byte alignment for EABI. If necessary top_of_stack must be
* rounded down to the next boundary
/* The ARM stack must be aligned to 8-byte alignment for EABI.
* If necessary top_of_stack must be rounded down to the next
* boundary
*/
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);

View File

@ -100,7 +100,7 @@ static void up_calibratedelay(void)
*
****************************************************************************/
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 7
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
static inline void up_color_intstack(void)
{
uint32_t *ptr = (uint32_t *)&g_intstackalloc;

View File

@ -53,22 +53,11 @@
* Pre-processor Macros
****************************************************************************/
/* ARM requires at least a 4-byte stack alignment. For use with EABI and
* floating point, the stack must be aligned to 8-byte addresses.
/* For use with EABI and floating point, the stack must be aligned to 8-byte
* addresses.
*/
#ifndef CONFIG_STACK_ALIGNMENT
/* 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
#define CONFIG_STACK_ALIGNMENT 8
/* Stack alignment macros */

View File

@ -56,22 +56,11 @@
* Pre-processor Macros
****************************************************************************/
/* ARM requires at least a 4-byte stack alignment. For use with EABI and
* floating point, the stack must be aligned to 8-byte addresses.
/* For use with EABI and floating point, the stack must be aligned to 8-byte
* addresses.
*/
#ifndef CONFIG_STACK_ALIGNMENT
/* 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
#define CONFIG_STACK_ALIGNMENT 8
/* 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;
/* The ARM stack must be aligned; 4 byte alignment for OABI and 8-byte
* alignment for EABI. If necessary top_of_stack must be rounded down
* to the next boundary
/* The ARM stack must be aligned to 8-byte alignment for EABI.
* If necessary top_of_stack must be rounded down to the next
* boundary
*/
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);

View File

@ -56,22 +56,11 @@
* Pre-processor Definitions
****************************************************************************/
/* ARM requires at least a 4-byte stack alignment. For use with EABI and
* floating point, the stack must be aligned to 8-byte addresses.
/* For use with EABI and floating point, the stack must be aligned to 8-byte
* addresses.
*/
#ifndef CONFIG_STACK_ALIGNMENT
/* 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
#define CONFIG_STACK_ALIGNMENT 8
/****************************************************************************
* Public Functions

View File

@ -319,16 +319,6 @@ void up_irqinitialize(void)
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
* 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

View File

@ -93,16 +93,6 @@ void up_irqinitialize(void)
* 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 */
arm_gic0_initialize(); /* Initialization unique to CPU0 */

View File

@ -385,16 +385,6 @@ void up_irqinitialize(void)
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
* 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

View File

@ -431,16 +431,6 @@ void up_irqinitialize(void)
* 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 */
sam_aic_redirection();

View File

@ -381,16 +381,6 @@ void up_irqinitialize(void)
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
* 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

View File

@ -310,16 +310,6 @@ void up_irqinitialize(void)
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
* 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

View File

@ -415,16 +415,6 @@ void up_irqinitialize(void)
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
* 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

View File

@ -304,16 +304,6 @@ void up_irqinitialize(void)
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
* 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

View File

@ -115,14 +115,6 @@ void up_irqinitialize(void)
FAR uintptr_t *vimram;
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
* interrupt handler logic.
*/

View File

@ -167,7 +167,8 @@ int stm32_usbhost_initialize(void)
{
int pid;
#if defined(CONFIG_USBHOST_HUB) || defined(CONFIG_USBHOST_MSC) || \
defined(CONFIG_USBHOST_HIDKBD) || defined(CONFIG_USBHOST_HIDMOUSE)
defined(CONFIG_USBHOST_HIDKBD) || defined(CONFIG_USBHOST_HIDMOUSE) || \
defined(CONFIG_USBHOST_XBOXCONTROLLER)
int ret;
#endif
@ -227,6 +228,16 @@ int stm32_usbhost_initialize(void)
}
#endif
#ifdef CONFIG_USBHOST_XBOXCONTROLLER
/* Initialize the HID mouse class */
ret = usbhost_xboxcontroller_init();
if (ret != OK)
{
uerr("ERROR: Failed to register the XBox Controller class\n");
}
#endif
/* Then get an instance of the USB host interface */
uinfo("Initialize USB host\n");

View File

@ -521,6 +521,38 @@ config RTL8187_PID
endif # USBHOST_RTL8187
config USBHOST_XBOXCONTROLLER
bool "Xbox Controller Support"
default n
depends on !INT_DISABLE
select INPUT
---help---
Enable support for the Xbox Controller driver.
if USBHOST_XBOXCONTROLLER
config XBOXCONTROLLER_DEFPRIO
int "Polling Thread Priority"
default 50
---help---
Priority of the polling thread. Default: 50.
config XBOXCONTROLLER_STACKSIZE
int "Polling thread stack size"
default 1024
---help---
Stack size for polling thread. Default: 1024
config XBOXCONTROLLER_NPOLLWAITERS
int "Max Number of Waiters for Poll Event"
default 2
depends on !DISABLE_POLL
---help---
If the poll() method is enabled, this defines the maximum number
of threads that can be waiting for mouse events. Default: 2.
endif # USBHOST_XBOXCONTROLLER
config USBHOST_TRACE
bool "Enable USB HCD tracing for debug"
default n

View File

@ -66,6 +66,10 @@ ifeq ($(CONFIG_USBHOST_HIDMOUSE),y)
CSRCS += usbhost_hidmouse.c
endif
ifeq ($(CONFIG_USBHOST_XBOXCONTROLLER),y)
CSRCS += usbhost_xboxcontroller.c
endif
# HCD debug/trace logic
ifeq ($(CONFIG_USBHOST_TRACE),y)

File diff suppressed because it is too large Load Diff

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);
#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 */

View File

@ -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)

View File

@ -85,7 +85,7 @@
#define _I2CBASE (0x2000) /* I2C driver commands */
#define _SPIBASE (0x2100) /* SPI 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 */

View File

@ -0,0 +1,88 @@
/************************************************************************************
* include/nuttx/input/xbox-controller.h
*
* Copyright (C) 2016 Brian Webb.
* Author: Brian Webb <webbbn@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name NuttX 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.
*
************************************************************************************/
#ifndef __INCLUDE_NUTTX_INPUT_XBOX_CONTROLLER_H
#define __INCLUDE_NUTTX_INPUT_XBOX_CONTROLLER_H
#ifdef __cplusplus
extern "C"
{
#endif
/****************************************************************************
* Public Types
****************************************************************************/
/* This type defines the button data report from the controller. */
struct xbox_controller_buttonstate_s
{
bool guide : 1;
bool sync : 1;
bool start : 1;
bool back : 1;
bool a : 1;
bool b : 1;
bool x : 1;
bool y : 1;
bool dpad_up : 1;
bool dpad_down : 1;
bool dpad_left : 1;
bool dpad_right : 1;
bool bumper_left : 1;
bool bumper_right : 1;
bool stick_click_left : 1;
bool stick_click_right : 1;
int16_t stick_left_x;
int16_t stick_left_y;
int16_t stick_right_x;
int16_t stick_right_y;
int16_t trigger_left;
int16_t trigger_right;
};
/* The supported IOCTL commands. */
enum
{
XBOX_CONTROLLER_IOCTL_RUMBLE
} xbox_controller_iotcl_cmds;
#ifdef __cplusplus
}
#endif
#endif /* __INCLUDE_NUTTX_INPUT_XBOX_CONTROLLER_H */

View File

@ -1084,6 +1084,27 @@ int usbhost_kbdinit(void);
int usbhost_mouse_init(void);
#endif
#ifdef CONFIG_USBHOST_XBOXCONTROLLER
/****************************************************************************
* Name: usbhost_xboxcontroller_init
*
* Description:
* Initialize the USB XBox controller driver. This function
* should be called be platform-specific code in order to initialize and
* register support for the USB XBox controller.
*
* Input Parameters:
* None
*
* Returned Values:
* On success this function will return zero (OK); A negated errno value
* will be returned on failure.
*
****************************************************************************/
int usbhost_xboxcontroller_init(void);
#endif
/****************************************************************************
* Name: usbhost_wlaninit
*

View File

@ -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

View File

@ -1171,9 +1171,7 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const IPTR char *src,
FAR char *ptmp;
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
int width;
#ifdef CONFIG_LIBC_FLOATINGPOINT
int trunc;
#endif
uint8_t fmt;
#endif
uint8_t flags;
@ -1215,9 +1213,7 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const IPTR char *src,
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
fmt = FMT_RJUST;
width = 0;
#ifdef CONFIG_LIBC_FLOATINGPOINT
trunc = 0;
#endif
#endif
/* Process each format qualifier. */
@ -1265,10 +1261,8 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const IPTR char *src,
int value = va_arg(ap, int);
if (IS_HASDOT(flags))
{
#ifdef CONFIG_LIBC_FLOATINGPOINT
trunc = value;
SET_HASASTERISKTRUNC(flags);
#endif
}
else
{
@ -1307,9 +1301,7 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const IPTR char *src,
if (IS_HASDOT(flags))
{
#ifdef CONFIG_LIBC_FLOATINGPOINT
trunc = n;
#endif
}
else
{
@ -1361,6 +1353,7 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const IPTR char *src,
{
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
int swidth;
int left;
#endif
/* Get the string to output */
@ -1375,13 +1368,21 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const IPTR char *src,
*/
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
swidth = strlen(ptmp);
swidth = (IS_HASDOT(flags) && trunc >= 0)
? strnlen(ptmp, trunc) : strlen(ptmp);
prejustify(obj, fmt, 0, width, swidth);
left = swidth;
#endif
/* Concatenate the string into the output */
while (*ptmp)
{
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
if (left-- <= 0)
{
break;
}
#endif
obj->put(obj, *ptmp);
ptmp++;
}

View File

@ -55,17 +55,38 @@
int vsnprintf(FAR char *buf, size_t size, FAR const IPTR char *format,
va_list ap)
{
struct lib_memoutstream_s memoutstream;
int n;
union
{
struct lib_outstream_s nulloutstream;
struct lib_memoutstream_s memoutstream;
} u;
/* Initialize a memory stream to write to the buffer */
FAR struct lib_outstream_s *stream;
int n;
lib_memoutstream((FAR struct lib_memoutstream_s *)&memoutstream,
buf, size);
/* "If the value of [size] is zero on a call to vsnprintf(), nothing shall
* be written, the number of bytes that would have been written had [size]
* been sufficiently large excluding the terminating null shall be returned,
* and [buf] may be a null pointer." -- opengroup.org
*/
if (size > 0)
{
/* Initialize a memory stream to write to the buffer */
lib_memoutstream(&u.memoutstream, buf, size);
stream = &u.memoutstream.public;
}
else
{
/* Use a null stream to get the size of the buffer */
lib_nulloutstream(&u.nulloutstream);
stream = &u.nulloutstream;
}
/* Then let lib_vsprintf do the real work */
n = lib_vsprintf((FAR struct lib_outstream_s *)&memoutstream.public,
format, ap);
n = lib_vsprintf(stream, format, ap);
return n;
}

View File

@ -235,6 +235,24 @@ static inline void sem_freeholder(sem_t *sem, FAR struct semholder_s *pholder)
#endif
}
/****************************************************************************
* Name: sem_findandfreeholder
****************************************************************************/
static inline void sem_findandfreeholder(sem_t *sem, FAR struct tcb_s *htcb)
{
FAR struct semholder_s *pholder = sem_findholder(sem, htcb);
/* When no more counts are held, remove the holder from the list. The
* count was decremented in sem_releaseholder.
*/
if (pholder != NULL && pholder->counts <= 0)
{
sem_freeholder(sem, pholder);
}
}
/****************************************************************************
* Name: sem_foreachholder
****************************************************************************/
@ -460,10 +478,10 @@ static int sem_dumpholder(FAR struct semholder_s *pholder, FAR sem_t *sem,
* Name: sem_restoreholderprio
****************************************************************************/
static int sem_restoreholderprio(FAR struct semholder_s *pholder,
static int sem_restoreholderprio(FAR struct tcb_s *htcb,
FAR sem_t *sem, FAR void *arg)
{
FAR struct tcb_s *htcb = (FAR struct tcb_s *)pholder->htcb;
FAR struct semholder_s *pholder = 0;
#if CONFIG_SEM_NNESTPRIO > 0
FAR struct tcb_s *stcb = (FAR struct tcb_s *)arg;
int rpriority;
@ -481,7 +499,11 @@ static int sem_restoreholderprio(FAR struct semholder_s *pholder,
{
serr("ERROR: TCB 0x%08x is a stale handle, counts lost\n", htcb);
DEBUGASSERT(!sched_verifytcb(htcb));
sem_freeholder(sem, pholder);
pholder = sem_findholder(sem, htcb);
if (pholder != NULL)
{
sem_freeholder(sem, pholder);
}
}
/* Was the priority of the holder thread boosted? If so, then drop its
@ -600,6 +622,20 @@ static int sem_restoreholderprio(FAR struct semholder_s *pholder,
return 0;
}
/****************************************************************************
* Name: sem_restoreholderprioall
*
* Description:
* Reprioritize all holders
*
****************************************************************************/
static int sem_restoreholderprioall(FAR struct semholder_s *pholder,
FAR sem_t *sem, FAR void *arg)
{
return sem_restoreholderprio(pholder->htcb, sem, arg);
}
/****************************************************************************
* Name: sem_restoreholderprioA
*
@ -614,7 +650,7 @@ static int sem_restoreholderprioA(FAR struct semholder_s *pholder,
FAR struct tcb_s *rtcb = this_task();
if (pholder->htcb != rtcb)
{
return sem_restoreholderprio(pholder, sem, arg);
return sem_restoreholderprio(pholder->htcb, sem, arg);
}
return 0;
@ -632,9 +668,22 @@ static int sem_restoreholderprioB(FAR struct semholder_s *pholder,
FAR sem_t *sem, FAR void *arg)
{
FAR struct tcb_s *rtcb = this_task();
if (pholder->htcb == rtcb)
{
(void)sem_restoreholderprio(pholder, sem, arg);
/* The running task has given up a count on the semaphore */
#if CONFIG_SEM_PREALLOCHOLDERS == 0
/* In the case where there are only 2 holders. This step
* is necessary to insure we have space. Release the holder
* if all counts have been given up. before reprioritizing
* causes a context switch.
*/
sem_findandfreeholder(sem, rtcb);
#endif
(void)sem_restoreholderprio(rtcb, sem, arg);
return 1;
}
@ -687,7 +736,7 @@ static inline void sem_restorebaseprio_irq(FAR struct tcb_s *stcb,
{
/* Drop the priority of all holder threads */
(void)sem_foreachholder(sem, sem_restoreholderprio, stcb);
(void)sem_foreachholder(sem, sem_restoreholderprioall, stcb);
}
/* If there are no tasks waiting for available counts, then all holders
@ -781,18 +830,8 @@ static inline void sem_restorebaseprio_task(FAR struct tcb_s *stcb,
* counts, then we need to remove it from the list of holders.
*/
pholder = sem_findholder(sem, rtcb);
if (pholder != NULL)
{
/* When no more counts are held, remove the holder from the list. The
* count was decremented in sem_releaseholder.
*/
sem_findandfreeholder(sem, rtcb);
if (pholder->counts <= 0)
{
sem_freeholder(sem, pholder);
}
}
}
/****************************************************************************
@ -1097,7 +1136,7 @@ void sem_canceled(FAR struct tcb_s *stcb, FAR sem_t *sem)
/* Adjust the priority of every holder as necessary */
(void)sem_foreachholder(sem, sem_restoreholderprio, stcb);
(void)sem_foreachholder(sem, sem_restoreholderprioall, stcb);
}
#endif

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->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
@ -129,8 +134,16 @@ static void lpwork_boostworker(pid_t wpid, uint8_t reqprio)
* saved priority and not to the base priority.
*/
wtcb->pend_reprios[wtcb->npend_reprio] = reqprio;
wtcb->npend_reprio++;
if (wtcb->npend_reprio < CONFIG_SEM_NNESTPRIO)
{
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

View File

@ -39,7 +39,7 @@ DELIM ?= $(strip /)
include proxies$(DELIM)Make.defs
include stubs$(DELIM)Make.defs
MKSYSCALL = "$(TOPDIR)$(DELIM)tools$(DELIM)mksyscall$(EXEEXT)"
MKSYSCALL = "$(TOPDIR)$(DELIM)tools$(DELIM)mksyscall$(HOSTEXEEXT)"
CSVFILE = "$(TOPDIR)$(DELIM)syscall$(DELIM)syscall.csv"
STUB_SRCS += syscall_funclookup.c syscall_stublookup.c syscall_nparms.c