1
0
Fork 0
forked from nuttx/nuttx-update

drivers/usbhost: Add a USB bluetooth driver.

This change adds support for the USB Transport Layer as described
in the bluetooth spec. Isochronous endpoints are not yet supported.
Because of limitations in the NuttX bluetooth stack, only one USB
device can be used. This driver will only allow one USB dongle to
use bluetooth.

A Laird USB BT4.2 dongle (from Mouser) was used for testing:
M/N BT851 1.0 1829, FCC ID:SQGBT850
lsusb: 04b4:f901 Cypress Semiconductor Corp. CYW20704A2

The following commands were used to test from the nsh prompt:
bt bnep0 scan start
bt bnep0 scan stop
bt bnep0 scan get
bt bnep0 info

The Linux gatttool was used to connect over wireless.

With the BDAddr found by "bt bnep0 info", start gatttool using:
gatttool -b BDAddr -I

Connect to the device using:
connect

Read the device name using the GAP device name UUID:
char-read-uuid 2a00

Part of the response is:
value: 41 70 61 63 68 65 20 4e 75 74 74 58
which is the string "Apache NuttX"
This commit is contained in:
Lwazi Dube 2024-01-15 22:17:31 -05:00 committed by Mateusz Szafoni
parent 7508a10e20
commit 1349dcfc1f
6 changed files with 1690 additions and 8 deletions

View file

@ -0,0 +1,102 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DEBUG_INFO is not set
# CONFIG_NET_ETHERNET is not set
# CONFIG_NET_IPv4 is not set
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
# CONFIG_SAMA5_UART0 is not set
# CONFIG_SAMA5_UHPHS_RHPORT1 is not set
CONFIG_ALLOW_BSD_COMPONENTS=y
CONFIG_ALLOW_MIT_COMPONENTS=y
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="sama5d3-xplained"
CONFIG_ARCH_BOARD_SAMA5D3_XPLAINED=y
CONFIG_ARCH_CHIP="sama5"
CONFIG_ARCH_CHIP_ATSAMA5D36=y
CONFIG_ARCH_CHIP_SAMA5=y
CONFIG_ARCH_CHIP_SAMA5D3=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_LOWVECTORS=y
CONFIG_BLUETOOTH_MAXSCANRESULT=100
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARD_LOOPSPERMSEC=65775
CONFIG_BOOT_RUNFROMSDRAM=y
CONFIG_BTSAK=y
CONFIG_BUILTIN=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_NET=y
CONFIG_DEBUG_NET_ERROR=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEBUG_USB=y
CONFIG_DEBUG_USB_ERROR=y
CONFIG_DEBUG_USB_WARN=y
CONFIG_DEBUG_WIRELESS=y
CONFIG_DEBUG_WIRELESS_ERROR=y
CONFIG_DEBUG_WIRELESS_WARN=y
CONFIG_DISABLE_ENVIRON=y
CONFIG_DRIVERS_BLUETOOTH=y
CONFIG_DRIVERS_WIRELESS=y
CONFIG_EXAMPLES_HIDKBD=y
CONFIG_EXAMPLES_TOUCHSCREEN=y
CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/mouse0"
CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE=y
CONFIG_FAT_LCNAMES=y
CONFIG_FAT_LFN=y
CONFIG_FS_FAT=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_HIDKBD_NOGETREPORT=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_NET=y
CONFIG_NET_BLUETOOTH=y
CONFIG_NET_LL_GUARDSIZE=14
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_MQ_MSGS=32
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=268435456
CONFIG_RAM_START=0x20000000
CONFIG_RAM_VSTART=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_READLINE_TABCOMPLETION=y
CONFIG_RR_INTERVAL=200
CONFIG_SAMA5D3XPLAINED_528MHZ=y
CONFIG_SAMA5_BOOT_SDRAM=y
CONFIG_SAMA5_DBGU=y
CONFIG_SAMA5_DBGU_CONSOLE=y
CONFIG_SAMA5_DBGU_NOCONFIG=y
CONFIG_SAMA5_HSMC=y
CONFIG_SAMA5_OHCI=y
CONFIG_SAMA5_OHCI_NEDS=20
CONFIG_SAMA5_OHCI_NTDS=20
CONFIG_SAMA5_OHCI_TDBUFFERS=20
CONFIG_SAMA5_OHCI_TDBUFSIZE=1280
CONFIG_SAMA5_SYSTEMRESET=y
CONFIG_SAMA5_UHPHS=y
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=31
CONFIG_START_MONTH=7
CONFIG_START_YEAR=2014
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_NSH=y
CONFIG_USBHOST_BTHCI=y
CONFIG_USBHOST_COMPOSITE=y
CONFIG_USBHOST_HID=y
CONFIG_USBHOST_HIDKBD=y
CONFIG_USBHOST_HIDMOUSE=y
CONFIG_USBHOST_HUB=y
CONFIG_USBHOST_MSC=y
CONFIG_WIRELESS=y
CONFIG_WIRELESS_BLUETOOTH=y

View file

@ -302,6 +302,16 @@ int sam_usbhost_initialize(void)
}
#endif
#ifdef CONFIG_USBHOST_BTHCI
/* Register USB Bluetooth support */
ret = usbhost_bthci_initialize();
if (ret != OK)
{
uerr("ERROR: Failed to register the bt controller: %d\n", ret);
}
#endif
#ifdef CONFIG_USBHOST_MSC
/* Register theUSB host Mass Storage Class */

View file

@ -721,4 +721,13 @@ config USBHOST_FT232R_LATENCY
endif # USBHOST_FT232R
config USBHOST_BTHCI
bool "Bluetooth HCI Driver"
default n
depends on WIRELESS_BLUETOOTH && USBHOST_HAVE_ASYNCH && !USBHOST_BULK_DISABLE && !USBHOST_INT_DISABLE
select USBHOST_ASYNCH
select SERIAL_REMOVABLE
---help---
Select this option to build in support for USB Bluetooth HCI devices.
endif # USBHOST

View file

@ -70,6 +70,10 @@ ifeq ($(CONFIG_USBHOST_FT232R),y)
CSRCS += usbhost_ft232r.c
endif
ifeq ($(CONFIG_USBHOST_BTHCI),y)
CSRCS += usbhost_bthci.c
endif
# HCD debug/trace logic
ifeq ($(CONFIG_USBHOST_TRACE),y)

File diff suppressed because it is too large Load diff

View file

@ -1013,7 +1013,7 @@ const struct usbhost_registry_s *
*
* Description:
* Initialize the USB hub class. This function should be called
* be platform-specific code in order to initialize and register support
* by platform-specific code in order to initialize and register support
* for the USB host storage class.
*
* Input Parameters:
@ -1034,7 +1034,7 @@ int usbhost_hub_initialize(void);
*
* Description:
* Initialize the USB host storage class. This function should be called
* be platform-specific code in order to initialize and register support
* by platform-specific code in order to initialize and register support
* for the USB host storage class.
*
* Input Parameters:
@ -1126,7 +1126,7 @@ void usbhost_msc_notifier_signal(uint8_t event, char sdchar);
*
* Description:
* Initialize the USB host CDC/ACM class. This function should be called
* be platform-specific code in order to initialize and register support
* by platform-specific code in order to initialize and register support
* for the USB host CDC/ACM class.
*
* Input Parameters:
@ -1147,7 +1147,7 @@ int usbhost_cdcacm_initialize(void);
*
* Description:
* Initialize the USB FT232R driver. This function should be called
* be platform-specific code in order to initialize and register support
* by platform-specific code in order to initialize and register support
* for the FT232R.
*
* Input Parameters:
@ -1168,7 +1168,7 @@ int usbhost_ft232r_initialize(void);
*
* Description:
* Initialize the USB storage HID keyboard class driver. This function
* should be called be platform-specific code in order to initialize and
* should be called by platform-specific code in order to initialize and
* register support for the USB host HID keyboard class device.
*
* Input Parameters:
@ -1189,7 +1189,7 @@ int usbhost_kbdinit(void);
*
* Description:
* Initialize the USB storage HID mouse class driver. This function
* should be called be platform-specific code in order to initialize and
* should be called by platform-specific code in order to initialize and
* register support for the USB host HID mouse class device.
*
* Input Parameters:
@ -1210,7 +1210,7 @@ int usbhost_mouse_init(void);
*
* Description:
* Initialize the USB XBox controller driver. This function
* should be called be platform-specific code in order to initialize and
* should be called by platform-specific code in order to initialize and
* register support for the USB XBox controller.
*
* Input Parameters:
@ -1225,12 +1225,33 @@ int usbhost_mouse_init(void);
int usbhost_xboxcontroller_init(void);
#endif
/****************************************************************************
* Name: usbhost_bthci_initialize
*
* Description:
* Initialize the USB Bluetooth HCI class driver. This function should be
* called by platform-specific code in order to initialize and register
* support for the USB host class device.
*
* Input Parameters:
* None
*
* Returned Value:
* On success this function will return zero (OK); A negated errno value
* will be returned on failure.
*
****************************************************************************/
#ifdef CONFIG_USBHOST_BTHCI
int usbhost_bthci_initialize(void);
#endif
/****************************************************************************
* Name: usbhost_wlaninit
*
* Description:
* Initialize the USB WLAN class driver. This function should be called
* be platform-specific code in order to initialize and register support
* by platform-specific code in order to initialize and register support
* for the USB host class device.
*
* Input Parameters: