| 1 | /* USER CODE BEGIN Header */
|
|---|
| 2 | /**
|
|---|
| 3 | ******************************************************************************
|
|---|
| 4 | * @file : usbd_conf.h
|
|---|
| 5 | * @version : v3.0_Cube
|
|---|
| 6 | * @brief : Header for usbd_conf.c file.
|
|---|
| 7 | ******************************************************************************
|
|---|
| 8 | * @attention
|
|---|
| 9 | *
|
|---|
| 10 | * Copyright (c) 2026 STMicroelectronics.
|
|---|
| 11 | * All rights reserved.
|
|---|
| 12 | *
|
|---|
| 13 | * This software is licensed under terms that can be found in the LICENSE file
|
|---|
| 14 | * in the root directory of this software component.
|
|---|
| 15 | * If no LICENSE file comes with this software, it is provided AS-IS.
|
|---|
| 16 | *
|
|---|
| 17 | ******************************************************************************
|
|---|
| 18 | */
|
|---|
| 19 | /* USER CODE END Header */
|
|---|
| 20 |
|
|---|
| 21 | /* Define to prevent recursive inclusion -------------------------------------*/
|
|---|
| 22 | #ifndef __USBD_CONF__H__
|
|---|
| 23 | #define __USBD_CONF__H__
|
|---|
| 24 |
|
|---|
| 25 | #ifdef __cplusplus
|
|---|
| 26 | extern "C" {
|
|---|
| 27 | #endif
|
|---|
| 28 |
|
|---|
| 29 | /* Includes ------------------------------------------------------------------*/
|
|---|
| 30 | #include <stdio.h>
|
|---|
| 31 | #include <stdlib.h>
|
|---|
| 32 | #include <string.h>
|
|---|
| 33 | #include "stm32g4xx.h"
|
|---|
| 34 | #include "stm32g4xx_hal.h"
|
|---|
| 35 |
|
|---|
| 36 | /* USER CODE BEGIN INCLUDE */
|
|---|
| 37 |
|
|---|
| 38 | /* USER CODE END INCLUDE */
|
|---|
| 39 |
|
|---|
| 40 | /** @addtogroup USBD_OTG_DRIVER
|
|---|
| 41 | * @brief Driver for Usb device.
|
|---|
| 42 | * @{
|
|---|
| 43 | */
|
|---|
| 44 |
|
|---|
| 45 | /** @defgroup USBD_CONF USBD_CONF
|
|---|
| 46 | * @brief Configuration file for Usb otg low level driver.
|
|---|
| 47 | * @{
|
|---|
| 48 | */
|
|---|
| 49 |
|
|---|
| 50 | /** @defgroup USBD_CONF_Exported_Variables USBD_CONF_Exported_Variables
|
|---|
| 51 | * @brief Public variables.
|
|---|
| 52 | * @{
|
|---|
| 53 | */
|
|---|
| 54 |
|
|---|
| 55 | /* Private variables ---------------------------------------------------------*/
|
|---|
| 56 | /* USER CODE BEGIN PV */
|
|---|
| 57 | /* USER CODE END PV */
|
|---|
| 58 | /**
|
|---|
| 59 | * @}
|
|---|
| 60 | */
|
|---|
| 61 |
|
|---|
| 62 | /** @defgroup USBD_CONF_Exported_Defines USBD_CONF_Exported_Defines
|
|---|
| 63 | * @brief Defines for configuration of the Usb device.
|
|---|
| 64 | * @{
|
|---|
| 65 | */
|
|---|
| 66 |
|
|---|
| 67 | /*---------- -----------*/
|
|---|
| 68 | #define USBD_MAX_NUM_INTERFACES 1U
|
|---|
| 69 | /*---------- -----------*/
|
|---|
| 70 | #define USBD_MAX_NUM_CONFIGURATION 1U
|
|---|
| 71 | /*---------- -----------*/
|
|---|
| 72 | #define USBD_MAX_STR_DESC_SIZ 512U
|
|---|
| 73 | /*---------- -----------*/
|
|---|
| 74 | #define USBD_DEBUG_LEVEL 0U
|
|---|
| 75 | /*---------- -----------*/
|
|---|
| 76 | #define USBD_LPM_ENABLED 0U
|
|---|
| 77 | /*---------- -----------*/
|
|---|
| 78 | #define USBD_SELF_POWERED 1U
|
|---|
| 79 |
|
|---|
| 80 | /****************************************/
|
|---|
| 81 | /* #define for FS and HS identification */
|
|---|
| 82 | #define DEVICE_FS 0
|
|---|
| 83 |
|
|---|
| 84 | /**
|
|---|
| 85 | * @}
|
|---|
| 86 | */
|
|---|
| 87 |
|
|---|
| 88 | /** @defgroup USBD_CONF_Exported_Macros USBD_CONF_Exported_Macros
|
|---|
| 89 | * @brief Aliases.
|
|---|
| 90 | * @{
|
|---|
| 91 | */
|
|---|
| 92 |
|
|---|
| 93 | /* Memory management macros */
|
|---|
| 94 |
|
|---|
| 95 | /** Alias for memory allocation. */
|
|---|
| 96 | #define USBD_malloc (void *)USBD_static_malloc
|
|---|
| 97 |
|
|---|
| 98 | /** Alias for memory release. */
|
|---|
| 99 | #define USBD_free USBD_static_free
|
|---|
| 100 |
|
|---|
| 101 | /** Alias for memory set. */
|
|---|
| 102 | #define USBD_memset memset
|
|---|
| 103 |
|
|---|
| 104 | /** Alias for memory copy. */
|
|---|
| 105 | #define USBD_memcpy memcpy
|
|---|
| 106 |
|
|---|
| 107 | /** Alias for delay. */
|
|---|
| 108 | #define USBD_Delay HAL_Delay
|
|---|
| 109 |
|
|---|
| 110 | /* DEBUG macros */
|
|---|
| 111 |
|
|---|
| 112 | #if (USBD_DEBUG_LEVEL > 0)
|
|---|
| 113 | #define USBD_UsrLog(...) printf(__VA_ARGS__);\
|
|---|
| 114 | printf("\n");
|
|---|
| 115 | #else
|
|---|
| 116 | #define USBD_UsrLog(...)
|
|---|
| 117 | #endif
|
|---|
| 118 |
|
|---|
| 119 | #if (USBD_DEBUG_LEVEL > 1)
|
|---|
| 120 |
|
|---|
| 121 | #define USBD_ErrLog(...) printf("ERROR: ") ;\
|
|---|
| 122 | printf(__VA_ARGS__);\
|
|---|
| 123 | printf("\n");
|
|---|
| 124 | #else
|
|---|
| 125 | #define USBD_ErrLog(...)
|
|---|
| 126 | #endif
|
|---|
| 127 |
|
|---|
| 128 | #if (USBD_DEBUG_LEVEL > 2)
|
|---|
| 129 | #define USBD_DbgLog(...) printf("DEBUG : ") ;\
|
|---|
| 130 | printf(__VA_ARGS__);\
|
|---|
| 131 | printf("\n");
|
|---|
| 132 | #else
|
|---|
| 133 | #define USBD_DbgLog(...)
|
|---|
| 134 | #endif
|
|---|
| 135 |
|
|---|
| 136 | /**
|
|---|
| 137 | * @}
|
|---|
| 138 | */
|
|---|
| 139 |
|
|---|
| 140 | /** @defgroup USBD_CONF_Exported_Types USBD_CONF_Exported_Types
|
|---|
| 141 | * @brief Types.
|
|---|
| 142 | * @{
|
|---|
| 143 | */
|
|---|
| 144 |
|
|---|
| 145 | /**
|
|---|
| 146 | * @}
|
|---|
| 147 | */
|
|---|
| 148 |
|
|---|
| 149 | /** @defgroup USBD_CONF_Exported_FunctionsPrototype USBD_CONF_Exported_FunctionsPrototype
|
|---|
| 150 | * @brief Declaration of public functions for Usb device.
|
|---|
| 151 | * @{
|
|---|
| 152 | */
|
|---|
| 153 |
|
|---|
| 154 | /* Exported functions -------------------------------------------------------*/
|
|---|
| 155 | void *USBD_static_malloc(uint32_t size);
|
|---|
| 156 | void USBD_static_free(void *p);
|
|---|
| 157 |
|
|---|
| 158 | /**
|
|---|
| 159 | * @}
|
|---|
| 160 | */
|
|---|
| 161 |
|
|---|
| 162 | /**
|
|---|
| 163 | * @}
|
|---|
| 164 | */
|
|---|
| 165 |
|
|---|
| 166 | /**
|
|---|
| 167 | * @}
|
|---|
| 168 | */
|
|---|
| 169 |
|
|---|
| 170 | #ifdef __cplusplus
|
|---|
| 171 | }
|
|---|
| 172 | #endif
|
|---|
| 173 |
|
|---|
| 174 | #endif /* __USBD_CONF__H__ */
|
|---|
| 175 |
|
|---|