diff options
author | Marcoen Hirschberg <marcoen@gmail.com> | 2007-04-19 10:14:55 +0000 |
---|---|---|
committer | Marcoen Hirschberg <marcoen@gmail.com> | 2007-04-19 10:14:55 +0000 |
commit | 6ffbe3896b89ce86cccfe3b1f492f60e34d89603 (patch) | |
tree | b6b845fc876b0d98b793aefa906f5d5eab6993f5 /firmware/target/arm/pnx0101/iriver-ifp7xx | |
parent | 710a9ca194316d3a269a3c3dd2e603768da5a780 (diff) | |
download | rockbox-6ffbe3896b89ce86cccfe3b1f492f60e34d89603.tar.gz rockbox-6ffbe3896b89ce86cccfe3b1f492f60e34d89603.zip |
move the iriver ifp7xx and other pnx0101 related files together in the target tree
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13207 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/pnx0101/iriver-ifp7xx')
9 files changed, 641 insertions, 0 deletions
diff --git a/firmware/target/arm/pnx0101/iriver-ifp7xx/adc-ifp7xx.c b/firmware/target/arm/pnx0101/iriver-ifp7xx/adc-ifp7xx.c new file mode 100644 index 0000000000..79b1ad0fcb --- /dev/null +++ b/firmware/target/arm/pnx0101/iriver-ifp7xx/adc-ifp7xx.c | |||
@@ -0,0 +1,57 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include "cpu.h" | ||
21 | #include "system.h" | ||
22 | #include "kernel.h" | ||
23 | #include "thread.h" | ||
24 | #include "adc.h" | ||
25 | |||
26 | static unsigned short adcdata[NUM_ADC_CHANNELS]; | ||
27 | |||
28 | unsigned short adc_read(int channel) | ||
29 | { | ||
30 | return adcdata[channel]; | ||
31 | } | ||
32 | |||
33 | static void adc_tick(void) | ||
34 | { | ||
35 | if (ADCST & 0x10) { | ||
36 | adcdata[0] = ADCCH0 & 0x3ff; | ||
37 | adcdata[1] = ADCCH1 & 0x3ff; | ||
38 | adcdata[2] = ADCCH2 & 0x3ff; | ||
39 | adcdata[3] = ADCCH3 & 0x3ff; | ||
40 | adcdata[4] = ADCCH4 & 0x3ff; | ||
41 | ADCST = 0xa; | ||
42 | } | ||
43 | } | ||
44 | |||
45 | void adc_init(void) | ||
46 | { | ||
47 | ADCR24 = 0xaaaaa; | ||
48 | ADCR28 = 0; | ||
49 | ADCST = 2; | ||
50 | ADCST = 0xa; | ||
51 | |||
52 | while (!(ADCST & 0x10)); | ||
53 | adc_tick(); | ||
54 | |||
55 | tick_add_task(adc_tick); | ||
56 | } | ||
57 | |||
diff --git a/firmware/target/arm/pnx0101/iriver-ifp7xx/adc-target.h b/firmware/target/arm/pnx0101/iriver-ifp7xx/adc-target.h new file mode 100644 index 0000000000..8e5e6edbc5 --- /dev/null +++ b/firmware/target/arm/pnx0101/iriver-ifp7xx/adc-target.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef _ADC_TARGET_H_ | ||
20 | #define _ADC_TARGET_H_ | ||
21 | |||
22 | #define NUM_ADC_CHANNELS 5 | ||
23 | |||
24 | #define ADC_BUTTONS 0 | ||
25 | #define ADC_BATTERY 1 | ||
26 | #define ADC_BUTTON_PLAY 2 | ||
27 | #define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */ | ||
28 | |||
29 | #endif | ||
diff --git a/firmware/target/arm/pnx0101/iriver-ifp7xx/backlight-ifp7xx.c b/firmware/target/arm/pnx0101/iriver-ifp7xx/backlight-ifp7xx.c new file mode 100644 index 0000000000..c0dc3974c0 --- /dev/null +++ b/firmware/target/arm/pnx0101/iriver-ifp7xx/backlight-ifp7xx.c | |||
@@ -0,0 +1,33 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include "cpu.h" | ||
21 | #include "system.h" | ||
22 | #include "backlight.h" | ||
23 | #include "lcd.h" | ||
24 | |||
25 | void __backlight_on(void) | ||
26 | { | ||
27 | GPIO3_SET = 1; | ||
28 | } | ||
29 | |||
30 | void __backlight_off(void) | ||
31 | { | ||
32 | GPIO3_CLR = 1; | ||
33 | } | ||
diff --git a/firmware/target/arm/pnx0101/iriver-ifp7xx/button-ifp7xx.c b/firmware/target/arm/pnx0101/iriver-ifp7xx/button-ifp7xx.c new file mode 100644 index 0000000000..52e29fdfdf --- /dev/null +++ b/firmware/target/arm/pnx0101/iriver-ifp7xx/button-ifp7xx.c | |||
@@ -0,0 +1,89 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | |||
21 | #include <stdlib.h> | ||
22 | #include "config.h" | ||
23 | #include "cpu.h" | ||
24 | #include "system.h" | ||
25 | #include "button.h" | ||
26 | #include "kernel.h" | ||
27 | #include "backlight.h" | ||
28 | #include "adc.h" | ||
29 | #include "system.h" | ||
30 | |||
31 | |||
32 | void button_init_device(void) | ||
33 | { | ||
34 | |||
35 | } | ||
36 | |||
37 | bool button_hold(void) | ||
38 | { | ||
39 | return (GPIO5_READ & 4) ? false : true; | ||
40 | } | ||
41 | |||
42 | /* | ||
43 | * Get button pressed from hardware | ||
44 | */ | ||
45 | int button_read_device(void) | ||
46 | { | ||
47 | int btn = BUTTON_NONE; | ||
48 | int data; | ||
49 | static bool hold_button = false; | ||
50 | bool hold_button_old; | ||
51 | |||
52 | /* normal buttons */ | ||
53 | hold_button_old = hold_button; | ||
54 | hold_button = button_hold(); | ||
55 | |||
56 | if (hold_button != hold_button_old) | ||
57 | backlight_hold_changed(hold_button); | ||
58 | |||
59 | if (!button_hold()) | ||
60 | { | ||
61 | data = adc_read(ADC_BUTTONS); | ||
62 | if (data < 0x35c) | ||
63 | { | ||
64 | if (data < 0x151) | ||
65 | if (data < 0xc7) | ||
66 | if (data < 0x41) | ||
67 | btn = BUTTON_LEFT; | ||
68 | else | ||
69 | btn = BUTTON_RIGHT; | ||
70 | else | ||
71 | btn = BUTTON_SELECT; | ||
72 | else | ||
73 | if (data < 0x268) | ||
74 | if (data < 0x1d7) | ||
75 | btn = BUTTON_UP; | ||
76 | else | ||
77 | btn = BUTTON_DOWN; | ||
78 | else | ||
79 | if (data < 0x2f9) | ||
80 | btn = BUTTON_EQ; | ||
81 | else | ||
82 | btn = BUTTON_MODE; | ||
83 | } | ||
84 | |||
85 | if (adc_read(ADC_BUTTON_PLAY) < 0x64) | ||
86 | btn |= BUTTON_PLAY; | ||
87 | } | ||
88 | return btn; | ||
89 | } | ||
diff --git a/firmware/target/arm/pnx0101/iriver-ifp7xx/button-target.h b/firmware/target/arm/pnx0101/iriver-ifp7xx/button-target.h new file mode 100644 index 0000000000..954a2dfe9c --- /dev/null +++ b/firmware/target/arm/pnx0101/iriver-ifp7xx/button-target.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | /* Custom written for the ifp7xx */ | ||
21 | |||
22 | #ifndef _BUTTON_TARGET_H_ | ||
23 | #define _BUTTON_TARGET_H_ | ||
24 | |||
25 | #include <stdbool.h> | ||
26 | #include "config.h" | ||
27 | |||
28 | #define HAS_BUTTON_HOLD | ||
29 | |||
30 | bool button_hold(void); | ||
31 | void button_init_device(void); | ||
32 | int button_read_device(void); | ||
33 | |||
34 | /* iriver IFP7XX specific button codes */ | ||
35 | |||
36 | #define BUTTON_PLAY 0x00000001 | ||
37 | #define BUTTON_SELECT 0x00000002 | ||
38 | |||
39 | #define BUTTON_LEFT 0x00000004 | ||
40 | #define BUTTON_RIGHT 0x00000008 | ||
41 | #define BUTTON_UP 0x00000010 | ||
42 | #define BUTTON_DOWN 0x00000020 | ||
43 | |||
44 | #define BUTTON_MODE 0x00000040 | ||
45 | #define BUTTON_EQ 0x00000080 | ||
46 | |||
47 | #define BUTTON_MAIN (BUTTON_PLAY|BUTTON_SELECT\ | ||
48 | |BUTTON_LEFT|BUTTON_RIGHT|BUTTON_UP|BUTTON_DOWN\ | ||
49 | |BUTTON_MODE|BUTTON_EQ) | ||
50 | |||
51 | #define BUTTON_REMOTE 0 | ||
52 | |||
53 | #define POWEROFF_BUTTON BUTTON_PLAY | ||
54 | #define POWEROFF_COUNT 40 | ||
55 | |||
56 | #endif /* _BUTTON_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/pnx0101/iriver-ifp7xx/lcd-ifp7xx.c b/firmware/target/arm/pnx0101/iriver-ifp7xx/lcd-ifp7xx.c new file mode 100644 index 0000000000..0aacd8af67 --- /dev/null +++ b/firmware/target/arm/pnx0101/iriver-ifp7xx/lcd-ifp7xx.c | |||
@@ -0,0 +1,208 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Alan Korr | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | |||
21 | #include "kernel.h" | ||
22 | #include "lcd.h" | ||
23 | #include "system.h" | ||
24 | |||
25 | /*** definitions ***/ | ||
26 | |||
27 | #define LCD_SET_LOWER_COLUMN_ADDRESS ((char)0x00) | ||
28 | #define LCD_SET_HIGHER_COLUMN_ADDRESS ((char)0x10) | ||
29 | #define LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO ((char)0x20) | ||
30 | #define LCD_SET_POWER_CONTROL_REGISTER ((char)0x28) | ||
31 | #define LCD_SET_DISPLAY_START_LINE ((char)0x40) | ||
32 | #define LCD_SET_CONTRAST_CONTROL_REGISTER ((char)0x81) | ||
33 | #define LCD_SET_SEGMENT_REMAP ((char)0xA0) | ||
34 | #define LCD_SET_LCD_BIAS ((char)0xA2) | ||
35 | #define LCD_SET_ENTIRE_DISPLAY_OFF ((char)0xA4) | ||
36 | #define LCD_SET_ENTIRE_DISPLAY_ON ((char)0xA5) | ||
37 | #define LCD_SET_NORMAL_DISPLAY ((char)0xA6) | ||
38 | #define LCD_SET_REVERSE_DISPLAY ((char)0xA7) | ||
39 | #define LCD_SET_MULTIPLEX_RATIO ((char)0xA8) | ||
40 | #define LCD_SET_BIAS_TC_OSC ((char)0xA9) | ||
41 | #define LCD_SET_1OVER4_BIAS_RATIO ((char)0xAA) | ||
42 | #define LCD_SET_INDICATOR_OFF ((char)0xAC) | ||
43 | #define LCD_SET_INDICATOR_ON ((char)0xAD) | ||
44 | #define LCD_SET_DISPLAY_OFF ((char)0xAE) | ||
45 | #define LCD_SET_DISPLAY_ON ((char)0xAF) | ||
46 | #define LCD_SET_PAGE_ADDRESS ((char)0xB0) | ||
47 | #define LCD_SET_COM_OUTPUT_SCAN_DIRECTION ((char)0xC0) | ||
48 | #define LCD_SET_TOTAL_FRAME_PHASES ((char)0xD2) | ||
49 | #define LCD_SET_DISPLAY_OFFSET ((char)0xD3) | ||
50 | #define LCD_SET_READ_MODIFY_WRITE_MODE ((char)0xE0) | ||
51 | #define LCD_SOFTWARE_RESET ((char)0xE2) | ||
52 | #define LCD_NOP ((char)0xE3) | ||
53 | #define LCD_SET_END_OF_READ_MODIFY_WRITE_MODE ((char)0xEE) | ||
54 | |||
55 | /* LCD command codes */ | ||
56 | #define LCD_CNTL_RESET 0xe2 /* Software reset */ | ||
57 | #define LCD_CNTL_POWER 0x2f /* Power control */ | ||
58 | #define LCD_CNTL_CONTRAST 0x81 /* Contrast */ | ||
59 | #define LCD_CNTL_OUTSCAN 0xc8 /* Output scan direction */ | ||
60 | #define LCD_CNTL_SEGREMAP 0xa1 /* Segment remap */ | ||
61 | #define LCD_CNTL_DISPON 0xaf /* Display on */ | ||
62 | |||
63 | #define LCD_CNTL_PAGE 0xb0 /* Page address */ | ||
64 | #define LCD_CNTL_HIGHCOL 0x10 /* Upper column address */ | ||
65 | #define LCD_CNTL_LOWCOL 0x00 /* Lower column address */ | ||
66 | |||
67 | /*** driver routines ***/ | ||
68 | |||
69 | void lcd_write_command(int cmd) | ||
70 | { | ||
71 | while ((LCDSTAT & 3) != 3); | ||
72 | LCDCMD = cmd; | ||
73 | } | ||
74 | |||
75 | void lcd_write_data( const unsigned char* data, int count ) | ||
76 | { | ||
77 | int i; | ||
78 | for (i=0; i < count; i++) { | ||
79 | while ((LCDSTAT & 3) != 3); | ||
80 | LCDDATA = data[i]; | ||
81 | } | ||
82 | } | ||
83 | |||
84 | /*** hardware configuration ***/ | ||
85 | |||
86 | int lcd_default_contrast(void) | ||
87 | { | ||
88 | return 45; | ||
89 | } | ||
90 | |||
91 | void lcd_set_contrast(int val) | ||
92 | { | ||
93 | lcd_write_command(LCD_CNTL_CONTRAST); | ||
94 | lcd_write_command(val); | ||
95 | } | ||
96 | |||
97 | void lcd_set_invert_display(bool yesno) | ||
98 | { | ||
99 | if (yesno) | ||
100 | lcd_write_command(LCD_SET_REVERSE_DISPLAY); | ||
101 | else | ||
102 | lcd_write_command(LCD_SET_NORMAL_DISPLAY); | ||
103 | } | ||
104 | |||
105 | /* turn the display upside down (call lcd_update() afterwards) */ | ||
106 | void lcd_set_flip(bool yesno) | ||
107 | { | ||
108 | if (yesno) | ||
109 | { | ||
110 | lcd_write_command(LCD_SET_SEGMENT_REMAP); | ||
111 | lcd_write_command(LCD_SET_COM_OUTPUT_SCAN_DIRECTION); | ||
112 | } | ||
113 | else | ||
114 | { | ||
115 | lcd_write_command(LCD_SET_SEGMENT_REMAP | 0x01); | ||
116 | lcd_write_command(LCD_SET_COM_OUTPUT_SCAN_DIRECTION | 0x08); | ||
117 | } | ||
118 | } | ||
119 | |||
120 | void lcd_init_device(void) | ||
121 | { | ||
122 | LCDREG10 = 0xf; | ||
123 | LCDREG04 = 0x4084; | ||
124 | |||
125 | /* inits like the original firmware */ | ||
126 | lcd_write_command(LCD_SOFTWARE_RESET); | ||
127 | lcd_write_command(LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO + 4); | ||
128 | lcd_write_command(LCD_SET_LCD_BIAS); | ||
129 | lcd_write_command(LCD_SET_POWER_CONTROL_REGISTER + 7); | ||
130 | /* power control register: op-amp=1, regulator=1, booster=1 */ | ||
131 | lcd_write_command(LCD_SET_DISPLAY_ON); | ||
132 | lcd_write_command(LCD_SET_NORMAL_DISPLAY); | ||
133 | lcd_set_flip(false); | ||
134 | lcd_write_command(LCD_SET_DISPLAY_START_LINE + 0); | ||
135 | lcd_set_contrast(lcd_default_contrast()); | ||
136 | lcd_write_command(LCD_SET_PAGE_ADDRESS); | ||
137 | lcd_write_command(LCD_SET_LOWER_COLUMN_ADDRESS + 0); | ||
138 | lcd_write_command(LCD_SET_HIGHER_COLUMN_ADDRESS + 0); | ||
139 | |||
140 | lcd_clear_display(); | ||
141 | lcd_update(); | ||
142 | } | ||
143 | |||
144 | /*** Update functions ***/ | ||
145 | |||
146 | /* Performance function that works with an external buffer | ||
147 | note that by and bheight are in 8-pixel units! */ | ||
148 | void lcd_blit(const unsigned char* data, int x, int by, int width, | ||
149 | int bheight, int stride) | ||
150 | { | ||
151 | /* Copy display bitmap to hardware */ | ||
152 | while (bheight--) | ||
153 | { | ||
154 | lcd_write_command (LCD_CNTL_PAGE | (by++ & 0xf)); | ||
155 | lcd_write_command (LCD_CNTL_HIGHCOL | (((x+4)>>4) & 0xf)); | ||
156 | lcd_write_command (LCD_CNTL_LOWCOL | ((x+4) & 0xf)); | ||
157 | |||
158 | lcd_write_data(data, width); | ||
159 | data += stride; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | |||
164 | /* Update the display. | ||
165 | This must be called after all other LCD functions that change the display. */ | ||
166 | void lcd_update(void) ICODE_ATTR; | ||
167 | void lcd_update(void) | ||
168 | { | ||
169 | int y; | ||
170 | |||
171 | /* Copy display bitmap to hardware */ | ||
172 | for (y = 0; y < LCD_FBHEIGHT; y++) | ||
173 | { | ||
174 | lcd_write_command (LCD_CNTL_PAGE | (y & 0xf)); | ||
175 | lcd_write_command (LCD_CNTL_HIGHCOL); | ||
176 | lcd_write_command (LCD_CNTL_LOWCOL | 4); | ||
177 | |||
178 | lcd_write_data (lcd_framebuffer[y], LCD_WIDTH); | ||
179 | } | ||
180 | } | ||
181 | |||
182 | /* Update a fraction of the display. */ | ||
183 | void lcd_update_rect(int, int, int, int) ICODE_ATTR; | ||
184 | void lcd_update_rect(int x, int y, int width, int height) | ||
185 | { | ||
186 | int ymax; | ||
187 | |||
188 | /* The Y coordinates have to work on even 8 pixel rows */ | ||
189 | ymax = (y + height-1) >> 3; | ||
190 | y >>= 3; | ||
191 | |||
192 | if(x + width > LCD_WIDTH) | ||
193 | width = LCD_WIDTH - x; | ||
194 | if (width <= 0) | ||
195 | return; /* nothing left to do, 0 is harmful to lcd_write_data() */ | ||
196 | if(ymax >= LCD_FBHEIGHT) | ||
197 | ymax = LCD_FBHEIGHT-1; | ||
198 | |||
199 | /* Copy specified rectange bitmap to hardware */ | ||
200 | for (; y <= ymax; y++) | ||
201 | { | ||
202 | lcd_write_command (LCD_CNTL_PAGE | (y & 0xf)); | ||
203 | lcd_write_command (LCD_CNTL_HIGHCOL | (((x+4) >> 4) & 0xf)); | ||
204 | lcd_write_command (LCD_CNTL_LOWCOL | ((x+4) & 0xf)); | ||
205 | |||
206 | lcd_write_data (&lcd_framebuffer[y][x], width); | ||
207 | } | ||
208 | } | ||
diff --git a/firmware/target/arm/pnx0101/iriver-ifp7xx/power-ifp7xx.c b/firmware/target/arm/pnx0101/iriver-ifp7xx/power-ifp7xx.c new file mode 100644 index 0000000000..4e4f585298 --- /dev/null +++ b/firmware/target/arm/pnx0101/iriver-ifp7xx/power-ifp7xx.c | |||
@@ -0,0 +1,85 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include "cpu.h" | ||
21 | #include <stdbool.h> | ||
22 | #include "adc.h" | ||
23 | #include "kernel.h" | ||
24 | #include "system.h" | ||
25 | #include "power.h" | ||
26 | #include "logf.h" | ||
27 | #include "usb.h" | ||
28 | |||
29 | #if CONFIG_TUNER | ||
30 | |||
31 | static bool powered = false; | ||
32 | |||
33 | bool radio_powered(void) | ||
34 | { | ||
35 | return powered; | ||
36 | } | ||
37 | |||
38 | bool radio_power(bool status) | ||
39 | { | ||
40 | bool old_status = powered; | ||
41 | powered = status; | ||
42 | |||
43 | return old_status; | ||
44 | } | ||
45 | |||
46 | #endif /* #if CONFIG_TUNER */ | ||
47 | |||
48 | #ifndef SIMULATOR | ||
49 | |||
50 | void power_init(void) | ||
51 | { | ||
52 | } | ||
53 | |||
54 | void ide_power_enable(bool on) | ||
55 | { | ||
56 | (void)on; | ||
57 | /* no ide controller */ | ||
58 | } | ||
59 | |||
60 | bool ide_powered(void) | ||
61 | { | ||
62 | return true; /* pretend always powered if not controlable */ | ||
63 | } | ||
64 | |||
65 | void power_off(void) | ||
66 | { | ||
67 | set_irq_level(HIGHEST_IRQ_LEVEL); | ||
68 | GPIO1_CLR = 1 << 16; | ||
69 | GPIO2_SET = 1; | ||
70 | while(1) | ||
71 | yield(); | ||
72 | } | ||
73 | |||
74 | #else | ||
75 | |||
76 | void power_off(void) | ||
77 | { | ||
78 | } | ||
79 | |||
80 | void ide_power_enable(bool on) | ||
81 | { | ||
82 | (void)on; | ||
83 | } | ||
84 | |||
85 | #endif /* SIMULATOR */ | ||
diff --git a/firmware/target/arm/pnx0101/iriver-ifp7xx/system-target.h b/firmware/target/arm/pnx0101/iriver-ifp7xx/system-target.h new file mode 100644 index 0000000000..dc11bb74da --- /dev/null +++ b/firmware/target/arm/pnx0101/iriver-ifp7xx/system-target.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Alan Korr | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef SYSTEM_TARGET_H | ||
20 | #define SYSTEM_TARGET_H | ||
21 | |||
22 | #include "system-arm.h" | ||
23 | |||
24 | #define CPUFREQ_DEFAULT 12000000 | ||
25 | #define CPUFREQ_NORMAL 48000000 | ||
26 | #define CPUFREQ_MAX 60000000 | ||
27 | |||
28 | typedef void (*interrupt_handler_t)(void); | ||
29 | |||
30 | void irq_set_int_handler(int n, interrupt_handler_t handler); | ||
31 | void irq_enable_int(int n); | ||
32 | void irq_disable_int(int n); | ||
33 | |||
34 | #endif /* SYSTEM_TARGET_H */ | ||
diff --git a/firmware/target/arm/pnx0101/iriver-ifp7xx/usb-ifp7xx.c b/firmware/target/arm/pnx0101/iriver-ifp7xx/usb-ifp7xx.c new file mode 100644 index 0000000000..a22a227b15 --- /dev/null +++ b/firmware/target/arm/pnx0101/iriver-ifp7xx/usb-ifp7xx.c | |||
@@ -0,0 +1,50 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include "cpu.h" | ||
21 | #include "kernel.h" | ||
22 | #include "thread.h" | ||
23 | #include "system.h" | ||
24 | #include "debug.h" | ||
25 | #include "ata.h" | ||
26 | #include "fat.h" | ||
27 | #include "disk.h" | ||
28 | #include "panic.h" | ||
29 | #include "lcd.h" | ||
30 | #include "adc.h" | ||
31 | #include "usb.h" | ||
32 | #include "button.h" | ||
33 | #include "sprintf.h" | ||
34 | #include "string.h" | ||
35 | |||
36 | void usb_init_device(void) | ||
37 | { | ||
38 | } | ||
39 | |||
40 | bool usb_detect(void) | ||
41 | { | ||
42 | /* TODO: Implement USB_ISP1582 */ | ||
43 | return false; | ||
44 | } | ||
45 | |||
46 | void usb_enable(bool on) | ||
47 | { | ||
48 | /* TODO: Implement USB_ISP1582 */ | ||
49 | (void)on; | ||
50 | } | ||