Bluetooth: Add HCI driver API

This patch adds a basic HCI driver registration API along with a fiber
to process data from the driver. A FIFO is used for receiving data
from the driver and waking up the respective fiber. To open and set up
the HCI transport for operation there's an open() callback passed to
the HCI core. This function will be called as soon as an application
initializes Bluetooth functionality through bt_init().

Change-Id: I780cca517a0dfc714f1ca35527e1c61e307345a0
Co-authored-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2015-04-14 15:32:32 +03:00 committed by Anas Nashif
commit 23a0df8b9b
2 changed files with 102 additions and 2 deletions

View file

@ -104,4 +104,26 @@ size_t bt_buf_headroom(struct bt_buf *buf);
/* Initialize Bluetooth. Must be the called before anything else. */
int bt_init(void);
/* HCI driver API */
/* Receive data from the controller/HCI driver */
void bt_recv(struct bt_buf *buf);
struct bt_driver {
/* How much headroom is needed for HCI transport headers */
size_t head_reserve;
/* Open the HCI transport */
int (*open) (void);
/* Send data to HCI */
int (*send) (struct bt_buf *buf);
};
/* Register a new HCI driver to the Bluetooth stack */
int bt_driver_register(struct bt_driver *drv);
/* Unregister a previously registered HCI driver */
void bt_driver_unregister(struct bt_driver *drv);
#endif /* __BT_BLUETOOTH_H */