diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2005-04-14 11:40:41 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2005-04-14 11:40:41 +0000 |
commit | 14c7900383bd2082494ce1cfa3e191bc34a44b3a (patch) | |
tree | 294ed696bc5345d8ab6139528e5ecd1908146bb7 | |
parent | 81bd3692882707d90a2be6a8c8de67fa9b2e9815 (diff) | |
download | rockbox-14c7900383bd2082494ce1cfa3e191bc34a44b3a.tar.gz rockbox-14c7900383bd2082494ce1cfa3e191bc34a44b3a.zip |
Low-level driver for the H100 remote control LCD, by Richard S. La Charite III
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6283 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | docs/CREDITS | 1 | ||||
-rw-r--r-- | firmware/SOURCES | 1 | ||||
-rw-r--r-- | firmware/drivers/lcd-h100-remote.c | 194 | ||||
-rw-r--r-- | firmware/export/lcd.h | 3 |
4 files changed, 199 insertions, 0 deletions
diff --git a/docs/CREDITS b/docs/CREDITS index b654e30d4b..e2d75c60ec 100644 --- a/docs/CREDITS +++ b/docs/CREDITS | |||
@@ -104,3 +104,4 @@ Michiel van der Kolk | |||
104 | Tony Motakis | 104 | Tony Motakis |
105 | Andy Young | 105 | Andy Young |
106 | Alexandre Bourget | 106 | Alexandre Bourget |
107 | Richard S. La Charité III | ||
diff --git a/firmware/SOURCES b/firmware/SOURCES index 8279f812d1..d3d3b1c656 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -114,6 +114,7 @@ drivers/lcd.S | |||
114 | #ifdef IRIVER_H100 | 114 | #ifdef IRIVER_H100 |
115 | #ifndef SIMULATOR | 115 | #ifndef SIMULATOR |
116 | drivers/uda1380.c | 116 | drivers/uda1380.c |
117 | drivers/lcd-h100-remote.c | ||
117 | pcm_playback.c | 118 | pcm_playback.c |
118 | #endif | 119 | #endif |
119 | #endif | 120 | #endif |
diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c new file mode 100644 index 0000000000..8b0cd393c7 --- /dev/null +++ b/firmware/drivers/lcd-h100-remote.c | |||
@@ -0,0 +1,194 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2005 by Richard S. La Charité III | ||
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 | |||
24 | #if CONFIG_CPU == MCF5249 | ||
25 | |||
26 | #define CS_LO GPIO_OUT &= ~0x00000004 | ||
27 | #define CS_HI GPIO_OUT |= 0x00000004 | ||
28 | #define CLK_LO GPIO_OUT &= ~0x10000000 | ||
29 | #define CLK_HI GPIO_OUT |= 0x10000000 | ||
30 | #define DATA_LO GPIO_OUT &= ~0x00040000 | ||
31 | #define DATA_HI GPIO_OUT |= 0x00040000 | ||
32 | #define RS_LO GPIO_OUT &= ~0x00010000 | ||
33 | #define RS_HI GPIO_OUT |= 0x00010000 | ||
34 | |||
35 | /* delay loop */ | ||
36 | #define DELAY do { int _x; for(_x=0;_x<3;_x++);} while (0) | ||
37 | |||
38 | void lcd_remote_write_command(int cmd) | ||
39 | { | ||
40 | int i; | ||
41 | |||
42 | CS_LO; | ||
43 | RS_LO; | ||
44 | |||
45 | for (i = 0; i < 8; i++) | ||
46 | { | ||
47 | if (cmd & 0x80) | ||
48 | DATA_HI; | ||
49 | else | ||
50 | DATA_LO; | ||
51 | |||
52 | CLK_HI; | ||
53 | cmd <<= 1; | ||
54 | DELAY; | ||
55 | |||
56 | CLK_LO; | ||
57 | } | ||
58 | |||
59 | CS_HI; | ||
60 | } | ||
61 | |||
62 | void lcd_remote_write_data(const unsigned char* p_bytes, int count) | ||
63 | { | ||
64 | int i, j; | ||
65 | int data; | ||
66 | |||
67 | CS_LO; | ||
68 | RS_HI; | ||
69 | |||
70 | for (i = 0; i < count; i++) | ||
71 | { | ||
72 | data = p_bytes[i]; | ||
73 | |||
74 | for (j = 0; j < 8; j++) | ||
75 | { | ||
76 | if (data & 0x80) | ||
77 | DATA_HI; | ||
78 | else | ||
79 | DATA_LO; | ||
80 | |||
81 | CLK_HI; | ||
82 | data <<= 1; | ||
83 | DELAY; | ||
84 | |||
85 | CLK_LO; | ||
86 | } | ||
87 | } | ||
88 | |||
89 | CS_HI; | ||
90 | } | ||
91 | |||
92 | void lcd_remote_write_command_ex(int cmd, int data1, int data2) | ||
93 | { | ||
94 | int i; | ||
95 | |||
96 | CS_LO; | ||
97 | RS_LO; | ||
98 | |||
99 | for (i = 0; i < 8; i++) | ||
100 | { | ||
101 | if (cmd & 0x80) | ||
102 | DATA_HI; | ||
103 | else | ||
104 | DATA_LO; | ||
105 | |||
106 | CLK_HI; | ||
107 | cmd <<= 1; | ||
108 | DELAY; | ||
109 | |||
110 | CLK_LO; | ||
111 | } | ||
112 | |||
113 | RS_HI; | ||
114 | |||
115 | for (i = 0; i < 8; i++) | ||
116 | { | ||
117 | if (data1 & 0x80) | ||
118 | DATA_HI; | ||
119 | else | ||
120 | DATA_LO; | ||
121 | |||
122 | CLK_HI; | ||
123 | data1 <<= 1; | ||
124 | DELAY; | ||
125 | |||
126 | CLK_LO; | ||
127 | } | ||
128 | |||
129 | if (data2 != -1) | ||
130 | { | ||
131 | for (i = 0; i < 8; i++) | ||
132 | { | ||
133 | if (data2 & 0x80) | ||
134 | DATA_HI; | ||
135 | else | ||
136 | DATA_LO; | ||
137 | |||
138 | CLK_HI; | ||
139 | data2 <<= 1; | ||
140 | DELAY; | ||
141 | |||
142 | CLK_LO; | ||
143 | } | ||
144 | } | ||
145 | |||
146 | CS_HI; | ||
147 | } | ||
148 | |||
149 | #define LCD_REMOTE_ADC_NORMAL 0xa0 | ||
150 | #define LCD_REMOTE_ADC_REVERSE 0xa1 | ||
151 | |||
152 | #define LCD_REMOTE_SHL_NORMAL 0xc0 | ||
153 | #define LCD_REMOTE_SHL_REVERSE 0xc8 | ||
154 | |||
155 | #define LCD_REMOTE_DISPLAY_OFF 0xae | ||
156 | #define LCD_REMOTE_DISPLAY_ON 0xaf | ||
157 | |||
158 | #define LCD_REMOTE_REVERSE_OFF 0xa6 | ||
159 | #define LCD_REMOTE_REVERSE_ON 0xa7 | ||
160 | |||
161 | #define LCD_REMOTE_DISPLAY_NORMAL 0xa4 | ||
162 | #define LCD_REMOTE_DISPLAY_ENTIRE 0xa5 | ||
163 | |||
164 | #define LCD_REMOTE_NO_OPERATION 0xe3 | ||
165 | |||
166 | #define LCD_REMOTE_POWER_CONTROL 0x2b | ||
167 | |||
168 | void lcd_remote_init(void) | ||
169 | { | ||
170 | GPIO_FUNCTION |= 0x10010000; /* GPIO16: RS | ||
171 | GPIO28: CLK */ | ||
172 | |||
173 | GPIO1_FUNCTION |= 0x00040004; /* GPIO34: CS | ||
174 | GPIO50: Data */ | ||
175 | GPIO_ENABLE |= 0x10010000; | ||
176 | GPIO1_ENABLE |= 0x00040004; | ||
177 | |||
178 | CLK_LO; | ||
179 | CS_HI; | ||
180 | } | ||
181 | |||
182 | /* | ||
183 | lcd_remote_write_command(LCD_REMOTE_ADC_NORMAL); | ||
184 | lcd_remote_write_command(LCD_REMOTE_SHL_NORMAL); | ||
185 | lcd_remote_write_command(0xA2); // Bias 0 | ||
186 | lcd_remote_write_command(LCD_REMOTE_POWER_CONTROL | 0x4); // Convertor | ||
187 | // 1ms | ||
188 | lcd_remote_write_command(LCD_REMOTE_POWER_CONTROL | 0x2); // Regulator | ||
189 | // 1ms | ||
190 | lcd_remote_write_command(LCD_REMOTE_POWER_CONTROL | 0x1); // Follower | ||
191 | // 1ms | ||
192 | */ | ||
193 | |||
194 | #endif | ||
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 98e2a58a53..9fe3ca2a8a 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h | |||
@@ -65,6 +65,9 @@ extern void lcd_update_rect(int x, int y, int width, int height); | |||
65 | #define lcd_update_rect(x,y,w,h) | 65 | #define lcd_update_rect(x,y,w,h) |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | #ifdef IRIVER_H100 | ||
69 | void lcd_remote_init(void); | ||
70 | #endif | ||
68 | #ifdef HAVE_LCD_CHARCELLS | 71 | #ifdef HAVE_LCD_CHARCELLS |
69 | 72 | ||
70 | /* Icon definitions for lcd_icon() */ | 73 | /* Icon definitions for lcd_icon() */ |