bluetooth: controller: openisa/RV32M1: add debug pins support

Add SW defined BLE LL debug support on Vega platform by using
the debug GPIO pins infrastructure.

Signed-off-by: David Leach <david.leach@nxp.com>
This commit is contained in:
David Leach 2019-09-25 17:26:02 +03:00 committed by Carles Cufí
commit 5edcb7dc2a
2 changed files with 147 additions and 1 deletions

View file

@ -7,6 +7,150 @@
*/
/* CONFIG_BT_CTLR_DEBUG_PINS */
/* CONFIG_BT_CTLR_DEBUG_PINS */
/*
* The BLE SW link layer defines 10 GPIO pins for debug related
* information (but really only uses 7 pins). Zephyr has a block of
* 10 GPIOs routed to J2 odd pins 1-19 (inside bank of J2).
*
* Mapping:
*
* J2.1 : DEBUG_CPU_SLEEP
* J2.3 : DEBUG_TICKER_ISR, DEBUG_TICKER_TASK
* J2.5 : DEBUG_TICKER_JOB
* J2.7 : DEBUG_RADIO_PREPARE_A, DEBUG_RADIO_CLOSE_A
* J2.9 : DEBUG_RADIO_PREPARE_S, DEBUG_RADIO_START_S, DEBUG_RADIO_CLOSE_S
* J2.11 : DEBUG_RADIO_PREPARE_O, DEBUG_RADIO_START_O, DEBUG_RADIO_CLOSE_O
* J2.13 : DEBUG_RADIO_PREPARE_M, DEBUG_RADIO_START_M, DEBUG_RADIO_CLOSE_M
* J2.15 : DEBUG_RADIO_ISR
* J2.17 : DEBUG_RADIO_XTAL
* J2.19 : DEBUG_RADIO_ACTIVE
*
*/
#ifdef CONFIG_BT_CTLR_DEBUG_PINS
#include <drivers/gpio.h>
extern struct device *vega_debug_portb;
extern struct device *vega_debug_portc;
extern struct device *vega_debug_portd;
#define DEBUG0_PIN 5
#define DEBUG0_PORT vega_debug_portd
#define DEBUG1_PIN 4
#define DEBUG1_PORT vega_debug_portd
#define DEBUG2_PIN 3
#define DEBUG2_PORT vega_debug_portd
#define DEBUG3_PIN 2
#define DEBUG3_PORT vega_debug_portd
#define DEBUG4_PIN 1
#define DEBUG4_PORT vega_debug_portd
#define DEBUG5_PIN 0
#define DEBUG5_PORT vega_debug_portd
#define DEBUG6_PIN 30
#define DEBUG6_PORT vega_debug_portc
#define DEBUG7_PIN 29
#define DEBUG7_PORT vega_debug_portc
#define DEBUG8_PIN 28
#define DEBUG8_PORT vega_debug_portc
#define DEBUG9_PIN 29
#define DEBUG9_PORT vega_debug_portb
/* below are some interesting macros referenced by controller
* which can be defined to SoC's GPIO toggle to observe/debug the
* controller's runtime behavior.
*
* The ULL/LLL has defined 10 bits for doing debug output to be captured
* by a logic analyzer (i.e. minimally invasive). Vega board has some
* GPIO routed to the headers. Unfortunately they are spread across
* ports if you want to implement the 10 unique bits.
*
* portd
*
*/
#define DEBUG_INIT() \
do { \
vega_debug_portb = device_get_binding(DT_ALIAS_GPIO_B_LABEL); \
vega_debug_portc = device_get_binding(DT_ALIAS_GPIO_C_LABEL); \
vega_debug_portd = device_get_binding(DT_ALIAS_GPIO_D_LABEL); \
\
gpio_pin_write(DEBUG0_PORT, DEBUG0_PIN, 1); \
gpio_pin_write(DEBUG0_PORT, DEBUG0_PIN, 0); \
} while (0)
#define DEBUG_CPU_SLEEP(flag) gpio_pin_write(DEBUG0_PORT, DEBUG0_PIN, flag)
#define DEBUG_TICKER_ISR(flag) gpio_pin_write(DEBUG1_PORT, DEBUG1_PIN, flag)
#define DEBUG_TICKER_TASK(flag) gpio_pin_write(DEBUG1_PORT, DEBUG1_PIN, flag)
#define DEBUG_TICKER_JOB(flag) gpio_pin_write(DEBUG2_PORT, DEBUG2_PIN, flag)
#define DEBUG_RADIO_ISR(flag) gpio_pin_write(DEBUG7_PORT, DEBUG7_PIN, flag)
#define DEBUG_RADIO_XTAL(flag) gpio_pin_write(DEBUG8_PORT, DEBUG8_PIN, flag)
#define DEBUG_RADIO_ACTIVE(flag) gpio_pin_write(DEBUG9_PORT, DEBUG9_PIN, flag)
#define DEBUG_RADIO_CLOSE(flag) \
do { \
if (!flag) { \
gpio_pin_write(DEBUG3_PORT, DEBUG3_PIN, flag); \
gpio_pin_write(DEBUG4_PORT, DEBUG4_PIN, flag); \
gpio_pin_write(DEBUG5_PORT, DEBUG5_PIN, flag); \
gpio_pin_write(DEBUG6_PORT, DEBUG6_PIN, flag); \
} \
} while (0)
#define DEBUG_RADIO_PREPARE_A(flag) \
gpio_pin_write(DEBUG3_PORT, DEBUG3_PIN, flag)
#define DEBUG_RADIO_START_A(flag) \
gpio_pin_write(DEBUG3_PORT, DEBUG3_PIN, flag)
#define DEBUG_RADIO_CLOSE_A(flag) \
gpio_pin_write(DEBUG3_PORT, DEBUG3_PIN, flag)
#define DEBUG_RADIO_PREPARE_S(flag) \
gpio_pin_write(DEBUG4_PORT, DEBUG4_PIN, flag)
#define DEBUG_RADIO_START_S(flag) \
gpio_pin_write(DEBUG4_PORT, DEBUG4_PIN, flag)
#define DEBUG_RADIO_CLOSE_S(flag) \
gpio_pin_write(DEBUG4_PORT, DEBUG4_PIN, flag)
#define DEBUG_RADIO_PREPARE_O(flag) \
gpio_pin_write(DEBUG5_PORT, DEBUG5_PIN, flag)
#define DEBUG_RADIO_START_O(flag) \
gpio_pin_write(DEBUG5_PORT, DEBUG5_PIN, flag)
#define DEBUG_RADIO_CLOSE_O(flag) \
gpio_pin_write(DEBUG5_PORT, DEBUG5_PIN, flag)
#define DEBUG_RADIO_PREPARE_M(flag) \
gpio_pin_write(DEBUG6_PORT, DEBUG6_PIN, flag)
#define DEBUG_RADIO_START_M(flag) \
gpio_pin_write(DEBUG6_PORT, DEBUG6_PIN, flag)
#define DEBUG_RADIO_CLOSE_M(flag) \
gpio_pin_write(DEBUG6_PORT, DEBUG6_PIN, flag)
#else
#define DEBUG_INIT()
#define DEBUG_CPU_SLEEP(flag)
#define DEBUG_TICKER_ISR(flag)
@ -29,3 +173,5 @@
#define DEBUG_RADIO_PREPARE_M(flag)
#define DEBUG_RADIO_START_M(flag)
#define DEBUG_RADIO_CLOSE_M(flag)
#endif

View file

@ -251,7 +251,7 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)
LL_ASSERT(!ret);
}
DEBUG_RADIO_START_S(1);
DEBUG_RADIO_START_S(0);
return 0;
}