diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/SOURCES | 2 | ||||
-rw-r--r-- | firmware/boot.lds | 2 | ||||
-rw-r--r-- | firmware/drivers/lcd-2bit-horz.c | 53 | ||||
-rw-r--r-- | firmware/drivers/lcd-ipod.c | 13 | ||||
-rw-r--r-- | firmware/drivers/power.c | 2 | ||||
-rw-r--r-- | firmware/export/config-ipod4g.h | 95 | ||||
-rw-r--r-- | firmware/export/config.h | 2 | ||||
-rw-r--r-- | firmware/usb.c | 2 |
8 files changed, 151 insertions, 20 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index ce7be4fe7a..4e32266654 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -112,7 +112,7 @@ drivers/mas.c | |||
112 | #ifdef IRIVER_H300_SERIES | 112 | #ifdef IRIVER_H300_SERIES |
113 | drivers/pcf50606.c | 113 | drivers/pcf50606.c |
114 | #endif | 114 | #endif |
115 | #if defined(APPLE_IPODCOLOR) || defined(APPLE_IPODNANO) || defined(APPLE_IPODVIDEO) || defined(APPLE_IPOD3G) | 115 | #if defined(APPLE_IPODCOLOR) || defined(APPLE_IPODNANO) || defined(APPLE_IPODVIDEO) || defined(APPLE_IPOD3G) || defined(APPLE_IPOD4G) |
116 | drivers/pcf50605.c | 116 | drivers/pcf50605.c |
117 | #endif | 117 | #endif |
118 | #if (CONFIG_RTC == RTC_M41ST84W) || (CONFIG_RTC == RTC_PCF50606) | 118 | #if (CONFIG_RTC == RTC_M41ST84W) || (CONFIG_RTC == RTC_PCF50606) |
diff --git a/firmware/boot.lds b/firmware/boot.lds index fc0d2c82c2..2f4594158e 100644 --- a/firmware/boot.lds +++ b/firmware/boot.lds | |||
@@ -52,7 +52,7 @@ INPUT(crt0.o) | |||
52 | #define FLASHSIZE 256K - ROM_START | 52 | #define FLASHSIZE 256K - ROM_START |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | #if (CONFIG_CPU!=PP5002) && (CONFIG_CPU!=PP5002) | 55 | #if (CONFIG_CPU!=PP5002) && (CONFIG_CPU!=PP5020) |
56 | MEMORY | 56 | MEMORY |
57 | { | 57 | { |
58 | DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE | 58 | DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE |
diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c index 01f5d93cf3..de1af90213 100644 --- a/firmware/drivers/lcd-2bit-horz.c +++ b/firmware/drivers/lcd-2bit-horz.c | |||
@@ -610,8 +610,27 @@ void lcd_putsxy(int x, int y, const unsigned char *str) | |||
610 | 610 | ||
611 | /*** line oriented text output ***/ | 611 | /*** line oriented text output ***/ |
612 | 612 | ||
613 | /* put a string at a given char position */ | ||
614 | void lcd_puts(int x, int y, const unsigned char *str) | ||
615 | { | ||
616 | lcd_puts_style_offset(x, y, str, STYLE_DEFAULT, 0); | ||
617 | } | ||
618 | |||
613 | void lcd_puts_style(int x, int y, const unsigned char *str, int style) | 619 | void lcd_puts_style(int x, int y, const unsigned char *str, int style) |
614 | { | 620 | { |
621 | lcd_puts_style_offset(x, y, str, style, 0); | ||
622 | } | ||
623 | |||
624 | void lcd_puts_offset(int x, int y, const unsigned char *str, int offset) | ||
625 | { | ||
626 | lcd_puts_style_offset(x, y, str, STYLE_DEFAULT, offset); | ||
627 | } | ||
628 | |||
629 | /* put a string at a given char position, style, and pixel position, | ||
630 | * skipping first offset pixel columns */ | ||
631 | void lcd_puts_style_offset(int x, int y, const unsigned char *str, | ||
632 | int style, int offset) | ||
633 | { | ||
615 | int xpos,ypos,w,h; | 634 | int xpos,ypos,w,h; |
616 | int lastmode = drawmode; | 635 | int lastmode = drawmode; |
617 | 636 | ||
@@ -624,23 +643,14 @@ void lcd_puts_style(int x, int y, const unsigned char *str, int style) | |||
624 | lcd_getstringsize(str, &w, &h); | 643 | lcd_getstringsize(str, &w, &h); |
625 | xpos = xmargin + x*w / utf8length((char *)str); | 644 | xpos = xmargin + x*w / utf8length((char *)str); |
626 | ypos = ymargin + y*h; | 645 | ypos = ymargin + y*h; |
627 | lcd_putsxy(xpos, ypos, str); | 646 | drawmode = (style & STYLE_INVERT) ? |
628 | drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); | 647 | (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; |
648 | lcd_putsxyofs(xpos, ypos, offset, str); | ||
649 | drawmode ^= DRMODE_INVERSEVID; | ||
629 | lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); | 650 | lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); |
630 | if (style & STYLE_INVERT) | ||
631 | { | ||
632 | drawmode = DRMODE_COMPLEMENT; | ||
633 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, h); | ||
634 | } | ||
635 | drawmode = lastmode; | 651 | drawmode = lastmode; |
636 | } | 652 | } |
637 | 653 | ||
638 | /* put a string at a given char position */ | ||
639 | void lcd_puts(int x, int y, const unsigned char *str) | ||
640 | { | ||
641 | lcd_puts_style(x, y, str, STYLE_DEFAULT); | ||
642 | } | ||
643 | |||
644 | /*** scrolling ***/ | 654 | /*** scrolling ***/ |
645 | 655 | ||
646 | /* Reverse the invert setting of the scrolling line (if any) at given char | 656 | /* Reverse the invert setting of the scrolling line (if any) at given char |
@@ -687,6 +697,17 @@ void lcd_puts_scroll(int x, int y, const unsigned char *string) | |||
687 | 697 | ||
688 | void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) | 698 | void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) |
689 | { | 699 | { |
700 | lcd_puts_scroll_style_offset(x, y, string, style, 0); | ||
701 | } | ||
702 | |||
703 | void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, int offset) | ||
704 | { | ||
705 | lcd_puts_scroll_style_offset(x, y, string, STYLE_DEFAULT, offset); | ||
706 | } | ||
707 | |||
708 | void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, | ||
709 | int style, int offset) | ||
710 | { | ||
690 | struct scrollinfo* s; | 711 | struct scrollinfo* s; |
691 | int w, h; | 712 | int w, h; |
692 | 713 | ||
@@ -696,10 +717,10 @@ void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) | |||
696 | s->invert = false; | 717 | s->invert = false; |
697 | if (style & STYLE_INVERT) { | 718 | if (style & STYLE_INVERT) { |
698 | s->invert = true; | 719 | s->invert = true; |
699 | lcd_puts_style(x,y,string,STYLE_INVERT); | 720 | lcd_puts_style_offset(x,y,string,STYLE_INVERT,offset); |
700 | } | 721 | } |
701 | else | 722 | else |
702 | lcd_puts(x,y,string); | 723 | lcd_puts_offset(x,y,string,offset); |
703 | 724 | ||
704 | lcd_getstringsize(string, &w, &h); | 725 | lcd_getstringsize(string, &w, &h); |
705 | 726 | ||
@@ -732,7 +753,7 @@ void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) | |||
732 | strncpy(end, (char *)string, LCD_WIDTH/2); | 753 | strncpy(end, (char *)string, LCD_WIDTH/2); |
733 | 754 | ||
734 | s->len = utf8length((char *)string); | 755 | s->len = utf8length((char *)string); |
735 | s->offset = 0; | 756 | s->offset = offset; |
736 | s->startx = x; | 757 | s->startx = x; |
737 | s->backward = false; | 758 | s->backward = false; |
738 | scrolling_lines |= (1<<y); | 759 | scrolling_lines |= (1<<y); |
diff --git a/firmware/drivers/lcd-ipod.c b/firmware/drivers/lcd-ipod.c index 2d165551e6..529509f4d8 100644 --- a/firmware/drivers/lcd-ipod.c +++ b/firmware/drivers/lcd-ipod.c | |||
@@ -156,6 +156,19 @@ void lcd_set_contrast(int val) | |||
156 | lcd_contrast = val; | 156 | lcd_contrast = val; |
157 | } | 157 | } |
158 | 158 | ||
159 | void lcd_set_invert_display(bool yesno) | ||
160 | { | ||
161 | /* TODO: Implement lcd_set_invert_display() */ | ||
162 | (void)yesno; | ||
163 | } | ||
164 | |||
165 | /* turn the display upside down (call lcd_update() afterwards) */ | ||
166 | void lcd_set_flip(bool yesno) | ||
167 | { | ||
168 | /* TODO: Implement lcd_set_flip() */ | ||
169 | (void)yesno; | ||
170 | } | ||
171 | |||
159 | void lcd_update_rect(int x, int y, int width, int height) | 172 | void lcd_update_rect(int x, int y, int width, int height) |
160 | { | 173 | { |
161 | int cursor_pos, xx; | 174 | int cursor_pos, xx; |
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c index 2150040dd6..5feece67f0 100644 --- a/firmware/drivers/power.c +++ b/firmware/drivers/power.c | |||
@@ -273,7 +273,7 @@ void power_off(void) | |||
273 | and_l(~0x00080000, &GPIO1_OUT); | 273 | and_l(~0x00080000, &GPIO1_OUT); |
274 | #elif defined(IAUDIO_X5) | 274 | #elif defined(IAUDIO_X5) |
275 | and_l(~0x00000008, &GPIO_OUT); | 275 | and_l(~0x00000008, &GPIO_OUT); |
276 | #elif (CONFIG_CPU == PP5002) || (CONFIG_CPU == PP5002) | 276 | #elif (CONFIG_CPU == PP5002) || (CONFIG_CPU == PP5020) |
277 | #ifndef BOOTLOADER | 277 | #ifndef BOOTLOADER |
278 | /* We don't turn off the ipod, we put it in a deep sleep */ | 278 | /* We don't turn off the ipod, we put it in a deep sleep */ |
279 | pcf50605_standby_mode(); | 279 | pcf50605_standby_mode(); |
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h new file mode 100644 index 0000000000..de0388dbb1 --- /dev/null +++ b/firmware/export/config-ipod4g.h | |||
@@ -0,0 +1,95 @@ | |||
1 | /* | ||
2 | * This config file is for the Apple iPod Color/Photo | ||
3 | */ | ||
4 | #define APPLE_IPOD4G 1 | ||
5 | |||
6 | /* For Rolo and boot loader */ | ||
7 | #define MODEL_NUMBER 8 | ||
8 | |||
9 | /* define this if you have recording possibility */ | ||
10 | /*#define HAVE_RECORDING 1*/ | ||
11 | |||
12 | /* define this if you have a bitmap LCD display */ | ||
13 | #define HAVE_LCD_BITMAP 1 | ||
14 | |||
15 | /* LCD dimensions */ | ||
16 | #define LCD_WIDTH 160 | ||
17 | #define LCD_HEIGHT 128 | ||
18 | #define LCD_DEPTH 2 /* 4 colours - 2bpp */ | ||
19 | |||
20 | #define CONFIG_KEYPAD IPOD_4G_PAD | ||
21 | |||
22 | /* Define this if you do software codec */ | ||
23 | #define CONFIG_CODEC SWCODEC | ||
24 | |||
25 | /* define this if you have a real-time clock */ | ||
26 | #ifndef BOOTLOADER | ||
27 | #define CONFIG_RTC RTC_PCF50605 | ||
28 | #endif | ||
29 | |||
30 | /* Define this if you have a software controlled poweroff */ | ||
31 | #define HAVE_SW_POWEROFF | ||
32 | |||
33 | /* The number of bytes reserved for loadable codecs */ | ||
34 | #define CODEC_SIZE 0x80000 | ||
35 | |||
36 | /* The number of bytes reserved for loadable plugins */ | ||
37 | #define PLUGIN_BUFFER_SIZE 0x80000 | ||
38 | |||
39 | /* Define this if you have the WM8975 audio codec */ | ||
40 | #define HAVE_WM8975 | ||
41 | |||
42 | /* Define this for LCD backlight available */ | ||
43 | #define CONFIG_BACKLIGHT BL_IPOD4G /* port controlled */ | ||
44 | |||
45 | #ifndef SIMULATOR | ||
46 | |||
47 | /* Define this if you have a PortalPlayer PP5020 */ | ||
48 | #define CONFIG_CPU PP5020 | ||
49 | |||
50 | /* Define this if you want to use the PP5020 i2c interface */ | ||
51 | #define CONFIG_I2C I2C_PP5020 | ||
52 | |||
53 | /* Type of mobile power */ | ||
54 | //#define CONFIG_BATTERY BATT_LIPOL1300 | ||
55 | |||
56 | #define BATTERY_SCALE_FACTOR 16665 /* FIX: this value is picked at random */ | ||
57 | |||
58 | /* Define this if the platform can charge batteries */ | ||
59 | //#define HAVE_CHARGING 1 | ||
60 | |||
61 | /* define this if the hardware can be powered off while charging */ | ||
62 | //#define HAVE_POWEROFF_WHILE_CHARGING | ||
63 | |||
64 | /* The start address index for ROM builds */ | ||
65 | #define ROM_START 0x00000000 | ||
66 | |||
67 | /* Define this to the CPU frequency */ | ||
68 | #define CPU_FREQ 11289600 | ||
69 | |||
70 | #define CONFIG_LCD LCD_IPOD2BPP | ||
71 | |||
72 | /* Offset ( in the firmware file's header ) to the file length */ | ||
73 | #define FIRMWARE_OFFSET_FILE_LENGTH 0 | ||
74 | |||
75 | /* Offset ( in the firmware file's header ) to the file CRC */ | ||
76 | #define FIRMWARE_OFFSET_FILE_CRC 0 | ||
77 | |||
78 | /* Offset ( in the firmware file's header ) to the real data */ | ||
79 | #define FIRMWARE_OFFSET_FILE_DATA 8 | ||
80 | |||
81 | #define USB_IPODSTYLE | ||
82 | |||
83 | /* define this if the unit can be powered or charged via USB */ | ||
84 | #define HAVE_USB_POWER | ||
85 | |||
86 | /* Virtual LED (icon) */ | ||
87 | #define CONFIG_LED LED_VIRTUAL | ||
88 | |||
89 | /* Define this if you have adjustable CPU frequency */ | ||
90 | //#define HAVE_ADJUSTABLE_CPU_FREQ | ||
91 | |||
92 | #define BOOTFILE_EXT "ipod" | ||
93 | #define BOOTFILE "rockbox." BOOTFILE_EXT | ||
94 | |||
95 | #endif | ||
diff --git a/firmware/export/config.h b/firmware/export/config.h index f451173d06..22352f5e53 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -153,6 +153,8 @@ | |||
153 | #include "config-ipodvideo.h" | 153 | #include "config-ipodvideo.h" |
154 | #elif defined(IPOD_3G) | 154 | #elif defined(IPOD_3G) |
155 | #include "config-ipod3g.h" | 155 | #include "config-ipod3g.h" |
156 | #elif defined(IPOD_4G) | ||
157 | #include "config-ipod4g.h" | ||
156 | #elif defined(IRIVER_IFP7XX) | 158 | #elif defined(IRIVER_IFP7XX) |
157 | #include "config-ifp7xx.h" | 159 | #include "config-ifp7xx.h" |
158 | #else | 160 | #else |
diff --git a/firmware/usb.c b/firmware/usb.c index 32e98ef6ce..1c90d63519 100644 --- a/firmware/usb.c +++ b/firmware/usb.c | |||
@@ -172,7 +172,7 @@ void usb_enable(bool on) | |||
172 | if (on) | 172 | if (on) |
173 | { | 173 | { |
174 | /* The following code is copied from ipodlinux */ | 174 | /* The following code is copied from ipodlinux */ |
175 | #if defined (APPLE_IPODCOLOR) || defined(APPLE_IPOD3G) | 175 | #if defined (APPLE_IPODCOLOR) || defined(APPLE_IPOD3G) || defined(APPLE_IPOD4G) |
176 | unsigned char* storage_ptr = (unsigned char *)0x40017F00; | 176 | unsigned char* storage_ptr = (unsigned char *)0x40017F00; |
177 | #elif defined(APPLE_IPODNANO) || defined(APPLE_IPODVIDEO) | 177 | #elif defined(APPLE_IPODNANO) || defined(APPLE_IPODVIDEO) |
178 | unsigned char* storage_ptr = (unsigned char *)0x4001FF00; | 178 | unsigned char* storage_ptr = (unsigned char *)0x4001FF00; |