summaryrefslogtreecommitdiffstats
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.tar.bz2
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 @@
* KIND, either express or implied.
*
****************************************************************************/
-
+#include "config.h"
#include "options.h"
#include "menu.h"
@@ -107,9 +107,7 @@ int show_logo( void )
#else
char *rockbox = " ROCKbox!";
lcd_clear_display();
-#ifdef HAVE_NEW_CHARCELL_LCD
lcd_double_height(true);
-#endif
lcd_puts(0, 0, rockbox);
lcd_puts(0, 1, appsversion);
#endif
@@ -123,7 +121,7 @@ bool show_credits(void)
int btn;
show_logo();
-#ifdef HAVE_NEW_CHARCELL_LCD
+#ifdef HAVE_LCD_CHARCELLS
lcd_double_height(false);
#endif
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 @@
****************************************************************************/
#include <stdbool.h>
+#include "hwcompat.h"
#include "lcd.h"
#include "font.h"
#include "backlight.h"
@@ -80,11 +81,8 @@ struct menu {
#endif /* HAVE_LCD_BITMAP */
-#ifdef HAVE_NEW_CHARCELL_LCD
-#define CURSOR_CHAR 0x7e
-#else
-#define CURSOR_CHAR 0x89
-#endif
+#define NEW_CURSOR_CHAR 0x7e
+#define OLD_CURSOR_CHAR 0x89
static struct menu menus[MAX_MENUS];
static bool inuse[MAX_MENUS] = { false };
@@ -108,7 +106,7 @@ void put_cursorxy(int x, int y, bool on)
lcd_bitmap ( bitmap_icons_6x8[Cursor],
xpos, ypos, 4, 8, true);
#else
- lcd_putc(x, y, CURSOR_CHAR);
+ lcd_putc(x, y, has_new_lcd()?NEW_CURSOR_CHAR:OLD_CURSOR_CHAR);
#endif
}
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)
qsort(dircache,filesindir,sizeof(struct entry),compare);
if ( dir_buffer_full || filesindir == MAX_FILES_IN_DIR ) {
-#ifdef HAVE_NEW_CHARCELL_LCD
+#ifdef HAVE_LCD_CHARCELLS
lcd_double_height(false);
#endif
lcd_clear_display();
@@ -347,7 +347,7 @@ static int showdir(char *path, int start)
}
lcd_stop_scroll();
-#ifdef HAVE_NEW_CHARCELL_LCD
+#ifdef HAVE_LCD_CHARCELLS
lcd_double_height(false);
#endif
lcd_clear_display();
@@ -446,7 +446,7 @@ static int showdir(char *path, int start)
bool ask_resume(void)
{
-#ifdef HAVE_NEW_CHARCELL_LCD
+#ifdef HAVE_LCD_CHARCELLS
lcd_double_height(false);
#endif
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 @@
/* define this if you have the Player's keyboard */
#define HAVE_PLAYER_KEYPAD 1
-/* define this if you have a post-4.50 charcell LCD display */
-#define HAVE_NEW_CHARCELL_LCD 1
-
/* Define this if you have a MAS3507D */
#define HAVE_MAS3507D
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 @@
#if defined(ARCHOS_PLAYER)
#include "config-player.h"
-#elif defined(ARCHOS_PLAYER_OLD)
-#include "config-playerold.h"
#elif defined(ARCHOS_RECORDER)
#include "config-recorder.h"
#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 @@
*
****************************************************************************/
#include "config.h"
+#include "hwcompat.h"
#ifdef HAVE_LCD_CHARCELLS
@@ -32,19 +33,18 @@
/*** definitions ***/
-#ifdef HAVE_NEW_CHARCELL_LCD
-# define LCD_CONTRAST_SET ((char)0x50)
-# define LCD_CRAM ((char)0x80) /* Characters */
-# define LCD_PRAM ((char)0xC0) /* Patterns */
-# define LCD_IRAM ((char)0x40) /* Icons */
-#else
-# define LCD_CONTRAST_SET ((char)0xA8)
-# define LCD_CRAM ((char)0xB0) /* Characters */
-# define LCD_PRAM ((char)0x80) /* Patterns */
-# define LCD_IRAM ((char)0xE0) /* Icons */
-#endif
-#define LCD_CURSOR(x,y) ((char)(LCD_CRAM+((y)*16+(x))))
-#define LCD_ICON(i) ((char)(LCD_IRAM+i))
+#define OLD_LCD_CONTRAST_SET ((char)0xA8)
+#define OLD_LCD_CRAM ((char)0xB0) /* Characters */
+#define OLD_LCD_PRAM ((char)0x80) /* Patterns */
+#define OLD_LCD_IRAM ((char)0xE0) /* Icons */
+
+#define NEW_LCD_CONTRAST_SET ((char)0x50)
+#define NEW_LCD_CRAM ((char)0x80) /* Characters */
+#define NEW_LCD_PRAM ((char)0xC0) /* Patterns */
+#define NEW_LCD_IRAM ((char)0x40) /* Icons */
+
+#define LCD_CURSOR(x,y) ((char)(lcd_cram+((y)*16+(x))))
+#define LCD_ICON(i) ((char)(lcd_iram+i))
/*** generic code ***/
@@ -68,9 +68,7 @@ static char scroll_spacing = 3; /* spaces between end and start of text */
static struct scrollinfo scroll; /* only one scroll line at the moment */
static int scroll_count = 0;
-#ifdef HAVE_NEW_CHARCELL_LCD
-
-static const unsigned char lcd_ascii[] = {
+static const unsigned char new_lcd_ascii[] = {
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
0x10,0x11,0x05,0x13,0x14,0x15,0x16,0x17,
@@ -105,9 +103,7 @@ static const unsigned char lcd_ascii[] = {
0x20,0x75,0x75,0x75,0x75,0x79,0x20,0x79
};
-#else
-
-static const unsigned char lcd_ascii[] = {
+static const unsigned char old_lcd_ascii[] = {
0x00,0x01,0x02,0x03,0x00,0x84,0x85,0x89,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xec,0xe3,0xe2,0xe1,0xe0,0xdf,0x15,0x00,
@@ -141,7 +137,15 @@ static const unsigned char lcd_ascii[] = {
0x73,0x72,0x73,0x73,0x73,0x73,0x73,0x24,
0x24,0x79,0x79,0x79,0x79,0x7d,0x24,0x7d
};
-#endif /* HAVE_NEW_CHARCELL_LCD */
+
+static bool new_lcd;
+
+static unsigned const char *lcd_ascii;
+static char lcd_contrast_set;
+static char lcd_cram;
+static char lcd_pram;
+static char lcd_iram;
+
void lcd_clear_display(void)
{
@@ -170,14 +174,15 @@ void lcd_putc(int x, int y, unsigned char ch)
void lcd_define_pattern (int which,char *pattern,int length)
{
int i;
- lcd_write(true,LCD_PRAM|which);
+ lcd_write(true,lcd_pram | which);
for (i=0;i<length;i++)
lcd_write(false,pattern[i]);
}
void lcd_double_height(bool on)
{
- lcd_write(true,on?9:8);
+ if(new_lcd)
+ lcd_write(true,on?9:8);
}
static char icon_pos[] =
@@ -238,13 +243,29 @@ void lcd_icon(int icon, bool enable)
void lcd_init (void)
{
+ new_lcd = has_new_lcd();
+
+ if(new_lcd) {
+ lcd_ascii = new_lcd_ascii;
+ lcd_contrast_set = NEW_LCD_CONTRAST_SET;
+ lcd_cram = NEW_LCD_CRAM;
+ lcd_pram = NEW_LCD_PRAM;
+ lcd_iram = NEW_LCD_IRAM;
+ } else {
+ lcd_ascii = old_lcd_ascii;
+ lcd_contrast_set = OLD_LCD_CONTRAST_SET;
+ lcd_cram = OLD_LCD_CRAM;
+ lcd_pram = OLD_LCD_PRAM;
+ lcd_iram = OLD_LCD_IRAM;
+ }
+
create_thread(scroll_thread, scroll_stack,
sizeof(scroll_stack), scroll_name);
}
void lcd_set_contrast(int val)
{
- lcd_write(true, LCD_CONTRAST_SET);
+ lcd_write(true, lcd_contrast_set);
lcd_write(false, 31-val);
}
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)
return mask;
}
+
+#ifdef ARCHOS_PLAYER
+bool has_new_lcd(void)
+{
+ return read_rom_version() > 451;
+}
+#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 @@
#ifndef HWCOMPAT_H
#define HWCOMPAT_H
+#include <stdbool.h>
+
/* Bit mask values for HW compatibility */
#define ATA_ADDRESS_300 0x0100
#define USB_ACTIVE_HIGH 0x0100
@@ -27,4 +29,8 @@
int read_rom_version(void);
int read_hw_mask(void);
+#ifdef ARCHOS_PLAYER
+bool has_new_lcd(void);
+#endif
+
#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
echo "Enter target platform: (defaults to Recorder)"
- echo "1 - Archos Player old LCD"
- echo "2 - Archos Player/Studio new LCD"
- echo "3 - Archos Recorder"
+ echo "1 - Archos Player/Studio"
+ echo "2 - Archos Recorder"
getit=`input`;
case $getit in
1)
- target="-DARCHOS_PLAYER_OLD"
- display="-DHAVE_LCD_CHARCELLS"
- keypad="-DHAVE_PLAYER_KEYPAD"
- ;;
-
- 2)
target="-DARCHOS_PLAYER"
display="-DHAVE_LCD_CHARCELLS"
keypad="-DHAVE_PLAYER_KEYPAD"
;;
- *|3)
+ *|2)
target="-DARCHOS_RECORDER"
display="-DHAVE_LCD_BITMAP"
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)
/* does nothing */
return false;
}
+
+void lcd_double_height(bool onoff)
+{
+ (void)onoff;
+}
+
+bool has_new_lcd(void)
+{
+ return false;
+}