usb.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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(STM32F429xx)
  62. #define USBD_STM32F429
  63. #if !defined(__ASSEMBLER__)
  64. extern const struct usbd_driver usbd_otgfs;
  65. #define usbd_hw usbd_otgfs
  66. #endif
  67. #elif defined(STM32F102x6) || defined(STM32F102xB) || \
  68. defined(STM32F103x6) || defined(STM32F103xB) || \
  69. defined(STM32F103xE) || defined(STM32F103xG) || \
  70. defined(STM32F302x8) || defined(STM32F302xC) || defined(STM32F302xE) || \
  71. defined(STM32F303xC) || defined(STM32F303xE) || \
  72. defined(STM32F373xC)
  73. #define USBD_STM32F103
  74. #if !defined(__ASSEMBLER__)
  75. extern const struct usbd_driver usbd_devfs;
  76. extern const struct usbd_driver usbd_devfs_asm;
  77. #if defined(USBD_ASM_DRIVER)
  78. #define usbd_hw usbd_devfs_asm
  79. #else
  80. #define usbd_hw usbd_devfs
  81. #endif
  82. #endif
  83. #else
  84. #error Unsupported STM32 family
  85. #endif
  86. #if defined (__cplusplus)
  87. }
  88. #endif
  89. #endif //_USB_H_