1 /** 2 ****************************************************************************** 3 * @file : usbd_conf.h 4 * @version : v2.0_Cube 5 * @brief : Header for usbd_conf.c file. 6 ****************************************************************************** 7 * This notice applies to any and all portions of this file 8 * that are not between comment pairs USER CODE BEGIN and 9 * USER CODE END. Other portions of this file, whether 10 * inserted by the user or by software development tools 11 * are owned by their respective copyright owners. 12 * 13 * Copyright (c) 2018 STMicroelectronics International N.V. 14 * All rights reserved. 15 * 16 * Redistribution and use in source and binary forms, with or without 17 * modification, are permitted, provided that the following conditions are met: 18 * 19 * 1. Redistribution of source code must retain the above copyright notice, 20 * this list of conditions and the following disclaimer. 21 * 2. Redistributions in binary form must reproduce the above copyright notice, 22 * this list of conditions and the following disclaimer in the documentation 23 * and/or other materials provided with the distribution. 24 * 3. Neither the name of STMicroelectronics nor the names of other 25 * contributors to this software may be used to endorse or promote products 26 * derived from this software without specific written permission. 27 * 4. This software, including modifications and/or derivative works of this 28 * software, must execute solely and exclusively on microcontroller or 29 * microprocessor devices manufactured by or for STMicroelectronics. 30 * 5. Redistribution and use of this software other than as permitted under 31 * this license is void and will automatically terminate your rights under 32 * this license. 33 * 34 * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" 35 * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT 36 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 37 * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY 38 * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT 39 * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 40 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 42 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 43 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 44 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 45 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 * 47 ****************************************************************************** 48 */ 49 50 /* Define to prevent recursive inclusion -------------------------------------*/ 51 #ifndef __USBD_CONF__H__ 52 #define __USBD_CONF__H__ 53 54 #ifdef __cplusplus 55 extern "C" { 56 #endif 57 58 /* Includes ------------------------------------------------------------------*/ 59 #include <stdio.h> 60 #include <stdlib.h> 61 #include <string.h> 62 #include "stm32l4xx.h" 63 #include "stm32l4xx_hal.h" 64 65 /* USER CODE BEGIN INCLUDE */ 66 67 /* USER CODE END INCLUDE */ 68 69 /** @addtogroup USBD_OTG_DRIVER 70 * @brief Driver for Usb device. 71 * @{ 72 */ 73 74 /** @defgroup USBD_CONF USBD_CONF 75 * @brief Configuration file for Usb otg low level driver. 76 * @{ 77 */ 78 79 /** @defgroup USBD_CONF_Exported_Variables USBD_CONF_Exported_Variables 80 * @brief Public variables. 81 * @{ 82 */ 83 84 /** 85 * @} 86 */ 87 88 /** @defgroup USBD_CONF_Exported_Defines USBD_CONF_Exported_Defines 89 * @brief Defines for configuration of the Usb device. 90 * @{ 91 */ 92 93 /*---------- -----------*/ 94 #define USBD_MAX_NUM_INTERFACES 1 95 /*---------- -----------*/ 96 #define USBD_MAX_NUM_CONFIGURATION 1 97 /*---------- -----------*/ 98 #define USBD_MAX_STR_DESC_SIZ 512 99 /*---------- -----------*/ 100 #define USBD_SUPPORT_USER_STRING 0 101 /*---------- -----------*/ 102 #define USBD_DEBUG_LEVEL 0 103 /*---------- -----------*/ 104 #define USBD_LPM_ENABLED 1 105 /*---------- -----------*/ 106 #define USBD_SELF_POWERED 1 107 108 /****************************************/ 109 /* #define for FS and HS identification */ 110 #define DEVICE_FS 0 111 112 /** 113 * @} 114 */ 115 116 /** @defgroup USBD_CONF_Exported_Macros USBD_CONF_Exported_Macros 117 * @brief Aliases. 118 * @{ 119 */ 120 121 /* Memory management macros */ 122 123 /** Alias for memory allocation. */ 124 #define USBD_malloc (uint32_t *)USBD_static_malloc 125 126 /** Alias for memory release. */ 127 #define USBD_free USBD_static_free 128 129 /** Alias for memory set. */ 130 #define USBD_memset /* Not used */ 131 132 /** Alias for memory copy. */ 133 #define USBD_memcpy /* Not used */ 134 135 /** Alias for delay. */ 136 #define USBD_Delay HAL_Delay 137 138 /* DEBUG macros */ 139 140 #if (USBD_DEBUG_LEVEL > 0) 141 #define USBD_UsrLog(...) printf(__VA_ARGS__);\ 142 printf("\n"); 143 #else 144 #define USBD_UsrLog(...) 145 #endif 146 147 #if (USBD_DEBUG_LEVEL > 1) 148 149 #define USBD_ErrLog(...) printf("ERROR: ") ;\ 150 printf(__VA_ARGS__);\ 151 printf("\n"); 152 #else 153 #define USBD_ErrLog(...) 154 #endif 155 156 #if (USBD_DEBUG_LEVEL > 2) 157 #define USBD_DbgLog(...) printf("DEBUG : ") ;\ 158 printf(__VA_ARGS__);\ 159 printf("\n"); 160 #else 161 #define USBD_DbgLog(...) 162 #endif 163 164 /** 165 * @} 166 */ 167 168 /** @defgroup USBD_CONF_Exported_Types USBD_CONF_Exported_Types 169 * @brief Types. 170 * @{ 171 */ 172 173 /** 174 * @} 175 */ 176 177 /** @defgroup USBD_CONF_Exported_FunctionsPrototype USBD_CONF_Exported_FunctionsPrototype 178 * @brief Declaration of public functions for Usb device. 179 * @{ 180 */ 181 182 /* Exported functions -------------------------------------------------------*/ 183 void *USBD_static_malloc(uint32_t size); 184 void USBD_static_free(void *p); 185 186 /** 187 * @} 188 */ 189 190 /** 191 * @} 192 */ 193 194 /** 195 * @} 196 */ 197 198 #ifdef __cplusplus 199 } 200 #endif 201 202 #endif /* __USBD_CONF__H__ */ 203 204 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 205