diff --git a/src/board/system76/common/scratch.c b/src/board/system76/common/scratch.c index 208b792..dfb3c1e 100644 --- a/src/board/system76/common/scratch.c +++ b/src/board/system76/common/scratch.c @@ -7,32 +7,13 @@ #include #include #include +#include // Include scratch ROM uint8_t __code __at(SCRATCH_OFFSET) scratch_rom[] = { #include }; -#if __EC__ == it5570e - // SCAR0 is stored in processor cache, not in xram - volatile uint8_t __xdata __at(0x1040) SCAR0L; - volatile uint8_t __xdata __at(0x1041) SCAR0M; - volatile uint8_t __xdata __at(0x1042) SCAR0H; - #define SCARL SCAR0L - #define SCARM SCAR0M - #define SCARH SCAR0H -#elif __EC__ == it8587e - // SCAR1 is in xram at 0x800-0xC00 - volatile uint8_t __xdata __at(0x1043) SCAR1L; - volatile uint8_t __xdata __at(0x1044) SCAR1M; - volatile uint8_t __xdata __at(0x1045) SCAR1H; - #define SCARL SCAR1L - #define SCARM SCAR1M - #define SCARH SCAR1H -#else - #error "scratch.c unknown EC" -#endif - // Enter or exit scratch ROM void scratch_trampoline(void) { // Set fans to 100% diff --git a/src/ec/it5570e/include/ec/scratch.h b/src/ec/it5570e/include/ec/scratch.h new file mode 100644 index 0000000..752dfc5 --- /dev/null +++ b/src/ec/it5570e/include/ec/scratch.h @@ -0,0 +1,14 @@ +#ifndef _EC_SCRATCH_H +#define _EC_SCRATCH_H + +#include + +// SCAR0 is stored in processor cache, not in xram +volatile uint8_t __xdata __at(0x1040) SCAR0L; +volatile uint8_t __xdata __at(0x1041) SCAR0M; +volatile uint8_t __xdata __at(0x1042) SCAR0H; +#define SCARL SCAR0L +#define SCARM SCAR0M +#define SCARH SCAR0H + +#endif // _EC_SCRATCH_H diff --git a/src/ec/it8587e/include/ec/scratch.h b/src/ec/it8587e/include/ec/scratch.h new file mode 100644 index 0000000..1688d76 --- /dev/null +++ b/src/ec/it8587e/include/ec/scratch.h @@ -0,0 +1,14 @@ +#ifndef _EC_SCRATCH_H +#define _EC_SCRATCH_H + +#include + +// SCAR1 is in xram at 0x800-0xC00 +volatile uint8_t __xdata __at(0x1043) SCAR1L; +volatile uint8_t __xdata __at(0x1044) SCAR1M; +volatile uint8_t __xdata __at(0x1045) SCAR1H; +#define SCARL SCAR1L +#define SCARM SCAR1M +#define SCARH SCAR1H + +#endif // _EC_SCRATCH_H