ChibiOS
21.6.0
|
Generic Embedded Flash Driver. More...
Generic Embedded Flash Driver.
This module implements a generic embedded flash driver.
HAL_USE_EFL
option must be enabled in halconf.h
. Macros | |
#define | _efl_flash_methods_alone |
EFlashDriver specific methods. More... | |
#define | _efl_flash_methods |
EFlashDriver specific methods with inherited ones. More... | |
#define | _efl_driver_data |
EFlashDriver specific data. More... | |
#define | efl_lld_driver_fields |
Low level fields of the embedded flash driver structure. More... | |
#define | efl_lld_config_fields |
Low level fields of the embedded flash configuration structure. More... | |
PLATFORM configuration options | |
#define | PLATFORM_EFL_USE_EFL1 FALSE |
EFL1 driver enable switch. More... | |
Typedefs | |
typedef struct hal_efl_driver | EFlashDriver |
Type of external flash driver class. More... | |
typedef struct hal_efl_config | EFlashConfig |
Type of a structure representing a flash driver configuration. More... | |
Data Structures | |
struct | EFlashDriverVMT |
EFlash virtual methods table. More... | |
struct | hal_efl_config |
Type of a structure representing a flash driver configuration. More... | |
struct | hal_efl_driver |
Structure representing an embedded flash driver. More... | |
Functions | |
void | eflInit (void) |
Embedded Flash Driver initialization. More... | |
void | eflObjectInit (EFlashDriver *eflp) |
Initializes a generic EFlashDriver object. More... | |
void | eflStart (EFlashDriver *eflp, const EFlashConfig *config) |
Configures and starts the driver. More... | |
void | eflStop (EFlashDriver *eflp) |
Stops the driver. More... | |
void | efl_lld_init (void) |
Low level Embedded Flash driver initialization. More... | |
void | efl_lld_start (EFlashDriver *eflp) |
Configures and activates the Embedded Flash peripheral. More... | |
void | efl_lld_stop (EFlashDriver *eflp) |
Deactivates the Embedded Flash peripheral. More... | |
const flash_descriptor_t * | efl_lld_get_descriptor (void *instance) |
Gets the flash descriptor structure. More... | |
flash_error_t | efl_lld_read (void *instance, flash_offset_t offset, size_t n, uint8_t *rp) |
Read operation. More... | |
flash_error_t | efl_lld_program (void *instance, flash_offset_t offset, size_t n, const uint8_t *pp) |
Program operation. More... | |
flash_error_t | efl_lld_start_erase_all (void *instance) |
Starts a whole-device erase operation. More... | |
flash_error_t | efl_lld_start_erase_sector (void *instance, flash_sector_t sector) |
Starts an sector erase operation. More... | |
flash_error_t | efl_lld_query_erase (void *instance, uint32_t *msec) |
Queries the driver for erase operation progress. More... | |
flash_error_t | efl_lld_verify_erase (void *instance, flash_sector_t sector) |
Returns the erase state of a sector. More... | |
Variables | |
EFlashDriver | EFLD1 |
EFL1 driver identifier. More... | |
#define _efl_flash_methods_alone |
#define _efl_flash_methods |
#define _efl_driver_data |
EFlashDriver
specific data.
#define PLATFORM_EFL_USE_EFL1 FALSE |
EFL1 driver enable switch.
If set to TRUE
the support for EFL1 is included.
FALSE
. Definition at line 48 of file hal_efl_lld.h.
#define efl_lld_driver_fields |
Low level fields of the embedded flash driver structure.
Definition at line 67 of file hal_efl_lld.h.
#define efl_lld_config_fields |
Low level fields of the embedded flash configuration structure.
Definition at line 74 of file hal_efl_lld.h.
typedef struct hal_efl_driver EFlashDriver |
typedef struct hal_efl_config EFlashConfig |
Type of a structure representing a flash driver configuration.
void eflInit | ( | void | ) |
Embedded Flash Driver initialization.
halInit()
, there is no need to explicitly initialize the driver.Definition at line 67 of file hal_efl.c.
References efl_lld_init().
Referenced by halInit().
void eflObjectInit | ( | EFlashDriver * | eflp | ) |
Initializes a generic EFlashDriver
object.
[out] | eflp | pointer to a EFlashDriver structure |
Definition at line 79 of file hal_efl.c.
References hal_efl_driver::vmt.
Referenced by efl_lld_init().
void eflStart | ( | EFlashDriver * | eflp, |
const EFlashConfig * | config | ||
) |
Configures and starts the driver.
[in] | eflp | pointer to a EFlashDriver structure |
[in] | config | pointer to a configuration structure. If this parameter is set to NULL then a default configuration is used. |
Definition at line 95 of file hal_efl.c.
References osalDbgAssert, osalDbgCheck, and osalSysLock().
void eflStop | ( | EFlashDriver * | eflp | ) |
Stops the driver.
[in] | eflp | pointer to a EFlashDriver structure |
Definition at line 117 of file hal_efl.c.
References osalDbgAssert, osalDbgCheck, and osalSysLock().
void efl_lld_init | ( | void | ) |
Low level Embedded Flash driver initialization.
Definition at line 78 of file hal_efl_lld.c.
References EFLD1, and eflObjectInit().
Referenced by eflInit().
void efl_lld_start | ( | EFlashDriver * | eflp | ) |
Configures and activates the Embedded Flash peripheral.
[in] | eflp | pointer to a EFlashDriver structure |
Definition at line 93 of file hal_efl_lld.c.
void efl_lld_stop | ( | EFlashDriver * | eflp | ) |
Deactivates the Embedded Flash peripheral.
[in] | eflp | pointer to a EFlashDriver structure |
Definition at line 114 of file hal_efl_lld.c.
const flash_descriptor_t * efl_lld_get_descriptor | ( | void * | instance | ) |
Gets the flash descriptor structure.
[in] | instance | pointer to a EFlashDriver instance |
Definition at line 136 of file hal_efl_lld.c.
flash_error_t efl_lld_read | ( | void * | instance, |
flash_offset_t | offset, | ||
size_t | n, | ||
uint8_t * | rp | ||
) |
Read operation.
[in] | instance | pointer to a EFlashDriver instance |
[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 158 of file hal_efl_lld.c.
flash_error_t efl_lld_program | ( | void * | instance, |
flash_offset_t | offset, | ||
size_t | n, | ||
const uint8_t * | pp | ||
) |
Program operation.
[in] | instance | pointer to a EFlashDriver instance |
[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 202 of file hal_efl_lld.c.
flash_error_t efl_lld_start_erase_all | ( | void * | instance | ) |
Starts a whole-device erase operation.
[in] | instance | pointer to a EFlashDriver instance |
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 243 of file hal_efl_lld.c.
References osalDbgAssert, and osalDbgCheck.
flash_error_t efl_lld_start_erase_sector | ( | void * | instance, |
flash_sector_t | sector | ||
) |
Starts an sector erase operation.
[in] | instance | pointer to a EFlashDriver instance |
[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 275 of file hal_efl_lld.c.
References osalDbgCheck.
flash_error_t efl_lld_query_erase | ( | void * | instance, |
uint32_t * | msec | ||
) |
Queries the driver for erase operation progress.
[in] | instance | pointer to a EFlashDriver instance |
[out] | msec | recommended time, in milliseconds, that 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 312 of file hal_efl_lld.c.
flash_error_t efl_lld_verify_erase | ( | void * | instance, |
flash_sector_t | sector | ||
) |
Returns the erase state of a sector.
[in] | instance | pointer to a EFlashDriver instance |
[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 341 of file hal_efl_lld.c.
EFlashDriver EFLD1 |