Merge pull request #11198 from SteveCEvans/sce_rc2
[betaflight.git] / src / main / vcp_hal / usbd_conf.h
blobe6b9b8b3362b12a8691b06df21bbad00006586ab
1 /**
2 ******************************************************************************
3 * @file USB_Device/CDC_Standalone/Inc/usbd_conf.h
4 * @author MCD Application Team
5 * @version V1.0.0
6 * @date 22-April-2016
7 * @brief General low level driver configuration
8 ******************************************************************************
9 * @attention
11 * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics International N.V.
12 * All rights reserved.</center></h2>
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted, provided that the following conditions are met:
17 * 1. Redistribution of source code must retain the above copyright notice,
18 * this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright notice,
20 * this list of conditions and the following disclaimer in the documentation
21 * and/or other materials provided with the distribution.
22 * 3. Neither the name of STMicroelectronics nor the names of other
23 * contributors to this software may be used to endorse or promote products
24 * derived from this software without specific written permission.
25 * 4. This software, including modifications and/or derivative works of this
26 * software, must execute solely and exclusively on microcontroller or
27 * microprocessor devices manufactured by or for STMicroelectronics.
28 * 5. Redistribution and use of this software other than as permitted under
29 * this license is void and will automatically terminate your rights under
30 * this license.
32 * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
33 * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
35 * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
36 * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
37 * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
38 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
39 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
40 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
41 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
42 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
43 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45 ******************************************************************************
48 /* Define to prevent recursive inclusion -------------------------------------*/
49 #ifndef __USBD_CONF_H
50 #define __USBD_CONF_H
52 /* Includes ------------------------------------------------------------------*/
53 #include "platform.h" // Required for inclusion of stm32Yxx_hal.h below within USB device library code
54 #include "common/maths.h" // Required for MIN & MAX within USB device library code
56 #if defined(STM32F7)
57 #include "stm32f7xx_hal.h"
58 #elif defined(STM32H7)
59 #include "stm32h7xx_hal.h"
60 #elif defined(STM32G4)
61 #include "stm32g4xx_hal.h"
62 #else
63 #error Unknown MCU
64 #endif
66 #ifdef STM32G4
67 #define USB_OTG_MAX_EP0_SIZE USB_MAX_EP0_SIZE
68 #endif
70 #if (USBD_DEBUG_LEVEL > 0)
71 #include <stdio.h>
72 #endif
73 #include <stdlib.h>
74 #include <string.h>
76 /* Exported types ------------------------------------------------------------*/
77 /* Exported constants --------------------------------------------------------*/
78 /* Common Config */
79 #define USBD_MAX_NUM_INTERFACES 3
80 #define USBD_MAX_NUM_CONFIGURATION 1
81 #define USBD_MAX_STR_DESC_SIZ 0x100
82 #define USBD_SUPPORT_USER_STRING 0
83 #define USBD_SELF_POWERED 1
84 #define USBD_DEBUG_LEVEL 0
85 #define MSC_MEDIA_PACKET 512U
86 #define USE_USB_FS
88 /* Exported macro ------------------------------------------------------------*/
89 /* Memory management macros */
90 #define USBD_malloc malloc
91 #define USBD_free free
92 #define USBD_memset memset
93 #define USBD_memcpy memcpy
95 /* DEBUG macros */
96 #if (USBD_DEBUG_LEVEL > 0)
97 #define USBD_UsrLog(...) printf(__VA_ARGS__);\
98 printf("\n");
99 #else
100 #define USBD_UsrLog(...)
101 #endif
103 #if (USBD_DEBUG_LEVEL > 1)
105 #define USBD_ErrLog(...) printf("ERROR: ") ;\
106 printf(__VA_ARGS__);\
107 printf("\n");
108 #else
109 #define USBD_ErrLog(...)
110 #endif
112 #if (USBD_DEBUG_LEVEL > 2)
113 #define USBD_DbgLog(...) printf("DEBUG : ") ;\
114 printf(__VA_ARGS__);\
115 printf("\n");
116 #else
117 #define USBD_DbgLog(...)
118 #endif
120 /* Exported functions ------------------------------------------------------- */
122 #endif /* __USBD_CONF_H */
124 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/