1
0

usb.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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(STM32L432xx) || defined(STM32L433xx) || \
  29. defined(STM32L442xx) || defined(STM32L443xx) || \
  30. defined(STM32L452xx) || defined(STM32L462xx) || \
  31. defined(STM32F042x6) || defined(STM32F048xx) || \
  32. defined(STM32F070x6) || defined(STM32F070xB) || \
  33. defined(STM32F072xB) || defined(STM32F078xx)
  34. #define USBD_STM32L052
  35. #if !defined(__ASSEMBLER__)
  36. extern const struct usbd_driver usbd_devfs;
  37. extern const struct usbd_driver usbd_devfs_asm;
  38. #if defined(USBD_ASM_DRIVER)
  39. #define usbd_hw usbd_devfs_asm
  40. #else
  41. #define usbd_hw usbd_devfs
  42. #endif
  43. #endif
  44. #elif defined(STM32L1)
  45. #define USBD_STM32L100
  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(STM32L475xx) || defined(STM32L476xx)
  56. #define USBD_STM32L476
  57. #if !defined(__ASSEMBLER__)
  58. extern const struct usbd_driver usbd_otgfs;
  59. #define usbd_hw usbd_otgfs
  60. #endif
  61. #elif defined(STM32F405xx) || defined(STM32F415xx) || \
  62. defined(STM32F407xx) || defined(STM32F417xx) || \
  63. defined(STM32F427xx) || defined(STM32F437xx) || \
  64. defined(STM32F429xx) || defined(STM32F439xx)
  65. #define USBD_STM32F429FS
  66. #define USBD_STM32F429HS
  67. #if !defined(__ASSEMBLER__)
  68. extern const struct usbd_driver usbd_otgfs;
  69. extern const struct usbd_driver usbd_otghs;
  70. #if defined(USBD_PRIMARY_OTGHS)
  71. #define usbd_hw usbd_otghs
  72. #else
  73. #define usbd_hw usbd_otgfs
  74. #endif
  75. #endif //__ASSEMBLER__
  76. #elif defined(STM32F102x6) || defined(STM32F102xB) || \
  77. defined(STM32F103x6) || defined(STM32F103xB) || \
  78. defined(STM32F103xE) || defined(STM32F103xG) || \
  79. defined(STM32F302x8) || defined(STM32F302xC) || defined(STM32F302xE) || \
  80. defined(STM32F303xC) || defined(STM32F303xE) || \
  81. defined(STM32F373xC)
  82. #define USBD_STM32F103
  83. #if !defined(__ASSEMBLER__)
  84. extern const struct usbd_driver usbd_devfs;
  85. extern const struct usbd_driver usbd_devfs_asm;
  86. #if defined(USBD_ASM_DRIVER)
  87. #define usbd_hw usbd_devfs_asm
  88. #else
  89. #define usbd_hw usbd_devfs
  90. #endif
  91. #endif
  92. #elif defined(STM32F105xC) || defined(STM32F107xC)
  93. #define USBD_STM32F105
  94. #if !defined(__ASSEMBLER__)
  95. extern const struct usbd_driver usbd_otgfs;
  96. #define usbd_hw usbd_otgfs
  97. #endif
  98. #else
  99. #error Unsupported STM32 family
  100. #endif
  101. #if defined (__cplusplus)
  102. }
  103. #endif
  104. #endif //_USB_H_