64 #include <inc/hw_types.h>
65 #include <inc/hw_flash.h>
66 #include <inc/hw_memmap.h>
67 #include <inc/hw_ints.h>
68 #include <inc/hw_aon_sysctl.h>
69 #include <inc/hw_fcfg1.h>
87 #define FlashPowerModeSet NOROM_FlashPowerModeSet
88 #define FlashPowerModeGet NOROM_FlashPowerModeGet
89 #define FlashProtectionSet NOROM_FlashProtectionSet
90 #define FlashProtectionGet NOROM_FlashProtectionGet
91 #define FlashProtectionSave NOROM_FlashProtectionSave
92 #define FlashSectorErase NOROM_FlashSectorErase
93 #define FlashProgram NOROM_FlashProgram
94 #define FlashEfuseReadRow NOROM_FlashEfuseReadRow
95 #define FlashDisableSectorsForWrite NOROM_FlashDisableSectorsForWrite
103 #define FAPI_STATUS_SUCCESS 0x00000000 // Function completed successfully
104 #define FAPI_STATUS_FSM_BUSY 0x00000001 // FSM is Busy
105 #define FAPI_STATUS_FSM_READY 0x00000002 // FSM is Ready
106 #define FAPI_STATUS_INCORRECT_DATABUFFER_LENGTH \
107 0x00000003 // Incorrect parameter value
108 #define FAPI_STATUS_FSM_ERROR 0x00000004 // Operation failed
116 #define FLASH_INT_FSM_DONE 0x00400000 // FSM Done Interrupt Mask
117 #define FLASH_INT_RV 0x00010000 // Read Verify error Interrupt Mask
124 #define FLASH_PWR_ACTIVE_MODE 0x00000000
125 #define FLASH_PWR_OFF_MODE 0x00000001
126 #define FLASH_PWR_DEEP_STDBY_MODE \
134 #define FLASH_NO_PROTECT 0x00000000 // Sector not protected
135 #define FLASH_WRITE_PROTECT 0x00000001 // Sector erase and program
150 #define FCFG1_OFFSET 0x1000
157 #define FLASH_MODULE_CLK_FREQ 48
183 #define FSM_REG_WRT_ENABLE 5
184 #define FSM_REG_WRT_DISABLE 2
191 #define FBFALLBACK_SLEEP 0
192 #define FBFALLBACK_DEEP_STDBY 1
193 #define FBFALLBACK_ACTIVE 3
200 #define FLASH_BAGP 0x14
201 #define FLASH_PAGP 0x14
208 #define PATTERN_BITS 0x20 // No of bits in data pattern to program
215 #define FW_WRT_TRIMMED 0x00000001
230 #define DUMPWORD_INSTR 0x04
237 #define FLASH_CMD_EXEC 0x15
244 #define CCFG_OFFSET_SECURITY 0x00000FD8
245 #define CCFG_OFFSET_SECT_PROT 0x00000FF0
246 #define CCFG_SIZE_SECURITY 0x00000014
247 #define CCFG_SIZE_SECT_PROT 0x00000004
258 __STATIC_INLINE uint32_t
261 uint32_t ui32SectorSizeInKbyte;
270 return(ui32SectorSizeInKbyte * 1024);
282 __STATIC_INLINE uint32_t
285 uint32_t ui32NoOfSectors;
342 uint32_t ui32BankGracePeriode,
343 uint32_t ui32PumpGracePeriode);
380 uint32_t ui32ProtectMode);
435 __STATIC_INLINE uint32_t
465 __STATIC_INLINE uint32_t
593 __STATIC_INLINE uint32_t
596 uint32_t ui32IntFlags;
616 return(ui32IntFlags);
653 uint32_t ui32TempVal;
733 uint32_t ui32Address, uint32_t ui32Count);
752 uint32_t ui32RowAddress);
778 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
780 #ifdef ROM_FlashPowerModeSet
781 #undef FlashPowerModeSet
782 #define FlashPowerModeSet ROM_FlashPowerModeSet
784 #ifdef ROM_FlashPowerModeGet
785 #undef FlashPowerModeGet
786 #define FlashPowerModeGet ROM_FlashPowerModeGet
788 #ifdef ROM_FlashProtectionSet
789 #undef FlashProtectionSet
790 #define FlashProtectionSet ROM_FlashProtectionSet
792 #ifdef ROM_FlashProtectionGet
793 #undef FlashProtectionGet
794 #define FlashProtectionGet ROM_FlashProtectionGet
796 #ifdef ROM_FlashProtectionSave
797 #undef FlashProtectionSave
798 #define FlashProtectionSave ROM_FlashProtectionSave
800 #ifdef ROM_FlashSectorErase
801 #undef FlashSectorErase
802 #define FlashSectorErase ROM_FlashSectorErase
804 #ifdef ROM_FlashProgram
806 #define FlashProgram ROM_FlashProgram
808 #ifdef ROM_FlashEfuseReadRow
809 #undef FlashEfuseReadRow
810 #define FlashEfuseReadRow ROM_FlashEfuseReadRow
812 #ifdef ROM_FlashDisableSectorsForWrite
813 #undef FlashDisableSectorsForWrite
814 #define FlashDisableSectorsForWrite ROM_FlashDisableSectorsForWrite
827 #endif // __FLASH_H__
static uint32_t FlashSectorSizeGet(void)
Get size of a flash sector in number of bytes.
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.
static void FlashIntClear(uint32_t ui32IntFlags)
Clears flash controller interrupt source.
static uint32_t FlashCheckFsmForReady(void)
Checks if the Flash state machine is ready.
static uint32_t FlashIntStatus(void)
Gets the current interrupt status.
static void FlashIntUnregister(void)
Unregisters the interrupt handler for the flash interrupt.
#define FLASH_INT_FSM_DONE
#define FSM_REG_WRT_DISABLE
uint32_t FlashPowerModeGet(void)
Get current configured power mode.
#define FAPI_STATUS_SUCCESS
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 FAPI_STATUS_FSM_ERROR
#define FAPI_STATUS_FSM_READY
bool FlashEfuseReadRow(uint32_t *pui32EfuseData, uint32_t ui32RowAddress)
Reads efuse data from specified row.
tFlashStateCommandsType
Defined values for Flash State Machine commands.
void IntUnregister(uint32_t ui32Interrupt)
Unregisters the function to be called when an interrupt occurs.
uint32_t FlashProtectionSave(uint32_t ui32SectorAddress)
Save sector protection to make it permanent.
static void FlashIntEnable(uint32_t ui32IntFlags)
Enables flash controller interrupt sources.
void FlashProtectionSet(uint32_t ui32SectorAddress, uint32_t ui32ProtectMode)
Set sector protection.
static uint32_t FlashCheckFsmForError(void)
Checks if the Flash state machine has detected an error.
volatile uint8_t tFwpWriteByte
#define FAPI_STATUS_FSM_BUSY
static void FlashIntDisable(uint32_t ui32IntFlags)
Disables individual flash controller interrupt sources.
uint32_t FlashProgram(uint8_t *pui8DataBuffer, uint32_t ui32Address, uint32_t ui32Count)
Programs unprotected main bank flash sectors.
static void FlashIntRegister(void(*pfnHandler)(void))
Registers an interrupt handler for the flash interrupt.
void IntDisable(uint32_t ui32Interrupt)
Disables an interrupt.
void IntRegister(uint32_t ui32Interrupt, void(*pfnHandler)(void))
Registers a function to be called when an interrupt occurs.
void IntEnable(uint32_t ui32Interrupt)
Enables an interrupt.