2 * Copyright (c) 2013-2018 Arm Limited. All rights reserved.
4 * SPDX-License-Identifier: Apache-2.0
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
10 * www.apache.org/licenses/LICENSE-2.0
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.
19 #include "Driver_I2C.h"
21 #define ARM_I2C_DRV_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(2, 0) /* driver version */
24 static const ARM_DRIVER_VERSION DriverVersion = {
29 /* Driver Capabilities */
30 static const ARM_I2C_CAPABILITIES DriverCapabilities = {
31 0 /* supports 10-bit addressing */
38 ARM_DRIVER_VERSION ARM_I2C_GetVersion(void)
42 ARM_I2C_CAPABILITIES ARM_I2C_GetCapabilities(void)
46 int32_t ARM_I2C_Initialize(ARM_I2C_SignalEvent_t cb_event)
50 int32_t ARM_I2C_Uninitialize(void)
54 int32_t ARM_I2C_PowerControl(ARM_POWER_STATE state)
68 return ARM_DRIVER_ERROR_UNSUPPORTED;
72 int32_t ARM_I2C_MasterTransmit(uint32_t addr, const uint8_t *data, uint32_t num, bool xfer_pending)
76 int32_t ARM_I2C_MasterReceive(uint32_t addr, uint8_t *data, uint32_t num, bool xfer_pending)
80 int32_t ARM_I2C_SlaveTransmit(const uint8_t *data, uint32_t num)
84 int32_t ARM_I2C_SlaveReceive(uint8_t *data, uint32_t num)
88 int32_t ARM_I2C_GetDataCount(void)
92 int32_t ARM_I2C_Control(uint32_t control, uint32_t arg)
96 case ARM_I2C_OWN_ADDRESS:
99 case ARM_I2C_BUS_SPEED:
102 case ARM_I2C_BUS_SPEED_STANDARD:
104 case ARM_I2C_BUS_SPEED_FAST:
106 case ARM_I2C_BUS_SPEED_FAST_PLUS:
109 return ARM_DRIVER_ERROR_UNSUPPORTED;
113 case ARM_I2C_BUS_CLEAR:
116 case ARM_I2C_ABORT_TRANSFER:
120 return ARM_DRIVER_ERROR_UNSUPPORTED;
124 ARM_I2C_STATUS ARM_I2C_GetStatus(void)
128 void ARM_I2C_SignalEvent(uint32_t event)
135 ARM_DRIVER_I2C Driver_I2C = {
137 ARM_I2C_GetCapabilities,
139 ARM_I2C_Uninitialize,
140 ARM_I2C_PowerControl,
141 ARM_I2C_MasterTransmit,
142 ARM_I2C_MasterReceive,
143 ARM_I2C_SlaveTransmit,
144 ARM_I2C_SlaveReceive,
145 ARM_I2C_GetDataCount,