Driver_USBH.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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_USBH.h"
  19. /* USB Host Driver */
  20. #define ARM_USBH_DRV_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(1, 0) /* driver version */
  21. /* Driver Version */
  22. static const ARM_DRIVER_VERSION usbh_driver_version = {
  23. ARM_USBH_API_VERSION,
  24. ARM_USBH_DRV_VERSION
  25. };
  26. /* Driver Capabilities */
  27. static const ARM_USBH_CAPABILITIES usbd_driver_capabilities = {
  28. 0x0001, /* Root HUB available Ports Mask */
  29. 0, /* Automatic SPLIT packet handling */
  30. 0, /* Signal Connect event */
  31. 0, /* Signal Disconnect event */
  32. 0, /* Signal Overcurrent event */
  33. 0 /* Reserved (must be zero) */
  34. };
  35. //
  36. // Functions
  37. //
  38. static ARM_DRIVER_VERSION ARM_USBH_GetVersion(void)
  39. {
  40. return usbh_driver_version;
  41. }
  42. static ARM_USBH_CAPABILITIES ARM_USBH_GetCapabilities(void)
  43. {
  44. return usbd_driver_capabilities;
  45. }
  46. static int32_t ARM_USBH_Initialize(ARM_USBH_SignalPortEvent_t cb_port_event,
  47. ARM_USBH_SignalPipeEvent_t cb_pipe_event)
  48. {
  49. }
  50. static int32_t ARM_USBH_Uninitialize(void)
  51. {
  52. }
  53. static int32_t ARM_USBH_PowerControl(ARM_POWER_STATE state)
  54. {
  55. switch (state)
  56. {
  57. case ARM_POWER_OFF:
  58. break;
  59. case ARM_POWER_LOW:
  60. break;
  61. case ARM_POWER_FULL:
  62. break;
  63. }
  64. return ARM_DRIVER_OK;
  65. }
  66. static int32_t ARM_USBH_PortVbusOnOff(uint8_t port, bool vbus)
  67. {
  68. }
  69. static int32_t ARM_USBH_PortReset(uint8_t port)
  70. {
  71. }
  72. static int32_t ARM_USBH_PortSuspend(uint8_t port)
  73. {
  74. }
  75. static int32_t ARM_USBH_PortResume(uint8_t port)
  76. {
  77. }
  78. static ARM_USBH_PORT_STATE ARM_USBH_PortGetState(uint8_t port)
  79. {
  80. }
  81. static ARM_USBH_PIPE_HANDLE ARM_USBH_PipeCreate(uint8_t dev_addr,
  82. uint8_t dev_speed,
  83. uint8_t hub_addr,
  84. uint8_t hub_port,
  85. uint8_t ep_addr,
  86. uint8_t ep_type,
  87. uint16_t ep_max_packet_size,
  88. uint8_t ep_interval)
  89. {
  90. }
  91. static int32_t ARM_USBH_PipeModify(ARM_USBH_PIPE_HANDLE pipe_hndl,
  92. uint8_t dev_addr,
  93. uint8_t dev_speed,
  94. uint8_t hub_addr,
  95. uint8_t hub_port,
  96. uint16_t ep_max_packet_size)
  97. {
  98. }
  99. static int32_t ARM_USBH_PipeDelete(ARM_USBH_PIPE_HANDLE pipe_hndl)
  100. {
  101. }
  102. static int32_t ARM_USBH_PipeReset(ARM_USBH_PIPE_HANDLE pipe_hndl)
  103. {
  104. }
  105. static int32_t ARM_USBH_PipeTransfer(ARM_USBH_PIPE_HANDLE pipe_hndl,
  106. uint32_t packet,
  107. uint8_t *data,
  108. uint32_t num)
  109. {
  110. }
  111. static uint32_t ARM_USBH_PipeTransferGetResult(ARM_USBH_PIPE_HANDLE pipe_hndl)
  112. {
  113. }
  114. static int32_t ARM_USBH_PipeTransferAbort(ARM_USBH_PIPE_HANDLE pipe_hndl)
  115. {
  116. }
  117. static uint16_t ARM_USBH_GetFrameNumber(void)
  118. {
  119. }
  120. static void ARM_USBH_SignalPortEvent(uint8_t port, uint32_t event)
  121. {
  122. // function body
  123. }
  124. static void ARM_USBH_SignalPipeEvent(ARM_USBH_PIPE_HANDLE pipe_hndl, uint32_t event)
  125. {
  126. // function body
  127. }
  128. // End USBH Interface
  129. extern \
  130. ARM_DRIVER_USBH Driver_USBH0;
  131. ARM_DRIVER_USBH Driver_USBH0 = {
  132. ARM_USBH_GetVersion,
  133. ARM_USBH_GetCapabilities,
  134. ARM_USBH_Initialize,
  135. ARM_USBH_Uninitialize,
  136. ARM_USBH_PowerControl,
  137. ARM_USBH_PortVbusOnOff,
  138. ARM_USBH_PortReset,
  139. ARM_USBH_PortSuspend,
  140. ARM_USBH_PortResume,
  141. ARM_USBH_PortGetState,
  142. ARM_USBH_PipeCreate,
  143. ARM_USBH_PipeModify,
  144. ARM_USBH_PipeDelete,
  145. ARM_USBH_PipeReset,
  146. ARM_USBH_PipeTransfer,
  147. ARM_USBH_PipeTransferGetResult,
  148. ARM_USBH_PipeTransferAbort,
  149. ARM_USBH_GetFrameNumber
  150. };