/ Middlewares / ST / STM32_USB_Device_Library / Core / Inc / usbd_conf_template.h
usbd_conf_template.h
  1  /**
  2    ******************************************************************************
  3    * @file    usbd_conf_template.h
  4    * @author  MCD Application Team
  5    * @brief   Header file for the usbd_conf_template.c file
  6    ******************************************************************************
  7    * @attention
  8    *
  9    * Copyright (c) 2015 STMicroelectronics.
 10    * All rights reserved.
 11    *
 12    * This software is licensed under terms that can be found in the LICENSE file
 13    * in the root directory of this software component.
 14    * If no LICENSE file comes with this software, it is provided AS-IS.
 15    *
 16    ******************************************************************************
 17    */
 18  
 19  /* Define to prevent recursive inclusion -------------------------------------*/
 20  #ifndef __USBD_CONF_TEMPLATE_H
 21  #define __USBD_CONF_TEMPLATE_H
 22  
 23  #ifdef __cplusplus
 24  extern "C" {
 25  #endif
 26  
 27  /* Includes ------------------------------------------------------------------*/
 28  #include "stm32fxxx.h"  /* replace 'stm32xxx' with your HAL driver header filename, ex: stm32f4xx.h */
 29  #include <stdio.h>
 30  #include <stdlib.h>
 31  #include <string.h>
 32  
 33  /** @addtogroup STM32_USB_DEVICE_LIBRARY
 34    * @{
 35    */
 36  
 37  /** @defgroup USBD_CONF
 38    * @brief USB device low level driver configuration file
 39    * @{
 40    */
 41  
 42  /** @defgroup USBD_CONF_Exported_Defines
 43    * @{
 44    */
 45  
 46  #define USBD_MAX_NUM_INTERFACES                     1U
 47  #define USBD_MAX_NUM_CONFIGURATION                  1U
 48  #define USBD_MAX_STR_DESC_SIZ                       0x100U
 49  #define USBD_SELF_POWERED                           1U
 50  #define USBD_DEBUG_LEVEL                            2U
 51  /* #define USBD_USER_REGISTER_CALLBACK                 1U */
 52  
 53  /* ECM, RNDIS, DFU Class Config */
 54  #define USBD_SUPPORT_USER_STRING_DESC               1U
 55  
 56  /* BillBoard Class Config */
 57  #define USBD_CLASS_USER_STRING_DESC                 1U
 58  #define USBD_CLASS_BOS_ENABLED                      1U
 59  #define USB_BB_MAX_NUM_ALT_MODE                     0x2U
 60  
 61  /* MSC Class Config */
 62  #define MSC_MEDIA_PACKET                            8192U
 63  
 64  /* CDC Class Config */
 65  #define USBD_CDC_INTERVAL                           2000U
 66  
 67  /* DFU Class Config */
 68  /* #define USBD_DFU_VENDOR_CMD_ENABLED                 1U */
 69  /* #define USBD_DFU_VENDOR_EXIT_ENABLED                1U */
 70  #define USBD_DFU_MAX_ITF_NUM                        1U
 71  #define USBD_DFU_XFERS_IZE                          1024U
 72  
 73  /* AUDIO Class Config */
 74  #define USBD_AUDIO_FREQ                             22100U
 75  
 76  /* CustomHID Class Config */
 77  #define CUSTOM_HID_HS_BINTERVAL                     0x05U
 78  #define CUSTOM_HID_FS_BINTERVAL                     0x05U
 79  #define USBD_CUSTOMHID_OUTREPORT_BUF_SIZE           0x02U
 80  #define USBD_CUSTOM_HID_REPORT_DESC_SIZE            163U
 81  
 82  /* #define USBD_CUSTOMHID_CTRL_REQ_GET_REPORT_ENABLED */
 83  /* #define USBD_CUSTOMHID_OUT_PREPARE_RECEIVE_DISABLED */
 84  /* #define USBD_CUSTOMHID_EP0_OUT_PREPARE_RECEIVE_DISABLED */
 85  /* #define USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED */
 86  
 87  /* VIDEO Class Config */
 88  #define UVC_1_1 /* #define UVC_1_0 */
 89  
 90  /* To be used only with YUY2 and NV12 Video format, shouldn't be defined for MJPEG format */
 91  #define USBD_UVC_FORMAT_UNCOMPRESSED
 92  
 93  #ifdef USBD_UVC_FORMAT_UNCOMPRESSED
 94  #define UVC_BITS_PER_PIXEL                          12U
 95  #define UVC_UNCOMPRESSED_GUID                       UVC_GUID_NV12 /* UVC_GUID_YUY2 */
 96  
 97  /* refer to Table 3-18 Color Matching Descriptor video class v1.1 */
 98  #define UVC_COLOR_PRIMARIE                          0x01U
 99  #define UVC_TFR_CHARACTERISTICS                     0x01U
100  #define UVC_MATRIX_COEFFICIENTS                     0x04U
101  #endif /* USBD_UVC_FORMAT_UNCOMPRESSED */
102  
103  /* Video Stream frame width and height */
104  #define UVC_WIDTH                                   176U
105  #define UVC_HEIGHT                                  144U
106  
107  /* bEndpointAddress in Endpoint Descriptor */
108  #define UVC_IN_EP                                   0x81U
109  
110  #define UVC_CAM_FPS_FS                              10U
111  #define UVC_CAM_FPS_HS                              5U
112  
113  #define UVC_ISO_FS_MPS                              512U
114  #define UVC_ISO_HS_MPS                              512U
115  
116  #define UVC_PACKET_SIZE                             UVC_ISO_FS_MPS
117  /* To be used with Device Only IP supporting double buffer mode */
118  /* #define UVC_HEADER_PACKET_CNT                     0x02U */
119  /* #define UVC_PACKET_SIZE                           (UVC_ISO_FS_MPS * UVC_HEADER_PACKET_CNT) */
120  
121  #define UVC_MAX_FRAME_SIZE                          (UVC_WIDTH * UVC_HEIGHT * 16U / 8U)
122  
123  /** @defgroup USBD_Exported_Macros
124    * @{
125    */
126  
127  /* Memory management macros make sure to use static memory allocation */
128  /** Alias for memory allocation. */
129  #define USBD_malloc         (void *)USBD_static_malloc
130  
131  /** Alias for memory release. */
132  #define USBD_free           USBD_static_free
133  
134  /** Alias for memory set. */
135  #define USBD_memset         memset
136  
137  /** Alias for memory copy. */
138  #define USBD_memcpy         memcpy
139  
140  /** Alias for delay. */
141  #define USBD_Delay          HAL_Delay
142  
143  /* DEBUG macros */
144  #if (USBD_DEBUG_LEVEL > 0U)
145  #define  USBD_UsrLog(...)   do { \
146                                   printf(__VA_ARGS__); \
147                                   printf("\n"); \
148                                 } while (0)
149  #else
150  #define USBD_UsrLog(...) do {} while (0)
151  #endif /* (USBD_DEBUG_LEVEL > 0U) */
152  
153  #if (USBD_DEBUG_LEVEL > 1U)
154  
155  #define  USBD_ErrLog(...) do { \
156                                 printf("ERROR: ") ; \
157                                 printf(__VA_ARGS__); \
158                                 printf("\n"); \
159                               } while (0)
160  #else
161  #define USBD_ErrLog(...) do {} while (0)
162  #endif /* (USBD_DEBUG_LEVEL > 1U) */
163  
164  #if (USBD_DEBUG_LEVEL > 2U)
165  #define  USBD_DbgLog(...)   do { \
166                                   printf("DEBUG : ") ; \
167                                   printf(__VA_ARGS__); \
168                                   printf("\n"); \
169                                 } while (0)
170  #else
171  #define USBD_DbgLog(...) do {} while (0)
172  #endif /* (USBD_DEBUG_LEVEL > 2U) */
173  
174  /**
175    * @}
176    */
177  
178  
179  
180  /**
181    * @}
182    */
183  
184  
185  /** @defgroup USBD_CONF_Exported_Types
186    * @{
187    */
188  /**
189    * @}
190    */
191  
192  
193  /** @defgroup USBD_CONF_Exported_Macros
194    * @{
195    */
196  /**
197    * @}
198    */
199  
200  /** @defgroup USBD_CONF_Exported_Variables
201    * @{
202    */
203  /**
204    * @}
205    */
206  
207  /** @defgroup USBD_CONF_Exported_FunctionsPrototype
208    * @{
209    */
210  /* Exported functions -------------------------------------------------------*/
211  void *USBD_static_malloc(uint32_t size);
212  void USBD_static_free(void *p);
213  /**
214    * @}
215    */
216  
217  #ifdef __cplusplus
218  }
219  #endif
220  
221  #endif /* __USBD_CONF_TEMPLATE_H */
222  
223  
224  /**
225    * @}
226    */
227  
228  /**
229    * @}
230    */