2 ******************************************************************************
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.
13 * Copyright (c) 2018 STMicroelectronics International N.V.
14 * All rights reserved.
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted, provided that the following conditions are met:
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
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.
47 ******************************************************************************
50 /* Define to prevent recursive inclusion -------------------------------------*/
51 #ifndef __USBD_CONF__H__
52 #define __USBD_CONF__H__
58 /* Includes ------------------------------------------------------------------*/
62 #include "stm32f1xx.h"
63 #include "stm32f1xx_hal.h"
66 /* USER CODE BEGIN INCLUDE */
68 /* USER CODE END INCLUDE */
70 /** @addtogroup USBD_OTG_DRIVER
74 /** @defgroup USBD_CONF USBD_CONF
75 * @brief Configuration file for Usb otg low level driver.
79 /** @defgroup USBD_CONF_Exported_Variables USBD_CONF_Exported_Variables
80 * @brief Public variables.
88 /** @defgroup USBD_CONF_Exported_Defines USBD_CONF_Exported_Defines
89 * @brief Defines for configuration of the Usb device.
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 1
101 /*---------- -----------*/
102 #define USBD_DEBUG_LEVEL 0
103 /*---------- -----------*/
104 #define USBD_SELF_POWERED 1
105 /*---------- -----------*/
106 #define USBD_DFU_MAX_ITF_NUM 1
107 /*---------- -----------*/
108 #define USBD_DFU_XFER_SIZE 1024
109 /*---------- -----------*/
110 #define USBD_DFU_APP_DEFAULT_ADD 0x08000000
112 /****************************************/
113 /* #define for FS and HS identification */
120 /** @defgroup USBD_CONF_Exported_Macros USBD_CONF_Exported_Macros
125 /* Memory management macros */
127 /** Alias for memory allocation. */
128 #define USBD_malloc (uint32_t *)USBD_static_malloc
130 /** Alias for memory release. */
131 #define USBD_free USBD_static_free
133 /** Alias for memory set. */
134 #define USBD_memset /* Not used */
136 /** Alias for memory copy. */
137 #define USBD_memcpy /* Not used */
139 /** Alias for delay. */
140 #define USBD_Delay HAL_Delay
142 /* For footprint reasons and since only one allocation is handled in the HID class
143 driver, the malloc/free is changed into a static allocation method */
144 void *USBD_static_malloc(uint32_t size);
145 void USBD_static_free(void *p);
149 #if (USBD_DEBUG_LEVEL > 0)
150 #define USBD_UsrLog(...) printf(__VA_ARGS__);\
153 #define USBD_UsrLog(...)
156 #if (USBD_DEBUG_LEVEL > 1)
158 #define USBD_ErrLog(...) printf("ERROR: ") ;\
159 printf(__VA_ARGS__);\
162 #define USBD_ErrLog(...)
165 #if (USBD_DEBUG_LEVEL > 2)
166 #define USBD_DbgLog(...) printf("DEBUG : ") ;\
167 printf(__VA_ARGS__);\
170 #define USBD_DbgLog(...)
177 /** @defgroup USBD_CONF_Exported_Types USBD_CONF_Exported_Types
186 /** @defgroup USBD_CONF_Exported_FunctionsPrototype USBD_CONF_Exported_FunctionsPrototype
187 * @brief Declaration of public functions for Usb device.
191 /* Exported functions -------------------------------------------------------*/
209 #endif /* __USBD_CONF__H__ */
211 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/