62 #include <inc/hw_types.h>
63 #include <inc/hw_flash.h>
64 #include <inc/hw_memmap.h>
65 #include <inc/hw_ints.h>
66 #include <inc/hw_aon_sysctl.h>
67 #include <inc/hw_fcfg1.h>
86 #ifndef DRIVERLIB_GENERATE_ROM
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 FlashProgramNowait NOROM_FlashProgramNowait
95 #define FlashEfuseReadRow NOROM_FlashEfuseReadRow
96 #define FlashDisableSectorsForWrite NOROM_FlashDisableSectorsForWrite
104 #define FAPI_STATUS_SUCCESS 0x00000000 // Function completed successfully
105 #define FAPI_STATUS_FSM_BUSY 0x00000001 // FSM is Busy
106 #define FAPI_STATUS_FSM_READY 0x00000002 // FSM is Ready
107 #define FAPI_STATUS_INCORRECT_DATABUFFER_LENGTH \
108 0x00000003 // Incorrect parameter value
109 #define FAPI_STATUS_FSM_ERROR 0x00000004 // Operation failed
117 #define FLASH_INT_FSM_DONE 0x00400000 // FSM Done Interrupt Mask
118 #define FLASH_INT_RV 0x00010000 // Read Verify error Interrupt Mask
125 #define FLASH_PWR_ACTIVE_MODE 0x00000000
126 #define FLASH_PWR_OFF_MODE 0x00000001
127 #define FLASH_PWR_DEEP_STDBY_MODE \
135 #define FLASH_NO_PROTECT 0x00000000 // Sector not protected
136 #define FLASH_WRITE_PROTECT 0x00000001 // Sector erase and program
151 #define FCFG1_OFFSET 0x1000
158 #define FLASH_MODULE_CLK_FREQ 48
184 #define FSM_REG_WRT_ENABLE 5
185 #define FSM_REG_WRT_DISABLE 2
192 #define FBFALLBACK_SLEEP 0
193 #define FBFALLBACK_DEEP_STDBY 1
194 #define FBFALLBACK_ACTIVE 3
201 #define FLASH_BAGP 0x14
202 #define FLASH_PAGP 0x14
209 #define PATTERN_BITS 0x20 // No of bits in data pattern to program
216 #define FW_WRT_TRIMMED 0x00000001
231 #define DUMPWORD_INSTR 0x04
238 #define FLASH_CMD_EXEC 0x15
245 #define CCFG_OFFSET_SECURITY 0x00000FD8
246 #define CCFG_OFFSET_SECT_PROT 0x00000FF0
247 #define CCFG_SIZE_SECURITY 0x00000014
248 #define CCFG_SIZE_SECT_PROT 0x00000004
259 __STATIC_INLINE uint32_t
262 uint32_t ui32SectorSizeInKbyte;
271 return(ui32SectorSizeInKbyte * 1024);
283 __STATIC_INLINE uint32_t
286 uint32_t ui32NoOfSectors;
343 uint32_t ui32BankGracePeriode,
344 uint32_t ui32PumpGracePeriode);
381 uint32_t ui32ProtectMode);
436 __STATIC_INLINE uint32_t
466 __STATIC_INLINE uint32_t
594 __STATIC_INLINE uint32_t
597 uint32_t ui32IntFlags;
617 return(ui32IntFlags);
648 uint32_t ui32TempVal;
728 uint32_t ui32Address, uint32_t ui32Count);
747 uint32_t ui32RowAddress);
773 #ifndef DRIVERLIB_NOROM
775 #ifdef ROM_FlashPowerModeSet
776 #undef FlashPowerModeSet
777 #define FlashPowerModeSet ROM_FlashPowerModeSet
779 #ifdef ROM_FlashPowerModeGet
780 #undef FlashPowerModeGet
781 #define FlashPowerModeGet ROM_FlashPowerModeGet
783 #ifdef ROM_FlashProtectionSet
784 #undef FlashProtectionSet
785 #define FlashProtectionSet ROM_FlashProtectionSet
787 #ifdef ROM_FlashProtectionGet
788 #undef FlashProtectionGet
789 #define FlashProtectionGet ROM_FlashProtectionGet
791 #ifdef ROM_FlashProtectionSave
792 #undef FlashProtectionSave
793 #define FlashProtectionSave ROM_FlashProtectionSave
795 #ifdef ROM_FlashSectorErase
796 #undef FlashSectorErase
797 #define FlashSectorErase ROM_FlashSectorErase
799 #ifdef ROM_FlashProgram
801 #define FlashProgram ROM_FlashProgram
803 #ifdef ROM_FlashProgramNowait
804 #undef FlashProgramNowait
805 #define FlashProgramNowait ROM_FlashProgramNowait
807 #ifdef ROM_FlashEfuseReadRow
808 #undef FlashEfuseReadRow
809 #define FlashEfuseReadRow ROM_FlashEfuseReadRow
811 #ifdef ROM_FlashDisableSectorsForWrite
812 #undef FlashDisableSectorsForWrite
813 #define FlashDisableSectorsForWrite ROM_FlashDisableSectorsForWrite
826 #endif // __FLASH_H__
__STATIC_INLINE uint32_t FlashSectorSizeGet(void)
Get size of a flash sector in number of bytes.
__STATIC_INLINE uint32_t FlashCheckFsmForReady(void)
Checks if the Flash state machine is ready.
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_INLINE void FlashIntUnregister(void)
Unregisters the interrupt handler for the flash interrupt.
__STATIC_INLINE uint32_t FlashCheckFsmForError(void)
Checks if the Flash state machine has detected an error.
#define FLASH_INT_FSM_DONE
#define FSM_REG_WRT_DISABLE
uint32_t FlashPowerModeGet(void)
Get current configured power mode.
__STATIC_INLINE uint32_t FlashSizeGet(void)
Get the size of the flash.
#define FAPI_STATUS_SUCCESS
uint32_t FlashSectorErase(uint32_t ui32SectorAddress)
Erase a flash sector.
#define FSM_REG_WRT_ENABLE
#define FAPI_STATUS_FSM_ERROR
__STATIC_INLINE void FlashIntClear(uint32_t ui32IntFlags)
Clears flash controller interrupt source.
#define FAPI_STATUS_FSM_READY
bool FlashEfuseReadRow(uint32_t *pui32EfuseData, uint32_t ui32RowAddress)
Reads efuse data from specified row.
__STATIC_INLINE void FlashIntEnable(uint32_t ui32IntFlags)
Enables flash controller interrupt sources.
tFlashStateCommandsType
Defined values for Flash State Machine commands.
void IntUnregister(uint32_t ui32Interrupt)
Unregisters the function to be called when an interrupt occurs.
__STATIC_INLINE uint32_t FlashIntStatus(void)
Gets the current interrupt status.
uint32_t FlashProtectionSave(uint32_t ui32SectorAddress)
Save sector protection to make it permanent.
__STATIC_INLINE void FlashIntRegister(void(*pfnHandler)(void))
Registers an interrupt handler for the flash interrupt.
void FlashProtectionSet(uint32_t ui32SectorAddress, uint32_t ui32ProtectMode)
Set sector protection.
__STATIC_INLINE void FlashIntDisable(uint32_t ui32IntFlags)
Disables individual flash controller interrupt sources.
volatile uint8_t tFwpWriteByte
#define FAPI_STATUS_FSM_BUSY
uint32_t FlashProgram(uint8_t *pui8DataBuffer, uint32_t ui32Address, uint32_t ui32Count)
Programs unprotected main bank flash sectors.
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.