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