X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=src%2Ftarget%2Ffirmware%2Fcalypso%2Fi2c.c;h=344424de8769a44cc343da29559282e150b6b803;hb=c4483bfed52ed42226f7f8a9f04968bafda1ba6c;hp=a46fd72a8a6948ab3e967c485b2407da3328bc53;hpb=e8451da581e230493e96432a63e110d04283138b;p=osmocom-bb.git diff --git a/src/target/firmware/calypso/i2c.c b/src/target/firmware/calypso/i2c.c index a46fd72..344424d 100644 --- a/src/target/firmware/calypso/i2c.c +++ b/src/target/firmware/calypso/i2c.c @@ -52,7 +52,7 @@ enum i2c_reg { #define I2C_STATUS_ERROR_DATA (1 << 0) #define I2C_STATUS_ERROR_DEV (1 << 1) -#define I2C_STATUS_IDLE (1 << 2) +#define I2C_STATUS_IDLE (1 << 2) // 1: not idle, 0: idle #define I2C_STATUS_INTERRUPT (1 << 3) int i2c_write(uint8_t chip, uint32_t addr, int alen, const uint8_t *buffer, int len) @@ -72,7 +72,7 @@ int i2c_write(uint8_t chip, uint32_t addr, int alen, const uint8_t *buffer, int writeb(chip & 0x3f, I2C_REG(DEVICE_REG)); writeb(addr & 0xff, I2C_REG(ADDRESS_REG)); - /* we have to tell the controler how many bits we'll put into the fifo ?!? */ + /* we have to tell the controller how many bits we'll put into the fifo ?!? */ writeb(len-1, I2C_REG(CONF_FIFO_REG)); /* fill the FIFO */ @@ -92,7 +92,7 @@ int i2c_write(uint8_t chip, uint32_t addr, int alen, const uint8_t *buffer, int while (1) { uint8_t reg = readb(I2C_REG(STATUS_ACTIVITY_REG)); printd("I2C Status: 0x%02x\n", rerg & 0xf); - if (reg & I2C_STATUS_IDLE) + if (!(reg & I2C_STATUS_IDLE)) // 0: idle 1: not idle break; } dputs("I2C transfer completed\n");