IIC适配器级别分析-基于s3c2410

来源:互联网 发布:金融数据来源有哪些 编辑:程序博客网 时间:2024/04/29 15:29



也就是说函数s3c_i2c0_set_platdata 的功能就是对s3c2410_platform_i2c结构体 进行初始化

初始化的结果是:

     struct s3c2410_platform_i2c default_i2c_data __initdata = {
            .bus_num = 0;
            .flags = 0;
            .slave_addr = 0x10;
            .frequency = 100*1000;
            .sda_delay = 100;
            .cfg_gpio =s3c_i2c0_cfg_gpio,

        };


结构体原型如下:

/**
 *    struct s3c2410_platform_i2c - Platform data for s3c I2C.
 *    @bus_num: The bus number to use (if possible).
 *    @flags: Any flags for the I2C bus (E.g. S3C_IICFLK_FILTER).
 *    @slave_addr: The I2C address for the slave device (if enabled).
 *    @frequency: The desired frequency in Hz of the bus.  This is
 *                  guaranteed to not be exceeded.  If the caller does
 *                  not care, use zero and the driver will select a
 *                  useful default.
 *    @sda_delay: The delay (in ns) applied to SDA edges.
 *    @cfg_gpio: A callback to configure the pins for I2C operation.
 */
struct s3c2410_platform_i2c {
    int        bus_num;
    unsigned int    flags;
    unsigned int    slave_addr;
    unsigned long    frequency;
    unsigned int    sda_delay;

    void    (*cfg_gpio)(struct platform_device *dev);
};

0 0
原创粉丝点击