4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-01-23 07:07:23 +08:00
ze9hyr 563d11f8cd 警告消除及代码格式化
修改文件头信息

修改ACM32F030 BSP的文件格式

新增BSP驱动中的lib文件

IAR和GCC支持备份

1. 修复不能包含HAL_EFLASH.h问题, 2. 消除GCC编译的几个警告

1. gcc启动文件重命名;2. 文件头信息修改; 3. 硬件timer支持修改

移动 .ignore_format.yml到bsp的目录下

修改目录成相对目录
2021-09-08 13:10:39 +08:00

78 lines
2.3 KiB
C

/*
******************************************************************************
* @file HAL_EFlash.c
* @version V1.0.0
* @date 2020
* @brief EFlash HAL module driver.
* This file provides firmware functions to manage the following
* functionalities of the internal FLASH memory:
* @ Program operations functions
* @ Erase operations functions
******************************************************************************
*/
#include "ACM32Fxx_HAL.h"
/*********************************************************************************
* Function : HAL_EFlash_Init
* Description : Configure eflash parameter as system clock
* Input : system clock frequency
* Output : None
* Author : Chris_Kyle
**********************************************************************************/
void HAL_EFlash_Init(uint32_t fu32_freq)
{
HAL_EFlash_Init_Para(fu32_freq);
}
/*
* Function : HAL_EFlash_Erase_Page
* Description : Erase a Page, TERASE has been configured in System_Clock_Init()
* Input :
* Outpu : false: FAIL
true: SUCCESS
* Author : Chris_Kyle Data : 2020年
**********************************************************************************/
bool HAL_EFlash_ErasePage(uint32_t fu32_Addr)
{
EFC->CTRL |= EFC_CTRL_PAGE_ERASE_MODE;
EFC->SEC = 0x55AAAA55;
*((volatile uint32_t *)fu32_Addr) = 0;
while (!(EFC->STATUS & EFC_STATUS_EFLASH_RDY));
EFC->CTRL &= ~EFC_CTRL_PAGE_ERASE_MODE;
return true;
}
/*********************************************************************************
* Function : HAL_EFlash_Programe
* Description : Program a word, TPROG has been configured in System_Clock_Init()
* Input :
* Outpu : false: FAIL
true: SUCCESS
* Author : Chris_Kyle Data : 2020年
**********************************************************************************/
bool HAL_EFlash_Program_Word(uint32_t fu32_Addr, uint32_t fu32_Data)
{
if (fu32_Addr % 4)
{
return false;
}
EFC->CTRL |= EFC_CTRL_PROGRAM_MODE;
EFC->SEC = 0x55AAAA55;
*((volatile uint32_t *)fu32_Addr) = fu32_Data;
while (!(EFC->STATUS & EFC_STATUS_EFLASH_RDY));
EFC->CTRL &= ~EFC_CTRL_PROGRAM_MODE;
return true;
}