|
| 1 | +/* USER CODE BEGIN Header */ |
| 2 | +/** |
| 3 | + ****************************************************************************** |
| 4 | + * @file : Target/usbh_conf.h |
| 5 | + * @version : v1.0_Cube |
| 6 | + * @brief : Header for usbh_conf.c file. |
| 7 | + ****************************************************************************** |
| 8 | + * @attention |
| 9 | + * |
| 10 | + * <h2><center>© Copyright (c) 2020 STMicroelectronics. |
| 11 | + * All rights reserved.</center></h2> |
| 12 | + * |
| 13 | + * This software component is licensed by ST under Ultimate Liberty license |
| 14 | + * SLA0044, the "License"; You may not use this file except in compliance with |
| 15 | + * the License. You may obtain a copy of the License at: |
| 16 | + * www.st.com/SLA0044 |
| 17 | + * |
| 18 | + ****************************************************************************** |
| 19 | + */ |
| 20 | +/* USER CODE END Header */ |
| 21 | + |
| 22 | +/* Define to prevent recursive inclusion -------------------------------------*/ |
| 23 | +#ifndef __USBH_CONF__H__ |
| 24 | +#define __USBH_CONF__H__ |
| 25 | +#ifdef __cplusplus |
| 26 | + extern "C" { |
| 27 | +#endif |
| 28 | + |
| 29 | +// #define USBHOST |
| 30 | + |
| 31 | +#ifdef USBHOST |
| 32 | +/* Includes ------------------------------------------------------------------*/ |
| 33 | +#include "stm32_def.h" |
| 34 | + |
| 35 | +/* Includes ------------------------------------------------------------------*/ |
| 36 | + |
| 37 | +#include <stdio.h> |
| 38 | +#include <stdlib.h> |
| 39 | +#include <string.h> |
| 40 | +// #include "main.h" |
| 41 | + |
| 42 | +// #include "stm32f4xx.h" |
| 43 | +// #include "stm32f4xx_hal.h" |
| 44 | + |
| 45 | +/* USER CODE BEGIN INCLUDE */ |
| 46 | + |
| 47 | +/* USER CODE END INCLUDE */ |
| 48 | + |
| 49 | +/** @addtogroup STM32_USB_HOST_LIBRARY |
| 50 | + * @{ |
| 51 | + */ |
| 52 | + |
| 53 | +/** @defgroup USBH_CONF |
| 54 | + * @brief usb host low level driver configuration file |
| 55 | + * @{ |
| 56 | + */ |
| 57 | + |
| 58 | +/** @defgroup USBH_CONF_Exported_Variables USBH_CONF_Exported_Variables |
| 59 | + * @brief Public variables. |
| 60 | + * @{ |
| 61 | + */ |
| 62 | + |
| 63 | +/** |
| 64 | + * @} |
| 65 | + */ |
| 66 | + |
| 67 | +/** @defgroup USBH_CONF_Exported_Defines USBH_CONF_Exported_Defines |
| 68 | + * @brief Defines for configuration of the Usb host. |
| 69 | + * @{ |
| 70 | + */ |
| 71 | + |
| 72 | +/*---------- -----------*/ |
| 73 | +#define USBH_MAX_NUM_ENDPOINTS 2U |
| 74 | + |
| 75 | +/*---------- -----------*/ |
| 76 | +#define USBH_MAX_NUM_INTERFACES 2U |
| 77 | + |
| 78 | +/*---------- -----------*/ |
| 79 | +#define USBH_MAX_NUM_CONFIGURATION 2U |
| 80 | + |
| 81 | +/*---------- -----------*/ |
| 82 | +#define USBH_KEEP_CFG_DESCRIPTOR 2U |
| 83 | + |
| 84 | +/*---------- -----------*/ |
| 85 | +#define USBH_MAX_NUM_SUPPORTED_CLASS 2U |
| 86 | + |
| 87 | +/*---------- -----------*/ |
| 88 | +#define USBH_MAX_SIZE_CONFIGURATION 256U |
| 89 | + |
| 90 | +/*---------- -----------*/ |
| 91 | +#define USBH_MAX_DATA_BUFFER 512U |
| 92 | + |
| 93 | +/*---------- -----------*/ |
| 94 | +#define USBH_DEBUG_LEVEL 0U |
| 95 | + |
| 96 | +/*---------- -----------*/ |
| 97 | +#define USBH_USE_OS 0U |
| 98 | + |
| 99 | +/****************************************/ |
| 100 | +/* #define for FS and HS identification */ |
| 101 | +#define HOST_HS 0 |
| 102 | +#define HOST_FS 1 |
| 103 | + |
| 104 | +/* Interrupt priority */ |
| 105 | +#ifndef USBH_IRQ_PRIO |
| 106 | +#define USBH_IRQ_PRIO 0 |
| 107 | +#endif /* USBH_IRQ_PRIO */ |
| 108 | +#ifndef USBH_IRQ_SUBPRIO |
| 109 | +#define USBH_IRQ_SUBPRIO 0 |
| 110 | +#endif /* USBH_IRQ_SUBPRIO */ |
| 111 | + |
| 112 | +#if (USBH_USE_OS == 1) |
| 113 | + #include "cmsis_os.h" |
| 114 | + #define USBH_PROCESS_PRIO osPriorityNormal |
| 115 | + #define USBH_PROCESS_STACK_SIZE ((uint16_t)0) |
| 116 | +#endif /* (USBH_USE_OS == 1) */ |
| 117 | + |
| 118 | +/** |
| 119 | + * @} |
| 120 | + */ |
| 121 | + |
| 122 | +/** @defgroup USBH_CONF_Exported_Macros USBH_CONF_Exported_Macros |
| 123 | + * @brief Aliases. |
| 124 | + * @{ |
| 125 | + */ |
| 126 | + |
| 127 | +/* Memory management macros */ |
| 128 | + |
| 129 | +/** Alias for memory allocation. */ |
| 130 | +#define USBH_malloc malloc |
| 131 | + |
| 132 | +/** Alias for memory release. */ |
| 133 | +#define USBH_free free |
| 134 | + |
| 135 | +/** Alias for memory set. */ |
| 136 | +#define USBH_memset memset |
| 137 | + |
| 138 | +/** Alias for memory copy. */ |
| 139 | +#define USBH_memcpy memcpy |
| 140 | + |
| 141 | +/* DEBUG macros */ |
| 142 | + |
| 143 | +extern void spi_debug(const char *msg, ...); |
| 144 | + |
| 145 | +#if (USBH_DEBUG_LEVEL > 0U) |
| 146 | +#define USBH_UsrLog(...) do { \ |
| 147 | + printf(__VA_ARGS__); \ |
| 148 | + printf("\n"); \ |
| 149 | +} while (0) |
| 150 | +#else |
| 151 | +#define USBH_UsrLog(MSG, ...) spi_debug(MSG __VA_OPT__(,) __VA_ARGS__); |
| 152 | +//do {} while (0) |
| 153 | +#endif |
| 154 | + |
| 155 | +#if (USBH_DEBUG_LEVEL > 1U) |
| 156 | + |
| 157 | +#define USBH_ErrLog(...) do { \ |
| 158 | + printf("ERROR: ") ; \ |
| 159 | + printf(__VA_ARGS__); \ |
| 160 | + printf("\n"); \ |
| 161 | +} while (0) |
| 162 | +#else |
| 163 | +#define USBH_ErrLog(MSG, ...) spi_debug(MSG __VA_OPT__(,) __VA_ARGS__); |
| 164 | +//do {} while (0) |
| 165 | +#endif |
| 166 | + |
| 167 | +#if (USBH_DEBUG_LEVEL > 2U) |
| 168 | +#define USBH_DbgLog(...) do { \ |
| 169 | + printf("DEBUG : ") ; \ |
| 170 | + printf(__VA_ARGS__); \ |
| 171 | + printf("\n"); \ |
| 172 | +} while (0) |
| 173 | +#else |
| 174 | +#define USBH_DbgLog(MSG, ...) spi_debug(MSG __VA_OPT__(,) __VA_ARGS__); |
| 175 | +//do {} while (0) |
| 176 | +#endif |
| 177 | + |
| 178 | +/** |
| 179 | + * @} |
| 180 | + */ |
| 181 | + |
| 182 | +/** @defgroup USBH_CONF_Exported_Types USBH_CONF_Exported_Types |
| 183 | + * @brief Types. |
| 184 | + * @{ |
| 185 | + */ |
| 186 | + |
| 187 | +/** |
| 188 | + * @} |
| 189 | + */ |
| 190 | + |
| 191 | +/** @defgroup USBH_CONF_Exported_FunctionsPrototype USBH_CONF_Exported_FunctionsPrototype |
| 192 | + * @brief Declaration of public functions for Usb host. |
| 193 | + * @{ |
| 194 | + */ |
| 195 | + |
| 196 | +/* Exported functions -------------------------------------------------------*/ |
| 197 | + |
| 198 | +/** |
| 199 | + * @} |
| 200 | + */ |
| 201 | + |
| 202 | +/** |
| 203 | + * @} |
| 204 | + */ |
| 205 | + |
| 206 | +/** |
| 207 | + * @} |
| 208 | + */ |
| 209 | + |
| 210 | + #endif /* USBHOST */ |
| 211 | + |
| 212 | +#ifdef __cplusplus |
| 213 | +} |
| 214 | +#endif |
| 215 | + |
| 216 | +#endif /* __USBH_CONF__H__ */ |
| 217 | + |
| 218 | +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
0 commit comments