arch/arm/src/tiva/common/tiva_hciuart.c: Port bluetooth HCI uart interface from stm32 to tiva
This commit is contained in:
parent
69940ade76
commit
4a1400dc6e
@ -416,7 +416,7 @@ config TIVA_TIMER
|
||||
bool
|
||||
default n
|
||||
|
||||
# Periperhal Selections
|
||||
# Peripheral Selections
|
||||
|
||||
config TIVA_ADC0
|
||||
bool "ADC0"
|
||||
@ -487,53 +487,387 @@ config TIVA_I2C9
|
||||
depends on TIVA_HAVE_I2C9
|
||||
select TIVA_I2C
|
||||
|
||||
config TIVA_UART0
|
||||
bool "UART0"
|
||||
config TIVA_HCIUART
|
||||
bool
|
||||
default n
|
||||
|
||||
choice
|
||||
prompt "UART0 Driver Configuration"
|
||||
default TIVA_UART0_NONE
|
||||
|
||||
config TIVA_UART0_NONE
|
||||
bool "Not selected"
|
||||
|
||||
config TIVA_UART0
|
||||
bool "Standard serial driver"
|
||||
select UART0_SERIALDRIVER
|
||||
|
||||
config TIVA_UART0_HCIUART
|
||||
bool "Bluetooth HCI-UART"
|
||||
select TIVA_HCIUART
|
||||
depends on WIRELESS_BLUETOOTH
|
||||
|
||||
endchoice # UART0 Driver Configuration
|
||||
|
||||
if TIVA_UART0_HCIUART
|
||||
config TIVA_HCIUART0_RXBUFSIZE
|
||||
int "HCI UART0 Rx buffer size"
|
||||
default 80
|
||||
---help---
|
||||
Characters are buffered as they are received. This specifies
|
||||
the size of the receive buffer. Ideally this should be at least
|
||||
the size of the largest frame that can be received
|
||||
|
||||
config TIVA_HCIUART0_TXBUFSIZE
|
||||
int "HCI UART0 Transmit buffer size"
|
||||
default 80
|
||||
---help---
|
||||
Characters are buffered before being sent. This specifies
|
||||
the size of the transmit buffer. Ideally this should be at least
|
||||
the size of the largest frame that can be sent
|
||||
|
||||
config TIVA_HCIUART0_BAUD
|
||||
int "HCI UART0 initial BAUD rate"
|
||||
default 115200
|
||||
---help---
|
||||
The configured initial BAUD of the HCI UART used during bringup.
|
||||
In most cases this initial rate can be increased by the upper half
|
||||
HCI UART driver using vendor-specifi HCI UART commands.
|
||||
|
||||
endif # TIVA_UART0_HCIUART
|
||||
|
||||
choice
|
||||
prompt "UART1 Driver Configuration"
|
||||
default TIVA_UART1_NONE
|
||||
|
||||
config TIVA_UART1_NONE
|
||||
bool "Not selected"
|
||||
|
||||
config TIVA_UART1
|
||||
bool "UART1"
|
||||
default n
|
||||
depends on TIVA_HAVE_UART1
|
||||
bool "Standard serial driver"
|
||||
select UART1_SERIALDRIVER
|
||||
|
||||
config TIVA_UART1_HCIUART
|
||||
bool "Bluetooth HCI-UART"
|
||||
select TIVA_HCIUART
|
||||
depends on WIRELESS_BLUETOOTH
|
||||
|
||||
endchoice # UART1 Driver Configuration
|
||||
|
||||
if TIVA_UART1_HCIUART
|
||||
config TIVA_HCIUART1_RXBUFSIZE
|
||||
int "HCI UART1 Rx buffer size"
|
||||
default 80
|
||||
---help---
|
||||
Characters are buffered as they are received. This specifies
|
||||
the size of the receive buffer. Ideally this should be at least
|
||||
the size of the largest frame that can be received
|
||||
|
||||
config TIVA_HCIUART1_TXBUFSIZE
|
||||
int "HCI UART1 Transmit buffer size"
|
||||
default 80
|
||||
---help---
|
||||
Characters are buffered before being sent. This specifies
|
||||
the size of the transmit buffer. Ideally this should be at least
|
||||
the size of the largest frame that can be sent
|
||||
|
||||
config TIVA_HCIUART1_BAUD
|
||||
int "HCI UART1 initial BAUD rate"
|
||||
default 115200
|
||||
---help---
|
||||
The configured initial BAUD of the HCI UART used during bringup.
|
||||
In most cases this initial rate can be increased by the upper half
|
||||
HCI UART driver using vendor-specifi HCI UART commands.
|
||||
|
||||
endif # TIVA_UART1_HCIUART
|
||||
|
||||
choice
|
||||
prompt "UART2 Driver Configuration"
|
||||
default TIVA_UART2_NONE
|
||||
|
||||
config TIVA_UART2_NONE
|
||||
bool "Not selected"
|
||||
|
||||
config TIVA_UART2
|
||||
bool "UART2"
|
||||
default n
|
||||
depends on TIVA_HAVE_UART2
|
||||
bool "Standard serial driver"
|
||||
select UART2_SERIALDRIVER
|
||||
|
||||
config TIVA_UART2_HCIUART
|
||||
bool "Bluetooth HCI-UART"
|
||||
select TIVA_HCIUART
|
||||
depends on WIRELESS_BLUETOOTH
|
||||
|
||||
endchoice # UART2 Driver Configuration
|
||||
|
||||
if TIVA_UART2_HCIUART
|
||||
config TIVA_HCIUART2_RXBUFSIZE
|
||||
int "HCI UART2 Rx buffer size"
|
||||
default 80
|
||||
---help---
|
||||
Characters are buffered as they are received. This specifies
|
||||
the size of the receive buffer. Ideally this should be at least
|
||||
the size of the largest frame that can be received
|
||||
|
||||
config TIVA_HCIUART2_TXBUFSIZE
|
||||
int "HCI UART2 Transmit buffer size"
|
||||
default 80
|
||||
---help---
|
||||
Characters are buffered before being sent. This specifies
|
||||
the size of the transmit buffer. Ideally this should be at least
|
||||
the size of the largest frame that can be sent
|
||||
|
||||
config TIVA_HCIUART2_BAUD
|
||||
int "HCI UART2 initial BAUD rate"
|
||||
default 115200
|
||||
---help---
|
||||
The configured initial BAUD of the HCI UART used during bringup.
|
||||
In most cases this initial rate can be increased by the upper half
|
||||
HCI UART driver using vendor-specifi HCI UART commands.
|
||||
|
||||
endif # TIVA_UART2_HCIUART
|
||||
|
||||
choice
|
||||
prompt "UART3 Driver Configuration"
|
||||
default TIVA_UART3_NONE
|
||||
|
||||
config TIVA_UART3_NONE
|
||||
bool "Not selected"
|
||||
|
||||
config TIVA_UART3
|
||||
bool "UART3"
|
||||
default n
|
||||
depends on TIVA_HAVE_UART3
|
||||
bool "Standard serial driver"
|
||||
select UART3_SERIALDRIVER
|
||||
|
||||
config TIVA_UART3_HCIUART
|
||||
bool "Bluetooth HCI-UART"
|
||||
select TIVA_HCIUART
|
||||
depends on WIRELESS_BLUETOOTH
|
||||
|
||||
endchoice # UART3 Driver Configuration
|
||||
|
||||
if TIVA_UART3_HCIUART
|
||||
config TIVA_HCIUART3_RXBUFSIZE
|
||||
int "HCI UART3 Rx buffer size"
|
||||
default 80
|
||||
---help---
|
||||
Characters are buffered as they are received. This specifies
|
||||
the size of the receive buffer. Ideally this should be at least
|
||||
the size of the largest frame that can be received
|
||||
|
||||
config TIVA_HCIUART3_TXBUFSIZE
|
||||
int "HCI UART3 Transmit buffer size"
|
||||
default 80
|
||||
---help---
|
||||
Characters are buffered before being sent. This specifies
|
||||
the size of the transmit buffer. Ideally this should be at least
|
||||
the size of the largest frame that can be sent
|
||||
|
||||
config TIVA_HCIUART3_BAUD
|
||||
int "HCI UART3 initial BAUD rate"
|
||||
default 115200
|
||||
---help---
|
||||
The configured initial BAUD of the HCI UART used during bringup.
|
||||
In most cases this initial rate can be increased by the upper half
|
||||
HCI UART driver using vendor-specifi HCI UART commands.
|
||||
|
||||
endif # TIVA_UART3_HCIUART
|
||||
|
||||
choice
|
||||
prompt "UART4 Driver Configuration"
|
||||
default TIVA_UART4_NONE
|
||||
|
||||
config TIVA_UART4_NONE
|
||||
bool "Not selected"
|
||||
|
||||
config TIVA_UART4
|
||||
bool "UART4"
|
||||
default n
|
||||
depends on TIVA_HAVE_UART4
|
||||
bool "Standard serial driver"
|
||||
select UART4_SERIALDRIVER
|
||||
|
||||
config TIVA_UART4_HCIUART
|
||||
bool "Bluetooth HCI-UART"
|
||||
select TIVA_HCIUART
|
||||
depends on WIRELESS_BLUETOOTH
|
||||
|
||||
endchoice # UART4 Driver Configuration
|
||||
|
||||
if TIVA_UART4_HCIUART
|
||||
config TIVA_HCIUART4_RXBUFSIZE
|
||||
int "HCI UART4 Rx buffer size"
|
||||
default 80
|
||||
---help---
|
||||
Characters are buffered as they are received. This specifies
|
||||
the size of the receive buffer. Ideally this should be at least
|
||||
the size of the largest frame that can be received
|
||||
|
||||
config TIVA_HCIUART4_TXBUFSIZE
|
||||
int "HCI UART4 Transmit buffer size"
|
||||
default 80
|
||||
---help---
|
||||
Characters are buffered before being sent. This specifies
|
||||
the size of the transmit buffer. Ideally this should be at least
|
||||
the size of the largest frame that can be sent
|
||||
|
||||
config TIVA_HCIUART4_BAUD
|
||||
int "HCI UART4 initial BAUD rate"
|
||||
default 115200
|
||||
---help---
|
||||
The configured initial BAUD of the HCI UART used during bringup.
|
||||
In most cases this initial rate can be increased by the upper half
|
||||
HCI UART driver using vendor-specifi HCI UART commands.
|
||||
|
||||
endif # TIVA_UART4_HCIUART
|
||||
|
||||
choice
|
||||
prompt "UART5 Driver Configuration"
|
||||
default TIVA_UART5_NONE
|
||||
|
||||
config TIVA_UART5_NONE
|
||||
bool "Not selected"
|
||||
|
||||
config TIVA_UART5
|
||||
bool "UART5"
|
||||
default n
|
||||
depends on TIVA_HAVE_UART5
|
||||
bool "Standard serial driver"
|
||||
select UART5_SERIALDRIVER
|
||||
|
||||
config TIVA_UART5_HCIUART
|
||||
bool "Bluetooth HCI-UART"
|
||||
select TIVA_HCIUART
|
||||
depends on WIRELESS_BLUETOOTH
|
||||
|
||||
endchoice # UART5 Driver Configuration
|
||||
|
||||
if TIVA_UART5_HCIUART
|
||||
config TIVA_HCIUART5_RXBUFSIZE
|
||||
int "HCI UART5 Rx buffer size"
|
||||
default 80
|
||||
---help---
|
||||
Characters are buffered as they are received. This specifies
|
||||
the size of the receive buffer. Ideally this should be at least
|
||||
the size of the largest frame that can be received
|
||||
|
||||
config TIVA_HCIUART5_TXBUFSIZE
|
||||
int "HCI UART5 Transmit buffer size"
|
||||
default 80
|
||||
---help---
|
||||
Characters are buffered before being sent. This specifies
|
||||
the size of the transmit buffer. Ideally this should be at least
|
||||
the size of the largest frame that can be sent
|
||||
|
||||
config TIVA_HCIUART5_BAUD
|
||||
int "HCI UART5 initial BAUD rate"
|
||||
default 115200
|
||||
---help---
|
||||
The configured initial BAUD of the HCI UART used during bringup.
|
||||
In most cases this initial rate can be increased by the upper half
|
||||
HCI UART driver using vendor-specifi HCI UART commands.
|
||||
|
||||
endif # TIVA_UART5_HCIUART
|
||||
|
||||
choice
|
||||
prompt "UART6 Driver Configuration"
|
||||
default TIVA_UART6_NONE
|
||||
|
||||
config TIVA_UART6_NONE
|
||||
bool "Not selected"
|
||||
|
||||
config TIVA_UART6
|
||||
bool "UART6"
|
||||
default n
|
||||
depends on TIVA_HAVE_UART6
|
||||
bool "Standard serial driver"
|
||||
select UART6_SERIALDRIVER
|
||||
|
||||
config TIVA_UART6_HCIUART
|
||||
bool "Bluetooth HCI-UART"
|
||||
select TIVA_HCIUART
|
||||
depends on WIRELESS_BLUETOOTH
|
||||
|
||||
endchoice # UART6 Driver Configuration
|
||||
|
||||
if TIVA_UART6_HCIUART
|
||||
config TIVA_HCIUART6_RXBUFSIZE
|
||||
int "HCI UART6 Rx buffer size"
|
||||
default 80
|
||||
---help---
|
||||
Characters are buffered as they are received. This specifies
|
||||
the size of the receive buffer. Ideally this should be at least
|
||||
the size of the largest frame that can be received
|
||||
|
||||
config TIVA_HCIUART6_TXBUFSIZE
|
||||
int "HCI UART6 Transmit buffer size"
|
||||
default 80
|
||||
---help---
|
||||
Characters are buffered before being sent. This specifies
|
||||
the size of the transmit buffer. Ideally this should be at least
|
||||
the size of the largest frame that can be sent
|
||||
|
||||
config TIVA_HCIUART6_BAUD
|
||||
int "HCI UART6 initial BAUD rate"
|
||||
default 115200
|
||||
---help---
|
||||
The configured initial BAUD of the HCI UART used during bringup.
|
||||
In most cases this initial rate can be increased by the upper half
|
||||
HCI UART driver using vendor-specifi HCI UART commands.
|
||||
|
||||
endif # TIVA_UART6_HCIUART
|
||||
|
||||
choice
|
||||
prompt "UART7 Driver Configuration"
|
||||
default TIVA_UART7_NONE
|
||||
|
||||
config TIVA_UART7_NONE
|
||||
bool "Not selected"
|
||||
|
||||
config TIVA_UART7
|
||||
bool "UART7"
|
||||
default n
|
||||
depends on TIVA_HAVE_UART7
|
||||
bool "Standard serial driver"
|
||||
select UART7_SERIALDRIVER
|
||||
|
||||
config TIVA_UART7_HCIUART
|
||||
bool "Bluetooth HCI-UART"
|
||||
select TIVA_HCIUART
|
||||
depends on WIRELESS_BLUETOOTH
|
||||
|
||||
endchoice # UART7 Driver Configuration
|
||||
|
||||
if TIVA_UART7_HCIUART
|
||||
config TIVA_HCIUART7_RXBUFSIZE
|
||||
int "HCI UART7 Rx buffer size"
|
||||
default 80
|
||||
---help---
|
||||
Characters are buffered as they are received. This specifies
|
||||
the size of the receive buffer. Ideally this should be at least
|
||||
the size of the largest frame that can be received
|
||||
|
||||
config TIVA_HCIUART7_TXBUFSIZE
|
||||
int "HCI UART7 Transmit buffer size"
|
||||
default 80
|
||||
---help---
|
||||
Characters are buffered before being sent. This specifies
|
||||
the size of the transmit buffer. Ideally this should be at least
|
||||
the size of the largest frame that can be sent
|
||||
|
||||
config TIVA_HCIUART7_BAUD
|
||||
int "HCI UART7 initial BAUD rate"
|
||||
default 115200
|
||||
---help---
|
||||
The configured initial BAUD of the HCI UART used during bringup.
|
||||
In most cases this initial rate can be increased by the upper half
|
||||
HCI UART driver using vendor-specifi HCI UART commands.
|
||||
|
||||
endif # TIVA_UART7_HCIUART
|
||||
|
||||
menu "HCI UART Driver Configuration"
|
||||
depends on TIVA_HCIUART
|
||||
|
||||
config TIVA_HCIUART_SW_RXFLOW
|
||||
bool "Use Software UART RTS flow control"
|
||||
default n
|
||||
---help---
|
||||
Enable UART RTS flow control using Software.
|
||||
|
||||
config TIVA_HCIUART_SW_TXFLOW
|
||||
bool "Use Software UART CTS flow control"
|
||||
default n
|
||||
---help---
|
||||
Enable UART CTS flow control using Software.
|
||||
|
||||
endmenu # HCI UART Driver Configuration
|
||||
|
||||
config TIVA_SSI0
|
||||
bool "SSI0"
|
||||
default n
|
||||
|
@ -161,6 +161,10 @@ ifeq ($(CONFIG_TIVA_EEPROM),y)
|
||||
CHIP_CSRCS += tiva_eeprom.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TIVA_HCIUART),y)
|
||||
CHIP_CSRCS += tiva_hciuart.c
|
||||
endif
|
||||
|
||||
# Paths to source files
|
||||
|
||||
VPATH += chip/common
|
||||
|
1874
arch/arm/src/tiva/common/tiva_hciuart.c
Normal file
1874
arch/arm/src/tiva/common/tiva_hciuart.c
Normal file
File diff suppressed because it is too large
Load Diff
138
arch/arm/src/tiva/tiva_hciuart.h
Normal file
138
arch/arm/src/tiva/tiva_hciuart.h
Normal file
@ -0,0 +1,138 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/tiva/tiva_hciuart.h
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 __ARCH_ARM_SRC_TIVA_HCIUART_H
|
||||
#define __ARCH_ARM_SRC_TIVA_HCIUART_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
enum hciuart_devno_e
|
||||
{
|
||||
#ifdef CONFIG_TIVA_UART0_HCIUART
|
||||
HCIUART0, /* HCI UART on TIVA UART0 */
|
||||
#endif
|
||||
#ifdef CONFIG_TIVA_UART1_HCIUART
|
||||
HCIUART1, /* HCI UART on TIVA UART1 */
|
||||
#endif
|
||||
#ifdef CONFIG_TIVA_UART2_HCIUART
|
||||
HCIUART2, /* HCI UART on TIVA UART2 */
|
||||
#endif
|
||||
#ifdef CONFIG_TIVA_UART3_HCIUART
|
||||
HCIUART3, /* HCI UART on TIVA UART3 */
|
||||
#endif
|
||||
#ifdef CONFIG_TIVA_UART4_HCIUART
|
||||
HCIUART4, /* HCI UART on TIVA UART4 */
|
||||
#endif
|
||||
#ifdef CONFIG_TIVA_UART5_HCIUART
|
||||
HCIUART5, /* HCI UART on TIVA UART5 */
|
||||
#endif
|
||||
#ifdef CONFIG_TIVA_UART6_HCIUART
|
||||
HCIUART6, /* HCI UART on TIVA UART6 */
|
||||
#endif
|
||||
#ifdef CONFIG_TIVA_UART7_HCIUART
|
||||
HCIUART7 /* HCI UART on TIVA UART7 */
|
||||
#endif
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: hciuart_instantiate
|
||||
*
|
||||
* Description:
|
||||
* Obtain an instance of the HCI UART interface for the specified HCI UART
|
||||
* This assumes that hciuart_initialize was called previously.
|
||||
*
|
||||
* Input Parameters:
|
||||
* uart - Identifies the HCI UART to be configured
|
||||
*
|
||||
* Returned Value:
|
||||
* On success, a reference to the HCI UART lower driver for the associated
|
||||
* UART
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
const struct btuart_lowerhalf_s *
|
||||
hciuart_instantiate(enum hciuart_devno_e uart);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: hciuart_initialize
|
||||
*
|
||||
* Description:
|
||||
* Performs the low-level, one-time USART initialization. This must be
|
||||
* called before hciuart_instantiate.
|
||||
*
|
||||
* Input Paramters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void hciuart_initialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tiva_serial_dma_poll
|
||||
*
|
||||
* Description:
|
||||
* Checks receive DMA buffers for received bytes that have not accumulated
|
||||
* to the point where the DMA half/full interrupt has triggered.
|
||||
*
|
||||
* This function should be called from a timer or other periodic context.
|
||||
*
|
||||
* Input Paramters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_TIVA_HCIUART_RXDMA
|
||||
void tiva_serial_dma_poll(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_TIVA_HCIUART_H */
|
@ -195,4 +195,19 @@
|
||||
#define GPIO_EN0_LED1 GPIO_EN0_LED1_1
|
||||
#define GPIO_EN0_LED2 GPIO_EN0_LED2_1
|
||||
|
||||
/* Control pins for BOOST-CC2564MODA plugged into BoosterPack1
|
||||
*
|
||||
* --- ------------
|
||||
* Pin Pin Function
|
||||
* --- ------------
|
||||
* PM3 NSHUTD
|
||||
* PG0 RTS
|
||||
* PL4 CTS
|
||||
* --- ------------
|
||||
*/
|
||||
|
||||
#define UART7_GPIO_NSHUTD (GPIO_FUNC_OUTPUT | GPIO_PORTM | GPIO_PIN_3)
|
||||
#define UART7_GPIO_RTS (GPIO_FUNC_OUTPUT | GPIO_PORTG | GPIO_PIN_0)
|
||||
#define UART7_GPIO_CTS (GPIO_FUNC_INPUT | GPIO_PORTL | GPIO_PIN_4)
|
||||
|
||||
#endif /* __CONFIGS_TM4C1294_LAUNCHPAD_INCLUDE_BOARD_H */
|
||||
|
@ -60,4 +60,10 @@ ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||
CSRCS += tm4c_appinit.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TIVA_HCIUART),y)
|
||||
ifeq ($(CONFIG_BLUETOOTH_UART),y)
|
||||
CSRCS += tm4c_hciuart.c
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/configs/Board.mk
|
||||
|
@ -50,6 +50,30 @@
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
/* Configuration ********************************************************************/
|
||||
#define HAVE_HCIUART 1
|
||||
|
||||
#if !defined(CONFIG_TIVA_HCIUART) || !defined(CONFIG_BLUETOOTH_UART)
|
||||
# undef HAVE_HCIUART
|
||||
#elif defined(CONFIG_TIVA_UART0_HCIUART)
|
||||
# define HCIUART_SERDEV HCIUART0
|
||||
#elif defined(CONFIG_TIVA_UART1_HCIUART)
|
||||
# define HCIUART_SERDEV HCIUART1
|
||||
#elif defined(CONFIG_TIVA_UART2_HCIUART)
|
||||
# define HCIUART_SERDEV HCIUART2
|
||||
#elif defined(CONFIG_TIVA_UART3_HCIUART)
|
||||
# define HCIUART_SERDEV HCIUART3
|
||||
#elif defined(CONFIG_TIVA_UART4_HCIUART)
|
||||
# define HCIUART_SERDEV HCIUART4
|
||||
#elif defined(CONFIG_TIVA_UART5_HCIUART)
|
||||
# define HCIUART_SERDEV HCIUART5
|
||||
#elif defined(CONFIG_TIVA_UART6_HCIUART)
|
||||
# define HCIUART_SERDEV HCIUART6
|
||||
#elif defined(CONFIG_TIVA_UART7_HCIUART)
|
||||
# define HCIUART_SERDEV HCIUART7
|
||||
#else
|
||||
# error No HCI UART specifified
|
||||
#endif
|
||||
|
||||
|
||||
/* How many SSI modules does this chip support? */
|
||||
|
||||
@ -177,5 +201,25 @@ int tm4c_bringup(void);
|
||||
int tiva_timer_configure(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: hciuart_dev_initialize
|
||||
*
|
||||
* Description:
|
||||
* This function is called by board initialization logic to configure the
|
||||
* Bluetooth HCI UART driver
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero is returned on success. Otherwise, a negated errno value is
|
||||
* returned to indicate the nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_HCIUART
|
||||
int hciuart_dev_initialize(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __CONFIGS_TM4C1294_LAUNCHPAD_TM4C1294_LAUNCHPAD_H */
|
||||
|
@ -306,7 +306,7 @@ static void tm4c_qei(void)
|
||||
|
||||
int tm4c_bringup(void)
|
||||
{
|
||||
#ifdef HAVE_TIMER
|
||||
#if defined(HAVE_TIMER) || defined(HAVE_HCIUART)
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
@ -336,5 +336,13 @@ int tm4c_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_HCIUART
|
||||
ret = hciuart_dev_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
serr("ERROR: Failed to initialize HCI UART driver: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
105
configs/tm4c1294-launchpad/src/tm4c_hciuart.c
Normal file
105
configs/tm4c1294-launchpad/src/tm4c_hciuart.c
Normal file
@ -0,0 +1,105 @@
|
||||
/****************************************************************************
|
||||
* configs/tm4c1294-launchpad/src/tm4c_hciuart.c
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Alan Carvalho de Assis <acassis@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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/wireless/bluetooth/bt_uart.h>
|
||||
|
||||
#include "tiva_hciuart.h"
|
||||
#include "tm4c1294-launchpad.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifdef HAVE_HCIUART
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: hciuart_dev_initialize
|
||||
*
|
||||
* Description:
|
||||
* This function is called by board initialization logic to configure the
|
||||
* Bluetooth HCI UART driver
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero is returned on success. Otherwise, a negated errno value is
|
||||
* returned to indicate the nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int hciuart_dev_initialize(void)
|
||||
{
|
||||
const struct btuart_lowerhalf_s *lower;
|
||||
int ret;
|
||||
|
||||
/* Perform one-time initialization */
|
||||
|
||||
hciuart_initialize();
|
||||
|
||||
/* Instantiate the HCI UART lower half interface */
|
||||
|
||||
lower = hciuart_instantiate(HCIUART_SERDEV);
|
||||
if (lower == NULL)
|
||||
{
|
||||
wlerr("ERROR: Failed to instantiate HCIUART%d\n", HCIUART_SERDEV + 1);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Then initialize the HCI UART upper half driver with the bluetooth stack */
|
||||
|
||||
ret = btuart_register(lower);
|
||||
if (ret < 0)
|
||||
{
|
||||
wlerr("ERROR: btuart_register() failed: %d\n", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* HAVE_HCIUART */
|
Loading…
Reference in New Issue
Block a user