From d31a32c5012e4bc0eed9921e1783ed8f59d72e96 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Fri, 11 Nov 2005 17:51:35 +0000 Subject: [PATCH] iPod: Code cleanup - the bootloader now compiles with zero warnings git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7812 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/adc.c | 3 ++- firmware/drivers/ata.c | 5 ++-- firmware/drivers/button.c | 5 +++- firmware/drivers/i2c-pp5020.c | 12 ++++++--- firmware/drivers/lcd-16bit.c | 51 ++++++++++++++++++++--------------- firmware/drivers/lcd-ipod.c | 21 ++++++++++----- firmware/drivers/power.c | 8 +++--- firmware/export/button.h | 2 +- firmware/export/i2c-pp5020.h | 3 +-- firmware/export/system.h | 2 +- firmware/kernel.c | 6 ++--- firmware/rolo.c | 7 +++-- firmware/sound.c | 12 +++++++++ firmware/system.c | 2 +- firmware/thread.c | 7 ++--- firmware/timer.c | 13 ++++++++- firmware/usb.c | 10 ++++--- 17 files changed, 111 insertions(+), 58 deletions(-) diff --git a/firmware/drivers/adc.c b/firmware/drivers/adc.c index 665cd37f81..c79c22ce0f 100644 --- a/firmware/drivers/adc.c +++ b/firmware/drivers/adc.c @@ -256,10 +256,11 @@ void adc_init(void) #elif CONFIG_CPU == PP5020 -#warning Implement adc.c +/* TODO: Implement adc.c */ unsigned short adc_read(int channel) { + (void)channel; return 0; } diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 4ae6cbc944..dac94b0ea9 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -1247,7 +1247,8 @@ void ata_enable(bool on) #elif CONFIG_CPU == TCC730 #elif CONFIG_CPU == PP5020 - #warning Implement ata_enable() + /* TODO: Implement ata_enable() */ + (void)on; #endif } @@ -1400,7 +1401,7 @@ int ata_init(void) bool coldstart = (GPIO_FUNCTION & 0x00080000) == 0; #elif CONFIG_CPU == PP5020 bool coldstart = false; - #warning Implement coldstart variable + /* TODO: Implement coldstart variable */ #else bool coldstart = (PACR2 & 0x4000) != 0; #endif diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index 4d1652984b..1e3cbcbf32 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c @@ -563,7 +563,10 @@ static int button_read(void) data = P7; if (data & 0x01) btn |= BUTTON_ON; - + +#elif CONFIG_KEYPAD == IPOD_4G_PAD || CONFIG_KEYPAD == IPOD_NANO_PAD + /* TODO: Implement for iPod */ + (void)data; #endif /* CONFIG_KEYPAD */ diff --git a/firmware/drivers/i2c-pp5020.c b/firmware/drivers/i2c-pp5020.c index c08fad3b64..6f8d9a91d5 100644 --- a/firmware/drivers/i2c-pp5020.c +++ b/firmware/drivers/i2c-pp5020.c @@ -28,10 +28,12 @@ /* Local functions definitions */ +#if 0 static int i2c_write_byte(int device, unsigned char data); static int i2c_gen_start(int device); static void i2c_gen_stop(int device); static volatile unsigned char *i2c_get_addr(int device); +#endif #define IPOD_I2C_BASE 0x7000c000 #define IPOD_I2C_CTRL (IPOD_I2C_BASE+0x00) @@ -53,8 +55,8 @@ static volatile unsigned char *i2c_get_addr(int device); static int ipod_i2c_wait_not_busy(void) { - unsigned long timeout; #if 0 + unsigned long timeout; timeout = jiffies + POLL_TIMEOUT; while (time_before(jiffies, timeout)) { if (!(inb(IPOD_I2C_STATUS) & IPOD_I2C_BUSY)) { @@ -65,6 +67,7 @@ ipod_i2c_wait_not_busy(void) return -ETIMEDOUT; #endif + return 0; } @@ -81,8 +84,7 @@ void i2c_init(void) outl(0x0, 0x600060a4); outl(0x80 | (0 << 8), 0x600060a4); - i2c_readbyte(0x8, 0); - + //i2c_readbyte(0x8, 0); } void i2c_close(void) @@ -130,8 +132,9 @@ int i2c_write(int device, unsigned char *buf, int count) return count; } +#if 0 /* Write a byte to the interface, returns 0 on success, -1 otherwise. */ -int i2c_write_byte(int device, unsigned char data) +static int i2c_write_byte(int device, unsigned char data) { if (ipod_i2c_wait_not_busy() < 0) { return -2; @@ -179,6 +182,7 @@ void i2c_gen_stop(int device) regs[O_MBCR] &= ~MSTA; /* Clear MSTA to generate STOP */ } +#endif volatile unsigned char *i2c_get_addr(int device) { diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index 030df3efb1..933d02e64a 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c @@ -155,23 +155,26 @@ int lcd_getstringsize(const unsigned char *str, int *w, int *h) static void setpixel(int x, int y) { - unsigned short *data = &lcd_framebuffer[y][x*2]; + unsigned short *data = (unsigned short*)&lcd_framebuffer[y][x*2]; *data = fg_pattern; } static void clearpixel(int x, int y) { - unsigned short *data = &lcd_framebuffer[y][x*2]; + unsigned short *data = (unsigned short*)&lcd_framebuffer[y][x*2]; *data = bg_pattern; } static void flippixel(int x, int y) { /* What should this do on a color display? */ + (void)x; + (void)y; } static void nopixel(int x, int y) { + /* What should this do on a color display? */ (void)x; (void)y; } @@ -182,17 +185,18 @@ lcd_pixelfunc_type* const lcd_pixelfuncs[8] = { }; /* 'mask' and 'bits' contain 2 bits per pixel */ -static void flipblock(unsigned short *address, unsigned mask, unsigned bits) +static void flipblock(unsigned char *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void flipblock(unsigned short *address, unsigned mask, unsigned bits) +static void flipblock(unsigned char *address, unsigned mask, unsigned bits) { *address ^= bits & mask; } -static void bgblock(unsigned short *address, unsigned mask, unsigned bits) +static void bgblock(unsigned char *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void bgblock(unsigned short *address, unsigned mask, unsigned bits) +static void bgblock(unsigned char *address, unsigned mask, unsigned bits) { + (void)bits; if (mask > 0) { *address = bg_pattern; } else { @@ -200,10 +204,11 @@ static void bgblock(unsigned short *address, unsigned mask, unsigned bits) } } -static void fgblock(unsigned short *address, unsigned mask, unsigned bits) +static void fgblock(unsigned char *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void fgblock(unsigned short *address, unsigned mask, unsigned bits) +static void fgblock(unsigned char *address, unsigned mask, unsigned bits) { + (void)bits; if (mask > 0) { *address = fg_pattern; } else { @@ -211,40 +216,40 @@ static void fgblock(unsigned short *address, unsigned mask, unsigned bits) } } -static void solidblock(unsigned short *address, unsigned mask, unsigned bits) +static void solidblock(unsigned char *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void solidblock(unsigned short *address, unsigned mask, unsigned bits) +static void solidblock(unsigned char *address, unsigned mask, unsigned bits) { *address = (*address & ~mask) | (bits & mask & fg_pattern) | (~bits & mask & bg_pattern); } -static void flipinvblock(unsigned short *address, unsigned mask, unsigned bits) +static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void flipinvblock(unsigned short *address, unsigned mask, unsigned bits) +static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) { *address ^= ~bits & mask; } -static void bginvblock(unsigned short *address, unsigned mask, unsigned bits) +static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void bginvblock(unsigned short *address, unsigned mask, unsigned bits) +static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) { mask &= bits; *address = (*address & ~mask) | (bg_pattern & mask); } -static void fginvblock(unsigned short *address, unsigned mask, unsigned bits) +static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void fginvblock(unsigned short *address, unsigned mask, unsigned bits) +static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) { mask &= ~bits; *address = (*address & ~mask) | (fg_pattern & mask); } -static void solidinvblock(unsigned short *address, unsigned mask, unsigned bits) +static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void solidinvblock(unsigned short *address, unsigned mask, unsigned bits) +static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) { *address = (*address & ~mask) | (~bits & mask & fg_pattern) | (bits & mask & bg_pattern); @@ -536,9 +541,9 @@ void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, int out_x; int out_y; unsigned char pixel; - int src_width=src_x+width+stride; unsigned short* addr; + (void)stride; /* nothing to draw? */ if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT) || (x + width <= 0) || (y + height <= 0)) @@ -705,7 +710,7 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, /* Draw a full native bitmap */ void lcd_bitmap(const unsigned char *src, int x, int y, int width, int height) { - unsigned short* s=src; + unsigned short* s=(unsigned short*)src; unsigned short* d=(unsigned short*)&lcd_framebuffer[y][x*2]; int k=LCD_WIDTH-width; int i,j; @@ -782,16 +787,18 @@ void lcd_puts_style(int x, int y, const unsigned char *str, int style) xpos = xmargin + x*w / strlen(str); ypos = ymargin + y*h; lcd_putsxy(xpos, ypos, str); -#if 0 drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); + (void)style; +#if 0 + /* TODO: Implement lcd_fillrect */ lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); if (style & STYLE_INVERT) { drawmode = DRMODE_COMPLEMENT; lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, h); } - drawmode = lastmode; #endif + drawmode = lastmode; } /* put a string at a given char position */ diff --git a/firmware/drivers/lcd-ipod.c b/firmware/drivers/lcd-ipod.c index 96cdddaea7..ebb5d3c439 100644 --- a/firmware/drivers/lcd-ipod.c +++ b/firmware/drivers/lcd-ipod.c @@ -71,7 +71,7 @@ static int timer_get_current(void) } /* check if number of useconds has past */ -static int timer_check(int clock_start, int usecs) +static int timer_check(unsigned long clock_start, unsigned long usecs) { unsigned long clock; clock = inl(IPOD_PP5020_RTC); @@ -127,18 +127,21 @@ int lcd_default_contrast(void) void lcd_set_contrast(int val) { - #warning: Implement lcd_set_contrast() + /* TODO: Implement lcd_set_contrast() */ + (void)val; } void lcd_set_invert_display(bool yesno) { - #warning: Implement lcd_set_invert_display() + /* TODO: Implement lcd_set_invert_display() */ + (void)yesno; } /* turn the display upside down (call lcd_update() afterwards) */ void lcd_set_flip(bool yesno) { -#warning: Implement lcd_set_flip() + /* TODO: Implement lcd_set_flip() */ + (void)yesno; } /* Rolls up the lcd display by the specified amount of lines. @@ -150,8 +153,8 @@ void lcd_set_flip(bool yesno) * The value must be 0 <= pixels < LCD_HEIGHT. */ void lcd_roll(int lines) { + /* TODO: Implement lcd_roll() */ lines &= LCD_HEIGHT-1; -#warning: To do: Implement lcd_roll() } /* LCD init */ @@ -204,7 +207,13 @@ void lcd_init_device(void) void lcd_blit(const unsigned char* data, int x, int by, int width, int bheight, int stride) { - #warning Implement lcd_blit() + /* TODO: Implement lcd_blit() */ + (void)data; + (void)x; + (void)by; + (void)width; + (void)bheight; + (void)stride; } /* Update a fraction of the display. */ diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c index c7ef691f91..f96b600b6f 100644 --- a/firmware/drivers/power.c +++ b/firmware/drivers/power.c @@ -74,7 +74,7 @@ void power_init(void) spdif_power_enable(false); #endif #elif CONFIG_CPU == PP5020 -#warning Implement power_init() + /* TODO: Implement power_init() */ #else #ifdef HAVE_POWEROFF_ON_PB5 PBCR2 &= ~0x0c00; /* GPIO for PB5 */ @@ -166,7 +166,7 @@ void ide_power_enable(bool on) else or_l(0x80000000, &GPIO_OUT); #elif CONFIG_CPU == PP5020 -#warning Implement ide_power_enable() + /* TODO: Implement ide_power_enable() */ #elif defined(GMINI_ARCH) if(on) P1 |= 0x08; @@ -218,7 +218,7 @@ bool ide_powered(void) #if CONFIG_CPU == MCF5249 return (GPIO_OUT & 0x80000000)?false:true; #elif CONFIG_CPU == PP5020 -#warning Implement ide_powered() + /* TODO: Implement ide_powered() */ return true; #elif defined(GMINI_ARCH) return (P1 & 0x08?true:false); @@ -252,7 +252,7 @@ void power_off(void) #if CONFIG_CPU == MCF5249 and_l(~0x00080000, &GPIO1_OUT); #elif CONFIG_CPU == PP5020 -#warning Implement power_off() + /* TODO: Implement power_off() */ #elif defined(GMINI_ARCH) P1 &= ~1; P1CON &= ~1; diff --git a/firmware/export/button.h b/firmware/export/button.h index 61c722bfb2..b6b316637b 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h @@ -146,7 +146,7 @@ bool remote_button_hold(void); #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_NANO_PAD) -#warning Correct the IPOD definitions +/* TODO: Correct the IPOD definitions */ #define BUTTON_ON 0x0001 #define BUTTON_OFF 0x0002 diff --git a/firmware/export/i2c-pp5020.h b/firmware/export/i2c-pp5020.h index d26a7feab5..8487c678cf 100644 --- a/firmware/export/i2c-pp5020.h +++ b/firmware/export/i2c-pp5020.h @@ -26,13 +26,12 @@ #ifndef _I2C_ARM_H #define _I2C_ARM_H -#warning Implement: i2c-pp5020.h +/* TODO: Implement: i2c-pp5020.h */ void i2c_init(void); int i2c_write(int device, unsigned char *buf, int count); void i2c_close(void); - #define MAX_LOOP 0x100 /* TODO: select a better value */ /* PLLCR control */ diff --git a/firmware/export/system.h b/firmware/export/system.h index 15c6edb00e..c0c4fb9bea 100644 --- a/firmware/export/system.h +++ b/firmware/export/system.h @@ -294,7 +294,7 @@ static inline void invalidate_icache(void) #elif CONFIG_CPU == PP5020 -#warning Implement set_irq_level and check CPU frequencies +/* TODO: Implement set_irq_level and check CPU frequencies */ #define CPUFREQ_DEFAULT CPU_FREQ #define CPUFREQ_NORMAL 37500000 diff --git a/firmware/kernel.c b/firmware/kernel.c index 215d5de46b..239394a244 100644 --- a/firmware/kernel.c +++ b/firmware/kernel.c @@ -68,8 +68,7 @@ void sleep(int ticks) void yield(void) { #if CONFIG_CPU == PP5020 - /* Threading not yet implemented */ - #warning Enable yield() + /* TODO: Threading not yet implemented */ return; #endif switch_thread(); @@ -325,7 +324,8 @@ void tick_start(unsigned int interval_in_ms) #elif CONFIG_CPU == PP5020 void tick_start(unsigned int interval_in_ms) { -#warning Implement tick_start + /* TODO: Implement tick_start */ + (void)interval_in_ms; } #endif diff --git a/firmware/rolo.c b/firmware/rolo.c index 43f5031146..cecfa19045 100644 --- a/firmware/rolo.c +++ b/firmware/rolo.c @@ -73,6 +73,9 @@ void rolo_restart(const unsigned char* source, unsigned char* dest, : : "a"(dest) ); #endif +#if CONFIG_CPU == PP5020 + /* TODO: Implement for iPod */ +#endif } #endif @@ -89,7 +92,7 @@ int rolo_load(const char* filename) { int fd; long length; -#if CONFIG_CPU == MCF5249 +#if CONFIG_CPU == MCF5249 || CONFIG_CPU == PP5020 int i; unsigned long checksum,file_checksum; #else @@ -113,7 +116,7 @@ int rolo_load(const char* filename) length = filesize(fd) - FIRMWARE_OFFSET_FILE_DATA; -#if CONFIG_CPU == MCF5249 +#if CONFIG_CPU == MCF5249 || CONFIG_CPU == PP5020 /* Read and save checksum */ lseek(fd, FIRMWARE_OFFSET_FILE_CRC, SEEK_SET); if (read(fd, &file_checksum, 4) != 4) { diff --git a/firmware/sound.c b/firmware/sound.c index 9ed3283906..332cca02e8 100644 --- a/firmware/sound.c +++ b/firmware/sound.c @@ -399,6 +399,9 @@ void sound_set_volume(int value) #elif (CONFIG_CODEC == MAS3507D) || defined HAVE_UDA1380 current_volume = VOLUME_MIN + (value * VOLUME_RANGE / 100); set_prescaled_volume(); /* tenth of dB */ +#elif (CONFIG_CPU == PP5020) + /* TODO: Implement sound_set_volume() */ + (void)value; #endif } @@ -412,6 +415,9 @@ void sound_set_balance(int value) #elif CONFIG_CODEC == MAS3507D || defined HAVE_UDA1380 current_balance = value * VOLUME_RANGE / 100; /* tenth of dB */ set_prescaled_volume(); +#elif (CONFIG_CPU == PP5020) + /* TODO: Implement sound_set_balance() */ + (void)value; #endif } @@ -430,6 +436,9 @@ void sound_set_bass(int value) uda1380_set_bass(value >> 1); current_bass = value * 10; set_prescaled_volume(); +#elif (CONFIG_CPU == PP5020) + /* TODO: Implement sound_set_bass() */ + (void)value; #endif } @@ -448,6 +457,9 @@ void sound_set_treble(int value) uda1380_set_treble(value >> 1); current_treble = value * 10; set_prescaled_volume(); +#elif (CONFIG_CPU == PP5020) + /* TODO: Implement sound_set_treble() */ + (void)value; #endif } diff --git a/firmware/system.c b/firmware/system.c index cc4a5f0c85..cf8d180940 100644 --- a/firmware/system.c +++ b/firmware/system.c @@ -1106,7 +1106,7 @@ int system_memory_guard(int newmode) } #elif CONFIG_CPU==PP5020 -#warning TODO: Implement system.c +/* TODO: Implement system.c */ void system_init(void) { diff --git a/firmware/thread.c b/firmware/thread.c index 83607ea964..face2d2445 100644 --- a/firmware/thread.c +++ b/firmware/thread.c @@ -42,7 +42,7 @@ struct regs void *start; /* Thread start address, or NULL when started */ }; #elif CONFIG_CPU == PP5020 -#warning TODO: define struct regs +/* TODO: define struct regs */ struct regs { void *sp; /* Stack pointer (a15) */ @@ -80,15 +80,16 @@ static inline void load_context(const void* addr) __attribute__ ((always_inline) #if CONFIG_CPU == PP5020 -#warning TODO: Implement store_context and load_context +/* TODO: Implement store_context and load_context */ static inline void store_context(void* addr) { + (void)addr; } static inline void load_context(const void* addr) { - + (void)addr; } diff --git a/firmware/timer.c b/firmware/timer.c index e5b5b68b11..cdbd928d67 100644 --- a/firmware/timer.c +++ b/firmware/timer.c @@ -55,7 +55,13 @@ static bool timer_set(long cycles, bool start) { int phi = 0; /* bits for the prescaler */ int prescale = 1; - + +#if CONFIG_CPU==PP5020 + /* TODO: Implement for iPod */ + (void)start; + (void)phi; +#endif + #ifdef CPU_COLDFIRE cycles >>= 1; /* the coldfire timer works on busclk == cpuclk/2 */ #endif @@ -156,6 +162,11 @@ bool timer_register(int reg_prio, void (*unregister_callback)(void), if (reg_prio <= timer_prio || cycles == 0) return false; +#if CONFIG_CPU==PP5020 + /* TODO: Implement for iPod */ + (void)int_prio; +#endif + #if CONFIG_CPU == SH7034 if (int_prio < 1 || int_prio > 15) return false; diff --git a/firmware/usb.c b/firmware/usb.c index f69df5a87d..fd92f852ed 100644 --- a/firmware/usb.c +++ b/firmware/usb.c @@ -146,9 +146,8 @@ static void usb_enable(bool on) } #elif defined(USB_IPODSTYLE) - -#warning Implement USB_IPODSTYLE - + /* TODO: Implement USB_IPODSTYLE */ + (void) on; #else #ifdef HAVE_LCD_BITMAP if(read_hw_mask() & USB_ACTIVE_HIGH) @@ -364,7 +363,10 @@ bool usb_detect(void) /* TODO: add proper code code for H300 USB style */ current_status = false; #endif - +#ifdef USB_IPODSTYLE + /* TODO: Implement USB_IPODSTYLE */ + current_status = false; +#endif return current_status; }