summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-10-15 12:25:57 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-10-15 12:25:57 +0000
commit0a4b247080dd132e847071adbc006ad9de2ca608 (patch)
tree5eb04ea6eefba517233d9c649ce5f6c56e6d16be
parent6e0a75c596a6c4ec5ec2820e1873c8527aec5007 (diff)
downloadrockbox-0a4b247080dd132e847071adbc006ad9de2ca608.tar.gz
rockbox-0a4b247080dd132e847071adbc006ad9de2ca608.zip
The player firmware now autodetects the LCD type. No need for two player versions anymore
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2658 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/main_menu.c6
-rw-r--r--apps/menu.c10
-rw-r--r--apps/tree.c6
-rw-r--r--firmware/config-player.h3
-rw-r--r--firmware/config.h2
-rw-r--r--firmware/drivers/lcd-player.c67
-rw-r--r--firmware/hwcompat.c7
-rw-r--r--firmware/hwcompat.h6
-rwxr-xr-xtools/configure13
-rw-r--r--uisimulator/common/stubs.c10
10 files changed, 79 insertions, 51 deletions
diff --git a/apps/main_menu.c b/apps/main_menu.c
index de51b57701..cf31e74961 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -16,7 +16,7 @@
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19#include "config.h"
20#include "options.h" 20#include "options.h"
21 21
22#include "menu.h" 22#include "menu.h"
@@ -107,9 +107,7 @@ int show_logo( void )
107#else 107#else
108 char *rockbox = " ROCKbox!"; 108 char *rockbox = " ROCKbox!";
109 lcd_clear_display(); 109 lcd_clear_display();
110#ifdef HAVE_NEW_CHARCELL_LCD
111 lcd_double_height(true); 110 lcd_double_height(true);
112#endif
113 lcd_puts(0, 0, rockbox); 111 lcd_puts(0, 0, rockbox);
114 lcd_puts(0, 1, appsversion); 112 lcd_puts(0, 1, appsversion);
115#endif 113#endif
@@ -123,7 +121,7 @@ bool show_credits(void)
123 int btn; 121 int btn;
124 122
125 show_logo(); 123 show_logo();
126#ifdef HAVE_NEW_CHARCELL_LCD 124#ifdef HAVE_LCD_CHARCELLS
127 lcd_double_height(false); 125 lcd_double_height(false);
128#endif 126#endif
129 127
diff --git a/apps/menu.c b/apps/menu.c
index eee1052d65..7051850a49 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -18,6 +18,7 @@
18 ****************************************************************************/ 18 ****************************************************************************/
19#include <stdbool.h> 19#include <stdbool.h>
20 20
21#include "hwcompat.h"
21#include "lcd.h" 22#include "lcd.h"
22#include "font.h" 23#include "font.h"
23#include "backlight.h" 24#include "backlight.h"
@@ -80,11 +81,8 @@ struct menu {
80 81
81#endif /* HAVE_LCD_BITMAP */ 82#endif /* HAVE_LCD_BITMAP */
82 83
83#ifdef HAVE_NEW_CHARCELL_LCD 84#define NEW_CURSOR_CHAR 0x7e
84#define CURSOR_CHAR 0x7e 85#define OLD_CURSOR_CHAR 0x89
85#else
86#define CURSOR_CHAR 0x89
87#endif
88 86
89static struct menu menus[MAX_MENUS]; 87static struct menu menus[MAX_MENUS];
90static bool inuse[MAX_MENUS] = { false }; 88static bool inuse[MAX_MENUS] = { false };
@@ -108,7 +106,7 @@ void put_cursorxy(int x, int y, bool on)
108 lcd_bitmap ( bitmap_icons_6x8[Cursor], 106 lcd_bitmap ( bitmap_icons_6x8[Cursor],
109 xpos, ypos, 4, 8, true); 107 xpos, ypos, 4, 8, true);
110#else 108#else
111 lcd_putc(x, y, CURSOR_CHAR); 109 lcd_putc(x, y, has_new_lcd()?NEW_CURSOR_CHAR:OLD_CURSOR_CHAR);
112#endif 110#endif
113 } 111 }
114 else { 112 else {
diff --git a/apps/tree.c b/apps/tree.c
index b026211f3c..1b19b04bba 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -303,7 +303,7 @@ static int showdir(char *path, int start)
303 qsort(dircache,filesindir,sizeof(struct entry),compare); 303 qsort(dircache,filesindir,sizeof(struct entry),compare);
304 304
305 if ( dir_buffer_full || filesindir == MAX_FILES_IN_DIR ) { 305 if ( dir_buffer_full || filesindir == MAX_FILES_IN_DIR ) {
306#ifdef HAVE_NEW_CHARCELL_LCD 306#ifdef HAVE_LCD_CHARCELLS
307 lcd_double_height(false); 307 lcd_double_height(false);
308#endif 308#endif
309 lcd_clear_display(); 309 lcd_clear_display();
@@ -347,7 +347,7 @@ static int showdir(char *path, int start)
347 } 347 }
348 348
349 lcd_stop_scroll(); 349 lcd_stop_scroll();
350#ifdef HAVE_NEW_CHARCELL_LCD 350#ifdef HAVE_LCD_CHARCELLS
351 lcd_double_height(false); 351 lcd_double_height(false);
352#endif 352#endif
353 lcd_clear_display(); 353 lcd_clear_display();
@@ -446,7 +446,7 @@ static int showdir(char *path, int start)
446 446
447bool ask_resume(void) 447bool ask_resume(void)
448{ 448{
449#ifdef HAVE_NEW_CHARCELL_LCD 449#ifdef HAVE_LCD_CHARCELLS
450 lcd_double_height(false); 450 lcd_double_height(false);
451#endif 451#endif
452 452
diff --git a/firmware/config-player.h b/firmware/config-player.h
index a1c5db9f9f..2068c94db4 100644
--- a/firmware/config-player.h
+++ b/firmware/config-player.h
@@ -4,9 +4,6 @@
4/* define this if you have the Player's keyboard */ 4/* define this if you have the Player's keyboard */
5#define HAVE_PLAYER_KEYPAD 1 5#define HAVE_PLAYER_KEYPAD 1
6 6
7/* define this if you have a post-4.50 charcell LCD display */
8#define HAVE_NEW_CHARCELL_LCD 1
9
10/* Define this if you have a MAS3507D */ 7/* Define this if you have a MAS3507D */
11#define HAVE_MAS3507D 8#define HAVE_MAS3507D
12 9
diff --git a/firmware/config.h b/firmware/config.h
index d79f061088..65fe070fba 100644
--- a/firmware/config.h
+++ b/firmware/config.h
@@ -22,8 +22,6 @@
22 22
23#if defined(ARCHOS_PLAYER) 23#if defined(ARCHOS_PLAYER)
24#include "config-player.h" 24#include "config-player.h"
25#elif defined(ARCHOS_PLAYER_OLD)
26#include "config-playerold.h"
27#elif defined(ARCHOS_RECORDER) 25#elif defined(ARCHOS_RECORDER)
28#include "config-recorder.h" 26#include "config-recorder.h"
29#else 27#else
diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c
index f0a222f831..a262b83fe9 100644
--- a/firmware/drivers/lcd-player.c
+++ b/firmware/drivers/lcd-player.c
@@ -17,6 +17,7 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#include "config.h" 19#include "config.h"
20#include "hwcompat.h"
20 21
21#ifdef HAVE_LCD_CHARCELLS 22#ifdef HAVE_LCD_CHARCELLS
22 23
@@ -32,19 +33,18 @@
32 33
33/*** definitions ***/ 34/*** definitions ***/
34 35
35#ifdef HAVE_NEW_CHARCELL_LCD 36#define OLD_LCD_CONTRAST_SET ((char)0xA8)
36# define LCD_CONTRAST_SET ((char)0x50) 37#define OLD_LCD_CRAM ((char)0xB0) /* Characters */
37# define LCD_CRAM ((char)0x80) /* Characters */ 38#define OLD_LCD_PRAM ((char)0x80) /* Patterns */
38# define LCD_PRAM ((char)0xC0) /* Patterns */ 39#define OLD_LCD_IRAM ((char)0xE0) /* Icons */
39# define LCD_IRAM ((char)0x40) /* Icons */ 40
40#else 41#define NEW_LCD_CONTRAST_SET ((char)0x50)
41# define LCD_CONTRAST_SET ((char)0xA8) 42#define NEW_LCD_CRAM ((char)0x80) /* Characters */
42# define LCD_CRAM ((char)0xB0) /* Characters */ 43#define NEW_LCD_PRAM ((char)0xC0) /* Patterns */
43# define LCD_PRAM ((char)0x80) /* Patterns */ 44#define NEW_LCD_IRAM ((char)0x40) /* Icons */
44# define LCD_IRAM ((char)0xE0) /* Icons */ 45
45#endif 46#define LCD_CURSOR(x,y) ((char)(lcd_cram+((y)*16+(x))))
46#define LCD_CURSOR(x,y) ((char)(LCD_CRAM+((y)*16+(x)))) 47#define LCD_ICON(i) ((char)(lcd_iram+i))
47#define LCD_ICON(i) ((char)(LCD_IRAM+i))
48 48
49/*** generic code ***/ 49/*** generic code ***/
50 50
@@ -68,9 +68,7 @@ static char scroll_spacing = 3; /* spaces between end and start of text */
68static struct scrollinfo scroll; /* only one scroll line at the moment */ 68static struct scrollinfo scroll; /* only one scroll line at the moment */
69static int scroll_count = 0; 69static int scroll_count = 0;
70 70
71#ifdef HAVE_NEW_CHARCELL_LCD 71static const unsigned char new_lcd_ascii[] = {
72
73static const unsigned char lcd_ascii[] = {
74 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, 72 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
75 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, 73 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
76 0x10,0x11,0x05,0x13,0x14,0x15,0x16,0x17, 74 0x10,0x11,0x05,0x13,0x14,0x15,0x16,0x17,
@@ -105,9 +103,7 @@ static const unsigned char lcd_ascii[] = {
105 0x20,0x75,0x75,0x75,0x75,0x79,0x20,0x79 103 0x20,0x75,0x75,0x75,0x75,0x79,0x20,0x79
106}; 104};
107 105
108#else 106static const unsigned char old_lcd_ascii[] = {
109
110static const unsigned char lcd_ascii[] = {
111 0x00,0x01,0x02,0x03,0x00,0x84,0x85,0x89, 107 0x00,0x01,0x02,0x03,0x00,0x84,0x85,0x89,
112 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 108 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
113 0xec,0xe3,0xe2,0xe1,0xe0,0xdf,0x15,0x00, 109 0xec,0xe3,0xe2,0xe1,0xe0,0xdf,0x15,0x00,
@@ -141,7 +137,15 @@ static const unsigned char lcd_ascii[] = {
141 0x73,0x72,0x73,0x73,0x73,0x73,0x73,0x24, 137 0x73,0x72,0x73,0x73,0x73,0x73,0x73,0x24,
142 0x24,0x79,0x79,0x79,0x79,0x7d,0x24,0x7d 138 0x24,0x79,0x79,0x79,0x79,0x7d,0x24,0x7d
143}; 139};
144#endif /* HAVE_NEW_CHARCELL_LCD */ 140
141static bool new_lcd;
142
143static unsigned const char *lcd_ascii;
144static char lcd_contrast_set;
145static char lcd_cram;
146static char lcd_pram;
147static char lcd_iram;
148
145 149
146void lcd_clear_display(void) 150void lcd_clear_display(void)
147{ 151{
@@ -170,14 +174,15 @@ void lcd_putc(int x, int y, unsigned char ch)
170void lcd_define_pattern (int which,char *pattern,int length) 174void lcd_define_pattern (int which,char *pattern,int length)
171{ 175{
172 int i; 176 int i;
173 lcd_write(true,LCD_PRAM|which); 177 lcd_write(true,lcd_pram | which);
174 for (i=0;i<length;i++) 178 for (i=0;i<length;i++)
175 lcd_write(false,pattern[i]); 179 lcd_write(false,pattern[i]);
176} 180}
177 181
178void lcd_double_height(bool on) 182void lcd_double_height(bool on)
179{ 183{
180 lcd_write(true,on?9:8); 184 if(new_lcd)
185 lcd_write(true,on?9:8);
181} 186}
182 187
183static char icon_pos[] = 188static char icon_pos[] =
@@ -238,13 +243,29 @@ void lcd_icon(int icon, bool enable)
238 243
239void lcd_init (void) 244void lcd_init (void)
240{ 245{
246 new_lcd = has_new_lcd();
247
248 if(new_lcd) {
249 lcd_ascii = new_lcd_ascii;
250 lcd_contrast_set = NEW_LCD_CONTRAST_SET;
251 lcd_cram = NEW_LCD_CRAM;
252 lcd_pram = NEW_LCD_PRAM;
253 lcd_iram = NEW_LCD_IRAM;
254 } else {
255 lcd_ascii = old_lcd_ascii;
256 lcd_contrast_set = OLD_LCD_CONTRAST_SET;
257 lcd_cram = OLD_LCD_CRAM;
258 lcd_pram = OLD_LCD_PRAM;
259 lcd_iram = OLD_LCD_IRAM;
260 }
261
241 create_thread(scroll_thread, scroll_stack, 262 create_thread(scroll_thread, scroll_stack,
242 sizeof(scroll_stack), scroll_name); 263 sizeof(scroll_stack), scroll_name);
243} 264}
244 265
245void lcd_set_contrast(int val) 266void lcd_set_contrast(int val)
246{ 267{
247 lcd_write(true, LCD_CONTRAST_SET); 268 lcd_write(true, lcd_contrast_set);
248 lcd_write(false, 31-val); 269 lcd_write(false, 31-val);
249} 270}
250 271
diff --git a/firmware/hwcompat.c b/firmware/hwcompat.c
index 48b17f2010..43a516815f 100644
--- a/firmware/hwcompat.c
+++ b/firmware/hwcompat.c
@@ -37,3 +37,10 @@ int read_hw_mask(void)
37 37
38 return mask; 38 return mask;
39} 39}
40
41#ifdef ARCHOS_PLAYER
42bool has_new_lcd(void)
43{
44 return read_rom_version() > 451;
45}
46#endif
diff --git a/firmware/hwcompat.h b/firmware/hwcompat.h
index d508218ac5..3a142fb713 100644
--- a/firmware/hwcompat.h
+++ b/firmware/hwcompat.h
@@ -19,6 +19,8 @@
19#ifndef HWCOMPAT_H 19#ifndef HWCOMPAT_H
20#define HWCOMPAT_H 20#define HWCOMPAT_H
21 21
22#include <stdbool.h>
23
22/* Bit mask values for HW compatibility */ 24/* Bit mask values for HW compatibility */
23#define ATA_ADDRESS_300 0x0100 25#define ATA_ADDRESS_300 0x0100
24#define USB_ACTIVE_HIGH 0x0100 26#define USB_ACTIVE_HIGH 0x0100
@@ -27,4 +29,8 @@
27int read_rom_version(void); 29int read_rom_version(void);
28int read_hw_mask(void); 30int read_hw_mask(void);
29 31
32#ifdef ARCHOS_PLAYER
33bool has_new_lcd(void);
34#endif
35
30#endif 36#endif
diff --git a/tools/configure b/tools/configure
index 916ae28c2a..f02866d652 100755
--- a/tools/configure
+++ b/tools/configure
@@ -178,27 +178,20 @@ if [ -z "$target" ]; then
178 178
179 echo "Enter target platform: (defaults to Recorder)" 179 echo "Enter target platform: (defaults to Recorder)"
180 180
181 echo "1 - Archos Player old LCD" 181 echo "1 - Archos Player/Studio"
182 echo "2 - Archos Player/Studio new LCD" 182 echo "2 - Archos Recorder"
183 echo "3 - Archos Recorder"
184 183
185 getit=`input`; 184 getit=`input`;
186 185
187 case $getit in 186 case $getit in
188 187
189 1) 188 1)
190 target="-DARCHOS_PLAYER_OLD"
191 display="-DHAVE_LCD_CHARCELLS"
192 keypad="-DHAVE_PLAYER_KEYPAD"
193 ;;
194
195 2)
196 target="-DARCHOS_PLAYER" 189 target="-DARCHOS_PLAYER"
197 display="-DHAVE_LCD_CHARCELLS" 190 display="-DHAVE_LCD_CHARCELLS"
198 keypad="-DHAVE_PLAYER_KEYPAD" 191 keypad="-DHAVE_PLAYER_KEYPAD"
199 ;; 192 ;;
200 193
201 *|3) 194 *|2)
202 target="-DARCHOS_RECORDER" 195 target="-DARCHOS_RECORDER"
203 display="-DHAVE_LCD_BITMAP" 196 display="-DHAVE_LCD_BITMAP"
204 keypad="-DHAVE_RECORDER_KEYPAD" 197 keypad="-DHAVE_RECORDER_KEYPAD"
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c
index ad334f5561..abdec40e02 100644
--- a/uisimulator/common/stubs.c
+++ b/uisimulator/common/stubs.c
@@ -212,3 +212,13 @@ bool oscillograph(void)
212 /* does nothing */ 212 /* does nothing */
213 return false; 213 return false;
214} 214}
215
216void lcd_double_height(bool onoff)
217{
218 (void)onoff;
219}
220
221bool has_new_lcd(void)
222{
223 return false;
224}