i2c.h :
******************* *******************************************
#ifndef I2C_H
#define I2C_H
#include <linux/types.h>
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
#include <linux/rtc.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <string.h>
#define I2C_DEFAULT_TIMEOUT 1
#define I2C_DEFAULT_RETRY 3
#define PCF8563_REG_SC 0x02
#define PCF8563_REG_MN 0x03
#define PCF8563_REG_HR 0x04
#define PCF8563_REG_DM 0x05
#define PCF8563_REG_DW 0x06
#define PCF8563_REG_MO 0x07
#define PCF8563_REG_YR 0x08
#define PCF8563_MO_C 0x80
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
typedef unsigned long long u64;
typedef signed char s8;
typedef short s16;
typedef int s32;
typedef long long s64;
static const unsigned char rtc_days_in_month[] = {
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
unsigned bcd2bin(unsigned char val);
unsigned bcd2bin(unsigned char val);
static int
__i2c_send(int fd, struct i2c_rdwr_ioctl_data *data);
static int
__i2c_set(int fd, unsigned int timeout, unsigned int retry);
int
i2c_read_data(u16 addr, u8 offset, u8 *val);
int
i2c_write_data(u16 addr, u8 offset, u8 val);
int
i2c_open(unsigned char* dev, unsigned int timeout, unsigned int retry);
#endif
