Bluetooth: controller: hci: Obtain pdu_data using a macro
Hide the details of obtaining a pointer to the PDU data from a node_rx structure to simplify the code. Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
parent
db5e6f861d
commit
9c32a6d287
2 changed files with 13 additions and 21 deletions
|
@ -3336,20 +3336,14 @@ static void encode_data_ctrl(struct node_rx_pdu *node_rx,
|
||||||
#if defined(CONFIG_BT_CONN)
|
#if defined(CONFIG_BT_CONN)
|
||||||
void hci_acl_encode(struct node_rx_pdu *node_rx, struct net_buf *buf)
|
void hci_acl_encode(struct node_rx_pdu *node_rx, struct net_buf *buf)
|
||||||
{
|
{
|
||||||
|
struct pdu_data *pdu_data = PDU_DATA(node_rx);
|
||||||
struct bt_hci_acl_hdr *acl;
|
struct bt_hci_acl_hdr *acl;
|
||||||
struct pdu_data *pdu_data;
|
|
||||||
u16_t handle_flags;
|
u16_t handle_flags;
|
||||||
u16_t handle;
|
u16_t handle;
|
||||||
u8_t *data;
|
u8_t *data;
|
||||||
|
|
||||||
handle = node_rx->hdr.handle;
|
handle = node_rx->hdr.handle;
|
||||||
|
|
||||||
#if defined(CONFIG_BT_LL_SW_SPLIT)
|
|
||||||
pdu_data = (void *)node_rx->pdu;
|
|
||||||
#else
|
|
||||||
pdu_data = (void *)((struct radio_pdu_node_rx *)node_rx)->pdu_data;
|
|
||||||
#endif /* CONFIG_BT_LL_SW_SPLIT */
|
|
||||||
|
|
||||||
switch (pdu_data->ll_id) {
|
switch (pdu_data->ll_id) {
|
||||||
case PDU_DATA_LLID_DATA_CONTINUE:
|
case PDU_DATA_LLID_DATA_CONTINUE:
|
||||||
case PDU_DATA_LLID_DATA_START:
|
case PDU_DATA_LLID_DATA_START:
|
||||||
|
@ -3386,13 +3380,7 @@ void hci_acl_encode(struct node_rx_pdu *node_rx, struct net_buf *buf)
|
||||||
|
|
||||||
void hci_evt_encode(struct node_rx_pdu *node_rx, struct net_buf *buf)
|
void hci_evt_encode(struct node_rx_pdu *node_rx, struct net_buf *buf)
|
||||||
{
|
{
|
||||||
struct pdu_data *pdu_data;
|
struct pdu_data *pdu_data = PDU_DATA(node_rx);
|
||||||
|
|
||||||
#if defined(CONFIG_BT_LL_SW_SPLIT)
|
|
||||||
pdu_data = (void *)node_rx->pdu;
|
|
||||||
#else
|
|
||||||
pdu_data = (void *)((struct radio_pdu_node_rx *)node_rx)->pdu_data;
|
|
||||||
#endif /* CONFIG_BT_LL_SW_SPLIT */
|
|
||||||
|
|
||||||
if (node_rx->hdr.type != NODE_RX_TYPE_DC_PDU) {
|
if (node_rx->hdr.type != NODE_RX_TYPE_DC_PDU) {
|
||||||
encode_control(node_rx, pdu_data, buf);
|
encode_control(node_rx, pdu_data, buf);
|
||||||
|
@ -3424,13 +3412,9 @@ void hci_num_cmplt_encode(struct net_buf *buf, u16_t handle, u8_t num)
|
||||||
|
|
||||||
s8_t hci_get_class(struct node_rx_pdu *node_rx)
|
s8_t hci_get_class(struct node_rx_pdu *node_rx)
|
||||||
{
|
{
|
||||||
struct pdu_data *pdu_data;
|
#if defined(CONFIG_BT_CONN)
|
||||||
|
struct pdu_data *pdu_data = PDU_DATA(node_rx);
|
||||||
#if defined(CONFIG_BT_LL_SW_SPLIT)
|
#endif
|
||||||
pdu_data = (void *)node_rx->pdu;
|
|
||||||
#else
|
|
||||||
pdu_data = (void *)((struct radio_pdu_node_rx *)node_rx)->pdu_data;
|
|
||||||
#endif /* CONFIG_BT_LL_SW_SPLIT */
|
|
||||||
|
|
||||||
if (node_rx->hdr.type != NODE_RX_TYPE_DC_PDU) {
|
if (node_rx->hdr.type != NODE_RX_TYPE_DC_PDU) {
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,14 @@ extern atomic_t hci_state_mask;
|
||||||
* data)
|
* data)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_LL_SW_SPLIT)
|
||||||
|
#define PDU_DATA(node_rx) ((void *)node_rx->pdu)
|
||||||
|
#else
|
||||||
|
#define PDU_DATA(node_rx) ((void *) \
|
||||||
|
((struct radio_pdu_node_rx *)node_rx)->pdu_data)
|
||||||
|
#endif /* CONFIG_BT_LL_SW_SPLIT */
|
||||||
|
|
||||||
|
|
||||||
void hci_init(struct k_poll_signal *signal_host_buf);
|
void hci_init(struct k_poll_signal *signal_host_buf);
|
||||||
struct net_buf *hci_cmd_handle(struct net_buf *cmd, void **node_rx);
|
struct net_buf *hci_cmd_handle(struct net_buf *cmd, void **node_rx);
|
||||||
void hci_evt_encode(struct node_rx_pdu *node_rx, struct net_buf *buf);
|
void hci_evt_encode(struct node_rx_pdu *node_rx, struct net_buf *buf);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue