Add mcu/*stm32l4.

This commit is contained in:
NIIBE Yutaka
2019-04-11 15:09:44 +09:00
parent 8b9d2c007a
commit e5e46b5de5
6 changed files with 243 additions and 19 deletions

29
mcu/chx-stm32l4.c Normal file
View File

@@ -0,0 +1,29 @@
#include <stdint.h>
#include <mcu/cortex-m.h>
#include <mcu/stm32l.h>
extern int chx_allow_sleep;
void
chx_sleep_mode (int how)
{
/*TBD*/
(void)how;
}
void __attribute__((naked))
chx_idle (void)
{
/*TBD*/
int sleep_enabled;
for (;;)
{
asm ("ldr %0, %1" : "=r" (sleep_enabled): "m" (chx_allow_sleep));
if (sleep_enabled)
{
asm volatile ("wfi" : : : "memory");
/* NOTE: it never comes here. Don't add lines after this. */
}
}
}