RFC : H4 and BCSP proto unification
Hi,
this patch is an attempt to share H4 and BCSP proto for other drivers than hci_uart.
hci_h4.c and hci_bcsp.c where expecting a hci_uart structure, I define a more generic one. I need to add a tx_wakeup function for BCSP.
I also added 1 operation henqueue that queue a skb in the head of the skb list for driver that can't send all the skb data in one operation.
This is far from perfect (I don't like the hci_dev pointer duplication, ...) and untested for hci_uart driver.
Any comments will be appreciated.
Thanks,
Matthieu
drivers/bluetooth/Kconfig +1 -2
@@ -36,7 +36,6 @@ config BT_HCIUART_H4 bool "UART (H4) protocol support" - depends on BT_HCIUART help UART (H4) is serial protocol for communication between Bluetooth device and host. This protocol is required for most Bluetooth devices
@@ -46,7 +45,6 @@ config BT_HCIUART_BCSP bool "BCSP protocol support" - depends on BT_HCIUART help BCSP (BlueCore Serial Protocol) is serial protocol for communication between Bluetooth device and host. This protocol is required for non
@@ -134,6 +132,7 @@ config BT_HCIBTUART tristate "HCI UART (PC Card) device driver" depends on PCMCIA + select BT_HCIUART_H4 help Bluetooth HCI UART (PC Card) driver. This driver provides support for Bluetooth PCMCIA devices with
drivers/bluetooth/Makefile +2 -2
@@ -12,8 +12,8 @@ obj-$(CONFIG_BT_HCIBT3C) += bt3c_cs.o obj-$(CONFIG_BT_HCIBLUECARD) += bluecard_cs.o obj-$(CONFIG_BT_HCIBTUART) += btuart_cs.o +obj-$(CONFIG_BT_HCIUART_H4) += hci_h4.o +obj-$(CONFIG_BT_HCIUART_BCSP) += hci_bcsp.o hci_uart-y := hci_ldisc.o -hci_uart-$(CONFIG_BT_HCIUART_H4) += hci_h4.o -hci_uart-$(CONFIG_BT_HCIUART_BCSP) += hci_bcsp.o hci_uart-objs := $(hci_uart-y)
drivers/bluetooth/btuart_cs.c +18 -109
199 lines not on this page · raw message
drivers/bluetooth/hci_bcsp.c +47 -46
236 lines not on this page · raw message
drivers/bluetooth/hci_h4.c +38 -35
165 lines not on this page · raw message
drivers/bluetooth/hci_ldisc.c +22 -39
152 lines not on this page · raw message
drivers/bluetooth/hci_uart.h +21 -14
@@ -41,14 +41,26 @@struct hci_uart ; +struct hci_uart_proto_op ; +struct hci_uart_proto { +struct hci_uart_proto_op *p; +void *priv; + +struct hci_dev *hdev; +int (*tx_wakeup) (void *data); +void *tx_wakeup_data; +}; + +struct hci_uart_proto_op {unsigned int id; -int (*open)(struct hci_uart *hu); -int (*close)(struct hci_uart *hu); -int (*flush)(struct hci_uart *hu); -int (*recv)(struct hci_uart *hu,void *data,int len); -int (*enqueue)(struct hci_uart *hu,struct sk_buff *skb); -struct sk_buff *(*dequeue)(struct hci_uart *hu); +int (*open)(struct hci_uart_proto *proto,struct hci_dev *hdev); +int (*close)(struct hci_uart_proto *proto); +int (*flush)(struct hci_uart_proto *proto); +int (*recv)(struct hci_uart_proto *proto,void *data,int len); +int (*enqueue)(struct hci_uart_proto *proto,struct sk_buff *skb); +int (*henqueue)(struct hci_uart_proto *proto,struct sk_buff *skb); +struct sk_buff *(*dequeue)(struct hci_uart_proto *proto); };struct hci_uart {
@@ -57,7 +69,6 @@unsigned long flags;struct hci_uart_proto *proto; -void *priv;struct sk_buff *tx_skb;unsigned long tx_state;
@@ -71,16 +82,12 @@#define HCI_UART_SENDING 1#define HCI_UART_TX_WAKEUP 2 -int hci_uart_register_proto (struct hci_uart_proto *p); -int hci_uart_unregister_proto (struct hci_uart_proto *p); -int hci_uart_tx_wakeup (struct hci_uart *hu); +int hci_uart_register_proto (struct hci_uart_proto_op *p);#ifdef CONFIG_BT_HCIUART_H4 -int h4_init (void ); -int h4_deinit (void ); +struct hci_uart_proto_op *h4_init (void );#endif #ifdef CONFIG_BT_HCIUART_BCSP -int bcsp_init (void ); -int bcsp_deinit (void ); +struct hci_uart_proto_op *bcsp_init (void );#endif
Quoted 11 lines · matthieu castet
Hi,
this patch is an attempt to share H4 and BCSP proto for other drivers than
hci_uart.
hci_h4.candhci_bcsp.cwhere expecting ahci_uartstructure, I define a more generic one. I need to add atx_wakeupfunction for BCSP.I also added 1 operation henqueue that queue a skb in the head of the skb list for driver that can't send all the skb data in one operation.
Quoted 9 lines
This is far from perfect (I don't like the
hci_devpointer duplication, ...) and untested forhci_uartdriver.Any comments will be appreciated.
Thanks,
Matthieu
No comments :(
Matthieu
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Matthieu,
Quoted 6 lines
this patch is an attempt to share H4 and BCSP proto for other drivers than
hci_uart.
hci_h4.candhci_bcsp.cwhere expecting ahci_uartstructure, I define a more generic one. I need to add atx_wakeupfunction for BCSP.
Quoted 7 lines
I also added 1 operation henqueue that queue a skb in the head of the skb list for driver that can't send all the skb data in one operation.
This is far from perfect (I don't like the
hci_devpointer duplication, ...) and untested forhci_uartdriver.Any comments will be appreciated.
we don't need anything for BCSP. So don't even bother with it, but for H4 it makes sense to have on common code. However using an extra module for it is a little bit too much. I would prefer using something like libata etc. So creating a libh4 and using it would be the better approach.
Regards
Marcel
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel