serial/uart/h5: add bt h5 uart serial driver

Signed-off-by: chengkai <chengkai@xiaomi.com>
This commit is contained in:
chengkai 2023-05-11 21:48:52 +08:00 committed by Xiang Xiao
parent 99ee94728a
commit d867c46bbc
5 changed files with 1397 additions and 7 deletions

View file

@ -434,7 +434,7 @@ endmenu
config SIM_HCISOCKET
bool "Attach Host Bluetooth"
default false
depends on HOST_LINUX && (UART_BTH4 || WIRELESS_BLUETOOTH)
depends on HOST_LINUX && (UART_BTH4 || UART_BTH5 || WIRELESS_BLUETOOTH)
---help---
Attached the local bluetooth device to the simulation
target via HCI_CHANNEL_USER. This gives NuttX full

View file

@ -715,7 +715,7 @@ config PSEUDOTERM_TXBUFSIZE
endif # PSEUDOTERM
menuconfig UART_BTH4
bool "BT H4 uart pseudo device"
bool "BT H4 UART Pseudo Device"
default n
depends on DRIVERS_BLUETOOTH
---help---
@ -727,19 +727,19 @@ menuconfig UART_BTH4
if UART_BTH4
config UART_BTH4_TXBUFSIZE
int "BT H4 uart TX buffer size"
int "BT H4 UART TX Buffer Size"
default 2048
---help---
H4 UART TX buffer size. Default: 2048
H4 UART TX Buffer Size. Default: 2048
config UART_BTH4_RXBUFSIZE
int "BT H4 uart RX buffer size"
int "BT H4 UART RX Buffer Size"
default 8096
---help---
H4 UART RX buffer size. Default: 8096
H4 UART RX Buffer Size. Default: 8096
config UART_BTH4_NPOLLWAITERS
int "Number of poll threads"
int "Number Of Poll Threads"
default 2
---help---
Maximum number of threads than can be waiting for POLL events.
@ -747,4 +747,43 @@ config UART_BTH4_NPOLLWAITERS
endif # UART_BTH4
menuconfig UART_BTH5
bool "BT H5 UART Pseudo Device"
default n
depends on DRIVERS_BLUETOOTH
---help---
Enable support for Bluetooth H5 UART Pseudo Device(eg. /dev/ttyHCI).
This instantiates a serial-like interface over an existing bluetooth
controller via HCI interface. Useful for external Bluetooth
stacks working this way instead of the socket based interface.
if UART_BTH5
config UART_BTH5_TXBUFSIZE
int "BT H5 UART TX Buffer Size"
default 2048
---help---
H5 UART TX Buffer Size. Default: 2048
config UART_BTH5_TXWIN
int "BT H5 Uart TX Window Size"
default 4
---help---
H5 UART TX Window Size. Default: 4
config UART_BTH5_RXBUFSIZE
int "BT H5 Uart RX Buffer Size"
default 8096
---help---
H5 UART RX Buffer Size. Default: 8096
config UART_BTH5_NPOLLWAITERS
int "Number Of Poll Threads"
default 2
---help---
Maximum number of threads than can be waiting for POLL events.
Default: 2
endif # UART_BTH5
endif # SERIAL

View file

@ -55,6 +55,13 @@ ifeq ($(CONFIG_UART_BTH4),y)
CSRCS += uart_bth4.c
endif
# Bluetooth H:5 UART driver
ifeq ($(CONFIG_UART_BTH5),y)
CSRCS += uart_bth5.c
endif
# Include serial build support
DEPPATH += --dep-path serial

1280
drivers/serial/uart_bth5.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,64 @@
/****************************************************************************
* include/nuttx/serial/uart_bth5.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_SERIAL_UART_BTH5_H
#define __INCLUDE_NUTTX_SERIAL_UART_BTH5_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/wireless/bluetooth/bt_driver.h>
/****************************************************************************
* Public Data
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: uart_bth5_register
*
* Description:
* Register bluetooth H:5 UART driver.
*
****************************************************************************/
int uart_bth5_register(FAR const char *path, FAR struct bt_driver_s *drv);
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __INCLUDE_NUTTX_SERIAL_UART_BTH4_H */