mtd/progmem: Add up_progmem_read callback guarded by ARCH_HAVE_PROGMEM_READ

since sometime platform code need do some special action during memcpy

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id108ef4232376feab3e37e9b3aee9a7927a03bd4
This commit is contained in:
Xiang Xiao
2021-03-01 22:59:14 +08:00
committed by David Sidrane
parent 0aa78ccc81
commit c8d4a4c76a
3 changed files with 55 additions and 2 deletions
+33
View File
@@ -216,6 +216,39 @@ ssize_t up_progmem_ispageerased(size_t page);
ssize_t up_progmem_write(size_t addr, FAR const void *buf, size_t count);
/****************************************************************************
* Name: up_progmem_read
*
* Description:
* Read data at given address
*
* Note: this function is not limited to single page and nor it requires
* the address be aligned inside the page boundaries.
*
* Input Parameters:
* addr - Address with or without flash offset
* (absolute or aligned to page0)
* buf - Pointer to buffer
* count - Number of bytes to read
*
* Returned Value:
* Bytes read or negative value on error. The following errors are
* reported (errno is not set!)
*
* EINVAL: If count is not aligned with the flash boundaries (i.e.
* some MCU's require per half-word or even word access)
* EFAULT: On invalid address
* EIO: On unsuccessful read
* EACCES: Insufficient permissions (read/write protected)
* EPERM: If operation is not permitted due to some other constraints
* (i.e. some internal block is not running etc.)
*
****************************************************************************/
#ifdef CONFIG_ARCH_HAVE_PROGMEM_READ
ssize_t up_progmem_read(size_t addr, FAR void *buf, size_t count);
#endif
#undef EXTERN
#if defined(__cplusplus)
}