Commit 82b5b21f authored by schneider's avatar schneider Committed by Rahix
Browse files

feat(bootloader): Reset when system says done

parent a43065c5
......@@ -114,11 +114,17 @@ void delay_us(unsigned int usec)
mxc_delay(usec);
}
void bootloader_stop(void)
{
card10_reset();
}
void bootloader_dirty(void)
{
Paint_DrawString_EN(0, 16 * 3, "Writing.", &Font16, 0x0000, 0xf000);
LCD_Update();
}
void bootloader_clean(void)
{
Paint_DrawString_EN(0, 16 * 3, "Ready. ", &Font16, 0x0000, 0xffff);
......
......@@ -210,15 +210,7 @@ static inline void boot(const void *vtable)
static void pmic_button(bool falling)
{
if (falling) {
printf("Resetting ...\n");
/*
* Give the UART fifo time to clear.
* TODO: Do this properly
*/
for (int i = 0; i < 0x1000000; i++) {
__asm volatile("nop");
}
MXC_GCR->rstr0 = MXC_F_GCR_RSTR0_SYSTEM;
card10_reset();
}
}
......
......@@ -3,6 +3,7 @@
#include <stdio.h>
#include "mx25lba.h"
void bootloader_stop(void);
void bootloader_dirty(void);
void bootloader_clean(void);
......@@ -50,7 +51,9 @@ int mscmem_start()
int mscmem_stop()
{
printf("%s\n", __func__);
return mx25_stop();
int ret = mx25_stop();
bootloader_stop();
return ret;
}
/******************************************************************************/
......
......@@ -216,6 +216,19 @@ void card10_poll(void)
pmic_poll();
}
void card10_reset(void)
{
printf("Resetting ...\n");
/*
* Give the UART fifo time to clear.
* TODO: Do this properly
*/
for (int i = 0; i < 0x1000000; i++) {
__asm volatile("nop");
}
MXC_GCR->rstr0 = MXC_F_GCR_RSTR0_SYSTEM;
}
void GPIO0_IRQHandler(void)
{
GPIO_Handler(PORT_0);
......
......@@ -13,4 +13,5 @@ void core1_start(void);
void core1_stop(void);
void card10_poll(void);
void card10_reset(void);
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment