1
0

usb.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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_STM32F429
  66. #if !defined(__ASSEMBLER__)
  67. extern const struct usbd_driver usbd_otgfs;
  68. #define usbd_hw usbd_otgfs
  69. #endif
  70. #elif defined(STM32F102x6) || defined(STM32F102xB) || \
  71. defined(STM32F103x6) || defined(STM32F103xB) || \
  72. defined(STM32F103xE) || defined(STM32F103xG) || \
  73. defined(STM32F302x8) || defined(STM32F302xC) || defined(STM32F302xE) || \
  74. defined(STM32F303xC) || defined(STM32F303xE) || \
  75. defined(STM32F373xC)
  76. #define USBD_STM32F103
  77. #if !defined(__ASSEMBLER__)
  78. extern const struct usbd_driver usbd_devfs;
  79. extern const struct usbd_driver usbd_devfs_asm;
  80. #if defined(USBD_ASM_DRIVER)
  81. #define usbd_hw usbd_devfs_asm
  82. #else
  83. #define usbd_hw usbd_devfs
  84. #endif
  85. #endif
  86. #elif defined(STM32F105xC) || defined(STM32F107xC)
  87. #define USBD_STM32F105
  88. #if !defined(__ASSEMBLER__)
  89. extern const struct usbd_driver usbd_otgfs;
  90. #define usbd_hw usbd_otgfs
  91. #endif
  92. #else
  93. #error Unsupported STM32 family
  94. #endif
  95. #if defined (__cplusplus)
  96. }
  97. #endif
  98. #endif //_USB_H_