|
PebbleOS v4.45.0-142-gc51251f50
|
Access to areas of the board's flash. More...
Data Structures | |
| struct | pbl_flash_partition |
| An area of the board's flash. More... | |
Macros | |
| #define | PBL_FLASH_PARTITION(name) ((struct pbl_flash_partition){.offset = name##_OFFSET, .size = name##_SIZE}) |
The partition described by the constants name_OFFSET and name_SIZE. | |
Functions | |
| static bool | pbl_flash_partition__in_range (struct pbl_flash_partition part, uint32_t offs, size_t len) |
| static int | pbl_flash_partition_read (struct pbl_flash_partition part, uint32_t offs, void *buf, size_t len) |
| Read data. | |
| static int | pbl_flash_partition_write (struct pbl_flash_partition part, uint32_t offs, const void *buf, size_t len) |
| Write data. | |
| static int | pbl_flash_partition_erase (struct pbl_flash_partition part, uint32_t offs, size_t len) |
| Erase a range. | |
| static bool | pbl_flash_partition_is_erased (struct pbl_flash_partition part, uint32_t offs, size_t len) |
| Check whether a range is erased. | |
| static int | pbl_flash_partition_protect (struct pbl_flash_partition part) |
| Protect a whole partition against writes and erases. | |
Access to areas of the board's flash.
Offsets given to these functions start at the partition, which they check them against. Code working on flash addresses uses offset and size directly. The partitions themselves belong to the board: see pbl/board/partitions.h.
| struct pbl_flash_partition |
| #define PBL_FLASH_PARTITION | ( | name | ) | ((struct pbl_flash_partition){.offset = name##_OFFSET, .size = name##_SIZE}) |
The partition described by the constants name_OFFSET and name_SIZE.
| name | Prefix of the constants. |
|
inlinestatic |
References pbl_flash_partition::size.
Referenced by pbl_flash_partition_erase(), pbl_flash_partition_is_erased(), pbl_flash_partition_read(), and pbl_flash_partition_write().
|
inlinestatic |
Erase a range.
| part | Partition. |
| offs | Offset in the partition, aligned to a subsector. |
| len | Number of bytes. |
| 0 | On success. |
| -EINVAL | If the range is outside the partition. |
References FLASH, pbl_flash_partition::offset, pbl_flash_erase(), and pbl_flash_partition__in_range().
|
inlinestatic |
Check whether a range is erased.
| part | Partition. |
| offs | Offset in the partition. |
| len | Number of bytes. |
References FLASH, pbl_flash_partition::offset, pbl_flash_is_erased(), and pbl_flash_partition__in_range().
|
inlinestatic |
Protect a whole partition against writes and erases.
| part | Partition. |
References FLASH, pbl_flash_partition::offset, pbl_flash_protect(), and pbl_flash_partition::size.
|
inlinestatic |
Read data.
| part | Partition. |
| offs | Offset in the partition. |
| buf | Buffer. |
| len | Number of bytes. |
| 0 | On success. |
| -EINVAL | If the range is outside the partition. |
References FLASH, pbl_flash_partition::offset, pbl_flash_partition__in_range(), and pbl_flash_read().
|
inlinestatic |
Write data.
| part | Partition. |
| offs | Offset in the partition. |
| buf | Data. |
| len | Number of bytes. |
| 0 | On success. |
| -EINVAL | If the range is outside the partition. |
References FLASH, pbl_flash_partition::offset, pbl_flash_partition__in_range(), and pbl_flash_write().