Bluetooth: controller: hci: Add user hooks.
Add hooks for processing of HCI user events on the controller side. Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
This commit is contained in:
parent
e54a7ba324
commit
845064bb31
4 changed files with 62 additions and 0 deletions
|
@ -47,6 +47,10 @@
|
|||
#include "ll_sw/ll_test.h"
|
||||
#endif /* CONFIG_BT_CTLR_DTM_HCI */
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_USER_EXT)
|
||||
#include "hci_user_ext.h"
|
||||
#endif /* CONFIG_BT_CTLR_USER_EXT */
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||
#define LOG_MODULE_NAME bt_ctlr_hci
|
||||
#include "common/log.h"
|
||||
|
@ -3102,6 +3106,12 @@ static void encode_control(struct node_rx_pdu *node_rx,
|
|||
return;
|
||||
#endif /* CONFIG_BT_HCI_MESH_EXT */
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_USER_EXT)
|
||||
case NODE_RX_TYPE_USER_START ... NODE_RX_TYPE_USER_END:
|
||||
hci_user_ext_encode_control(node_rx, pdu_data, buf);
|
||||
return;
|
||||
#endif /* CONFIG_BT_CTLR_USER_EXT */
|
||||
|
||||
default:
|
||||
LL_ASSERT(0);
|
||||
return;
|
||||
|
@ -3470,6 +3480,11 @@ s8_t hci_get_class(struct node_rx_pdu *node_rx)
|
|||
return HCI_CLASS_EVT_CONNECTION;
|
||||
#endif /* CONFIG_BT_CONN */
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_USER_EXT)
|
||||
case NODE_RX_TYPE_USER_START ... NODE_RX_TYPE_USER_END:
|
||||
return hci_user_ext_get_class(node_rx);
|
||||
#endif /* CONFIG_BT_CTLR_USER_EXT */
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
|
12
subsys/bluetooth/controller/hci/hci_user_ext.h
Normal file
12
subsys/bluetooth/controller/hci/hci_user_ext.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
/** @file
|
||||
* @brief HCI controller user extensions
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2019 Oticon A/S
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
s8_t hci_user_ext_get_class(struct node_rx_pdu *node_rx);
|
||||
void hci_user_ext_encode_control(struct node_rx_pdu *node_rx, struct pdu_data *pdu_data, struct net_buf *buf);
|
|
@ -6,6 +6,7 @@ include_directories("./src")
|
|||
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
||||
project(bluetooth_ctrl_user_ext)
|
||||
|
||||
zephyr_library_include_directories($ENV{ZEPHYR_BASE}/subsys/bluetooth/controller/)
|
||||
|
||||
FILE(GLOB app_sources src/*.c)
|
||||
|
||||
|
|
34
tests/bluetooth/ctrl_user_ext/src/hci_user_ext.c
Normal file
34
tests/bluetooth/ctrl_user_ext/src/hci_user_ext.c
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Oticon A/S
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_USER_EXT)
|
||||
|
||||
#include <toolchain.h>
|
||||
#include <zephyr/types.h>
|
||||
#include <net/buf.h>
|
||||
|
||||
#include "util/memq.h"
|
||||
#include "ll_sw/pdu.h"
|
||||
#include "ll_sw/lll.h"
|
||||
#include "hci/hci_user_ext.h"
|
||||
|
||||
/* The test is made to show that hci.c and other code can compile when
|
||||
* certain Kconfig options are set. This includes functions that are
|
||||
* used for proprietary user extension. The function implementations
|
||||
* in this file are simple stubs without functional behavior.
|
||||
*/
|
||||
|
||||
s8_t hci_user_ext_get_class(struct node_rx_pdu *node_rx)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void hci_user_ext_encode_control(struct node_rx_pdu *node_rx, struct pdu_data *pdu_data, struct net_buf *buf)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue