Bluetooth: Introduce HCI-driver specific buffer functions
This way we avoid dealing with the specific buffer type value and to make it clear that these are for drivers onle. Change-Id: I8aef7ec6a767b2fa68cbe374eb371e2a6192f675 Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
7ff1cbd976
commit
1ddc3edcaa
3 changed files with 19 additions and 3 deletions
|
|
@ -91,7 +91,7 @@ static struct net_buf *bt_uart_evt_recv(int *remaining)
|
|||
|
||||
*remaining = hdr.len;
|
||||
|
||||
buf = bt_buf_get(BT_EVT, 0);
|
||||
buf = bt_buf_get_evt();
|
||||
if (buf) {
|
||||
memcpy(net_buf_add(buf, sizeof(hdr)), &hdr, sizeof(hdr));
|
||||
} else {
|
||||
|
|
@ -111,7 +111,7 @@ static struct net_buf *bt_uart_acl_recv(int *remaining)
|
|||
/* We can ignore the return value since we pass len == min */
|
||||
bt_uart_read(BT_UART_DEV, (void *)&hdr, sizeof(hdr), sizeof(hdr));
|
||||
|
||||
buf = bt_buf_get(BT_ACL_IN, 0);
|
||||
buf = bt_buf_get_acl();
|
||||
if (buf) {
|
||||
memcpy(net_buf_add(buf, sizeof(hdr)), &hdr, sizeof(hdr));
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,13 @@
|
|||
#ifndef __BT_DRIVER_H
|
||||
#define __BT_DRIVER_H
|
||||
|
||||
#include <bluetooth/buf.h>
|
||||
#include <net/buf.h>
|
||||
|
||||
/* 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);
|
||||
|
||||
/* Receive data from the controller/HCI driver */
|
||||
void bt_recv(struct net_buf *buf);
|
||||
|
|
|
|||
|
|
@ -1706,3 +1706,13 @@ int bt_stop_scanning(void)
|
|||
|
||||
return bt_le_scan_update();
|
||||
}
|
||||
|
||||
struct net_buf *bt_buf_get_evt(void)
|
||||
{
|
||||
return bt_buf_get(BT_EVT, 0);
|
||||
}
|
||||
|
||||
struct net_buf *bt_buf_get_acl(void)
|
||||
{
|
||||
return bt_buf_get(BT_ACL_IN, 0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue