This commit adds a Bluetooth HCI UART lower half driver for the STM32
Squashed commit of the following: arch/arm/src/stm32: Add Kconfig options needed by the HCI UART. Various fixes to finally get a clean error free compile with no unexpected warnings. arch/arm/src/stm32: In HCI UART, use spin_lock_irqsave() instead of enter_critical_section() whenever possible. arch/arm/src/stm32: In HCI UART, fix up naming of configurations so that they are unique. Still needs Kconfig settings. Modify logic so that there can be multiple HCI UARTs, some supporting DMA and some not. arch/arm/src/stm32: Integrate watermarks and software Rx flow control into the HCI UART driver. arch/arm/src/stm32: Eliminate some HCI UART UART configuration options. Per the HCI UART spec, the link will b 8 data bits, no parity, 1 stop bit... Always. arch/arm/src/stm32: Trivial cleanup arch/arm/src/stm32: Fixes most initial compilation issues STM32 HCI UART driver. Still need to set up USART configuration parmeters for HCI UART arch/arm/src/stm32: Completes first cut at STM32 HCI UART driver. arch/arm/src/stm32: Completes most of read logic for HCI UART. Still needs to be able to block if no read data is available. Still missing write and flush logic. drivers/wireless: Remove txenable from HCI UART methods. arch/arm/src/stm32: Reorganize some structures in HCI UART. arch/arm/src/stm32: Still messaging the HCI uart driver. arch/arm/src/stm32: Some trivial renaming. arch/arm/src/stm32: A little more HCI-UART logic. arch/arm/src/stm32: Initial setup to support HCI-UART. Little more than the serial driver with some name changes and a few things removed.
This commit is contained in:
parent
e8832be8f1
commit
d25549ac54
@ -6674,12 +6674,27 @@ endmenu
|
||||
|
||||
config STM32_USART
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32_USART_RXDMA
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32_SERIALDRIVER
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32_1WIREDRIVER
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32_HCIUART
|
||||
bool
|
||||
default n
|
||||
|
||||
config STM32_HCIUART_RXDMA
|
||||
bool
|
||||
default n
|
||||
|
||||
menu "U[S]ART Configuration"
|
||||
depends on STM32_USART
|
||||
@ -6701,6 +6716,11 @@ config STM32_USART1_1WIREDRIVER
|
||||
bool "1-Wire driver"
|
||||
select STM32_1WIREDRIVER
|
||||
|
||||
config STM32_USART1_HCIUART
|
||||
bool "Bluetooth HCI-UART"
|
||||
select STM32_HCIUART
|
||||
depends on WIRELESS_BLUETOOTH
|
||||
|
||||
endchoice # USART1 Driver Configuration
|
||||
|
||||
if STM32_USART1_SERIALDRIVER
|
||||
@ -6726,11 +6746,46 @@ config USART1_RXDMA
|
||||
bool "USART1 Rx DMA"
|
||||
default n
|
||||
depends on (((STM32_STM32F10XX || STM32_STM32L15XX) && STM32_DMA1) || (!STM32_STM32F10XX && STM32_DMA2))
|
||||
select STM32_USART_RXDMA
|
||||
---help---
|
||||
In high data rate usage, Rx DMA may eliminate Rx overrun errors
|
||||
|
||||
endif # STM32_USART1_SERIALDRIVER
|
||||
|
||||
if STM32_USART1_HCIUART
|
||||
|
||||
config STM32_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 STM32_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 STM32_HCIUART1_BAUD
|
||||
int "HCI UART1 BAUD rate"
|
||||
default 115200
|
||||
---help---
|
||||
The configured BAUD of the USART.
|
||||
|
||||
config STM32_HCIUART1_RXDMA
|
||||
bool "HCI UART1 Rx DMA"
|
||||
default n
|
||||
depends on (((STM32_STM32F10XX || STM32_STM32L15XX) && STM32_DMA1) || (!STM32_STM32F10XX && STM32_DMA2))
|
||||
select STM32_HCIUART_RXDMA
|
||||
---help---
|
||||
In high data rate usage, Rx DMA may eliminate Rx overrun errors
|
||||
|
||||
endif # STM32_USART1_HCIUART
|
||||
|
||||
choice
|
||||
prompt "USART2 Driver Configuration"
|
||||
default STM32_USART2_SERIALDRIVER
|
||||
@ -6746,6 +6801,11 @@ config STM32_USART2_1WIREDRIVER
|
||||
bool "1-Wire driver"
|
||||
select STM32_1WIREDRIVER
|
||||
|
||||
config STM32_USART2_HCIUART
|
||||
bool "Bluetooth HCI-UART"
|
||||
select STM32_HCIUART
|
||||
depends on WIRELESS_BLUETOOTH
|
||||
|
||||
endchoice # USART2 Driver Configuration
|
||||
|
||||
if STM32_USART2_SERIALDRIVER
|
||||
@ -6771,11 +6831,46 @@ config USART2_RXDMA
|
||||
bool "USART2 Rx DMA"
|
||||
default n
|
||||
depends on STM32_DMA1
|
||||
select STM32_USART_RXDMA
|
||||
---help---
|
||||
In high data rate usage, Rx DMA may eliminate Rx overrun errors
|
||||
|
||||
endif # STM32_USART2_SERIALDRIVER
|
||||
|
||||
if STM32_USART2_HCIUART
|
||||
|
||||
config STM32_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 STM32_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 STM32_HCIUART2_BAUD
|
||||
int "HCI UART2 BAUD rate"
|
||||
default 115200
|
||||
---help---
|
||||
The configured BAUD of the USART.
|
||||
|
||||
config STM32_HCIUART2_RXDMA
|
||||
bool "HCI UART2 Rx DMA"
|
||||
default n
|
||||
depends on STM32_DMA1
|
||||
select STM32_HCIUART_RXDMA
|
||||
---help---
|
||||
In high data rate usage, Rx DMA may eliminate Rx overrun errors
|
||||
|
||||
endif # STM32_USART2_HCIUART
|
||||
|
||||
choice
|
||||
prompt "USART3 Driver Configuration"
|
||||
default STM32_USART3_SERIALDRIVER
|
||||
@ -6791,6 +6886,11 @@ config STM32_USART3_1WIREDRIVER
|
||||
bool "1-Wire driver"
|
||||
select STM32_1WIREDRIVER
|
||||
|
||||
config STM32_USART3_HCIUART
|
||||
bool "Bluetooth HCI-UART"
|
||||
select STM32_HCIUART
|
||||
depends on WIRELESS_BLUETOOTH
|
||||
|
||||
endchoice # USART3 Driver Configuration
|
||||
|
||||
if STM32_USART3_SERIALDRIVER
|
||||
@ -6816,11 +6916,46 @@ config USART3_RXDMA
|
||||
bool "USART3 Rx DMA"
|
||||
default n
|
||||
depends on STM32_DMA1
|
||||
select STM32_USART_RXDMA
|
||||
---help---
|
||||
In high data rate usage, Rx DMA may eliminate Rx overrun errors
|
||||
|
||||
endif # STM32_USART3_SERIALDRIVER
|
||||
|
||||
if STM32_USART3_HCIUART
|
||||
|
||||
config STM32_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 STM32_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 STM32_HCIUART3_BAUD
|
||||
int "HCI UART3 BAUD rate"
|
||||
default 115200
|
||||
---help---
|
||||
The configured BAUD of the USART.
|
||||
|
||||
config STM32_HCIUART3_RXDMA
|
||||
bool "HCI UART3 Rx DMA"
|
||||
default n
|
||||
depends on STM32_DMA1
|
||||
select STM32_HCIUART_RXDMA
|
||||
---help---
|
||||
In high data rate usage, Rx DMA may eliminate Rx overrun errors
|
||||
|
||||
endif # STM32_USART3_HCIUART
|
||||
|
||||
choice
|
||||
prompt "UART4 Driver Configuration"
|
||||
default STM32_UART4_SERIALDRIVER
|
||||
@ -6861,6 +6996,7 @@ config UART4_RXDMA
|
||||
bool "UART4 Rx DMA"
|
||||
default n
|
||||
depends on STM32_DMA1
|
||||
select STM32_USART_RXDMA
|
||||
---help---
|
||||
In high data rate usage, Rx DMA may eliminate Rx overrun errors
|
||||
|
||||
@ -6906,6 +7042,7 @@ config UART5_RXDMA
|
||||
bool "UART5 Rx DMA"
|
||||
default n
|
||||
depends on STM32_DMA1
|
||||
select STM32_USART_RXDMA
|
||||
---help---
|
||||
In high data rate usage, Rx DMA may eliminate Rx overrun errors
|
||||
|
||||
@ -6926,6 +7063,11 @@ config STM32_USART6_1WIREDRIVER
|
||||
bool "1-Wire driver"
|
||||
select STM32_1WIREDRIVER
|
||||
|
||||
config STM32_USART6_HCIUART
|
||||
bool "Bluetooth HCI-UART"
|
||||
select STM32_HCIUART
|
||||
depends on WIRELESS_BLUETOOTH
|
||||
|
||||
endchoice # USART6 Driver Configuration
|
||||
|
||||
if STM32_USART6_SERIALDRIVER
|
||||
@ -6951,11 +7093,46 @@ config USART6_RXDMA
|
||||
bool "USART6 Rx DMA"
|
||||
default n
|
||||
depends on STM32_DMA2
|
||||
select STM32_USART_RXDMA
|
||||
---help---
|
||||
In high data rate usage, Rx DMA may eliminate Rx overrun errors
|
||||
|
||||
endif # STM32_USART6_SERIALDRIVER
|
||||
|
||||
if STM32_USART6_HCIUART
|
||||
|
||||
config STM32_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 STM32_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 STM32_HCIUART6_BAUD
|
||||
int "HCI UART6 BAUD rate"
|
||||
default 115200
|
||||
---help---
|
||||
The configured BAUD of the USART.
|
||||
|
||||
config STM32_HCIUART6_RXDMA
|
||||
bool "HCI UART6 Rx DMA"
|
||||
default n
|
||||
depends on STM32_DMA1
|
||||
select STM32_HCIUART_RXDMA
|
||||
---help---
|
||||
In high data rate usage, Rx DMA may eliminate Rx overrun errors
|
||||
|
||||
endif # STM32_USART6_HCIUART
|
||||
|
||||
choice
|
||||
prompt "UART7 Driver Configuration"
|
||||
default STM32_UART7_SERIALDRIVER
|
||||
@ -6971,6 +7148,11 @@ config STM32_UART7_1WIREDRIVER
|
||||
bool "1-Wire driver"
|
||||
select STM32_1WIREDRIVER
|
||||
|
||||
config STM32_UART7_HCIUART
|
||||
bool "Bluetooth HCI-UART"
|
||||
select STM32_HCIUART
|
||||
depends on WIRELESS_BLUETOOTH
|
||||
|
||||
endchoice # UART7 Driver Configuration
|
||||
|
||||
if STM32_UART7_SERIALDRIVER
|
||||
@ -6996,11 +7178,46 @@ config UART7_RXDMA
|
||||
bool "UART7 Rx DMA"
|
||||
default n
|
||||
depends on STM32_DMA2
|
||||
select STM32_USART_RXDMA
|
||||
---help---
|
||||
In high data rate usage, Rx DMA may eliminate Rx overrun errors
|
||||
|
||||
endif # STM32_UART7_SERIALDRIVER
|
||||
|
||||
if STM32_UART7_HCIUART
|
||||
|
||||
config STM32_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 STM32_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 STM32_HCIUART7_BAUD
|
||||
int "HCI UART7 BAUD rate"
|
||||
default 115200
|
||||
---help---
|
||||
The configured BAUD of the USART.
|
||||
|
||||
config STM32_HCIUART7_RXDMA
|
||||
bool "HCI UART7 Rx DMA"
|
||||
default n
|
||||
depends on STM32_DMA2
|
||||
select STM32_HCIUART_RXDMA
|
||||
---help---
|
||||
In high data rate usage, Rx DMA may eliminate Rx overrun errors
|
||||
|
||||
endif # STM32_UART7_HCIUART
|
||||
|
||||
choice
|
||||
prompt "UART8 Driver Configuration"
|
||||
default STM32_UART8_SERIALDRIVER
|
||||
@ -7016,6 +7233,11 @@ config STM32_UART8_1WIREDRIVER
|
||||
bool "1-Wire driver"
|
||||
select STM32_1WIREDRIVER
|
||||
|
||||
config STM32_UART8_HCIUART
|
||||
bool "Bluetooth HCI-UART"
|
||||
select STM32_HCIUART
|
||||
depends on WIRELESS_BLUETOOTH
|
||||
|
||||
endchoice # UART8 Driver Configuration
|
||||
|
||||
if STM32_UART8_SERIALDRIVER
|
||||
@ -7041,20 +7263,54 @@ config UART8_RXDMA
|
||||
bool "UART8 Rx DMA"
|
||||
default n
|
||||
depends on STM32_DMA2
|
||||
select STM32_USART_RXDMA
|
||||
---help---
|
||||
In high data rate usage, Rx DMA may eliminate Rx overrun errors
|
||||
|
||||
endif # STM32_UART8_SERIALDRIVER
|
||||
|
||||
if STM32_SERIALDRIVER
|
||||
if STM32_UART8_HCIUART
|
||||
|
||||
comment "Serial Driver Configuration"
|
||||
config STM32_HCIUART8_RXBUFSIZE
|
||||
int "HCI UART8 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 STM32_HCIUART8_TXBUFSIZE
|
||||
int "HCI UART8 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 STM32_HCIUART8_BAUD
|
||||
int "HCI UART8 BAUD rate"
|
||||
default 115200
|
||||
---help---
|
||||
The configured BAUD of the USART.
|
||||
|
||||
config STM32_HCIUART8_RXDMA
|
||||
bool "HCI UART8 Rx DMA"
|
||||
default n
|
||||
depends on STM32_DMA2
|
||||
select STM32_HCIUART_RXDMA
|
||||
---help---
|
||||
In high data rate usage, Rx DMA may eliminate Rx overrun errors
|
||||
|
||||
endif # STM32_UART8_HCIUART
|
||||
|
||||
menu "Serial Driver Configuration"
|
||||
depends on STM32_SERIALDRIVER
|
||||
|
||||
config STM32_SERIAL_RXDMA_BUFFER_SIZE
|
||||
int "Rx DMA buffer size"
|
||||
default 32
|
||||
range 32 4096
|
||||
depends on USART1_RXDMA || USART2_RXDMA || USART3_RXDMA || UART4_RXDMA || UART5_RXDMA || USART6_RXDMA || UART7_RXDMA || UART8_RXDMA
|
||||
depends on STM32_USART_RXDMA
|
||||
---help---
|
||||
The DMA buffer size when using RX DMA to emulate a FIFO.
|
||||
|
||||
@ -7065,7 +7321,6 @@ config STM32_SERIAL_RXDMA_BUFFER_SIZE
|
||||
|
||||
config SERIAL_DISABLE_REORDERING
|
||||
bool "Disable reordering of ttySx devices."
|
||||
depends on STM32_USART1 || STM32_USART2 || STM32_USART3 || STM32_UART4 || STM32_UART5 || STM32_USART6 || STM32_UART7 || STM32_UART8
|
||||
default n
|
||||
---help---
|
||||
NuttX per default reorders the serial ports (/dev/ttySx) so that the
|
||||
@ -7079,17 +7334,15 @@ config SERIAL_DISABLE_REORDERING
|
||||
|
||||
config STM32_FLOWCONTROL_BROKEN
|
||||
bool "Use Software UART RTS flow control"
|
||||
depends on STM32_USART
|
||||
default n
|
||||
---help---
|
||||
Enable UART RTS flow control using Software. Because STM
|
||||
Current STM32 have broken HW based RTS behavior (they assert
|
||||
nRTS after every byte received) Enable this setting workaround
|
||||
this issue by useing software based management of RTS
|
||||
this issue by using software based management of RTS
|
||||
|
||||
config STM32_USART_BREAKS
|
||||
bool "Add TIOxSBRK to support sending Breaks"
|
||||
depends on STM32_USART
|
||||
default n
|
||||
---help---
|
||||
Add TIOCxBRK routines to send a line break per the STM32 manual, the
|
||||
@ -7098,7 +7351,7 @@ config STM32_USART_BREAKS
|
||||
|
||||
config STM32_SERIALBRK_BSDCOMPAT
|
||||
bool "Use GPIO To send Break"
|
||||
depends on STM32_USART && STM32_USART_BREAKS
|
||||
depends on STM32_USART_BREAKS
|
||||
default n
|
||||
---help---
|
||||
Enable using GPIO on the TX pin to send a BSD compatible break:
|
||||
@ -7107,13 +7360,68 @@ config STM32_SERIALBRK_BSDCOMPAT
|
||||
on because the SW starts the break and then the HW automatically clears
|
||||
the break. This makes it is difficult to sent a long break.
|
||||
|
||||
config STM32_USART_SINGLEWIRE
|
||||
bool "Single Wire Support"
|
||||
default n
|
||||
depends on STM32_USART
|
||||
endmenu # Serial Driver Configuration
|
||||
|
||||
menu "HCI UART Driver Configuration"
|
||||
depends on STM32_SERIALDRIVER
|
||||
|
||||
config STM32_HCIUART_RXDMA_BUFSIZE
|
||||
int "Rx DMA buffer size"
|
||||
default 32
|
||||
range 32 4096
|
||||
depends on STM32_HCIUART_RXDMA
|
||||
---help---
|
||||
Enable single wire UART support. The option enables support for the
|
||||
TIOCSSINGLEWIRE ioctl in the STM32 serial driver.
|
||||
The DMA buffer size when using RX DMA to emulate a FIFO.
|
||||
|
||||
When streaming data, the generic serial layer will be called
|
||||
every time the FIFO receives half or this number of bytes.
|
||||
|
||||
Value given here will be rounded up to next multiple of 4 bytes.
|
||||
|
||||
config STM32_HCIUART_DMAPRIO
|
||||
hex "HCI UART DMA priority"
|
||||
default 0x00001000 if STM32_STM32F10XX
|
||||
default 0x00010000 if !STM32_STM32F10XX
|
||||
depends on STM32_HCIUART_RXDMA
|
||||
---help---
|
||||
Select HCI UART DMA prority.
|
||||
|
||||
For STM32 F1 family, options are: 0x00000000 low, 0x00001000 medium,
|
||||
0x00002000 high, 0x00003000 very high. Default: medium.
|
||||
|
||||
For other STM32's, options are: 0x00000000 low, 0x00010000 medium,
|
||||
0x00020000 high, 0x00030000 very high. Default: medium.
|
||||
|
||||
config STM32_HCIUART_SW_RXFLOW
|
||||
bool "Use Software UART RTS flow control"
|
||||
default n
|
||||
---help---
|
||||
Enable UART RTS flow control using Software. Because STM
|
||||
Current STM32 have broken HW based RTS behavior (they assert
|
||||
nRTS after every byte received) Enable this setting workaround
|
||||
this issue by using software based management of RTS
|
||||
|
||||
config STM32_HCIUART_UPPER_WATERMARK
|
||||
int "RTS flow control upper watermark (%)"
|
||||
default 75
|
||||
range 2 100
|
||||
depends on STM32_HCIUART_SW_RXFLOW
|
||||
---help---
|
||||
If software RTS flow control is enable, then RTS will be asserted
|
||||
when this amount of Rx data has been buffered. The amount is
|
||||
expressed as a percentage of the Rx buffer size.
|
||||
|
||||
config STM32_HCIUART_LOWER_WATERMARK
|
||||
int "RTS flow control lower watermark (%)"
|
||||
default 25
|
||||
range 1 99
|
||||
depends on STM32_HCIUART_SW_RXFLOW
|
||||
---help---
|
||||
If software RTS flow control is enable, then RTS will be de-asserted
|
||||
when there is less than this amount ofdata in the Rx buffere. The
|
||||
amount is expressed as a percentage of the Rx buffer size.
|
||||
|
||||
endmenu # HCI UART Driver Configuration
|
||||
|
||||
if PM
|
||||
config PM_SERIAL_ACTIVITY
|
||||
@ -7124,7 +7432,6 @@ config PM_SERIAL_ACTIVITY
|
||||
interrupt.
|
||||
endif
|
||||
|
||||
endif # STM32_SERIALDRIVER
|
||||
endmenu # U[S]ART Configuration
|
||||
|
||||
menu "SPI Configuration"
|
||||
|
@ -240,6 +240,10 @@ ifeq ($(CONFIG_STM32_1WIREDRIVER),y)
|
||||
CHIP_CSRCS += stm32_1wire.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STM32_HCIUART),y)
|
||||
CHIP_CSRCS += stm32_hciuart.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STM32_RNG),y)
|
||||
CHIP_CSRCS += stm32_rng.c
|
||||
endif
|
||||
|
2535
arch/arm/src/stm32/stm32_hciuart.c
Normal file
2535
arch/arm/src/stm32/stm32_hciuart.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -247,7 +247,7 @@
|
||||
# define GPIO_CAN2_TX GPIO_CAN2_TX_1
|
||||
#endif
|
||||
|
||||
/* UART2:
|
||||
/* USART2:
|
||||
*
|
||||
* The STM32F4 Discovery has no on-board serial devices, but the console is
|
||||
* brought out to PA2 (TX) and PA3 (RX) for connection to an external serial
|
||||
@ -257,23 +257,29 @@
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_STM32F4DISBB
|
||||
# define GPIO_USART2_RX GPIO_USART2_RX_1
|
||||
# define GPIO_USART2_TX GPIO_USART2_TX_1
|
||||
# define GPIO_USART2_RX GPIO_USART2_RX_1 /* PA3 */
|
||||
# define GPIO_USART2_TX GPIO_USART2_TX_1 /* PA2 */
|
||||
#endif
|
||||
|
||||
/* UART3: (Used in pseudoterm configuration) */
|
||||
/* USART3:
|
||||
*
|
||||
* Used in pseudoterm configuration and also with the BT860 HCI UART.
|
||||
* RTS/CTS Flow control support is need by the HCI UART.
|
||||
*/
|
||||
|
||||
#define GPIO_USART3_TX GPIO_USART3_TX_1
|
||||
#define GPIO_USART3_RX GPIO_USART3_RX_1
|
||||
#define GPIO_USART3_TX GPIO_USART3_TX_1 /* PB10 */
|
||||
#define GPIO_USART3_RX GPIO_USART3_RX_1 /* PB11 */
|
||||
#define GPIO_USART3_CTS GPIO_USART3_CTS_1 /* PB13 */
|
||||
#define GPIO_USART3_RTS GPIO_USART3_RTS_1 /* PB14 */
|
||||
|
||||
/* UART6:
|
||||
/* USART6:
|
||||
*
|
||||
* The STM32F4DIS-BB base board provides RS-232 drivers and a DB9 connector
|
||||
* for USART6. This is the preferred serial console for use with the STM32F4DIS-BB.
|
||||
*/
|
||||
|
||||
#define GPIO_USART6_RX GPIO_USART6_RX_1
|
||||
#define GPIO_USART6_TX GPIO_USART6_TX_1
|
||||
#define GPIO_USART6_RX GPIO_USART6_RX_1 /* PC7 */
|
||||
#define GPIO_USART6_TX GPIO_USART6_TX_1 /* PC6 */
|
||||
|
||||
/* PWM
|
||||
*
|
||||
|
@ -198,8 +198,8 @@ static FAR struct bt_buf_s *btuart_acl_recv(FAR struct btuart_upperhalf_s *upper
|
||||
return buf;
|
||||
}
|
||||
|
||||
static void btuart_interrupt(FAR const struct btuart_lowerhalf_s *lower,
|
||||
FAR void *arg)
|
||||
static void btuart_rxcallback(FAR const struct btuart_lowerhalf_s *lower,
|
||||
FAR void *arg)
|
||||
{
|
||||
FAR struct btuart_upperhalf_s *upper;
|
||||
static FAR struct bt_buf_s *buf;
|
||||
@ -343,16 +343,15 @@ static int btuart_open(FAR const struct bt_driver_s *dev)
|
||||
DEBUGASSERT(upper != NULL && upper->lower != NULL);
|
||||
lower = upper->lower;
|
||||
|
||||
/* Disable Tx and Rx interrupts */
|
||||
/* Disable Rx callbacks */
|
||||
|
||||
lower->txenable(lower, false);
|
||||
lower->rxenable(lower, false);
|
||||
|
||||
/* Drain any cached Rx data */
|
||||
|
||||
(void)lower->rxdrain(lower);
|
||||
|
||||
/* Enable Rx interrupts */
|
||||
/* Re-enable Rx callbacks */
|
||||
|
||||
lower->rxenable(lower, true);
|
||||
return OK;
|
||||
@ -405,7 +404,7 @@ int btuart_register(FAR const struct btuart_lowerhalf_s *lower)
|
||||
|
||||
/* Attach the interrupt handler */
|
||||
|
||||
lower->attach(lower, btuart_interrupt, upper);
|
||||
lower->rxattach(lower, btuart_rxcallback, upper);
|
||||
|
||||
/* And register the driver with the Bluetooth stack */
|
||||
|
||||
|
@ -46,6 +46,7 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/wireless/wireless.h>
|
||||
#include <nuttx/wireless/bt_core.h>
|
||||
#include <nuttx/wireless/bt_hci.h>
|
||||
|
||||
@ -58,7 +59,7 @@
|
||||
|
||||
/* Bluetooth network device IOCTL commands. */
|
||||
|
||||
#ifndef WL_BLUETOOTHCMDS != 16
|
||||
#if !defined(WL_BLUETOOTHCMDS) || WL_BLUETOOTHCMDS != 16
|
||||
# error Incorrect setting for number of Bluetooth IOCTL commands
|
||||
#endif
|
||||
|
||||
|
@ -55,11 +55,11 @@
|
||||
****************************************************************************/
|
||||
|
||||
/* This is the type of the Bluetooth UART upper-half driver interrupt
|
||||
* handler used with the struct btuart_lowerhalf_s attach() method.
|
||||
* callback used with the struct btuart_lowerhalf_s attach() method.
|
||||
*/
|
||||
|
||||
struct btuart_lowerhalf_s;
|
||||
typedef CODE void (*btuart_handler_t)
|
||||
typedef CODE void (*btuart_rxcallback_t)
|
||||
(FAR const struct btuart_lowerhalf_s *lower, FAR void *arg);
|
||||
|
||||
/* The Bluetooth UART driver is a two-part driver:
|
||||
@ -77,19 +77,35 @@ typedef CODE void (*btuart_handler_t)
|
||||
|
||||
struct btuart_lowerhalf_s
|
||||
{
|
||||
/* Attach the upper half interrupt handler */
|
||||
|
||||
CODE void (*attach)(FAR const struct btuart_lowerhalf_s *lower,
|
||||
btuart_handler_t handler, FAR void *arg);
|
||||
|
||||
/* Enable/disable RX/TX interrupts from the UART. */
|
||||
/* Attach/enable the upper half Rx interrupt callback.
|
||||
*
|
||||
* rxattach() allows the upper half logic to attach a callback function
|
||||
* that will be used to inform the upper half that an Rx frame is
|
||||
* available. This callback will, most likely, be invoked in the
|
||||
* context of an interrupt callback. The receive() method should then
|
||||
* be invoked in order to receive the obtain the Rx frame data.
|
||||
* rxenable() may be used to enable or disable callback events. This
|
||||
* probably translates to enabling and disabled Rx interrupts at
|
||||
* the UART. NOTE: Rx event notification should be done sparingly:
|
||||
* Rx data overrun may occur when Rx events are disabled!
|
||||
*/
|
||||
|
||||
CODE void (*rxattach)(FAR const struct btuart_lowerhalf_s *lower,
|
||||
btuart_rxcallback_t callback, FAR void *arg);
|
||||
CODE void (*rxenable)(FAR const struct btuart_lowerhalf_s *lower,
|
||||
bool enable);
|
||||
CODE void (*txenable)(FAR const struct btuart_lowerhalf_s *lower,
|
||||
bool enable);
|
||||
|
||||
/* Read/write UART data */
|
||||
/* Read/write UART frames
|
||||
*
|
||||
* read() after receipt of a callback notifying the upper half of the
|
||||
* availability of Rx frame, the upper half may call the receive()
|
||||
* method in order to obtain the buffered Rx frame data.
|
||||
* write() will add the outgoing frame to the Tx buffer and will return
|
||||
* immediately. This function may block only in the event that there
|
||||
* is insufficient buffer space to hold the Tx frame data. In that
|
||||
* case the lower half will block until there is sufficient to buffer
|
||||
* the entire outgoing packet.
|
||||
*/
|
||||
|
||||
CODE ssize_t (*read)(FAR const struct btuart_lowerhalf_s *lower,
|
||||
FAR void *buffer, size_t buflen);
|
||||
|
@ -53,8 +53,6 @@
|
||||
#include <net/if.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
|
||||
#ifdef CONFIG_DRIVERS_WIRELESS
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
@ -564,5 +562,4 @@ struct iw_scan_req
|
||||
struct iw_freq channel_list[IW_MAX_FREQUENCIES];
|
||||
};
|
||||
|
||||
#endif /* CONFIG_DRIVERS_WIRELESS */
|
||||
#endif /* __INCLUDE_NUTTX_WIRELESS_WIRELESS_H */
|
||||
|
@ -565,6 +565,7 @@ void bt_conn_set_state(FAR struct bt_conn_s *conn,
|
||||
CONFIG_BLUETOOTH_TXCONN_STACKSIZE,
|
||||
conn_tx_kthread, NULL);
|
||||
DEBUGASSERT(pid > 0);
|
||||
UNUSED(pid);
|
||||
|
||||
/* Take the semaphore again. This will force us to wait with the
|
||||
* sem_count at -1. It will be zero again when we continue.
|
||||
|
@ -316,12 +316,14 @@ static void hci_num_completed_packets(FAR struct bt_buf_s *buf)
|
||||
|
||||
for (i = 0; i < num_handles; i++)
|
||||
{
|
||||
uint16_t handle, count;
|
||||
uint16_t handle;
|
||||
uint16_t count;
|
||||
|
||||
handle = BT_LE162HOST(evt->h[i].handle);
|
||||
count = BT_LE162HOST(evt->h[i].count);
|
||||
|
||||
wlinfo("handle %u count %u\n", handle, count);
|
||||
UNUSED(handle);
|
||||
|
||||
while (count--)
|
||||
{
|
||||
|
@ -938,6 +938,7 @@ static int btnet_req_data(FAR struct radio_driver_s *netdev,
|
||||
NETDEV_TXDONE(&priv->bd_dev.r_dev);
|
||||
}
|
||||
|
||||
UNUSED(priv);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user