VSF Documented
Macros | Functions
flash_common.c File Reference
#include "hal/driver/driver.h"

Macros

#define VSF_FLASH_CFG_FUNCTION_RENAME   DISABLED
 

Functions

vsf_err_t vsf_flash_init (vsf_flash_t *flash_ptr, vsf_flash_cfg_t *cfg_ptr)
 Initialize a FLASH instance.
 
void vsf_flash_fini (vsf_flash_t *flash_ptr)
 Finalize a FLASH instance.
 
fsm_rt_t vsf_flash_enable (vsf_flash_t *flash_ptr)
 Enable a FLASH instance.
 
fsm_rt_t vsf_flash_disable (vsf_flash_t *flash_ptr)
 Disable a FLASH instance.
 
void vsf_flash_irq_enable (vsf_flash_t *flash_ptr, vsf_flash_irq_mask_t irq_mask)
 Enable interrupt masks of FLASH instance.
 
void vsf_flash_irq_disable (vsf_flash_t *flash_ptr, vsf_flash_irq_mask_t irq_mask)
 Disable interrupt masks of FLASH instance.
 
vsf_flash_status_t vsf_flash_status (vsf_flash_t *flash_ptr)
 Get the status of FLASH instance.
 
vsf_flash_capability_t vsf_flash_capability (vsf_flash_t *flash_ptr)
 Get the capabilities of FLASH instance.
 
vsf_err_t vsf_flash_erase_one_sector (vsf_flash_t *flash_ptr, uint_fast32_t offset)
 FLASH erase one sector.
 
vsf_err_t vsf_flash_erase_multi_sector (vsf_flash_t *flash_ptr, uint_fast32_t offset, uint_fast32_t size)
 Flash erase a continuous range.
 
vsf_err_t vsf_flash_erase_all (vsf_flash_t *flash_ptr)
 Flash chip erase.
 
vsf_err_t vsf_flash_write_one_sector (vsf_flash_t *flash_ptr, uint_fast32_t offset, uint8_t *buffer, uint_fast32_t size)
 Flash write one sector.
 
vsf_err_t vsf_flash_write_multi_sector (vsf_flash_t *flash_ptr, uint_fast32_t offset, uint8_t *buffer, uint_fast32_t size)
 Flash write multi sector.
 
vsf_err_t vsf_flash_read_one_sector (vsf_flash_t *flash_ptr, uint_fast32_t offset, uint8_t *buffer, uint_fast32_t size)
 flash read one sector
 
vsf_err_t vsf_flash_read_multi_sector (vsf_flash_t *flash_ptr, uint_fast32_t offset, uint8_t *buffer, uint_fast32_t size)
 flash read multi sector
 

Macro Definition Documentation

◆ VSF_FLASH_CFG_FUNCTION_RENAME

#define VSF_FLASH_CFG_FUNCTION_RENAME   DISABLED

Function Documentation

◆ vsf_flash_init()

vsf_err_t vsf_flash_init ( vsf_flash_t flash_ptr,
vsf_flash_cfg_t cfg_ptr 
)

Initialize a FLASH instance.

Parameters
[in]flash_ptra pointer to structure vsf_flash_t
[in]cfg_ptra pointer to configuration structure vsf_flash_cfg_t
Returns
vsf_err_t: VSF_ERR_NONE if initialization successful, otherwise returns error code
Note
It is not necessary to call vsf_flash_fini() to deinitialization.
vsf_flash_init() should be called before any other FLASH API except vsf_flash_capability().

◆ vsf_flash_fini()

void vsf_flash_fini ( vsf_flash_t flash_ptr)

Finalize a FLASH instance.

Parameters
[in]flash_ptra pointer to structure vsf_flash_t
Returns
none

◆ vsf_flash_enable()

fsm_rt_t vsf_flash_enable ( vsf_flash_t flash_ptr)

Enable a FLASH instance.

Parameters
[in]flash_ptra pointer to structure vsf_flash_t
Returns
fsm_rt_t: fsm_rt_cpl if FLASH was enabled, fsm_rt_on_going if FLASH is still enabling

◆ vsf_flash_disable()

fsm_rt_t vsf_flash_disable ( vsf_flash_t flash_ptr)

Disable a FLASH instance.

Parameters
[in]flash_ptra pointer to structure vsf_flash_t
Returns
fsm_rt_t: fsm_rt_cpl if FLASH was disabled, fsm_rt_on_going if FLASH is still disabling

◆ vsf_flash_irq_enable()

void vsf_flash_irq_enable ( vsf_flash_t flash_ptr,
vsf_flash_irq_mask_t  irq_mask 
)

Enable interrupt masks of FLASH instance.

Parameters
[in]flash_ptra pointer to structure vsf_flash_t
[in]irq_maskone or more value of enum vsf_flash_irq_mask_t
Returns
none
Note
All pending interrupts should be cleared before interrupts are enabled.

◆ vsf_flash_irq_disable()

void vsf_flash_irq_disable ( vsf_flash_t flash_ptr,
vsf_flash_irq_mask_t  irq_mask 
)

Disable interrupt masks of FLASH instance.

Parameters
[in]flash_ptra pointer to structure vsf_flash_t
[in]irq_maskone or more value of enum vsf_flash_irq_mask_t, vsf_flash_irq_mask_t
Returns
none

◆ vsf_flash_status()

vsf_flash_status_t vsf_flash_status ( vsf_flash_t flash_ptr)

Get the status of FLASH instance.

Parameters
[in]flash_ptra pointer to structure vsf_flash_t
Returns
vsf_flash_status_t: All status of current FLASH vsf_flash_status_t

◆ vsf_flash_capability()

vsf_flash_capability_t vsf_flash_capability ( vsf_flash_t flash_ptr)

Get the capabilities of FLASH instance.

Parameters
[in]flash_ptra pointer to structure vsf_flash_t
Returns
vsf_flash_capability_t: All capabilities of current FLASH vsf_flash_capability_t

◆ vsf_flash_erase_one_sector()

vsf_err_t vsf_flash_erase_one_sector ( vsf_flash_t flash_ptr,
vsf_flash_size_t  offset_of_bytes 
)

FLASH erase one sector.

Parameters
[in]flash_ptra pointer to structure vsf_flash_t
[in]offset_of_bytesThe address of the sector to be erased, needs to be an integer multiple of the smallest erasable sector size
Returns
vsf_err_t: VSF_ERR_NONE if FLASH starts to perform the erase, otherwise returns error code

◆ vsf_flash_erase_multi_sector()

vsf_err_t vsf_flash_erase_multi_sector ( vsf_flash_t flash_ptr,
vsf_flash_size_t  offset_of_bytes,
vsf_flash_size_t  size_of_bytes 
)

Flash erase a continuous range.

Parameters
[in]flash_ptra pointer to structure vsf_flash_t
[in]offset_of_bytesThe address of the sector to be erased, needs to be an integer multiple of the smallest erasable sector size
[in]size_of_bytesSize in bytes to erase, needs to be an integer multiple of the smallest erasable sector size
Returns
vsf_err_t: VSF_ERR_NONE if flash starts to perform the erase, or a negative error code

◆ vsf_flash_erase_all()

vsf_err_t vsf_flash_erase_all ( vsf_flash_t flash_ptr)

Flash chip erase.

Parameters
[in]flash_ptra pointer to structure vsf_flash_t
Returns
vsf_err_t: VSF_ERR_NONE if flash starts to perform the chip erase, or a negative error code

◆ vsf_flash_write_one_sector()

vsf_err_t vsf_flash_write_one_sector ( vsf_flash_t flash_ptr,
vsf_flash_size_t  offset_of_bytes,
uint8_t buffer,
vsf_flash_size_t  size_of_bytes 
)

Flash write one sector.

Parameters
[in]flash_ptra pointer to structure vsf_flash_t
[in]offset_of_bytesAddress of the sector to be written, some flash requires an integer multiple of the smallest writable sector size
[in]buffera pointer to data
[in]size_of_bytesa pointer to data
Returns
vsf_err_t: VSF_ERR_NONE if flash starts to perform the write, or a negative error code

◆ vsf_flash_write_multi_sector()

vsf_err_t vsf_flash_write_multi_sector ( vsf_flash_t flash_ptr,
vsf_flash_size_t  offset_of_bytes,
uint8_t buffer,
vsf_flash_size_t  size_of_bytes 
)

Flash write multi sector.

Parameters
[in]flash_ptra pointer to structure vsf_flash_t
[in]offset_of_bytesAddress of the sector to be written, some flash requires an integer multiple of the smallest writable sector size
[in]buffera pointer to data
[in]size_of_bytessize of data to write
Returns
vsf_err_t: VSF_ERR_NONE if flash starts to perform the write, or a negative error code

◆ vsf_flash_read_one_sector()

vsf_err_t vsf_flash_read_one_sector ( vsf_flash_t flash_ptr,
vsf_flash_size_t  offset_of_bytes,
uint8_t buffer,
vsf_flash_size_t  size_of_bytes 
)

flash read one sector

Parameters
[in]flash_ptra pointer to structure vsf_flash_t
[in]offset_of_bytesAddress of the sector to be written, some flash requires an integer multiple of the smallest writable sector size
[in]buffera pointer to data
[in]size_of_bytesa pointer to data
Returns
vsf_err_t: VSF_ERR_NONE if flash starts to perform the chip erase, or a negative error code

◆ vsf_flash_read_multi_sector()

vsf_err_t vsf_flash_read_multi_sector ( vsf_flash_t flash_ptr,
vsf_flash_size_t  offset_of_bytes,
uint8_t buffer,
vsf_flash_size_t  size_of_bytes 
)

flash read multi sector

Parameters
[in]flash_ptra pointer to structure vsf_flash_t
[in]offset_of_bytesAddress of the sector to be written, some flash requires an integer multiple of the smallest writable sector size
[in]buffera pointer to data
[in]size_of_bytesa pointer to data
Returns
vsf_err_t: VSF_ERR_NONE if flash starts to perform the chip erase, or a negative error code
Generated from commit: vsfteam/vsf@2b286be