usb.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. #if defined(STM32L052xx) || defined(STM32L053xx) || \
  21. defined(STM32L062xx) || defined(STM32L063xx) || \
  22. defined(STM32L072xx) || defined(STM32L073xx) || \
  23. defined(STM32L082xx) || defined(STM32L083xx) || \
  24. defined(STM32L432xx) || defined(STM32L433xx) || \
  25. defined(STM32L442xx) || defined(STM32L443xx) || \
  26. defined(STM32L452xx) || defined(STM32L462xx) || \
  27. defined(STM32F042x6) || defined(STM32F048xx) || \
  28. defined(STM32F070x6) || defined(STM32F070xB) || \
  29. defined(STM32F072xB) || defined(STM32F078xx) \
  30. #define USE_STMV0_DRIVER
  31. #if (defined(FORCE_ASM_DRIVER) || defined(STM32L052xx)) && !defined(FORCE_C_DRIVER)
  32. #define USE_STMV0A_DRIVER
  33. #endif
  34. #elif defined(STM32L1)
  35. #define USE_STMV1_DRIVER
  36. #if (defined(FORCE_ASM_DRIVER) || defined(STM32L100xC)) && !defined(FORCE_C_DRIVER)
  37. #define USE_STMV1A_DRIVER
  38. #endif
  39. #elif defined(STM32L476xx)
  40. #define USE_STMV2_DRIVER
  41. #elif defined(STM32F102x6) || defined(STM32F102xB) || \
  42. defined(STM32F103x6) || defined(STM32F103xB) || \
  43. defined(STM32F103xE) || defined(STM32F103xG) || \
  44. defined(STM32F302x8) || defined(STM32F302xC) || defined(STM32F302xE) || \
  45. defined(STM32F303xC) || defined(STM32F303xE) || \
  46. defined(STM32F373xC)
  47. #define USE_STMV3_DRIVER
  48. #if (defined(FORCE_ASM_DRIVER) || defined(STM32F103x6)) && !defined(FORCE_C_DRIVER)
  49. #define USE_STMV3A_DRIVER
  50. #endif
  51. #else
  52. #error Unsupported STM32 family
  53. #endif
  54. #include "inc/usbd_core.h"
  55. #if !defined(__ASSEMBLER__)
  56. #include "inc/usb_std.h"
  57. #if defined(USE_STMV0A_DRIVER)
  58. extern const struct usbd_driver usb_stmv0a;
  59. #define usbd_hw usb_stmv0a
  60. #elif defined(USE_STMV0_DRIVER)
  61. extern const struct usbd_driver usb_stmv0;
  62. #define usbd_hw usb_stmv0
  63. #elif defined(USE_STMV1A_DRIVER)
  64. extern const struct usbd_driver usb_stmv1a;
  65. #define usbd_hw usb_stmv1a
  66. #elif defined(USE_STMV1_DRIVER)
  67. extern const struct usbd_driver usb_stmv1;
  68. #define usbd_hw usb_stmv1
  69. #elif defined(USE_STMV2_DRIVER)
  70. extern const struct usbd_driver usb_stmv2;
  71. #define usbd_hw usb_stmv2
  72. #elif defined(USE_STMV3A_DRIVER)
  73. extern const struct usbd_driver usb_stmv3a;
  74. #define usbd_hw usb_stmv3a
  75. #elif defined(USE_STMV3_DRIVER)
  76. extern const struct usbd_driver usb_stmv3;
  77. #define usbd_hw usb_stmv3
  78. #endif
  79. #endif
  80. #if defined (__cplusplus)
  81. }
  82. #endif
  83. #endif //_USB_H_