]> mj.ucw.cz Git - home-hw.git/blob - Inc/usbd_conf.h
f71c5fff4b7ace49970d0682eaff7a743aff8ac5
[home-hw.git] / Inc / usbd_conf.h
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 "stm32f1xx.h"
63 #include "stm32f1xx_hal.h"
64 #include "usbd_def.h"
65
66 /* USER CODE BEGIN INCLUDE */
67
68 /* USER CODE END INCLUDE */
69
70 /** @addtogroup USBD_OTG_DRIVER
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     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
111
112 /****************************************/
113 /* #define for FS and HS identification */
114 #define DEVICE_FS               0
115
116 /**
117   * @}
118   */
119
120 /** @defgroup USBD_CONF_Exported_Macros USBD_CONF_Exported_Macros
121   * @brief Aliases.
122   * @{
123   */
124
125 /* Memory management macros */
126
127 /** Alias for memory allocation. */
128 #define USBD_malloc         (uint32_t *)USBD_static_malloc
129
130 /** Alias for memory release. */
131 #define USBD_free           USBD_static_free
132
133 /** Alias for memory set. */
134 #define USBD_memset         /* Not used */
135
136 /** Alias for memory copy. */
137 #define USBD_memcpy         /* Not used */
138
139 /** Alias for delay. */
140 #define USBD_Delay          HAL_Delay
141
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);
146
147 /* DEBUG macros */
148
149 #if (USBD_DEBUG_LEVEL > 0)
150 #define USBD_UsrLog(...)    printf(__VA_ARGS__);\
151                             printf("\n");
152 #else
153 #define USBD_UsrLog(...)
154 #endif
155
156 #if (USBD_DEBUG_LEVEL > 1)
157
158 #define USBD_ErrLog(...)    printf("ERROR: ") ;\
159                             printf(__VA_ARGS__);\
160                             printf("\n");
161 #else
162 #define USBD_ErrLog(...)
163 #endif
164
165 #if (USBD_DEBUG_LEVEL > 2)
166 #define USBD_DbgLog(...)    printf("DEBUG : ") ;\
167                             printf(__VA_ARGS__);\
168                             printf("\n");
169 #else
170 #define USBD_DbgLog(...)
171 #endif
172
173 /**
174   * @}
175   */
176
177 /** @defgroup USBD_CONF_Exported_Types USBD_CONF_Exported_Types
178   * @brief Types.
179   * @{
180   */
181
182 /**
183   * @}
184   */
185
186 /** @defgroup USBD_CONF_Exported_FunctionsPrototype USBD_CONF_Exported_FunctionsPrototype
187   * @brief Declaration of public functions for Usb device.
188   * @{
189   */
190
191 /* Exported functions -------------------------------------------------------*/
192
193 /**
194   * @}
195   */
196
197 /**
198   * @}
199   */
200
201 /**
202   * @}
203   */
204
205 #ifdef __cplusplus
206 }
207 #endif
208
209 #endif /* __USBD_CONF__H__ */
210
211 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/