xref: /btstack/port/stm32-f4discovery-usb/USB_HOST/Target/usbh_conf.h (revision a8f7f3fcbcd51f8d2e92aca076b6a9f812db358c)
1 /* USER CODE BEGIN Header */
2 /**
3   ******************************************************************************
4   * @file           : Target/usbh_conf.h
5   * @version        : v1.0_Cube
6   * @brief          : Header for usbh_conf.c file.
7   ******************************************************************************
8   * @attention
9   *
10   * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
11   * All rights reserved.</center></h2>
12   *
13   * This software component is licensed by ST under Ultimate Liberty license
14   * SLA0044, the "License"; You may not use this file except in compliance with
15   * the License. You may obtain a copy of the License at:
16   *                             www.st.com/SLA0044
17   *
18   ******************************************************************************
19   */
20 /* USER CODE END Header */
21 
22 /* Define to prevent recursive inclusion -------------------------------------*/
23 #ifndef __USBH_CONF__H__
24 #define __USBH_CONF__H__
25 #ifdef __cplusplus
26  extern "C" {
27 #endif
28 /* Includes ------------------------------------------------------------------*/
29 
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <string.h>
33 #include "main.h"
34 
35 #include "stm32f4xx.h"
36 #include "stm32f4xx_hal.h"
37 
38 /* USER CODE BEGIN INCLUDE */
39 
40 /* USER CODE END INCLUDE */
41 
42 /** @addtogroup STM32_USB_HOST_LIBRARY
43   * @{
44   */
45 
46 /** @defgroup USBH_CONF
47   * @brief usb host low level driver configuration file
48   * @{
49   */
50 
51 /** @defgroup USBH_CONF_Exported_Variables USBH_CONF_Exported_Variables
52   * @brief Public variables.
53   * @{
54   */
55 
56 /**
57   * @}
58   */
59 
60 /** @defgroup USBH_CONF_Exported_Defines USBH_CONF_Exported_Defines
61   * @brief Defines for configuration of the Usb host.
62   * @{
63   */
64 
65 /*----------   -----------*/
66 #define USBH_MAX_NUM_ENDPOINTS      4U
67 
68 /*----------   -----------*/
69 #define USBH_MAX_NUM_INTERFACES      2U
70 
71 /*----------   -----------*/
72 #define USBH_MAX_NUM_CONFIGURATION      1U
73 
74 /*----------   -----------*/
75 #define USBH_KEEP_CFG_DESCRIPTOR      1U
76 
77 /*----------   -----------*/
78 #define USBH_MAX_NUM_SUPPORTED_CLASS      1U
79 
80 /*----------   -----------*/
81 #define USBH_MAX_SIZE_CONFIGURATION      256U
82 
83 /*----------   -----------*/
84 #define USBH_MAX_DATA_BUFFER      512U
85 
86 /*----------   -----------*/
87 #define USBH_DEBUG_LEVEL      3U
88 
89 /*----------   -----------*/
90 #define USBH_USE_OS      0U
91 
92 /****************************************/
93 /* #define for FS and HS identification */
94 #define HOST_HS 		0
95 #define HOST_FS 		1
96 
97 #if (USBH_USE_OS == 1)
98   #include "cmsis_os.h"
99   #define USBH_PROCESS_PRIO          osPriorityNormal
100   #define USBH_PROCESS_STACK_SIZE    ((uint16_t)0)
101 #endif /* (USBH_USE_OS == 1) */
102 
103 /**
104   * @}
105   */
106 
107 /** @defgroup USBH_CONF_Exported_Macros USBH_CONF_Exported_Macros
108   * @brief Aliases.
109   * @{
110   */
111 
112 /* Memory management macros */
113 
114 /** Alias for memory allocation. */
115 #define USBH_malloc         malloc
116 
117 /** Alias for memory release. */
118 #define USBH_free           free
119 
120 /** Alias for memory set. */
121 #define USBH_memset         memset
122 
123 /** Alias for memory copy. */
124 #define USBH_memcpy         memcpy
125 
126 /* DEBUG macros */
127 
128 #if (USBH_DEBUG_LEVEL > 0U)
129 #define  USBH_UsrLog(...)   do { \
130                             printf(__VA_ARGS__); \
131                             printf("\n"); \
132 } while (0)
133 #else
134 #define USBH_UsrLog(...) do {} while (0)
135 #endif
136 
137 #if (USBH_DEBUG_LEVEL > 1U)
138 
139 #define  USBH_ErrLog(...) do { \
140                             printf("ERROR: ") ; \
141                             printf(__VA_ARGS__); \
142                             printf("\n"); \
143 } while (0)
144 #else
145 #define USBH_ErrLog(...) do {} while (0)
146 #endif
147 
148 #if (USBH_DEBUG_LEVEL > 2U)
149 #define  USBH_DbgLog(...)   do { \
150                             printf("DEBUG : ") ; \
151                             printf(__VA_ARGS__); \
152                             printf("\n"); \
153 } while (0)
154 #else
155 #define USBH_DbgLog(...) do {} while (0)
156 #endif
157 
158 /**
159   * @}
160   */
161 
162 /** @defgroup USBH_CONF_Exported_Types USBH_CONF_Exported_Types
163   * @brief Types.
164   * @{
165   */
166 
167 /**
168   * @}
169   */
170 
171 /** @defgroup USBH_CONF_Exported_FunctionsPrototype USBH_CONF_Exported_FunctionsPrototype
172   * @brief Declaration of public functions for Usb host.
173   * @{
174   */
175 
176 /* Exported functions -------------------------------------------------------*/
177 
178 /**
179   * @}
180   */
181 
182 /**
183   * @}
184   */
185 
186 /**
187   * @}
188   */
189 
190 #ifdef __cplusplus
191 }
192 #endif
193 
194 #endif /* __USBH_CONF__H__ */
195 
196 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
197