mirror of https://github.com/ARMmbed/mbed-os.git
STM32F0: Remove flash functions doc
parent
a47f9b3480
commit
ca24ee4cd7
|
@ -28,29 +28,9 @@
|
||||||
// Minimum number of bytes to be programmed at a time
|
// Minimum number of bytes to be programmed at a time
|
||||||
#define MIN_PROG_SIZE (4U)
|
#define MIN_PROG_SIZE (4U)
|
||||||
|
|
||||||
/** Initialize the flash peripheral and the flash_t object
|
|
||||||
*
|
|
||||||
* @param obj The flash object
|
|
||||||
* @return 0 for success, -1 for error
|
|
||||||
*/
|
|
||||||
int32_t flash_init(flash_t *obj)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Uninitialize the flash peripheral and the flash_t object
|
|
||||||
*
|
|
||||||
* @param obj The flash object
|
|
||||||
* @return 0 for success, -1 for error
|
|
||||||
*/
|
|
||||||
int32_t flash_free(flash_t *obj)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t flash_unlock(void)
|
static int32_t flash_unlock(void)
|
||||||
{
|
{
|
||||||
/* Allow Access to Flash control registers and user Falsh */
|
/* Allow Access to Flash control registers and user Flash */
|
||||||
if (HAL_FLASH_Unlock()) {
|
if (HAL_FLASH_Unlock()) {
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -69,13 +49,16 @@ static int32_t flash_lock(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Erase one sector starting at defined address
|
int32_t flash_init(flash_t *obj)
|
||||||
*
|
{
|
||||||
* The address should be at sector boundary. This function does not do any check for address alignments
|
return 0;
|
||||||
* @param obj The flash object
|
}
|
||||||
* @param address The sector starting address
|
|
||||||
* @return 0 for success, -1 for error
|
int32_t flash_free(flash_t *obj)
|
||||||
*/
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t flash_erase_sector(flash_t *obj, uint32_t address)
|
int32_t flash_erase_sector(flash_t *obj, uint32_t address)
|
||||||
{
|
{
|
||||||
uint32_t PAGEError = 0;
|
uint32_t PAGEError = 0;
|
||||||
|
@ -113,19 +96,7 @@ int32_t flash_erase_sector(flash_t *obj, uint32_t address)
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Program one page starting at defined address
|
int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data, uint32_t size)
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
* @param obj The flash object
|
|
||||||
* @param address The sector starting address
|
|
||||||
* @param data The data buffer to be programmed
|
|
||||||
* @param size The number of bytes to program
|
|
||||||
* @return 0 for success, -1 for error
|
|
||||||
*/
|
|
||||||
int32_t flash_program_page(flash_t *obj, uint32_t address,
|
|
||||||
const uint8_t *data, uint32_t size)
|
|
||||||
{
|
{
|
||||||
uint32_t StartAddress = 0;
|
uint32_t StartAddress = 0;
|
||||||
int32_t status = 0;
|
int32_t status = 0;
|
||||||
|
@ -177,12 +148,6 @@ int32_t flash_program_page(flash_t *obj, uint32_t address,
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get sector size
|
|
||||||
*
|
|
||||||
* @param obj The flash object
|
|
||||||
* @param address The sector starting address
|
|
||||||
* @return The size of a sector (in our case considering 1 sector = 1 page)
|
|
||||||
*/
|
|
||||||
uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
|
uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
|
||||||
{
|
{
|
||||||
if (!(IS_FLASH_PROGRAM_ADDRESS(address))) {
|
if (!(IS_FLASH_PROGRAM_ADDRESS(address))) {
|
||||||
|
@ -192,32 +157,16 @@ uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get page size
|
|
||||||
*
|
|
||||||
* @param obj The flash object
|
|
||||||
* @param address The page starting address
|
|
||||||
* @return The size of a page (in our case the minimum programmable size)
|
|
||||||
*/
|
|
||||||
uint32_t flash_get_page_size(const flash_t *obj)
|
uint32_t flash_get_page_size(const flash_t *obj)
|
||||||
{
|
{
|
||||||
return MIN_PROG_SIZE;
|
return MIN_PROG_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get start address for the flash region
|
|
||||||
*
|
|
||||||
* @param obj The flash object
|
|
||||||
* @return The start address for the flash region
|
|
||||||
*/
|
|
||||||
uint32_t flash_get_start_address(const flash_t *obj)
|
uint32_t flash_get_start_address(const flash_t *obj)
|
||||||
{
|
{
|
||||||
return FLASH_BASE;
|
return FLASH_BASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the flash region size
|
|
||||||
*
|
|
||||||
* @param obj The flash object
|
|
||||||
* @return The flash region size
|
|
||||||
*/
|
|
||||||
uint32_t flash_get_size(const flash_t *obj)
|
uint32_t flash_get_size(const flash_t *obj)
|
||||||
{
|
{
|
||||||
return FLASH_SIZE;
|
return FLASH_SIZE;
|
||||||
|
|
Loading…
Reference in New Issue