ChibiOS/HAL 9.0.0
hal_flash.h File Reference

Generic flash driver class header. More...

Go to the source code of this file.

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...

Macros

#define _base_flash_methods_alone
 BaseFlash specific methods.
#define _base_flash_methods
 BaseFlash specific methods with inherited ones.
#define _base_flash_data
 BaseFlash specific data.
Flash attributes
#define FLASH_ATTR_ERASED_IS_ONE   0x00000001U
 Defines one as the erased bit state.
#define FLASH_ATTR_MEMORY_MAPPED   0x00000002U
 The memory is accessible in a memory mapped mode.
#define FLASH_ATTR_REWRITABLE   0x00000004U
 Programmed pages can be programmed again.
#define FLASH_ATTR_ECC_CAPABLE   0x00000008U
 The memory is protected by an ECC mechanism.
#define FLASH_ATTR_ECC_ZERO_LINE_CAPABLE   0x00000010U
 The device is able to overwrite zero to a line.
#define FLASH_ATTR_SUSPEND_ERASE_CAPABLE   0x00000020U
 The device is able to suspend erase operations.
Macro Functions (BaseFlash)
#define getBaseFlash(ip)
 Instance getter.
#define flashGetDescriptor(ip)
 Gets the flash descriptor structure.
#define flashRead(ip, offset, n, rp)
 Read operation.
#define flashProgram(ip, offset, n, pp)
 Program operation.
#define flashStartEraseAll(ip)
 Starts a whole-device erase operation.
#define flashStartEraseSector(ip, sector)
 Starts an sector erase operation.
#define flashQueryErase(ip, msec)
 Queries the driver for erase operation progress.
#define flashVerifyErase(ip, sector)
 Returns the erase state of a sector.
#define flashAcquireExclusive(ip)
 Acquires exclusive access to flash.
#define flashReleaseExclusive(ip)
 Releases exclusive access to flash.

Typedefs

typedef uint32_t flash_offset_t
 Type of a flash offset.
typedef uint32_t flash_sector_t
 Type of a flash sector number.

Enumerations

enum  flash_state_t {
  FLASH_UNINIT = 0 , FLASH_STOP = 1 , FLASH_READY = 2 , FLASH_READ = 3 ,
  FLASH_PGM = 4 , FLASH_ERASE = 5
}
 Driver state machine possible states. More...
enum  flash_error_t {
  FLASH_NO_ERROR = 0 , FLASH_BUSY_ERASING = 1 , FLASH_ERROR_READ = 2 , FLASH_ERROR_PROGRAM = 3 ,
  FLASH_ERROR_ERASE = 4 , FLASH_ERROR_VERIFY = 5 , FLASH_ERROR_HW_FAILURE = 6 , FLASH_ERROR_UNIMPLEMENTED = 7
}
 Type of a flash error code. More...

Functions

flash_error_t flashWaitErase (BaseFlash *devp)
 Waits until the current erase operation is finished.
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.
flash_sector_t flashGetOffsetSector (BaseFlash *devp, flash_offset_t offset)
 Returns the sector of an offset.
void * flashGetOffsetAddress (BaseFlash *devp, flash_offset_t offset)
 Get absolute address from offset.
flash_offset_t flashGetAddressOffset (BaseFlash *devp, void *addr)
 Get offset from absolute address.

Detailed Description

Generic flash driver class header.

Definition in file hal_flash.h.