39#define FLASH_ATTR_ERASED_IS_ONE 0x00000001U
43#define FLASH_ATTR_MEMORY_MAPPED 0x00000002U
48#define FLASH_ATTR_REWRITABLE 0x00000004U
58#define FLASH_ATTR_ECC_CAPABLE 0x00000008U
64#define FLASH_ATTR_ECC_ZERO_LINE_CAPABLE 0x00000010U
68#define FLASH_ATTR_SUSPEND_ERASE_CAPABLE 0x00000020U
175#define _base_flash_methods_alone \
177 const flash_descriptor_t * (*get_descriptor)(void *instance); \
179 flash_error_t (*read)(void *instance, flash_offset_t offset, \
180 size_t n, uint8_t *rp); \
182 flash_error_t (*program)(void *instance, flash_offset_t offset, \
183 size_t n, const uint8_t *pp); \
185 flash_error_t (*start_erase_all)(void *instance); \
187 flash_error_t (*start_erase_sector)(void *instance, \
188 flash_sector_t sector); \
189 flash_error_t (*query_erase)(void *instance, uint32_t *wait_time); \
191 flash_error_t (*verify_erase)(void *instance, flash_sector_t sector); \
193 flash_error_t (*acquire_exclusive)(void *instance); \
195 flash_error_t (*release_exclusive)(void *instance);
200#define _base_flash_methods \
201 _base_object_methods \
202 _base_flash_methods_alone
214#define _base_flash_data \
243#define getBaseFlash(ip) ((BaseFlash *)&(ip)->vmt)
253#define flashGetDescriptor(ip) \
254 (ip)->vmt->get_descriptor(ip)
271#define flashRead(ip, offset, n, rp) \
272 (ip)->vmt->read(ip, offset, n, rp)
289#define flashProgram(ip, offset, n, pp) \
290 (ip)->vmt->program(ip, offset, n, pp)
303#define flashStartEraseAll(ip) \
304 (ip)->vmt->start_erase_all(ip)
318#define flashStartEraseSector(ip, sector) \
319 (ip)->vmt->start_erase_sector(ip, sector)
336#define flashQueryErase(ip, msec) \
337 (ip)->vmt->query_erase(ip, msec)
352#define flashVerifyErase(ip, sector) \
353 (ip)->vmt->verify_erase(ip, sector)
364#define flashAcquireExclusive(ip) \
365 (ip)->vmt->acquire_exclusive(ip)
376#define flashReleaseExclusive(ip) \
377 (ip)->vmt->release_exclusive(ip)
flash_offset_t flashGetSectorOffset(BaseFlash *devp, flash_sector_t sector)
Returns the offset of a sector.
uint32_t flashGetSectorSize(BaseFlash *devp, flash_sector_t sector)
Returns the size of a sector.
#define _base_flash_data
BaseFlash specific data.
flash_sector_t flashGetOffsetSector(BaseFlash *devp, flash_offset_t offset)
Returns the sector of an offset.
uint32_t flash_sector_t
Type of a flash sector number.
flash_error_t flashWaitErase(BaseFlash *devp)
Waits until the current erase operation is finished.
flash_state_t
Driver state machine possible states.
uint32_t flash_offset_t
Type of a flash offset.
void * flashGetOffsetAddress(BaseFlash *devp, flash_offset_t offset)
Get absolute address from offset.
flash_error_t
Type of a flash error code.
flash_offset_t flashGetAddressOffset(BaseFlash *devp, void *addr)
Get offset from absolute address.
#define _base_flash_methods
BaseFlash specific methods with inherited ones.
@ FLASH_ERROR_UNIMPLEMENTED
const struct BaseFlashVMT * vmt
Virtual Methods Table.
BaseFlash virtual methods table.
Type of a flash device descriptor.
const flash_sector_descriptor_t * sectors
List of sectors for devices with non-uniform sector sizes.
uint32_t attributes
Device_attributes.
uint32_t sectors_size
Size of sectors for devices with uniform sector size.
uint32_t page_size
Size of write page.
flash_sector_t sectors_count
Number of sectors in the device.
uint8_t * address
Flash address if memory mapped or zero.
flash_offset_t offset
Sector offset.
uint32_t size
Sector size.