• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ i2c_writel函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中i2c_writel函数的典型用法代码示例。如果您正苦于以下问题:C++ i2c_writel函数的具体用法?C++ i2c_writel怎么用?C++ i2c_writel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了i2c_writel函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: rk30_i2c_irq

static irqreturn_t rk30_i2c_irq(int irq, void *dev_id)
{
        struct rk30_i2c *i2c = dev_id;
        unsigned int ipd;

        spin_lock(&i2c->lock);
        ipd = i2c_readl(i2c->regs + I2C_IPD);
        if(i2c->state == STATE_IDLE){
                dev_info(i2c->dev, "Addr[0x%02x]  irq in STATE_IDLE, ipd = 0x%x\n", i2c->addr, ipd);
                i2c_writel(I2C_IPD_ALL_CLEAN, i2c->regs + I2C_IPD);
                goto out;
        }

#if defined(CONFIG_MFD_TRS65910)	//for trs65910 Trsilicon peter
	if(ipd & I2C_NAKRCVIPD && i2c->addr == 0x2d){
		i2c_writel(I2C_NAKRCVIPD, i2c->regs + I2C_IPD);
		goto out;
	}else  if(ipd & I2C_NAKRCVIPD){
		i2c_writel(I2C_NAKRCVIPD, i2c->regs + I2C_IPD);
		i2c->error = -EAGAIN;
		goto out;
	}
#else
	if(ipd & I2C_NAKRCVIPD){
		i2c_writel(I2C_NAKRCVIPD, i2c->regs + I2C_IPD);
		i2c->error = -EAGAIN;
		goto out;
	}
#endif
        rk30_i2c_irq_nextblock(i2c, ipd);
out:
        spin_unlock(&i2c->lock);
        return IRQ_HANDLED;
}
开发者ID:Ciastex,项目名称:kernel_rk3168_86v_yk,代码行数:34,代码来源:i2c-rk30-adapter.c


示例2: rk30_irq_write_prepare

static void rk30_irq_write_prepare(struct rk30_i2c *i2c)
{
    unsigned int data = 0, cnt = 0, i, j;
    unsigned char byte;

    if(is_msgend(i2c)) {
        rk30_i2c_stop(i2c, i2c->error);
        return;
    }
    for(i = 0; i < 8; i++) {
        data = 0;
        for(j = 0; j < 4; j++) {
            if(is_msgend(i2c))
                break;
            if(i2c->msg_ptr == 0 && cnt == 0)
                byte = (i2c->addr & 0x7f) << 1;
            else
                byte =  i2c->msg->buf[i2c->msg_ptr++];
            cnt++;
            data |= (byte << (j * 8));
        }
        i2c_writel(data, i2c->regs + I2C_TXDATA_BASE + 4 * i);
        if(is_msgend(i2c))
            break;
    }
    i2c_writel(cnt, i2c->regs + I2C_MTXCNT);
}
开发者ID:davidftv,项目名称:rk3x_kernel_3.0.36,代码行数:27,代码来源:i2c-rk30-adapter.c


示例3: i2c_lpc2k_reset

static void i2c_lpc2k_reset(struct lpc2k_i2c *i2c)
{
	/* Will force clear all statuses */
	i2c_writel(0x7C, i2c->reg_base + LPC24XX_I2CONCLR);
	i2c_writel(0, i2c->reg_base + LPC24XX_I2ADDR);
	i2c_writel(LPC24XX_I2EN, i2c->reg_base + LPC24XX_I2CONSET);
}
开发者ID:AdrianHuang,项目名称:uclinux-robutest,代码行数:7,代码来源:i2c-lpc2k.c


示例4: tegra_i2c_flush_fifos

static int tegra_i2c_flush_fifos(struct tegra_i2c_dev *i2c_dev)
{
	unsigned long timeout = jiffies + HZ;
	unsigned int offset;
	u32 mask, val;

	if (i2c_dev->hw->has_mst_fifo) {
		mask = I2C_MST_FIFO_CONTROL_TX_FLUSH |
		       I2C_MST_FIFO_CONTROL_RX_FLUSH;
		offset = I2C_MST_FIFO_CONTROL;
	} else {
		mask = I2C_FIFO_CONTROL_TX_FLUSH |
		       I2C_FIFO_CONTROL_RX_FLUSH;
		offset = I2C_FIFO_CONTROL;
	}

	val = i2c_readl(i2c_dev, offset);
	val |= mask;
	i2c_writel(i2c_dev, val, offset);

	while (i2c_readl(i2c_dev, offset) & mask) {
		if (time_after(jiffies, timeout)) {
			dev_warn(i2c_dev->dev, "timeout waiting for fifo flush\n");
			return -ETIMEDOUT;
		}
		msleep(1);
	}
	return 0;
}
开发者ID:Anjali05,项目名称:linux,代码行数:29,代码来源:i2c-tegra.c


示例5: rk30_i2c_clean_stop

static inline void rk30_i2c_clean_stop(struct rk30_i2c *i2c)
{
    unsigned int con = i2c_readl(i2c->regs + I2C_CON);

    con &= ~I2C_CON_STOP;
    i2c_writel(con, i2c->regs + I2C_CON);
}
开发者ID:davidftv,项目名称:rk3x_kernel_3.0.36,代码行数:7,代码来源:i2c-rk30-adapter.c


示例6: tegra_i2c_unmask_irq

static void tegra_i2c_unmask_irq(struct tegra_i2c_dev *i2c_dev, u32 mask)
{
	u32 int_mask;

	int_mask = i2c_readl(i2c_dev, I2C_INT_MASK) | mask;
	i2c_writel(i2c_dev, int_mask, I2C_INT_MASK);
}
开发者ID:Anjali05,项目名称:linux,代码行数:7,代码来源:i2c-tegra.c


示例7: rk30_i2c_send_stop

static inline void rk30_i2c_send_stop(struct rk30_i2c *i2c)
{
    unsigned int con = i2c_readl(i2c->regs + I2C_CON);

    con |= I2C_CON_STOP;
    if(con & I2C_CON_START)
        dev_warn(i2c->dev, "I2C_CON: start bit is set\n");

    i2c_writel(con, i2c->regs + I2C_CON);
}
开发者ID:davidftv,项目名称:rk3x_kernel_3.0.36,代码行数:10,代码来源:i2c-rk30-adapter.c


示例8: rk30_set_rx_mode

static inline void rk30_set_rx_mode(struct rk30_i2c *i2c, unsigned int lastnak)
{
    unsigned long con = i2c_readl(i2c->regs + I2C_CON);

    con &= (~I2C_CON_MASK);
    con |= (I2C_CON_MOD_RX << 1);
    if(lastnak)
        con |= I2C_CON_LASTACK;
    i2c_writel(con, i2c->regs + I2C_CON);
}
开发者ID:davidftv,项目名称:rk3x_kernel_3.0.36,代码行数:10,代码来源:i2c-rk30-adapter.c


示例9: rk30_i2c_enable

static inline void rk30_i2c_enable(struct rk30_i2c *i2c, unsigned int lastnak)
{
    unsigned int con = 0;

    con |= I2C_CON_EN;
    con |= I2C_CON_MOD(i2c->mode);
    if(lastnak)
        con |= I2C_CON_LASTACK;
    con |= I2C_CON_START;
    i2c_writel(con, i2c->regs + I2C_CON);
}
开发者ID:davidftv,项目名称:rk3x_kernel_3.0.36,代码行数:11,代码来源:i2c-rk30-adapter.c


示例10: rk30_i2c_irq

static irqreturn_t rk30_i2c_irq(int irq, void *dev_id)
{
    struct rk30_i2c *i2c = dev_id;
    unsigned int ipd;

    spin_lock(&i2c->lock);
    ipd = i2c_readl(i2c->regs + I2C_IPD);
    if(i2c->state == STATE_IDLE) {
        dev_info(i2c->dev, "Addr[0x%02x]  irq in STATE_IDLE, ipd = 0x%x\n", i2c->addr, ipd);
        i2c_writel(I2C_IPD_ALL_CLEAN, i2c->regs + I2C_IPD);
        goto out;
    }

    if(ipd & I2C_NAKRCVIPD) {
        i2c_writel(I2C_NAKRCVIPD, i2c->regs + I2C_IPD);
        i2c->error = -EAGAIN;
        goto out;
    }
    rk30_i2c_irq_nextblock(i2c, ipd);
out:
    spin_unlock(&i2c->lock);
    return IRQ_HANDLED;
}
开发者ID:davidftv,项目名称:rk3x_kernel_3.0.36,代码行数:23,代码来源:i2c-rk30-adapter.c


示例11: rk30_i2c_set_clk

/* SCL Divisor = 8 * (CLKDIVL + CLKDIVH)
 * SCL = i2c_rate/ SCLK Divisor
*/
static void  rk30_i2c_set_clk(struct rk30_i2c *i2c, unsigned long scl_rate)
{
    unsigned long i2c_rate = clk_get_rate(i2c->clk);

    unsigned int div, divl, divh;

    if((scl_rate == i2c->scl_rate) && (i2c_rate == i2c->i2c_rate))
        return;
    i2c->i2c_rate = i2c_rate;
    i2c->scl_rate = scl_rate;
    div = rk30_ceil(i2c_rate, scl_rate * 8);
    divh = divl = rk30_ceil(div, 2);
    i2c_writel(I2C_CLKDIV_VAL(divl, divh), i2c->regs + I2C_CLKDIV);
    i2c_dbg(i2c->dev, "set clk(I2C_CLKDIV: 0x%08x)\n", i2c_readl(i2c->regs + I2C_CLKDIV));
    return;
}
开发者ID:davidftv,项目名称:rk3x_kernel_3.0.36,代码行数:19,代码来源:i2c-rk30-adapter.c


示例12: rk30_i2c_stop

static void rk30_i2c_stop(struct rk30_i2c *i2c, int ret)
{

    i2c->msg_ptr = 0;
    i2c->msg = NULL;
    if(ret == -EAGAIN) {
        i2c->state = STATE_IDLE;
        i2c->is_busy = 0;
        wake_up(&i2c->wait);
        return;
    }
    i2c->error = ret;
    i2c_writel(I2C_STOPIEN, i2c->regs + I2C_IEN);
    i2c->state = STATE_STOP;
    rk30_i2c_send_stop(i2c);
    return;
}
开发者ID:davidftv,项目名称:rk3x_kernel_3.0.36,代码行数:17,代码来源:i2c-rk30-adapter.c


示例13: rk30_irq_read_prepare

static void rk30_irq_read_prepare(struct rk30_i2c *i2c)
{
    unsigned int cnt, len = i2c->msg->len - i2c->msg_ptr;

    if(len <= 32 && i2c->msg_ptr != 0)
        rk30_set_rx_mode(i2c, 1);
    else if(i2c->msg_ptr != 0)
        rk30_set_rx_mode(i2c, 0);

    if(is_msgend(i2c)) {
        rk30_i2c_stop(i2c, i2c->error);
        return;
    }
    if(len > 32)
        cnt = 32;
    else
        cnt = len;
    i2c_writel(cnt, i2c->regs + I2C_MRXCNT);
}
开发者ID:davidftv,项目名称:rk3x_kernel_3.0.36,代码行数:19,代码来源:i2c-rk30-adapter.c


示例14: i2c_lpc2k_clear_arb

static int i2c_lpc2k_clear_arb(struct lpc2k_i2c *i2c)
{
	long timeout = jiffies + HZ;
	int ret = 0;

	/*
	 * If the transfer needs to abort for some reason, we'll try to
	 * force a stop condition to clear any pending bus conditions
	 */
	i2c_writel(LPC24XX_STO, i2c->reg_base + LPC24XX_I2CONSET);

	/* Wait for status change */
	while (jiffies < timeout &&
		(i2c_readl(i2c->reg_base + LPC24XX_I2STAT) != m_i2c_idle))
		cpu_relax();

	if (i2c_readl(i2c->reg_base + LPC24XX_I2STAT) != m_i2c_idle) {
		/* Bus was not idle, try to reset adapter */
		i2c_lpc2k_reset(i2c);
		ret = -EBUSY;
	}

	return ret;
}
开发者ID:AdrianHuang,项目名称:uclinux-robutest,代码行数:24,代码来源:i2c-lpc2k.c


示例15: rk30_i2c_doxfer

/* rk30_i2c_doxfer
 *
 * this starts an i2c transfer
*/
static int rk30_i2c_doxfer(struct rk30_i2c *i2c,
                           struct i2c_msg *msgs, int num)
{
    unsigned long timeout, flags;
    int error = 0;
    /* 32 -- max transfer bytes
     * 2 -- addr bytes * 2
     * 3 -- max reg addr bytes
     * 9 -- cycles per bytes
     * max cycles: (32 + 2 + 3) * 9 --> 400 cycles
     */
    int msleep_time = 400 * 1000/ i2c->scl_rate; // ms

    if (i2c->suspended) {
        dev_err(i2c->dev, "i2c is suspended\n");
        return -EIO;
    }

    spin_lock_irqsave(&i2c->lock, flags);
    if(rk30_i2c_set_master(i2c, msgs, num) < 0) {
        spin_unlock_irqrestore(&i2c->lock, flags);
        dev_err(i2c->dev, "addr[0x%02x] set master error\n", msgs[0].addr);
        return -EIO;
    }
    i2c->addr = msgs[0].addr;
    i2c->msg_ptr = 0;
    i2c->error = 0;
    i2c->is_busy = 1;
    i2c->state = STATE_START;
    i2c->complete_what = 0;
    i2c_writel(I2C_STARTIEN, i2c->regs + I2C_IEN);
    spin_unlock_irqrestore(&i2c->lock, flags);

    rk30_i2c_enable(i2c, (i2c->count > 32)?0:1); //if count > 32,  byte(32) send ack

    if (in_atomic()) {
        int tmo = I2C_WAIT_TIMEOUT * USEC_PER_MSEC;
        while(tmo-- && i2c->is_busy != 0)
            udelay(1);
        timeout = (tmo <= 0)?0:1;
    } else
        timeout = wait_event_timeout(i2c->wait, (i2c->is_busy == 0), msecs_to_jiffies(I2C_WAIT_TIMEOUT));

    spin_lock_irqsave(&i2c->lock, flags);
    i2c->state = STATE_IDLE;
    error = i2c->error;
    spin_unlock_irqrestore(&i2c->lock, flags);

    if (timeout == 0) {
        if(error < 0)
            i2c_dbg(i2c->dev, "error = %d\n", error);
        else if((i2c->complete_what !=COMPLETE_READ  && i2c->complete_what != COMPLETE_WRITE)) {
            dev_err(i2c->dev, "Addr[0x%02x] wait event timeout, state: %d, is_busy: %d, error: %d, complete_what: 0x%x, ipd: 0x%x\n",
                    msgs[0].addr, i2c->state, i2c->is_busy, error, i2c->complete_what, i2c_readl(i2c->regs + I2C_IPD));
            //rk30_show_regs(i2c);
            error = -ETIMEDOUT;
            msleep(msleep_time);
            rk30_i2c_send_stop(i2c);
            msleep(1);
        }
        else
            i2c_dbg(i2c->dev, "Addr[0x%02x] wait event timeout, but transfer complete\n", i2c->addr);
    }
    i2c_writel(I2C_IPD_ALL_CLEAN, i2c->regs + I2C_IPD);
    rk30_i2c_disable_irq(i2c);
    rk30_i2c_disable(i2c);

    if(error == -EAGAIN)
        i2c_dbg(i2c->dev, "No ack(complete_what: 0x%x), Maybe slave(addr: 0x%02x) not exist or abnormal power-on\n",
                i2c->complete_what, i2c->addr);
    return error;
}
开发者ID:davidftv,项目名称:rk3x_kernel_3.0.36,代码行数:76,代码来源:i2c-rk30-adapter.c


示例16: rk30_i2c_set_master

static int rk30_i2c_set_master(struct rk30_i2c *i2c, struct i2c_msg *msgs, int num)
{
    unsigned int addr = (msgs[0].addr & 0x7f) << 1;
    unsigned int reg_valid_bits = 0;
    unsigned int reg_addr = 0;

    if(num == 1) {
        i2c->count = msgs[0].len;
        if(!(msgs[0].flags & I2C_M_RD)) {
            i2c->msg = &msgs[0];
            i2c->mode = I2C_CON_MOD_TX;
        }
        else {
            addr |= 1;
            i2c->msg = &msgs[0];
            i2c_writel(addr | I2C_MRXADDR_LOW, i2c->regs + I2C_MRXADDR);
            i2c_writel(0, i2c->regs + I2C_MRXRADDR);
            i2c->mode = I2C_CON_MOD_TRX;
            //i2c->mode = I2C_CON_MOD_RX;
        }
    }
    else if(num == 2) {
        i2c->count = msgs[1].len;
        switch(msgs[0].len) {
        case 1:
            reg_addr = msgs[0].buf[0];
            reg_valid_bits |= I2C_MRXADDR_LOW;
            break;
        case 2:
            reg_addr = msgs[0].buf[0] | (msgs[0].buf[1] << 8);
            reg_valid_bits |= I2C_MRXADDR_LOW | I2C_MRXADDR_MID;
            break;
        case 3:
            reg_addr = msgs[0].buf[0] | (msgs[0].buf[1] << 8) | (msgs[0].buf[2] << 16);
            reg_valid_bits |= I2C_MRXADDR_LOW | I2C_MRXADDR_MID | I2C_MRXADDR_HIGH;
            break;
        default:
            return -EIO;
        }
        if((msgs[0].flags & I2C_M_RD) && (msgs[1].flags & I2C_M_RD)) {
            addr |= 1;
            i2c->msg = &msgs[1];
            i2c_writel(addr | I2C_MRXADDR_LOW, i2c->regs + I2C_MRXADDR);
            i2c_writel(reg_addr | reg_valid_bits, i2c->regs + I2C_MRXRADDR);
            i2c->mode = I2C_CON_MOD_RRX;
        }
        else if(!(msgs[0].flags & I2C_M_RD) && (msgs[1].flags & I2C_M_RD)) {
            i2c->msg = &msgs[1];
            i2c_writel(addr | I2C_MRXADDR_LOW, i2c->regs + I2C_MRXADDR);
            i2c_writel(reg_addr | reg_valid_bits, i2c->regs + I2C_MRXRADDR);
            i2c->mode = I2C_CON_MOD_TRX;
        }
        else
            return -EIO;
    }
    else {
        dev_err(i2c->dev, "This case(num > 2) has not been support now\n");
        return -EIO;
    }

    return 0;
}
开发者ID:davidftv,项目名称:rk3x_kernel_3.0.36,代码行数:62,代码来源:i2c-rk30-adapter.c


示例17: rk30_i2c_irq_nextblock

static void rk30_i2c_irq_nextblock(struct rk30_i2c *i2c, unsigned int ipd)
{
    switch (i2c->state) {
    case STATE_START:
        if(!(ipd & I2C_STARTIPD)) {
            rk30_i2c_stop(i2c, -ENXIO);
            dev_err(i2c->dev, "Addr[0x%02x] no start irq in STATE_START\n", i2c->addr);
            rk30_show_regs(i2c);
            i2c_writel(I2C_IPD_ALL_CLEAN, i2c->regs + I2C_IPD);
            goto out;
        }
        i2c->complete_what |= 1<<i2c->state;
        i2c_writel(I2C_STARTIPD, i2c->regs + I2C_IPD);
        rk30_i2c_clean_start(i2c);
        if(i2c->mode ==  I2C_CON_MOD_TX) {
            i2c_writel(I2C_MBTFIEN  | I2C_NAKRCVIEN, i2c->regs + I2C_IEN);
            i2c->state = STATE_WRITE;
            goto prepare_write;
        } else {
            i2c_writel(I2C_MBRFIEN | I2C_NAKRCVIEN, i2c->regs + I2C_IEN);
            i2c->state = STATE_READ;
            goto prepare_read;
        }
    case STATE_WRITE:
        if(!(ipd & I2C_MBTFIPD)) {
            rk30_i2c_stop(i2c, -ENXIO);
            dev_err(i2c->dev, "Addr[0x%02x] no mbtf irq in STATE_WRITE\n", i2c->addr);
            rk30_show_regs(i2c);
            i2c_writel(I2C_IPD_ALL_CLEAN, i2c->regs + I2C_IPD);
            goto out;
        }
        i2c->complete_what |= 1<<i2c->state;
        i2c_writel(I2C_MBTFIPD, i2c->regs + I2C_IPD);
prepare_write:
        rk30_irq_write_prepare(i2c);
        break;
    case STATE_READ:
        if(!(ipd & I2C_MBRFIPD)) {
            rk30_i2c_stop(i2c, -ENXIO);
            dev_err(i2c->dev, "Addr[0x%02x] no mbrf irq in STATE_READ, ipd = 0x%x\n", i2c->addr, ipd);
            rk30_show_regs(i2c);
            i2c_writel(I2C_IPD_ALL_CLEAN, i2c->regs + I2C_IPD);
            goto out;
        }
        i2c->complete_what |= 1<<i2c->state;
        i2c_writel(I2C_MBRFIPD, i2c->regs + I2C_IPD);
        rk30_irq_read_get_data(i2c);
prepare_read:
        rk30_irq_read_prepare(i2c);
        break;
    case STATE_STOP:
        if(!(ipd & I2C_STOPIPD)) {
            rk30_i2c_stop(i2c, -ENXIO);
            dev_err(i2c->dev, "Addr[0x%02x] no stop irq in STATE_STOP\n", i2c->addr);
            rk30_show_regs(i2c);
            i2c_writel(I2C_IPD_ALL_CLEAN, i2c->regs + I2C_IPD);
            goto out;
        }
        rk30_i2c_clean_stop(i2c);
        i2c_writel(I2C_STOPIPD, i2c->regs + I2C_IPD);
        i2c->is_busy = 0;
        i2c->complete_what |= 1<<i2c->state;
        i2c->state = STATE_IDLE;
        wake_up(&i2c->wait);
        break;
    default:
        break;
    }
out:
    return;
}
开发者ID:davidftv,项目名称:rk3x_kernel_3.0.36,代码行数:71,代码来源:i2c-rk30-adapter.c


示例18: i2c_61_init

int __init i2c_61_init(void)
{
    int rc = 0;
    int i2c_clk = 0;
    int gcr_kdv;
    unsigned long gcr;
	printk(KERN_INFO "Initialize Prolific I2C adapter module v%s\n", VERSION);

    i2c_adapt_data.base = DEFAULT_BASE;
    i2c_adapt_data.irq = DEFAULT_IRQ;
    i2c_adapt_data.clock = DEFAULT_CLOCK;
    i2c_adapt_data.own = DEFAULT_OWN;
	i2c_algo_data.data = (void *)&i2c_adapt_data;
	init_waitqueue_head(&i2c_adapt_data.i2c_wait);
    atomic_set(&i2c_adapt_data.irq_done, 0);


    if (i2c_clk_setup) {
        i2c_cd = i2c_cd & 0x7;
        writeb(i2c_cd, PL_CLK_I2C);
        i2c_clk = pl_get_dev_hz() / 8;  /* jedy should be modified */
        gcr_kdv = i2c_kdv;
    } else if (pl_get_dev_hz() == 96000000) {   /* dclk = 96MHz */
        writeb(6, PL_CLK_I2C);                  /* program i2c dev clk to 24MHz */
        gcr_kdv = 10;            /* program i2c data rate = i2c_dev_clk/(20*(10+2)) */
        i2c_clk = 96000000/4;
    } else if (pl_get_dev_hz() == 32000000) {    /* dclk = 32MHz */
        writeb(5, PL_CLK_I2C);                   /* target 16MHz */
        gcr_kdv = 6;
        i2c_clk = 32000000/2;
    } else if (pl_get_dev_hz() == 120000000) {  /* dclk = 120MHz */
        writeb(6, PL_CLK_I2C);                  /* program i2c dev clk to 30MHz */
        gcr_kdv = 13;
        i2c_clk = 120000000/4;
    } else {
        writeb(7, PL_CLK_I2C);
        gcr_kdv = 32;
        i2c_clk = pl_get_dev_hz()/8;
    }

    i2c_adapt_data.clock = i2c_clk / (20 * (gcr_kdv + 2));

#if 0
    gcr = PL_GCR_I2CEN | PL_GCR_MCR_IEN | PL_GCR_SCR_IEN | PL_GCR_KDV(gcr_kdv) |
            PL_GCR_XSCL_PU | PL_GCR_XSCL_6MA |  PL_GCR_XSDA_PU | PL_GCR_XSDA_6MA;
#endif
    gcr = PL_GCR_I2CEN | PL_GCR_MCR_IEN | PL_GCR_KDV(gcr_kdv);
    i2c_writel(&i2c_adapt_data, I2C_GCR, gcr);

    rc = request_irq(i2c_adapt_data.irq, i2c_handler, 0, "I2C ADAPT", &i2c_adapt_data);
    if (rc < 0) {
        printk("Failed to enable i2c irq %d\n", i2c_adapt_data.irq);
        rc = -ENODEV;
        goto EXIT;
    }
    /* enable_irq(i2c_adapt_data.irq); */  // it's redundant

    init_timer(&i2c_adapt_data.wait_timeout);
    i2c_adapt_data.wait_timeout.function = i2c_timeout_handler;
    i2c_adapt_data.wait_timeout.data = (unsigned long) &i2c_adapt_data;



    if (i2c_61_add_bus(&i2c_61_ops) < 0) {
        rc = -ENODEV;
        goto EXIT;
    }
	printk(KERN_INFO " found i2c adapter at %#x irq %d. Data tranfer clock is %dHz\n",
		i2c_adapt_data.base, i2c_adapt_data.irq, i2c_adapt_data.clock);


EXIT:
    return rc;
}
开发者ID:archith,项目名称:camera_project,代码行数:74,代码来源:i2c-adap-61.c


示例19: rk30_i2c_enable_irq

static inline void rk30_i2c_enable_irq(struct rk30_i2c *i2c)
{
    i2c_writel(IRQ_MST_ENABLE, i2c->regs + I2C_IEN);
}
开发者ID:davidftv,项目名称:rk3x_kernel_3.0.36,代码行数:4,代码来源:i2c-rk30-adapter.c


示例20: rk30_i2c_disable_irq

static inline void rk30_i2c_disable_irq(struct rk30_i2c *i2c)
{
    i2c_writel(IRQ_ALL_DISABLE, i2c->regs + I2C_IEN);
}
开发者ID:davidftv,项目名称:rk3x_kernel_3.0.36,代码行数:4,代码来源:i2c-rk30-adapter.c



注:本文中的i2c_writel函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ i2d函数代码示例发布时间:2022-05-30
下一篇:
C++ i2c_write_bytes函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap