Lightweight USB stack  1.0
usb.h
1 /* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
2  *
3  * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  * http://www.apache.org/licenses/LICENSE-2.0
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef _USB_H_
17 #define _USB_H_
18 #if defined(__cplusplus)
19  extern "C" {
20 #endif
21 
22 #include "usbd_core.h"
23 #if !defined(__ASSEMBLER__)
24 #include "usb_std.h"
25 #endif
26 
27 #if defined(STM32L052xx) || defined(STM32L053xx) || \
28  defined(STM32L062xx) || defined(STM32L063xx) || \
29  defined(STM32L072xx) || defined(STM32L073xx) || \
30  defined(STM32L082xx) || defined(STM32L083xx) || \
31  defined(STM32F042x6) || defined(STM32F048xx) || \
32  defined(STM32F070x6) || defined(STM32F070xB) || \
33  defined(STM32F072xB) || defined(STM32F078xx)
34 
35  #define USBD_STM32L052
36 
37  #if !defined(__ASSEMBLER__)
38  extern const struct usbd_driver usbd_devfs;
39  extern const struct usbd_driver usbd_devfs_asm;
40  #if defined(USBD_ASM_DRIVER)
41  #define usbd_hw usbd_devfs_asm
42  #else
43  #define usbd_hw usbd_devfs
44  #endif
45  #endif
46 
47 #elif defined(STM32L432xx) || defined(STM32L433xx) || \
48  defined(STM32L442xx) || defined(STM32L443xx) || \
49  defined(STM32L452xx) || defined(STM32L462xx) || \
50  defined(STM32G4)
51 
52  #define USBD_STM32L433
53 
54  #if !defined(__ASSEMBLER__)
55  extern const struct usbd_driver usbd_devfs;
56  extern const struct usbd_driver usbd_devfs_asm;
57  #if defined(USBD_ASM_DRIVER)
58  #define usbd_hw usbd_devfs_asm
59  #else
60  #define usbd_hw usbd_devfs
61  #endif
62  #endif
63 
64 #elif defined(STM32L1)
65 
66  #define USBD_STM32L100
67 
68  #if !defined(__ASSEMBLER__)
69  extern const struct usbd_driver usbd_devfs;
70  extern const struct usbd_driver usbd_devfs_asm;
71  #if defined(USBD_ASM_DRIVER)
72  #define usbd_hw usbd_devfs_asm
73  #else
74  #define usbd_hw usbd_devfs
75  #endif
76  #endif
77 
78 #elif defined(STM32L475xx) || defined(STM32L476xx)
79 
80  #define USBD_STM32L476
81 
82  #if !defined(__ASSEMBLER__)
83  extern const struct usbd_driver usbd_otgfs;
84  #define usbd_hw usbd_otgfs
85  #endif
86 
87 #elif defined(STM32F405xx) || defined(STM32F415xx) || \
88  defined(STM32F407xx) || defined(STM32F417xx) || \
89  defined(STM32F427xx) || defined(STM32F437xx) || \
90  defined(STM32F429xx) || defined(STM32F439xx)
91 
92  #define USBD_STM32F429FS
93  #define USBD_STM32F429HS
94 
95  #if !defined(__ASSEMBLER__)
96  extern const struct usbd_driver usbd_otgfs;
97  extern const struct usbd_driver usbd_otghs;
98  #if defined(USBD_PRIMARY_OTGHS)
99  #define usbd_hw usbd_otghs
100  #else
101  #define usbd_hw usbd_otgfs
102  #endif
103  #endif //__ASSEMBLER__
104 
105 #elif defined(STM32F411xE)
106 
107  #define USBD_STM32F429FS
108  #if !defined(__ASSEMBLER__)
109  extern const struct usbd_driver usbd_otgfs;
110  #endif
111  #define usbd_hw usbd_otgfs
112 
113 #elif defined(STM32F446xx)
114  #define USBD_STM32F446FS
115  #define USBD_STM32F446HS
116 
117  #if !defined(__ASSEMBLER__)
118  extern const struct usbd_driver usbd_otgfs;
119  extern const struct usbd_driver usbd_otghs;
120  #if defined(USBD_PRIMARY_OTGHS)
121  #define usbd_hw usbd_otghs
122  #else
123  #define usbd_hw usbd_otgfs
124  #endif
125  #endif //__ASSEMBLER__
126 
127 #elif defined(STM32F102x6) || defined(STM32F102xB) || \
128  defined(STM32F103x6) || defined(STM32F103xB) || \
129  defined(STM32F103xE) || defined(STM32F103xG) || \
130  defined(STM32F302x8) || defined(STM32F302xC) || defined(STM32F302xE) || \
131  defined(STM32F303xC) || defined(STM32F303xE) || \
132  defined(STM32F373xC)
133 
134  #define USBD_STM32F103
135 
136  #if !defined(__ASSEMBLER__)
137  extern const struct usbd_driver usbd_devfs;
138  extern const struct usbd_driver usbd_devfs_asm;
139  #if defined(USBD_ASM_DRIVER)
140  #define usbd_hw usbd_devfs_asm
141  #else
142  #define usbd_hw usbd_devfs
143  #endif
144  #endif
145 
146 #elif defined(STM32F105xC) || defined(STM32F107xC)
147  #define USBD_STM32F105
148 
149  #if !defined(__ASSEMBLER__)
150  extern const struct usbd_driver usbd_otgfs;
151  #define usbd_hw usbd_otgfs
152  #endif
153 
154 #else
155  #error Unsupported STM32 family
156 #endif
157 
158 #if defined (__cplusplus)
159  }
160 #endif
161 #endif //_USB_H_
Represents a hardware USB driver call table.
Definition: usbd_core.h:307