tle8888: watchdog: use FWDRespSyncCmd for last response (#1140)

This commit is contained in:
dron0gus 2020-02-11 23:49:17 +03:00 committed by GitHub
parent 7bd68beae9
commit 95ce978c23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -75,6 +75,8 @@ typedef enum {
/* Window watchdog open WWDOWT window time = 12.8 mS - fixed value for TLE8888QK */
#define CMD_WWDServiceCmd CMD_WR(0x15, 0x03)
#define FWDRespCmd(d) CMD_WR(0x16, d)
#define FWDRespSyncCmd(d) CMD_WR(0x17, d)
#define CMD_SR CMD_WR(0x1a, 0x03)
// 0x238 = 568
@ -93,8 +95,6 @@ typedef enum {
#define FWDStat1 0x38
#define CMD_FWDStat1 CMD_R(FWDStat1)
#define FWDRespCmd 0x16
//#define CMD_VRSCONFIG0(d) CMD_WR(0x49, d)
#define CMD_VRSCONFIG1(d) CMD_WR(0x4a, d)
#define CMD_INCONFIG(n, d) CMD_WR(0x53 + (n & 0x03), d)
@ -399,7 +399,12 @@ static void handleFWDStat1(struct tle8888_priv *chip, int registerNum, int data)
uint8_t FWDRESPC = (data >> 4) & 3;
/* Table lines are filled in reverse order (like in DS) */
uint8_t response = watchDogResponses[FWDQUEST][3 - FWDRESPC];
tle8888_spi_rw(chip, CMD_WR(FWDRespCmd, response), NULL);
if (FWDRESPC) {
tle8888_spi_rw(chip, FWDRespCmd(response), NULL);
} else {
/* to restart heartbeat timer, sync command should be used for response 0 */
tle8888_spi_rw(chip, FWDRespSyncCmd(response), NULL);
}
tle8888_spi_rw(chip, CMD_WdDiag, NULL);
tle8888_spi_rw(chip, CMD_WdDiag, &wdDiagResponse);
}