36 #define FLASH_ATTR_ERASED_IS_ONE            0x00000001    37 #define FLASH_ATTR_MEMORY_MAPPED            0x00000002    38 #define FLASH_ATTR_REWRITABLE               0x00000004    39 #define FLASH_ATTR_READ_ECC_CAPABLE         0x00000008    40 #define FLASH_ATTR_SUSPEND_ERASE_CAPABLE    0x00000010    72   FLASH_BUSY_ERASING = 1,       
    74   FLASH_ERROR_PROGRAM = 3,      
    75   FLASH_ERROR_ERASE = 4,        
    76   FLASH_ERROR_VERIFY = 5,       
    77   FLASH_ERROR_HW_FAILURE = 6    
   142 #define _base_flash_methods_alone                                           \   144   const flash_descriptor_t * (*get_descriptor)(void *instance);             \   146   flash_error_t (*read)(void *instance, flash_offset_t offset,              \   147                         size_t n, uint8_t *rp);                             \   149   flash_error_t (*program)(void *instance, flash_offset_t offset,           \   150                            size_t n, const uint8_t *pp);                    \   152   flash_error_t (*start_erase_all)(void *instance);                         \   154   flash_error_t (*start_erase_sector)(void *instance,                       \   155                                       flash_sector_t sector);               \   156   flash_error_t (*query_erase)(void *instance, uint32_t *wait_time);        \   158   flash_error_t (*verify_erase)(void *instance, flash_sector_t sector);   163 #define _base_flash_methods                                                 \   164   _base_object_methods                                                      \   165   _base_flash_methods_alone   177 #define _base_flash_data                                                    \   206 #define getBaseFlash(ip) ((BaseFlash *)&(ip)->vmt)   216 #define flashGetDescriptor(ip)                                              \   217   (ip)->vmt->get_descriptor(ip)   234 #define flashRead(ip, offset, n, rp)                                        \   235   (ip)->vmt->read(ip, offset, n, rp)   252 #define flashProgram(ip, offset, n, pp)                                     \   253   (ip)->vmt->program(ip, offset, n, pp)   266 #define flashStartEraseAll(ip)                                              \   267   (ip)->vmt->start_erase_all(ip)   281 #define flashStartEraseSector(ip, sector)                                   \   282   (ip)->vmt->start_erase_sector(ip, sector)   298 #define flashQueryErase(ip, msec)                                           \   299   (ip)->vmt->query_erase(ip, msec)   314 #define flashVerifyErase(ip, sector)                                        \   315   (ip)->vmt->verify_erase(ip, sector) BaseFlash virtual methods table. 
 
uint32_t flash_sector_t
Type of a flash sector number. 
 
flash_state_t
Driver state machine possible states. 
 
uint32_t size
Sector size. 
 
uint32_t attributes
Device_attributes. 
 
#define _base_flash_data
BaseFlash specific data. 
 
flash_offset_t offset
Sector offset. 
 
uint32_t sectors_size
Size of sectors for devices with uniform sector size. 
 
Type of a flash device descriptor. 
 
uint32_t flashGetSectorSize(BaseFlash *devp, flash_sector_t sector)
Returns the size of a sector. 
 
flash_error_t
Type of a flash error code. 
 
flash_error_t flashWaitErase(BaseFlash *devp)
Waits until the current erase operation is finished. 
 
uint32_t page_size
Size of write page. 
 
uint32_t flash_offset_t
Type of a flash offset. 
 
#define _base_flash_methods
BaseFlash specific methods with inherited ones. 
 
flash_offset_t flashGetSectorOffset(BaseFlash *devp, flash_sector_t sector)
Returns the offset of a sector. 
 
flash_offset_t address
Flash address if memory mapped or zero. 
 
const flash_sector_descriptor_t * sectors
List of sectors for devices with non-uniform sector sizes. 
 
flash_sector_t sectors_count
Number of sectors in the device. 
 
const struct BaseFlashVMT * vmt
Virtual Methods Table.