1 /* USER CODE BEGIN Header */ 2 /** 3 ****************************************************************************** 4 * @file RTDebug.h 5 * @author MCD Application Team 6 * @brief Real Time Debug module API declaration 7 ****************************************************************************** 8 * @attention 9 * 10 * Copyright (c) 2022 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 #ifndef SYSTEM_DEBUG_H 21 #define SYSTEM_DEBUG_H 22 23 #include "debug_config.h" 24 25 #if(CFG_RT_DEBUG_GPIO_MODULE == 1) 26 27 /**************************************************************/ 28 /** Generic macros for local signal table index recuperation **/ 29 /** and global signal table GPIO manipulation **/ 30 /**************************************************************/ 31 32 #define GENERIC_DEBUG_GPIO_SET(signal, table) do { \ 33 uint32_t debug_table_idx = 0; \ 34 if(signal >= sizeof(table)) \ 35 { \ 36 return; \ 37 } \ 38 debug_table_idx = table[signal]; \ 39 if(debug_table_idx != RT_DEBUG_SIGNAL_UNUSED) \ 40 { \ 41 HAL_GPIO_WritePin(general_debug_table[debug_table_idx].GPIO_port, \ 42 general_debug_table[debug_table_idx].GPIO_pin, \ 43 GPIO_PIN_SET); \ 44 } \ 45 } while(0) 46 47 #define GENERIC_DEBUG_GPIO_RESET(signal, table) do { \ 48 uint32_t debug_table_idx = 0; \ 49 if(signal >= sizeof(table)) \ 50 { \ 51 return; \ 52 } \ 53 debug_table_idx = table[signal]; \ 54 if(debug_table_idx != RT_DEBUG_SIGNAL_UNUSED) \ 55 { \ 56 HAL_GPIO_WritePin(general_debug_table[debug_table_idx].GPIO_port, \ 57 general_debug_table[debug_table_idx].GPIO_pin, \ 58 GPIO_PIN_RESET); \ 59 } \ 60 } while(0) 61 62 #define GENERIC_DEBUG_GPIO_TOGGLE(signal, table) do { \ 63 uint32_t debug_table_idx = 0; \ 64 if(signal >= sizeof(table)) \ 65 { \ 66 return; \ 67 } \ 68 debug_table_idx = table[signal]; \ 69 if(debug_table_idx != RT_DEBUG_SIGNAL_UNUSED) \ 70 { \ 71 HAL_GPIO_TogglePin(general_debug_table[debug_table_idx].GPIO_port, \ 72 general_debug_table[debug_table_idx].GPIO_pin); \ 73 } \ 74 } while(0) 75 76 #endif /* CFG_RT_DEBUG_GPIO_MODULE */ 77 78 /* System debug API definition */ 79 void SYSTEM_DEBUG_SIGNAL_SET(system_debug_signal_t signal); 80 void SYSTEM_DEBUG_SIGNAL_RESET(system_debug_signal_t signal); 81 void SYSTEM_DEBUG_SIGNAL_TOGGLE(system_debug_signal_t signal); 82 83 /* Link Layer debug API definition */ 84 void LINKLAYER_DEBUG_SIGNAL_SET(linklayer_debug_signal_t signal); 85 void LINKLAYER_DEBUG_SIGNAL_RESET(linklayer_debug_signal_t signal); 86 void LINKLAYER_DEBUG_SIGNAL_TOGGLE(linklayer_debug_signal_t signal); 87 88 #endif /* SYSTEM_DEBUG_H */ 89