Ensure rustup is up-to-date to avoid users having a version that is too
old to support the TOML format.
If rustup was just installed, tell the user to source the new env vars
to use the correct version of the toolchain.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
The IT81202E, despite using a different core, contains sufficiently
equivalent documentation to IT8587E and IT5570E for most tasks except
interrupt management. Provide it as a reference since we cannot share
the datasheets for the models we use.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Calculating diffs with *unsigned* integers will always produce the
correct result, as long as the diff is less than the type max.
For example, suppose we read 254 and 2 for an 8 bit value:
2 - 254 = 4
Using this property, simplify diffs on time_get() comparisons.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
ecflash has no verification for the EC it detects. It will attempt to
read and erase whatever it finds, where it will hang. Document what it
*should* read and an example of what it *shouldn't* read.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Explicitly affix the literal with `U` so SDCC will directly call
`moduint()` instead of `modsint()`.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Use u8/u16 instead of i16 as the value will never be negative and the
bounds are known at compile time.
Use a decrementing loop as SDCC generates more efficient code.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
The length will never be negative. Change it from i16 to u16 so
SDCC will generate more efficient code.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
The index will never be negative and will never exceed 255. Change them
from i16 to u8 so SDCC will generate more efficient code.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
The index will never be negative and will never exceed 255. Change them
from i16 to u8 so SDCC will generate more efficient code.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
The index will never be negative and will never exceed 255. Change them
from i16 to u8 so SDCC will generate more efficient code.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
The index will never be negative and will never exceed 255. Change them
from i16 to u8 so SDCC will generate more efficient code.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
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>
Per the charger for the 3050 variants:
DC OUTPUT (输出/輸出): 19.5V⎓7.7A 150W
The 3060 charger does list 9.23A.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Use u8 instead of i16 as a delay can never be negative and should never
block for a long period of time.
Use a decrementing loop as SDCC generates more efficient code.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Most of the code is the same between IT8587E and IT5570E.
Identical files were detected with:
diff -rs src/ec/it8587e/ src/ec/it5570e/ | egrep '^Files .+ and .+ are identical$'
Then manually moved from one variant and deleted from the other.
Signed-off-by: Tim Crawford <tcrawford@system76.com>