Merged in masayuki2009/nuttx.nuttx/lc823450_bt (pull request #657)

lc823450 bt

* arch/arm/src/lc823450: Fix H/W flow control in lc823450_serial.c

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

* configs/lc823450-xgevk: Add lc823450-xgevk/bt configuration

    NOTE: This configuration requires external bluetooth stack.

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: GregoryN <gnutt@nuttx.org>
This commit is contained in:
Masayuki Ishikawa 2018-06-13 12:50:12 +00:00 committed by GregoryN
parent 2f921fbe8e
commit a7a258e05e
5 changed files with 294 additions and 8 deletions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/lc823450/lc823450_serial.c
*
* Copyright 2014,2015,2016,2017 Sony Video & Sound Products Inc.
* Copyright 2014,2015,2016,2017,2018 Sony Video & Sound Products Inc.
* Author: Masatoshi Tateishi <Masatoshi.Tateishi@jp.sony.com>
* Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
*
@ -176,13 +176,13 @@ struct up_dev_s
uint8_t irq; /* IRQ associated with this UART */
uint8_t parity; /* 0=none, 1=odd, 2=even */
uint8_t bits; /* Number of bits (7 or 8) */
uint8_t cts;
uint8_t rts;
bool stopbits2; /* true: Configure with 2 stop bits instead of 1 */
uint32_t rowe; /* receive register over write error */
uint32_t pe; /* parity error */
uint32_t fe; /* framing error */
uint32_t rxowe; /* RX FIFO over write error */
bool iflow; /* input flow control (RTS) enabled */
bool oflow; /* output flow control (CTS) enabled */
#ifdef CONFIG_HSUART
DMA_HANDLE hrxdma;
DMA_HANDLE htxdma;
@ -538,7 +538,7 @@ static int up_setup(struct uart_dev_s *dev)
ctl |= UART_UMD_STL;
}
if (priv->cts)
if (priv->oflow)
{
ctl |= UART_UMD_CTSEN;
}
@ -547,7 +547,7 @@ static int up_setup(struct uart_dev_s *dev)
ctl &= ~UART_UMD_CTSEN;
}
if (priv->rts)
if (priv->iflow)
{
ctl |= UART_UMD_RTSEN;
}
@ -782,7 +782,6 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
#endif
CS8;
/* TODO: CCTS_IFLOW, CCTS_OFLOW */
}
break;
@ -809,10 +808,10 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
priv->stopbits2 = (termiosp->c_cflag & CSTOPB) != 0;
#ifdef CONFIG_SERIAL_OFLOWCONTROL
priv->cts = (termiosp->c_cflag & CCTS_OFLOW) != 0;
priv->oflow = (termiosp->c_cflag & CCTS_OFLOW) != 0;
#endif
#ifdef CONFIG_SERIAL_IFLOWCONTROL
priv->rts = (termiosp->c_cflag & CRTS_IFLOW) != 0;
priv->iflow = (termiosp->c_cflag & CRTS_IFLOW) != 0;
#endif
/* Note that since there is no way to request 9-bit mode

View File

@ -4,4 +4,9 @@
#
if ARCH_BOARD_LC823450_XGEVK
config LC823450_XGEVK_BTPOWER
bool "Enable bluetooth power control on lc823450-xgevk"
default n
endif

View File

@ -0,0 +1,198 @@
# CONFIG_AUDIO_FORMAT_MP3 is not set
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NX_DISABLE_1BPP is not set
# CONFIG_SPI_EXCHANGE is not set
CONFIG_AQM_1248A=y
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="lc823450-xgevk"
CONFIG_ARCH_BOARD_LC823450_XGEVK=y
CONFIG_ARCH_CHIP_LC823450=y
CONFIG_ARCH_FLOAT_H=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_STDARG_H=y
CONFIG_ARMV7M_MEMCPY=y
CONFIG_AUDIO=y
CONFIG_AUDIO_BUFFER_NUMBYTES=1024
CONFIG_AUDIO_EXCLUDE_BALANCE=y
CONFIG_AUDIO_EXCLUDE_FFORWARD=y
CONFIG_AUDIO_EXCLUDE_TONE=y
CONFIG_AUDIO_WM8776=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARDCTL_USBDEVCTRL=y
CONFIG_BOARD_LOOPSPERMSEC=12061
CONFIG_BUILTIN=y
CONFIG_C99_BOOL8=y
CONFIG_CODECS_HASH_MD5=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_ERROR=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_NET=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEBUG_WARN=y
CONFIG_DEV_ZERO=y
CONFIG_DISABLE_POSIX_TIMERS=y
CONFIG_DRIVERS_AUDIO=y
CONFIG_DVFS=y
CONFIG_EXAMPLES_BTSTACK=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_EXAMPLES_NSH=y
CONFIG_EXAMPLES_NXHELLO=y
CONFIG_EXAMPLES_NXHELLO_BPP=1
CONFIG_EXAMPLES_OSTEST=y
CONFIG_EXAMPLES_PIPE=y
CONFIG_EXPERIMENTAL=y
CONFIG_FAT_LCNAMES=y
CONFIG_FAT_LFN=y
CONFIG_FS_FAT=y
CONFIG_FS_FATTIME=y
CONFIG_FS_PROCFS=y
CONFIG_FS_PROCFS_REGISTER=y
CONFIG_HRT_TIMER=y
CONFIG_I2C=y
CONFIG_I2CTOOL_MAXBUS=1
CONFIG_I2C_RESET=y
CONFIG_I2S=y
CONFIG_INTELHEX_BINARY=y
CONFIG_IOB_BUFSIZE=192
CONFIG_IOB_NBUFFERS=256
CONFIG_LC823450_I2C0=y
CONFIG_LC823450_I2C1=y
CONFIG_LC823450_I2S0=y
CONFIG_LC823450_MTD=y
CONFIG_LC823450_MTM0_TICK=y
CONFIG_LC823450_SDIF_SDC=y
CONFIG_LC823450_SPI_DMA=y
CONFIG_LC823450_UART0=y
CONFIG_LC823450_UART1=y
CONFIG_LC823450_XGEVK_BTPOWER=y
CONFIG_LCD=y
CONFIG_LCD_ST7565=y
CONFIG_LIBC_IOCTL_VARIADIC=y
CONFIG_LIBM=y
CONFIG_LIB_KBDCODEC=y
CONFIG_MAX_TASKS=64
CONFIG_MAX_WDOGPARMS=2
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_MTD=y
CONFIG_NAME_MAX=765
CONFIG_NET=y
CONFIG_NETDB_DNSCLIENT=y
CONFIG_NETDB_DNSCLIENT_MAXRESPONSE=176
CONFIG_NETDEVICES=y
CONFIG_NETUTILS_CODECS=y
CONFIG_NETUTILS_PING=y
CONFIG_NETUTILS_TELNETD=y
CONFIG_NETUTILS_WEBCLIENT=y
CONFIG_NET_ARP_SEND=y
CONFIG_NET_BROADCAST=y
CONFIG_NET_ETH_MTU=1500
CONFIG_NET_ETH_TCP_RECVWNDO=8400
CONFIG_NET_ICMP=y
CONFIG_NET_ICMP_SOCKET=y
CONFIG_NET_LOOPBACK=y
CONFIG_NET_PKT=y
CONFIG_NET_ROUTE=y
CONFIG_NET_SOCKOPTS=y
CONFIG_NET_STATISTICS=y
CONFIG_NET_TCP=y
CONFIG_NET_TCP_KEEPALIVE=y
CONFIG_NET_TCP_RWND_CONTROL=y
CONFIG_NET_TUN=y
CONFIG_NET_TUN_MTU=1500
CONFIG_NET_TUN_TCP_RECVWNDO=8400
CONFIG_NET_UDP=y
CONFIG_NFILE_DESCRIPTORS=45
CONFIG_NFILE_STREAMS=8
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_CMDOPT_DD_STATS=y
CONFIG_NSH_DISABLE_BASENAME=y
CONFIG_NSH_DISABLE_DIRNAME=y
CONFIG_NSH_DISABLE_EXEC=y
CONFIG_NSH_DISABLE_GET=y
CONFIG_NSH_DISABLE_LOSETUP=y
CONFIG_NSH_DISABLE_MB=y
CONFIG_NSH_DISABLE_MH=y
CONFIG_NSH_DISABLE_MKFIFO=y
CONFIG_NSH_DISABLE_MKRD=y
CONFIG_NSH_DISABLE_PUT=y
CONFIG_NSH_DISABLE_SH=y
CONFIG_NSH_DISABLE_XD=y
CONFIG_NSH_DRIPADDR=0xa9feab5a
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_LINELEN=128
CONFIG_NSH_MACADDR=0x00e0deadbeff
CONFIG_NSH_MAXARGUMENTS=10
CONFIG_NSH_NETINIT_THREAD=y
CONFIG_NSH_NETMASK=0xffff0000
CONFIG_NSH_NOMAC=y
CONFIG_NSH_READLINE=y
CONFIG_NSH_WGET_USERAGENT="NuttX/7.2x.x (; http://www.nuttx.org/)"
CONFIG_NX=y
CONFIG_NXFONT_MONO5X8=y
CONFIG_NXPLAYER_DEFAULT_MEDIADIR="/mnt/sd1"
CONFIG_NXPLAYER_HTTP_STREAMING_SUPPORT=y
CONFIG_NX_BLOCKING=y
CONFIG_PIPES=y
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=2048
CONFIG_PREALLOC_MQ_MSGS=4
CONFIG_PREALLOC_TIMERS=4
CONFIG_PREALLOC_WDOGS=16
CONFIG_PTHREAD_MUTEX_TYPES=y
CONFIG_PTHREAD_STACK_DEFAULT=3072
CONFIG_RAM_SIZE=1044480
CONFIG_RAM_START=0x02001000
CONFIG_RAW_BINARY=y
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RTC=y
CONFIG_RTC_HIRES=y
CONFIG_SCHED_ATEXIT=y
CONFIG_SCHED_CHILD_STATUS=y
CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_HPWORKPERIOD=50000
CONFIG_SCHED_HPWORKPRIORITY=192
CONFIG_SCHED_INSTRUMENTATION=y
CONFIG_SCHED_INSTRUMENTATION_BUFFER=y
CONFIG_SCHED_INSTRUMENTATION_PREEMPTION=y
CONFIG_SCHED_LPWORK=y
CONFIG_SCHED_LPWORKPRIORITY=60
CONFIG_SCHED_ONEXIT=y
CONFIG_SCHED_ONEXIT_MAX=32
CONFIG_SCHED_STARTHOOK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_SENSORS=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_SPI=y
CONFIG_START_DAY=3
CONFIG_START_MONTH=10
CONFIG_START_YEAR=2013
CONFIG_SYSLOG_TIMESTAMP=y
CONFIG_SYSLOG_TIMESTAMP_REALTIME=y
CONFIG_SYSTEM_DHCPC_RENEW=y
CONFIG_SYSTEM_I2CTOOL=y
CONFIG_SYSTEM_NXPLAYER=y
CONFIG_SYSTEM_PING=y
CONFIG_SYSTEM_TIME64=y
CONFIG_TASK_NAME_SIZE=24
CONFIG_TELNET_CHARACTER_MODE=y
CONFIG_TUN_LPWORK=y
CONFIG_UART0_RXBUFSIZE=512
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_UART0_TXBUFSIZE=2048
CONFIG_UART1_IFLOWCONTROL=y
CONFIG_UART1_OFLOWCONTROL=y
CONFIG_UART1_PARITY=2
CONFIG_UART1_RXBUFSIZE=5120
CONFIG_UART1_TXBUFSIZE=1024
CONFIG_USBDEV=y
CONFIG_USBDEV_BUSPOWERED=y
CONFIG_USBDEV_DUALSPEED=y
CONFIG_USBDEV_MAXPOWER=500
CONFIG_USERMAIN_STACKSIZE=3072
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_WM8776_SWAP_HPOUT=y

View File

@ -80,4 +80,8 @@ ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += lc823450_autoleds.c
endif
ifeq ($(CONFIG_LC823450_XGEVK_BTPOWER),y)
CSRCS += lc823450_bt.c
endif
include $(TOPDIR)/configs/Board.mk

View File

@ -0,0 +1,80 @@
/****************************************************************************
* configs/lc823450-xgevk/src/lc823450_bt.c
*
* Copyright 2018 Sony Video & Sound Products Inc.
* Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include <unistd.h>
#include "chip.h"
#include "up_arch.h"
#include "up_internal.h"
#include "lc823450_gpio.h"
#include "lc823450-xgevk.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define BT_POWER (GPIO_PORT1 | GPIO_PIN7)
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_bt_enable
****************************************************************************/
void up_bt_enable(int enable)
{
if (enable)
{
lc823450_gpio_write(BT_POWER, 0);
usleep(100 * 1000);
lc823450_gpio_write(BT_POWER, 1);
usleep(100 * 1000);
}
else
{
lc823450_gpio_write(BT_POWER, 0);
}
}