#include "chip.h"
#include <string.h>
#include <assert.h>
Go to the source code of this file.
Defines |
#define | GPNVM_NUM_MAX 9 |
Functions |
void | FLASHD_Initialize (uint32_t dwMCk, uint32_t dwUseIAP) |
| Initializes the flash driver.
|
uint32_t | FLASHD_Erase (uint32_t dwAddress) |
| Erases the entire flash.
|
uint32_t | FLASHD_EraseSector (uint32_t dwAddress) |
| Erases flash by sector.
|
uint32_t | FLASHD_ErasePages (uint32_t dwAddress, uint32_t dwPageNum) |
| Erases flash by pages.
|
uint32_t | FLASHD_Write (uint32_t dwAddress, const void *pvBuffer, uint32_t dwSize) |
| Writes a data buffer in the internal flash.
|
uint32_t | FLASHD_Lock (uint32_t start, uint32_t end, uint32_t *pActualStart, uint32_t *pActualEnd) |
| Locks all the regions in the given address range. The actual lock range is reported through two output parameters.
|
uint32_t | FLASHD_Unlock (uint32_t start, uint32_t end, uint32_t *pActualStart, uint32_t *pActualEnd) |
| Unlocks all the regions in the given address range. The actual unlock range is reported through two output parameters.
|
uint32_t | FLASHD_IsLocked (uint32_t start, uint32_t end) |
| Returns the number of locked regions inside the given address range.
|
uint32_t | FLASHD_IsGPNVMSet (uint8_t ucGPNVM) |
| Check if the given GPNVM bit is set or not.
|
uint32_t | FLASHD_SetGPNVM (uint8_t ucGPNVM) |
| Sets the selected GPNVM bit.
|
uint32_t | FLASHD_ClearGPNVM (uint8_t ucGPNVM) |
| Clears the selected GPNVM bit.
|
| __attribute__ ((section(".ramfunc"))) |
| Read the unique ID.
|
Detailed Description
The flash driver provides the unified interface for flash program operations.
Definition in file flashd.c.
Function Documentation
Read the unique ID.
- Parameters:
-
| pdwUniqueID | pointer on a 4bytes char containing the unique ID value. |
- Returns:
- 0 if successful; otherwise returns an error code.
Definition at line 550 of file flashd.c.
uint32_t FLASHD_ClearGPNVM |
( |
uint8_t |
ucGPNVM |
) |
|
Clears the selected GPNVM bit.
- Parameters:
-
- Returns:
- 0 if successful; otherwise returns an error code.
Definition at line 531 of file flashd.c.
uint32_t FLASHD_Erase |
( |
uint32_t |
dwAddress |
) |
|
Erases the entire flash.
- Parameters:
-
| dwAddress | Flash start address. |
- Returns:
- 0 if successful; otherwise returns an error code.
Definition at line 173 of file flashd.c.
uint32_t FLASHD_ErasePages |
( |
uint32_t |
dwAddress, |
|
|
uint32_t |
dwPageNum | |
|
) |
| | |
Erases flash by pages.
- Parameters:
-
| dwAddress | Start address of be erased pages. |
| dwPageNum | Number of pages to be erased with EPA command (4, 8, 16, 32) |
- Returns:
- 0 if successful; otherwise returns an error code.
Definition at line 222 of file flashd.c.
uint32_t FLASHD_EraseSector |
( |
uint32_t |
dwAddress |
) |
|
Erases flash by sector.
- Parameters:
-
| dwAddress | Start address of be erased sector. |
- Returns:
- 0 if successful; otherwise returns an error code.
Definition at line 197 of file flashd.c.
void FLASHD_Initialize |
( |
uint32_t |
dwMCk, |
|
|
uint32_t |
dwUseIAP | |
|
) |
| | |
Initializes the flash driver.
- Parameters:
-
| dwMCk | Master clock frequency in Hz. |
| dwUseIAP | 0: use EEFC controller interface, 1: use IAP interface. dwUseIAP should be set to 1 when running out of flash. |
Definition at line 159 of file flashd.c.
uint32_t FLASHD_IsGPNVMSet |
( |
uint8_t |
ucGPNVM |
) |
|
Check if the given GPNVM bit is set or not.
- Parameters:
-
- Returns:
- 1 if the given GPNVM bit is currently set; otherwise returns 0.
Definition at line 492 of file flashd.c.
uint32_t FLASHD_IsLocked |
( |
uint32_t |
start, |
|
|
uint32_t |
end | |
|
) |
| | |
Returns the number of locked regions inside the given address range.
- Parameters:
-
| start | Start address of range |
| end | End address of range. |
Definition at line 441 of file flashd.c.
uint32_t FLASHD_Lock |
( |
uint32_t |
start, |
|
|
uint32_t |
end, |
|
|
uint32_t * |
pActualStart, |
|
|
uint32_t * |
pActualEnd | |
|
) |
| | |
Locks all the regions in the given address range. The actual lock range is reported through two output parameters.
- Parameters:
-
| start | Start address of lock range. |
| end | End address of lock range. |
| pActualStart | Start address of the actual lock range (optional). |
| pActualEnd | End address of the actual lock range (optional). |
- Returns:
- 0 if successful, otherwise returns an error code.
Definition at line 356 of file flashd.c.
uint32_t FLASHD_SetGPNVM |
( |
uint8_t |
ucGPNVM |
) |
|
Sets the selected GPNVM bit.
- Parameters:
-
- Returns:
- 0 if successful; otherwise returns an error code.
Definition at line 515 of file flashd.c.
uint32_t FLASHD_Unlock |
( |
uint32_t |
start, |
|
|
uint32_t |
end, |
|
|
uint32_t * |
pActualStart, |
|
|
uint32_t * |
pActualEnd | |
|
) |
| | |
Unlocks all the regions in the given address range. The actual unlock range is reported through two output parameters.
- Parameters:
-
| start | Start address of unlock range. |
| end | End address of unlock range. |
| pActualStart | Start address of the actual unlock range (optional). |
| pActualEnd | End address of the actual unlock range (optional). |
- Returns:
- 0 if successful, otherwise returns an error code.
Definition at line 400 of file flashd.c.
uint32_t FLASHD_Write |
( |
uint32_t |
dwAddress, |
|
|
const void * |
pvBuffer, |
|
|
uint32_t |
dwSize | |
|
) |
| | |
Writes a data buffer in the internal flash.
- Note:
- This function works in polling mode, and thus only returns when the data has been effectively written.
- Parameters:
-
| address | Write address. |
| pBuffer | Data buffer. |
| size | Size of data buffer in bytes. |
- Returns:
- 0 if successful, otherwise returns an error code.
Definition at line 274 of file flashd.c.