Skip to content

Commit f4c2607

Browse files
committed
fix: implement BLE debug based on core_debug()
Signed-off-by: Alexandre Bourdiol <[email protected]>
1 parent f77db6b commit f4c2607

File tree

1 file changed

+140
-0
lines changed

1 file changed

+140
-0
lines changed

Diff for: src/utility/STM32Cube_FW/tl_dbg_conf.h

+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
/* USER CODE BEGIN Header */
2+
/**
3+
******************************************************************************
4+
* File Name : tl_dbg_conf.h
5+
* Description : Debug configuration file for stm32wpan transport layer interface.
6+
*
7+
******************************************************************************
8+
* @attention
9+
*
10+
* Copyright (c) 2019-2021 STMicroelectronics.
11+
* All rights reserved.
12+
*
13+
* This software is licensed under terms that can be found in the LICENSE file
14+
* in the root directory of this software component.
15+
* If no LICENSE file comes with this software, it is provided AS-IS.
16+
*
17+
******************************************************************************
18+
*/
19+
/* USER CODE END Header */
20+
21+
/* Define to prevent recursive inclusion -------------------------------------*/
22+
#ifndef TL_DBG_CONF_H
23+
#define TL_DBG_CONF_H
24+
25+
#ifdef __cplusplus
26+
extern "C" {
27+
#endif
28+
29+
/* USER CODE BEGIN Tl_Conf */
30+
31+
/* Includes ------------------------------------------------------------------*/
32+
#include "core_debug.h"
33+
34+
/**
35+
* Enable or Disable traces
36+
* The raw data output is the hci binary packet format as specified by the BT specification *
37+
*/
38+
#ifndef TL_SHCI_CMD_DBG_EN
39+
#define TL_SHCI_CMD_DBG_EN 1 /* Reports System commands sent to CPU2 and the command response */
40+
#endif
41+
42+
#ifndef TL_SHCI_EVT_DBG_EN
43+
#define TL_SHCI_EVT_DBG_EN 1 /* Reports System Asynchronous Events received from CPU2 */
44+
#endif
45+
46+
#ifndef TL_HCI_CMD_DBG_EN
47+
#define TL_HCI_CMD_DBG_EN 1 /* Reports BLE command sent to CPU2 and the command response */
48+
#endif
49+
50+
#ifndef TL_HCI_EVT_DBG_EN
51+
#define TL_HCI_EVT_DBG_EN 1 /* Reports BLE Asynchronous Events received from CPU2 */
52+
#endif
53+
54+
#ifndef TL_MM_DBG_EN
55+
#define TL_MM_DBG_EN 1 /* Reports the information of the buffer released to CPU2 */
56+
#endif
57+
58+
/**
59+
* Macro definition
60+
*/
61+
62+
/**
63+
* System Transport Layer
64+
*/
65+
#if (TL_SHCI_CMD_DBG_EN != 0)
66+
#define TL_SHCI_CMD_DBG_MSG core_debug
67+
#define TL_SHCI_CMD_DBG_BUF PRINT_LOG_BUFF_DBG
68+
#else
69+
#define TL_SHCI_CMD_DBG_MSG(...)
70+
#define TL_SHCI_CMD_DBG_BUF(...)
71+
#endif
72+
73+
#define TL_SHCI_CMD_DBG_RAW(...)
74+
75+
#if (TL_SHCI_EVT_DBG_EN != 0)
76+
#define TL_SHCI_EVT_DBG_MSG core_debug
77+
#define TL_SHCI_EVT_DBG_BUF PRINT_LOG_BUFF_DBG
78+
#else
79+
#define TL_SHCI_EVT_DBG_MSG(...)
80+
#define TL_SHCI_EVT_DBG_BUF(...)
81+
#endif
82+
83+
#define TL_SHCI_EVT_DBG_RAW(...)
84+
85+
/**
86+
* BLE Transport Layer
87+
*/
88+
#if (TL_HCI_CMD_DBG_EN != 0)
89+
#define TL_HCI_CMD_DBG_MSG core_debug
90+
#define TL_HCI_CMD_DBG_BUF PRINT_LOG_BUFF_DBG
91+
#else
92+
#define TL_HCI_CMD_DBG_MSG(...)
93+
#define TL_HCI_CMD_DBG_BUF(...)
94+
#endif
95+
96+
#define TL_HCI_CMD_DBG_RAW(...)
97+
98+
#if (TL_HCI_EVT_DBG_EN != 0)
99+
#define TL_HCI_EVT_DBG_MSG core_debug
100+
#define TL_HCI_EVT_DBG_BUF PRINT_LOG_BUFF_DBG
101+
#else
102+
#define TL_HCI_EVT_DBG_MSG(...)
103+
#define TL_HCI_EVT_DBG_BUF(...)
104+
#endif
105+
106+
#define TL_HCI_EVT_DBG_RAW(...)
107+
108+
/**
109+
* Memory Manager - Released buffer tracing
110+
*/
111+
#if (TL_MM_DBG_EN != 0)
112+
#define TL_MM_DBG_MSG core_debug
113+
#else
114+
#define TL_MM_DBG_MSG(...)
115+
#endif
116+
117+
118+
#define PRINT_LOG_BUFF_DBG(...) DbgTraceBuffer(__VA_ARGS__)
119+
120+
void DbgTraceBuffer(const void *pBuffer, uint32_t u32Length, const char *strFormat, ...)
121+
{
122+
va_list vaArgs;
123+
uint32_t u32Index;
124+
va_start(vaArgs, strFormat);
125+
vprintf(strFormat, vaArgs);
126+
va_end(vaArgs);
127+
for (u32Index = 0; u32Index < u32Length; u32Index ++)
128+
{
129+
core_debug(" %02X", ((const uint8_t *) pBuffer)[u32Index]);
130+
}
131+
}
132+
133+
/* USER CODE END Tl_Conf */
134+
135+
#ifdef __cplusplus
136+
}
137+
#endif
138+
139+
#endif /* TL_DBG_CONF_H */
140+

0 commit comments

Comments
 (0)