Port several bootloader size reductions and functional fixes from trunk in preparation for new archos flash ROM images. r18609 (disable font caching), r18614 (no idle callbacks), r18631+r18633 (full USB init), r18636 (ASCII-only sysfont), r18637 (main.c cleanup).

git-svn-id: svn://svn.rockbox.org/rockbox/branches/v3_0@18638 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2008-09-24 22:05:17 +00:00
parent 28a86faac7
commit d04a15e1a2
5 changed files with 84 additions and 63 deletions

View file

@ -12,6 +12,13 @@ INCLUDES=$(TARGET_INC) -Iinclude -I$(FIRMDIR) -Iexport -Icommon -Idrivers -I$(BU
CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(BUILDDATE) $(EXTRA_DEFINES) \
-DMEM=${MEMORYSIZE}
# Limits for the built-in sysfont: ASCII for bootloaders, ISO8859-1 for normal builds
ifneq (,$(findstring -DBOOTLOADER,$(EXTRA_DEFINES)))
MAXCHAR = 127
else
MAXCHAR = 255
endif
# This sets up 'SRC' based on the files mentioned in SOURCES
include $(TOOLSDIR)/makesrc.inc
@ -43,10 +50,10 @@ $(OBJDIR)/thread.o: thread.c export/thread.h
$(call PRINTS,CC thread.c)$(CC) -c -O -fomit-frame-pointer $(CFLAGS) $< -o $@
$(BUILDDIR)/sysfont.h: ../fonts/08-Schumacher-Clean.bdf
$(call PRINTS,Create sysfont.h)$(TOOLSDIR)/convbdf -l 255 -h -o $@ $<
$(call PRINTS,Create sysfont.h)$(TOOLSDIR)/convbdf -l $(MAXCHAR) -h -o $@ $<
$(OBJDIR)/sysfont.o: ../fonts/08-Schumacher-Clean.bdf
$(call PRINTS,CONVBDF)$(TOOLSDIR)/convbdf -l 255 -c -o $(OBJDIR)/sysfont.c $<
$(call PRINTS,CONVBDF)$(TOOLSDIR)/convbdf -l $(MAXCHAR) -c -o $(OBJDIR)/sysfont.c $<
$(call PRINTS,CC sysfont.c)$(CC) $(CFLAGS) -c $(OBJDIR)/sysfont.c -o $@
-include $(DEPFILE)

View file

@ -44,7 +44,8 @@ enum {
};
#define USING_ATA_CALLBACK !defined(SIMULATOR) \
&& !defined(HAVE_FLASH_DISK)
&& !defined(HAVE_FLASH_DISK) \
&& !defined(BOOTLOADER)
typedef bool (*ata_idle_notify)(void);

View file

@ -26,8 +26,6 @@
*/
#include "config.h"
#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR)
#include <stdio.h>
#include <string.h>
#include "inttypes.h"
@ -37,9 +35,12 @@
#include "debug.h"
#include "panic.h"
#include "rbunicode.h"
#ifndef BOOTLOADER
/* Font cache includes */
#include "font_cache.h"
#include "lru.h"
#endif
#ifndef O_BINARY
#define O_BINARY 0
@ -48,6 +49,8 @@
/* compiled-in font */
extern struct font sysfont;
#ifndef BOOTLOADER
/* structure filled in by font_load */
static struct font font_ui;
@ -378,27 +381,6 @@ struct font* font_get(int font)
panicf("No font!");
}
}
/*
* Returns the stringsize of a given string.
*/
int font_getstringsize(const unsigned char *str, int *w, int *h, int fontnumber)
{
struct font* pf = font_get(fontnumber);
unsigned short ch;
int width = 0;
for (str = utf8decode(str, &ch); ch != 0 ; str = utf8decode(str, &ch))
{
/* get proportional width and glyph bits*/
width += font_get_width(pf,ch);
}
if ( w )
*w = width;
if ( h )
*h = pf->height;
return width;
}
/*
* Reads an entry into cache entry
@ -565,8 +547,73 @@ static void glyph_cache_load(void)
}
return;
}
#else /* BOOTLOADER */
#endif /* HAVE_LCD_BITMAP */
void font_init(void)
{
}
/*
* Bootloader only supports the built-in sysfont.
*/
struct font* font_get(int font)
{
(void)font;
return &sysfont;
}
/*
* Returns width of character
*/
int font_get_width(struct font* pf, unsigned short char_code)
{
/* check input range*/
if (char_code < pf->firstchar || char_code >= pf->firstchar+pf->size)
char_code = pf->defaultchar;
char_code -= pf->firstchar;
return pf->width? pf->width[char_code]: pf->maxwidth;
}
const unsigned char* font_get_bits(struct font* pf, unsigned short char_code)
{
const unsigned char* bits;
/* check input range*/
if (char_code < pf->firstchar || char_code >= pf->firstchar+pf->size)
char_code = pf->defaultchar;
char_code -= pf->firstchar;
bits = pf->bits + (pf->offset?
pf->offset[char_code]:
(((pf->height + 7) / 8) * pf->maxwidth * char_code));
return bits;
}
#endif /* BOOTLOADER */
/*
* Returns the stringsize of a given string.
*/
int font_getstringsize(const unsigned char *str, int *w, int *h, int fontnumber)
{
struct font* pf = font_get(fontnumber);
unsigned short ch;
int width = 0;
for (str = utf8decode(str, &ch); ch != 0 ; str = utf8decode(str, &ch))
{
/* get proportional width and glyph bits*/
width += font_get_width(pf,ch);
}
if ( w )
*w = width;
if ( h )
*h = pf->height;
return width;
}
/* -----------------------------------------------------------------
* vim: et sw=4 ts=8 sts=4 tw=78

View file

@ -48,14 +48,12 @@
#include "logf.h"
/* Conditions under which we want the entire driver */
#if !defined(BOOTLOADER) || \
#if !defined(BOOTLOADER) || (CONFIG_CPU == SH7034) || \
(defined(TOSHIBA_GIGABEAT_S) && defined(USE_ROCKBOX_USB) && defined(USB_STORAGE)) || \
(defined(CREATIVE_ZVx) && defined(HAVE_USBSTACK))
#define USB_FULL_INIT
#endif
extern void dbg_ports(void); /* NASTY! defined in apps/ */
#ifdef HAVE_LCD_BITMAP
bool do_screendump_instead_of_usb = false;
#if defined(USB_FULL_INIT) && defined(BOOTLOADER)
@ -122,18 +120,7 @@ static void usb_slave_mode(bool on)
rc = ata_init();
if(rc)
{
/* fixme: can we remove this? (already such in main.c) */
char str[32];
lcd_clear_display();
snprintf(str, 31, "ATA error: %d", rc);
lcd_puts(0, 0, str);
lcd_puts(0, 1, "Press ON to debug");
lcd_update();
while(!(button_get(true) & BUTTON_REL)) {};
dbg_ports();
panicf("ata: %d",rc);
}
rc = disk_mount_all();
if (rc <= 0) /* no partition */

View file

@ -55,14 +55,12 @@ void usb_screen(void)
}
}
int show_logo(void)
void show_logo(void)
{
lcd_clear_display();
lcd_puts(0, 0, "Rockbox");
lcd_puts(0, 1, "Rescue boot");
lcd_update();
return 0;
}
#if CONFIG_CHARGING
@ -190,7 +188,6 @@ void main(void)
panicf("ata: %d", rc);
}
//disk_init();
usb_start_monitoring();
while (usb_detect() == USB_INSERTED)
{ /* enter USB mode early, before trying to mount */
@ -219,15 +216,6 @@ void main(void)
/* These functions are present in the firmware library, but we reimplement
them here because the originals do a lot more than we want */
void screen_dump(void)
{
}
int dbg_ports(void)
{
return 0;
}
void audio_stop(void)
{
}
@ -244,12 +232,3 @@ void audio_stop_recording(void)
void mp3_shutdown(void)
{
}
/*
void i2c_init(void)
{
}
void backlight_on(void)
{
}
*/