From a019386dd1ebae0f0b2c01bf0218baa3e6bfd692 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sun, 14 Aug 2022 01:29:45 +0200 Subject: added copro reset f --- fw/fe310/eos/eve/eve.c | 26 +++++++++++++++----------- fw/fe310/eos/eve/eve.h | 3 ++- 2 files changed, 17 insertions(+), 12 deletions(-) (limited to 'fw/fe310/eos') diff --git a/fw/fe310/eos/eve/eve.c b/fw/fe310/eos/eve/eve.c index 5103e5f..7f77190 100644 --- a/fw/fe310/eos/eve/eve.c +++ b/fw/fe310/eos/eve/eve.c @@ -256,17 +256,7 @@ int eve_cmd_done(void) { uint16_t r = eve_read16(REG_CMD_READ); if (r == 0xfff) { - uint16_t ptr; - - cmd_offset = 0; - ptr = eve_read16(REG_COPRO_PATCH_PTR); - eve_write8(REG_CPURESET, 1); - eve_write16(REG_CMD_READ, 0); - eve_write16(REG_CMD_WRITE, 0); - eve_write16(REG_CMD_DL, 0); - eve_write8(REG_CPURESET, 0); - eve_write16(REG_COPRO_PATCH_PTR, ptr); - eve_write8(REG_PCLK, EVE_PCLK); + eve_copro_reset(); return EVE_ERR; } @@ -486,3 +476,17 @@ void eve_brightness(uint8_t b) { void eve_lcd_absent(void) { lcd_absent = 1; } + +void eve_copro_reset(void) { + uint16_t ptr; + + cmd_offset = 0; + ptr = eve_read16(REG_COPRO_PATCH_PTR); + eve_write8(REG_CPURESET, 1); + eve_write16(REG_CMD_READ, 0); + eve_write16(REG_CMD_WRITE, 0); + eve_write16(REG_CMD_DL, 0); + eve_write8(REG_CPURESET, 0); + eve_write16(REG_COPRO_PATCH_PTR, ptr); + eve_write8(REG_PCLK, EVE_PCLK); +} diff --git a/fw/fe310/eos/eve/eve.h b/fw/fe310/eos/eve/eve.h index c1b91e4..145c4ba 100644 --- a/fw/fe310/eos/eve/eve.h +++ b/fw/fe310/eos/eve/eve.h @@ -75,4 +75,5 @@ uint8_t eve_gpio_get_dir(void); void eve_gpio_set_dir(uint8_t dir); void eve_brightness(uint8_t b); -void eve_lcd_absent(void); \ No newline at end of file +void eve_lcd_absent(void); +void eve_copro_reset(void); -- cgit v1.2.3