drv_i2c.h 820 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. #ifndef __DRV_I2C_H__
  11. #define __DRV_I2C_H__
  12. #include <rtdevice.h>
  13. #include <rtthread.h>
  14. #include "board.h"
  15. struct raspi_master_config_t
  16. {
  17. rt_uint8_t sdl_pin;
  18. rt_uint8_t scl_pin;
  19. rt_uint8_t sdl_pin_mode;
  20. rt_uint8_t scl_pin_mode;
  21. rt_uint8_t slave_address;
  22. rt_uint32_t bsc_base;
  23. rt_uint16_t clk_div;
  24. };
  25. struct raspi_i2c_bus
  26. {
  27. struct rt_i2c_bus_device device;
  28. struct rt_i2c_msg *msg;
  29. rt_uint32_t msg_cnt;
  30. volatile rt_uint32_t msg_ptr;
  31. volatile rt_uint32_t dptr;
  32. char *device_name;
  33. struct raspi_master_config_t *cfg;
  34. };
  35. int rt_hw_i2c_init(void);
  36. #endif