summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flash/bootbox/main.c14
-rw-r--r--flash/bootloader/Makefile2
-rw-r--r--flash/bootloader/bootloader.c40
-rw-r--r--flash/bootloader/bootloader.h17
4 files changed, 33 insertions, 40 deletions
diff --git a/flash/bootbox/main.c b/flash/bootbox/main.c
index 71708675f4..2bd3fea115 100644
--- a/flash/bootbox/main.c
+++ b/flash/bootbox/main.c
@@ -44,7 +44,7 @@
44#include "usb.h" 44#include "usb.h"
45#include "powermgmt.h" 45#include "powermgmt.h"
46 46
47void usb_screen(void) 47static void usb_screen(void)
48{ 48{
49 lcd_clear_display(); 49 lcd_clear_display();
50 lcd_puts(0, 0, "USB mode"); 50 lcd_puts(0, 0, "USB mode");
@@ -55,7 +55,7 @@ void usb_screen(void)
55 } 55 }
56} 56}
57 57
58void show_logo(void) 58static void show_logo(void)
59{ 59{
60 lcd_clear_display(); 60 lcd_clear_display();
61 lcd_puts(0, 0, "Rockbox"); 61 lcd_puts(0, 0, "Rockbox");
@@ -64,13 +64,7 @@ void show_logo(void)
64} 64}
65 65
66#if CONFIG_CHARGING 66#if CONFIG_CHARGING
67/* 67static void charging_screen(void)
68bool backlight_get_on_when_charging(void)
69{
70 return false;
71}
72*/
73void charging_screen(void)
74{ 68{
75 unsigned int button; 69 unsigned int button;
76 const char* msg; 70 const char* msg;
@@ -123,7 +117,7 @@ void charging_screen(void)
123#endif /* CONFIG_CHARGING */ 117#endif /* CONFIG_CHARGING */
124 118
125/* prompt user to plug USB and fix a problem */ 119/* prompt user to plug USB and fix a problem */
126void prompt_usb(const char* msg1, const char* msg2) 120static void prompt_usb(const char* msg1, const char* msg2)
127{ 121{
128 int button; 122 int button;
129 lcd_clear_display(); 123 lcd_clear_display();
diff --git a/flash/bootloader/Makefile b/flash/bootloader/Makefile
index 6872fcbc99..e7bd17aae9 100644
--- a/flash/bootloader/Makefile
+++ b/flash/bootloader/Makefile
@@ -35,7 +35,7 @@ DEFINES= -DPLATFORM_$(PLATFORM)
35 35
36OBJDIR := . 36OBJDIR := .
37 37
38CFLAGS = -O -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(DEFINES) 38CFLAGS = -Os -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(DEFINES)
39AFLAGS += -small -relax 39AFLAGS += -small -relax
40 40
41 41
diff --git a/flash/bootloader/bootloader.c b/flash/bootloader/bootloader.c
index dc094d1b2e..d1955c2ccd 100644
--- a/flash/bootloader/bootloader.c
+++ b/flash/bootloader/bootloader.c
@@ -27,6 +27,22 @@
27#include "sh7034.h" 27#include "sh7034.h"
28#include "bootloader.h" 28#include "bootloader.h"
29 29
30// prototypes
31static void PlatformInit(void);
32static int ucl_nrv2e_decompress_8(const UINT8 *src, UINT8 *dst, UINT32* dst_len);
33static void DecompressStart(tImage* pImage);
34#ifdef USE_ADC
35static int ReadADC(int channel);
36#endif
37static int ButtonPressed(void);
38static tImage* GetStartImage(int nPreferred);
39// test functions
40static void SetLed(BOOL bOn);
41static void UartInit(void);
42static UINT8 UartRead(void);
43static void UartWrite(UINT8 byte);
44static void MiniMon(void);
45
30 46
31#ifdef NO_ROM 47#ifdef NO_ROM
32/* start with the vector table */ 48/* start with the vector table */
@@ -71,7 +87,7 @@ void _main(void)
71} 87}
72 88
73 89
74void BootInit(void) 90static void BootInit(void)
75{ 91{
76 /* inits from the boot ROM, whether they make sense or not */ 92 /* inits from the boot ROM, whether they make sense or not */
77 PBDR &= 0xFFBF; /* LED off (0x131E) */ 93 PBDR &= 0xFFBF; /* LED off (0x131E) */
@@ -117,7 +133,7 @@ int main(void)
117 133
118 134
119/* init code that is specific to certain platform */ 135/* init code that is specific to certain platform */
120void PlatformInit(void) 136static void PlatformInit(void)
121{ 137{
122#ifdef NO_ROM 138#ifdef NO_ROM
123 BootInit(); /* if not started by boot ROM, we need to init what it did */ 139 BootInit(); /* if not started by boot ROM, we need to init what it did */
@@ -177,7 +193,7 @@ void PlatformInit(void)
177#define GETBIT(bb, src, ilen) \ 193#define GETBIT(bb, src, ilen) \
178 (((bb = bb & 0x7f ? bb*2 : ((unsigned)src[ilen++]*2+1)) >> 8) & 1) 194 (((bb = bb & 0x7f ? bb*2 : ((unsigned)src[ilen++]*2+1)) >> 8) & 1)
179 195
180int ucl_nrv2e_decompress_8( 196static int ucl_nrv2e_decompress_8(
181 const UINT8 *src, UINT8 *dst, UINT32* dst_len) 197 const UINT8 *src, UINT8 *dst, UINT32* dst_len)
182{ 198{
183 UINT32 bb = 0; 199 UINT32 bb = 0;
@@ -239,7 +255,7 @@ int ucl_nrv2e_decompress_8(
239 255
240 256
241/* move the image into place and start it */ 257/* move the image into place and start it */
242void DecompressStart(tImage* pImage) 258static void DecompressStart(tImage* pImage)
243{ 259{
244 UINT32* pSrc; 260 UINT32* pSrc;
245 UINT32* pDest; 261 UINT32* pDest;
@@ -273,7 +289,7 @@ void DecompressStart(tImage* pImage)
273} 289}
274 290
275#ifdef USE_ADC 291#ifdef USE_ADC
276int ReadADC(int channel) 292static int ReadADC(int channel)
277{ 293{
278 /* after channel 3, the ports wrap and get re-used */ 294 /* after channel 3, the ports wrap and get re-used */
279 volatile UINT16* pResult = (UINT16*)(ADDRAH_ADDR + 2 * (channel & 0x03)); 295 volatile UINT16* pResult = (UINT16*)(ADDRAH_ADDR + 2 * (channel & 0x03));
@@ -289,7 +305,7 @@ int ReadADC(int channel)
289 305
290/* This function is platform-dependent, 306/* This function is platform-dependent,
291 * until I figure out how to distinguish at runtime. */ 307 * until I figure out how to distinguish at runtime. */
292int ButtonPressed(void) /* return 1,2,3 for F1,F2,F3, 0 if none pressed */ 308static int ButtonPressed(void) /* return 1,2,3 for F1,F2,F3, 0 if none pressed */
293{ 309{
294#ifdef USE_ADC 310#ifdef USE_ADC
295 int value = ReadADC(CHANNEL); 311 int value = ReadADC(CHANNEL);
@@ -316,7 +332,7 @@ int ButtonPressed(void) /* return 1,2,3 for F1,F2,F3, 0 if none pressed */
316 332
317 333
318/* Determine the image to be started */ 334/* Determine the image to be started */
319tImage* GetStartImage(int nPreferred) 335static tImage* GetStartImage(int nPreferred)
320{ 336{
321 tImage* pImage1; 337 tImage* pImage1;
322 tImage* pImage2 = NULL; /* default to not present */ 338 tImage* pImage2 = NULL; /* default to not present */
@@ -357,7 +373,7 @@ tImage* GetStartImage(int nPreferred)
357 373
358/* diagnostic functions */ 374/* diagnostic functions */
359 375
360void SetLed(BOOL bOn) 376static void SetLed(BOOL bOn)
361{ 377{
362 if (bOn) 378 if (bOn)
363 PBDR |= 0x0040; 379 PBDR |= 0x0040;
@@ -366,7 +382,7 @@ void SetLed(BOOL bOn)
366} 382}
367 383
368 384
369void UartInit(void) 385static void UartInit(void)
370{ 386{
371 PBIOR &= 0xFBFF; /* input: RXD1 remote pin */ 387 PBIOR &= 0xFBFF; /* input: RXD1 remote pin */
372 PBCR1 |= 0x00A0; /* set PB11+PB10 to UART */ 388 PBCR1 |= 0x00A0; /* set PB11+PB10 to UART */
@@ -378,7 +394,7 @@ void UartInit(void)
378} 394}
379 395
380 396
381UINT8 UartRead(void) 397static UINT8 UartRead(void)
382{ 398{
383 UINT8 byte; 399 UINT8 byte;
384 while (!(SSR1 & SCI_RDRF)); /* wait for char to be available */ 400 while (!(SSR1 & SCI_RDRF)); /* wait for char to be available */
@@ -388,7 +404,7 @@ UINT8 UartRead(void)
388} 404}
389 405
390 406
391void UartWrite(UINT8 byte) 407static void UartWrite(UINT8 byte)
392{ 408{
393 while (!(SSR1 & SCI_TDRE)); /* wait for transmit buffer empty */ 409 while (!(SSR1 & SCI_TDRE)); /* wait for transmit buffer empty */
394 TDR1 = byte; 410 TDR1 = byte;
@@ -397,7 +413,7 @@ void UartWrite(UINT8 byte)
397 413
398 414
399/* include the mini monitor as a rescue feature, started with F3 */ 415/* include the mini monitor as a rescue feature, started with F3 */
400void MiniMon(void) 416static void MiniMon(void)
401{ 417{
402 UINT8 cmd; 418 UINT8 cmd;
403 UINT32 addr; 419 UINT32 addr;
diff --git a/flash/bootloader/bootloader.h b/flash/bootloader/bootloader.h
index fc6bcb1eed..948311f55d 100644
--- a/flash/bootloader/bootloader.h
+++ b/flash/bootloader/bootloader.h
@@ -76,26 +76,9 @@ typedef struct
76#define FLASH_BASE 0x02000000 // start of the flash memory 76#define FLASH_BASE 0x02000000 // start of the flash memory
77#define FW_VERSION *(unsigned short*)(FLASH_BASE + 0xFE) // firmware version 77#define FW_VERSION *(unsigned short*)(FLASH_BASE + 0xFE) // firmware version
78 78
79
80// prototypes 79// prototypes
81void _main(void) __attribute__ ((section (".startup"))); 80void _main(void) __attribute__ ((section (".startup")));
82int main(void); 81int main(void);
83void PlatformInit(void);
84void DramInit(void);
85int ucl_nrv2e_decompress_8(const UINT8 *src, UINT8 *dst, UINT32* dst_len);
86void DecompressStart(tImage* pImage);
87#ifdef USE_ADC
88int ReadADC(int channel);
89#endif
90int ButtonPressed(void);
91tImage* GetStartImage(int nPreferred);
92// test functions
93void SetLed(BOOL bOn);
94void UartInit(void);
95UINT8 UartRead(void);
96void UartWrite(UINT8 byte);
97void MiniMon(void);
98
99 82
100// minimon commands 83// minimon commands
101#define BAUDRATE 0x00 // followed by BRR value; response: command byte 84#define BAUDRATE 0x00 // followed by BRR value; response: command byte