Azure Sphere MT3620 M4 API Reference Manual
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
os_hal_i2c.h
1 /*
2  * (C) 2005-2020 MediaTek Inc. All rights reserved.
3  *
4  * Copyright Statement:
5  *
6  * This MT3620 driver software/firmware and related documentation
7  * ("MediaTek Software") are protected under relevant copyright laws.
8  * The information contained herein is confidential and proprietary to
9  * MediaTek Inc. ("MediaTek"). You may only use, reproduce, modify, or
10  * distribute (as applicable) MediaTek Software if you have agreed to and been
11  * bound by this Statement and the applicable license agreement with MediaTek
12  * ("License Agreement") and been granted explicit permission to do so within
13  * the License Agreement ("Permitted User"). If you are not a Permitted User,
14  * please cease any access or use of MediaTek Software immediately.
15  *
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE
18  * PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS
19  * ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
21  * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
22  * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
23  * INCORPORATED IN, OR SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO
24  * LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
25  * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
26  * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
27  * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
28  * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
29  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
30  * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED
31  * HEREUNDER WILL BE ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY
32  * RECEIVER TO MEDIATEK DURING THE PRECEDING TWELVE (12) MONTHS FOR SUCH
33  * MEDIATEK SOFTWARE AT ISSUE.
34  */
35 
36 #ifndef __OS_HAL_I2C_H__
37 #define __OS_HAL_I2C_H__
38 
39 #include "mhal_i2c.h"
40 
131 typedef enum {
144 } i2c_num;
145 
156 #ifdef __cplusplus
157 extern "C" {
158 #endif
159 
169 int mtk_os_hal_i2c_ctrl_init(i2c_num bus_num);
170 
181 
195 int mtk_os_hal_i2c_speed_init(i2c_num bus_num, enum i2c_speed_kHz speed);
196 
213 int mtk_os_hal_i2c_read(i2c_num bus_num, u8 device_addr, u8 *buffer, u16 len);
214 
231 int mtk_os_hal_i2c_write(i2c_num bus_num, u8 device_addr, u8 *buffer, u16 len);
232 
253 int mtk_os_hal_i2c_write_read(i2c_num bus_num, u8 device_addr,
254  u8 *wr_buf, u8 *rd_buf, u16 wr_len, u16 rd_len);
255 
273 int mtk_os_hal_i2c_set_slave_addr(i2c_num bus_num, u8 slv_addr);
274 
292 int mtk_os_hal_i2c_slave_tx(i2c_num bus_num, u8 *buffer, u16 len, u32 time_out);
293 
311 int mtk_os_hal_i2c_slave_rx(i2c_num bus_num, u8 *buffer, u16 len, u32 time_out);
312 
313 #ifdef __cplusplus
314 }
315 #endif
316 
326 #endif
i2c_speed_kHz
I2C master's clock frequency definition.
Definition: mhal_i2c.h:146
i2c_num
Definition: os_hal_i2c.h:131
Use ISU2 as I2C port.
Definition: os_hal_i2c.h:137
The maximum ISU number (invalid)
Definition: os_hal_i2c.h:143
Use ISU4 as I2C port.
Definition: os_hal_i2c.h:141
int mtk_os_hal_i2c_speed_init(i2c_num bus_num, enum i2c_speed_kHz speed)
Initialize i2c master transfer speed.
int mtk_os_hal_i2c_ctrl_deinit(i2c_num bus_num)
Deinit I2C controller.
Use ISU1 as I2C port.
Definition: os_hal_i2c.h:135
int mtk_os_hal_i2c_read(i2c_num bus_num, u8 device_addr, u8 *buffer, u16 len)
I2C master read data from slave device.
int mtk_os_hal_i2c_ctrl_init(i2c_num bus_num)
Init I2C controller.
int mtk_os_hal_i2c_write_read(i2c_num bus_num, u8 device_addr, u8 *wr_buf, u8 *rd_buf, u16 wr_len, u16 rd_len)
I2C master write data to slave device then read data from device.
int mtk_os_hal_i2c_set_slave_addr(i2c_num bus_num, u8 slv_addr)
Set I2C slave address before transfer when I2C hardware controller is set as a slave role...
int mtk_os_hal_i2c_slave_tx(i2c_num bus_num, u8 *buffer, u16 len, u32 time_out)
I2C slave wait for master to trigger transfer and then send data to the master.
Use ISU3 as I2C port.
Definition: os_hal_i2c.h:139
Use ISU0 as I2C port.
Definition: os_hal_i2c.h:133
int mtk_os_hal_i2c_slave_rx(i2c_num bus_num, u8 *buffer, u16 len, u32 time_out)
I2C slave wait for master to trigger transfer and then receive data from the master.
int mtk_os_hal_i2c_write(i2c_num bus_num, u8 device_addr, u8 *buffer, u16 len)
I2C master write data to slave device.