i2c_api.h 872 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef __I2C_API_H__
  2. #define __I2C_API_H__
  3. #include <stdint.h>
  4. #include <fcntl.h>
  5. #include "./../../driver/I2C/i2c.h"
  6. //#include <linux/i2c.h>
  7. //#include <linux/fs.h>
  8. //#include <linux/slab.h>
  9. int I2C_Master_Transmit(I2C_DEV_T *dev, uint8_t DevAddress, uint8_t *pData, uint8_t start_reg, uint16_t Size);
  10. int I2C_Master_Receiver(I2C_DEV_T *dev, uint8_t DevAddress, uint8_t *pData, uint8_t start_reg, uint16_t Size);
  11. //int test()
  12. //{
  13. // char a[2];
  14. // struct file *my_file;
  15. // int ret;
  16. // char b=0;
  17. // my_file=kzalloc(sizeof(file),GFP_KERNEL);
  18. // ret = i2cdev_open("/dev/i2c3",&my_file)
  19. // if(ret!=0)
  20. // printf("open fail\n");
  21. //
  22. // my_file.private_data.addr=0x88;
  23. //
  24. // i2c_master_send&((my_file->private_data),&b,1)
  25. // i2c_master_recv(&(my_file->private_data),a ,2);
  26. // printf("read data is %x , %x\n",a[0],a[1]);
  27. //
  28. //};
  29. //
  30. //}
  31. #endif /* __I2C_API_H__ */