summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2005-12-18 13:04:00 +0000
committerDave Chapman <dave@dchapman.com>2005-12-18 13:04:00 +0000
commit2a7bd9fb7b9698b949ae85e24b17921c807c323c (patch)
treef81fe7b060f1202996d6e5946ba349e5b9861935
parent3f9789b45a971418025a23a437a9c9384c61e2f7 (diff)
New target - iPod Video.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8261 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/SOURCES6
-rw-r--r--apps/plugins/jewels.c4
-rw-r--r--apps/plugins/sudoku.c2
-rw-r--r--apps/recorder/icons.h2
-rw-r--r--firmware/SOURCES5
-rw-r--r--firmware/drivers/lcd-ipodvideo.c195
-rw-r--r--firmware/export/config-ipodvideo.h96
-rw-r--r--firmware/export/config.h5
-rw-r--r--firmware/export/system.h2
-rw-r--r--firmware/system.c4
-rwxr-xr-xtools/configure20
-rw-r--r--tools/scramble.c4
12 files changed, 334 insertions, 11 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index c811dd2757..cf17bbc27c 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -56,11 +56,11 @@ recorder/icons.c
recorder/keyboard.c
recorder/peakmeter.c
recorder/widgets.c
-#ifdef IRIVER_H300_SERIES
+#if defined(IRIVER_H300_SERIES) || defined(APPLE_IPODVIDEO)
recorder/logo-h300.c
-#elif APPLE_IPODCOLOR
+#elif defined(APPLE_IPODCOLOR)
recorder/logo-ipod.c
-#elif APPLE_IPODNANO
+#elif defined(APPLE_IPODNANO)
recorder/logo-nano.c
#endif
#endif
diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c
index 88938dc125..2031a1cc3b 100644
--- a/apps/plugins/jewels.c
+++ b/apps/plugins/jewels.c
@@ -103,7 +103,7 @@
#define SWAP_TIMER 30
/* use 22x22 tiles */
-#if (LCD_HEIGHT == 176) && (LCD_WIDTH == 220) && \
+#if (LCD_HEIGHT >= 176) && (LCD_WIDTH >= 220) && \
(LCD_PIXELFORMAT == RGB565SWAPPED)
/* size of a tile */
#define TILE_WIDTH 22
@@ -616,7 +616,7 @@ static unsigned short jewel[8][484] = {
};
/* use 22x22 tiles */
-#elif (LCD_HEIGHT == 176) && (LCD_WIDTH == 220) && \
+#elif (LCD_HEIGHT >= 176) && (LCD_WIDTH >= 220) && \
(LCD_PIXELFORMAT == RGB565)
/* size of a tile */
#define TILE_WIDTH 22
diff --git a/apps/plugins/sudoku.c b/apps/plugins/sudoku.c
index 9d02ff162a..586b94b721 100644
--- a/apps/plugins/sudoku.c
+++ b/apps/plugins/sudoku.c
@@ -381,7 +381,7 @@ static unsigned char num_inverse[10][8]= {
/* Numeral 9 */
{0x3f,0x3f,0x1b,0x15,0x15,0x23,0x3f,0x3f},
};
-#elif (LCD_HEIGHT==176) && (LCD_WIDTH==220)
+#elif (LCD_HEIGHT>=176) && (LCD_WIDTH>=220)
/* iriver h300 */
/* Internal dimensions of a cell */
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h
index 72dc70a95c..98f86cbdac 100644
--- a/apps/recorder/icons.h
+++ b/apps/recorder/icons.h
@@ -81,7 +81,7 @@ extern const unsigned char bitmap_icon_disk[];
#if LCD_WIDTH == 112 || LCD_WIDTH == 128 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128)
extern const unsigned char rockbox112x37[];
#endif
-#if defined(IRIVER_H300_SERIES) || defined(APPLE_IPODCOLOR)
+#if defined(IRIVER_H300_SERIES) || defined(APPLE_IPODCOLOR) || defined(APPLE_IPODVIDEO)
#define ROCKBOXLOGO_WIDTH 220
#define ROCKBOXLOGO_HEIGHT 68
extern const unsigned short rockboxlogo[];
diff --git a/firmware/SOURCES b/firmware/SOURCES
index da5453d67d..ce5ec7f803 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -61,6 +61,9 @@ drivers/lcd-16bit.c
#if CONFIG_LCD==LCD_IPODNANO || CONFIG_LCD==LCD_IPODCOLOR
drivers/lcd-ipod.c
#endif
+#if CONFIG_LCD==LCD_IPODVIDEO
+drivers/lcd-ipodvideo.c
+#endif
#if CONFIG_LCD==LCD_H300
drivers/lcd-h300.c
#endif
@@ -99,7 +102,7 @@ drivers/mas.c
#ifdef IRIVER_H300_SERIES
drivers/pcf50606.c
#endif
-#if defined(APPLE_IPODCOLOR) || defined(APPLE_IPODNANO)
+#if defined(APPLE_IPODCOLOR) || defined(APPLE_IPODNANO) || defined(APPLE_IPODVIDEO)
drivers/pcf50605.c
#endif
#if CONFIG_RTC == RTC_M41ST84W
diff --git a/firmware/drivers/lcd-ipodvideo.c b/firmware/drivers/lcd-ipodvideo.c
new file mode 100644
index 0000000000..519f185311
--- /dev/null
+++ b/firmware/drivers/lcd-ipodvideo.c
@@ -0,0 +1,195 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2005 by Dave Chapman
+ *
+ * Rockbox driver for iPod Video LCDs
+ *
+ * Based on code from ipodlinux - http://ipodlinux.org
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include "config.h"
+#include "cpu.h"
+#include "lcd.h"
+#include "kernel.h"
+#include "system.h"
+
+/*** hardware configuration ***/
+
+void lcd_set_contrast(int val)
+{
+ /* TODO: Implement lcd_set_contrast() */
+ (void)val;
+}
+
+void lcd_set_invert_display(bool yesno)
+{
+ /* TODO: Implement lcd_set_invert_display() */
+ (void)yesno;
+}
+
+/* turn the display upside down (call lcd_update() afterwards) */
+void lcd_set_flip(bool yesno)
+{
+ /* TODO: Implement lcd_set_flip() */
+ (void)yesno;
+}
+
+/* Rolls up the lcd display by the specified amount of lines.
+ * Lines that are rolled out over the top of the screen are
+ * rolled in from the bottom again. This is a hardware
+ * remapping only and all operations on the lcd are affected.
+ * ->
+ * @param int lines - The number of lines that are rolled.
+ * The value must be 0 <= pixels < LCD_HEIGHT. */
+void lcd_roll(int lines)
+{
+ /* TODO: Implement lcd_roll() */
+ lines &= LCD_HEIGHT-1;
+}
+
+/* LCD init */
+void lcd_init_device(void)
+{
+ /* iPodLinux doesn't appear have any LCD init code for the Video */
+}
+
+/*** update functions ***/
+
+/* Performance function that works with an external buffer
+ note that by and bheight are in 4-pixel units! */
+void lcd_blit(const fb_data* data, int x, int by, int width,
+ int bheight, int stride)
+{
+ /* TODO: Implement lcd_blit() */
+ (void)data;
+ (void)x;
+ (void)by;
+ (void)width;
+ (void)bheight;
+ (void)stride;
+}
+
+static void lcd_bcm_write32(unsigned address, unsigned value)
+{
+ /* write out destination address as two 16bit values */
+ outw(address, 0x30010000);
+ outw((address >> 16), 0x30010000);
+
+ /* wait for it to be write ready */
+ while ((inw(0x30030000) & 0x2) == 0);
+
+ /* write out the value low 16, high 16 */
+ outw(value, 0x30000000);
+ outw((value >> 16), 0x30000000);
+}
+
+static void lcd_bcm_setup_rect(unsigned cmd,
+ unsigned start_horiz,
+ unsigned start_vert,
+ unsigned max_horiz,
+ unsigned max_vert,
+ unsigned count)
+{
+ lcd_bcm_write32(0x1F8, 0xFFFA0005);
+ lcd_bcm_write32(0xE0000, cmd);
+ lcd_bcm_write32(0xE0004, start_horiz);
+ lcd_bcm_write32(0xE0008, start_vert);
+ lcd_bcm_write32(0xE000C, max_horiz);
+ lcd_bcm_write32(0xE0010, max_vert);
+ lcd_bcm_write32(0xE0014, count);
+ lcd_bcm_write32(0xE0018, count);
+ lcd_bcm_write32(0xE001C, 0);
+}
+
+static unsigned lcd_bcm_read32(unsigned address) {
+ while ((inw(0x30020000) & 1) == 0);
+
+ /* write out destination address as two 16bit values */
+ outw(address, 0x30020000);
+ outw((address >> 16), 0x30020000);
+
+ /* wait for it to be read ready */
+ while ((inw(0x30030000) & 0x10) == 0);
+
+ /* read the value */
+ return inw(0x30000000) | inw(0x30000000) << 16;
+}
+
+static void lcd_bcm_finishup(void) {
+ unsigned data;
+
+ outw(0x31, 0x30030000);
+
+ lcd_bcm_read32(0x1FC);
+
+ do {
+ data = lcd_bcm_read32(0x1F8);
+ } while (data == 0xFFFA0005 || data == 0xFFFF);
+
+ lcd_bcm_read32(0x1FC);
+}
+
+/* Update a fraction of the display. */
+void lcd_update_rect(int x, int y, int width, int height)
+{
+ int rect1,rect2,rect3,rect4;
+ int newx,newwidth;
+ int count;
+ unsigned int curpixel=0;
+ int c, r;
+ unsigned long *addr;
+ int p0,p1;
+
+ /* Ensure x and width are both even - so we can read 32-bit aligned
+ data from lcd_framebuffer */
+ newx=x&~1;
+ newwidth=width&~1;
+ if (newx+newwidth < x+width) { newwidth+=2; }
+ x=newx; width=newwidth;
+
+ /* calculate the drawing region */
+ rect1 = x; /* start horiz */
+ rect2 = y; /* start vert */
+ rect3 = (x + width) - 1; /* max horiz */
+ rect4 = (y + height) - 1; /* max vert */
+
+ /* setup the drawing region */
+ count=(width * height) << 1;
+ lcd_bcm_setup_rect(0x34, rect1, rect2, rect3, rect4, count);
+
+ addr = (unsigned long*)&lcd_framebuffer[y][x];
+
+ /* for each row */
+ for (r = 0; r < height; r++) {
+ /* for each column */
+ for (c = 0; c < width; c += 2) {
+ /* output 2 pixels */
+ lcd_bcm_write32(0xE0020 + (curpixel << 2), *(addr++));
+ curpixel++;
+ }
+
+ addr += (LCD_WIDTH - width)/2;
+ }
+
+ lcd_bcm_finishup();
+}
+
+/* Update the display.
+ This must be called after all other LCD functions that change the display. */
+void lcd_update(void)
+{
+ lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
+}
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h
new file mode 100644
index 0000000000..5972915965
--- /dev/null
+++ b/firmware/export/config-ipodvideo.h
@@ -0,0 +1,96 @@
+/*
+ * This config file is for the Apple iPod Video
+ */
+#define APPLE_IPODVIDEO 1
+
+/* For Rolo and boot loader */
+#define MODEL_NUMBER 5
+
+/* define this if you have recording possibility */
+/*#define HAVE_RECORDING 1*/
+
+/* define this if you have a bitmap LCD display */
+#define HAVE_LCD_BITMAP 1
+
+/* define this if you have a colour LCD */
+#define HAVE_LCD_COLOR 1
+
+/* LCD dimensions */
+#define LCD_WIDTH 320
+#define LCD_HEIGHT 240
+#define LCD_DEPTH 16 /* 65536 colours */
+#define LCD_PIXELFORMAT RGB565 /* rgb565 */
+
+#define CONFIG_KEYPAD IPOD_4G_PAD
+
+/* Define this if you do software codec */
+#define CONFIG_CODEC SWCODEC
+
+/* define this if you have a real-time clock */
+#define CONFIG_RTC RTC_PCF50605
+
+/* Define this if you have a software controlled poweroff */
+//#define HAVE_SW_POWEROFF
+
+/* The number of bytes reserved for loadable codecs */
+#define CODEC_SIZE 0x80000
+
+/* The number of bytes reserved for loadable plugins */
+#define PLUGIN_BUFFER_SIZE 0xC0000
+
+/* Define this if you have the WM8975 audio codec */
+#define HAVE_WM8975
+
+/* Define this for LCD backlight available */
+#define CONFIG_BACKLIGHT BL_IPODNANO /* port controlled */
+
+#ifndef SIMULATOR
+
+/* The Nano actually has a PP5021 - but it's register compatible with
+ the 5020 so Rockbox doesn't care. */
+/* Define this if you have a PortalPlayer PP5020 */
+#define CONFIG_CPU PP5020
+
+/* Define this if you want to use the PP5020 i2c interface */
+#define CONFIG_I2C I2C_PP5020
+
+/* Type of mobile power */
+//#define CONFIG_BATTERY BATT_LIPOL1300
+
+#define BATTERY_SCALE_FACTOR 16665 /* FIX: this value is picked at random */
+
+/* Define this if the platform can charge batteries */
+//#define HAVE_CHARGING 1
+
+/* define this if the hardware can be powered off while charging */
+//#define HAVE_POWEROFF_WHILE_CHARGING
+
+/* The start address index for ROM builds */
+#define ROM_START 0x00000000
+
+/* Define this to the CPU frequency */
+#define CPU_FREQ 11289600
+
+#define CONFIG_LCD LCD_IPODVIDEO
+
+/* Offset ( in the firmware file's header ) to the file length */
+#define FIRMWARE_OFFSET_FILE_LENGTH 0
+
+/* Offset ( in the firmware file's header ) to the file CRC */
+#define FIRMWARE_OFFSET_FILE_CRC 0
+
+/* Offset ( in the firmware file's header ) to the real data */
+#define FIRMWARE_OFFSET_FILE_DATA 8
+
+#define USB_IPODSTYLE
+
+/* Virtual LED (icon) */
+#define CONFIG_LED LED_VIRTUAL
+
+/* Define this if you have adjustable CPU frequency */
+//#define HAVE_ADJUSTABLE_CPU_FREQ
+
+#define BOOTFILE_EXT "ipod"
+#define BOOTFILE "rockbox." BOOTFILE_EXT
+
+#endif
diff --git a/firmware/export/config.h b/firmware/export/config.h
index d34c5682c7..858b348ed3 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -75,6 +75,7 @@
unknown at the time of this writing */
#define LCD_IPODCOLOR 6 /* as used by iPod Color/Photo */
#define LCD_IPODNANO 7 /* as used by iPod Nano */
+#define LCD_IPODVIDEO 8 /* as used by iPod Video */
/* LCD_PIXELFORMAT */
#define RGB565 565
@@ -87,7 +88,7 @@
#define BL_IRIVER_H100 3 /* IRiver GPIO */
#define BL_GMINI 4 /* Archos GMini */
#define BL_IPOD4G 5 /* Apple iPod 4G */
-#define BL_IPODNANO 6 /* Apple iPod Nano */
+#define BL_IPODNANO 6 /* Apple iPod Nano and iPod Video*/
#define BL_IRIVER_H300 7 /* IRiver PWM */
/* CONFIG_I2C */
@@ -137,6 +138,8 @@
#include "config-ipodcolor.h"
#elif defined(IPOD_NANO)
#include "config-ipodnano.h"
+#elif defined(IPOD_VIDEO)
+#include "config-ipodvideo.h"
#else
/* no known platform */
#endif
diff --git a/firmware/export/system.h b/firmware/export/system.h
index 40e3884b16..d197b06547 100644
--- a/firmware/export/system.h
+++ b/firmware/export/system.h
@@ -34,6 +34,8 @@ extern long cpu_frequency;
#define outl(a,b) (*(volatile unsigned long *) (b) = (a))
#define inb(a) (*(volatile unsigned char *) (a))
#define outb(a,b) (*(volatile unsigned char *) (b) = (a))
+#define inw(a) (*(volatile unsigned short *) (a))
+#define outw(a,b) (*(volatile unsigned short *) (b) = (a))
static inline void udelay(unsigned usecs)
{
unsigned start = inl(0x60005010);
diff --git a/firmware/system.c b/firmware/system.c
index cbc009aa78..0015b3a55d 100644
--- a/firmware/system.c
+++ b/firmware/system.c
@@ -1126,6 +1126,9 @@ void irq(void)
static void ipod_init_cache(void)
{
+/* Initialising the cache in the iPod Video bootloader prevents
+ Rockbox from starting */
+#if !defined(BOOTLOADER) || !defined(APPLE_IPODVIDEO)
unsigned i;
/* cache init mode? */
@@ -1144,6 +1147,7 @@ static void ipod_init_cache(void)
for (i = 0x10000000; i < 0x10002000; i += 16)
inb(i);
+#endif
}
static void ipod_set_cpu_speed(void)
diff --git a/tools/configure b/tools/configure
index 5830f89c6d..fc8a52e058 100755
--- a/tools/configure
+++ b/tools/configure
@@ -410,6 +410,7 @@ appsdir='\$(ROOTDIR)/apps'
echo "12 - iAudio X5"
echo "13 - iPod Color/Photo"
echo "14 - iPod Nano"
+ echo "15 - iPod Video"
getit=`input`;
@@ -659,6 +660,23 @@ appsdir='\$(ROOTDIR)/apps'
toolset=$ipodbitmaptools
;;
+ 15)
+ archos="ipodvideo"
+ target="-DIPOD_VIDEO"
+ memory=32 # 30GB models have 32MB, 60GB have 64MB
+ arm7tdmicc
+ tool="$rootdir/tools/scramble -add=ipvd"
+ output="rockbox.ipod"
+ appextra="recorder:gui"
+ archosrom=""
+ flash=""
+ plugins="yes"
+ codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
+ # toolset is the tools within the tools directory that we build for
+ # this particular target.
+ toolset=$ipodbitmaptools
+ ;;
+
*)
echo "Please select an actual target platform!"
exit
@@ -703,7 +721,7 @@ fi
case $option in
[Bb])
case $archos in
- h100|h120|h300|ipodcolor|ipodnano)
+ h100|h120|h300|ipodcolor|ipodnano|ipodvideo)
extradefines="-DBOOTLOADER" # for target makefile symbol EXTRA_DEFINES
appsdir='\$(ROOTDIR)/bootloader'
apps="bootloader"
diff --git a/tools/scramble.c b/tools/scramble.c
index 7d936cf42f..73e4925e48 100644
--- a/tools/scramble.c
+++ b/tools/scramble.c
@@ -68,7 +68,7 @@ void usage(void)
"\t-mm=X Archos Multimedia format (X values: A=JBMM, B=AV1xx, C=AV3xx)\n"
"\t-iriver iRiver format\n"
"\t-add=X Rockbox generic \"add-up\" checksum format\n"
- "\t (X values: h100, h120, h140, h300, ipco, nano)\n"
+ "\t (X values: h100, h120, h140, h300, ipco, nano, ipvd)\n"
"\nNo option results in Archos standard player/recorder format.\n");
exit(1);
@@ -166,6 +166,8 @@ int main (int argc, char** argv)
modelnum = 3;
else if(!strcmp(&argv[1][5], "nano"))
modelnum = 4;
+ else if(!strcmp(&argv[1][5], "ipvd"))
+ modelnum = 5;
else {
fprintf(stderr, "unsupported model: %s\n", &argv[1][5]);
return 2;