2 * Copyright (c) 2013-2016 ARM Limited. All rights reserved.
\r
4 * SPDX-License-Identifier: Apache-2.0
\r
6 * Licensed under the Apache License, Version 2.0 (the License); you may
\r
7 * not use this file except in compliance with the License.
\r
8 * You may obtain a copy of the License at
\r
10 * http://www.apache.org/licenses/LICENSE-2.0
\r
12 * Unless required by applicable law or agreed to in writing, software
\r
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
\r
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
15 * See the License for the specific language governing permissions and
\r
16 * limitations under the License.
\r
19 #include "Driver_I2C.h"
\r
21 #define ARM_I2C_DRV_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(2, 0) /* driver version */
\r
23 /* Driver Version */
\r
24 static const ARM_DRIVER_VERSION DriverVersion = {
\r
25 ARM_I2C_API_VERSION,
\r
29 /* Driver Capabilities */
\r
30 static const ARM_I2C_CAPABILITIES DriverCapabilities = {
\r
31 0 /* supports 10-bit addressing */
\r
38 ARM_DRIVER_VERSION ARM_I2C_GetVersion(void)
\r
42 ARM_I2C_CAPABILITIES ARM_I2C_GetCapabilities(void)
\r
46 int32_t ARM_I2C_Initialize(ARM_I2C_SignalEvent_t cb_event)
\r
50 int32_t ARM_I2C_Uninitialize(void)
\r
54 int32_t ARM_I2C_PowerControl(ARM_POWER_STATE state)
\r
64 case ARM_POWER_FULL:
\r
68 return ARM_DRIVER_ERROR_UNSUPPORTED;
\r
72 int32_t ARM_I2C_MasterTransmit(uint32_t addr, const uint8_t *data, uint32_t num, bool xfer_pending)
\r
76 int32_t ARM_I2C_MasterReceive(uint32_t addr, uint8_t *data, uint32_t num, bool xfer_pending)
\r
80 int32_t ARM_I2C_SlaveTransmit(const uint8_t *data, uint32_t num)
\r
84 int32_t ARM_I2C_SlaveReceive(uint8_t *data, uint32_t num)
\r
88 int32_t ARM_I2C_GetDataCount(void)
\r
92 int32_t ARM_I2C_Control(uint32_t control, uint32_t arg)
\r
96 case ARM_I2C_OWN_ADDRESS:
\r
99 case ARM_I2C_BUS_SPEED:
\r
102 case ARM_I2C_BUS_SPEED_STANDARD:
\r
104 case ARM_I2C_BUS_SPEED_FAST:
\r
106 case ARM_I2C_BUS_SPEED_FAST_PLUS:
\r
109 return ARM_DRIVER_ERROR_UNSUPPORTED;
\r
113 case ARM_I2C_BUS_CLEAR:
\r
116 case ARM_I2C_ABORT_TRANSFER:
\r
120 return ARM_DRIVER_ERROR_UNSUPPORTED;
\r
124 ARM_I2C_STATUS ARM_I2C_GetStatus(void)
\r
128 void ARM_I2C_SignalEvent(uint32_t event)
\r
133 // End I2C Interface
\r
135 ARM_DRIVER_I2C Driver_I2C = {
\r
136 ARM_I2C_GetVersion,
\r
137 ARM_I2C_GetCapabilities,
\r
138 ARM_I2C_Initialize,
\r
139 ARM_I2C_Uninitialize,
\r
140 ARM_I2C_PowerControl,
\r
141 ARM_I2C_MasterTransmit,
\r
142 ARM_I2C_MasterReceive,
\r
143 ARM_I2C_SlaveTransmit,
\r
144 ARM_I2C_SlaveReceive,
\r
145 ARM_I2C_GetDataCount,
\r