From ae079c1fc5d990ba55714d4b3a51b19f96edaec4 Mon Sep 17 00:00:00 2001 From: WXK <287788329@qq.com> Date: 星期四, 24 四月 2025 16:01:43 +0800 Subject: [PATCH] 改为中断来低电平触发发送当前扫描数据,3s内扫描不到的会退出,串口来55 AA 75 70 64 61 74 65,进入升级模式 --- 01_SDK/modules/hal/panchip/panplat/pan1070/bsp/peripheral/inc/pan_fmc.h | 50 +++++++++++++++++++++++++++++++------------------- 1 files changed, 31 insertions(+), 19 deletions(-) diff --git a/01_SDK/modules/hal/panchip/panplat/pan1070/bsp/peripheral/inc/pan_fmc.h b/01_SDK/modules/hal/panchip/panplat/pan1070/bsp/peripheral/inc/pan_fmc.h index baf8ef5..7f830fa 100644 --- a/01_SDK/modules/hal/panchip/panplat/pan1070/bsp/peripheral/inc/pan_fmc.h +++ b/01_SDK/modules/hal/panchip/panplat/pan1070/bsp/peripheral/inc/pan_fmc.h @@ -151,6 +151,18 @@ } /** + * @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 @@ -224,20 +236,7 @@ * @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. * @@ -347,7 +346,7 @@ * @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); @@ -374,7 +373,7 @@ * @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); @@ -383,7 +382,7 @@ * @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); @@ -392,7 +391,7 @@ * @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 @@ -408,30 +407,39 @@ * @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 */ @@ -483,6 +491,7 @@ * @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. * @@ -494,6 +503,7 @@ * @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. * @@ -506,6 +516,7 @@ * @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. * @@ -517,6 +528,7 @@ * @return None */ extern void FMC_SetSuspendTimeout(FLCTL_T *fmc, uint32_t timeout); + /**@} */ #ifdef __cplusplus } -- Gitblit v1.9.3