|
ChibiOS
0.0.0
|
HAL Generic Flash Driver Interface. More...
|
HAL Generic Flash Driver Interface.
Macros | |
| #define | _base_flash_methods_alone |
BaseFlash specific methods. More... | |
| #define | _base_flash_methods |
BaseFlash specific methods with inherited ones. More... | |
| #define | _base_flash_data |
BaseFlash specific data. More... | |
Macro Functions (BaseFlash) | |
| #define | getBaseFlash(ip) ((BaseFlash *)&(ip)->vmt) |
| Instance getter. More... | |
| #define | flashGetDescriptor(ip) (ip)->vmt->get_descriptor(ip) |
| Sensors get axes number. More... | |
| #define | flashRead(ip, offset, n, rp) (ip)->vmt->read(ip, offset, n, rp) |
| Read operation. More... | |
| #define | flashProgram(ip, offset, n, pp) (ip)->vmt->program(ip, offset, n, pp) |
| Program operation. More... | |
| #define | flashStartEraseAll(ip) (ip)->vmt->start_erase_all(ip) |
| Starts a whole-device erase operation. More... | |
| #define | flashStartEraseSector(ip, sector) (ip)->vmt->start_erase_sector(ip, sector) |
| Starts an sector erase operation. More... | |
| #define | flashQueryErase(ip, msec) (ip)->vmt->query_erase(ip, msec) |
| Queries the driver for erase operation progress. More... | |
| #define | flashVerifyErase(ip, sector) (ip)->vmt->verify_erase(ip, sector) |
| Returns the erase state of a sector. More... | |
Typedefs | |
| typedef uint32_t | flash_offset_t |
| Type of a flash offset. More... | |
| typedef uint32_t | flash_sector_t |
| Type of a flash sector number. More... | |
Data Structures | |
| struct | flash_sector_descriptor_t |
| Flash sector descriptor. More... | |
| struct | flash_descriptor_t |
| Type of a flash device descriptor. More... | |
| struct | BaseFlashVMT |
BaseFlash virtual methods table. More... | |
| struct | BaseFlash |
| Base flash class. More... | |
Functions | |
| flash_error_t | flashWaitErase (BaseFlash *devp) |
| Waits until the current erase operation is finished. More... | |
| flash_offset_t | flashGetSectorOffset (BaseFlash *devp, flash_sector_t sector) |
| Returns the offset of a sector. More... | |
| uint32_t | flashGetSectorSize (BaseFlash *devp, flash_sector_t sector) |
| Returns the size of a sector. More... | |
Enumerations |
| #define _base_flash_methods_alone |
BaseFlash specific methods.
Definition at line 143 of file hal_flash.h.
| #define _base_flash_methods |
BaseFlash specific methods with inherited ones.
Definition at line 164 of file hal_flash.h.
| #define _base_flash_data |
BaseFlash specific data.
Definition at line 178 of file hal_flash.h.
| #define getBaseFlash | ( | ip | ) | ((BaseFlash *)&(ip)->vmt) |
Instance getter.
This special method is used to get the instance of this class object from a derived class.
Definition at line 207 of file hal_flash.h.
| #define flashGetDescriptor | ( | ip | ) | (ip)->vmt->get_descriptor(ip) |
Sensors get axes number.
| [in] | ip | pointer to a BaseFlash or derived class |
Definition at line 217 of file hal_flash.h.
Referenced by flashGetSectorOffset(), and flashGetSectorSize().
| #define flashRead | ( | ip, | |
| offset, | |||
| n, | |||
| rp | |||
| ) | (ip)->vmt->read(ip, offset, n, rp) |
Read operation.
| [in] | ip | pointer to a BaseFlash or derived class |
| [in] | offset | flash offset |
| [in] | n | number of bytes to be read |
| [out] | rp | pointer to the data buffer |
| FLASH_NO_ERROR | if there is no erase operation in progress. |
| FLASH_BUSY_ERASING | if there is an erase operation in progress. |
| FLASH_ERROR_READ | if the read operation failed. |
| FLASH_ERROR_HW_FAILURE | if access to the memory failed. |
Definition at line 235 of file hal_flash.h.
Referenced by mfs_flash_read().
| #define flashProgram | ( | ip, | |
| offset, | |||
| n, | |||
| pp | |||
| ) | (ip)->vmt->program(ip, offset, n, pp) |
Program operation.
| [in] | ip | pointer to a BaseFlash or derived class |
| [in] | offset | flash offset |
| [in] | n | number of bytes to be programmed |
| [in] | pp | pointer to the data buffer |
| FLASH_NO_ERROR | if there is no erase operation in progress. |
| FLASH_BUSY_ERASING | if there is an erase operation in progress. |
| FLASH_ERROR_PROGRAM | if the program operation failed. |
| FLASH_ERROR_HW_FAILURE | if access to the memory failed. |
Definition at line 253 of file hal_flash.h.
Referenced by mfs_flash_write().
| #define flashStartEraseAll | ( | ip | ) | (ip)->vmt->start_erase_all(ip) |
Starts a whole-device erase operation.
| [in] | ip | pointer to a BaseFlash or derived class |
| FLASH_NO_ERROR | if there is no erase operation in progress. |
| FLASH_BUSY_ERASING | if there is an erase operation in progress. |
| FLASH_ERROR_HW_FAILURE | if access to the memory failed. |
Definition at line 267 of file hal_flash.h.
| #define flashStartEraseSector | ( | ip, | |
| sector | |||
| ) | (ip)->vmt->start_erase_sector(ip, sector) |
Starts an sector erase operation.
| [in] | ip | pointer to a BaseFlash or derived class |
| [in] | sector | sector to be erased |
| FLASH_NO_ERROR | if there is no erase operation in progress. |
| FLASH_BUSY_ERASING | if there is an erase operation in progress. |
| FLASH_ERROR_HW_FAILURE | if access to the memory failed. |
Definition at line 282 of file hal_flash.h.
Referenced by mfs_bank_erase().
| #define flashQueryErase | ( | ip, | |
| msec | |||
| ) | (ip)->vmt->query_erase(ip, msec) |
Queries the driver for erase operation progress.
| [in] | ip | pointer to a BaseFlash or derived class |
| [out] | msec | recommended time, in milliseconds, that what should be spent before calling this function again, can be NULL |
| FLASH_NO_ERROR | if there is no erase operation in progress. |
| FLASH_BUSY_ERASING | if there is an erase operation in progress. |
| FLASH_ERROR_ERASE | if the erase operation failed. |
| FLASH_ERROR_HW_FAILURE | if access to the memory failed. |
Definition at line 299 of file hal_flash.h.
Referenced by flashWaitErase().
| #define flashVerifyErase | ( | ip, | |
| sector | |||
| ) | (ip)->vmt->verify_erase(ip, sector) |
Returns the erase state of a sector.
| [in] | ip | pointer to a BaseFlash or derived class |
| [in] | sector | sector to be verified |
| FLASH_NO_ERROR | if the sector is erased. |
| FLASH_BUSY_ERASING | if there is an erase operation in progress. |
| FLASH_ERROR_VERIFY | if the verify operation failed. |
| FLASH_ERROR_HW_FAILURE | if access to the memory failed. |
Definition at line 315 of file hal_flash.h.
Referenced by mfs_bank_erase(), and mfs_bank_verify_erase().
| typedef uint32_t flash_offset_t |
Type of a flash offset.
Definition at line 83 of file hal_flash.h.
| typedef uint32_t flash_sector_t |
Type of a flash sector number.
Definition at line 88 of file hal_flash.h.
| enum flash_state_t |
Driver state machine possible states.
Definition at line 58 of file hal_flash.h.
| enum flash_error_t |
Type of a flash error code.
Definition at line 70 of file hal_flash.h.
| flash_error_t flashWaitErase | ( | BaseFlash * | devp | ) |
Waits until the current erase operation is finished.
| [in] | devp | pointer to a BaseFlash object |
| FLASH_NO_ERROR | if there is no erase operation in progress. |
| FLASH_ERROR_ERASE | if the erase operation failed. |
| FLASH_ERROR_HW_FAILURE | if access to the memory failed. |
Definition at line 59 of file hal_flash.c.
References flashQueryErase, and osalThreadSleepMilliseconds.
Referenced by mfs_bank_erase().
| flash_offset_t flashGetSectorOffset | ( | BaseFlash * | devp, |
| flash_sector_t | sector | ||
| ) |
Returns the offset of a sector.
| [in] | devp | pointer to a BaseFlash object |
| [in] | sector | flash sector number |
Definition at line 84 of file hal_flash.c.
References flashGetDescriptor, flash_sector_descriptor_t::offset, osalDbgAssert, flash_descriptor_t::sectors, and flash_descriptor_t::sectors_size.
Referenced by mfs_bank_write_header().
| uint32_t flashGetSectorSize | ( | BaseFlash * | devp, |
| flash_sector_t | sector | ||
| ) |
Returns the size of a sector.
| [in] | devp | pointer to a BaseFlash object |
| [in] | sector | flash sector number |
Definition at line 109 of file hal_flash.c.
References flashGetDescriptor, osalDbgAssert, flash_descriptor_t::sectors, flash_descriptor_t::sectors_size, and flash_sector_descriptor_t::size.