usb.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. #define USBD_STM32L433
  45. #if !defined(__ASSEMBLER__)
  46. extern const struct usbd_driver usbd_devfs;
  47. //extern const struct usbd_driver usbd_devfs_asm;
  48. //#if defined(USBD_ASM_DRIVER)
  49. //#define usbd_hw usbd_devfs_asm
  50. //#else
  51. //#define usbd_hw usbd_devfs
  52. //#endif
  53. #endif
  54. #elif defined(STM32L1)
  55. #define USBD_STM32L100
  56. #if !defined(__ASSEMBLER__)
  57. extern const struct usbd_driver usbd_devfs;
  58. extern const struct usbd_driver usbd_devfs_asm;
  59. #if defined(USBD_ASM_DRIVER)
  60. #define usbd_hw usbd_devfs_asm
  61. #else
  62. #define usbd_hw usbd_devfs
  63. #endif
  64. #endif
  65. #elif defined(STM32L475xx) || defined(STM32L476xx)
  66. #define USBD_STM32L476
  67. #if !defined(__ASSEMBLER__)
  68. extern const struct usbd_driver usbd_otgfs;
  69. #define usbd_hw usbd_otgfs
  70. #endif
  71. #elif defined(STM32F405xx) || defined(STM32F415xx) || \
  72. defined(STM32F407xx) || defined(STM32F417xx) || \
  73. defined(STM32F427xx) || defined(STM32F437xx) || \
  74. defined(STM32F429xx) || defined(STM32F439xx)
  75. #define USBD_STM32F429FS
  76. #define USBD_STM32F429HS
  77. #if !defined(__ASSEMBLER__)
  78. extern const struct usbd_driver usbd_otgfs;
  79. extern const struct usbd_driver usbd_otghs;
  80. #if defined(USBD_PRIMARY_OTGHS)
  81. #define usbd_hw usbd_otghs
  82. #else
  83. #define usbd_hw usbd_otgfs
  84. #endif
  85. #endif //__ASSEMBLER__
  86. #elif defined(STM32F102x6) || defined(STM32F102xB) || \
  87. defined(STM32F103x6) || defined(STM32F103xB) || \
  88. defined(STM32F103xE) || defined(STM32F103xG) || \
  89. defined(STM32F302x8) || defined(STM32F302xC) || defined(STM32F302xE) || \
  90. defined(STM32F303xC) || defined(STM32F303xE) || \
  91. defined(STM32F373xC)
  92. #define USBD_STM32F103
  93. #if !defined(__ASSEMBLER__)
  94. extern const struct usbd_driver usbd_devfs;
  95. extern const struct usbd_driver usbd_devfs_asm;
  96. #if defined(USBD_ASM_DRIVER)
  97. #define usbd_hw usbd_devfs_asm
  98. #else
  99. #define usbd_hw usbd_devfs
  100. #endif
  101. #endif
  102. #elif defined(STM32F105xC) || defined(STM32F107xC)
  103. #define USBD_STM32F105
  104. #if !defined(__ASSEMBLER__)
  105. extern const struct usbd_driver usbd_otgfs;
  106. #define usbd_hw usbd_otgfs
  107. #endif
  108. #else
  109. #error Unsupported STM32 family
  110. #endif
  111. #if defined (__cplusplus)
  112. }
  113. #endif
  114. #endif //_USB_H_