diff --git a/src/arch/avr/i2c.c b/src/arch/avr/i2c.c index 2cb1161..d22752e 100644 --- a/src/arch/avr/i2c.c +++ b/src/arch/avr/i2c.c @@ -10,7 +10,7 @@ #define TIMEOUT (F_CPU/1000) -int i2c_start(struct I2C * i2c, uint8_t addr, bool read) { +int16_t i2c_start(struct I2C * i2c, uint8_t addr, bool read) { uint32_t count; // reset TWI control register @@ -46,8 +46,8 @@ void i2c_stop(struct I2C * i2c) { TWCR = BIT(TWINT) | BIT(TWEN) | BIT(TWSTO); } -int i2c_write(struct I2C * i2c, uint8_t * data, int length) { - int i; +int16_t i2c_write(struct I2C * i2c, uint8_t * data, int16_t length) { + int16_t i; for (i = 0; i < length; i++) { // load data into data register TWDR = data[i]; @@ -65,8 +65,8 @@ int i2c_write(struct I2C * i2c, uint8_t * data, int length) { return i; } -int i2c_read(struct I2C * i2c, uint8_t * data, int length) { - int i; +int16_t i2c_read(struct I2C * i2c, uint8_t * data, int16_t length) { + int16_t i; for (i = 0; i < length; i++) { if ((i + 1) < length) { // start TWI module and acknowledge data after reception diff --git a/src/arch/avr/include/arch/uart.h b/src/arch/avr/include/arch/uart.h index 80e7dfd..2e63e72 100644 --- a/src/arch/avr/include/arch/uart.h +++ b/src/arch/avr/include/arch/uart.h @@ -19,18 +19,18 @@ struct Uart { uint8_t c_init; }; -void uart_init(struct Uart * uart, unsigned long baud); +void uart_init(struct Uart * uart, uint32_t baud); -int uart_count(); -struct Uart * uart_new(int num); +int16_t uart_count(); +struct Uart * uart_new(int16_t num); -unsigned char uart_can_read(struct Uart * uart); -unsigned char uart_can_write(struct Uart * uart); +uint8_t uart_can_read(struct Uart * uart); +uint8_t uart_can_write(struct Uart * uart); -unsigned char uart_read(struct Uart * uart); -void uart_write(struct Uart * uart, unsigned char data); +uint8_t uart_read(struct Uart * uart); +void uart_write(struct Uart * uart, uint8_t data); extern struct Uart * uart_stdio; -void uart_stdio_init(int num, unsigned long baud); +void uart_stdio_init(int16_t num, uint32_t baud); #endif // _ARCH_UART_H diff --git a/src/arch/avr/uart.c b/src/arch/avr/uart.c index c012a72..589827b 100644 --- a/src/arch/avr/uart.c +++ b/src/arch/avr/uart.c @@ -40,11 +40,11 @@ #error "Could not find UART definitions" #endif -int uart_count() { +int16_t uart_count() { return sizeof(UARTS)/sizeof(struct Uart); } -struct Uart * uart_new(int num) { +struct Uart * uart_new(int16_t num) { if (num < uart_count()) { return &UARTS[num]; } else { @@ -52,8 +52,8 @@ struct Uart * uart_new(int num) { } } -void uart_init(struct Uart * uart, unsigned long baud) { - unsigned long baud_prescale = (F_CPU / (baud * 16UL)) - 1; +void uart_init(struct Uart * uart, uint32_t baud) { + uint32_t baud_prescale = (F_CPU / (baud * 16UL)) - 1; *(uart->baud_h) = (uint8_t)(baud_prescale>>8); *(uart->baud_l) = (uint8_t)(baud_prescale); *(uart->a) = uart->a_init; @@ -61,38 +61,38 @@ void uart_init(struct Uart * uart, unsigned long baud) { *(uart->c) = uart->c_init; } -unsigned char uart_can_read(struct Uart * uart) { +uint8_t uart_can_read(struct Uart * uart) { return (*(uart->a)) & uart->a_read; } -unsigned char uart_read(struct Uart * uart) { +uint8_t uart_read(struct Uart * uart) { while (!uart_can_read(uart)) ; return *(uart->data); } -unsigned char uart_can_write(struct Uart * uart) { +uint8_t uart_can_write(struct Uart * uart) { return (*(uart->a)) & uart->a_write; } -void uart_write(struct Uart * uart, unsigned char data) { +void uart_write(struct Uart * uart, uint8_t data) { while (!uart_can_write(uart)) ; *(uart->data) = data; } struct Uart * uart_stdio = NULL; -int uart_stdio_get(FILE * stream) { - return (int)uart_read(uart_stdio); +int16_t uart_stdio_get(FILE * stream) { + return (int16_t)uart_read(uart_stdio); } -int uart_stdio_put(char data, FILE * stream) { - uart_write(uart_stdio, (unsigned char)data); +int16_t uart_stdio_put(char data, FILE * stream) { + uart_write(uart_stdio, (uint8_t)data); return 0; } FILE uart_stdio_file = FDEV_SETUP_STREAM(uart_stdio_put, uart_stdio_get, _FDEV_SETUP_RW); -void uart_stdio_init(int num, unsigned long baud) { +void uart_stdio_init(int16_t num, uint32_t baud) { struct Uart * uart = uart_new(num); if(uart != NULL) { uart_init(uart, baud); diff --git a/src/board/arduino/mega2560/battery.c b/src/board/arduino/mega2560/battery.c index 5f6ce3d..183288c 100644 --- a/src/board/arduino/mega2560/battery.c +++ b/src/board/arduino/mega2560/battery.c @@ -4,17 +4,17 @@ #include -int smbus_read(uint8_t address, uint8_t command, uint16_t * data) { +int16_t smbus_read(uint8_t address, uint8_t command, uint16_t * data) { return i2c_get(NULL, address, command, (uint8_t *)data, 2); } -int smbus_write(uint8_t address, uint8_t command, uint16_t data) { +int16_t smbus_write(uint8_t address, uint8_t command, uint16_t data) { return i2c_set(NULL, address, command, (uint8_t *)&data, 2); } void battery_debug(void) { uint16_t data = 0; - int res = 0; + int16_t res = 0; #define command(N, A, V) { \ printf(#N ": "); \ diff --git a/src/board/arduino/mega2560/i2c.c b/src/board/arduino/mega2560/i2c.c index 3c056a3..cb58e91 100644 --- a/src/board/arduino/mega2560/i2c.c +++ b/src/board/arduino/mega2560/i2c.c @@ -5,7 +5,7 @@ #include #include -void i2c_init(unsigned long baud) { +void i2c_init(uint32_t baud) { TWAR = 0; TWBR = (uint8_t)(((F_CPU / baud) - 16 ) / 2); TWCR = 0; diff --git a/src/board/arduino/mega2560/include/board/i2c.h b/src/board/arduino/mega2560/include/board/i2c.h index 735558f..dbec82a 100644 --- a/src/board/arduino/mega2560/include/board/i2c.h +++ b/src/board/arduino/mega2560/include/board/i2c.h @@ -3,6 +3,6 @@ #ifndef _BOARD_I2C_H #define _BOARD_I2C_H -void i2c_init(unsigned long baud); +void i2c_init(uint32_t baud); #endif // _BOARD_I2C_H diff --git a/src/board/arduino/mega2560/main.c b/src/board/arduino/mega2560/main.c index a8067b4..895567d 100644 --- a/src/board/arduino/mega2560/main.c +++ b/src/board/arduino/mega2560/main.c @@ -12,7 +12,7 @@ void init(void) { struct Gpio LED = GPIO(B, 7); //TODO: .h file -void parallel_main(void); +int parallel_main(void); int main(void) { init(); diff --git a/src/board/arduino/mega2560/parallel.c b/src/board/arduino/mega2560/parallel.c index 5b61c1a..eeb4d51 100644 --- a/src/board/arduino/mega2560/parallel.c +++ b/src/board/arduino/mega2560/parallel.c @@ -213,7 +213,7 @@ void parallel_write_data(struct Parallel * port, uint8_t byte) { } //TODO: timeout -int parallel_transaction(struct Parallel * port, uint8_t * data, int length, bool read, bool addr) { +int16_t parallel_transaction(struct Parallel * port, uint8_t * data, int16_t length, bool read, bool addr) { if (!read) { // Set write line low gpio_set(port->write_n, false); @@ -222,7 +222,7 @@ int parallel_transaction(struct Parallel * port, uint8_t * data, int length, boo parallel_data_forward(port); } - int i; + int16_t i; uint8_t byte = 0; for (i = 0; i < length; i++) { // Wait for peripheral to indicate it's ready for next cycle @@ -333,8 +333,8 @@ static uint8_t SPI_ENABLE = 0xFE; static uint8_t SPI_DATA = 0xFD; // Disable chip -int parallel_spi_reset(struct Parallel *port) { - int res; +int16_t parallel_spi_reset(struct Parallel *port) { + int16_t res; res = parallel_set_address(port, &ADDRESS_INDAR1, 1); if (res < 0) return res; @@ -349,8 +349,8 @@ int parallel_spi_reset(struct Parallel *port) { } // Enable chip and read or write data -int parallel_spi_transaction(struct Parallel *port, uint8_t * data, int length, bool read) { - int res; +int16_t parallel_spi_transaction(struct Parallel *port, uint8_t * data, int16_t length, bool read) { + int16_t res; res = parallel_set_address(port, &ADDRESS_INDAR1, 1); if (res < 0) return res; @@ -368,10 +368,10 @@ int parallel_spi_transaction(struct Parallel *port, uint8_t * data, int length, #define parallel_spi_write(P, D, L) parallel_spi_transaction(P, D, L, false) // "Hardware" accelerated SPI programming, requires ECINDARs to be set -int parallel_spi_program(struct Parallel * port, uint8_t * data, int length, bool initialized) { +int16_t parallel_spi_program(struct Parallel * port, uint8_t * data, int16_t length, bool initialized) { static uint8_t aai[6] = { 0xAD, 0, 0, 0, 0, 0 }; - int res; - int i; + int16_t res; + int16_t i; uint8_t status; for(i = 0; (i + 1) < length; i+=2) { @@ -420,13 +420,13 @@ int parallel_spi_program(struct Parallel * port, uint8_t * data, int length, boo return i; } -int serial_transaction(uint8_t * data, int length, bool read) { - int i; +int16_t serial_transaction(uint8_t * data, int16_t length, bool read) { + int16_t i; for (i = 0; i < length; i++) { if (read) { data[i] = (uint8_t)uart_read(uart_stdio); } else { - uart_write(uart_stdio, (unsigned char)data[i]); + uart_write(uart_stdio, (uint8_t)data[i]); } } @@ -437,20 +437,20 @@ int serial_transaction(uint8_t * data, int length, bool read) { #define serial_write(D, L) serial_transaction(D, L, false) int parallel_main(void) { - int res = 0; + int16_t res = 0; struct Parallel * port = &PORT; parallel_state(port, PARALLEL_STATE_HIZ); static uint8_t data[128]; char command; - int length; - int i; + int16_t length; + int16_t i; uint8_t address; bool set_address = false; bool program_aai = false; - unsigned char console_msg[] = "Entering console mode\n"; + uint8_t console_msg[] = "Entering console mode\n"; for (;;) { // Read command and length @@ -471,7 +471,7 @@ int parallel_main(void) { } // Length is received data + 1 - length = ((int)data[1]) + 1; + length = ((int16_t)data[1]) + 1; // Truncate length to size of data if (length > sizeof(data)) length = sizeof(data); diff --git a/src/board/arduino/uno/battery.c b/src/board/arduino/uno/battery.c index 5f6ce3d..183288c 100644 --- a/src/board/arduino/uno/battery.c +++ b/src/board/arduino/uno/battery.c @@ -4,17 +4,17 @@ #include -int smbus_read(uint8_t address, uint8_t command, uint16_t * data) { +int16_t smbus_read(uint8_t address, uint8_t command, uint16_t * data) { return i2c_get(NULL, address, command, (uint8_t *)data, 2); } -int smbus_write(uint8_t address, uint8_t command, uint16_t data) { +int16_t smbus_write(uint8_t address, uint8_t command, uint16_t data) { return i2c_set(NULL, address, command, (uint8_t *)&data, 2); } void battery_debug(void) { uint16_t data = 0; - int res = 0; + int16_t res = 0; #define command(N, A, V) { \ printf(#N ": "); \ diff --git a/src/board/arduino/uno/i2c.c b/src/board/arduino/uno/i2c.c index 3c056a3..cb58e91 100644 --- a/src/board/arduino/uno/i2c.c +++ b/src/board/arduino/uno/i2c.c @@ -5,7 +5,7 @@ #include #include -void i2c_init(unsigned long baud) { +void i2c_init(uint32_t baud) { TWAR = 0; TWBR = (uint8_t)(((F_CPU / baud) - 16 ) / 2); TWCR = 0; diff --git a/src/board/arduino/uno/include/board/i2c.h b/src/board/arduino/uno/include/board/i2c.h index 735558f..dbec82a 100644 --- a/src/board/arduino/uno/include/board/i2c.h +++ b/src/board/arduino/uno/include/board/i2c.h @@ -3,6 +3,6 @@ #ifndef _BOARD_I2C_H #define _BOARD_I2C_H -void i2c_init(unsigned long baud); +void i2c_init(uint32_t baud); #endif // _BOARD_I2C_H diff --git a/src/board/arduino/uno/main.c b/src/board/arduino/uno/main.c index 5e90797..ea529af 100644 --- a/src/board/arduino/uno/main.c +++ b/src/board/arduino/uno/main.c @@ -12,7 +12,7 @@ void init(void) { struct Gpio LED = GPIO(B, 5); //TODO: .h file -void parallel_main(void); +int parallel_main(void); int main(void) { init(); diff --git a/src/board/arduino/uno/parallel.c b/src/board/arduino/uno/parallel.c index 109be1a..cd7b06a 100644 --- a/src/board/arduino/uno/parallel.c +++ b/src/board/arduino/uno/parallel.c @@ -162,7 +162,7 @@ void parallel_write_data(struct Parallel * port, uint8_t byte) { } //TODO: timeout -int parallel_transaction(struct Parallel * port, uint8_t * data, int length, bool read, bool addr) { +int16_t parallel_transaction(struct Parallel * port, uint8_t * data, int16_t length, bool read, bool addr) { if (!read) { // Set write line low gpio_set(port->write_n, false); @@ -171,7 +171,7 @@ int parallel_transaction(struct Parallel * port, uint8_t * data, int length, boo parallel_data_forward(port); } - int i; + int16_t i; uint8_t byte = 0; for (i = 0; i < length; i++) { // Wait for peripheral to indicate it's ready for next cycle @@ -278,8 +278,8 @@ static uint8_t SPI_ENABLE = 0xFE; static uint8_t SPI_DATA = 0xFD; // Disable chip -int parallel_spi_reset(struct Parallel *port) { - int res; +int16_t parallel_spi_reset(struct Parallel *port) { + int16_t res; res = parallel_set_address(port, &ADDRESS_INDAR1, 1); if (res < 0) return res; @@ -294,8 +294,8 @@ int parallel_spi_reset(struct Parallel *port) { } // Enable chip and read or write data -int parallel_spi_transaction(struct Parallel *port, uint8_t * data, int length, bool read) { - int res; +int16_t parallel_spi_transaction(struct Parallel *port, uint8_t * data, int16_t length, bool read) { + int16_t res; res = parallel_set_address(port, &ADDRESS_INDAR1, 1); if (res < 0) return res; @@ -313,10 +313,10 @@ int parallel_spi_transaction(struct Parallel *port, uint8_t * data, int length, #define parallel_spi_write(P, D, L) parallel_spi_transaction(P, D, L, false) // "Hardware" accelerated SPI programming, requires ECINDARs to be set -int parallel_spi_program(struct Parallel * port, uint8_t * data, int length, bool initialized) { +int16_t parallel_spi_program(struct Parallel * port, uint8_t * data, int16_t length, bool initialized) { static uint8_t aai[6] = { 0xAD, 0, 0, 0, 0, 0 }; - int res; - int i; + int16_t res; + int16_t i; uint8_t status; for(i = 0; (i + 1) < length; i+=2) { @@ -365,13 +365,13 @@ int parallel_spi_program(struct Parallel * port, uint8_t * data, int length, boo return i; } -int serial_transaction(uint8_t * data, int length, bool read) { - int i; +int16_t serial_transaction(uint8_t * data, int16_t length, bool read) { + int16_t i; for (i = 0; i < length; i++) { if (read) { data[i] = (uint8_t)uart_read(uart_stdio); } else { - uart_write(uart_stdio, (unsigned char)data[i]); + uart_write(uart_stdio, (uint8_t)data[i]); } } @@ -381,21 +381,21 @@ int serial_transaction(uint8_t * data, int length, bool read) { #define serial_read(D, L) serial_transaction(D, L, true) #define serial_write(D, L) serial_transaction(D, L, false) -int parallel_main(void) { - int res = 0; +int16_t parallel_main(void) { + int16_t res = 0; struct Parallel * port = &PORT; parallel_reset(port, true); static uint8_t data[128]; char command; - int length; - int i; + int16_t length; + int16_t i; uint8_t address; bool set_address = false; bool program_aai = false; - unsigned char console_msg[] = "Entering console mode\n"; + uint8_t console_msg[] = "Entering console mode\n"; for (;;) { // Read command and length @@ -416,7 +416,7 @@ int parallel_main(void) { } // Length is received data + 1 - length = ((int)data[1]) + 1; + length = ((int16_t)data[1]) + 1; // Truncate length to size of data if (length > sizeof(data)) length = sizeof(data); diff --git a/src/board/system76/common/battery.c b/src/board/system76/common/battery.c index 5042d60..662b2d6 100644 --- a/src/board/system76/common/battery.c +++ b/src/board/system76/common/battery.c @@ -49,7 +49,7 @@ bool battery_set_end_threshold(uint8_t value) { /** * Configure the charger based on charging threshold values. */ -int battery_charger_configure(void) { +int16_t battery_charger_configure(void) { static bool should_charge = true; if (battery_get_end_threshold() == BATTERY_END_DEFAULT) { @@ -85,7 +85,7 @@ uint16_t battery_design_capacity = 0; uint16_t battery_design_voltage = 0; void battery_event(void) { - int res = 0; + int16_t res = 0; #define command(N, V) { \ res = smbus_read(BATTERY_ADDRESS, V, &N); \ diff --git a/src/board/system76/common/charger/bq24780s.c b/src/board/system76/common/charger/bq24780s.c index bb2e62b..3f1676d 100644 --- a/src/board/system76/common/charger/bq24780s.c +++ b/src/board/system76/common/charger/bq24780s.c @@ -21,8 +21,8 @@ // XXX: Assumption: ac_last is initialized high. static bool charger_enabled = false; -int battery_charger_disable(void) { - int res = 0; +int16_t battery_charger_disable(void) { + int16_t res = 0; if (!charger_enabled) return 0; @@ -53,8 +53,8 @@ int battery_charger_disable(void) { return 0; } -int battery_charger_enable(void) { - int res = 0; +int16_t battery_charger_enable(void) { + int16_t res = 0; if (charger_enabled) return 0; @@ -93,7 +93,7 @@ void battery_charger_event(void) { void battery_debug(void) { uint16_t data = 0; - int res = 0; + int16_t res = 0; #define command(N, A, V) { \ DEBUG(" " #N ": "); \ diff --git a/src/board/system76/common/charger/oz26786.c b/src/board/system76/common/charger/oz26786.c index 5792ca4..a82fa87 100644 --- a/src/board/system76/common/charger/oz26786.c +++ b/src/board/system76/common/charger/oz26786.c @@ -20,8 +20,8 @@ // XXX: Assumption: ac_last is initialized high. static bool charger_enabled = false; -int battery_charger_disable(void) { - int res = 0; +int16_t battery_charger_disable(void) { + int16_t res = 0; if (!charger_enabled) return 0; @@ -61,8 +61,8 @@ int battery_charger_disable(void) { return 0; } -int battery_charger_enable(void) { - int res = 0; +int16_t battery_charger_enable(void) { + int16_t res = 0; if (charger_enabled) return 0; @@ -112,7 +112,7 @@ void battery_charger_event(void) { void battery_debug(void) { uint16_t data = 0; - int res = 0; + int16_t res = 0; #define command(N, A, V) { \ DEBUG(" " #N ": "); \ diff --git a/src/board/system76/common/dgpu.c b/src/board/system76/common/dgpu.c index 815723a..ce2c04b 100644 --- a/src/board/system76/common/dgpu.c +++ b/src/board/system76/common/dgpu.c @@ -66,7 +66,7 @@ uint8_t dgpu_get_fan_duty(void) { if (power_state == POWER_STATE_S0 && gpio_get(&DGPU_PWR_EN) && !gpio_get(&GC6_FB_EN)) { // Use I2CS if in S0 state int8_t rlts; - int res = i2c_get(&I2C_DGPU, 0x4F, 0x00, &rlts, 1); + int16_t res = i2c_get(&I2C_DGPU, 0x4F, 0x00, &rlts, 1); if (res == 1) { dgpu_temp = (int16_t)rlts; duty = fan_duty(&FAN, dgpu_temp); diff --git a/src/board/system76/common/fan.c b/src/board/system76/common/fan.c index 116ab6d..48a065f 100644 --- a/src/board/system76/common/fan.c +++ b/src/board/system76/common/fan.c @@ -26,7 +26,7 @@ void fan_reset(void) { // Get duty cycle based on temperature, adapted from // https://github.com/pop-os/system76-power/blob/master/src/fan.rs uint8_t fan_duty(const struct Fan * fan, int16_t temp) __reentrant { - for (int i = 0; i < fan->points_size; i++) { + for (int16_t i = 0; i < fan->points_size; i++) { const struct FanPoint * cur = &fan->points[i]; // If exactly the current temp, return the current duty @@ -86,7 +86,7 @@ void fan_duty_set(uint8_t peci_fan_duty, uint8_t dgpu_fan_duty) __reentrant { uint8_t fan_heatup(const struct Fan * fan, uint8_t duty) __reentrant { uint8_t lowest = duty; - int i; + int16_t i; for (i = 0; (i + 1) < fan->heatup_size; i++) { uint8_t value = fan->heatup[i + 1]; if (value < lowest) { @@ -102,7 +102,7 @@ uint8_t fan_heatup(const struct Fan * fan, uint8_t duty) __reentrant { uint8_t fan_cooldown(const struct Fan * fan, uint8_t duty) __reentrant { uint8_t highest = duty; - int i; + int16_t i; for (i = 0; (i + 1) < fan->cooldown_size; i++) { uint8_t value = fan->cooldown[i + 1]; if (value > highest) { diff --git a/src/board/system76/common/include/board/battery.h b/src/board/system76/common/include/board/battery.h index 6921388..7316d5d 100644 --- a/src/board/system76/common/include/board/battery.h +++ b/src/board/system76/common/include/board/battery.h @@ -34,13 +34,13 @@ bool battery_set_start_threshold(uint8_t value); uint8_t battery_get_end_threshold(void); bool battery_set_end_threshold(uint8_t value); -int battery_charger_configure(void); +int16_t battery_charger_configure(void); void battery_event(void); void battery_reset(void); // Defined by charger/*.c -int battery_charger_disable(void); -int battery_charger_enable(void); +int16_t battery_charger_disable(void); +int16_t battery_charger_enable(void); void battery_charger_event(void); void battery_debug(void); diff --git a/src/board/system76/common/include/board/parallel.h b/src/board/system76/common/include/board/parallel.h index e117dba..530def7 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); -int parallel_write(uint8_t * data, int length); +int16_t parallel_write(uint8_t * data, int16_t length); #endif // _BOARD_PARALLEL_H diff --git a/src/board/system76/common/include/board/peci.h b/src/board/system76/common/include/board/peci.h index 9e55753..7d6fb9f 100644 --- a/src/board/system76/common/include/board/peci.h +++ b/src/board/system76/common/include/board/peci.h @@ -9,7 +9,7 @@ extern bool peci_on; extern int16_t peci_temp; void peci_init(void); -int peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data); +int16_t peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data); uint8_t peci_get_fan_duty(void); #endif // _BOARD_PECI_H diff --git a/src/board/system76/common/include/board/smbus.h b/src/board/system76/common/include/board/smbus.h index a3f9512..60220ba 100644 --- a/src/board/system76/common/include/board/smbus.h +++ b/src/board/system76/common/include/board/smbus.h @@ -6,7 +6,7 @@ #include void smbus_init(void); -int smbus_read(uint8_t address, uint8_t command, uint16_t * data); -int smbus_write(uint8_t address, uint8_t command, uint16_t data); +int16_t smbus_read(uint8_t address, uint8_t command, uint16_t * data); +int16_t smbus_write(uint8_t address, uint8_t command, uint16_t data); #endif // _BOARD_SMBUS_H diff --git a/src/board/system76/common/include/board/smfi.h b/src/board/system76/common/include/board/smfi.h index 8d5d32b..56b4a11 100644 --- a/src/board/system76/common/include/board/smfi.h +++ b/src/board/system76/common/include/board/smfi.h @@ -3,9 +3,11 @@ #ifndef _BOARD_SMFI_H #define _BOARD_SMFI_H +#include + void smfi_init(void); void smfi_watchdog(void); void smfi_event(void); -void smfi_debug(unsigned char byte); +void smfi_debug(uint8_t byte); #endif // _BOARD_SMFI_H diff --git a/src/board/system76/common/kbled.c b/src/board/system76/common/kbled.c index 7f7fb7e..4328542 100644 --- a/src/board/system76/common/kbled.c +++ b/src/board/system76/common/kbled.c @@ -3,7 +3,7 @@ #include #include -static int LEVEL_I = 1; +static int16_t LEVEL_I = 1; static const uint8_t __code LEVELS[] = { 48, 72, @@ -13,7 +13,7 @@ static const uint8_t __code LEVELS[] = { 255 }; -static int COLOR_I = 0; +static int16_t COLOR_I = 0; static const uint32_t __code COLORS[] = { 0xFFFFFF, 0x0000FF, diff --git a/src/board/system76/common/kbled/bonw14.c b/src/board/system76/common/kbled/bonw14.c index 802e165..1f31f4f 100644 --- a/src/board/system76/common/kbled/bonw14.c +++ b/src/board/system76/common/kbled/bonw14.c @@ -15,7 +15,7 @@ void kbled_init(void) { void kbled_reset(void) { uint8_t value = 0xE4; - int res = i2c_set(&I2C_DGPU, 0x2D, 0xA0, &value, 1); + int16_t res = i2c_set(&I2C_DGPU, 0x2D, 0xA0, &value, 1); DEBUG("kbled_reset 0x2D: %d\n", res); //value = 0xC4; diff --git a/src/board/system76/common/kbscan.c b/src/board/system76/common/kbscan.c index 7d3b3bf..780be1b 100644 --- a/src/board/system76/common/kbscan.c +++ b/src/board/system76/common/kbscan.c @@ -30,11 +30,11 @@ uint8_t kbscan_matrix[KM_OUT] = { 0 }; uint8_t sci_extra = 0; -static inline bool matrix_position_is_esc(int row, int col) { +static inline bool matrix_position_is_esc(int16_t row, int16_t col) { return (row == MATRIX_ESC_OUTPUT) && (col == MATRIX_ESC_INPUT); } -static inline bool matrix_position_is_fn(int row, int col) { +static inline bool matrix_position_is_fn(int16_t row, int16_t col) { return (row == MATRIX_FN_OUTPUT) && (col == MATRIX_FN_INPUT); } @@ -60,7 +60,7 @@ void kbscan_init(void) { // Debounce time in milliseconds #define DEBOUNCE_DELAY 15 -static uint8_t kbscan_get_row(int i) { +static uint8_t kbscan_get_row(int16_t i) { // Report all keys as released when lid is closed if (!lid_state) { return 0; @@ -118,7 +118,7 @@ static uint8_t kbscan_get_row(int i) { } #if KM_NKEY -static bool kbscan_has_ghost_in_row(int row, uint8_t rowdata) { +static bool kbscan_has_ghost_in_row(int16_t row, uint8_t rowdata) { // Use arguments row = row; rowdata = rowdata; @@ -129,7 +129,7 @@ static inline bool popcount_more_than_one(uint8_t rowdata) { return rowdata & (rowdata - 1); } -static uint8_t kbscan_get_real_keys(int row, uint8_t rowdata) { +static uint8_t kbscan_get_real_keys(int16_t row, uint8_t rowdata) { // Remove any "active" blanks from the matrix. uint8_t realdata = 0; for (uint8_t col = 0; col < KM_IN; col++) { @@ -143,7 +143,7 @@ static uint8_t kbscan_get_real_keys(int row, uint8_t rowdata) { return realdata; } -static bool kbscan_has_ghost_in_row(int row, uint8_t rowdata) { +static bool kbscan_has_ghost_in_row(int16_t row, uint8_t rowdata) { rowdata = kbscan_get_real_keys(row, rowdata); // No ghosts exist when less than 2 keys in the row are active. @@ -152,7 +152,7 @@ static bool kbscan_has_ghost_in_row(int row, uint8_t rowdata) { } // Check against other rows to see if more than one column matches. - for (int i = 0; i < KM_OUT; i++) { + for (int16_t i = 0; i < KM_OUT; i++) { uint8_t otherrow = kbscan_get_real_keys(i, kbscan_get_row(i)); if (i != row && popcount_more_than_one(otherrow & rowdata)) { return true; @@ -315,7 +315,7 @@ void kbscan_event(void) { } } - int i; + int16_t i; for (i = 0; i < KM_OUT; i++) { uint8_t new = kbscan_get_row(i); uint8_t last = kbscan_matrix[i]; @@ -331,7 +331,7 @@ void kbscan_event(void) { } // A key was pressed or released - int j; + int16_t j; for (j = 0; j < KM_IN; j++) { bool new_b = new & BIT(j); bool last_b = last & BIT(j); diff --git a/src/board/system76/common/keymap.c b/src/board/system76/common/keymap.c index 91196df..c0094c8 100644 --- a/src/board/system76/common/keymap.c +++ b/src/board/system76/common/keymap.c @@ -17,9 +17,9 @@ void keymap_init(void) { } void keymap_load_default(void) { - for (int layer = 0; layer < KM_LAY; layer++) { - for (int output = 0; output < KM_OUT; output++) { - for (int input = 0; input < KM_IN; input++) { + for (int16_t layer = 0; layer < KM_LAY; layer++) { + for (int16_t output = 0; output < KM_OUT; output++) { + for (int16_t input = 0; input < KM_IN; input++) { DYNAMIC_KEYMAP[layer][output][input] = KEYMAP[layer][output][input]; } } @@ -57,7 +57,7 @@ bool keymap_save_config(void) { return flash_read_u16(CONFIG_ADDR) == CONFIG_SIGNATURE; } -bool keymap_get(int layer, int output, int input, uint16_t * value) { +bool keymap_get(int16_t layer, int16_t output, int16_t input, uint16_t * value) { if (layer < KM_LAY && output < KM_OUT && input < KM_IN) { *value = DYNAMIC_KEYMAP[layer][output][input]; return true; @@ -66,7 +66,7 @@ bool keymap_get(int layer, int output, int input, uint16_t * value) { } } -bool keymap_set(int layer, int output, int input, uint16_t value) { +bool keymap_set(int16_t layer, int16_t output, int16_t input, uint16_t value) { if (layer < KM_LAY && output < KM_OUT && input < KM_IN) { DYNAMIC_KEYMAP[layer][output][input] = value; return true; diff --git a/src/board/system76/common/parallel.c b/src/board/system76/common/parallel.c index ff0c0e9..fd460a3 100644 --- a/src/board/system76/common/parallel.c +++ b/src/board/system76/common/parallel.c @@ -82,14 +82,14 @@ bool parallel_init(void) { return parallel_wait_peripheral(STS_WAIT, 0); } -int parallel_write(uint8_t * data, int length) { +int16_t parallel_write(uint8_t * data, int16_t length) { // Assert nWRITE KSIGDAT &= ~CTL_WRITE; // Set data lines as outputs KSOLGOEN = 0xFF; - int i; + int16_t i; for (i = 0; i < length; i++) { // Wait for peripheral to indicate it's ready for next cycle if (!parallel_wait_peripheral(STS_WAIT, 0)) { diff --git a/src/board/system76/common/peci.c b/src/board/system76/common/peci.c index 4b333a6..00dc989 100644 --- a/src/board/system76/common/peci.c +++ b/src/board/system76/common/peci.c @@ -69,7 +69,7 @@ void peci_init(void) { // Returns positive completion code on success, negative completion code or // negative (0x1000 | status register) on PECI hardware error -int peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data) { +int16_t peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data) { // Wait for completion while (HOSTAR & 1) {} // Clear status @@ -105,9 +105,9 @@ int peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data) { // Wait for completion while (HOSTAR & 1) {} - int status = (int)HOSTAR; + int16_t status = (int16_t)HOSTAR; if (status & BIT(1)) { - int cc = (int)HORDDR; + int16_t cc = (int16_t)HORDDR; if (cc & 0x80) { return -cc; } else { diff --git a/src/board/system76/common/power.c b/src/board/system76/common/power.c index 73b969c..594ec53 100644 --- a/src/board/system76/common/power.c +++ b/src/board/system76/common/power.c @@ -294,7 +294,7 @@ void power_on_s5(void) { // Wait for SUSPWRDNACK validity tPLT01; - for (int i = 0; i < 5000; i++) { + for (int16_t i = 0; i < 5000; i++) { // If we reached S0, exit this loop update_power_state(); if (power_state == POWER_STATE_S0) { @@ -361,9 +361,9 @@ void power_off_s5(void) { static void power_peci_limit(bool ac) { uint8_t watts = ac ? POWER_LIMIT_AC : POWER_LIMIT_DC; // Retry, timeout errors happen occasionally - for (int i = 0; i < 16; i++) { + for (int16_t i = 0; i < 16; i++) { // Set PL4 using PECI - int res = peci_wr_pkg_config(60, 0, ((uint32_t)watts) * 8); + int16_t res = peci_wr_pkg_config(60, 0, ((uint32_t)watts) * 8); DEBUG("power_peci_limit %d = %d\n", watts, res); if (res == 0x40) { break; @@ -466,7 +466,7 @@ void power_event(void) { bool ps_new = gpio_get(&PWR_SW_N); if (!ps_new && ps_last) { // Ensure press is not spurious - for (int i = 0; i < 100; i++) { + for (int16_t i = 0; i < 100; i++) { delay_ms(1); if (gpio_get(&PWR_SW_N) != ps_new) { DEBUG("%02X: Spurious press\n", main_cycle); diff --git a/src/board/system76/common/scratch/stdio.c b/src/board/system76/common/scratch/stdio.c index 273947c..9ca2f8b 100644 --- a/src/board/system76/common/scratch/stdio.c +++ b/src/board/system76/common/scratch/stdio.c @@ -5,7 +5,7 @@ #include int putchar(int c) { - unsigned char byte = (unsigned char)c; + uint8_t byte = (uint8_t)c; smfi_debug(byte); return (int)byte; } diff --git a/src/board/system76/common/smbus.c b/src/board/system76/common/smbus.c index 5233ec7..fcc8120 100644 --- a/src/board/system76/common/smbus.c +++ b/src/board/system76/common/smbus.c @@ -22,10 +22,10 @@ void smbus_init(void) { i2c_reset(&I2C_SMBUS, true); } -int smbus_read(uint8_t address, uint8_t command, uint16_t * data) { +int16_t smbus_read(uint8_t address, uint8_t command, uint16_t * data) { return i2c_get(&I2C_SMBUS, address, command, (uint8_t *)data, 2); } -int smbus_write(uint8_t address, uint8_t command, uint16_t data) { +int16_t smbus_write(uint8_t address, uint8_t command, uint16_t data) { return i2c_set(&I2C_SMBUS, address, command, (uint8_t *)&data, 2); } diff --git a/src/board/system76/common/smfi.c b/src/board/system76/common/smfi.c index 42cb551..dffb638 100644 --- a/src/board/system76/common/smfi.c +++ b/src/board/system76/common/smfi.c @@ -71,7 +71,7 @@ static volatile uint8_t __xdata __at(0xF00) smfi_dbg[256]; #if !defined(__SCRATCH__) void smfi_init(void) { - int i; + int16_t i; // Clear command region for (i = (SMFI_CMD_CMD + 1); i < ARRAY_SIZE(smfi_cmd); i++) { @@ -151,9 +151,9 @@ static enum Result cmd_fan_set(void) { } static enum Result cmd_keymap_get(void) { - int layer = smfi_cmd[SMFI_CMD_DATA]; - int output = smfi_cmd[SMFI_CMD_DATA + 1]; - int input = smfi_cmd[SMFI_CMD_DATA + 2]; + int16_t layer = smfi_cmd[SMFI_CMD_DATA]; + int16_t output = smfi_cmd[SMFI_CMD_DATA + 1]; + int16_t input = smfi_cmd[SMFI_CMD_DATA + 2]; uint16_t key = 0; if (keymap_get(layer, output, input, &key)) { smfi_cmd[SMFI_CMD_DATA + 3] = (uint8_t)key; @@ -165,9 +165,9 @@ static enum Result cmd_keymap_get(void) { } static enum Result cmd_keymap_set(void) { - int layer = smfi_cmd[SMFI_CMD_DATA]; - int output = smfi_cmd[SMFI_CMD_DATA + 1]; - int input = smfi_cmd[SMFI_CMD_DATA + 2]; + int16_t layer = smfi_cmd[SMFI_CMD_DATA]; + int16_t output = smfi_cmd[SMFI_CMD_DATA + 1]; + int16_t input = smfi_cmd[SMFI_CMD_DATA + 2]; uint16_t key = ((uint16_t)smfi_cmd[SMFI_CMD_DATA + 3]) | (((uint16_t)smfi_cmd[SMFI_CMD_DATA + 4]) << 8); @@ -389,8 +389,8 @@ void smfi_event(void) { } } -void smfi_debug(unsigned char byte) { - int tail = (int)smfi_dbg[SMFI_DBG_TAIL]; +void smfi_debug(uint8_t byte) { + int16_t tail = (int16_t)smfi_dbg[SMFI_DBG_TAIL]; tail++; if (tail >= ARRAY_SIZE(smfi_dbg)) { tail = SMFI_DBG_TAIL + 1; diff --git a/src/board/system76/common/stdio.c b/src/board/system76/common/stdio.c index fc925e9..eae821f 100644 --- a/src/board/system76/common/stdio.c +++ b/src/board/system76/common/stdio.c @@ -17,7 +17,7 @@ #endif // PARALLEL_DEBUG int putchar(int c) { - unsigned char byte = (unsigned char)c; + uint8_t byte = (uint8_t)c; smfi_debug(byte); diff --git a/src/common/i2c.c b/src/common/i2c.c index c1b4e98..e35faa8 100644 --- a/src/common/i2c.c +++ b/src/common/i2c.c @@ -2,8 +2,8 @@ #include -int i2c_recv(struct I2C * i2c, uint8_t addr, uint8_t* data, int length) __reentrant { - int res = 0; +int16_t i2c_recv(struct I2C * i2c, uint8_t addr, uint8_t* data, int16_t length) __reentrant { + int16_t res = 0; res = i2c_start(i2c, addr, true); if (res < 0) return res; @@ -16,8 +16,8 @@ int i2c_recv(struct I2C * i2c, uint8_t addr, uint8_t* data, int length) __reentr return res; } -int i2c_send(struct I2C * i2c, uint8_t addr, uint8_t* data, int length) __reentrant { - int res = 0; +int16_t i2c_send(struct I2C * i2c, uint8_t addr, uint8_t* data, int16_t length) __reentrant { + int16_t res = 0; res = i2c_start(i2c, addr, false); if (res < 0) return res; @@ -30,8 +30,8 @@ int i2c_send(struct I2C * i2c, uint8_t addr, uint8_t* data, int length) __reentr return res; } -int i2c_get(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int length) __reentrant { - int res = 0; +int16_t i2c_get(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int16_t length) __reentrant { + int16_t res = 0; res = i2c_start(i2c, addr, false); if (res < 0) return res; @@ -42,8 +42,8 @@ int i2c_get(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int leng return i2c_recv(i2c, addr, data, length); } -int i2c_set(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int length) __reentrant { - int res = 0; +int16_t i2c_set(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int16_t length) __reentrant { + int16_t res = 0; res = i2c_start(i2c, addr, false); if (res < 0) return res; diff --git a/src/common/include/common/i2c.h b/src/common/include/common/i2c.h index c8102fe..370630d 100644 --- a/src/common/include/common/i2c.h +++ b/src/common/include/common/i2c.h @@ -16,7 +16,7 @@ struct I2C; // Start i2c transaction // Must be defined by arch, board, or ec -int i2c_start(struct I2C * i2c, uint8_t addr, bool read) __reentrant; +int16_t i2c_start(struct I2C * i2c, uint8_t addr, bool read) __reentrant; // Stop i2c transaction // Must be defined by arch, board, or ec @@ -24,22 +24,22 @@ void i2c_stop(struct I2C * i2c) __reentrant; // Send a byte on i2c bus // Must be defined by arch, board, or ec -int i2c_write(struct I2C * i2c, uint8_t * data, int length) __reentrant; +int16_t i2c_write(struct I2C * i2c, uint8_t * data, int16_t length) __reentrant; // Read bytes from bus // Must be defined by arch, board, or ec -int i2c_read(struct I2C * i2c, uint8_t * data, int length) __reentrant; +int16_t i2c_read(struct I2C * i2c, uint8_t * data, int16_t length) __reentrant; // Read multiple bytes from address in one transaction -int i2c_recv(struct I2C * i2c, uint8_t addr, uint8_t* data, int length) __reentrant; +int16_t i2c_recv(struct I2C * i2c, uint8_t addr, uint8_t* data, int16_t length) __reentrant; // Write multiple bytes to address in one transaction -int i2c_send(struct I2C * i2c, uint8_t addr, uint8_t* data, int length) __reentrant; +int16_t i2c_send(struct I2C * i2c, uint8_t addr, uint8_t* data, int16_t length) __reentrant; // Read multiple bytes from a register in one transaction -int i2c_get(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int length) __reentrant; +int16_t i2c_get(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int16_t length) __reentrant; // Write multiple bytes to a register in one transaction -int i2c_set(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int length) __reentrant; +int16_t i2c_set(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int16_t length) __reentrant; #endif // _COMMON_I2C_H diff --git a/src/common/include/common/keymap.h b/src/common/include/common/keymap.h index 16a3307..7f1d0f0 100644 --- a/src/common/include/common/keymap.h +++ b/src/common/include/common/keymap.h @@ -27,9 +27,9 @@ // Save dynamic keymap to flash bool keymap_save_config(void); // Get a keycode from the dynamic keymap - bool keymap_get(int layer, int output, int input, uint16_t * value); + bool keymap_get(int16_t layer, int16_t output, int16_t input, uint16_t * value); // Set a keycode in the dynamic keymap - bool keymap_set(int layer, int output, int input, uint16_t value); + bool keymap_set(int16_t layer, int16_t output, int16_t input, uint16_t value); #endif // Translate a keycode from PS/2 set 2 to PS/2 set 1 diff --git a/src/ec/ite/i2c.c b/src/ec/ite/i2c.c index b0bd492..51c7caa 100644 --- a/src/ec/ite/i2c.c +++ b/src/ec/ite/i2c.c @@ -57,7 +57,7 @@ void i2c_reset(struct I2C * i2c, bool kill) { *(i2c->hoctl2) = 0; } -int i2c_start(struct I2C * i2c, uint8_t addr, bool read) __reentrant { +int16_t i2c_start(struct I2C * i2c, uint8_t addr, bool read) __reentrant { // If we are already in a transaction if (*(i2c->hosta) & HOSTA_BYTE_DONE) { // If we are switching direction @@ -94,8 +94,8 @@ void i2c_stop(struct I2C * i2c) { i2c_reset(i2c, false); } -static int i2c_transaction(struct I2C * i2c, uint8_t * data, int length, bool read) { - int i; +static int16_t i2c_transaction(struct I2C * i2c, uint8_t * data, int16_t length, bool read) { + int16_t i; for (i = 0; i < length; i++) { if (read) { // If last byte @@ -131,7 +131,7 @@ static int i2c_transaction(struct I2C * i2c, uint8_t * data, int length, bool re // If error occured, kill transaction and return error if (status & HOSTA_ERR) { i2c_reset(i2c, true); - return -(int)(status); + return -(int16_t)(status); } else // If byte done, break if (status & HOSTA_BYTE_DONE) { @@ -141,7 +141,7 @@ static int i2c_transaction(struct I2C * i2c, uint8_t * data, int length, bool re // If timeout occured, kill transaction and return error if (timeout == 0) { i2c_reset(i2c, true); - return -(0x1000 | (int)status); + return -(0x1000 | (int16_t)status); } if (read) { @@ -153,10 +153,10 @@ static int i2c_transaction(struct I2C * i2c, uint8_t * data, int length, bool re return i; } -int i2c_read(struct I2C * i2c, uint8_t * data, int length) __reentrant { +int16_t i2c_read(struct I2C * i2c, uint8_t * data, int16_t length) __reentrant { return i2c_transaction(i2c, data, length, true); } -int i2c_write(struct I2C * i2c, uint8_t * data, int length) __reentrant { +int16_t i2c_write(struct I2C * i2c, uint8_t * data, int16_t length) __reentrant { return i2c_transaction(i2c, data, length, false); } diff --git a/src/ec/ite/include/ec/kbc.h b/src/ec/ite/include/ec/kbc.h index 2467c8f..163f72d 100644 --- a/src/ec/ite/include/ec/kbc.h +++ b/src/ec/ite/include/ec/kbc.h @@ -33,8 +33,8 @@ extern struct Kbc __code KBC; uint8_t kbc_status(struct Kbc * kbc); uint8_t kbc_read(struct Kbc * kbc); -bool kbc_keyboard(struct Kbc * kbc, uint8_t data, int timeout); -bool kbc_mouse(struct Kbc * kbc, uint8_t data, int timeout); +bool kbc_keyboard(struct Kbc * kbc, uint8_t data, int16_t timeout); +bool kbc_mouse(struct Kbc * kbc, uint8_t data, int16_t timeout); volatile uint8_t __xdata __at(0x1300) KBHICR; volatile uint8_t __xdata __at(0x1302) KBIRQR; diff --git a/src/ec/ite/kbc.c b/src/ec/ite/kbc.c index 7f70ec6..47da946 100644 --- a/src/ec/ite/kbc.c +++ b/src/ec/ite/kbc.c @@ -20,7 +20,7 @@ uint8_t kbc_read(struct Kbc * kbc) { return *(kbc->data_in); } -static bool kbc_wait(struct Kbc * kbc, int timeout) { +static bool kbc_wait(struct Kbc * kbc, int16_t timeout) { while (*(kbc->status) & KBC_STS_OBF) { if (timeout == 0) return false; timeout -= 1; @@ -29,14 +29,14 @@ static bool kbc_wait(struct Kbc * kbc, int timeout) { return true; } -bool kbc_keyboard(struct Kbc * kbc, uint8_t data, int timeout) { +bool kbc_keyboard(struct Kbc * kbc, uint8_t data, int16_t timeout) { if (!kbc_wait(kbc, timeout)) return false; *(kbc->status) &= ~0x20; *(kbc->keyboard_out) = data; return true; } -bool kbc_mouse(struct Kbc * kbc, uint8_t data, int timeout) { +bool kbc_mouse(struct Kbc * kbc, uint8_t data, int16_t timeout) { if (!kbc_wait(kbc, timeout)) return false; *(kbc->status) |= 0x20; *(kbc->mouse_out) = data; diff --git a/src/ec/ite/signature.c b/src/ec/ite/signature.c index 477da26..c9d8270 100644 --- a/src/ec/ite/signature.c +++ b/src/ec/ite/signature.c @@ -4,13 +4,13 @@ #if EC_ESPI // eSPI signature (byte 7 = 0xA4) -static __code const unsigned char __at(0x40) SIGNATURE[16] = { +static __code const uint8_t __at(0x40) SIGNATURE[16] = { 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA4, 0x95, 0x85, 0x12, 0x5A, 0x5A, 0xAA, 0x00, 0x55, 0x55, }; #else // EC_ESPI // LPC signature (byte 7 = 0xA5) -static __code const unsigned char __at(0x40) SIGNATURE[16] = { +static __code const uint8_t __at(0x40) SIGNATURE[16] = { 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0x94, 0x85, 0x12, 0x5A, 0x5A, 0xAA, 0x00, 0x55, 0x55, };