From 2fb31aa2d128b3715d180acef6b088a1437e6354 Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarek Date: Fri, 28 Feb 2020 10:01:02 +0100 Subject: [PATCH] nimble/ll: Update ll_hci GPIO debug to new macros --- nimble/controller/src/ble_ll_hci.c | 28 +++++++--------------------- nimble/controller/syscfg.yml | 14 ++++++-------- 2 files changed, 13 insertions(+), 29 deletions(-) diff --git a/nimble/controller/src/ble_ll_hci.c b/nimble/controller/src/ble_ll_hci.c index 3c123b6ac..b82adc2e9 100644 --- a/nimble/controller/src/ble_ll_hci.c +++ b/nimble/controller/src/ble_ll_hci.c @@ -33,10 +33,8 @@ #include "controller/ble_ll_whitelist.h" #include "controller/ble_ll_resolv.h" #include "controller/ble_ll_sync.h" +#include "ble_ll_priv.h" #include "ble_ll_conn_priv.h" -#if MYNEWT_VAL(BLE_LL_DBG_HCI_CMD_PIN) >= 0 || MYNEWT_VAL(BLE_LL_DBG_HCI_EV_PIN) >= 0 -#include "hal/hal_gpio.h" -#endif #if MYNEWT_VAL(BLE_LL_DTM) #include "ble_ll_dtm_priv.h" @@ -100,9 +98,7 @@ ble_ll_hci_event_send(struct ble_hci_ev *hci_ev) { int rc; -#if MYNEWT_VAL(BLE_LL_DBG_HCI_EV_PIN) >= 0 - hal_gpio_write(MYNEWT_VAL(BLE_LL_DBG_HCI_EV_PIN), 1); -#endif + BLE_LL_DEBUG_GPIO(HCI_EV, 1); BLE_LL_ASSERT(sizeof(*hci_ev) + hci_ev->length <= BLE_LL_MAX_EVT_LEN); @@ -112,9 +108,7 @@ ble_ll_hci_event_send(struct ble_hci_ev *hci_ev) /* Send the event to the host */ rc = ble_hci_trans_ll_evt_tx((uint8_t *)hci_ev); -#if MYNEWT_VAL(BLE_LL_DBG_HCI_EV_PIN) >= 0 - hal_gpio_write(MYNEWT_VAL(BLE_LL_DBG_HCI_EV_PIN), 0); -#endif + BLE_LL_DEBUG_GPIO(HCI_EV, 0); return rc; } @@ -1361,9 +1355,7 @@ ble_ll_hci_cmd_proc(struct ble_npl_event *ev) struct ble_hci_ev_command_complete *cmd_complete; uint8_t *rspbuf; -#if MYNEWT_VAL(BLE_LL_DBG_HCI_CMD_PIN) >= 0 - hal_gpio_write(MYNEWT_VAL(BLE_LL_DBG_HCI_CMD_PIN), 1); -#endif + BLE_LL_DEBUG_GPIO(HCI_CMD, 1); /* The command buffer is the event argument */ cmd = ble_npl_event_get_arg(ev); @@ -1447,9 +1439,7 @@ ble_ll_hci_cmd_proc(struct ble_npl_event *ev) post_cb(); } -#if MYNEWT_VAL(BLE_LL_DBG_HCI_CMD_PIN) >= 0 - hal_gpio_write(MYNEWT_VAL(BLE_LL_DBG_HCI_CMD_PIN), 0); -#endif + BLE_LL_DEBUG_GPIO(HCI_CMD, 0); } /** @@ -1498,12 +1488,8 @@ ble_ll_hci_acl_rx(struct os_mbuf *om, void *arg) void ble_ll_hci_init(void) { -#if MYNEWT_VAL(BLE_LL_DBG_HCI_CMD_PIN) >= 0 - hal_gpio_init_out(MYNEWT_VAL(BLE_LL_DBG_HCI_CMD_PIN), 0); -#endif -#if MYNEWT_VAL(BLE_LL_DBG_HCI_EV_PIN) >= 0 - hal_gpio_init_out(MYNEWT_VAL(BLE_LL_DBG_HCI_EV_PIN), 0); -#endif + BLE_LL_DEBUG_GPIO_INIT(HCI_CMD); + BLE_LL_DEBUG_GPIO_INIT(HCI_EV); /* Set event callback for command processing */ ble_npl_event_init(&g_ble_ll_hci_cmd_ev, ble_ll_hci_cmd_proc, NULL); diff --git a/nimble/controller/syscfg.yml b/nimble/controller/syscfg.yml index dab3025da..dff84c582 100644 --- a/nimble/controller/syscfg.yml +++ b/nimble/controller/syscfg.yml @@ -335,17 +335,15 @@ syscfg.defs: Sysinit stage for the NimBLE controller. value: 250 - BLE_LL_DBG_HCI_CMD_PIN: + BLE_LL_DEBUG_GPIO_HCI_CMD: description: > - When set to proper GPIO pin number, this pin will be set to high - state when HCI command is received and being processed and back - to low state when it was processed. + GPIO pin number to debug HCI commands flow. Pin is set to high state + when HCI command is being processed. value: -1 - BLE_LL_DBG_HCI_EV_PIN: + BLE_LL_DEBUG_GPIO_HCI_EV: description: > - When set to proper GPIO pin number, this pin will be set to high - state when HCI event is being sent and back to low state when event - was sent from controller. + GPIO pin number to debug HCI events flow. Pin is set to high state + when HCI event is being sent. value: -1 # Below settings allow to change scheduler timings. These should be left at