563d11f8cd
修改文件头信息 修改ACM32F030 BSP的文件格式 新增BSP驱动中的lib文件 IAR和GCC支持备份 1. 修复不能包含HAL_EFLASH.h问题, 2. 消除GCC编译的几个警告 1. gcc启动文件重命名;2. 文件头信息修改; 3. 硬件timer支持修改 移动 .ignore_format.yml到bsp的目录下 修改目录成相对目录
118 lines
3.4 KiB
C
118 lines
3.4 KiB
C
/***********************************************************************
|
|
* Filename : HAL_WDT.c
|
|
* Description : HAL WDT driver source file
|
|
* Author(s) : CWT
|
|
* version : V1.0
|
|
* Modify date : 2020-04-17
|
|
***********************************************************************/
|
|
#include "ACM32Fxx_HAL.h"
|
|
|
|
/************************************************************************
|
|
* function : HAL_WDT_Feed
|
|
* Description: WDT feed.
|
|
* input :
|
|
* none
|
|
* return: none
|
|
************************************************************************/
|
|
void HAL_WDT_Feed(WDT_HandleTypeDef* hwdt)
|
|
{
|
|
hwdt->Instance->FEED = 0xAA55A55A;
|
|
}
|
|
/************************************************************************
|
|
* function : HAL_WDT_IRQHandler
|
|
* Description: WDT interrupt service routine.
|
|
* input :
|
|
* none
|
|
* return: none
|
|
************************************************************************/
|
|
void HAL_WDT_IRQHandler(WDT_HandleTypeDef* hwdt)
|
|
{
|
|
#ifdef __GNUC__
|
|
#pragma GCC diagnostic push
|
|
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
|
#endif
|
|
volatile uint32_t wdt_ris = 0;
|
|
wdt_ris = hwdt->Instance->RIS;
|
|
HAL_WDT_Feed(hwdt);
|
|
NVIC_ClearPendingIRQ(WDT_IRQn);
|
|
#ifdef __GNUC__
|
|
#pragma GCC diagnostic pop
|
|
#endif
|
|
}
|
|
|
|
/************************************************************************
|
|
* function : HAL_WDT_Init
|
|
* Description: WDT initiation.
|
|
* input :
|
|
* pinit initiation parameters
|
|
* return: none
|
|
************************************************************************/
|
|
void HAL_WDT_Init(WDT_HandleTypeDef* hwdt)
|
|
{
|
|
System_Module_Enable(EN_WDT);
|
|
System_Delay(1);
|
|
System_Enable_Disable_RTC_Domain_Access(FUNC_ENABLE);
|
|
System_Enable_Disable_Reset(RESET_ENABLE_SOURCE_WDT, FUNC_ENABLE);
|
|
|
|
hwdt->Instance->LOAD = hwdt->Init.WDTLoad;
|
|
hwdt->Instance->CTRL = (hwdt->Instance->CTRL & ~0x47) | (hwdt->Init.WDTDivisor) | (hwdt->Init.WDTMode << 6);
|
|
|
|
if (WDT_MODE_INT == hwdt->Init.WDTMode)
|
|
{
|
|
hwdt->Instance->INTCLRTIME = hwdt->Init.WDTINTCLRTIME;
|
|
HAL_WDT_Int_Enable(hwdt);
|
|
}
|
|
}
|
|
|
|
/************************************************************************
|
|
* function : HAL_WDT_Start
|
|
* Description: WDT start
|
|
* input : none
|
|
*
|
|
* return: none
|
|
************************************************************************/
|
|
void HAL_WDT_Start(WDT_HandleTypeDef* hwdt)
|
|
{
|
|
hwdt->Instance->CTRL |= WDT_ENABLE;
|
|
}
|
|
|
|
/************************************************************************
|
|
* function : WDT_Stop
|
|
* Description: WDT stop
|
|
* input : none
|
|
*
|
|
* return: none
|
|
************************************************************************/
|
|
void HAL_WDT_Stop(WDT_HandleTypeDef* hwdt)
|
|
{
|
|
hwdt->Instance->CTRL &= WDT_DISABLE;
|
|
}
|
|
|
|
/************************************************************************
|
|
* function : WDT_Int_Enable
|
|
* Description: WDT int enable
|
|
* input : none
|
|
*
|
|
* return: none
|
|
************************************************************************/
|
|
void HAL_WDT_Int_Enable(WDT_HandleTypeDef* hwdt)
|
|
{
|
|
hwdt->Instance->CTRL |= WDT_INT_ENABLE;
|
|
NVIC_ClearPendingIRQ(WDT_IRQn);
|
|
NVIC_EnableIRQ(WDT_IRQn);
|
|
}
|
|
|
|
/************************************************************************
|
|
* function : WDT_Int_Disable
|
|
* Description: WDT int disable
|
|
* input : none
|
|
*
|
|
* return: none
|
|
************************************************************************/
|
|
void HAL_WDT_Int_Disable(WDT_HandleTypeDef* hwdt)
|
|
{
|
|
hwdt->Instance->CTRL &= WDT_INT_DISABLE;
|
|
}
|
|
|
|
|