diff options
author | Nick Foster <nick@nerdnetworks.org> | 2010-08-11 09:19:22 -0700 |
---|---|---|
committer | Nick Foster <nick@nerdnetworks.org> | 2010-08-16 17:29:40 -0700 |
commit | 936c5518e47f797c062c0ac5de0e5bd1452c7a0d (patch) | |
tree | 4c599aa5030c61e880ef4e8ac569e0d8a54d299e | |
parent | f89f7476a1c3452511d54ec6839f574a7a37c0fe (diff) | |
download | uhd-936c5518e47f797c062c0ac5de0e5bd1452c7a0d.tar.gz uhd-936c5518e47f797c062c0ac5de0e5bd1452c7a0d.tar.bz2 uhd-936c5518e47f797c062c0ac5de0e5bd1452c7a0d.zip |
Fix warnings related to const-ness and volatile-ness.
-rw-r--r-- | firmware/microblaze/lib/i2c.c | 12 | ||||
-rw-r--r-- | firmware/microblaze/lib/i2c.h | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/firmware/microblaze/lib/i2c.c b/firmware/microblaze/lib/i2c.c index b60a05fcc..216b01800 100644 --- a/firmware/microblaze/lib/i2c.c +++ b/firmware/microblaze/lib/i2c.c @@ -39,12 +39,12 @@ static uint16_t prescaler_values[MAX_WB_DIV+1] = { //asynchronous (interrupt-driven) i2c state variables volatile uint8_t i2c_buf[17]; //tx/rx data transfer buffer -volatile uint8_t *i2c_bufptr = i2c_buf; //ptr to current position +volatile uint8_t *volatile i2c_bufptr = i2c_buf; //ptr to current position volatile uint8_t i2c_len = 0; //length remaining in current transfer volatile i2c_state_t i2c_state = I2C_STATE_IDLE; //current I2C transfer state i2c_dir_t i2c_dir; //I2C transfer direction -volatile void (*i2c_callback)(void); //function pointer to i2c callback to be called when transaction is complete +void (*volatile i2c_callback)(void); //function pointer to i2c callback to be called when transaction is complete static void i2c_irq_handler(unsigned irq); inline void i2c_async_err(void); @@ -228,7 +228,7 @@ static void i2c_irq_handler(unsigned irq) { } -void i2c_register_callback(volatile void (*callback)(void)) { +void i2c_register_callback(void (*volatile callback)(void)) { i2c_callback = callback; } @@ -272,7 +272,7 @@ bool i2c_async_write(uint8_t addr, const uint8_t *buf, unsigned int len) { i2c_regs->cmd_status |= I2C_CMD_IACK; //copy the buffer into our own if writing - memcpy(i2c_buf, buf, len); + memcpy((void *)i2c_buf, buf, len); i2c_len = len; i2c_dir = I2C_DIR_WRITE; @@ -288,10 +288,10 @@ bool i2c_async_write(uint8_t addr, const uint8_t *buf, unsigned int len) { } //TODO: determine if it's better to read sequentially into the user's buffer, copy on transfer complete, or copy on request (shown below). probably best to copy on request. -bool i2c_async_data_ready(const void *buf) { +bool i2c_async_data_ready(void *buf) { if(i2c_state == I2C_STATE_DATA_READY) { i2c_state = I2C_STATE_IDLE; - memcpy(buf, i2c_buf, (i2c_bufptr - i2c_buf)); //TODO: not really comfortable with this + memcpy(buf, (void *)i2c_buf, (i2c_bufptr - i2c_buf)); //TODO: not really comfortable with this //printf("Copying %d bytes to user buffer\n", i2c_bufptr-i2c_buf); return true; } diff --git a/firmware/microblaze/lib/i2c.h b/firmware/microblaze/lib/i2c.h index a991c6ac4..77129e922 100644 --- a/firmware/microblaze/lib/i2c.h +++ b/firmware/microblaze/lib/i2c.h @@ -38,7 +38,7 @@ bool i2c_write(unsigned char i2c_addr, const unsigned char *buf, unsigned int le bool i2c_async_read(uint8_t addr, unsigned int len); bool i2c_async_write(uint8_t addr, const uint8_t *buf, unsigned int len); -bool i2c_async_data_ready(const void *); +bool i2c_async_data_ready(void *); //static void i2c_irq_handler(unsigned irq); void i2c_register_callback(void (*callback)(void)); |