summaryrefslogtreecommitdiff
path: root/firmware/target/arm/iriver
diff options
context:
space:
mode:
authorHristo Kovachev <bger@rockbox.org>2006-08-11 08:35:27 +0000
committerHristo Kovachev <bger@rockbox.org>2006-08-11 08:35:27 +0000
commit9dc0e6222942b31ecf8a7ba4b8f4d1dff1d52caa (patch)
treeca0458168d06e758160bae2980797ee52ed27fb4 /firmware/target/arm/iriver
parent2c3fd0ce7e035fe0c42fed1e4be9c5a22518fd6f (diff)
downloadrockbox-9dc0e6222942b31ecf8a7ba4b8f4d1dff1d52caa.tar.gz
rockbox-9dc0e6222942b31ecf8a7ba4b8f4d1dff1d52caa.zip
Patch #5731 by Barry Wardell: more iriver h10 work. Thanks!
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10521 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/iriver')
-rw-r--r--firmware/target/arm/iriver/h10/ata-h10.c51
-rw-r--r--firmware/target/arm/iriver/h10/ata-target.h72
-rw-r--r--firmware/target/arm/iriver/h10/button-h10.c26
-rw-r--r--firmware/target/arm/iriver/h10/lcd-h10.c30
4 files changed, 23 insertions, 156 deletions
diff --git a/firmware/target/arm/iriver/h10/ata-h10.c b/firmware/target/arm/iriver/h10/ata-h10.c
deleted file mode 100644
index f8ca773132..0000000000
--- a/firmware/target/arm/iriver/h10/ata-h10.c
+++ /dev/null
@@ -1,51 +0,0 @@
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/* ATA stuff was taken from the iPod code */
21
22#include <stdbool.h>
23#include "system.h"
24#include "ata-target.h"
25
26void ata_reset()
27{
28
29}
30
31void ata_enable(bool on)
32{
33 /* TODO: Implement ata_enable() */
34 (void)on;
35}
36
37bool ata_is_coldstart()
38{
39 return false;
40 /* TODO: Implement coldstart variable */
41}
42
43void ata_device_init()
44{
45 /* From ipod-ide.c:ipod_ide_register() */
46 outl(inl(0xc3000028) | (1 << 5), 0xc3000028);
47 outl(inl(0xc3000028) & ~0x10000000, 0xc3000028);
48
49 outl(0x10, 0xc3000000);
50 outl(0x80002150, 0xc3000004);
51}
diff --git a/firmware/target/arm/iriver/h10/ata-target.h b/firmware/target/arm/iriver/h10/ata-target.h
deleted file mode 100644
index a93af79015..0000000000
--- a/firmware/target/arm/iriver/h10/ata-target.h
+++ /dev/null
@@ -1,72 +0,0 @@
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/* ATA stuff was taken from the iPod code */
21
22/* Plain C read & write loops */
23#define PREFER_C_READING
24#define PREFER_C_WRITING
25
26#if (CONFIG_CPU == PP5002)
27#define ATA_IOBASE 0xc00031e0
28#define ATA_CONTROL (*((volatile unsigned char*)(0xc00033f8)))
29#elif (CONFIG_CPU == PP5020)
30#define ATA_IOBASE 0xc30001e0
31#define ATA_CONTROL (*((volatile unsigned char*)(0xc30003f8)))
32#endif
33
34#define ATA_DATA (*((volatile unsigned short*)(ATA_IOBASE)))
35#define ATA_ERROR (*((volatile unsigned char*)(ATA_IOBASE + 0x04)))
36#define ATA_NSECTOR (*((volatile unsigned char*)(ATA_IOBASE + 0x08)))
37#define ATA_SECTOR (*((volatile unsigned char*)(ATA_IOBASE + 0x0c)))
38#define ATA_LCYL (*((volatile unsigned char*)(ATA_IOBASE + 0x10)))
39#define ATA_HCYL (*((volatile unsigned char*)(ATA_IOBASE + 0x14)))
40#define ATA_SELECT (*((volatile unsigned char*)(ATA_IOBASE + 0x18)))
41#define ATA_COMMAND (*((volatile unsigned char*)(ATA_IOBASE + 0x1c)))
42
43#define STATUS_BSY 0x80
44#define STATUS_RDY 0x40
45#define STATUS_DF 0x20
46#define STATUS_DRQ 0x08
47#define STATUS_ERR 0x01
48#define ERROR_ABRT 0x04
49
50#define WRITE_PATTERN1 0xa5
51#define WRITE_PATTERN2 0x5a
52#define WRITE_PATTERN3 0xaa
53#define WRITE_PATTERN4 0x55
54
55#define READ_PATTERN1 0xa5
56#define READ_PATTERN2 0x5a
57#define READ_PATTERN3 0xaa
58#define READ_PATTERN4 0x55
59
60#define READ_PATTERN1_MASK 0xff
61#define READ_PATTERN2_MASK 0xff
62#define READ_PATTERN3_MASK 0xff
63#define READ_PATTERN4_MASK 0xff
64
65#define SET_REG(reg,val) reg = (val)
66#define SET_16BITREG(reg,val) reg = (val)
67
68
69void ata_reset(void);
70void ata_enable(bool on);
71bool ata_is_coldstart(void);
72void ata_device_init(void);
diff --git a/firmware/target/arm/iriver/h10/button-h10.c b/firmware/target/arm/iriver/h10/button-h10.c
index badcd594a1..7979a52976 100644
--- a/firmware/target/arm/iriver/h10/button-h10.c
+++ b/firmware/target/arm/iriver/h10/button-h10.c
@@ -49,6 +49,7 @@ int button_read_device(void)
49 int btn = BUTTON_NONE; 49 int btn = BUTTON_NONE;
50 unsigned char state; 50 unsigned char state;
51 static bool hold_button = false; 51 static bool hold_button = false;
52
52#if 0 53#if 0
53 /* light handling */ 54 /* light handling */
54 if (hold_button && !button_hold()) 55 if (hold_button && !button_hold())
@@ -58,12 +59,25 @@ int button_read_device(void)
58#endif 59#endif
59 60
60 hold_button = button_hold(); 61 hold_button = button_hold();
61 state = GPIOA_INPUT_VAL & 0xf8; 62 if (!hold_button)
62 if ((state & 0x8) == 0) btn |= BUTTON_FF; 63 {
63 if ((state & 0x16) == 0) btn |= BUTTON_PLAY; 64 /* Read normal buttons */
64 if ((state & 0x32) == 0) btn |= BUTTON_REW; 65 state = GPIOA_INPUT_VAL & 0xf8;
65 if ((state & 0x64) == 0) btn |= BUTTON_RIGHT; 66 if ((state & 0x8) == 0) btn |= BUTTON_FF;
66 if ((state & 0x128) == 0) btn |= BUTTON_LEFT; 67 if ((state & 0x10) == 0) btn |= BUTTON_PLAY;
68 if ((state & 0x20) == 0) btn |= BUTTON_REW;
69 if ((state & 0x40) == 0) btn |= BUTTON_RIGHT;
70 if ((state & 0x80) == 0) btn |= BUTTON_LEFT;
71
72 /* Read power button */
73 if ((GPIOB_INPUT_VAL & 0x1) == 0) btn |= BUTTON_POWER;
74
75 /* Read scroller */
76 if ( ((GPIOC_INPUT_VAL & 0x4)==1) && ((GPIOD_INPUT_VAL & 0x10)==1) )
77 {
78 /* Scroller is pressed */
79 }
80 }
67 81
68 return btn; 82 return btn;
69} 83}
diff --git a/firmware/target/arm/iriver/h10/lcd-h10.c b/firmware/target/arm/iriver/h10/lcd-h10.c
index c2fa05b05c..3640aa1ba1 100644
--- a/firmware/target/arm/iriver/h10/lcd-h10.c
+++ b/firmware/target/arm/iriver/h10/lcd-h10.c
@@ -36,8 +36,8 @@
36 36
37static bool display_on=false; /* is the display turned on? */ 37static bool display_on=false; /* is the display turned on? */
38 38
39#define LCD_CMD *(volatile unsigned short *)0xf0008000 39#define LCD_CMD *(volatile unsigned short *)0x70003008 /* or maybe 0x70008a0c */
40#define LCD_DATA *(volatile unsigned short *)0xf0008002 40#define LCD_DATA *(volatile unsigned short *)0x70003010
41 41
42/* register defines for the Renesas HD66773R */ 42/* register defines for the Renesas HD66773R */
43#define R_HORIZ_RAM_ADDR_POS 0x16 43#define R_HORIZ_RAM_ADDR_POS 0x16
@@ -98,30 +98,23 @@ const short high8to9[] ICONST_ATTR = {
98/* called very frequently - inline! */ 98/* called very frequently - inline! */
99inline void lcd_write_reg(int reg, int val) 99inline void lcd_write_reg(int reg, int val)
100{ 100{
101#if 0
102 LCD_CMD = (reg >> 8) << 1; 101 LCD_CMD = (reg >> 8) << 1;
103 LCD_CMD = (reg & 0xff) << 1; 102 LCD_CMD = (reg & 0xff) << 1;
104 LCD_DATA = (val >> 8) << 1; 103 LCD_DATA = (val >> 8) << 1;
105 LCD_DATA = (val & 0xff) << 1; 104 LCD_DATA = (val & 0xff) << 1;
106#endif
107 (void)reg;
108 (void)val;
109} 105}
110 106
111/* called very frequently - inline! */ 107/* called very frequently - inline! */
112inline void lcd_begin_write_gram(void) 108inline void lcd_begin_write_gram(void)
113{ 109{
114#if 0
115 LCD_CMD = (R_WRITE_DATA_2_GRAM >> 8) << 1; 110 LCD_CMD = (R_WRITE_DATA_2_GRAM >> 8) << 1;
116 LCD_CMD = (R_WRITE_DATA_2_GRAM & 0xff) << 1; 111 LCD_CMD = (R_WRITE_DATA_2_GRAM & 0xff) << 1;
117#endif
118} 112}
119 113
120/* called very frequently - inline! */ 114/* called very frequently - inline! */
121inline void lcd_write_data(const unsigned short* p_bytes, int count) ICODE_ATTR; 115inline void lcd_write_data(const unsigned short* p_bytes, int count) ICODE_ATTR;
122inline void lcd_write_data(const unsigned short* p_bytes, int count) 116inline void lcd_write_data(const unsigned short* p_bytes, int count)
123{ 117{
124#if 0
125 unsigned int tmp; 118 unsigned int tmp;
126 unsigned int *ptr = (unsigned int *)p_bytes; 119 unsigned int *ptr = (unsigned int *)p_bytes;
127 bool extra; 120 bool extra;
@@ -144,9 +137,6 @@ inline void lcd_write_data(const unsigned short* p_bytes, int count)
144 LCD_DATA = high8to9[read >> 8]; 137 LCD_DATA = high8to9[read >> 8];
145 LCD_DATA = read<<1; 138 LCD_DATA = read<<1;
146 } 139 }
147#endif
148 (void)p_bytes;
149 (void)count;
150} 140}
151 141
152/*** hardware configuration ***/ 142/*** hardware configuration ***/
@@ -158,15 +148,12 @@ int lcd_default_contrast(void)
158 148
159void lcd_set_contrast(int val) 149void lcd_set_contrast(int val)
160{ 150{
161#if 0
162 if (val >= 15) // val must'nt be 15 or 31 151 if (val >= 15) // val must'nt be 15 or 31
163 ++val; 152 ++val;
164 if (val > 30) 153 if (val > 30)
165 return; 154 return;
166 155
167 lcd_write_reg(0x0e, 0x201e + (val << 8)); 156 lcd_write_reg(0x0e, 0x201e + (val << 8));
168#endif
169 (void)val;
170} 157}
171 158
172void lcd_set_invert_display(bool yesno) 159void lcd_set_invert_display(bool yesno)
@@ -197,9 +184,9 @@ void lcd_roll(int lines)
197 */ 184 */
198void lcd_init_device(void) 185void lcd_init_device(void)
199{ 186{
200#if 0
201 display_on=true; 187 display_on=true;
202 188
189#if 0
203 /* LCD Reset */ 190 /* LCD Reset */
204 and_l(~0x00000010, &GPIO1_OUT); 191 and_l(~0x00000010, &GPIO1_OUT);
205 or_l(0x00000010, &GPIO1_ENABLE); 192 or_l(0x00000010, &GPIO1_ENABLE);
@@ -268,10 +255,7 @@ void lcd_init_device(void)
268 255
269void lcd_enable(bool on) 256void lcd_enable(bool on)
270{ 257{
271#if 0
272 display_on = on; 258 display_on = on;
273#endif
274 (void)on;
275} 259}
276 260
277/*** update functions ***/ 261/*** update functions ***/
@@ -297,7 +281,6 @@ void lcd_blit(const fb_data* data, int x, int by, int width,
297void lcd_update(void) ICODE_ATTR; 281void lcd_update(void) ICODE_ATTR;
298void lcd_update(void) 282void lcd_update(void)
299{ 283{
300#if 0
301 if(display_on){ 284 if(display_on){
302 285
303 /* Copy display bitmap to hardware */ 286 /* Copy display bitmap to hardware */
@@ -305,14 +288,12 @@ void lcd_update(void)
305 lcd_begin_write_gram(); 288 lcd_begin_write_gram();
306 lcd_write_data((unsigned short *)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT); 289 lcd_write_data((unsigned short *)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT);
307 } 290 }
308#endif
309} 291}
310 292
311/* Update a fraction of the display. */ 293/* Update a fraction of the display. */
312void lcd_update_rect(int, int, int, int) ICODE_ATTR; 294void lcd_update_rect(int, int, int, int) ICODE_ATTR;
313void lcd_update_rect(int x, int y, int width, int height) 295void lcd_update_rect(int x, int y, int width, int height)
314{ 296{
315#if 0
316 if(display_on) { 297 if(display_on) {
317 int ymax = y + height; 298 int ymax = y + height;
318 299
@@ -343,9 +324,4 @@ void lcd_update_rect(int x, int y, int width, int height)
343 lcd_write_reg(R_HORIZ_RAM_ADDR_POS, 0x7f00); 324 lcd_write_reg(R_HORIZ_RAM_ADDR_POS, 0x7f00);
344 lcd_write_reg(R_VERT_RAM_ADDR_POS, 0x9f00); 325 lcd_write_reg(R_VERT_RAM_ADDR_POS, 0x9f00);
345 } 326 }
346#endif
347 (void)x;
348 (void)y;
349 (void)width;
350 (void)height;
351} 327}