Add a watchdog timer of 10 seconds when using scratch ROM
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
#define _BOARD_SMFI_H
|
||||
|
||||
void smfi_init(void);
|
||||
void smfi_watchdog(void);
|
||||
void smfi_event(void);
|
||||
void smfi_debug(unsigned char byte);
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <8051.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <board/smfi.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// Include scratch ROM
|
||||
@ -15,6 +16,8 @@ volatile uint8_t __xdata __at(0x1045) SCAR1H;
|
||||
|
||||
// Enter or exit scratch ROM
|
||||
void scratch_trampoline(void) {
|
||||
smfi_watchdog();
|
||||
|
||||
// Disable interrupts
|
||||
EA = 0;
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <common/command.h>
|
||||
#include <common/macro.h>
|
||||
#include <common/version.h>
|
||||
#include <ec/etwd.h>
|
||||
#include <ec/pwm.h>
|
||||
|
||||
// Shared memory host semaphore
|
||||
@ -33,9 +34,6 @@ volatile uint8_t __xdata __at(0x103D) ECINDAR2;
|
||||
volatile uint8_t __xdata __at(0x103E) ECINDAR3;
|
||||
volatile uint8_t __xdata __at(0x103F) ECINDDR;
|
||||
|
||||
volatile uint8_t __xdata __at(0x1F01) ETWCFG;
|
||||
volatile uint8_t __xdata __at(0x1F07) EWDKEYR;
|
||||
|
||||
static volatile uint8_t __xdata __at(0xE00) smfi_cmd[256];
|
||||
static volatile uint8_t __xdata __at(0xF00) smfi_dbg[256];
|
||||
|
||||
@ -144,6 +142,7 @@ static enum Result cmd_reset(void) {
|
||||
return RES_ERR;
|
||||
}
|
||||
|
||||
#ifndef __SCRATCH__
|
||||
static enum Result cmd_fan_get(void) {
|
||||
// If setting fan 0
|
||||
if (smfi_cmd[2] == 0) {
|
||||
@ -167,9 +166,22 @@ static enum Result cmd_fan_set(void) {
|
||||
// Failed if fan not found
|
||||
return RES_ERR;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set a watchdog timer of 10 seconds
|
||||
void smfi_watchdog(void) {
|
||||
ET1CNTLLR = 0xFF;
|
||||
EWDCNTLLR = 0xFF;
|
||||
EWDCNTLHR = 0x04;
|
||||
}
|
||||
|
||||
void smfi_event(void) {
|
||||
if (smfi_cmd[0]) {
|
||||
#ifdef __SCRATCH__
|
||||
// If in scratch ROM, restart watchdog timer when command received
|
||||
smfi_watchdog();
|
||||
#endif
|
||||
|
||||
switch (smfi_cmd[0]) {
|
||||
case CMD_PROBE:
|
||||
// Signature
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define _BOARD_SMFI_H
|
||||
|
||||
void smfi_init(void);
|
||||
void smfi_watchdog(void);
|
||||
void smfi_event(void);
|
||||
void smfi_debug(unsigned char byte);
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <8051.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <board/smfi.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// Include scratch ROM
|
||||
@ -15,6 +16,8 @@ volatile uint8_t __xdata __at(0x1045) SCAR1H;
|
||||
|
||||
// Enter or exit scratch ROM
|
||||
void scratch_trampoline(void) {
|
||||
smfi_watchdog();
|
||||
|
||||
// Disable interrupts
|
||||
EA = 0;
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <common/command.h>
|
||||
#include <common/macro.h>
|
||||
#include <common/version.h>
|
||||
#include <ec/etwd.h>
|
||||
#include <ec/pwm.h>
|
||||
|
||||
// Shared memory host semaphore
|
||||
@ -33,9 +34,6 @@ volatile uint8_t __xdata __at(0x103D) ECINDAR2;
|
||||
volatile uint8_t __xdata __at(0x103E) ECINDAR3;
|
||||
volatile uint8_t __xdata __at(0x103F) ECINDDR;
|
||||
|
||||
volatile uint8_t __xdata __at(0x1F01) ETWCFG;
|
||||
volatile uint8_t __xdata __at(0x1F07) EWDKEYR;
|
||||
|
||||
static volatile uint8_t __xdata __at(0xE00) smfi_cmd[256];
|
||||
static volatile uint8_t __xdata __at(0xF00) smfi_dbg[256];
|
||||
|
||||
@ -144,6 +142,7 @@ static enum Result cmd_reset(void) {
|
||||
return RES_ERR;
|
||||
}
|
||||
|
||||
#ifndef __SCRATCH__
|
||||
static enum Result cmd_fan_get(void) {
|
||||
// If setting fan 0
|
||||
if (smfi_cmd[2] == 0) {
|
||||
@ -167,9 +166,22 @@ static enum Result cmd_fan_set(void) {
|
||||
// Failed if fan not found
|
||||
return RES_ERR;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set a watchdog timer of 10 seconds
|
||||
void smfi_watchdog(void) {
|
||||
ET1CNTLLR = 0xFF;
|
||||
EWDCNTLLR = 0xFF;
|
||||
EWDCNTLHR = 0x04;
|
||||
}
|
||||
|
||||
void smfi_event(void) {
|
||||
if (smfi_cmd[0]) {
|
||||
#ifdef __SCRATCH__
|
||||
// If in scratch ROM, restart watchdog timer when command received
|
||||
smfi_watchdog();
|
||||
#endif
|
||||
|
||||
switch (smfi_cmd[0]) {
|
||||
case CMD_PROBE:
|
||||
// Signature
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define _BOARD_SMFI_H
|
||||
|
||||
void smfi_init(void);
|
||||
void smfi_watchdog(void);
|
||||
void smfi_event(void);
|
||||
void smfi_debug(unsigned char byte);
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <8051.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <board/smfi.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// Include scratch ROM
|
||||
@ -15,6 +16,8 @@ volatile uint8_t __xdata __at(0x1042) SCAR0H;
|
||||
|
||||
// Enter or exit scratch ROM
|
||||
void scratch_trampoline(void) {
|
||||
smfi_watchdog();
|
||||
|
||||
// Disable interrupts
|
||||
EA = 0;
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <common/command.h>
|
||||
#include <common/macro.h>
|
||||
#include <common/version.h>
|
||||
#include <ec/etwd.h>
|
||||
#include <ec/pwm.h>
|
||||
|
||||
// Shared memory host semaphore
|
||||
@ -33,9 +34,6 @@ volatile uint8_t __xdata __at(0x103D) ECINDAR2;
|
||||
volatile uint8_t __xdata __at(0x103E) ECINDAR3;
|
||||
volatile uint8_t __xdata __at(0x103F) ECINDDR;
|
||||
|
||||
volatile uint8_t __xdata __at(0x1F01) ETWCFG;
|
||||
volatile uint8_t __xdata __at(0x1F07) EWDKEYR;
|
||||
|
||||
static volatile uint8_t __xdata __at(0xE00) smfi_cmd[256];
|
||||
static volatile uint8_t __xdata __at(0xF00) smfi_dbg[256];
|
||||
|
||||
@ -144,6 +142,7 @@ static enum Result cmd_reset(void) {
|
||||
return RES_ERR;
|
||||
}
|
||||
|
||||
#ifndef __SCRATCH__
|
||||
static enum Result cmd_fan_get(void) {
|
||||
// If setting fan 0
|
||||
if (smfi_cmd[2] == 0) {
|
||||
@ -167,9 +166,22 @@ static enum Result cmd_fan_set(void) {
|
||||
// Failed if fan not found
|
||||
return RES_ERR;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set a watchdog timer of 10 seconds
|
||||
void smfi_watchdog(void) {
|
||||
ET1CNTLLR = 0xFF;
|
||||
EWDCNTLLR = 0xFF;
|
||||
EWDCNTLHR = 0x04;
|
||||
}
|
||||
|
||||
void smfi_event(void) {
|
||||
if (smfi_cmd[0]) {
|
||||
#ifdef __SCRATCH__
|
||||
// If in scratch ROM, restart watchdog timer when command received
|
||||
smfi_watchdog();
|
||||
#endif
|
||||
|
||||
switch (smfi_cmd[0]) {
|
||||
case CMD_PROBE:
|
||||
// Signature
|
||||
|
13
src/ec/it5570e/include/ec/etwd.h
Normal file
13
src/ec/it5570e/include/ec/etwd.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef _EC_ECWD_H
|
||||
#define _EC_ECWD_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
volatile uint8_t __xdata __at(0x1F01) ETWCFG;
|
||||
volatile uint8_t __xdata __at(0x1F02) ET1PSR;
|
||||
volatile uint8_t __xdata __at(0x1F04) ET1CNTLLR;
|
||||
volatile uint8_t __xdata __at(0x1F06) EWDCNTLLR;
|
||||
volatile uint8_t __xdata __at(0x1F07) EWDKEYR;
|
||||
volatile uint8_t __xdata __at(0x1F09) EWDCNTLHR;
|
||||
|
||||
#endif // _EC_ECWD_H
|
13
src/ec/it8587e/include/ec/etwd.h
Normal file
13
src/ec/it8587e/include/ec/etwd.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef _EC_ECWD_H
|
||||
#define _EC_ECWD_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
volatile uint8_t __xdata __at(0x1F01) ETWCFG;
|
||||
volatile uint8_t __xdata __at(0x1F02) ET1PSR;
|
||||
volatile uint8_t __xdata __at(0x1F04) ET1CNTLLR;
|
||||
volatile uint8_t __xdata __at(0x1F06) EWDCNTLLR;
|
||||
volatile uint8_t __xdata __at(0x1F07) EWDKEYR;
|
||||
volatile uint8_t __xdata __at(0x1F09) EWDCNTLHR;
|
||||
|
||||
#endif // _EC_ECWD_H
|
Reference in New Issue
Block a user