Commit Graph

37 Commits

Author SHA1 Message Date
Tim Crawford
2a3830fb57 i2c: Use u16 for data length
The length will never be negative.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2021-08-02 14:37:08 -06:00
Tim Crawford
99af8a35f5 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>
2021-08-02 07:46:44 -06:00
Tim Crawford
e86e18d4b1 delay: Use u8, decrementing loop
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>
2021-07-19 06:48:16 -06:00
Tim Crawford
4963e04a83 Reindent files using spaces 2021-05-07 12:44:48 -06:00
Tim Crawford
720af4b2b0 Use BIT macro
Mostly done with the cocci script. macro.h was then added manually.
2021-05-07 11:24:25 -06:00
Tim Crawford
5c4f9b6c8b Sort object files
ROMs produced of Pop!_OS 20.10 and Fedora 33 with SDCC 4.0.0 cause
uecflash to crash after verifying the block write, leaving the  system
unbootable until all power is removed to force an EC reset.

Sorting object files appears to resolve this issue, creates a smaller
binary (~200 bytes from 20.04), and gives up more reproducible builds.
2020-12-08 13:43:40 -07:00
Evan Lojewski
6f6fc652d5 flash: Enable read/write/erase access flash from firmware. 2020-10-01 10:32:03 -06:00
Evan Lojewski
ba5f1ab55c 8051: Allow up to 64KB firmware images.
The ITE EC hardware always has the first 32KB of ram mapped, while
a second 32KB of ram is banked immediately after. By default, the
banked physical address immediately follows the fixed area in flash.
2020-10-01 10:32:03 -06:00
Jeremy Soller
fd0bbc53f4 Set limits on SRAM usage 2020-09-29 19:42:05 -06:00
Tim Crawford
5fd9df0ed0 Add SPDX license identifiers
Add license information to files. Mostly automated with:

    find src/ -name '*.[c,h]' | xargs sed -i '1s,^,// SPDX-License-Identifier: GPL-3.0-only\n\n,'
    find src/ -name '*.mk' | xargs sed -i '1s,^,# SPDX-License-Identifier: GPL-3.0-only\n\n,'
2020-09-17 09:17:08 -06:00
Jeremy Soller
39cd014f7b Addw2 support (#67)
* Add addw2 board

* Set charge params and update gpio.h

* Set VGA fan to 100% when entering scratch rom

* Implement keyboard LEDs

* Turn off keyboard LEDs in gpio defaults

* Default airplane mode LED to off

* Enable GPU power and fan control

* Add NVIDIA GPU power and temp to power.csv

* Add NVIDIA GPU fan value to power.sh

* Move GPU init back to coreboot

* Do not turn on GPU fan if GPU is off

* Show POST codes

* Add timestamps to console_external

* Accept port 81 cycles

* Move setting RSTS into ec_init

* Move post code debugging to system76/common

* Move some GPIO init from system76/common to boards

* Make some power signals optional

* Remove POST code support - it only works on IT5570
2020-06-04 13:22:59 -06:00
Jeremy Soller
c50632c1bf Fix timer interrupt 2020-02-03 20:12:23 -07:00
Jeremy Soller
c1fbbce805 Create arch_init function, enable interrupts 2020-02-03 15:27:27 -07:00
Jeremy Soller
ce22dd5208 Add global timer 2020-02-03 15:16:17 -07:00
Jeremy Soller
3692bed6b2 Remove unused reset code 2020-02-03 15:14:10 -07:00
Jeremy Soller
e7c80c370c Use large model 2020-02-03 15:13:56 -07:00
Jeremy Soller
6672befb31 Update AVR I2C functions 2020-01-16 14:37:39 -07:00
Jeremy Soller
c1236b9e4a Improve power light control 2020-01-13 15:51:22 -07:00
Jeremy Soller
0a07213412 Implement ISP programmer firmware 2020-01-02 15:46:33 -07:00
Jeremy Soller
da60fc9080 Fix delay_us and delay_ns not showing up 2019-11-22 14:30:21 -07:00
Jeremy Soller
9cfd3a8d5a WIP: redo power sequence 2019-11-22 10:02:24 -07:00
Jeremy Soller
b6d2c587f6 Only build items in $(OBJ) with standard rules 2019-11-20 10:47:23 -07:00
Jeremy Soller
97502b61b0 Update avr i2c to match new common i2c library 2019-11-13 19:26:04 -07:00
Jeremy Soller
890d8e9968 Move i2c support to common 2019-11-13 14:33:04 -07:00
Jeremy Soller
1de07139cd Set model to medium 2019-11-13 10:56:30 -07:00
Jeremy Soller
73cd5f1cdf Add i2c slave support to arduino firmware 2019-11-11 09:35:56 -07:00
Jeremy Soller
badc84d99b Use Werror for avr architecture 2019-11-11 09:35:11 -07:00
Jeremy Soller
8f69ece191 Fix errors and deny errors 2019-11-10 18:49:21 -07:00
Jeremy Soller
1b0f79c818 Add delay_ticks function 2019-11-08 10:29:04 -07:00
Jeremy Soller
044584e96e Add i2c capability for AVR 2019-10-01 14:20:35 -06:00
Jeremy Soller
01bae12644 Add AVR GPIO 2019-09-29 21:47:37 -06:00
Jeremy Soller
e3aa21cae4 Add Arduino Micro and Arduino Uno 2019-09-29 21:20:03 -06:00
Jeremy Soller
abd457ba73 Fix building AVR hex files 2019-09-29 21:19:32 -06:00
Jeremy Soller
ded5181926 Organize into arch, board, and ec modules 2019-09-29 20:13:03 -06:00
Jeremy Soller
9d056547e6 Add includes from each directory 2019-09-29 20:09:42 -06:00
Jeremy Soller
b04352cb63 Reorganize to allow compiling and running AVR firmware 2019-09-29 17:13:31 -06:00
Jeremy Soller
608326af30 Prepare for portable build process 2019-09-29 16:45:12 -06:00