1
0

usb.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. #ifndef _USB_H_
  16. #define _USB_H_
  17. #if defined(__cplusplus)
  18. extern "C" {
  19. #endif
  20. #include "usbd_core.h"
  21. #if !defined(__ASSEMBLER__)
  22. #include "usb_std.h"
  23. #endif
  24. #if defined(STM32L052xx) || defined(STM32L053xx) || \
  25. defined(STM32L062xx) || defined(STM32L063xx) || \
  26. defined(STM32L072xx) || defined(STM32L073xx) || \
  27. defined(STM32L082xx) || defined(STM32L083xx) || \
  28. defined(STM32F042x6) || defined(STM32F048xx) || \
  29. defined(STM32F070x6) || defined(STM32F070xB) || \
  30. defined(STM32F072xB) || defined(STM32F078xx)
  31. #define USBD_STM32L052
  32. #if !defined(__ASSEMBLER__)
  33. extern const struct usbd_driver usbd_devfs;
  34. extern const struct usbd_driver usbd_devfs_asm;
  35. #if defined(USBD_ASM_DRIVER)
  36. #define usbd_hw usbd_devfs_asm
  37. #else
  38. #define usbd_hw usbd_devfs
  39. #endif
  40. #endif
  41. #elif defined(STM32L432xx) || defined(STM32L433xx) || \
  42. defined(STM32L442xx) || defined(STM32L443xx) || \
  43. defined(STM32L452xx) || defined(STM32L462xx) || \
  44. defined(STM32G4)
  45. #define USBD_STM32L433
  46. #if !defined(__ASSEMBLER__)
  47. extern const struct usbd_driver usbd_devfs;
  48. extern const struct usbd_driver usbd_devfs_asm;
  49. #if defined(USBD_ASM_DRIVER)
  50. #define usbd_hw usbd_devfs_asm
  51. #else
  52. #define usbd_hw usbd_devfs
  53. #endif
  54. #endif
  55. #elif defined(STM32L1)
  56. #define USBD_STM32L100
  57. #if !defined(__ASSEMBLER__)
  58. extern const struct usbd_driver usbd_devfs;
  59. extern const struct usbd_driver usbd_devfs_asm;
  60. #if defined(USBD_ASM_DRIVER)
  61. #define usbd_hw usbd_devfs_asm
  62. #else
  63. #define usbd_hw usbd_devfs
  64. #endif
  65. #endif
  66. #elif defined(STM32L475xx) || defined(STM32L476xx)
  67. #define USBD_STM32L476
  68. #if !defined(__ASSEMBLER__)
  69. extern const struct usbd_driver usbd_otgfs;
  70. #define usbd_hw usbd_otgfs
  71. #endif
  72. #elif defined(STM32F405xx) || defined(STM32F415xx) || \
  73. defined(STM32F407xx) || defined(STM32F417xx) || \
  74. defined(STM32F427xx) || defined(STM32F437xx) || \
  75. defined(STM32F429xx) || defined(STM32F439xx)
  76. #define USBD_STM32F429FS
  77. #define USBD_STM32F429HS
  78. #if !defined(__ASSEMBLER__)
  79. extern const struct usbd_driver usbd_otgfs;
  80. extern const struct usbd_driver usbd_otghs;
  81. #if defined(USBD_PRIMARY_OTGHS)
  82. #define usbd_hw usbd_otghs
  83. #else
  84. #define usbd_hw usbd_otgfs
  85. #endif
  86. #endif //__ASSEMBLER__
  87. #elif defined(STM32F411xE) || defined(STM32F401xC) || defined(STM32F401xE)
  88. #define USBD_STM32F429FS
  89. #if !defined(__ASSEMBLER__)
  90. extern const struct usbd_driver usbd_otgfs;
  91. #endif
  92. #define usbd_hw usbd_otgfs
  93. #elif defined(STM32F446xx)
  94. #define USBD_STM32F446FS
  95. #define USBD_STM32F446HS
  96. #if !defined(__ASSEMBLER__)
  97. extern const struct usbd_driver usbd_otgfs;
  98. extern const struct usbd_driver usbd_otghs;
  99. #if defined(USBD_PRIMARY_OTGHS)
  100. #define usbd_hw usbd_otghs
  101. #else
  102. #define usbd_hw usbd_otgfs
  103. #endif
  104. #endif //__ASSEMBLER__
  105. #elif defined(STM32F102x6) || defined(STM32F102xB) || \
  106. defined(STM32F103x6) || defined(STM32F103xB) || \
  107. defined(STM32F103xE) || defined(STM32F103xG) || \
  108. defined(STM32F302x8) || defined(STM32F302xC) || defined(STM32F302xE) || \
  109. defined(STM32F303xC) || defined(STM32F303xE) || \
  110. defined(STM32F373xC)
  111. #define USBD_STM32F103
  112. #if !defined(__ASSEMBLER__)
  113. extern const struct usbd_driver usbd_devfs;
  114. extern const struct usbd_driver usbd_devfs_asm;
  115. #if defined(USBD_ASM_DRIVER)
  116. #define usbd_hw usbd_devfs_asm
  117. #else
  118. #define usbd_hw usbd_devfs
  119. #endif
  120. #endif
  121. #elif defined(STM32F105xC) || defined(STM32F107xC)
  122. #define USBD_STM32F105
  123. #if !defined(__ASSEMBLER__)
  124. extern const struct usbd_driver usbd_otgfs;
  125. #define usbd_hw usbd_otgfs
  126. #endif
  127. #else
  128. #error Unsupported STM32 family
  129. #endif
  130. #if defined (__cplusplus)
  131. }
  132. #endif
  133. #endif //_USB_H_