主题 : i2c 驱动问题 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 18505
精华: 0
发帖: 48
金钱: 250 两
威望: 50 点
综合积分: 96 分
注册时间: 2010-04-10
最后登录: 2011-05-05
楼主  发表于: 2010-05-24 11:00

 i2c 驱动问题

在这个i2c的总线驱动中的start函数中 ,我个问题请教
static void s3c24xx_i2c_message_start(struct s3c24xx_i2c *i2c,
                      struct i2c_msg *msg)
{
    unsigned int addr = (msg->addr & 0x7f) << 1;
    unsigned long stat;
    unsigned long iiccon;

    stat = 0;
    stat |=  S3C2410_IICSTAT_TXRXEN;

    if (msg->flags & I2C_M_RD) {
        stat |= S3C2410_IICSTAT_MASTER_RX;
        addr |= 1;
    } else
        stat |= S3C2410_IICSTAT_MASTER_TX;

    if (msg->flags & I2C_M_REV_DIR_ADDR)
        addr ^= 1;

    // todo - check for wether ack wanted or not
    s3c24xx_i2c_enable_ack(i2c);

    iiccon = readl(i2c->regs + S3C2410_IICCON);
    writel(stat, i2c->regs + S3C2410_IICSTAT);
    
    dev_dbg(i2c->dev, "START: %08lx to IICSTAT, %02x to DS\n", stat, addr);
    writeb(addr, i2c->regs + S3C2410_IICDS);
    
    // delay a bit and reset iiccon before setting start (per samsung)
    udelay(1);
    dev_dbg(i2c->dev, "iiccon, %08lx\n", iiccon);
    writel(iiccon, i2c->regs + S3C2410_IICCON);
    
    stat |=  S3C2410_IICSTAT_START;
    writel(stat, i2c->regs + S3C2410_IICSTAT);
}
请问函数中的udelay(1) 延迟的目的是什么呢?
学习交流