RE: [patch] some splash screen tweaks

From: Hicks, Jamey (Jamey.Hicks@compaq.com)
Date: Wed Mar 06 2002 - 09:44:58 EST


Sacha,

I think vertical orientation of the splash screen is a useful feature. However, I would prefer to maintain or even increase the level of abstraction used in the current code, so jffs2 should call lcd_bar(), which should be configured to be horizontal/vertical in lcd.c.

Jamey
 

> -----Original Message-----
> From: Sacha Chua [mailto:sacha-lists@cersa.admu.edu.ph]
> Sent: Tuesday, March 05, 2002 5:14 AM
> To: bootldr@handhelds.org
> Subject: [Bootldr] [patch] some splash screen tweaks
>
>
> After a bit of poking around, I've gotten the bootloader to
> be a little
> more flexible when it comes to the splash screen.
>
> - added lcd_clear_region and lcd_fill_region in lcd.c
> - added debug bootloader commands - lcdclearregion, lcdfillregion
> - changed lcd_bar to use the lcd_clear_region, lcd_fill_region
> - added a config option for DEBUG_BOOTLDR_CMDS so that we can set that
> in config.mk, although in retrospect that's probably not needed
> - changed load_kernel/src/jffs2.c so that the progress bar
> uses the new
> code, can do vertical progress bars too.
> - added some notes to README.splash
>
> Note that lcd_bar is still a horizontal bar.. might be nice
> to move the
> vertical bar code out of load_kernel/src/jffs2.c, but since progress
> bars aren't used anywhere else (yet), it should be fine. =)
>
> I had tons of fun learning enough to try this out, although I
> must have
> flashed my iPAQ several dozen times now. Please tell me what
> you think.
> New programmer alert! =) Flame away.
>
> (by the way; I just realized all the isalpha stuff I was
> worrying about
> isn't cpp'd in because it's under an #ifdef NoLibC.. but that doesn't
> explain how the rest of it manages to compile.. <muses> Hmm. I really
> want it to pass -Wall -Werror..)
>
> ---- BEGIN UNIFIED DIFF ---------------------------------
> diff -r -u -b bootldr.orig/Makefile bootldr/Makefile
> --- bootldr.orig/Makefile Tue Mar 5 12:26:53 2002
> +++ bootldr/Makefile Tue Mar 5 15:46:21 2002
> @@ -248,6 +248,9 @@
> OTHEROBJS += ymodem.o crc.o
> SMALLOBJS += ymodem.o crc.o
> endif
> +ifeq ($(DEBUG_BOOTLDR_CMDS),y)
> + GLOBAL_DEFS += -DDEBUG_BOOTLDR_CMDS
> +endif
> ifeq ($(CONFIG_H3600_SLEEVE), y)
> ARCH_DEFS += -DCONFIG_H3600_SLEEVE
> HDRS += h3600_sleeve.h
> diff -r -u -b bootldr.orig/README.splash bootldr/README.splash
> --- bootldr.orig/README.splash Tue Mar 5 12:26:53 2002
> +++ bootldr/README.splash Tue Mar 5 15:46:21 2002
> @@ -6,7 +6,25 @@
>
> So, please, BE CAREFUL.
>
> -Also, for the accident prone, you can play with images by using
> -$ make splashz_linux
> +Picky people may also want to edit the LCD_PB_ constants in
> +load_kernel/src/jffs2.c. #define LCD_PB_VERTICAL if you want
> a vertical
> +progress bar; default is horizontal.
> +
> +If you want buttons highlighted properly when you press
> them, you need to
> +edit aux_micro.c. Change the last 4 entries of the relevant key to
> +start_row, start_col, end_row, end_col. Example:
> + {"calb",
> KIF_ENABLE_REBOOT_BUTTON,H3800_ASIC2_CAL_BUTTON,0,154,54,225,79},
> +If you don't want visual feedback, set the coordinates to 0.
> +
> +Also, for the accident prone, you can play with images by
> +
> + $ make splashz_linux
> +
> and
> -boot> lcdzimg <sizeof-splashz-file>
> +
> + boot> lcdzimg <sizeof-splashz-file>
> +
> +Note that you'll need to enable the bootloader debugging
> commands, which you can do by setting this in config.mk:
> +
> + DEBUG_BOOTLDR_CMDS=y
> +
> diff -r -u -b bootldr.orig/bootldr.c bootldr/bootldr.c
> --- bootldr.orig/bootldr.c Tue Mar 5 12:26:53 2002
> +++ bootldr/bootldr.c Tue Mar 5 15:59:26 2002
> @@ -346,6 +346,10 @@
> /* { "lcdpal", command_lcd_pal, "lcdpal -- set lcd pal",
> BB_RUN_FROM_RAM }, */
> { "lcdfill", command_lcd_fill, "lcdfill -- fill lcd
> display", BB_RUN_FROM_RAM },
> { "lcdbar", command_lcd_bar, "lcdbar -- fill lcd bar with
> [color] to [percent] at [row offset]", BB_RUN_FROM_RAM },
> + { "lcdfillregion", command_lcd_fill_region,
> + "lcdfillregion -- fill region args:start_row start_col
> end_row end_col color", BB_RUN_FROM_RAM },
> + { "lcdclearregion", command_lcd_clear_region,
> + "lcdclearregion -- fill region args:start_row start_col
> end_row end_col", BB_RUN_FROM_RAM },
> { "lcdinvertregion", command_lcd_invert_region,
> "lcdinvertregion -- invert region args:start_row
> start_col end_row end_col", BB_RUN_FROM_RAM },
> { "lcdimg", command_lcd_image, "lcdimg -- display image",
> BB_RUN_FROM_RAM },
> @@ -367,7 +371,7 @@
> { "discover", discover_machine_type, "discover -- guess
> what machine i am see mach_type for result", BB_RUN_FROM_RAM },
> { "tdz", command_tdz, "tdz -- test decompress routines
> (best with ascii) pre flashing", BB_RUN_FROM_RAM },
>
> -#endif // DEBUG_BOOTLDR_COMMANDS
> +#endif // DEBUG_BOOTLDR_CMDS
>
> { NULL, NULL, NULL , BB_RUN_FROM_RAM },
> };
> diff -r -u -b bootldr.orig/config.mk bootldr/config.mk
> --- bootldr.orig/config.mk Tue Mar 5 12:26:53 2002
> +++ bootldr/config.mk Tue Mar 5 15:47:14 2002
> @@ -50,3 +50,8 @@
> # ymodem? (depends on CONFIG_ACCEPT_GPL)
> #
> CONFIG_YMODEM=y
> +
> +#
> +# Enable debugging commands?
> +#
> +DEBUG_BOOTLDR_CMDS=y
> diff -r -u -b bootldr.orig/lcd.c bootldr/lcd.c
> --- bootldr.orig/lcd.c Tue Mar 5 12:26:53 2002
> +++ bootldr/lcd.c Tue Mar 5 16:04:43 2002
> @@ -530,14 +530,7 @@
> int percent,
> int row_offset)
> {
> - unsigned short row,col;
> - for (row=row_offset; row < (row_offset+25); row++)
> - for (col=0; col < LCD_XRES; col++)
> - if ((col*100)/LCD_XRES < percent)
> - set_pixel_value(row, col, color);
> -
> -
> -
> + lcd_fill_region(color, row_offset, 0, row_offset + 25,
> (LCD_XRES * percent) / 100);
> }
>
> void
> @@ -545,22 +538,51 @@
> int percent,
> int row_offset)
> {
> - unsigned short color;
> - unsigned short row,col;
> - if (lcd_params->id == LCDP_3100)
> - color = 0;
> - else
> - color = 0xffff;
> -
> - for (row=row_offset; row < (row_offset+25); row++)
> - for (col=0; col < LCD_XRES; col++)
> - if ((col*100)/LCD_XRES < percent)
> - set_pixel_value(row, col, color);
> + lcd_bar((lcd_params->id == LCDP_3100) ? 0 : 0xffff,
> percent, row_offset);
> +}
>
> +unsigned int
> +min(
> + unsigned int a,
> + unsigned int b)
> +{
> + return (a < b) ? a : b;
> +}
>
> +unsigned int
> +max(
> + unsigned int a,
> + unsigned int b)
> +{
> + return (a > b) ? a : b;
> +}
>
> +void
> +lcd_clear_region(
> + unsigned int start_row,
> + unsigned int start_col,
> + unsigned int end_row,
> + unsigned int end_col
> + )
> +{
> + lcd_fill_region(start_row, start_col, end_row, end_col,
> + (lcd_params->id == LCDP_3100) ? 0 : 0xffff);
> }
>
> +void
> +lcd_fill_region(
> + unsigned int start_row,
> + unsigned int start_col,
> + unsigned int end_row,
> + unsigned int end_col,
> + int color
> + )
> +{
> + unsigned int row, col;
> + for (col = min(start_col, end_col); col < max(start_col,
> end_col); col++)
> + for (row = min(start_row, end_row); row <
> max(start_row, end_row); row++)
> + set_pixel_value(row, col, color);
> +}
>
> void
> lcd_invert_region(
> @@ -747,6 +769,47 @@
> else
> putstr("Need args: color [percent] [row offset]\n\r");
>
> +}
> +
> +void
> +command_lcd_fill_region(
> + int argc,
> + const char* argv[])
> +{
> + int start_row;
> + int end_row;
> + int start_col;
> + int end_col;
> + int color;
> +
> + if (argc < 6)
> + putstr("Need args: start_row start_col end_row end_col
> color\n\r");
> +
> + start_row = strtoul(argv[1], NULL, 0);
> + start_col = strtoul(argv[2], NULL, 0);
> + end_row = strtoul(argv[3], NULL, 0);
> + end_col = strtoul(argv[4], NULL, 0);
> + color = strtoul(argv[5], NULL, 0);
> + lcd_fill_region(start_row,start_col,end_row,end_col,color);
> +}
> +void
> +command_lcd_clear_region(
> + int argc,
> + const char* argv[])
> +{
> + int start_row;
> + int end_row;
> + int start_col;
> + int end_col;
> +
> + if (argc < 5)
> + putstr("Need args: start_row start_col end_row end_col\n\r");
> +
> + start_row = strtoul(argv[1], NULL, 0);
> + start_col = strtoul(argv[2], NULL, 0);
> + end_row = strtoul(argv[3], NULL, 0);
> + end_col = strtoul(argv[4], NULL, 0);
> + lcd_clear_region(start_row,start_col,end_row,end_col);
> }
>
> void
> diff -r -u -b bootldr.orig/lcd.h bootldr/lcd.h
> --- bootldr.orig/lcd.h Tue Mar 5 12:26:53 2002
> +++ bootldr/lcd.h Tue Mar 5 16:01:10 2002
> @@ -417,6 +417,23 @@
> char offTime);
>
> extern void
> +lcd_fill_region(
> + unsigned int start_row,
> + unsigned int start_col,
> + unsigned int end_row,
> + unsigned int end_col,
> + int color
> + );
> +
> +extern void
> +lcd_clear_region(
> + unsigned int start_row,
> + unsigned int start_col,
> + unsigned int end_row,
> + unsigned int end_col
> + );
> +
> +extern void
> lcd_invert_region(
> unsigned short start_row,
> unsigned short start_col,
> @@ -439,6 +456,8 @@
> void command_ser_con(int argc, const char* argv[]);
> void command_irda_con(int argc, const char* argv[]);
> void command_splash(int argc, const char* argv[]);
> +void command_lcd_fill_region(int argc,const char* argv[]);
> +void command_lcd_clear_region(int argc,const char* argv[]);
> void command_lcd_invert_region(int argc,const char* argv[]);
>
>
> diff -r -u -b bootldr.orig/load_kernel/src/jffs2.c
> bootldr/load_kernel/src/jffs2.c
> --- bootldr.orig/load_kernel/src/jffs2.c Tue Mar 5 12:26:53 2002
> +++ bootldr/load_kernel/src/jffs2.c Tue Mar 5 15:46:21 2002
> @@ -68,6 +68,8 @@
> #include "load_kernel.h"
> #include "jffs2.h"
> #include "crc32.h"
> +/* lcd.h has LCD_XRES and LCD_YRES */
> +#include "../../lcd.h"
>
> //#define D_PUTSTR(x) putstr((x))
> #define D_PUTSTR(x)
> @@ -75,7 +77,12 @@
> #define D_PUTLABELEDWORD(x,y)
> // for the lcd progress bar
> #define LCD_PB_COLOR 0xfff
> -#define LCD_PB_ROW 177
> +/* default Compaq bootloader splash */
> +#define LCD_PB_START_ROW 177
> +#define LCD_PB_START_COL 0
> +#define LCD_PB_END_ROW 202
> +#define LCD_PB_END_COL LCD_XRES
> +// #define LCD_PB_VERTICAL
>
> static struct jffs2_raw_dirent *find_inode(struct part_info
> *part, const char *name,
> u32 pino);
> @@ -1183,7 +1190,22 @@
> while (offset < max) {
> if (!(counter++ % 10000)){
> putstr(".");
> - lcd_bar(LCD_PB_COLOR,(offset*100)/max,LCD_PB_ROW);
> +#ifdef LCD_PB_VERTICAL
> + lcd_fill_region(
> + LCD_PB_START_ROW +
> + ((max - offset) * (LCD_PB_END_ROW -
> LCD_PB_START_ROW)) / max,
> + LCD_PB_START_COL,
> + LCD_PB_END_ROW,
> + LCD_PB_END_COL,
> + LCD_PB_COLOR);
> +#else
> + lcd_fill_region(
> + LCD_PB_START_ROW,
> + LCD_PB_START_COL,
> + LCD_PB_END_ROW,
> + LCD_PB_START_COL + (offset * (LCD_PB_END_COL
> - LCD_PB_START_COL)) / max,
> + LCD_PB_COLOR);
> +#endif
> button_check();
> if (get_last_buttonpress() > 0){
> // unhilite the old
> @@ -1321,7 +1343,11 @@
> // give visual feedback that we are done scanning the flash
> led_blink(0x0,0x0,0x1,0x1); // off, forever, on 100ms, off 100ms
> //reset the screen
> - lcd_bar_clear(100,LCD_PB_ROW);
> + lcd_clear_region(
> + LCD_PB_START_ROW,
> + LCD_PB_START_COL,
> + LCD_PB_END_ROW,
> + LCD_PB_END_COL);
> // exec whatever button was pressed and unhilite it.
> if (last_button > 0){
> hilite_button(last_button);
> ------ END UNIFIED DIFF -------------------------------
>
> --
> Sacha Chua <sachac@iname.com> 3 BS CS geekette =)
> Ateneo Cervini-Eliazo Networks (ACENT) tel: 63(2) 426-6001 loc 5925
> BOFH excuse #448: vi needs to be upgraded to vii
> _______________________________________________
> Bootldr mailing list
> Bootldr@handhelds.org
> http://handhelds.org/mailman/listinfo/bootldr
>



This archive was generated by hypermail 2.1.5 : Fri Jan 17 2003 - 17:47:03 EST