add low power

This commit is contained in:
Steven Dan
2026-05-15 10:53:57 +08:00
parent b9303bccb8
commit 458978cb70
2 changed files with 28 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
#include <platform.h>
void power_down()
{
#if (LOW_POWER_EN == 1)
// Give the software 10 seconds to start up, then apply power optimisations below.
timer tmr;
int t;
tmr :> t;
tmr when timerafter(t+1000000000) :> void;
// Reduce switch clock frequency
// write_node_config_reg(tile[0], XS1_SSWITCH_CLK_DIVIDER_NUM, 4);
write_node_config_reg(tile[1], XS1_SSWITCH_CLK_DIVIDER_NUM, 4);
//
// // Reduce core 0 clock frequency (to 9 MHz)
// // Note, to completely disable, use:
// // write_tile_config_reg(tile[0], XS1_PSWITCH_PLL_CLK_DIVIDER_NUM, 0x80000000);
// write_tile_config_reg(tile[0], XS1_PSWITCH_PLL_CLK_DIVIDER_NUM, 0x00000040);
write_tile_config_reg(tile[1], XS1_PSWITCH_PLL_CLK_DIVIDER_NUM, 0x00000040);
setps(XS1_PS_XCORE_CTRL0, 0x10);
#endif
}