libxr
Embedded C++ framework for bare-metal, RTOS and Linux
Loading...
Searching...
No Matches
hpm_power.cpp
1#include "hpm_power.hpp"
2
3#include "hpm_ppor_drv.h"
4#include "hpm_romapi.h"
5#ifdef HPM_PDGO_BASE
6#include "hpm_pdgo_drv.h"
7#endif
8
9using namespace LibXR;
10
11HPMPowerManager::HPMPowerManager() {}
12
21{
22 ppor_reset_mask_set_source_enable(HPM_PPOR, ppor_reset_software);
23 ppor_sw_reset(HPM_PPOR, 24);
24 while (true)
25 {
26 }
27}
28
40{
41#ifdef HPM_PDGO_BASE
42 pdgo_set_turnoff_counter(HPM_PDGO, 0x100);
43 while (true)
44 {
45 }
46#else
47 disable_global_irq(CSR_MSTATUS_MIE_MASK);
48 while (true)
49 {
50 __asm volatile("wfi");
51 }
52#endif
53}
54
64{
65 disable_global_irq(CSR_MSTATUS_MIE_MASK);
66 api_boot_arg_t arg;
67 arg.index = 0;
68 arg.peripheral = API_BOOT_PERIPH_AUTO;
69 arg.src = API_BOOT_SRC_ISP;
70 arg.tag = API_BOOT_TAG;
71 rom_enter_bootloader(&arg);
72 Reset();
73}
void JumpToBootloader() override
进入 ROM ISP / Enters the ROM ISP
Definition hpm_power.cpp:63
void Shutdown() override
进入 power down 模式 / Enters the power down mode
Definition hpm_power.cpp:39
void Reset() override
PPOR 软件复位整机 / Resets the whole device through the PPOR.
Definition hpm_power.cpp:20
LibXR 命名空间 / LibXR namespace.
Definition ch32_can.hpp:14