#include <stdbool.h>
#include <stdint.h>
#include "../inc/hw_types.h"
#include "../inc/hw_flash.h"
#include "../inc/hw_memmap.h"
#include "../inc/hw_ints.h"
#include "../inc/hw_aon_pmctl.h"
#include "../inc/hw_fcfg1.h"
#include "interrupt.h"
#include "debug.h"
Macros | |
#define | FAPI_STATUS_SUCCESS 0x00000000 |
#define | FAPI_STATUS_FSM_BUSY 0x00000001 |
#define | FAPI_STATUS_FSM_READY 0x00000002 |
#define | FAPI_STATUS_INCORRECT_DATABUFFER_LENGTH 0x00000003 |
#define | FAPI_STATUS_FSM_ERROR 0x00000004 |
#define | FLASH_INT_FSM_DONE 0x00400000 |
#define | FLASH_INT_RV 0x00010000 |
#define | FLASH_PWR_ACTIVE_MODE 0x00000000 |
#define | FLASH_PWR_OFF_MODE 0x00000001 |
#define | FLASH_PWR_DEEP_STDBY_MODE 0x00000002 |
#define | FLASH_NO_PROTECT 0x00000000 |
#define | FLASH_WRITE_PROTECT 0x00000001 |
#define | ADDR_OFFSET (0x1F800000 - FLASHMEM_BASE) |
#define | FCFG1_OFFSET 0x1000 |
#define | FLASH_MODULE_CLK_FREQ 48 |
#define | FSM_REG_WRT_ENABLE 5 |
#define | FSM_REG_WRT_DISABLE 2 |
#define | FBFALLBACK_SLEEP 0 |
#define | FBFALLBACK_DEEP_STDBY 1 |
#define | FBFALLBACK_ACTIVE 3 |
#define | FLASH_BAGP 0x14 |
#define | FLASH_PAGP 0x14 |
#define | PATTERN_BITS 0x20 |
#define | FW_WRT_TRIMMED 0x00000001 |
#define | FW_PWRMODE_DEPRECATED 0x00000002 |
#define | FWPWRITE_BYTE_ADDRESS ((tFwpWriteByte *)((FLASH_BASE + FLASH_O_FWPWRITE0))) |
#define | DUMPWORD_INSTR 0x04 |
#define | FLASH_CMD_EXEC 0x15 |
Typedefs | |
typedef volatile uint8_t | tFwpWriteByte |
Enumerations | |
enum | tFlashStateCommandsType { FAPI_PROGRAM_DATA = 0x0002, FAPI_ERASE_SECTOR = 0x0006, FAPI_ERASE_BANK = 0x0008, FAPI_VALIDATE_SECTOR = 0x000E, FAPI_CLEAR_STATUS = 0x0010, FAPI_PROGRAM_RESUME = 0x0014, FAPI_ERASE_RESUME = 0x0016, FAPI_CLEAR_MORE = 0x0018, FAPI_PROGRAM_SECTOR = 0x0020, FAPI_ERASE_OTP = 0x0030 } |
Defined values for Flash State Machine commands. More... | |
Functions | |
static uint32_t | FlashSectorSizeGet (void) |
Get size of a flash sector in number of bytes. More... | |
static uint32_t | FlashSizeGet (void) |
Get the size of the flash. More... | |
void | FlashPowerModeSet (uint32_t ui32PowerMode, uint32_t ui32BankGracePeriod, uint32_t ui32PumpGracePeriod) |
Set power mode. More... | |
uint32_t | FlashPowerModeGet (void) |
Get current configured power mode. More... | |
void | FlashProtectionSet (uint32_t ui32SectorAddress, uint32_t ui32ProtectMode) |
Set sector protection. More... | |
uint32_t | FlashProtectionGet (uint32_t ui32SectorAddress) |
Get sector protection. More... | |
uint32_t | FlashProtectionSave (uint32_t ui32SectorAddress) |
Save sector protection to make it permanent. More... | |
static uint32_t | FlashCheckFsmForError (void) |
Checks if the Flash state machine has detected an error. More... | |
static uint32_t | FlashCheckFsmForReady (void) |
Checks if the Flash state machine is ready. More... | |
static void | FlashIntRegister (void(*pfnHandler)(void)) |
Registers an interrupt handler for the flash interrupt in the dynamic interrupt table. More... | |
static void | FlashIntUnregister (void) |
Unregisters the interrupt handler for the flash interrupt in the dynamic interrupt table. More... | |
static void | FlashIntEnable (uint32_t ui32IntFlags) |
Enables flash controller interrupt sources. More... | |
static void | FlashIntDisable (uint32_t ui32IntFlags) |
Disables individual flash controller interrupt sources. More... | |
static uint32_t | FlashIntStatus (void) |
Gets the current interrupt status. More... | |
static void | FlashIntClear (uint32_t ui32IntFlags) |
Clears flash controller interrupt source. More... | |
uint32_t | FlashSectorErase (uint32_t ui32SectorAddress) |
Erase a flash sector. More... | |
uint32_t | FlashProgram (uint8_t *pui8DataBuffer, uint32_t ui32Address, uint32_t ui32Count) |
Programs unprotected flash sectors in the main bank. More... | |
bool | FlashEfuseReadRow (uint32_t *pui32EfuseData, uint32_t ui32RowAddress) |
Reads efuse data from specified row. More... | |
void | FlashDisableSectorsForWrite (void) |
Disables all sectors for erase and programming on the active bank. More... | |