Driver_I2C.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * Copyright (c) 2013-2018 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_I2C.h"
  19. #define ARM_I2C_DRV_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(2, 0) /* driver version */
  20. /* Driver Version */
  21. static const ARM_DRIVER_VERSION DriverVersion = {
  22. ARM_I2C_API_VERSION,
  23. ARM_I2C_DRV_VERSION
  24. };
  25. /* Driver Capabilities */
  26. static const ARM_I2C_CAPABILITIES DriverCapabilities = {
  27. 0 /* supports 10-bit addressing */
  28. };
  29. //
  30. // Functions
  31. //
  32. ARM_DRIVER_VERSION ARM_I2C_GetVersion(void)
  33. {
  34. }
  35. ARM_I2C_CAPABILITIES ARM_I2C_GetCapabilities(void)
  36. {
  37. }
  38. int32_t ARM_I2C_Initialize(ARM_I2C_SignalEvent_t cb_event)
  39. {
  40. }
  41. int32_t ARM_I2C_Uninitialize(void)
  42. {
  43. }
  44. int32_t ARM_I2C_PowerControl(ARM_POWER_STATE state)
  45. {
  46. switch (state)
  47. {
  48. case ARM_POWER_OFF:
  49. break;
  50. case ARM_POWER_LOW:
  51. break;
  52. case ARM_POWER_FULL:
  53. break;
  54. default:
  55. return ARM_DRIVER_ERROR_UNSUPPORTED;
  56. }
  57. }
  58. int32_t ARM_I2C_MasterTransmit(uint32_t addr, const uint8_t *data, uint32_t num, bool xfer_pending)
  59. {
  60. }
  61. int32_t ARM_I2C_MasterReceive(uint32_t addr, uint8_t *data, uint32_t num, bool xfer_pending)
  62. {
  63. }
  64. int32_t ARM_I2C_SlaveTransmit(const uint8_t *data, uint32_t num)
  65. {
  66. }
  67. int32_t ARM_I2C_SlaveReceive(uint8_t *data, uint32_t num)
  68. {
  69. }
  70. int32_t ARM_I2C_GetDataCount(void)
  71. {
  72. }
  73. int32_t ARM_I2C_Control(uint32_t control, uint32_t arg)
  74. {
  75. switch (control)
  76. {
  77. case ARM_I2C_OWN_ADDRESS:
  78. break;
  79. case ARM_I2C_BUS_SPEED:
  80. switch (arg)
  81. {
  82. case ARM_I2C_BUS_SPEED_STANDARD:
  83. break;
  84. case ARM_I2C_BUS_SPEED_FAST:
  85. break;
  86. case ARM_I2C_BUS_SPEED_FAST_PLUS:
  87. break;
  88. default:
  89. return ARM_DRIVER_ERROR_UNSUPPORTED;
  90. }
  91. break;
  92. case ARM_I2C_BUS_CLEAR:
  93. break;
  94. case ARM_I2C_ABORT_TRANSFER:
  95. break;
  96. default:
  97. return ARM_DRIVER_ERROR_UNSUPPORTED;
  98. }
  99. }
  100. ARM_I2C_STATUS ARM_I2C_GetStatus(void)
  101. {
  102. }
  103. void ARM_I2C_SignalEvent(uint32_t event)
  104. {
  105. // function body
  106. }
  107. // End I2C Interface
  108. ARM_DRIVER_I2C Driver_I2C = {
  109. ARM_I2C_GetVersion,
  110. ARM_I2C_GetCapabilities,
  111. ARM_I2C_Initialize,
  112. ARM_I2C_Uninitialize,
  113. ARM_I2C_PowerControl,
  114. ARM_I2C_MasterTransmit,
  115. ARM_I2C_MasterReceive,
  116. ARM_I2C_SlaveTransmit,
  117. ARM_I2C_SlaveReceive,
  118. ARM_I2C_GetDataCount,
  119. ARM_I2C_Control,
  120. ARM_I2C_GetStatus
  121. };