39 #include <inc/hw_types.h>
51 #undef FlashPowerModeSet
52 #define FlashPowerModeSet NOROM_FlashPowerModeSet
53 #undef FlashPowerModeGet
54 #define FlashPowerModeGet NOROM_FlashPowerModeGet
55 #undef FlashProtectionSet
56 #define FlashProtectionSet NOROM_FlashProtectionSet
57 #undef FlashProtectionGet
58 #define FlashProtectionGet NOROM_FlashProtectionGet
59 #undef FlashProtectionSave
60 #define FlashProtectionSave NOROM_FlashProtectionSave
61 #undef FlashSectorErase
62 #define FlashSectorErase NOROM_FlashSectorErase
64 #define FlashProgram NOROM_FlashProgram
65 #undef FlashEfuseReadRow
66 #define FlashEfuseReadRow NOROM_FlashEfuseReadRow
67 #undef FlashDisableSectorsForWrite
68 #define FlashDisableSectorsForWrite NOROM_FlashDisableSectorsForWrite
78 0xFF, 0xFF, 0xFF, 0xFF,
79 0xC5, 0xFF, 0xFF, 0xFF,
80 0xC5, 0xC5, 0xC5, 0xFF,
81 0xC5, 0xC5, 0xC5, 0xFF
102 uint32_t ui32PumpGracePeriode)
110 ASSERT(ui32BankGracePeriode <= 0xFF);
111 ASSERT(ui32PumpGracePeriode <= 0xFFFF);
113 switch(ui32PowerMode)
194 uint32_t ui32PowerMode;
195 uint32_t ui32BankPwrMode;
216 return(ui32PowerMode);
227 uint32_t ui32SectorNumber;
242 if(ui32SectorNumber <= 31)
247 else if(ui32SectorNumber <= 63)
250 (1 << (ui32SectorNumber & 0x1F));
252 (1 << (ui32SectorNumber & 0x1F));
267 uint32_t ui32SectorProtect;
268 uint32_t ui32SectorNumber;
280 if(ui32SectorNumber <= 31)
288 else if(ui32SectorNumber <= 63)
291 (1 << (ui32SectorNumber & 0x1F))) &&
293 (1 << (ui32SectorNumber & 0x1F))))
299 return(ui32SectorProtect);
310 uint32_t ui32ErrorReturn;
311 uint32_t ui32SectorNumber;
312 uint32_t ui32CcfgSectorAddr;
313 uint32_t ui32ProgBuf;
343 ui32ProgBuf = (~(1 << (ui32SectorNumber & 0x1F))) &
344 *(uint32_t *)ui32CcfgSectorAddr;
346 ui32ErrorReturn =
FlashProgram((uint8_t*)&ui32ProgBuf, ui32CcfgSectorAddr,
353 return(ui32ErrorReturn);
364 uint32_t ui32ErrorReturn;
378 ui32ErrorReturn = FuncPointer(ui32SectorAddress);
388 return(ui32ErrorReturn);
399 FlashProgram(uint8_t *pui8DataBuffer, uint32_t ui32Address, uint32_t ui32Count)
401 uint32_t ui32ErrorReturn;
413 ui32ErrorReturn = FuncPointer( pui8DataBuffer, ui32Address, ui32Count);
423 return(ui32ErrorReturn);
563 uint32_t ui32TrimValue;
582 ui32Value = ((ui32TrimValue &
587 ui32Value |= ((ui32TrimValue &
594 ui32Value |= ((ui32TrimValue &
618 ui32Value = ((ui32TrimValue &
650 ui32Value = ((ui32TrimValue &
655 ui32Value |= ((ui32TrimValue &
662 ui32Value |= ((ui32TrimValue &
686 ui32Value = (((ui32TrimValue &
718 uint32_t ui32ErrorReturn;
725 FuncPointer = (uint32_t (*)(uint8_t *, uint32_t, uint32_t)) (ui32RomAddr);
726 ui32ErrorReturn = FuncPointer( pui8DataBuffer, ui32Address, ui32Count);
736 return(ui32ErrorReturn);
747 uint32_t ui32ErrorReturn;
755 FuncPointer = (uint32_t (*)(uint32_t)) (ui32RomAddr);
756 ui32ErrorReturn = FuncPointer(ui32Address);
766 return(ui32ErrorReturn);
#define FLASH_PWR_OFF_MODE
static uint32_t FlashSectorSizeGet(void)
Get size of a flash sector in number of bytes.
#define CCFG_SIZE_SECT_PROT
#define FBFALLBACK_DEEP_STDBY
uint32_t FlashProtectionGet(uint32_t ui32SectorAddress)
Get sector protection.
void FlashPowerModeSet(uint32_t ui32PowerMode, uint32_t ui32BankGracePeriode, uint32_t ui32PumpGracePeriode)
Set power mode.
void FlashDisableSectorsForWrite(void)
Disables all sectors for erase and programming on the active bank.
uint32_t(* FlashSectorErasePointer_t)(uint32_t)
#define FSM_REG_WRT_DISABLE
uint32_t FlashPowerModeGet(void)
Get current configured power mode.
#define FAPI_STATUS_SUCCESS
uint32_t MemBusWrkAroundHapiEraseSector(uint32_t ui32Address)
uint32_t FlashSectorErase(uint32_t ui32SectorAddress)
Erase a flash sector.
static uint32_t FlashSizeGet(void)
Get the size of the flash.
#define FSM_REG_WRT_ENABLE
#define FBFALLBACK_ACTIVE
bool FlashEfuseReadRow(uint32_t *pui32EfuseData, uint32_t ui32RowAddress)
Reads efuse data from specified row.
static void SetReadMode(void)
uint32_t MemBusWrkAroundHapiProgramFlash(uint8_t *pui8DataBuffer, uint32_t ui32Address, uint32_t ui32Count)
#define ROM_HAPI_TABLE_ADDR
uint32_t FlashProtectionSave(uint32_t ui32SectorAddress)
Save sector protection to make it permanent.
#define FLASH_PWR_ACTIVE_MODE
#define FLASH_WRITE_PROTECT
#define CCFG_OFFSET_SECT_PROT
void FlashProtectionSet(uint32_t ui32SectorAddress, uint32_t ui32ProtectMode)
Set sector protection.
#define FLASH_PWR_DEEP_STDBY_MODE
uint32_t(* FlashPrgPointer_t)(uint8_t *, uint32_t, uint32_t)
#define ROM_API_FLASH_TABLE
uint32_t FlashProgram(uint8_t *pui8DataBuffer, uint32_t ui32Address, uint32_t ui32Count)
Programs unprotected main bank flash sectors.
const uint8_t g_pui8CcfgDefaultSec[]