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
248 __STATIC_INLINE uint32_t
251 uint32_t ui32SectorSizeInKbyte;
260 return(ui32SectorSizeInKbyte * 1024);
272 __STATIC_INLINE uint32_t
275 uint32_t ui32NoOfSectors;
332 uint32_t ui32BankGracePeriode,
333 uint32_t ui32PumpGracePeriode);
370 uint32_t ui32ProtectMode);
425 __STATIC_INLINE uint32_t
455 __STATIC_INLINE uint32_t
583 __STATIC_INLINE uint32_t
586 uint32_t ui32IntFlags;
606 return(ui32IntFlags);
643 uint32_t ui32TempVal;
723 uint32_t ui32Address, uint32_t ui32Count);
742 uint32_t ui32RowAddress);
768 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
770 #ifdef ROM_FlashPowerModeSet
771 #undef FlashPowerModeSet
772 #define FlashPowerModeSet ROM_FlashPowerModeSet
774 #ifdef ROM_FlashPowerModeGet
775 #undef FlashPowerModeGet
776 #define FlashPowerModeGet ROM_FlashPowerModeGet
778 #ifdef ROM_FlashProtectionSet
779 #undef FlashProtectionSet
780 #define FlashProtectionSet ROM_FlashProtectionSet
782 #ifdef ROM_FlashProtectionGet
783 #undef FlashProtectionGet
784 #define FlashProtectionGet ROM_FlashProtectionGet
786 #ifdef ROM_FlashProtectionSave
787 #undef FlashProtectionSave
788 #define FlashProtectionSave ROM_FlashProtectionSave
790 #ifdef ROM_FlashSectorErase
791 #undef FlashSectorErase
792 #define FlashSectorErase ROM_FlashSectorErase
794 #ifdef ROM_FlashProgram
796 #define FlashProgram ROM_FlashProgram
798 #ifdef ROM_FlashEfuseReadRow
799 #undef FlashEfuseReadRow
800 #define FlashEfuseReadRow ROM_FlashEfuseReadRow
802 #ifdef ROM_FlashDisableSectorsForWrite
803 #undef FlashDisableSectorsForWrite
804 #define FlashDisableSectorsForWrite ROM_FlashDisableSectorsForWrite
817 #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.