Driver_USART.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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_USART.h"
  19. #define ARM_USART_DRV_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(1, 0) /* driver version */
  20. /* Driver Version */
  21. static const ARM_DRIVER_VERSION DriverVersion = {
  22. ARM_USART_API_VERSION,
  23. ARM_USART_DRV_VERSION
  24. };
  25. /* Driver Capabilities */
  26. static const ARM_USART_CAPABILITIES DriverCapabilities = {
  27. 1, /* supports UART (Asynchronous) mode */
  28. 0, /* supports Synchronous Master mode */
  29. 0, /* supports Synchronous Slave mode */
  30. 0, /* supports UART Single-wire mode */
  31. 0, /* supports UART IrDA mode */
  32. 0, /* supports UART Smart Card mode */
  33. 0, /* Smart Card Clock generator available */
  34. 0, /* RTS Flow Control available */
  35. 0, /* CTS Flow Control available */
  36. 0, /* Transmit completed event: \ref ARM_USART_EVENT_TX_COMPLETE */
  37. 0, /* Signal receive character timeout event: \ref ARM_USART_EVENT_RX_TIMEOUT */
  38. 0, /* RTS Line: 0=not available, 1=available */
  39. 0, /* CTS Line: 0=not available, 1=available */
  40. 0, /* DTR Line: 0=not available, 1=available */
  41. 0, /* DSR Line: 0=not available, 1=available */
  42. 0, /* DCD Line: 0=not available, 1=available */
  43. 0, /* RI Line: 0=not available, 1=available */
  44. 0, /* Signal CTS change event: \ref ARM_USART_EVENT_CTS */
  45. 0, /* Signal DSR change event: \ref ARM_USART_EVENT_DSR */
  46. 0, /* Signal DCD change event: \ref ARM_USART_EVENT_DCD */
  47. 0, /* Signal RI change event: \ref ARM_USART_EVENT_RI */
  48. 0 /* Reserved (must be zero) */
  49. };
  50. //
  51. // Functions
  52. //
  53. static ARM_DRIVER_VERSION ARM_USART_GetVersion(void)
  54. {
  55. return DriverVersion;
  56. }
  57. static ARM_USART_CAPABILITIES ARM_USART_GetCapabilities(void)
  58. {
  59. return DriverCapabilities;
  60. }
  61. static int32_t ARM_USART_Initialize(ARM_USART_SignalEvent_t cb_event)
  62. {
  63. }
  64. static int32_t ARM_USART_Uninitialize(void)
  65. {
  66. }
  67. static int32_t ARM_USART_PowerControl(ARM_POWER_STATE state)
  68. {
  69. switch (state)
  70. {
  71. case ARM_POWER_OFF:
  72. break;
  73. case ARM_POWER_LOW:
  74. break;
  75. case ARM_POWER_FULL:
  76. break;
  77. }
  78. return ARM_DRIVER_OK;
  79. }
  80. static int32_t ARM_USART_Send(const void *data, uint32_t num)
  81. {
  82. }
  83. static int32_t ARM_USART_Receive(void *data, uint32_t num)
  84. {
  85. }
  86. static int32_t ARM_USART_Transfer(const void *data_out, void *data_in, uint32_t num)
  87. {
  88. }
  89. static uint32_t ARM_USART_GetTxCount(void)
  90. {
  91. }
  92. static uint32_t ARM_USART_GetRxCount(void)
  93. {
  94. }
  95. static int32_t ARM_USART_Control(uint32_t control, uint32_t arg)
  96. {
  97. }
  98. static ARM_USART_STATUS ARM_USART_GetStatus(void)
  99. {
  100. }
  101. static int32_t ARM_USART_SetModemControl(ARM_USART_MODEM_CONTROL control)
  102. {
  103. }
  104. static ARM_USART_MODEM_STATUS ARM_USART_GetModemStatus(void)
  105. {
  106. }
  107. static void ARM_USART_SignalEvent(uint32_t event)
  108. {
  109. // function body
  110. }
  111. // End USART Interface
  112. extern \
  113. ARM_DRIVER_USART Driver_USART0;
  114. ARM_DRIVER_USART Driver_USART0 = {
  115. ARM_USART_GetVersion,
  116. ARM_USART_GetCapabilities,
  117. ARM_USART_Initialize,
  118. ARM_USART_Uninitialize,
  119. ARM_USART_PowerControl,
  120. ARM_USART_Send,
  121. ARM_USART_Receive,
  122. ARM_USART_Transfer,
  123. ARM_USART_GetTxCount,
  124. ARM_USART_GetRxCount,
  125. ARM_USART_Control,
  126. ARM_USART_GetStatus,
  127. ARM_USART_SetModemControl,
  128. ARM_USART_GetModemStatus
  129. };