Move SROM register definition to ec/scratch.h

This commit is contained in:
Jeremy Soller 2020-09-15 12:28:36 -06:00 committed by Jeremy Soller
parent fd0bbc53f4
commit 882dd02e06
3 changed files with 29 additions and 20 deletions

View File

@ -7,32 +7,13 @@
#include <board/smfi.h>
#include <common/macro.h>
#include <ec/pwm.h>
#include <ec/scratch.h>
// Include scratch ROM
uint8_t __code __at(SCRATCH_OFFSET) scratch_rom[] = {
#include <scratch.h>
};
#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%

View File

@ -0,0 +1,14 @@
#ifndef _EC_SCRATCH_H
#define _EC_SCRATCH_H
#include <stdint.h>
// 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

View File

@ -0,0 +1,14 @@
#ifndef _EC_SCRATCH_H
#define _EC_SCRATCH_H
#include <stdint.h>
// 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