- 论坛徽章:
- 0
|
各位大神,最近在看iic驱动,里头有个不明白的地方,求教:- 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);
- [backcolor=Red]iiccon = readl(i2c->regs + S3C2410_IICCON);[/backcolor]
- 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 here to ensure the data byte has gotten onto the bus
- * before the transaction is started */
- ndelay(i2c->tx_setup);
- dev_dbg(i2c->dev, "iiccon, %08lx\n", iiccon);
- [backcolor=Red]writel(iiccon, i2c->regs + S3C2410_IICCON);[/backcolor]
- stat |= S3C2410_IICSTAT_START;
- writel(stat, i2c->regs + S3C2410_IICSTAT);
- }
复制代码 这是个启动消息传输的函数,里头标红的两个地方,不是很明白,为什么需要先把iiccon寄存器的值读出来,然后再写进去了,也没见做任何处理。
到底是为了什么?求指教。。。。。
|
|