diff --git a/src/arch/avr/gpio.c b/src/arch/avr/gpio.c index e4cefa2..c11e7ce 100644 --- a/src/arch/avr/gpio.c +++ b/src/arch/avr/gpio.c @@ -2,7 +2,7 @@ #include -bool gpio_get_dir(struct Gpio *const gpio) { +bool gpio_get_dir(const struct Gpio *const gpio) { if (*gpio->ddr & gpio->value) { return true; } else { @@ -18,7 +18,7 @@ void gpio_set_dir(struct Gpio *const gpio, bool value) { } } -bool gpio_get(struct Gpio *const gpio) { +bool gpio_get(const struct Gpio *const gpio) { if (*gpio->pin & gpio->value) { return true; } else { diff --git a/src/arch/avr/i2c.c b/src/arch/avr/i2c.c index 02a203d..502c5bf 100644 --- a/src/arch/avr/i2c.c +++ b/src/arch/avr/i2c.c @@ -52,7 +52,7 @@ void i2c_stop(struct I2C *const i2c) { TWCR = BIT(TWINT) | BIT(TWEN) | BIT(TWSTO); } -int16_t i2c_write(struct I2C *const i2c, uint8_t *const data, uint16_t length) { +int16_t i2c_write(struct I2C *const i2c, const uint8_t *const data, uint16_t length) { uint16_t i; for (i = 0; i < length; i++) { // load data into data register diff --git a/src/arch/avr/include/arch/gpio.h b/src/arch/avr/include/arch/gpio.h index 95c68a3..ca5f77a 100644 --- a/src/arch/avr/include/arch/gpio.h +++ b/src/arch/avr/include/arch/gpio.h @@ -25,9 +25,9 @@ struct Gpio { } // clang-format on -bool gpio_get(struct Gpio *const gpio); +bool gpio_get(const struct Gpio *const gpio); void gpio_set(struct Gpio *const gpio, bool value); -bool gpio_get_dir(struct Gpio *const gpio); +bool gpio_get_dir(const struct Gpio *const gpio); void gpio_set_dir(struct Gpio *const gpio, bool value); #endif // _ARCH_GPIO_H diff --git a/src/board/arduino/mega2560/parallel.c b/src/board/arduino/mega2560/parallel.c index 7f0f496..215ae31 100644 --- a/src/board/arduino/mega2560/parallel.c +++ b/src/board/arduino/mega2560/parallel.c @@ -436,7 +436,7 @@ int16_t parallel_spi_transaction( // "Hardware" accelerated SPI programming, requires ECINDARs to be set int16_t parallel_spi_program( struct Parallel *const port, - uint8_t *const data, + const uint8_t *const data, int16_t length, bool initialized ) { diff --git a/src/board/arduino/uno/parallel.c b/src/board/arduino/uno/parallel.c index da87e2c..e853f31 100644 --- a/src/board/arduino/uno/parallel.c +++ b/src/board/arduino/uno/parallel.c @@ -346,7 +346,7 @@ int16_t parallel_spi_transaction( // "Hardware" accelerated SPI programming, requires ECINDARs to be set int16_t parallel_spi_program( struct Parallel *const port, - uint8_t *const data, + const uint8_t *const data, int16_t length, bool initialized ) { diff --git a/src/board/system76/common/include/board/parallel.h b/src/board/system76/common/include/board/parallel.h index 674b10a..7f075ee 100644 --- a/src/board/system76/common/include/board/parallel.h +++ b/src/board/system76/common/include/board/parallel.h @@ -8,6 +8,6 @@ extern bool parallel_debug; bool parallel_init(void); -int16_t parallel_write(uint8_t *const data, uint16_t length); +int16_t parallel_write(const uint8_t *const data, uint16_t length); #endif // _BOARD_PARALLEL_H diff --git a/src/board/system76/common/kbc.c b/src/board/system76/common/kbc.c index 6222daa..50f3715 100644 --- a/src/board/system76/common/kbc.c +++ b/src/board/system76/common/kbc.c @@ -92,7 +92,7 @@ static bool kbc_buffer_pop(uint8_t *const scancode) { return true; } -static bool kbc_buffer_push(uint8_t *const scancodes, uint8_t len) { +static bool kbc_buffer_push(const uint8_t *const scancodes, uint8_t len) { //TODO: make this test more efficient for (uint8_t i = 0; i < len; i++) { if ((kbc_buffer_tail + i + 1U) % ARRAY_SIZE(kbc_buffer) == kbc_buffer_head) { diff --git a/src/board/system76/common/kbscan.c b/src/board/system76/common/kbscan.c index 2ac1b4b..b3e33b2 100644 --- a/src/board/system76/common/kbscan.c +++ b/src/board/system76/common/kbscan.c @@ -96,7 +96,7 @@ static inline bool popcount_more_than_one(uint8_t rowdata) { return rowdata & (rowdata - 1); } -static bool kbscan_row_has_ghost(uint8_t *const matrix, uint8_t col) { +static bool kbscan_row_has_ghost(const uint8_t *const matrix, uint8_t col) { uint8_t rowdata = matrix[col]; // No ghosts exist when less than 2 keys in the row are active. diff --git a/src/board/system76/common/parallel.c b/src/board/system76/common/parallel.c index de50131..6476c4f 100644 --- a/src/board/system76/common/parallel.c +++ b/src/board/system76/common/parallel.c @@ -84,7 +84,7 @@ bool parallel_init(void) { return parallel_wait_peripheral(STS_WAIT, 0); } -int16_t parallel_write(uint8_t *const data, uint16_t length) { +int16_t parallel_write(const uint8_t *const data, uint16_t length) { // Assert nWRITE KSIGDAT &= ~CTL_WRITE; diff --git a/src/common/include/common/i2c.h b/src/common/include/common/i2c.h index 8288a0f..87bbd6b 100644 --- a/src/common/include/common/i2c.h +++ b/src/common/include/common/i2c.h @@ -24,7 +24,7 @@ void i2c_stop(struct I2C *const i2c) __reentrant; // Send a byte on i2c bus // Must be defined by arch, board, or ec -int16_t i2c_write(struct I2C *const i2c, uint8_t *const data, uint16_t length) __reentrant; +int16_t i2c_write(struct I2C *const i2c, const uint8_t *const data, uint16_t length) __reentrant; // Read bytes from bus // Must be defined by arch, board, or ec diff --git a/src/ec/ite/gpio.c b/src/ec/ite/gpio.c index b46852f..8eaee98 100644 --- a/src/ec/ite/gpio.c +++ b/src/ec/ite/gpio.c @@ -3,7 +3,7 @@ #include #include -bool gpio_get(struct Gpio *const gpio) { +bool gpio_get(const struct Gpio *const gpio) { if (*(gpio->data) & gpio->value) { return true; } else { diff --git a/src/ec/ite/include/ec/gpio.h b/src/ec/ite/include/ec/gpio.h index 02370ee..8debc8d 100644 --- a/src/ec/ite/include/ec/gpio.h +++ b/src/ec/ite/include/ec/gpio.h @@ -32,7 +32,7 @@ struct Gpio { } // clang-format on -bool gpio_get(struct Gpio *const gpio); +bool gpio_get(const struct Gpio *const gpio); void gpio_set(struct Gpio *const gpio, bool value); #ifdef GPIO_DEBUG diff --git a/src/ec/ite/include/ec/kbc.h b/src/ec/ite/include/ec/kbc.h index e005d15..0fbc254 100644 --- a/src/ec/ite/include/ec/kbc.h +++ b/src/ec/ite/include/ec/kbc.h @@ -29,8 +29,8 @@ extern struct Kbc __code KBC; #define KBC_STS_IBF BIT(1) #define KBC_STS_CMD BIT(3) -uint8_t kbc_status(struct Kbc *const kbc); -uint8_t kbc_read(struct Kbc *const kbc); +uint8_t kbc_status(const struct Kbc *const kbc); +uint8_t kbc_read(const struct Kbc *const kbc); bool kbc_keyboard(struct Kbc *const kbc, uint8_t data, uint16_t timeout); bool kbc_mouse(struct Kbc *const kbc, uint8_t data, uint16_t timeout); diff --git a/src/ec/ite/kbc.c b/src/ec/ite/kbc.c index d856b4f..5fd6349 100644 --- a/src/ec/ite/kbc.c +++ b/src/ec/ite/kbc.c @@ -12,15 +12,15 @@ struct Kbc __code KBC = { .data_in = &KBHIDIR, }; -uint8_t kbc_status(struct Kbc *const kbc) { +uint8_t kbc_status(const struct Kbc *const kbc) { return *(kbc->status); } -uint8_t kbc_read(struct Kbc *const kbc) { +uint8_t kbc_read(const struct Kbc *const kbc) { return *(kbc->data_in); } -static bool kbc_wait(struct Kbc *const kbc, uint16_t timeout) { +static bool kbc_wait(const struct Kbc *const kbc, uint16_t timeout) { while (*(kbc->status) & KBC_STS_OBF) { if (timeout == 0) return false;