2018-04-16 19:03:33 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2017 Ken Rabold
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup cpu_fe310
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file pm.c
|
|
|
|
* @brief Implementation of the CPU power management for SiFive FE310
|
|
|
|
*
|
|
|
|
* @author Ken Rabold
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2019-02-20 23:39:09 +01:00
|
|
|
#include <stdint.h>
|
2018-04-16 19:03:33 +02:00
|
|
|
#include "periph/pm.h"
|
2019-02-20 23:39:09 +01:00
|
|
|
#include "vendor/platform.h"
|
2018-04-16 19:03:33 +02:00
|
|
|
|
|
|
|
void pm_set_lowest(void)
|
|
|
|
{
|
2019-09-16 17:54:40 +02:00
|
|
|
__asm__ volatile ("wfi");
|
2018-04-16 19:03:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void pm_reboot(void)
|
|
|
|
{
|
2019-02-20 23:39:09 +01:00
|
|
|
AON_REG(AON_WDOGKEY) = AON_WDOGKEY_VALUE;
|
|
|
|
AON_REG(AON_WDOGCMP) = 0;
|
|
|
|
//wdogconfig: : wdogrsten | enablealways | reset to 0 | max scale
|
|
|
|
AON_REG(AON_WDOGKEY) = AON_WDOGKEY_VALUE;
|
2021-01-15 11:53:28 +01:00
|
|
|
AON_REG(AON_WDOGCFG) |= (AON_WDOGCFG_RSTEN | AON_WDOGCFG_ENALWAYS | \
|
|
|
|
AON_WDOGCFG_ZEROCMP | AON_WDOGCFG_SCALE);
|
2019-02-20 23:39:09 +01:00
|
|
|
AON_REG(AON_WDOGKEY) = AON_WDOGKEY_VALUE;
|
|
|
|
AON_REG(AON_WDOGFEED) = AON_WDOGFEED_VALUE;
|
2021-01-15 11:53:28 +01:00
|
|
|
while (1) {}
|
2018-04-16 19:03:33 +02:00
|
|
|
}
|