arch/arm/src/samv7: add flash progmem erasestate ioctl support
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
parent
134b2e6ec9
commit
0d9425676d
@ -816,6 +816,13 @@ config SAMV7_PROGMEM_NSECTORS
|
||||
flash memory that will be reserved for use with by the interfaces
|
||||
prototyped in include/nuttx/progmem.h
|
||||
|
||||
config SAMV7_PROGMEM_ERASESTATE
|
||||
bool "Flash progmem erasestate ioctl support"
|
||||
default y
|
||||
select ARCH_HAVE_PROGMEM_ERASESTATE
|
||||
---help---
|
||||
Add progmem erasestate ioctl command.
|
||||
|
||||
endif # SAMV7_PROGMEM
|
||||
|
||||
menu "SDRAM Configuration"
|
||||
|
@ -137,6 +137,8 @@
|
||||
#define SAMV7_PROGMEM_ENDSEC (SAMV7_TOTAL_NSECTORS)
|
||||
#define SAMV7_PROGMEM_STARTSEC (SAMV7_PROGMEM_ENDSEC - CONFIG_SAMV7_PROGMEM_NSECTORS)
|
||||
|
||||
#define SAMV7_PROGMEM_ERASEDVAL (0xff)
|
||||
|
||||
/* Misc stuff */
|
||||
|
||||
#ifndef MIN
|
||||
@ -445,13 +447,13 @@ ssize_t up_progmem_ispageerased(size_t cluster)
|
||||
address = (cluster << SAMV7_CLUSTER_SHIFT) + SAMV7_PROGMEM_START;
|
||||
up_flush_dcache(address, address + SAMV7_CLUSTER_SIZE);
|
||||
|
||||
/* Verify that the cluster is erased (i.e., all 0xff) */
|
||||
/* Verify that the cluster is erased (i.e., all SAMV7_PROGMEM_ERASEDVAL) */
|
||||
|
||||
for (nleft = SAMV7_CLUSTER_SIZE, nwritten = 0;
|
||||
nleft > 0;
|
||||
nleft--, address++)
|
||||
{
|
||||
if (getreg8(address) != 0xff)
|
||||
if (getreg8(address) != SAMV7_PROGMEM_ERASEDVAL)
|
||||
{
|
||||
nwritten++;
|
||||
}
|
||||
@ -469,7 +471,7 @@ ssize_t up_progmem_ispageerased(size_t cluster)
|
||||
* Input Parameters:
|
||||
* address - Address with or without flash offset
|
||||
* buffer - Pointer to buffer
|
||||
* buflen - Number of bytes to write
|
||||
* buflen - Number of bytes to write
|
||||
*
|
||||
* Returned Value:
|
||||
* Bytes written or negative value on error. The following errors are
|
||||
@ -608,3 +610,16 @@ ssize_t up_progmem_write(size_t address, const void *buffer, size_t buflen)
|
||||
page_buffer_unlock();
|
||||
return written;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_progmem_erasestate
|
||||
*
|
||||
* Description:
|
||||
* Return a byte that represents flash erased value state
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
ssize_t up_progmem_erasestate(void)
|
||||
{
|
||||
return SAMV7_PROGMEM_ERASEDVAL;
|
||||
}
|
||||
|
@ -334,12 +334,12 @@ config STM32H7_PROGMEM
|
||||
obtain an uniform flash memory mapping.
|
||||
|
||||
config STM32H7_PROGMEM_ERASESTATE
|
||||
bool "Flash progmem erasestate ictl support"
|
||||
bool "Flash progmem erasestate ioctl support"
|
||||
depends on STM32H7_PROGMEM
|
||||
default y
|
||||
select ARCH_HAVE_PROGMEM_ERASESTATE
|
||||
---help---
|
||||
Add progmem erasestate ictl command.
|
||||
Add progmem erasestate ioctl command.
|
||||
|
||||
menu "STM32H7 Peripheral Selection"
|
||||
|
||||
|
@ -238,7 +238,7 @@ ssize_t up_progmem_read(size_t addr, FAR void *buf, size_t count);
|
||||
* Name: up_progmem_erasestate
|
||||
*
|
||||
* Description:
|
||||
* Return value of erease state.
|
||||
* Return value of erase state.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user