From 01b91ea01d35d1928fe17008d1a66917150d5231 Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarek Date: Fri, 28 Feb 2020 11:30:40 +0100 Subject: [PATCH] nimble/ll: Add some ll_sched GPIO debugging --- nimble/controller/src/ble_ll_sched.c | 10 ++++++++++ nimble/controller/syscfg.yml | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/nimble/controller/src/ble_ll_sched.c b/nimble/controller/src/ble_ll_sched.c index 5e46a6f55..370faddf8 100644 --- a/nimble/controller/src/ble_ll_sched.c +++ b/nimble/controller/src/ble_ll_sched.c @@ -31,6 +31,7 @@ #include "controller/ble_ll_rfmgmt.h" #include "controller/ble_ll_trace.h" #include "controller/ble_ll_sync.h" +#include "ble_ll_priv.h" #include "ble_ll_conn_priv.h" /* XXX: this is temporary. Not sure what I want to do here */ @@ -1469,8 +1470,10 @@ ble_ll_sched_execute_item(struct ble_ll_sched_item *sch) } sched: + BLE_LL_DEBUG_GPIO(SCHED_ITEM_CB, 1); BLE_LL_ASSERT(sch->sched_cb); rc = sch->sched_cb(sch); + BLE_LL_DEBUG_GPIO(SCHED_ITEM_CB, 0); return rc; } @@ -1486,6 +1489,8 @@ ble_ll_sched_run(void *arg) { struct ble_ll_sched_item *sch; + BLE_LL_DEBUG_GPIO(SCHED_RUN, 1); + /* Look through schedule queue */ sch = TAILQ_FIRST(&g_ble_ll_sched_q); if (sch) { @@ -1514,6 +1519,8 @@ ble_ll_sched_run(void *arg) } ble_ll_rfmgmt_sched_changed(sch); } + + BLE_LL_DEBUG_GPIO(SCHED_RUN, 0); } /** @@ -1787,6 +1794,9 @@ ble_ll_sched_stop(void) int ble_ll_sched_init(void) { + BLE_LL_DEBUG_GPIO_INIT(SCHED_ITEM_CB); + BLE_LL_DEBUG_GPIO_INIT(SCHED_RUN); + /* * Initialize max early to large negative number. This is used * to determine the worst-case "early" time the schedule was called. Dont diff --git a/nimble/controller/syscfg.yml b/nimble/controller/syscfg.yml index dff84c582..85049cb09 100644 --- a/nimble/controller/syscfg.yml +++ b/nimble/controller/syscfg.yml @@ -345,6 +345,16 @@ syscfg.defs: GPIO pin number to debug HCI events flow. Pin is set to high state when HCI event is being sent. value: -1 + BLE_LL_DEBUG_GPIO_SCHED_RUN: + description: > + GPIO pin number to debug scheduler running (on timer). Pin is set + to high state while scheduler is running. + value: -1 + BLE_LL_DEBUG_GPIO_SCHED_ITEM_CB: + description: > + GPIO pin number to debug scheduler item execution times. Pin is set + to high state while item is executed. + value: -1 # Below settings allow to change scheduler timings. These should be left at # default values unless you know what you are doing!