Go to the documentation of this file.
39 #define FLASH_ATTR_ERASED_IS_ONE 0x00000001U
43 #define FLASH_ATTR_MEMORY_MAPPED 0x00000002U
48 #define FLASH_ATTR_REWRITABLE 0x00000004U
59 #define FLASH_ATTR_ECC_CAPABLE 0x00000008U
65 #define FLASH_ATTR_ECC_ZERO_LINE_CAPABLE 0x00000010U
69 #define FLASH_ATTR_SUSPEND_ERASE_CAPABLE 0x00000020U
101 FLASH_BUSY_ERASING = 1,
102 FLASH_ERROR_READ = 2,
103 FLASH_ERROR_PROGRAM = 3,
104 FLASH_ERROR_ERASE = 4,
105 FLASH_ERROR_VERIFY = 5,
106 FLASH_ERROR_HW_FAILURE = 6,
107 FLASH_ERROR_UNIMPLEMENTED = 7
176 #define _base_flash_methods_alone \
178 const flash_descriptor_t * (*get_descriptor)(void *instance); \
180 flash_error_t (*read)(void *instance, flash_offset_t offset, \
181 size_t n, uint8_t *rp); \
183 flash_error_t (*program)(void *instance, flash_offset_t offset, \
184 size_t n, const uint8_t *pp); \
186 flash_error_t (*start_erase_all)(void *instance); \
188 flash_error_t (*start_erase_sector)(void *instance, \
189 flash_sector_t sector); \
190 flash_error_t (*query_erase)(void *instance, uint32_t *wait_time); \
192 flash_error_t (*verify_erase)(void *instance, flash_sector_t sector);
197 #define _base_flash_methods \
198 _base_object_methods \
199 _base_flash_methods_alone
211 #define _base_flash_data \
240 #define getBaseFlash(ip) ((BaseFlash *)&(ip)->vmt)
250 #define flashGetDescriptor(ip) \
251 (ip)->vmt->get_descriptor(ip)
268 #define flashRead(ip, offset, n, rp) \
269 (ip)->vmt->read(ip, offset, n, rp)
286 #define flashProgram(ip, offset, n, pp) \
287 (ip)->vmt->program(ip, offset, n, pp)
300 #define flashStartEraseAll(ip) \
301 (ip)->vmt->start_erase_all(ip)
315 #define flashStartEraseSector(ip, sector) \
316 (ip)->vmt->start_erase_sector(ip, sector)
333 #define flashQueryErase(ip, msec) \
334 (ip)->vmt->query_erase(ip, msec)
349 #define flashVerifyErase(ip, sector) \
350 (ip)->vmt->verify_erase(ip, sector)
#define _base_flash_methods
BaseFlash specific methods with inherited ones.
flash_state_t
Driver state machine possible states.
Type of a flash device descriptor.
uint32_t flashGetSectorSize(BaseFlash *devp, flash_sector_t sector)
Returns the size of a sector.
uint32_t attributes
Device_attributes.
flash_offset_t flashGetSectorOffset(BaseFlash *devp, flash_sector_t sector)
Returns the offset of a sector.
uint32_t flash_sector_t
Type of a flash sector number.
uint32_t sectors_size
Size of sectors for devices with uniform sector size.
const flash_sector_descriptor_t * sectors
List of sectors for devices with non-uniform sector sizes.
#define _base_flash_data
BaseFlash specific data.
const struct BaseFlashVMT * vmt
Virtual Methods Table.
flash_sector_t sectors_count
Number of sectors in the device.
uint32_t page_size
Size of write page.
flash_error_t flashWaitErase(BaseFlash *devp)
Waits until the current erase operation is finished.
uint32_t size
Sector size.
uint8_t * address
Flash address if memory mapped or zero.
flash_error_t
Type of a flash error code.
uint32_t flash_offset_t
Type of a flash offset.
flash_offset_t offset
Sector offset.
BaseFlash virtual methods table.