diff options
author | Dave Chapman <dave@dchapman.com> | 2006-08-31 19:19:35 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2006-08-31 19:19:35 +0000 |
commit | 657dcb5165e80b3363b89ca3108356878d4c048e (patch) | |
tree | 1f7af6e22ee866dcce37f9d1fa310c26a8bb44b4 | |
parent | 20332bce1d49d7285109564d2e29ee18b0acd54e (diff) | |
download | rockbox-657dcb5165e80b3363b89ca3108356878d4c048e.tar.gz rockbox-657dcb5165e80b3363b89ca3108356878d4c048e.zip |
Initial commit of work for port to the Tatung Elio TPJ-1022 - yet another PortalPlayer PP5020 target.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10828 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | bootloader/SOURCES | 2 | ||||
-rw-r--r-- | bootloader/tpj1022.c | 135 | ||||
-rw-r--r-- | firmware/SOURCES | 12 | ||||
-rw-r--r-- | firmware/common/disk.c | 5 | ||||
-rw-r--r-- | firmware/export/config-tpj1022.h | 123 | ||||
-rw-r--r-- | firmware/export/config.h | 5 | ||||
-rw-r--r-- | firmware/kernel.c | 3 | ||||
-rw-r--r-- | firmware/system.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/tatung/tpj1022/adc-target.h | 42 | ||||
-rw-r--r-- | firmware/target/arm/tatung/tpj1022/adc-tpj1022.c | 101 | ||||
-rw-r--r-- | firmware/target/arm/tatung/tpj1022/backlight-target.h | 28 | ||||
-rw-r--r-- | firmware/target/arm/tatung/tpj1022/backlight-tpj1022.c | 44 | ||||
-rw-r--r-- | firmware/target/arm/tatung/tpj1022/button-target.h | 58 | ||||
-rw-r--r-- | firmware/target/arm/tatung/tpj1022/button-tpj1022.c | 83 | ||||
-rw-r--r-- | firmware/target/arm/tatung/tpj1022/lcd-tpj1022.c | 97 | ||||
-rw-r--r-- | firmware/target/arm/tatung/tpj1022/power-tpj1022.c | 67 | ||||
-rw-r--r-- | firmware/target/arm/tatung/tpj1022/usb-target.h | 27 | ||||
-rw-r--r-- | firmware/target/arm/tatung/tpj1022/usb-tpj1022.c | 107 | ||||
-rwxr-xr-x | tools/configure | 29 | ||||
-rw-r--r-- | tools/scramble.c | 2 |
20 files changed, 970 insertions, 2 deletions
diff --git a/bootloader/SOURCES b/bootloader/SOURCES index 45f8453dbd..94f5a60e6b 100644 --- a/bootloader/SOURCES +++ b/bootloader/SOURCES | |||
@@ -6,6 +6,8 @@ gigabeat.c | |||
6 | e200.c | 6 | e200.c |
7 | #elif defined(IRIVER_H10) || defined(IRIVER_H10_5GB) | 7 | #elif defined(IRIVER_H10) || defined(IRIVER_H10_5GB) |
8 | h10.c | 8 | h10.c |
9 | #elif defined(ELIO_TPJ1022) | ||
10 | tpj1022.c | ||
9 | #else | 11 | #else |
10 | main.c | 12 | main.c |
11 | #endif | 13 | #endif |
diff --git a/bootloader/tpj1022.c b/bootloader/tpj1022.c new file mode 100644 index 0000000000..0088f73690 --- /dev/null +++ b/bootloader/tpj1022.c | |||
@@ -0,0 +1,135 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Dave Chapman | ||
11 | * | ||
12 | * Based on Rockbox iriver bootloader by Linus Nielsen Feltzing | ||
13 | * | ||
14 | * All files in this archive are subject to the GNU General Public License. | ||
15 | * See the file COPYING in the source tree root for full license agreement. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "config.h" | ||
22 | |||
23 | #include <stdlib.h> | ||
24 | #include <stdio.h> | ||
25 | #include <string.h> | ||
26 | #include "cpu.h" | ||
27 | #include "system.h" | ||
28 | #include "lcd.h" | ||
29 | #include "kernel.h" | ||
30 | #include "thread.h" | ||
31 | #include "ata.h" | ||
32 | #include "fat.h" | ||
33 | #include "disk.h" | ||
34 | #include "font.h" | ||
35 | #include "adc.h" | ||
36 | #include "backlight.h" | ||
37 | #include "panic.h" | ||
38 | #include "power.h" | ||
39 | #include "file.h" | ||
40 | |||
41 | char version[] = APPSVERSION; | ||
42 | |||
43 | int line=0; | ||
44 | |||
45 | void* main(void) | ||
46 | { | ||
47 | int i; | ||
48 | int rc; | ||
49 | int fd; | ||
50 | char buffer[80]; | ||
51 | unsigned char* framebuffer = (unsigned char*)0x11e00000; | ||
52 | |||
53 | #if 0 | ||
54 | lcd_init(); | ||
55 | font_init(); | ||
56 | |||
57 | lcd_puts(0, line++ ,"Hello World!"); | ||
58 | lcd_update(); | ||
59 | #endif | ||
60 | |||
61 | i=ata_init(); | ||
62 | |||
63 | disk_init(); | ||
64 | rc = disk_mount_all(); | ||
65 | |||
66 | #if 0 | ||
67 | /* Dump the flash */ | ||
68 | fd=open("/flash.bin",O_CREAT|O_RDWR); | ||
69 | write(fd,(char*)0,1024*1024); | ||
70 | close(fd); | ||
71 | #endif | ||
72 | |||
73 | #if 1 | ||
74 | /* Dump what may be the framebuffer */ | ||
75 | fd=open("/framebuffer.bin",O_CREAT|O_RDWR|O_TRUNC); | ||
76 | write(fd,framebuffer,220*176*4); | ||
77 | close(fd); | ||
78 | #endif | ||
79 | |||
80 | |||
81 | fd=open("/gpio.txt",O_CREAT|O_RDWR|O_TRUNC); | ||
82 | unsigned int gpio_a = GPIOA_INPUT_VAL; | ||
83 | unsigned int gpio_b = GPIOB_INPUT_VAL; | ||
84 | unsigned int gpio_c = GPIOC_INPUT_VAL; | ||
85 | unsigned int gpio_d = GPIOD_INPUT_VAL; | ||
86 | unsigned int gpio_e = GPIOE_INPUT_VAL; | ||
87 | unsigned int gpio_f = GPIOF_INPUT_VAL; | ||
88 | unsigned int gpio_g = GPIOG_INPUT_VAL; | ||
89 | unsigned int gpio_h = GPIOH_INPUT_VAL; | ||
90 | unsigned int gpio_i = GPIOI_INPUT_VAL; | ||
91 | unsigned int gpio_j = GPIOJ_INPUT_VAL; | ||
92 | unsigned int gpio_k = GPIOK_INPUT_VAL; | ||
93 | unsigned int gpio_l = GPIOL_INPUT_VAL; | ||
94 | |||
95 | snprintf(buffer, sizeof(buffer), "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",gpio_a,gpio_b,gpio_c,gpio_d,gpio_e,gpio_f,gpio_g,gpio_h,gpio_i,gpio_j,gpio_k,gpio_l); | ||
96 | write(fd,buffer,strlen(buffer)+1); | ||
97 | close(fd); | ||
98 | |||
99 | /* Wait for FFWD button to be pressed */ | ||
100 | while((GPIOA_INPUT_VAL & 0x04) != 0); | ||
101 | |||
102 | |||
103 | /* Now reboot */ | ||
104 | DEV_RS |= 0x4; | ||
105 | |||
106 | return 0; | ||
107 | } | ||
108 | |||
109 | /* These functions are present in the firmware library, but we reimplement | ||
110 | them here because the originals do a lot more than we want */ | ||
111 | |||
112 | void reset_poweroff_timer(void) | ||
113 | { | ||
114 | } | ||
115 | |||
116 | int dbg_ports(void) | ||
117 | { | ||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | void mpeg_stop(void) | ||
122 | { | ||
123 | } | ||
124 | |||
125 | void usb_acknowledge(void) | ||
126 | { | ||
127 | } | ||
128 | |||
129 | void usb_wait_for_disconnect(void) | ||
130 | { | ||
131 | } | ||
132 | |||
133 | void sys_poweroff(void) | ||
134 | { | ||
135 | } | ||
diff --git a/firmware/SOURCES b/firmware/SOURCES index 29e8ad8271..07b8355662 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -293,3 +293,15 @@ target/arm/gigabeat/meg-fx/lcd-meg-fx.c | |||
293 | target/arm/gigabeat/meg-fx/sc606-meg-fx.c | 293 | target/arm/gigabeat/meg-fx/sc606-meg-fx.c |
294 | #endif | 294 | #endif |
295 | #endif | 295 | #endif |
296 | |||
297 | #ifdef ELIO_TPJ1022 | ||
298 | #ifndef SIMULATOR | ||
299 | target/arm/tatung/tpj1022/backlight-tpj1022.c | ||
300 | target/arm/tatung/tpj1022/button-tpj1022.c | ||
301 | target/arm/ata-pp5020.c | ||
302 | target/arm/tatung/tpj1022/power-tpj1022.c | ||
303 | target/arm/tatung/tpj1022/usb-tpj1022.c | ||
304 | target/arm/tatung/tpj1022/lcd-tpj1022.c | ||
305 | target/arm/tatung/tpj1022/adc-tpj1022.c | ||
306 | #endif | ||
307 | #endif | ||
diff --git a/firmware/common/disk.c b/firmware/common/disk.c index 2f1d789738..950658286c 100644 --- a/firmware/common/disk.c +++ b/firmware/common/disk.c | |||
@@ -146,6 +146,10 @@ int disk_mount(int drive) | |||
146 | { | 146 | { |
147 | return 0; | 147 | return 0; |
148 | } | 148 | } |
149 | #ifndef ELIO_TPJ1022 | ||
150 | /* The Elio's hard drive has no partition table and probing for partitions causes | ||
151 | Rockbox to crash - so we temporarily disable the probing until we fix the | ||
152 | real problem. */ | ||
149 | for (i=0; volume != -1 && i<4; i++) | 153 | for (i=0; volume != -1 && i<4; i++) |
150 | { | 154 | { |
151 | if (!fat_mount(IF_MV2(volume,) IF_MV2(drive,) pinfo[i].start)) | 155 | if (!fat_mount(IF_MV2(volume,) IF_MV2(drive,) pinfo[i].start)) |
@@ -155,6 +159,7 @@ int disk_mount(int drive) | |||
155 | volume = get_free_volume(); /* prepare next entry */ | 159 | volume = get_free_volume(); /* prepare next entry */ |
156 | } | 160 | } |
157 | } | 161 | } |
162 | #endif | ||
158 | 163 | ||
159 | if (mounted == 0 && volume != -1) /* none of the 4 entries worked? */ | 164 | if (mounted == 0 && volume != -1) /* none of the 4 entries worked? */ |
160 | { /* try "superfloppy" mode */ | 165 | { /* try "superfloppy" mode */ |
diff --git a/firmware/export/config-tpj1022.h b/firmware/export/config-tpj1022.h new file mode 100644 index 0000000000..03ab9445fb --- /dev/null +++ b/firmware/export/config-tpj1022.h | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | * This config file is for the Tatung Elio TPJ-1022 | ||
3 | */ | ||
4 | |||
5 | #define TARGET_TREE /* this target is using the target tree system */ | ||
6 | |||
7 | /* For Rolo and boot loader */ | ||
8 | #define MODEL_NUMBER 15 | ||
9 | |||
10 | /* define this if you have recording possibility */ | ||
11 | /*#define HAVE_RECORDING 1*/ /* TODO: add support for this */ | ||
12 | |||
13 | /* define this if you have a bitmap LCD display */ | ||
14 | #define HAVE_LCD_BITMAP 1 | ||
15 | |||
16 | /* define this if you have a colour LCD */ | ||
17 | #define HAVE_LCD_COLOR 1 | ||
18 | |||
19 | /* define this if you have access to the quickscreen */ | ||
20 | #define HAVE_QUICKSCREEN | ||
21 | |||
22 | /* define this if you have access to the pitchscreen */ | ||
23 | #define HAVE_PITCHSCREEN | ||
24 | |||
25 | /* LCD dimensions */ | ||
26 | #define LCD_WIDTH 220 | ||
27 | #define LCD_HEIGHT 176 | ||
28 | #define LCD_DEPTH 16 /* 65536 colours */ | ||
29 | #define LCD_PIXELFORMAT RGB565 | ||
30 | |||
31 | /* #define IRAM_LCDFRAMEBUFFER IDATA_ATTR *//* put the lcd frame buffer in IRAM */ | ||
32 | |||
33 | #define CONFIG_KEYPAD ELIO_TPJ1022_PAD | ||
34 | |||
35 | /* Define this if you do software codec */ | ||
36 | #define CONFIG_CODEC SWCODEC | ||
37 | |||
38 | /* define this if you have a real-time clock */ | ||
39 | #ifndef BOOTLOADER | ||
40 | //#define CONFIG_RTC RTC_E8564 | ||
41 | #endif | ||
42 | |||
43 | /* Define this if you have a software controlled poweroff */ | ||
44 | #define HAVE_SW_POWEROFF | ||
45 | |||
46 | /* The number of bytes reserved for loadable codecs */ | ||
47 | #define CODEC_SIZE 0x80000 | ||
48 | |||
49 | /* The number of bytes reserved for loadable plugins */ | ||
50 | #define PLUGIN_BUFFER_SIZE 0x80000 | ||
51 | |||
52 | /* Define this if you have the WM8731 audio codec */ | ||
53 | #define HAVE_WM8731 | ||
54 | |||
55 | #define AB_REPEAT_ENABLE 1 | ||
56 | |||
57 | /* Define this for LCD backlight available */ | ||
58 | #define CONFIG_BACKLIGHT BL_TPJ1022 /* TODO: figure this out, probably not necessary | ||
59 | because of 'target' stuff */ | ||
60 | |||
61 | #define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity | ||
62 | TODO: check this, probably different | ||
63 | for different models too */ | ||
64 | |||
65 | #ifndef SIMULATOR | ||
66 | |||
67 | /* Define this if you have a PortalPlayer PP5020 */ | ||
68 | #define CONFIG_CPU PP5020 | ||
69 | |||
70 | /* Define this if you want to use the PP5020 i2c interface */ | ||
71 | #define CONFIG_I2C I2C_PP5020 | ||
72 | |||
73 | /* Type of mobile power */ | ||
74 | #define CONFIG_BATTERY BATT_LPCS355385 | ||
75 | #define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ | ||
76 | #define BATTERY_CAPACITY_MAX 1600 /* max. capacity selectable */ | ||
77 | #define BATTERY_CAPACITY_INC 10 /* capacity increment */ | ||
78 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | ||
79 | #define BATTERY_SCALE_FACTOR 5865 | ||
80 | |||
81 | /* Hardware controlled charging? FIXME */ | ||
82 | //#define CONFIG_CHARGING CHARGING_SIMPLE | ||
83 | |||
84 | /* define this if the hardware can be powered off while charging */ | ||
85 | /* TODO: should this be set for the H10? */ | ||
86 | //#define HAVE_POWEROFF_WHILE_CHARGING | ||
87 | |||
88 | /* The start address index for ROM builds */ | ||
89 | #define ROM_START 0x00000000 | ||
90 | |||
91 | /* Define this to the CPU frequency */ | ||
92 | /* TODO: this is probably wrong */ | ||
93 | #define CPU_FREQ 11289600 | ||
94 | |||
95 | /* Type of LCD */ | ||
96 | #define CONFIG_LCD LCD_TPJ1022 | ||
97 | |||
98 | #define DEFAULT_CONTRAST_SETTING 19 | ||
99 | |||
100 | /* Offset ( in the firmware file's header ) to the file length */ | ||
101 | #define FIRMWARE_OFFSET_FILE_LENGTH 0 | ||
102 | |||
103 | /* Offset ( in the firmware file's header ) to the file CRC */ | ||
104 | #define FIRMWARE_OFFSET_FILE_CRC 0 | ||
105 | |||
106 | /* Offset ( in the firmware file's header ) to the real data */ | ||
107 | #define FIRMWARE_OFFSET_FILE_DATA 8 | ||
108 | |||
109 | /* #define USB_IPODSTYLE */ | ||
110 | |||
111 | /* define this if the unit can be powered or charged via USB */ | ||
112 | /*#define HAVE_USB_POWER*/ | ||
113 | |||
114 | /* Virtual LED (icon) */ | ||
115 | #define CONFIG_LED LED_VIRTUAL | ||
116 | |||
117 | /* Define this if you have adjustable CPU frequency */ | ||
118 | #define HAVE_ADJUSTABLE_CPU_FREQ | ||
119 | |||
120 | #define BOOTFILE_EXT "elio" | ||
121 | #define BOOTFILE "rockbox." BOOTFILE_EXT | ||
122 | |||
123 | #endif | ||
diff --git a/firmware/export/config.h b/firmware/export/config.h index cd674b63f8..18adaeeca2 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -59,6 +59,7 @@ | |||
59 | #define GIGABEAT_PAD 10 | 59 | #define GIGABEAT_PAD 10 |
60 | #define IRIVER_H10_PAD 11 | 60 | #define IRIVER_H10_PAD 11 |
61 | #define SANSA_E200_PAD 12 | 61 | #define SANSA_E200_PAD 12 |
62 | #define ELIO_TPJ1022_PAD 13 | ||
62 | 63 | ||
63 | /* CONFIG_REMOTE_KEYPAD */ | 64 | /* CONFIG_REMOTE_KEYPAD */ |
64 | #define H100_REMOTE 1 | 65 | #define H100_REMOTE 1 |
@@ -96,6 +97,7 @@ | |||
96 | #define LCD_GIGABEAT 12 | 97 | #define LCD_GIGABEAT 12 |
97 | #define LCD_H10 13 /* as used by iriver H10 20Gb */ | 98 | #define LCD_H10 13 /* as used by iriver H10 20Gb */ |
98 | #define LCD_H10_5GB 14 /* as used by iriver H10 5Gb */ | 99 | #define LCD_H10_5GB 14 /* as used by iriver H10 5Gb */ |
100 | #define LCD_TPJ1022 15 /* as used by Tatung Elio TPJ-1022 */ | ||
99 | 101 | ||
100 | /* LCD_PIXELFORMAT */ | 102 | /* LCD_PIXELFORMAT */ |
101 | #define HORIZONTAL_PACKING 1 | 103 | #define HORIZONTAL_PACKING 1 |
@@ -121,6 +123,7 @@ | |||
121 | #define BL_H10 12 /* iriver H10 */ | 123 | #define BL_H10 12 /* iriver H10 */ |
122 | #define BL_X5 13 /* iAudio X5 PCF50606 I2C */ | 124 | #define BL_X5 13 /* iAudio X5 PCF50606 I2C */ |
123 | #define BL_H10_5GB 14 /* iriver H10 5/6GB */ | 125 | #define BL_H10_5GB 14 /* iriver H10 5/6GB */ |
126 | #define BL_TPJ1022 15 /* Tatung Elio TPJ-1022 */ | ||
124 | 127 | ||
125 | /* CONFIG_I2C */ | 128 | /* CONFIG_I2C */ |
126 | #define I2C_PLAYREC 0 /* Archos Player/Recorder style */ | 129 | #define I2C_PLAYREC 0 /* Archos Player/Recorder style */ |
@@ -204,6 +207,8 @@ | |||
204 | #include "config-h10_5gb.h" | 207 | #include "config-h10_5gb.h" |
205 | #elif defined(SANSA_E200) | 208 | #elif defined(SANSA_E200) |
206 | #include "config-e200.h" | 209 | #include "config-e200.h" |
210 | #elif defined(ELIO_TPJ1022) | ||
211 | #include "config-tpj1022.h" | ||
207 | #else | 212 | #else |
208 | /* no known platform */ | 213 | /* no known platform */ |
209 | #endif | 214 | #endif |
diff --git a/firmware/kernel.c b/firmware/kernel.c index 1c8bf9dd81..b4123fe3ca 100644 --- a/firmware/kernel.c +++ b/firmware/kernel.c | |||
@@ -83,7 +83,8 @@ void sleep(int ticks) | |||
83 | 83 | ||
84 | void yield(void) | 84 | void yield(void) |
85 | { | 85 | { |
86 | #if CONFIG_CPU == S3C2440 && defined(BOOTLOADER) | 86 | #if (CONFIG_CPU == S3C2440 || defined(ELIO_TPJ1022) && defined(BOOTLOADER)) |
87 | /* Some targets don't like yielding in the bootloader */ | ||
87 | #else | 88 | #else |
88 | switch_thread(); | 89 | switch_thread(); |
89 | wake_up_thread(); | 90 | wake_up_thread(); |
diff --git a/firmware/system.c b/firmware/system.c index 44453db816..9b2f1ba5a4 100644 --- a/firmware/system.c +++ b/firmware/system.c | |||
@@ -1162,7 +1162,7 @@ void irq(void) | |||
1162 | else if (CPU_HI_INT_STAT & GPIO_MASK) | 1162 | else if (CPU_HI_INT_STAT & GPIO_MASK) |
1163 | ipod_mini_button_int(); | 1163 | ipod_mini_button_int(); |
1164 | } | 1164 | } |
1165 | #elif (defined IRIVER_H10) || (defined IRIVER_H10_5GB) | 1165 | #elif (defined IRIVER_H10) || (defined IRIVER_H10_5GB) || defined(ELIO_TPJ1022) |
1166 | /* TODO: this should really be in the target tree, but moving it there caused | 1166 | /* TODO: this should really be in the target tree, but moving it there caused |
1167 | crt0.S not to find it while linking */ | 1167 | crt0.S not to find it while linking */ |
1168 | void irq(void) | 1168 | void irq(void) |
diff --git a/firmware/target/arm/tatung/tpj1022/adc-target.h b/firmware/target/arm/tatung/tpj1022/adc-target.h new file mode 100644 index 0000000000..3aab373290 --- /dev/null +++ b/firmware/target/arm/tatung/tpj1022/adc-target.h | |||
@@ -0,0 +1,42 @@ | |||
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 | #ifndef _ADC_TARGET_H_ | ||
20 | #define _ADC_TARGET_H_ | ||
21 | |||
22 | #define ADC_ENABLE_ADDR (*(volatile unsigned long*)(0x70000010)) | ||
23 | #define ADC_ENABLE 0x1100 | ||
24 | |||
25 | #define ADC_ADDR (*(volatile unsigned long*)(0x7000ad00)) | ||
26 | #define ADC_STATUS (*(volatile unsigned long*)(0x7000ad04)) | ||
27 | #define ADC_DATA_1 (*(volatile unsigned long*)(0x7000ad20)) | ||
28 | #define ADC_DATA_2 (*(volatile unsigned long*)(0x7000ad24)) | ||
29 | #define ADC_INIT (*(volatile unsigned long*)(0x7000ad2c)) | ||
30 | |||
31 | #define NUM_ADC_CHANNELS 4 | ||
32 | |||
33 | #define ADC_BATTERY 0 | ||
34 | #define ADC_UNKNOWN_1 1 | ||
35 | #define ADC_UNKNOWN_2 2 | ||
36 | #define ADC_SCROLLPAD 3 | ||
37 | #define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */ | ||
38 | |||
39 | /* Force a scan now */ | ||
40 | unsigned short adc_scan(int channel); | ||
41 | |||
42 | #endif | ||
diff --git a/firmware/target/arm/tatung/tpj1022/adc-tpj1022.c b/firmware/target/arm/tatung/tpj1022/adc-tpj1022.c new file mode 100644 index 0000000000..134b90b587 --- /dev/null +++ b/firmware/target/arm/tatung/tpj1022/adc-tpj1022.c | |||
@@ -0,0 +1,101 @@ | |||
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 | #include "config.h" | ||
20 | #include "cpu.h" | ||
21 | #include "system.h" | ||
22 | #include "kernel.h" | ||
23 | #include "thread.h" | ||
24 | #include "adc.h" | ||
25 | |||
26 | static unsigned short adcdata[NUM_ADC_CHANNELS]; | ||
27 | |||
28 | /* Scan ADC so that adcdata[channel] gets updated */ | ||
29 | unsigned short adc_scan(int channel) | ||
30 | { | ||
31 | unsigned int adc_data_1; | ||
32 | unsigned int adc_data_2; | ||
33 | |||
34 | /* Initialise */ | ||
35 | ADC_ADDR=0x130; | ||
36 | ADC_STATUS=0; /* 4 bytes, 1 per channel. Each byte is 0 if the channel is | ||
37 | off, 0x40 if the channel is on */ | ||
38 | |||
39 | /* Enable Channel */ | ||
40 | ADC_ADDR |= (0x1000000<<channel); | ||
41 | |||
42 | /* Start? */ | ||
43 | ADC_ADDR |= 0x20000000; | ||
44 | ADC_ADDR |= 0x80000000; | ||
45 | |||
46 | /* ADC_DATA_1 and ADC_DATA_2 are both four bytes, one byte per channel. | ||
47 | For each channel, ADC_DATA_1 stores the 8-bit msb, ADC_DATA_2 stores the | ||
48 | 2-bit lsb (in bits 0 and 1). Each channel is 10 bits total. */ | ||
49 | adc_data_1 = ((ADC_DATA_1 >> (8*channel)) & 0xff); | ||
50 | adc_data_2 = ((ADC_DATA_2 >> (8*channel+6)) & 0x3); | ||
51 | |||
52 | adcdata[channel] = (adc_data_1<<2 | adc_data_2); | ||
53 | |||
54 | return adcdata[channel]; | ||
55 | } | ||
56 | |||
57 | /* Read 10-bit channel data */ | ||
58 | unsigned short adc_read(int channel) | ||
59 | { | ||
60 | return adcdata[channel]; | ||
61 | } | ||
62 | |||
63 | static int adc_counter; | ||
64 | |||
65 | static void adc_tick(void) | ||
66 | { | ||
67 | if(++adc_counter == HZ) | ||
68 | { | ||
69 | adc_counter = 0; | ||
70 | adc_scan(ADC_BATTERY); | ||
71 | adc_scan(ADC_UNKNOWN_1); | ||
72 | adc_scan(ADC_UNKNOWN_2); | ||
73 | adc_scan(ADC_SCROLLPAD); | ||
74 | } | ||
75 | } | ||
76 | |||
77 | void adc_init(void) | ||
78 | { | ||
79 | /* Enable ADC */ | ||
80 | ADC_ENABLE_ADDR |= ADC_ENABLE; | ||
81 | |||
82 | /* Initialise */ | ||
83 | ADC_INIT=0; | ||
84 | ADC_ADDR=0x130; | ||
85 | ADC_STATUS=0; | ||
86 | |||
87 | /* Enable Channels 1-4 */ | ||
88 | ADC_ADDR |= 0x1000000; | ||
89 | ADC_ADDR |= 0x2000000; | ||
90 | ADC_ADDR |= 0x4000000; | ||
91 | ADC_ADDR |= 0x8000000; | ||
92 | |||
93 | /* Start? */ | ||
94 | ADC_ADDR |= 0x20000000; | ||
95 | ADC_ADDR |= 0x80000000; | ||
96 | |||
97 | /* Wait 50ms for things to settle */ | ||
98 | sleep(HZ/20); | ||
99 | |||
100 | tick_add_task(adc_tick); | ||
101 | } | ||
diff --git a/firmware/target/arm/tatung/tpj1022/backlight-target.h b/firmware/target/arm/tatung/tpj1022/backlight-target.h new file mode 100644 index 0000000000..b5fe2f7c5d --- /dev/null +++ b/firmware/target/arm/tatung/tpj1022/backlight-target.h | |||
@@ -0,0 +1,28 @@ | |||
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 | /* Taken from the x5's implementation */ | ||
21 | |||
22 | #ifndef BACKLIGHT_TARGET_H | ||
23 | #define BACKLIGHT_TARGET_H | ||
24 | |||
25 | void __backlight_on(void); | ||
26 | void __backlight_off(void); | ||
27 | |||
28 | #endif | ||
diff --git a/firmware/target/arm/tatung/tpj1022/backlight-tpj1022.c b/firmware/target/arm/tatung/tpj1022/backlight-tpj1022.c new file mode 100644 index 0000000000..51218e21be --- /dev/null +++ b/firmware/target/arm/tatung/tpj1022/backlight-tpj1022.c | |||
@@ -0,0 +1,44 @@ | |||
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 | /* The H10 display (and hence backlight) possibly identical to that of the X5, | ||
21 | so that code was used here but left #if 0'ed out for the moment */ | ||
22 | |||
23 | #include "config.h" | ||
24 | #include "cpu.h" | ||
25 | #include "system.h" | ||
26 | #include "backlight.h" | ||
27 | |||
28 | void __backlight_on(void) | ||
29 | { | ||
30 | #if 0 | ||
31 | int level = set_irq_level(HIGHEST_IRQ_LEVEL); | ||
32 | pcf50606_write(0x38, 0xb0); /* Backlight ON, GPO1INV=1, GPO1ACT=011 */ | ||
33 | set_irq_level(level); | ||
34 | #endif | ||
35 | } | ||
36 | |||
37 | void __backlight_off(void) | ||
38 | { | ||
39 | #if 0 | ||
40 | int level = set_irq_level(HIGHEST_IRQ_LEVEL); | ||
41 | pcf50606_write(0x38, 0x80); /* Backlight OFF, GPO1INV=1, GPO1ACT=000 */ | ||
42 | set_irq_level(level); | ||
43 | #endif | ||
44 | } | ||
diff --git a/firmware/target/arm/tatung/tpj1022/button-target.h b/firmware/target/arm/tatung/tpj1022/button-target.h new file mode 100644 index 0000000000..74bd61ed3d --- /dev/null +++ b/firmware/target/arm/tatung/tpj1022/button-target.h | |||
@@ -0,0 +1,58 @@ | |||
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 | #ifndef _BUTTON_TARGET_H_ | ||
21 | #define _BUTTON_TARGET_H_ | ||
22 | |||
23 | #include <stdbool.h> | ||
24 | #include "config.h" | ||
25 | |||
26 | #define HAS_BUTTON_HOLD | ||
27 | |||
28 | bool button_hold(void); | ||
29 | void button_init_device(void); | ||
30 | int button_read_device(void); | ||
31 | |||
32 | /* Tatung Elio TPJ-1022 button codes */ | ||
33 | |||
34 | /* Main unit's buttons */ | ||
35 | #define BUTTON_POWER 0x00000001 | ||
36 | |||
37 | #define BUTTON_LEFT 0x00000002 | ||
38 | #define BUTTON_RIGHT 0x00000004 | ||
39 | #define BUTTON_UP 0x00000008 | ||
40 | #define BUTTON_DOWN 0x00000010 | ||
41 | |||
42 | #define BUTTON_MENU 0x00000020 | ||
43 | #define BUTTON_FF 0x00000040 | ||
44 | #define BUTTON_REW 0x00000080 | ||
45 | #define BUTTON_REC 0x00000100 | ||
46 | #define BUTTON_AB 0x00000200 | ||
47 | #define BUTTON_PLUS 0x00000400 | ||
48 | #define BUTTON_MINUS 0x00000800 | ||
49 | |||
50 | #define BUTTON_MAIN 0x00000fff | ||
51 | |||
52 | /* No Remote control */ | ||
53 | #define BUTTON_REMOTE 0 | ||
54 | |||
55 | #define POWEROFF_BUTTON BUTTON_POWER | ||
56 | #define POWEROFF_COUNT 10 | ||
57 | |||
58 | #endif /* _BUTTON_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/tatung/tpj1022/button-tpj1022.c b/firmware/target/arm/tatung/tpj1022/button-tpj1022.c new file mode 100644 index 0000000000..f0b338c1c1 --- /dev/null +++ b/firmware/target/arm/tatung/tpj1022/button-tpj1022.c | |||
@@ -0,0 +1,83 @@ | |||
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 | /* Custom written for the TPJ-1022 based on analysis of the GPIO data */ | ||
21 | |||
22 | #include <stdlib.h> | ||
23 | #include "config.h" | ||
24 | #include "cpu.h" | ||
25 | #include "system.h" | ||
26 | #include "button.h" | ||
27 | #include "kernel.h" | ||
28 | #include "backlight.h" | ||
29 | #include "adc.h" | ||
30 | #include "system.h" | ||
31 | |||
32 | void button_init_device(void) | ||
33 | { | ||
34 | /* No hardware initialisation required as it is done by the bootloader */ | ||
35 | } | ||
36 | |||
37 | bool button_hold(void) | ||
38 | { | ||
39 | return false; | ||
40 | } | ||
41 | |||
42 | /* | ||
43 | * Get button pressed from hardware | ||
44 | */ | ||
45 | int button_read_device(void) | ||
46 | { | ||
47 | int btn = BUTTON_NONE; | ||
48 | unsigned char state; | ||
49 | static bool hold_button = false; | ||
50 | |||
51 | #if 0 | ||
52 | /* light handling */ | ||
53 | if (hold_button && !button_hold()) | ||
54 | { | ||
55 | backlight_on(); | ||
56 | } | ||
57 | #endif | ||
58 | |||
59 | hold_button = button_hold(); | ||
60 | if (!hold_button) | ||
61 | { | ||
62 | /* Read normal buttons */ | ||
63 | state = GPIOA_INPUT_VAL; | ||
64 | if ((state & 0x2) == 0) btn |= BUTTON_REW; | ||
65 | if ((state & 0x4) == 0) btn |= BUTTON_FF; | ||
66 | if ((state & 0x80) == 0) btn |= BUTTON_RIGHT; | ||
67 | |||
68 | /* Buttons left to figure out: | ||
69 | button_hold() | ||
70 | BUTTON_POWER | ||
71 | BUTTON_LEFT | ||
72 | BUTTON_UP | ||
73 | BUTTON_DOWN | ||
74 | BUTTON_MENU | ||
75 | BUTTON_REC | ||
76 | BUTTON_AB | ||
77 | BUTTON_PLUS | ||
78 | BUTTON_MINUS | ||
79 | */ | ||
80 | } | ||
81 | |||
82 | return btn; | ||
83 | } | ||
diff --git a/firmware/target/arm/tatung/tpj1022/lcd-tpj1022.c b/firmware/target/arm/tatung/tpj1022/lcd-tpj1022.c new file mode 100644 index 0000000000..53f32792c3 --- /dev/null +++ b/firmware/target/arm/tatung/tpj1022/lcd-tpj1022.c | |||
@@ -0,0 +1,97 @@ | |||
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 | #include "config.h" | ||
20 | #include "cpu.h" | ||
21 | #include "lcd.h" | ||
22 | #include "kernel.h" | ||
23 | #include "system.h" | ||
24 | |||
25 | /*** hardware configuration ***/ | ||
26 | |||
27 | void lcd_set_contrast(int val) | ||
28 | { | ||
29 | /* TODO: Implement lcd_set_contrast() */ | ||
30 | (void)val; | ||
31 | } | ||
32 | |||
33 | void lcd_set_invert_display(bool yesno) | ||
34 | { | ||
35 | /* TODO: Implement lcd_set_invert_display() */ | ||
36 | (void)yesno; | ||
37 | } | ||
38 | |||
39 | /* turn the display upside down (call lcd_update() afterwards) */ | ||
40 | void lcd_set_flip(bool yesno) | ||
41 | { | ||
42 | /* TODO: Implement lcd_set_flip() */ | ||
43 | (void)yesno; | ||
44 | } | ||
45 | |||
46 | /* LCD init */ | ||
47 | void lcd_init_device(void) | ||
48 | { | ||
49 | |||
50 | } | ||
51 | |||
52 | /*** update functions ***/ | ||
53 | |||
54 | /* Performance function that works with an external buffer | ||
55 | note that by and bheight are in 4-pixel units! */ | ||
56 | void lcd_blit(const fb_data* data, int x, int by, int width, | ||
57 | int bheight, int stride) | ||
58 | { | ||
59 | /* TODO: Implement lcd_blit() */ | ||
60 | (void)data; | ||
61 | (void)x; | ||
62 | (void)by; | ||
63 | (void)width; | ||
64 | (void)bheight; | ||
65 | (void)stride; | ||
66 | } | ||
67 | |||
68 | /* Performance function to blit a YUV bitmap directly to the LCD */ | ||
69 | void lcd_yuv_blit(unsigned char * const src[3], | ||
70 | int src_x, int src_y, int stride, | ||
71 | int x, int y, int width, int height) | ||
72 | { | ||
73 | (void)src; | ||
74 | (void)src_x; | ||
75 | (void)src_y; | ||
76 | (void)stride; | ||
77 | (void)x; | ||
78 | (void)y; | ||
79 | (void)width; | ||
80 | (void)height; | ||
81 | } | ||
82 | |||
83 | /* Update a fraction of the display. */ | ||
84 | void lcd_update_rect(int x0, int y0, int width, int height) | ||
85 | { | ||
86 | (void)x0; | ||
87 | (void)y0; | ||
88 | (void)width; | ||
89 | (void)height; | ||
90 | } | ||
91 | |||
92 | /* Update the display. | ||
93 | This must be called after all other LCD functions that change the display. */ | ||
94 | void lcd_update(void) | ||
95 | { | ||
96 | lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); | ||
97 | } | ||
diff --git a/firmware/target/arm/tatung/tpj1022/power-tpj1022.c b/firmware/target/arm/tatung/tpj1022/power-tpj1022.c new file mode 100644 index 0000000000..e8bc4e1fb0 --- /dev/null +++ b/firmware/target/arm/tatung/tpj1022/power-tpj1022.c | |||
@@ -0,0 +1,67 @@ | |||
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 | /* Created from power.c using some iPod code, and some custom stuff based on | ||
21 | GPIO analysis | ||
22 | */ | ||
23 | |||
24 | #include "config.h" | ||
25 | #include "cpu.h" | ||
26 | #include <stdbool.h> | ||
27 | #include "adc.h" | ||
28 | #include "kernel.h" | ||
29 | #include "system.h" | ||
30 | #include "power.h" | ||
31 | #include "hwcompat.h" | ||
32 | #include "logf.h" | ||
33 | #include "usb.h" | ||
34 | |||
35 | #if CONFIG_CHARGING == CHARGING_CONTROL | ||
36 | bool charger_enabled; | ||
37 | #endif | ||
38 | |||
39 | void power_init(void) | ||
40 | { | ||
41 | } | ||
42 | |||
43 | bool charger_inserted(void) | ||
44 | { | ||
45 | return false; | ||
46 | } | ||
47 | |||
48 | void ide_power_enable(bool on) | ||
49 | { | ||
50 | (void)on; | ||
51 | /* We do nothing on the iPod */ | ||
52 | } | ||
53 | |||
54 | |||
55 | bool ide_powered(void) | ||
56 | { | ||
57 | /* pretend we are always powered - we don't turn it off on the ipod */ | ||
58 | return true; | ||
59 | } | ||
60 | |||
61 | void power_off(void) | ||
62 | { | ||
63 | /* Give things a second to settle before cutting power */ | ||
64 | sleep(HZ); | ||
65 | |||
66 | //GPIOF_OUTPUT_VAL &=~ 0x20; | ||
67 | } | ||
diff --git a/firmware/target/arm/tatung/tpj1022/usb-target.h b/firmware/target/arm/tatung/tpj1022/usb-target.h new file mode 100644 index 0000000000..7a17f7bacf --- /dev/null +++ b/firmware/target/arm/tatung/tpj1022/usb-target.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardelll | ||
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 | /* Based off x5 version */ | ||
21 | |||
22 | #ifndef USB_TARGET_H | ||
23 | #define USB_TARGET_H | ||
24 | |||
25 | bool usb_init_device(void); | ||
26 | |||
27 | #endif | ||
diff --git a/firmware/target/arm/tatung/tpj1022/usb-tpj1022.c b/firmware/target/arm/tatung/tpj1022/usb-tpj1022.c new file mode 100644 index 0000000000..b238de4369 --- /dev/null +++ b/firmware/target/arm/tatung/tpj1022/usb-tpj1022.c | |||
@@ -0,0 +1,107 @@ | |||
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 | /* Code from the iPod port but commented out. USB detection custom made based | ||
21 | on GPIO analysis */ | ||
22 | |||
23 | #include "config.h" | ||
24 | #include "cpu.h" | ||
25 | #include "kernel.h" | ||
26 | #include "thread.h" | ||
27 | #include "system.h" | ||
28 | #include "debug.h" | ||
29 | #include "ata.h" | ||
30 | #include "fat.h" | ||
31 | #include "disk.h" | ||
32 | #include "panic.h" | ||
33 | #include "lcd.h" | ||
34 | #include "adc.h" | ||
35 | #include "usb.h" | ||
36 | #include "button.h" | ||
37 | #include "sprintf.h" | ||
38 | #include "string.h" | ||
39 | #include "hwcompat.h" | ||
40 | #ifdef HAVE_MMC | ||
41 | #include "ata_mmc.h" | ||
42 | #endif | ||
43 | |||
44 | void usb_init_device(void) | ||
45 | { | ||
46 | #if 0 | ||
47 | int r0; | ||
48 | outl(inl(0x70000084) | 0x200, 0x70000084); | ||
49 | |||
50 | outl(inl(0x7000002C) | 0x3000000, 0x7000002C); | ||
51 | outl(inl(0x6000600C) | 0x400000, 0x6000600C); | ||
52 | |||
53 | outl(inl(0x60006004) | 0x400000, 0x60006004); /* reset usb start */ | ||
54 | outl(inl(0x60006004) & ~0x400000, 0x60006004); /* reset usb end */ | ||
55 | |||
56 | outl(inl(0x70000020) | 0x80000000, 0x70000020); | ||
57 | while ((inl(0x70000028) & 0x80) == 0); | ||
58 | |||
59 | outl(inl(0xc5000184) | 0x100, 0xc5000184); | ||
60 | while ((inl(0xc5000184) & 0x100) != 0); | ||
61 | |||
62 | outl(inl(0xc50001A4) | 0x5F000000, 0xc50001A4); | ||
63 | if ((inl(0xc50001A4) & 0x100) == 0) { | ||
64 | outl(inl(0xc50001A8) & ~0x3, 0xc50001A8); | ||
65 | outl(inl(0xc50001A8) | 0x2, 0xc50001A8); | ||
66 | outl(inl(0x70000028) | 0x4000, 0x70000028); | ||
67 | outl(inl(0x70000028) | 0x2, 0x70000028); | ||
68 | } else { | ||
69 | outl(inl(0xc50001A8) | 0x3, 0xc50001A8); | ||
70 | outl(inl(0x70000028) &~0x4000, 0x70000028); | ||
71 | outl(inl(0x70000028) | 0x2, 0x70000028); | ||
72 | } | ||
73 | outl(inl(0xc5000140) | 0x2, 0xc5000140); | ||
74 | while((inl(0xc5000140) & 0x2) != 0); | ||
75 | r0 = inl(0xc5000184); | ||
76 | |||
77 | /* Note from IPL source (referring to next 5 lines of code: | ||
78 | THIS NEEDS TO BE CHANGED ONCE THERE IS KERNEL USB */ | ||
79 | outl(inl(0x70000020) | 0x80000000, 0x70000020); | ||
80 | outl(inl(0x6000600C) | 0x400000, 0x6000600C); | ||
81 | while ((inl(0x70000028) & 0x80) == 0); | ||
82 | outl(inl(0x70000028) | 0x2, 0x70000028); | ||
83 | |||
84 | udelay(0x186A0); | ||
85 | #endif | ||
86 | } | ||
87 | |||
88 | bool usb_detect(void) | ||
89 | { | ||
90 | return false; | ||
91 | } | ||
92 | |||
93 | void usb_enable(bool on) | ||
94 | { | ||
95 | (void)on; | ||
96 | #if 0 | ||
97 | /* For the ipod, we can only do one thing with USB mode - reboot | ||
98 | into Apple's flash-based disk-mode. This does not return. */ | ||
99 | if (on) | ||
100 | { | ||
101 | /* The following code is copied from ipodlinux */ | ||
102 | unsigned char* storage_ptr = (unsigned char *)0x40017F00; | ||
103 | memcpy(storage_ptr, "diskmode\0\0hotstuff\0\0\1", 21); | ||
104 | DEV_RS |= 4; /* Reboot */ | ||
105 | } | ||
106 | #endif | ||
107 | } | ||
diff --git a/tools/configure b/tools/configure index 697abceb00..b4c2fd8b21 100755 --- a/tools/configure +++ b/tools/configure | |||
@@ -442,6 +442,9 @@ cat <<EOF | |||
442 | 442 | ||
443 | ==iAudio== ==Toshiba== ==SanDisk== | 443 | ==iAudio== ==Toshiba== ==SanDisk== |
444 | 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200 | 444 | 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200 |
445 | |||
446 | ==Tatung== | ||
447 | 60) Elio TPJ-1022 | ||
445 | EOF | 448 | EOF |
446 | 449 | ||
447 | buildfor=`input`; | 450 | buildfor=`input`; |
@@ -1018,6 +1021,32 @@ EOF | |||
1018 | t_model="h10" | 1021 | t_model="h10" |
1019 | ;; | 1022 | ;; |
1020 | 1023 | ||
1024 | 60|tpj1022) | ||
1025 | target_id=23 | ||
1026 | archos="tpj1022" | ||
1027 | target="-DELIO_TPJ1022" | ||
1028 | memory=32 # always | ||
1029 | arm7tdmicc | ||
1030 | tool="$rootdir/tools/scramble -add tpj2" | ||
1031 | bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" | ||
1032 | bmp2rb_native="$rootdir/tools/bmp2rb -f 5" | ||
1033 | output="rockbox.elio" | ||
1034 | appextra="recorder:gui" | ||
1035 | archosrom="" | ||
1036 | flash="" | ||
1037 | plugins="yes" | ||
1038 | codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a" | ||
1039 | boottool="$rootdir/tools/scramble -mi4v2" | ||
1040 | bootoutput="pp5020.mi4" | ||
1041 | # toolset is the tools within the tools directory that we build for | ||
1042 | # this particular target. | ||
1043 | toolset="$genericbitmaptools scramble" | ||
1044 | # architecture, manufacturer and model for the target-tree build | ||
1045 | t_cpu="arm" | ||
1046 | t_manufacturer="tatung" | ||
1047 | t_model="tpj1022" | ||
1048 | ;; | ||
1049 | |||
1021 | *) | 1050 | *) |
1022 | echo "Please select a supported target platform!" | 1051 | echo "Please select a supported target platform!" |
1023 | exit | 1052 | exit |
diff --git a/tools/scramble.c b/tools/scramble.c index 50d745b388..30d4ea9edb 100644 --- a/tools/scramble.c +++ b/tools/scramble.c | |||
@@ -205,6 +205,8 @@ int main (int argc, char** argv) | |||
205 | modelnum = 13; | 205 | modelnum = 13; |
206 | else if(!strcmp(&argv[1][5], "h10_5gb")) | 206 | else if(!strcmp(&argv[1][5], "h10_5gb")) |
207 | modelnum = 14; | 207 | modelnum = 14; |
208 | else if(!strcmp(&argv[1][5], "tpj2")) | ||
209 | modelnum = 15; | ||
208 | else { | 210 | else { |
209 | fprintf(stderr, "unsupported model: %s\n", &argv[1][5]); | 211 | fprintf(stderr, "unsupported model: %s\n", &argv[1][5]); |
210 | return 2; | 212 | return 2; |