Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Embed: (wiki syntax)

« Back to documentation index

Flash HAL API

Flash HAL API
[Hal]

Functions

int32_t flash_init (flash_t *obj)
 Initialize the flash peripheral and the flash_t object.
int32_t flash_free (flash_t *obj)
 Uninitialize the flash peripheral and the flash_t object.
int32_t flash_erase_sector (flash_t *obj, uint32_t address)
 Erase one sector starting at defined address.
int32_t flash_program_page (flash_t *obj, uint32_t address, const uint8_t *data, uint32_t size)
 Program one page starting at defined address.
uint32_t flash_get_sector_size (const flash_t *obj, uint32_t address)
 Get sector size.
uint32_t flash_get_page_size (const flash_t *obj)
 Get page size.
uint32_t flash_get_start_address (const flash_t *obj)
 Get start address for the flash region.
uint32_t flash_get_size (const flash_t *obj)
 Get the flash region size.

Function Documentation

int32_t flash_erase_sector ( flash_t *  obj,
uint32_t  address 
)

Erase one sector starting at defined address.

The address should be at sector boundary. This function does not do any check for address alignments

Parameters:
objThe flash object
addressThe sector starting address
Returns:
0 for success, -1 for error
int32_t flash_free ( flash_t *  obj )

Uninitialize the flash peripheral and the flash_t object.

Parameters:
objThe flash object
Returns:
0 for success, -1 for error
uint32_t flash_get_page_size ( const flash_t *  obj )

Get page size.

Parameters:
objThe flash object
addressThe page starting address
Returns:
The size of a page
uint32_t flash_get_sector_size ( const flash_t *  obj,
uint32_t  address 
)

Get sector size.

Parameters:
objThe flash object
addressThe sector starting address
Returns:
The size of a sector
uint32_t flash_get_size ( const flash_t *  obj )

Get the flash region size.

Parameters:
objThe flash object
Returns:
The flash region size
uint32_t flash_get_start_address ( const flash_t *  obj )

Get start address for the flash region.

Parameters:
objThe flash object
Returns:
The start address for the flash region
int32_t flash_init ( flash_t *  obj )

Initialize the flash peripheral and the flash_t object.

Parameters:
objThe flash object
Returns:
0 for success, -1 for error
int32_t flash_program_page ( flash_t *  obj,
uint32_t  address,
const uint8_t *  data,
uint32_t  size 
)

Program one page starting at defined address.

The page should be at page boundary, should not cross multiple sectors. This function does not do any check for address alignments or if size is aligned to a page size.

Parameters:
objThe flash object
addressThe sector starting address
dataThe data buffer to be programmed
sizeThe number of bytes to program
Returns:
0 for success, -1 for error