Skip to content
Snippets Groups Projects
Commit a43065c5 authored by schneider's avatar schneider Committed by rahix
Browse files

feat(bootloader): Show ready/writing message

parent d681d9de
No related branches found
No related tags found
No related merge requests found
......@@ -52,6 +52,8 @@
#include "descriptors.h"
#include "mscmem.h"
#include "card10.h"
#include "display.h"
#include "GUI_Paint.h"
/***** Definitions *****/
#define EVENT_ENUM_COMP MAXUSB_NUM_EVENTS
......@@ -112,6 +114,17 @@ void delay_us(unsigned int usec)
mxc_delay(usec);
}
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);
LCD_Update();
}
/******************************************************************************/
void run_usbmsc(void)
{
......
......@@ -238,12 +238,10 @@ int main(void)
// If the button is pressed, we go into MSC mode.
if (PB_Get(3)) {
Paint_DrawString_EN(
0,
16 * 2,
"USB activated. Waiting.",
&Font16,
0x0000,
0xffff
0, 16 * 2, "USB activated.", &Font16, 0x0000, 0xffff
);
Paint_DrawString_EN(
0, 16 * 3, "Ready.", &Font16, 0x0000, 0xffff
);
LCD_Update();
run_usbmsc();
......
......@@ -3,6 +3,11 @@
#include <stdio.h>
#include "mx25lba.h"
void bootloader_dirty(void);
void bootloader_clean(void);
static int dirty = 0;
/******************************************************************************/
int mscmem_init()
{
......@@ -27,6 +32,10 @@ int mscmem_read(uint32_t lba, uint8_t *buffer)
int mscmem_write(uint32_t lba, uint8_t *buffer)
{
//printf("%s\n", __func__);
if (dirty == 0) {
bootloader_dirty();
}
dirty = 2;
return mx25_write(lba, buffer);
}
......@@ -48,5 +57,13 @@ int mscmem_stop()
int mscmem_ready()
{
//printf("%s\n", __func__);
if (dirty) {
dirty--;
if (dirty == 0) {
printf("sync\n");
mx25_sync();
bootloader_clean();
}
}
return mx25_ready();
}
......@@ -52,5 +52,6 @@ uint32_t mx25_size(void);
int mx25_read(uint32_t lba, uint8_t* buffer);
int mx25_write(uint32_t lba, uint8_t* buffer);
int mx25_ready(void);
int mx25_sync(void);
#endif /* __MX25_H__ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment