1 /* USER CODE BEGIN Header */ 2 /** 3 ****************************************************************************** 4 * @file utilities_conf.h 5 * @author MCD Application Team 6 * @brief Header for configuration file for STM32 Utilities. 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 21 /* Define to prevent recursive inclusion -------------------------------------*/ 22 #ifndef UTILITIES_CONF_H 23 #define UTILITIES_CONF_H 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 /* Includes ------------------------------------------------------------------*/ 30 #include "cmsis_compiler.h" 31 #include "app_conf.h" 32 /* definitions to be provided to "sequencer" utility */ 33 #include "stm32_mem.h" 34 /* definition and callback for tiny_vsnprintf */ 35 #include "stm32_tiny_vsnprintf.h" 36 37 /* USER CODE BEGIN Includes */ 38 39 /* USER CODE END Includes */ 40 41 /* Exported types ------------------------------------------------------------*/ 42 /* USER CODE BEGIN ET */ 43 44 /* USER CODE END ET */ 45 46 /* Exported constants --------------------------------------------------------*/ 47 48 #define VLEVEL_OFF 0 /*!< used to set UTIL_ADV_TRACE_SetVerboseLevel() (not as message param) */ 49 #define VLEVEL_ALWAYS 0 /*!< used as message params, if this level is given 50 trace will be printed even when UTIL_ADV_TRACE_SetVerboseLevel(OFF) */ 51 #define VLEVEL_L 1 /*!< just essential traces */ 52 #define VLEVEL_M 2 /*!< functional traces */ 53 #define VLEVEL_H 3 /*!< all traces */ 54 55 #define TS_OFF 0 /*!< Log without TimeStamp */ 56 #define TS_ON 1 /*!< Log with TimeStamp */ 57 58 #define T_REG_OFF 0 /*!< Log without bitmask */ 59 60 /* USER CODE BEGIN EC */ 61 62 /* USER CODE END EC */ 63 /* External variables --------------------------------------------------------*/ 64 /* USER CODE BEGIN EV */ 65 66 /* USER CODE END EV */ 67 68 /* Exported macros -----------------------------------------------------------*/ 69 /** 70 * @brief Memory placement macro 71 */ 72 #if defined(__CC_ARM) 73 #define UTIL_PLACE_IN_SECTION( __x__ ) __attribute__((section (__x__), zero_init)) 74 #elif defined(__ICCARM__) 75 #define UTIL_PLACE_IN_SECTION( __x__ ) __attribute__((section (__x__))) 76 #else /* __GNUC__ */ 77 #define UTIL_PLACE_IN_SECTION( __x__ ) __attribute__((section (__x__))) 78 #endif /* __CC_ARM | __ICCARM__ | __GNUC__ */ 79 80 /** 81 * @brief Memory alignment macro 82 */ 83 #undef ALIGN 84 #ifdef WIN32 85 #define ALIGN(n) 86 #else 87 #define ALIGN(n) __attribute__((aligned(n))) 88 #endif /* WIN32 */ 89 90 /** 91 * @brief macro used to initialize the critical section 92 */ 93 #define UTIL_SEQ_INIT_CRITICAL_SECTION( ) UTILS_INIT_CRITICAL_SECTION() 94 95 /** 96 * @brief macro used to enter the critical section 97 */ 98 #define UTIL_SEQ_ENTER_CRITICAL_SECTION( ) UTILS_ENTER_CRITICAL_SECTION() 99 100 /** 101 * @brief macro used to exit the critical section 102 */ 103 #define UTIL_SEQ_EXIT_CRITICAL_SECTION( ) UTILS_EXIT_CRITICAL_SECTION() 104 105 /** 106 * @brief Memset utilities interface to application 107 */ 108 #define UTIL_SEQ_MEMSET8( dest, value, size ) UTIL_MEM_set_8( dest, value, size ) 109 110 /** 111 * @brief macro used to initialize the critical section 112 */ 113 #define UTILS_INIT_CRITICAL_SECTION() 114 115 /** 116 * @brief macro used to enter the critical section 117 */ 118 #define UTILS_ENTER_CRITICAL_SECTION() uint32_t primask_bit= __get_PRIMASK();\ 119 __disable_irq() 120 121 /** 122 * @brief macro used to exit the critical section 123 */ 124 #define UTILS_EXIT_CRITICAL_SECTION() __set_PRIMASK(primask_bit) 125 126 /** 127 * @brief macro used to enter the critical section 128 */ 129 #define UTILS_ENTER_LIMITED_CRITICAL_SECTION(x) uint32_t basepri_value= __get_BASEPRI();\ 130 __set_BASEPRI_MAX(x) 131 132 /** 133 * @brief macro used to exit the critical section 134 */ 135 #define UTILS_EXIT_LIMITED_CRITICAL_SECTION() __set_BASEPRI(basepri_value) 136 137 /****************************************************************************** 138 * trace\advanced 139 * the define option 140 * UTIL_ADV_TRACE_CONDITIONNAL shall be defined if you want use conditional function 141 * UTIL_ADV_TRACE_UNCHUNK_MODE shall be defined if you want use the unchunk mode 142 * 143 ******************************************************************************/ 144 145 #define UTIL_ADV_TRACE_CONDITIONNAL /*!< not used */ 146 #define UTIL_ADV_TRACE_UNCHUNK_MODE /*!< not used */ 147 #define UTIL_ADV_TRACE_DEBUG(...) /*!< not used */ 148 #define UTIL_ADV_TRACE_INIT_CRITICAL_SECTION( ) UTILS_INIT_CRITICAL_SECTION() /*!< init the critical section in trace feature */ 149 #define UTIL_ADV_TRACE_ENTER_CRITICAL_SECTION( ) UTILS_ENTER_CRITICAL_SECTION() /*!< enter the critical section in trace feature */ 150 #define UTIL_ADV_TRACE_EXIT_CRITICAL_SECTION( ) UTILS_EXIT_CRITICAL_SECTION() /*!< exit the critical section in trace feature */ 151 #define UTIL_ADV_TRACE_TMP_BUF_SIZE (CFG_LOG_TRACE_BUF_SIZE) /*!< trace buffer size */ 152 #define UTIL_ADV_TRACE_TMP_MAX_TIMESTMAP_SIZE (15U) /*!< trace timestamp size */ 153 #define UTIL_ADV_TRACE_FIFO_SIZE (CFG_LOG_TRACE_FIFO_SIZE) /*!< trace fifo size */ 154 #define UTIL_ADV_TRACE_MEMSET8( dest, value, size) UTIL_MEM_set_8((dest),(value),(size)) /*!< memset utilities interface to trace feature */ 155 #define UTIL_ADV_TRACE_VSNPRINTF(...) vsnprintf(__VA_ARGS__) /*!< vsnprintf utilities interface to trace feature */ 156 157 /* USER CODE BEGIN EM */ 158 159 /* USER CODE END EM */ 160 161 /* Exported functions prototypes ---------------------------------------------*/ 162 /* USER CODE BEGIN EFP */ 163 164 /* USER CODE END EFP */ 165 166 #ifdef __cplusplus 167 } 168 #endif 169 170 #endif /*UTILITIES_CONF_H */ 171