freemyipod r421 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r420‎ | r421 | r422 >
Date:17:04, 9 January 2011
Author:theseven
Status:new
Tags:
Comment:
UMSboot: Make LCD console colors configurable
Modified paths:
  • /apps/installer-nano2g/fsfiles (modified) (history)
  • /umsboot/lcdconsole.c (modified) (history)
  • /umsboot/main.c (modified) (history)
  • /umsboot/panic.c (modified) (history)
  • /umsboot/target/ipodclassic/target.h (modified) (history)
  • /umsboot/target/ipodnano2g/target.h (modified) (history)

Diff [purge]

Index: apps/installer-nano2g/fsfiles
Property changes on: apps/installer-nano2g/fsfiles
___________________________________________________________________
Added: svn:ignore
## -0,0 +1 ##
 1+.rockbox
Index: umsboot/panic.c
@@ -32,9 +32,9 @@
3333 {
3434 enter_critical_section();
3535 while (!displaylcd_safe());
36 - lcdconsole_puts_noblit("\n*PANIC*\n", 0, -1);
37 - lcdconsole_puts_noblit(string, 0, -1);
38 - lcdconsole_puts_noblit("\n", 0, -1);
 36+ lcdconsole_puts_noblit("\n*PANIC*\n", LCDCONSOLE_FGCOLOR, LCDCONSOLE_BGCOLOR);
 37+ lcdconsole_puts_noblit(string, LCDCONSOLE_FGCOLOR, LCDCONSOLE_BGCOLOR);
 38+ lcdconsole_puts_noblit("\n", LCDCONSOLE_FGCOLOR, LCDCONSOLE_BGCOLOR);
3939 lcdconsole_update();
4040 hang();
4141 }
@@ -41,7 +41,7 @@
4242
4343 static int pprfunc(void* ptr, unsigned char letter)
4444 {
45 - lcdconsole_putc_noblit(letter, 0, -1);
 45+ lcdconsole_putc_noblit(letter, LCDCONSOLE_FGCOLOR, LCDCONSOLE_BGCOLOR);
4646 return true;
4747 }
4848
@@ -50,11 +50,11 @@
5151 va_list ap;
5252 enter_critical_section();
5353 while (!displaylcd_safe());
54 - lcdconsole_puts_noblit("\n*PANIC*\n", 0, -1);
 54+ lcdconsole_puts_noblit("\n*PANIC*\n", LCDCONSOLE_FGCOLOR, LCDCONSOLE_BGCOLOR);
5555 va_start(ap, string);
5656 format(pprfunc, NULL, string, ap);
5757 va_end(ap);
58 - lcdconsole_puts_noblit("\n", 0, -1);
 58+ lcdconsole_puts_noblit("\n", LCDCONSOLE_FGCOLOR, LCDCONSOLE_BGCOLOR);
5959 lcdconsole_update();
6060 hang();
6161 }
Index: umsboot/target/ipodnano2g/target.h
@@ -49,6 +49,8 @@
5050 #define LCD_BYTESPERPIXEL 2
5151 #define FRAMEBUF_WIDTH 176
5252 #define FRAMEBUF_HEIGHT 132
 53+#define LCDCONSOLE_FGCOLOR 0
 54+#define LCDCONSOLE_BGCOLOR -1
5355
5456 #define HAVE_BACKLIGHT
5557
Index: umsboot/target/ipodclassic/target.h
@@ -49,6 +49,8 @@
5050 #define LCD_BYTESPERPIXEL 2
5151 #define FRAMEBUF_WIDTH 176
5252 #define FRAMEBUF_HEIGHT 98
 53+#define LCDCONSOLE_FGCOLOR 0
 54+#define LCDCONSOLE_BGCOLOR -1
5355
5456 #define HAVE_BACKLIGHT
5557
Index: umsboot/main.c
@@ -131,7 +131,7 @@
132132 while (vbus_state() && !usb_ejected);
133133 udelay(200000);
134134 usb_exit();
135 - lcdconsole_puts("\nLoading UBI file...\n", 0, 0xffff);
 135+ lcdconsole_puts("\nLoading UBI file...\n", LCDCONSOLE_FGCOLOR, LCDCONSOLE_BGCOLOR);
136136 int found = 0;
137137 uint16_t cluster;
138138 uint32_t size;
@@ -151,17 +151,17 @@
152152 + RAMDISK_SECTORSIZE - 1) / RAMDISK_SECTORSIZE;
153153 if (!found)
154154 {
155 - lcdconsole_puts("No UBI file found!", 0, 0xffff);
 155+ lcdconsole_puts("No UBI file found!", LCDCONSOLE_FGCOLOR, LCDCONSOLE_BGCOLOR);
156156 return;
157157 }
158158 if (found != 1)
159159 {
160 - lcdconsole_puts("Multiple UBI files found!\nPlease copy exactly one.", 0, 0xffff);
 160+ lcdconsole_puts("Multiple UBI files found!\nPlease copy exactly one.", LCDCONSOLE_FGCOLOR, LCDCONSOLE_BGCOLOR);
161161 return;
162162 }
163163 if (!size || !cluster)
164164 {
165 - lcdconsole_puts("UBI file is empty!", 0, 0xffff);
 165+ lcdconsole_puts("UBI file is empty!", LCDCONSOLE_FGCOLOR, LCDCONSOLE_BGCOLOR);
166166 return;
167167 }
168168 uint16_t dest = 0;
@@ -171,7 +171,7 @@
172172 cluster = *((uint16_t*)&ramdisk[swapmap[1 + (cluster / (RAMDISK_SECTORSIZE / 2))]]
173173 [(cluster % (RAMDISK_SECTORSIZE / 2)) * 2]);
174174 }
175 - lcdconsole_puts("Rearranging files...\n", 0, 0xffff);
 175+ lcdconsole_puts("Rearranging files...\n", LCDCONSOLE_FGCOLOR, LCDCONSOLE_BGCOLOR);
176176 uint16_t offset = RAMDISK_SECTORS - totalclusters - 2;
177177 memset(newfat, 0, sizeof(newfat));
178178 memset(newdir, 0, sizeof(newdir));
@@ -205,7 +205,7 @@
206206 memcpy(ramdisk[offset + 1], newdir, RAMDISK_SECTORSIZE);
207207 memcpy(ramdisk[offset - fatsectors + 1], newfat, fatsectors * RAMDISK_SECTORSIZE);
208208 fat16_write_mbr(_ramdiskptr, totalclusters + fatsectors + 2);
209 - lcdconsole_puts("Booting...", 0, 0xffff);
 209+ lcdconsole_puts("Booting...", LCDCONSOLE_FGCOLOR, LCDCONSOLE_BGCOLOR);
210210 displaylcd_sync();
211211 udelay(10000);
212212 execfirmware(ramdisk[0]);
@@ -229,7 +229,7 @@
230230 i2c_init();
231231 #endif
232232 power_init();
233 - lcdconsole_puts(welcomestring, 0, 0xffff);
 233+ lcdconsole_puts(welcomestring, LCDCONSOLE_FGCOLOR, LCDCONSOLE_BGCOLOR);
234234 #ifdef HAVE_BACKLIGHT
235235 backlight_init();
236236 #endif
Index: umsboot/lcdconsole.c
@@ -44,7 +44,7 @@
4545 void lcdconsole_init()
4646 {
4747 displaylcd(0, LCD_WIDTH - 1, 0, LCD_HEIGHT - 1, (void*)0xffffffff, 0);
48 - memset(framebuf, -1, sizeof(framebuf));
 48+ memset(framebuf, LCDCONSOLE_BGCOLOR, sizeof(framebuf));
4949 current_row = 0;
5050 current_col = -1;
5151 lcdconsole_needs_update = false;