You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/06/03 12:27:00 UTC

[GitHub] [incubator-nuttx] davids5 commented on a change in pull request #3834: RFQ: progmem.h: Modify interface to avoid terms like page, sector, and block, as these terms are used interchangeably by different silicon vendors.

davids5 commented on a change in pull request #3834:
URL: https://github.com/apache/incubator-nuttx/pull/3834#discussion_r644734148



##########
File path: include/nuttx/progmem.h
##########
@@ -49,96 +49,119 @@ extern "C"
  * Public Functions Definitions
  ****************************************************************************/
 
+/* NOTE: Since vendors use the terms page, block, and sector interchangably,
+ * it causes confusion and therefore a neutral term is used. We use the term
+ * "index" to refer to the ordinal number of erasable units of memory.
+ */
+
 /****************************************************************************
- * Name: up_progmem_neraseblocks
+ * Name: up_progmem_maxeraseindex
  *
  * Description:
- *   Return number of erase blocks
+ *   Return the total number of erasable units of memory.
  *
  ****************************************************************************/
 
-size_t up_progmem_neraseblocks(void);
+size_t up_progmem_maxeraseindex(void);
 
 /****************************************************************************
  * Name: up_progmem_isuniform
  *
  * Description:
- *  Is program memory uniform or erase page and read/write page size differs?
+ *  Are all erasable units of memory the same size?
+ *
+ * Returned Value:
+ *   true if all erasable units are the same size, false if they vary in size
  *
  ****************************************************************************/
 
 bool up_progmem_isuniform(void);
 
 /****************************************************************************
- * Name: up_progmem_pagesize
+ * Name: up_progmem_writegranularity
  *
  * Description:
- *   Return read/write page size
+ *   Return the number of bytes of the smallest allowable write operation.
+ *   All writes MUST be a multiple of the granularity. Some FLASH memories
+ *   require write operations in multiples of 8-bit, 16-bit, 32-bit, 128-bit,
+ *   256-bit, etc. The caller must ensure the size of the data passed into
+ *   up_progmem_write is an even multiple of the writegranularity. Padding
+ *   may be required.
+ *
+ * Returned Value:
+ *   Required granularity of a write operation for the FLASH memory.
  *
  ****************************************************************************/
 
-size_t up_progmem_pagesize(size_t page);
+size_t up_progmem_writegranularity(void);
 
 /****************************************************************************
  * Name: up_progmem_erasesize
  *
  * Description:
- *  Return erase block size. Must be a multiple of the read/write page size.
+ *   Return the erase size for a specified index. Will always be a multiple of

Review comment:
       Needs Wrapping.

##########
File path: include/nuttx/progmem.h
##########
@@ -49,96 +49,119 @@ extern "C"
  * Public Functions Definitions
  ****************************************************************************/
 
+/* NOTE: Since vendors use the terms page, block, and sector interchangably,
+ * it causes confusion and therefore a neutral term is used. We use the term
+ * "index" to refer to the ordinal number of erasable units of memory.
+ */
+
 /****************************************************************************
- * Name: up_progmem_neraseblocks
+ * Name: up_progmem_maxeraseindex
  *
  * Description:
- *   Return number of erase blocks
+ *   Return the total number of erasable units of memory.
  *
  ****************************************************************************/
 
-size_t up_progmem_neraseblocks(void);
+size_t up_progmem_maxeraseindex(void);
 
 /****************************************************************************
  * Name: up_progmem_isuniform
  *
  * Description:
- *  Is program memory uniform or erase page and read/write page size differs?
+ *  Are all erasable units of memory the same size?
+ *
+ * Returned Value:
+ *   true if all erasable units are the same size, false if they vary in size
  *
  ****************************************************************************/
 
 bool up_progmem_isuniform(void);
 
 /****************************************************************************
- * Name: up_progmem_pagesize
+ * Name: up_progmem_writegranularity
  *
  * Description:
- *   Return read/write page size
+ *   Return the number of bytes of the smallest allowable write operation.
+ *   All writes MUST be a multiple of the granularity. Some FLASH memories
+ *   require write operations in multiples of 8-bit, 16-bit, 32-bit, 128-bit,
+ *   256-bit, etc. The caller must ensure the size of the data passed into
+ *   up_progmem_write is an even multiple of the writegranularity. Padding
+ *   may be required.
+ *
+ * Returned Value:
+ *   Required granularity of a write operation for the FLASH memory.
  *
  ****************************************************************************/
 
-size_t up_progmem_pagesize(size_t page);
+size_t up_progmem_writegranularity(void);
 
 /****************************************************************************
  * Name: up_progmem_erasesize
  *
  * Description:
- *  Return erase block size. Must be a multiple of the read/write page size.
+ *   Return the erase size for a specified index. Will always be a multiple of
+ *   the write granularity.
+ *
+ * Input Parameters:
+ *   index - ordinal number of the set of erasable units of memory
+ *
+ * Returned Value:
+ *   Erase size for erasable unit of memory, SIZE_MAX if index is invalid.
  *
  ****************************************************************************/
 
-size_t up_progmem_erasesize(size_t block);
+size_t up_progmem_erasesize(size_t index);

Review comment:
       ```suggestion
   ssize_t up_progmem_erasesize(size_t index);
   ```

##########
File path: include/nuttx/progmem.h
##########
@@ -207,12 +232,14 @@ ssize_t up_progmem_write(size_t addr, FAR const void *buf, size_t count);
  * 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.
+ *   NOTE: This function does not require the address to be aligned with a
+ *         unit of memory. It is also not limited to single unit of memory
+ *         (i.e. multiple units of memory may be read, including partial unit
+ *         reads)
  *
  * Input Parameters:
  *   addr  - Address with or without flash offset
- *           (absolute or aligned to page0)
+ *           (absolute or aligned to sector0)

Review comment:
       ```suggestion
    *           (absolute or aligned to the zeroth unit of memory)
   ```

##########
File path: include/nuttx/progmem.h
##########
@@ -147,48 +170,50 @@ size_t up_progmem_getaddress(size_t page);
  *
  ****************************************************************************/
 
-ssize_t up_progmem_eraseblock(size_t block);
+ssize_t up_progmem_erase(size_t index);
 
 /****************************************************************************
- * Name: up_progmem_ispageerased
+ * Name: up_progmem_issectionerased
  *
  * Description:
- *   Checks whether erase page is erased
+ *   Checks whether a specified unit of memory is erased
  *
  * Input Parameters:
- *   page - The page index to be checked.
+ *   index - ordinal number of the set of erasable units of memory
  *
  * Returned Value:
  *   Returns number of bytes NOT erased or negative value on error. If it
- *   returns zero then complete page is erased.
+ *   returns zero then complete section is erased.

Review comment:
       ```suggestion
    *   returns zero then complete unit of memory is erased.
   ```

##########
File path: include/nuttx/progmem.h
##########
@@ -49,96 +49,119 @@ extern "C"
  * Public Functions Definitions
  ****************************************************************************/
 
+/* NOTE: Since vendors use the terms page, block, and sector interchangably,
+ * it causes confusion and therefore a neutral term is used. We use the term
+ * "index" to refer to the ordinal number of erasable units of memory.
+ */
+
 /****************************************************************************
- * Name: up_progmem_neraseblocks
+ * Name: up_progmem_maxeraseindex
  *
  * Description:
- *   Return number of erase blocks
+ *   Return the total number of erasable units of memory.
  *
  ****************************************************************************/
 
-size_t up_progmem_neraseblocks(void);
+size_t up_progmem_maxeraseindex(void);
 
 /****************************************************************************
  * Name: up_progmem_isuniform
  *
  * Description:
- *  Is program memory uniform or erase page and read/write page size differs?
+ *  Are all erasable units of memory the same size?
+ *
+ * Returned Value:
+ *   true if all erasable units are the same size, false if they vary in size
  *
  ****************************************************************************/
 
 bool up_progmem_isuniform(void);
 
 /****************************************************************************
- * Name: up_progmem_pagesize
+ * Name: up_progmem_writegranularity
  *
  * Description:
- *   Return read/write page size
+ *   Return the number of bytes of the smallest allowable write operation.
+ *   All writes MUST be a multiple of the granularity. Some FLASH memories
+ *   require write operations in multiples of 8-bit, 16-bit, 32-bit, 128-bit,
+ *   256-bit, etc. The caller must ensure the size of the data passed into
+ *   up_progmem_write is an even multiple of the writegranularity. Padding
+ *   may be required.
+ *
+ * Returned Value:
+ *   Required granularity of a write operation for the FLASH memory.
  *
  ****************************************************************************/
 
-size_t up_progmem_pagesize(size_t page);
+size_t up_progmem_writegranularity(void);
 
 /****************************************************************************
  * Name: up_progmem_erasesize
  *
  * Description:
- *  Return erase block size. Must be a multiple of the read/write page size.
+ *   Return the erase size for a specified index. Will always be a multiple of
+ *   the write granularity.
+ *
+ * Input Parameters:
+ *   index - ordinal number of the set of erasable units of memory
+ *
+ * Returned Value:
+ *   Erase size for erasable unit of memory, SIZE_MAX if index is invalid.
  *
  ****************************************************************************/
 
-size_t up_progmem_erasesize(size_t block);
+size_t up_progmem_erasesize(size_t index);
 
 /****************************************************************************
- * Name: up_progmem_getpage
+ * Name: up_progmem_getindex
  *
  * Description:
- *   Address to read/write page conversion
+ *   Get the index of memory, given a FLASH memory address
  *
  * Input Parameters:
  *  addr - Address with or without flash offset
- *         (absolute or aligned to page0)
+ *         (absolute or aligned to sector0)
  *
  * Returned Value:
- *   Page or negative value on error.
+ *   Index or negative value on error.
  *   The following errors are reported (errno is not set!):
  *
  *     -EFAULT: On invalid address
  *
  ****************************************************************************/
 
-ssize_t up_progmem_getpage(size_t addr);
+ssize_t up_progmem_getindex(size_t addr);
 
 /****************************************************************************
  * Name: up_progmem_getaddress
  *
  * Description:
- *   Read/write page to address conversion
+ *   Get the base address of a unit of memory, given an index
  *
  * Input Parameters:
- *   page - page index
+ *   index - ordinal number of the set of erasable units of memory
  *
  * Returned Value:
- *   Base address of given page, SIZE_MAX if page index is not valid.
+ *   Base address of given section, SIZE_MAX if index is not valid.

Review comment:
       ```suggestion
    *   Base address of given unit of memory, SIZE_MAX if index is not valid.
   ```

##########
File path: include/nuttx/progmem.h
##########
@@ -49,96 +49,119 @@ extern "C"
  * Public Functions Definitions
  ****************************************************************************/
 
+/* NOTE: Since vendors use the terms page, block, and sector interchangably,
+ * it causes confusion and therefore a neutral term is used. We use the term
+ * "index" to refer to the ordinal number of erasable units of memory.
+ */
+
 /****************************************************************************
- * Name: up_progmem_neraseblocks
+ * Name: up_progmem_maxeraseindex
  *
  * Description:
- *   Return number of erase blocks
+ *   Return the total number of erasable units of memory.
  *
  ****************************************************************************/
 
-size_t up_progmem_neraseblocks(void);
+size_t up_progmem_maxeraseindex(void);
 
 /****************************************************************************
  * Name: up_progmem_isuniform
  *
  * Description:
- *  Is program memory uniform or erase page and read/write page size differs?
+ *  Are all erasable units of memory the same size?
+ *
+ * Returned Value:
+ *   true if all erasable units are the same size, false if they vary in size
  *
  ****************************************************************************/
 
 bool up_progmem_isuniform(void);
 
 /****************************************************************************
- * Name: up_progmem_pagesize
+ * Name: up_progmem_writegranularity
  *
  * Description:
- *   Return read/write page size
+ *   Return the number of bytes of the smallest allowable write operation.
+ *   All writes MUST be a multiple of the granularity. Some FLASH memories
+ *   require write operations in multiples of 8-bit, 16-bit, 32-bit, 128-bit,
+ *   256-bit, etc. The caller must ensure the size of the data passed into
+ *   up_progmem_write is an even multiple of the writegranularity. Padding
+ *   may be required.
+ *
+ * Returned Value:
+ *   Required granularity of a write operation for the FLASH memory.
  *
  ****************************************************************************/
 
-size_t up_progmem_pagesize(size_t page);
+size_t up_progmem_writegranularity(void);
 
 /****************************************************************************
  * Name: up_progmem_erasesize
  *
  * Description:
- *  Return erase block size. Must be a multiple of the read/write page size.
+ *   Return the erase size for a specified index. Will always be a multiple of
+ *   the write granularity.
+ *
+ * Input Parameters:
+ *   index - ordinal number of the set of erasable units of memory
+ *
+ * Returned Value:
+ *   Erase size for erasable unit of memory, SIZE_MAX if index is invalid.

Review comment:
       Would 0 be a better choice, or change the return type to ssize_t and return negative 

##########
File path: include/nuttx/progmem.h
##########
@@ -49,96 +49,119 @@ extern "C"
  * Public Functions Definitions
  ****************************************************************************/
 
+/* NOTE: Since vendors use the terms page, block, and sector interchangably,
+ * it causes confusion and therefore a neutral term is used. We use the term
+ * "index" to refer to the ordinal number of erasable units of memory.
+ */
+
 /****************************************************************************
- * Name: up_progmem_neraseblocks
+ * Name: up_progmem_maxeraseindex
  *
  * Description:
- *   Return number of erase blocks
+ *   Return the total number of erasable units of memory.

Review comment:
       Add the fail return value 0

##########
File path: include/nuttx/progmem.h
##########
@@ -49,96 +49,119 @@ extern "C"
  * Public Functions Definitions
  ****************************************************************************/
 
+/* NOTE: Since vendors use the terms page, block, and sector interchangably,
+ * it causes confusion and therefore a neutral term is used. We use the term
+ * "index" to refer to the ordinal number of erasable units of memory.
+ */
+
 /****************************************************************************
- * Name: up_progmem_neraseblocks
+ * Name: up_progmem_maxeraseindex
  *
  * Description:
- *   Return number of erase blocks
+ *   Return the total number of erasable units of memory.
  *
  ****************************************************************************/
 
-size_t up_progmem_neraseblocks(void);
+size_t up_progmem_maxeraseindex(void);
 
 /****************************************************************************
  * Name: up_progmem_isuniform
  *
  * Description:
- *  Is program memory uniform or erase page and read/write page size differs?
+ *  Are all erasable units of memory the same size?
+ *
+ * Returned Value:
+ *   true if all erasable units are the same size, false if they vary in size
  *
  ****************************************************************************/
 
 bool up_progmem_isuniform(void);
 
 /****************************************************************************
- * Name: up_progmem_pagesize
+ * Name: up_progmem_writegranularity
  *
  * Description:
- *   Return read/write page size
+ *   Return the number of bytes of the smallest allowable write operation.
+ *   All writes MUST be a multiple of the granularity. Some FLASH memories
+ *   require write operations in multiples of 8-bit, 16-bit, 32-bit, 128-bit,
+ *   256-bit, etc. The caller must ensure the size of the data passed into
+ *   up_progmem_write is an even multiple of the writegranularity. Padding
+ *   may be required.
+ *
+ * Returned Value:
+ *   Required granularity of a write operation for the FLASH memory.
  *
  ****************************************************************************/
 
-size_t up_progmem_pagesize(size_t page);
+size_t up_progmem_writegranularity(void);
 
 /****************************************************************************
  * Name: up_progmem_erasesize
  *
  * Description:
- *  Return erase block size. Must be a multiple of the read/write page size.
+ *   Return the erase size for a specified index. Will always be a multiple of
+ *   the write granularity.
+ *
+ * Input Parameters:
+ *   index - ordinal number of the set of erasable units of memory
+ *
+ * Returned Value:
+ *   Erase size for erasable unit of memory, SIZE_MAX if index is invalid.
  *
  ****************************************************************************/
 
-size_t up_progmem_erasesize(size_t block);
+size_t up_progmem_erasesize(size_t index);
 
 /****************************************************************************
- * Name: up_progmem_getpage
+ * Name: up_progmem_getindex
  *
  * Description:
- *   Address to read/write page conversion
+ *   Get the index of memory, given a FLASH memory address
  *
  * Input Parameters:
  *  addr - Address with or without flash offset
- *         (absolute or aligned to page0)
+ *         (absolute or aligned to sector0)
  *
  * Returned Value:
- *   Page or negative value on error.
+ *   Index or negative value on error.
  *   The following errors are reported (errno is not set!):
  *
  *     -EFAULT: On invalid address
  *
  ****************************************************************************/
 
-ssize_t up_progmem_getpage(size_t addr);
+ssize_t up_progmem_getindex(size_t addr);
 
 /****************************************************************************
  * Name: up_progmem_getaddress
  *
  * Description:
- *   Read/write page to address conversion
+ *   Get the base address of a unit of memory, given an index
  *
  * Input Parameters:
- *   page - page index
+ *   index - ordinal number of the set of erasable units of memory
  *
  * Returned Value:
- *   Base address of given page, SIZE_MAX if page index is not valid.
+ *   Base address of given section, SIZE_MAX if index is not valid.
  *
  ****************************************************************************/
 
-size_t up_progmem_getaddress(size_t page);
+size_t up_progmem_getaddress(size_t index);
 
 /****************************************************************************
- * Name: up_progmem_eraseblock
+ * Name: up_progmem_erase
  *
  * Description:
- *   Erase selected erase block.
+ *   Erase a specified unit of memory, given an index
  *
  * Input Parameters:
- *   block - The erase block index to be erased.
+ *   index - ordinal number of the set of erasable units of memory
  *
  * Returned Value:
- *   block size or negative value on error.
+ *   section size or negative value on error.

Review comment:
       ```suggestion
    *   The unit of memory's size or negative value on error.
   ```
   return type needs to be ssize_t if negative return or use 0

##########
File path: include/nuttx/progmem.h
##########
@@ -234,6 +261,67 @@ ssize_t up_progmem_write(size_t addr, FAR const void *buf, size_t count);
 ssize_t up_progmem_read(size_t addr, FAR void *buf, size_t count);
 #endif
 
+/****************************************************************************
+ * Name: up_progmem_enableprogramming
+ *
+ * Description:
+ *   Enable the ability to erase/write the FLASH memory.
+ *

Review comment:
       Add: Typically done by "Unlocking" the FLASH programming IP Block 

##########
File path: include/nuttx/progmem.h
##########
@@ -147,48 +170,50 @@ size_t up_progmem_getaddress(size_t page);
  *
  ****************************************************************************/
 
-ssize_t up_progmem_eraseblock(size_t block);
+ssize_t up_progmem_erase(size_t index);
 
 /****************************************************************************
- * Name: up_progmem_ispageerased
+ * Name: up_progmem_issectionerased
  *
  * Description:
- *   Checks whether erase page is erased
+ *   Checks whether a specified unit of memory is erased
  *
  * Input Parameters:
- *   page - The page index to be checked.
+ *   index - ordinal number of the set of erasable units of memory
  *
  * Returned Value:
  *   Returns number of bytes NOT erased or negative value on error. If it
- *   returns zero then complete page is erased.
+ *   returns zero then complete section is erased.
  *
  *   The following errors are reported:
- *     -EFAULT: On invalid page
+ *     -EFAULT: On invalid index
  *
  ****************************************************************************/
 
-ssize_t up_progmem_ispageerased(size_t page);
+ssize_t up_progmem_iserased(size_t index);
 
 /****************************************************************************
  * Name: up_progmem_write
  *
  * Description:
  *   Program 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.
+ *   Note: This function may cross memory boundaries so long as the caller
+ *         has ensured all units of memory that will be programmed have been
+ *         erased. It also does not require that the write be aligned with the
+ *         beginning of a unit of memory.
  *
  * Input Parameters:
  *   addr  - Address with or without flash offset
- *           (absolute or aligned to page0)
+ *           (absolute or aligned to sector0)

Review comment:
       ```suggestion
    *           (absolute or aligned to the zeroth unit of memory)
   ```

##########
File path: include/nuttx/progmem.h
##########
@@ -234,6 +261,67 @@ ssize_t up_progmem_write(size_t addr, FAR const void *buf, size_t count);
 ssize_t up_progmem_read(size_t addr, FAR void *buf, size_t count);
 #endif
 
+/****************************************************************************
+ * Name: up_progmem_enableprogramming
+ *
+ * Description:
+ *   Enable the ability to erase/write the FLASH memory.
+ *
+ *   NOTE: Write-protection may still be required for an individual
+ *         unit of memory.
+ *
+ * Returned Value:
+ *   0 on success, or negative value on error.
+ *
+ ****************************************************************************/
+
+int up_progmem_enableprogramming(void);
+
+/****************************************************************************
+ * Name: up_progmem_disableprogramming
+ *
+ * Description:
+ *   Disable the ability to erase/write the FLASH memory.
+ *

Review comment:
       "

##########
File path: include/nuttx/progmem.h
##########
@@ -49,96 +49,119 @@ extern "C"
  * Public Functions Definitions
  ****************************************************************************/
 
+/* NOTE: Since vendors use the terms page, block, and sector interchangably,
+ * it causes confusion and therefore a neutral term is used. We use the term
+ * "index" to refer to the ordinal number of erasable units of memory.
+ */
+
 /****************************************************************************
- * Name: up_progmem_neraseblocks
+ * Name: up_progmem_maxeraseindex
  *
  * Description:
- *   Return number of erase blocks
+ *   Return the total number of erasable units of memory.
  *
  ****************************************************************************/
 
-size_t up_progmem_neraseblocks(void);
+size_t up_progmem_maxeraseindex(void);
 
 /****************************************************************************
  * Name: up_progmem_isuniform
  *
  * Description:
- *  Is program memory uniform or erase page and read/write page size differs?
+ *  Are all erasable units of memory the same size?
+ *
+ * Returned Value:
+ *   true if all erasable units are the same size, false if they vary in size
  *
  ****************************************************************************/
 
 bool up_progmem_isuniform(void);
 
 /****************************************************************************
- * Name: up_progmem_pagesize
+ * Name: up_progmem_writegranularity
  *
  * Description:
- *   Return read/write page size
+ *   Return the number of bytes of the smallest allowable write operation.
+ *   All writes MUST be a multiple of the granularity. Some FLASH memories
+ *   require write operations in multiples of 8-bit, 16-bit, 32-bit, 128-bit,
+ *   256-bit, etc. The caller must ensure the size of the data passed into
+ *   up_progmem_write is an even multiple of the writegranularity. Padding
+ *   may be required.
+ *
+ * Returned Value:
+ *   Required granularity of a write operation for the FLASH memory.
  *
  ****************************************************************************/
 
-size_t up_progmem_pagesize(size_t page);
+size_t up_progmem_writegranularity(void);
 
 /****************************************************************************
  * Name: up_progmem_erasesize
  *
  * Description:
- *  Return erase block size. Must be a multiple of the read/write page size.
+ *   Return the erase size for a specified index. Will always be a multiple of
+ *   the write granularity.
+ *
+ * Input Parameters:
+ *   index - ordinal number of the set of erasable units of memory
+ *
+ * Returned Value:
+ *   Erase size for erasable unit of memory, SIZE_MAX if index is invalid.
  *
  ****************************************************************************/
 
-size_t up_progmem_erasesize(size_t block);
+size_t up_progmem_erasesize(size_t index);
 
 /****************************************************************************
- * Name: up_progmem_getpage
+ * Name: up_progmem_getindex
  *
  * Description:
- *   Address to read/write page conversion
+ *   Get the index of memory, given a FLASH memory address
  *
  * Input Parameters:
  *  addr - Address with or without flash offset
- *         (absolute or aligned to page0)
+ *         (absolute or aligned to sector0)
  *
  * Returned Value:
- *   Page or negative value on error.
+ *   Index or negative value on error.
  *   The following errors are reported (errno is not set!):
  *
  *     -EFAULT: On invalid address
  *
  ****************************************************************************/
 
-ssize_t up_progmem_getpage(size_t addr);
+ssize_t up_progmem_getindex(size_t addr);
 
 /****************************************************************************
  * Name: up_progmem_getaddress
  *
  * Description:
- *   Read/write page to address conversion
+ *   Get the base address of a unit of memory, given an index
  *
  * Input Parameters:
- *   page - page index
+ *   index - ordinal number of the set of erasable units of memory
  *
  * Returned Value:
- *   Base address of given page, SIZE_MAX if page index is not valid.
+ *   Base address of given section, SIZE_MAX if index is not valid.
  *
  ****************************************************************************/
 
-size_t up_progmem_getaddress(size_t page);
+size_t up_progmem_getaddress(size_t index);
 
 /****************************************************************************
- * Name: up_progmem_eraseblock
+ * Name: up_progmem_erase
  *
  * Description:
- *   Erase selected erase block.
+ *   Erase a specified unit of memory, given an index
  *
  * Input Parameters:
- *   block - The erase block index to be erased.
+ *   index - ordinal number of the set of erasable units of memory
  *
  * Returned Value:
- *   block size or negative value on error.
+ *   section size or negative value on error.
  *   The following errors are reported (errno is not set!):
  *
- *     -EFAULT: On invalid page
+ *     -EFAULT: On invalid section

Review comment:
       ```suggestion
    *     -EFAULT: On invalid index
   ```

##########
File path: include/nuttx/progmem.h
##########
@@ -147,48 +170,50 @@ size_t up_progmem_getaddress(size_t page);
  *
  ****************************************************************************/
 
-ssize_t up_progmem_eraseblock(size_t block);
+ssize_t up_progmem_erase(size_t index);
 
 /****************************************************************************
- * Name: up_progmem_ispageerased
+ * Name: up_progmem_issectionerased
  *
  * Description:
- *   Checks whether erase page is erased
+ *   Checks whether a specified unit of memory is erased
  *
  * Input Parameters:
- *   page - The page index to be checked.
+ *   index - ordinal number of the set of erasable units of memory
  *
  * Returned Value:
  *   Returns number of bytes NOT erased or negative value on error. If it
- *   returns zero then complete page is erased.
+ *   returns zero then complete section is erased.
  *
  *   The following errors are reported:
- *     -EFAULT: On invalid page
+ *     -EFAULT: On invalid index
  *
  ****************************************************************************/
 
-ssize_t up_progmem_ispageerased(size_t page);
+ssize_t up_progmem_iserased(size_t index);
 
 /****************************************************************************
  * Name: up_progmem_write
  *
  * Description:
  *   Program 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.
+ *   Note: This function may cross memory boundaries so long as the caller
+ *         has ensured all units of memory that will be programmed have been
+ *         erased. It also does not require that the write be aligned with the
+ *         beginning of a unit of memory.
  *
  * Input Parameters:
  *   addr  - Address with or without flash offset
- *           (absolute or aligned to page0)
+ *           (absolute or aligned to sector0)

Review comment:
       I find this confusing. 
   
   If it is an address the caller has to know the base address of the memory, so the arch data has to be exposed to the caller.  Would could add a function that returns the the base(s) as any counted array.
   
   If it is BASE address less it is an offset. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org