2015-07-02 04:47:13 +08:00
|
|
|
/** @file
|
2015-06-16 22:31:09 +08:00
|
|
|
* @brief Bluetooth HCI driver API.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Intel Corporation
|
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* Licensed 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
|
2015-06-16 22:31:09 +08:00
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2015-06-16 22:31:09 +08:00
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* 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.
|
2015-06-16 22:31:09 +08:00
|
|
|
*/
|
|
|
|
#ifndef __BT_DRIVER_H
|
|
|
|
#define __BT_DRIVER_H
|
|
|
|
|
2015-10-28 20:59:43 +08:00
|
|
|
#include <net/buf.h>
|
|
|
|
|
2015-10-29 02:17:20 +08:00
|
|
|
enum bt_buf_type {
|
|
|
|
BT_CMD, /** HCI command */
|
|
|
|
BT_EVT, /** HCI event */
|
|
|
|
BT_ACL_OUT, /** Outgoing ACL data */
|
|
|
|
BT_ACL_IN, /** Incoming ACL data */
|
|
|
|
};
|
|
|
|
|
2015-10-28 20:59:43 +08:00
|
|
|
/* Allocate a buffer for an HCI event */
|
|
|
|
struct net_buf *bt_buf_get_evt(void);
|
|
|
|
|
|
|
|
/* Allocate a buffer for incoming ACL data */
|
|
|
|
struct net_buf *bt_buf_get_acl(void);
|
2015-06-16 22:31:09 +08:00
|
|
|
|
2016-01-23 01:38:49 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-06-16 22:31:09 +08:00
|
|
|
/* Receive data from the controller/HCI driver */
|
2015-10-28 16:34:15 +08:00
|
|
|
void bt_recv(struct net_buf *buf);
|
2015-06-16 22:31:09 +08:00
|
|
|
|
|
|
|
struct bt_driver {
|
|
|
|
/* Open the HCI transport */
|
|
|
|
int (*open)(void);
|
|
|
|
|
2015-10-29 02:24:16 +08:00
|
|
|
/* Send buffer command to controller */
|
|
|
|
int (*send)(enum bt_buf_type type, struct net_buf *buf);
|
2015-06-16 22:31:09 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* 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);
|
|
|
|
|
2016-01-23 01:38:49 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-06-16 22:31:09 +08:00
|
|
|
#endif /* __BT_DRIVER_H */
|