2024-12-15 17:22:09 +08:00
|
|
|
|
/*
|
|
|
|
|
* @Author : stark1898y 1658608470@qq.com
|
|
|
|
|
* @Date : 2024-12-15 16:13:37
|
|
|
|
|
* @LastEditors : stark1898y 1658608470@qq.com
|
2025-04-13 23:18:47 +08:00
|
|
|
|
* @LastEditTime : 2025-04-13 22:48:38
|
|
|
|
|
* @FilePath : \BLE_TYQ_CH584M\BSP\inc\bsp_iwdg.h
|
2024-12-15 17:22:09 +08:00
|
|
|
|
* @Description :
|
|
|
|
|
*
|
|
|
|
|
* Copyright (c) 2024 by yzy, All Rights Reserved.
|
|
|
|
|
*/
|
2024-12-14 13:31:23 +08:00
|
|
|
|
/*
|
|
|
|
|
* @Author : stark1898y 1658608470@qq.com
|
|
|
|
|
* @Date : 2024-12-14 10:51:01
|
|
|
|
|
* @LastEditors : stark1898y 1658608470@qq.com
|
2024-12-15 14:30:06 +08:00
|
|
|
|
* @LastEditTime : 2024-12-15 11:16:24
|
2024-12-30 10:15:27 +08:00
|
|
|
|
* @FilePath : \BLE_TYQ_CH584M\BSP\inc\bsp_iwdg.h
|
2024-12-14 13:31:23 +08:00
|
|
|
|
* @Description :
|
|
|
|
|
*
|
|
|
|
|
* Copyright (c) 2024 by yzy, All Rights Reserved.
|
|
|
|
|
*/
|
|
|
|
|
#ifndef __BSP_IWDG_H__
|
|
|
|
|
#define __BSP_IWDG_H__
|
|
|
|
|
|
|
|
|
|
#include "CONFIG.h"
|
|
|
|
|
|
|
|
|
|
#define RB_RLR 0x0FFF // RW, watch-dog counter reload (write protect)
|
|
|
|
|
#define RB_PR 0x7000 // PR, prescale (write protect)
|
|
|
|
|
#define RB_PVU 0x8000 // RO, register update flag (write protect)
|
|
|
|
|
#define RB_COUNT 0xFF0000 // RO, watch-dog down counter
|
|
|
|
|
#define RB_STOP_EN 0x20000000 // RW, watch-dog stop enable (write protect)
|
|
|
|
|
#define RB_WR_PROTECT 0x40000000 // RO, write protect
|
|
|
|
|
#define RB_IWDG_EN 0x80000000 // RO, watch-dog enable
|
|
|
|
|
|
2025-04-13 23:18:47 +08:00
|
|
|
|
#define IWDG_MS (6000)
|
|
|
|
|
|
|
|
|
|
#define IWIG_FEED_EVENT (0x01 << 0)
|
|
|
|
|
|
2024-12-15 14:30:06 +08:00
|
|
|
|
void IWDG_Init(uint16_t ms);
|
2024-12-14 13:31:23 +08:00
|
|
|
|
|
2024-12-15 14:30:06 +08:00
|
|
|
|
// 需要定时调用喂狗
|
|
|
|
|
// 在看门狗键寄存器 (R32_IWDG_KR) 中,软件要以一定的间隔写入 0xAAAA,重装载计数值,这就是喂狗的操作。
|
|
|
|
|
// 否则,当计数器为 0 时,看门狗会产生复位。
|
|
|
|
|
#define FEED_IWDG() {R32_IWDG_KR=0xAAAA;}
|
|
|
|
|
|
|
|
|
|
void ShowRestartReason(void);
|
2024-12-14 13:31:23 +08:00
|
|
|
|
|
|
|
|
|
#endif // !__BSP_IWDG_H__
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|