Moved watchdog_periodic into the lowest level to avoid multiple redundant calls higher up
This commit is contained in:
parent
db0423af20
commit
00ac8cfaa0
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)$Id: xmem.c,v 1.12 2010/10/12 22:55:11 nifi Exp $
|
* @(#)$Id: xmem.c,v 1.13 2011/01/18 14:03:55 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,6 +113,7 @@ wait_ready(void)
|
||||||
unsigned u;
|
unsigned u;
|
||||||
do {
|
do {
|
||||||
u = read_status_register();
|
u = read_status_register();
|
||||||
|
watchdog_periodic();
|
||||||
} while(u & 0x01); /* WIP=1, write in progress */
|
} while(u & 0x01); /* WIP=1, write in progress */
|
||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
|
@ -124,8 +125,8 @@ static void
|
||||||
erase_sector(unsigned long offset)
|
erase_sector(unsigned long offset)
|
||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
wait_ready();
|
|
||||||
|
|
||||||
|
wait_ready();
|
||||||
write_enable();
|
write_enable();
|
||||||
|
|
||||||
s = splhigh();
|
s = splhigh();
|
||||||
|
@ -170,6 +171,7 @@ xmem_pread(void *_p, int size, unsigned long offset)
|
||||||
unsigned char *p = _p;
|
unsigned char *p = _p;
|
||||||
const unsigned char *end = p + size;
|
const unsigned char *end = p + size;
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
wait_ready();
|
wait_ready();
|
||||||
|
|
||||||
ENERGEST_ON(ENERGEST_TYPE_FLASH_READ);
|
ENERGEST_ON(ENERGEST_TYPE_FLASH_READ);
|
||||||
|
@ -205,7 +207,6 @@ program_page(unsigned long offset, const unsigned char *p, int nbytes)
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
wait_ready();
|
wait_ready();
|
||||||
|
|
||||||
write_enable();
|
write_enable();
|
||||||
|
|
||||||
s = splhigh();
|
s = splhigh();
|
||||||
|
@ -265,14 +266,10 @@ xmem_erase(long size, unsigned long addr)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
watchdog_stop();
|
|
||||||
|
|
||||||
for (; addr < end; addr += XMEM_ERASE_UNIT_SIZE) {
|
for (; addr < end; addr += XMEM_ERASE_UNIT_SIZE) {
|
||||||
erase_sector(addr);
|
erase_sector(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
watchdog_start();
|
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in a new issue