mirror of
https://github.com/apache/nuttx.git
synced 2026-05-24 07:46:16 +08:00
esp32/esp32_spiflash.c: during the SPI Flash erasure operation, task
scheduling (yield) is added to prevent the Watchdog Timer from triggering a reset due to timeout Signed-off-by: nuttxs <zhaoqing.zhang@sony.com>
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include <nuttx/kthread.h>
|
||||
#include <nuttx/mutex.h>
|
||||
#include <nuttx/mtd/mtd.h>
|
||||
#include <nuttx/signal.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
|
||||
@@ -225,6 +226,8 @@ inline void IRAM_ATTR
|
||||
esp32_spiflash_opstart(void);
|
||||
inline void IRAM_ATTR
|
||||
esp32_spiflash_opdone(void);
|
||||
static inline void IRAM_ATTR
|
||||
esp32_spiflash_oposyield(void);
|
||||
|
||||
static bool IRAM_ATTR spiflash_pagecached(uint32_t phypage);
|
||||
static void IRAM_ATTR spiflash_flushmapped(size_t start, size_t size);
|
||||
@@ -661,6 +664,28 @@ static void IRAM_ATTR spiflash_flushmapped(size_t start, size_t size)
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32_spiflash_oposyield
|
||||
*
|
||||
* Description:
|
||||
* Yield to other tasks, called during erase operations.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void IRAM_ATTR esp32_spiflash_oposyield(void)
|
||||
{
|
||||
/* Delay 1 tick */
|
||||
|
||||
useconds_t us = TICK2USEC(1);
|
||||
nxsig_usleep(us);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32_set_read_opt
|
||||
*
|
||||
@@ -967,6 +992,11 @@ static int IRAM_ATTR esp32_erasesector(struct esp32_spiflash_s *priv,
|
||||
|
||||
for (offset = 0; offset < size; offset += MTD_ERASESIZE(priv))
|
||||
{
|
||||
if (offset > 0)
|
||||
{
|
||||
esp32_spiflash_oposyield();
|
||||
}
|
||||
|
||||
esp32_spiflash_opstart();
|
||||
|
||||
if (esp32_enable_write(priv) != OK)
|
||||
|
||||
Reference in New Issue
Block a user