From c65947b877e6493977047a15ecea3fa400fa2ab5 Mon Sep 17 00:00:00 2001 From: UserDeploy Date: Wed, 23 Apr 2025 22:32:55 +0700 Subject: [PATCH] more aggressive watchdog --- dcc/memory.c | 8 ++++---- flash/nand/controller/controller.h | 8 ++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/dcc/memory.c b/dcc/memory.c index 5953e81..22d0ecb 100644 --- a/dcc/memory.c +++ b/dcc/memory.c @@ -7,7 +7,7 @@ void *memcpy(void *dst, const void *src, size_t len) char *d = dst; while (len--) { - if ((len & 0x1ff) == 0x1ff) wdog_reset(); + if ((len & 0x3f) == 0x3f) wdog_reset(); *d++ = *s++; } @@ -19,7 +19,7 @@ void *memset(void *dst, int val, size_t count) register uint8_t *ptr = (uint8_t *)dst; while (count-- > 0) { - if ((count & 0x1ff) == 0x1ff) wdog_reset(); + if ((count & 0x3f) == 0x3f) wdog_reset(); *ptr++ = val; } @@ -45,7 +45,7 @@ void *memmove(void *dst, const void *src, size_t len) const char *s = (const char *)src + len; char *d = (char *)dst + len; while (d != end) { - if (((size_t)d & 0x1ff) == 0x1ff) wdog_reset(); + if (((size_t)d & 0x3f) == 0x3f) wdog_reset(); *--d = *--s; } } @@ -60,7 +60,7 @@ int memcmp(const void *s1, const void *s2, size_t len) unsigned char dc; while (len--) { - if ((len & 0x1ff) == 0x1ff) wdog_reset(); + if ((len & 0x3f) == 0x3f) wdog_reset(); sc = *s++; dc = *d++; if (sc - dc) diff --git a/flash/nand/controller/controller.h b/flash/nand/controller/controller.h index 4023f24..2feb6bc 100644 --- a/flash/nand/controller/controller.h +++ b/flash/nand/controller/controller.h @@ -67,6 +67,14 @@ static nand_info flash_ids[] = { {0, 0, 0, 0, 0} }; +typedef enum { + NAND_STATUS_FAIL = 0x01, + NAND_STATUS_FAIL_N1 = 0x02, + NAND_STATUS_TRUE_READY = 0x20, + NAND_STATUS_READY = 0x40, + NAND_STATUS_WP = 0x80, +} NANDStatus; + typedef enum { /* Standard NAND flash commands */ NAND_CMD_READ0 = 0x0,