Driver_USBD.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. * Copyright (c) 2013-2020 Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the License); you may
  7. * not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  14. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. #include "Driver_USBD.h"
  19. #define ARM_USBD_DRV_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(1, 0) /* driver version */
  20. /* Driver Version */
  21. static const ARM_DRIVER_VERSION usbd_driver_version = {
  22. ARM_USBD_API_VERSION,
  23. ARM_USBD_DRV_VERSION
  24. };
  25. /* Driver Capabilities */
  26. static const ARM_USBD_CAPABILITIES usbd_driver_capabilities = {
  27. 0, /* vbus_detection */
  28. 0, /* event_vbus_on */
  29. 0, /* event_vbus_off */
  30. 0 /* reserved */
  31. };
  32. //
  33. // Functions
  34. //
  35. static ARM_DRIVER_VERSION ARM_USBD_GetVersion(void)
  36. {
  37. return usbd_driver_version;
  38. }
  39. static ARM_USBD_CAPABILITIES ARM_USBD_GetCapabilities(void)
  40. {
  41. return usbd_driver_capabilities;
  42. }
  43. static int32_t ARM_USBD_Initialize(ARM_USBD_SignalDeviceEvent_t cb_device_event,
  44. ARM_USBD_SignalEndpointEvent_t cb_endpoint_event)
  45. {
  46. }
  47. static int32_t ARM_USBD_Uninitialize(void)
  48. {
  49. }
  50. static int32_t ARM_USBD_PowerControl(ARM_POWER_STATE state)
  51. {
  52. switch (state)
  53. {
  54. case ARM_POWER_OFF:
  55. break;
  56. case ARM_POWER_LOW:
  57. break;
  58. case ARM_POWER_FULL:
  59. break;
  60. }
  61. return ARM_DRIVER_OK;
  62. }
  63. static int32_t ARM_USBD_DeviceConnect(void)
  64. {
  65. }
  66. static int32_t ARM_USBD_DeviceDisconnect(void)
  67. {
  68. }
  69. static ARM_USBD_STATE ARM_USBD_DeviceGetState(void)
  70. {
  71. }
  72. static int32_t ARM_USBD_DeviceRemoteWakeup(void)
  73. {
  74. }
  75. static int32_t ARM_USBD_DeviceSetAddress(uint8_t dev_addr)
  76. {
  77. }
  78. static int32_t ARM_USBD_ReadSetupPacket(uint8_t *setup)
  79. {
  80. }
  81. static int32_t ARM_USBD_EndpointConfigure(uint8_t ep_addr,
  82. uint8_t ep_type,
  83. uint16_t ep_max_packet_size)
  84. {
  85. }
  86. static int32_t ARM_USBD_EndpointUnconfigure(uint8_t ep_addr)
  87. {
  88. }
  89. static int32_t ARM_USBD_EndpointStall(uint8_t ep_addr, bool stall)
  90. {
  91. }
  92. static int32_t ARM_USBD_EndpointTransfer(uint8_t ep_addr, uint8_t *data, uint32_t num)
  93. {
  94. }
  95. static uint32_t ARM_USBD_EndpointTransferGetResult(uint8_t ep_addr)
  96. {
  97. }
  98. static int32_t ARM_USBD_EndpointTransferAbort(uint8_t ep_addr)
  99. {
  100. }
  101. static uint16_t ARM_USBD_GetFrameNumber(void)
  102. {
  103. }
  104. static void ARM_USBD_SignalDeviceEvent(uint32_t event)
  105. {
  106. // function body
  107. }
  108. static void ARM_USBD_SignalEndpointEvent(uint8_t ep_addr, uint32_t ep_event)
  109. {
  110. // function body
  111. }
  112. // End USBD Interface
  113. extern \
  114. ARM_DRIVER_USBD Driver_USBD0;
  115. ARM_DRIVER_USBD Driver_USBD0 =
  116. {
  117. ARM_USBD_GetVersion,
  118. ARM_USBD_GetCapabilities,
  119. ARM_USBD_Initialize,
  120. ARM_USBD_Uninitialize,
  121. ARM_USBD_PowerControl,
  122. ARM_USBD_DeviceConnect,
  123. ARM_USBD_DeviceDisconnect,
  124. ARM_USBD_DeviceGetState,
  125. ARM_USBD_DeviceRemoteWakeup,
  126. ARM_USBD_DeviceSetAddress,
  127. ARM_USBD_ReadSetupPacket,
  128. ARM_USBD_EndpointConfigure,
  129. ARM_USBD_EndpointUnconfigure,
  130. ARM_USBD_EndpointStall,
  131. ARM_USBD_EndpointTransfer,
  132. ARM_USBD_EndpointTransferGetResult,
  133. ARM_USBD_EndpointTransferAbort,
  134. ARM_USBD_GetFrameNumber
  135. };