1 /* 2 * Copyright (c) 2006-2021, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2019-07-29 zdzn first version 9 */ 10 11 #ifndef __DRV_I2C_H__ 12 #define __DRV_I2C_H__ 13 14 #include <rtdevice.h> 15 #include <rtthread.h> 16 17 #include "board.h" 18 19 struct raspi_master_config_t 20 { 21 rt_uint8_t sdl_pin; 22 rt_uint8_t scl_pin; 23 rt_uint8_t sdl_pin_mode; 24 rt_uint8_t scl_pin_mode; 25 rt_uint8_t slave_address; 26 rt_uint32_t bsc_base; 27 rt_uint16_t clk_div; 28 }; 29 30 struct raspi_i2c_bus 31 { 32 struct rt_i2c_bus_device device; 33 struct rt_i2c_msg *msg; 34 rt_uint32_t msg_cnt; 35 volatile rt_uint32_t msg_ptr; 36 volatile rt_uint32_t dptr; 37 char *device_name; 38 struct raspi_master_config_t *cfg; 39 }; 40 41 int rt_hw_i2c_init(void); 42 43 #endif 44