Use explicitly sized types from stdint

Replace bare int types with stdint types. This was done with:

    grep -rwl 'int' src/ | xargs sed -i 's/\<int\>/int16_t/g'
    grep -rwl 'unsigned long' src/ | xargs sed -i 's/\<unsigned long\>/uint32_t/g'
    grep -rwl 'unsigned char' src/ | xargs sed -i 's/\<unsigned char\>/uint8_t/g'

Then reverted for *main(), putchar(), and getchar().

The Arduino declarations for parallel_main() were also corrected to
match their definitions.

SDCC does *not* generate the same code in all instances, due to `int`
being treated different than `short int`.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
Tim Crawford
2021-07-28 07:36:42 -06:00
committed by Jeremy Soller
parent 38b2a628f9
commit 99af8a35f5
41 changed files with 169 additions and 167 deletions

View File

@ -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 {