日期:2014-05-16 浏览次数:20784 次
#define I2C0_REG_BASE (0x01C22000) m_nFd = open("/dev/mem", O_RDWR); m_pBaseAddr = (i2c_regs_t *)mmap(0, sizeof(i2c_regs_t), PROT_READ | PROT_WRITE, MAP_SHARED, m_nFd, (0x00000000+I2C0_REG_BASE ) >>0 ); 在I2C 的读写函数中,总是死在红色的位置 // transmit data one byte at a time. for (i = 0; i < in_length; i++) { i2c->ICDXR = src_buffer[i]; // wait for data to be copied to shift register. cnt = 0; do { if (cnt++ > I2C_TIMEOUT) { // timed out waiting for data...reinit and return error. //I2C_init(i2c, g_clock_rate); // return (ERR_TIMEOUT); } } [color=#FF0000]while (!CHKBIT(i2c->ICSTR, ICXRDY));[/color] }