Skip to content

Commit eda2679

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

File tree

1 file changed

+128
-0
lines changed

1 file changed

+128
-0
lines changed

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

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
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+
#define TL_SHCI_CMD_DBG_EN 1 /* Reports System commands sent to CPU2 and the command response */
39+
#define TL_SHCI_EVT_DBG_EN 1 /* Reports System Asynchronous Events received from CPU2 */
40+
41+
#define TL_HCI_CMD_DBG_EN 1 /* Reports BLE command sent to CPU2 and the command response */
42+
#define TL_HCI_EVT_DBG_EN 1 /* Reports BLE Asynchronous Events received from CPU2 */
43+
44+
#define TL_MM_DBG_EN 1 /* Reports the information of the buffer released to CPU2 */
45+
46+
/**
47+
* Macro definition
48+
*/
49+
50+
/**
51+
* System Transport Layer
52+
*/
53+
#if (TL_SHCI_CMD_DBG_EN != 0)
54+
#define TL_SHCI_CMD_DBG_MSG core_debug
55+
#define TL_SHCI_CMD_DBG_BUF PRINT_LOG_BUFF_DBG
56+
#else
57+
#define TL_SHCI_CMD_DBG_MSG(...)
58+
#define TL_SHCI_CMD_DBG_BUF(...)
59+
#endif
60+
61+
#define TL_SHCI_CMD_DBG_RAW(...)
62+
63+
#if (TL_SHCI_EVT_DBG_EN != 0)
64+
#define TL_SHCI_EVT_DBG_MSG core_debug
65+
#define TL_SHCI_EVT_DBG_BUF PRINT_LOG_BUFF_DBG
66+
#else
67+
#define TL_SHCI_EVT_DBG_MSG(...)
68+
#define TL_SHCI_EVT_DBG_BUF(...)
69+
#endif
70+
71+
#define TL_SHCI_EVT_DBG_RAW(...)
72+
73+
/**
74+
* BLE Transport Layer
75+
*/
76+
#if (TL_HCI_CMD_DBG_EN != 0)
77+
#define TL_HCI_CMD_DBG_MSG core_debug
78+
#define TL_HCI_CMD_DBG_BUF PRINT_LOG_BUFF_DBG
79+
#else
80+
#define TL_HCI_CMD_DBG_MSG(...)
81+
#define TL_HCI_CMD_DBG_BUF(...)
82+
#endif
83+
84+
#define TL_HCI_CMD_DBG_RAW(...)
85+
86+
#if (TL_HCI_EVT_DBG_EN != 0)
87+
#define TL_HCI_EVT_DBG_MSG core_debug
88+
#define TL_HCI_EVT_DBG_BUF PRINT_LOG_BUFF_DBG
89+
#else
90+
#define TL_HCI_EVT_DBG_MSG(...)
91+
#define TL_HCI_EVT_DBG_BUF(...)
92+
#endif
93+
94+
#define TL_HCI_EVT_DBG_RAW(...)
95+
96+
/**
97+
* Memory Manager - Released buffer tracing
98+
*/
99+
#if (TL_MM_DBG_EN != 0)
100+
#define TL_MM_DBG_MSG core_debug
101+
#else
102+
#define TL_MM_DBG_MSG(...)
103+
#endif
104+
105+
106+
#define PRINT_LOG_BUFF_DBG(...) DbgTraceBuffer(__VA_ARGS__)
107+
108+
void DbgTraceBuffer(const void *pBuffer, uint32_t u32Length, const char *strFormat, ...)
109+
{
110+
va_list vaArgs;
111+
uint32_t u32Index;
112+
va_start(vaArgs, strFormat);
113+
vprintf(strFormat, vaArgs);
114+
va_end(vaArgs);
115+
for (u32Index = 0; u32Index < u32Length; u32Index ++)
116+
{
117+
core_debug(" %02X", ((const uint8_t *) pBuffer)[u32Index]);
118+
}
119+
}
120+
121+
/* USER CODE END Tl_Conf */
122+
123+
#ifdef __cplusplus
124+
}
125+
#endif
126+
127+
#endif /* TL_DBG_CONF_H */
128+

0 commit comments

Comments
 (0)