| | |
| | | } |
| | | |
| | | /** |
| | | * @brief Get busy status of FMC module |
| | | * @param fmc Flash memory controller base |
| | | * @note FMC changes to busy status when doing read/write/erase operations |
| | | * using software APIs in current fmc driver. |
| | | * @return fmc is busy working (true) or not (false) |
| | | */ |
| | | __STATIC_FORCEINLINE bool FMC_IsBusyWorking(FLCTL_T *fmc) |
| | | { |
| | | return (bool)fmc->X_FL_TRIG; |
| | | } |
| | | |
| | | /** |
| | | * @brief This function is used to get flash unique id, |
| | | * @param fmc: where fmc is a flash peripheral. |
| | | * @return None |
| | |
| | | * @retval -1: Fail. |
| | | */ |
| | | extern int FMC_EraseBlock64k(FLCTL_T *fmc,unsigned long addr); |
| | | /** |
| | | * @brief Erase the whole flash memory. |
| | | * |
| | | * This function is used to erase all data in flash, include |
| | | * Code Area and Info Area. |
| | | * |
| | | * @note This API should only be used when you really know what |
| | | * you are doing. |
| | | * |
| | | * @param fmc: where fmc is a flash peripheral. |
| | | * @retval 0: Success. |
| | | * @retval -1: Fail. |
| | | */ |
| | | extern int FMC_EraseChip(FLCTL_T *fmc); |
| | | |
| | | /** |
| | | * @brief Erase specific data in flash code area. |
| | | * |
| | |
| | | * @brief This function is used to read flash, |
| | | * @param fmc: where fmc is a flash peripheral. |
| | | * @param Addr: where Addr is start address to read |
| | | * @param cmd: where cmd can be \ref CMD_FAST_READ or \ref CMD_NORM_READ |
| | | * @param cmd: where cmd can be \ref CMD_FAST_READ or \ref CMD_DREAD |
| | | * @return 1byte data |
| | | */ |
| | | extern unsigned char FMC_ReadByte(FLCTL_T *fmc, unsigned int Addr, unsigned char cmd); |
| | |
| | | * @brief This function is used to read flash |
| | | * @param fmc: where fmc is a flash peripheral. |
| | | * @param Addr: where Addr is start address to read |
| | | * @param cmd: where cmd can be CMD_FAST_READ or CMD_NOR_READ |
| | | * @param cmd: where cmd can be \ref CMD_FAST_READ or \ref CMD_DREAD |
| | | * @return 4byte data |
| | | */ |
| | | extern unsigned int FMC_ReadWord(FLCTL_T *fmc,unsigned int Addr, unsigned char cmd); |
| | |
| | | * @brief This function is used to read a page size (256 bytes) of data from flash |
| | | * @param fmc where fmc is a flash peripheral. |
| | | * @param Addr where Addr is start address to read |
| | | * @param cmd where cmd can be CMD_FAST_READ or CMD_NORM_READ |
| | | * @param cmd where cmd can be \ref CMD_FAST_READ or \ref CMD_DREAD |
| | | * @return Internal Buffer address |
| | | */ |
| | | extern unsigned char *FMC_ReadPage(FLCTL_T *fmc,unsigned int Addr,unsigned char cmd); |
| | |
| | | * @brief This function is used to read data stream from flash |
| | | * @param fmc where fmc is a flash peripheral. |
| | | * @param Addr where Addr is start address to read |
| | | * @param cmd where cmd can be CMD_FAST_READ or CMD_NORM_READ |
| | | * @param cmd where cmd can be \ref CMD_FAST_READ or \ref CMD_DREAD |
| | | * @param buf where buf is a buffer to store read data |
| | | * @param len where len is data length of bytes to read |
| | | * @return None |
| | |
| | | * @return None |
| | | */ |
| | | extern int FMC_WriteStream(FLCTL_T *fmc, unsigned int Addr, unsigned char *buf, unsigned int len); |
| | | |
| | | /** |
| | | * @brief This function is used to read data from the flash 4KB INFO area. |
| | | * @param fmc where fmc is a flash peripheral. |
| | | * @param Addr where Addr is start address to read, can be 0 ~ 4095 |
| | | * @param cmd where cmd can be CMD_FAST_READ or CMD_NORM_READ |
| | | * @param cmd where cmd can be \ref CMD_FAST_READ or \ref CMD_DREAD |
| | | * @param buf where buf is a buffer to store read data |
| | | * @param len where len is data length of bytes to read |
| | | * @retval 0 read success |
| | | * @retval -1 read fail |
| | | */ |
| | | extern int FMC_ReadInfoArea(FLCTL_T *fmc, unsigned int Addr, unsigned char cmd, unsigned char *buf, unsigned int len); |
| | | |
| | | /** |
| | | * @brief This function is used to write data to the flash 4KB INFO area. |
| | | * @param fmc where fmc is a flash peripheral |
| | | * @param Addr where Addr is start address to write, can be 0 ~ 4095 |
| | | * @param buf where buf is a buffer to store data to write |
| | | * @param len where len is data length of bytes to write |
| | | * @note [CAUTION!] This is a dangerous API! It may destroy the calibrate |
| | | * data of SoC, do not call this API if you are not sure the actual |
| | | * behavior of it! |
| | | * @retval 0 write success |
| | | * @retval -1 write fail |
| | | */ |
| | | extern int FMC_WriteInfoArea(FLCTL_T *fmc, unsigned int Addr, unsigned char *buf, unsigned int len); |
| | | |
| | | /** |
| | | * @brief This function is used to erase the flash 4KB INFO area. |
| | | * @param fmc where fmc is a flash peripheral |
| | | * @note [CAUTION!] This is a dangerous API! It may destroy the calibrate |
| | | * data of SoC, do not call this API if you are not sure the actual |
| | | * behavior of it! |
| | | * @retval 0 erase success |
| | | * @retval -1 erase fail |
| | | */ |
| | |
| | | * @return None |
| | | */ |
| | | extern void FMC_SetRdpWaitCount(FLCTL_T *fmc, uint32_t cnt); |
| | | |
| | | /** |
| | | * @brief Set the Data Flash wait count for the specified Flash control (FMC) module. |
| | | * |
| | |
| | | * @return None |
| | | */ |
| | | extern void FMC_SetDpWaitCount(FLCTL_T *fmc, uint32_t cnt); |
| | | |
| | | /** |
| | | * @brief Enable or disable the Suspend IRQ for the specified Flash control (FMC) module. |
| | | * |
| | |
| | | * @return None |
| | | */ |
| | | extern void FMC_SetSuspendIrq(FLCTL_T *fmc, IRQn_Type IRQn, FunctionalState NewState); |
| | | |
| | | /** |
| | | * @brief Set the Suspend Timeout value for the specified Flash control (FMC) module. |
| | | * |
| | |
| | | * @return None |
| | | */ |
| | | extern void FMC_SetSuspendTimeout(FLCTL_T *fmc, uint32_t timeout); |
| | | |
| | | /**@} */ |
| | | #ifdef __cplusplus |
| | | } |