summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/SOURCES13
-rw-r--r--firmware/drivers/ata.c69
-rw-r--r--firmware/drivers/serial.c5
-rw-r--r--firmware/export/button.h25
-rw-r--r--firmware/export/config-gigabeat.h19
-rw-r--r--firmware/export/s3c2440.h3
-rw-r--r--firmware/kernel.c24
-rw-r--r--firmware/pcm_playback.c64
-rw-r--r--firmware/system.c8
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c43
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/ata-target.h66
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c38
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/backlight-target.h26
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/button-meg-fx.c84
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/button-target.h58
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c31
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/power-meg-fx.c75
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/usb-meg-fx.c52
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/usb-target.h26
-rw-r--r--firmware/thread.c2
-rw-r--r--firmware/usb.c5
-rwxr-xr-xtools/configure4
22 files changed, 622 insertions, 118 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index a0e4922154..fd83c05982 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -137,6 +137,8 @@ drivers/i2c-pp5020.c
137drivers/i2c-pp5002.c 137drivers/i2c-pp5002.c
138#elif CONFIG_I2C == I2C_PNX0101 138#elif CONFIG_I2C == I2C_PNX0101
139drivers/i2c-pnx0101.c 139drivers/i2c-pnx0101.c
140#elif CONFIG_I2C == I2C_S3C2440
141/* no i2c driver yet */
140#else 142#else
141drivers/i2c.c 143drivers/i2c.c
142#endif 144#endif
@@ -256,3 +258,14 @@ target/arm/iriver/h10/usb-h10.c
256target/arm/iriver/h10/lcd-h10.c 258target/arm/iriver/h10/lcd-h10.c
257#endif 259#endif
258#endif 260#endif
261
262#ifdef GIGABEAT_F
263#ifndef SIMULATOR
264target/arm/gigabeat/meg-fx/backlight-meg-fx.c
265target/arm/gigabeat/meg-fx/button-meg-fx.c
266target/arm/gigabeat/meg-fx/ata-meg-fx.c
267target/arm/gigabeat/meg-fx/power-meg-fx.c
268target/arm/gigabeat/meg-fx/usb-meg-fx.c
269target/arm/gigabeat/meg-fx/lcd-meg-fx.c
270#endif
271#endif
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 9c37a15537..8593eebea1 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -274,48 +274,6 @@ int ide_read_register(int reg) {
274 return ide_reg_temp; 274 return ide_reg_temp;
275} 275}
276 276
277#elif defined(TOSHIBA_GIGABEAT_F)
278
279/* Plain C read & write loops */
280#define PREFER_C_READING
281#define PREFER_C_WRITING
282
283#define ATA_IOBASE 0x18000000
284#define ATA_DATA (*((volatile unsigned short*)(ATA_IOBASE)))
285#define ATA_ERROR (*((volatile unsigned char*)(ATA_IOBASE + 0x02)))
286#define ATA_NSECTOR (*((volatile unsigned char*)(ATA_IOBASE + 0x04)))
287#define ATA_SECTOR (*((volatile unsigned char*)(ATA_IOBASE + 0x06)))
288#define ATA_LCYL (*((volatile unsigned char*)(ATA_IOBASE + 0x08)))
289#define ATA_HCYL (*((volatile unsigned char*)(ATA_IOBASE + 0x10)))
290#define ATA_SELECT (*((volatile unsigned char*)(ATA_IOBASE + 0x12)))
291#define ATA_COMMAND (*((volatile unsigned char*)(ATA_IOBASE + 0x14)))
292#define ATA_CONTROL (*((volatile unsigned char*)(0x20000000 + 0x1c)))
293
294#define STATUS_BSY 0x80
295#define STATUS_RDY 0x40
296#define STATUS_DF 0x20
297#define STATUS_DRQ 0x08
298#define STATUS_ERR 0x01
299#define ERROR_ABRT 0x04
300
301#define WRITE_PATTERN1 0xa5
302#define WRITE_PATTERN2 0x5a
303#define WRITE_PATTERN3 0xaa
304#define WRITE_PATTERN4 0x55
305
306#define READ_PATTERN1 0xa5
307#define READ_PATTERN2 0x5a
308#define READ_PATTERN3 0xaa
309#define READ_PATTERN4 0x55
310
311#define READ_PATTERN1_MASK 0xff
312#define READ_PATTERN2_MASK 0xff
313#define READ_PATTERN3_MASK 0xff
314#define READ_PATTERN4_MASK 0xff
315
316#define SET_REG(reg,val) reg = (val)
317#define SET_16BITREG(reg,val) reg = (val)
318
319#endif 277#endif
320 278
321#ifndef NOINLINE_ATTR 279#ifndef NOINLINE_ATTR
@@ -323,6 +281,7 @@ int ide_read_register(int reg) {
323#endif 281#endif
324 282
325#define ATA_FEATURE ATA_ERROR 283#define ATA_FEATURE ATA_ERROR
284
326#define ATA_STATUS ATA_COMMAND 285#define ATA_STATUS ATA_COMMAND
327#define ATA_ALT_STATUS ATA_CONTROL 286#define ATA_ALT_STATUS ATA_CONTROL
328 287
@@ -348,7 +307,6 @@ int ide_read_register(int reg) {
348 307
349#define READ_TIMEOUT 5*HZ 308#define READ_TIMEOUT 5*HZ
350 309
351
352static struct mutex ata_mtx; 310static struct mutex ata_mtx;
353char ata_device; /* device 0 (master) or 1 (slave) */ 311char ata_device; /* device 0 (master) or 1 (slave) */
354int ata_io_address; /* 0x300 or 0x200, only valid on recorder */ 312int ata_io_address; /* 0x300 or 0x200, only valid on recorder */
@@ -430,6 +388,7 @@ static int wait_for_start_of_transfer(void)
430{ 388{
431 if (!wait_for_bsy()) 389 if (!wait_for_bsy())
432 return 0; 390 return 0;
391
433 return (ATA_ALT_STATUS & (STATUS_BSY|STATUS_DRQ)) == STATUS_DRQ; 392 return (ATA_ALT_STATUS & (STATUS_BSY|STATUS_DRQ)) == STATUS_DRQ;
434} 393}
435 394
@@ -1402,16 +1361,16 @@ static int check_registers(void)
1402 return -1; 1361 return -1;
1403 1362
1404 for (i = 0; i<64; i++) { 1363 for (i = 0; i<64; i++) {
1405 SET_REG(ATA_NSECTOR, WRITE_PATTERN1); 1364 SET_REG(ATA_NSECTOR, WRITE_PATTERN1);
1406 SET_REG(ATA_SECTOR, WRITE_PATTERN2); 1365 SET_REG(ATA_SECTOR, WRITE_PATTERN2);
1407 SET_REG(ATA_LCYL, WRITE_PATTERN3); 1366 SET_REG(ATA_LCYL, WRITE_PATTERN3);
1408 SET_REG(ATA_HCYL, WRITE_PATTERN4); 1367 SET_REG(ATA_HCYL, WRITE_PATTERN4);
1409 1368
1410 if (((ATA_NSECTOR & READ_PATTERN1_MASK) == READ_PATTERN1) && 1369 if (((ATA_NSECTOR & READ_PATTERN1_MASK) == READ_PATTERN1) &&
1411 ((ATA_SECTOR & READ_PATTERN2_MASK) == READ_PATTERN2) && 1370 ((ATA_SECTOR & READ_PATTERN2_MASK) == READ_PATTERN2) &&
1412 ((ATA_LCYL & READ_PATTERN3_MASK) == READ_PATTERN3) && 1371 ((ATA_LCYL & READ_PATTERN3_MASK) == READ_PATTERN3) &&
1413 ((ATA_HCYL & READ_PATTERN4_MASK) == READ_PATTERN4)) 1372 ((ATA_HCYL & READ_PATTERN4_MASK) == READ_PATTERN4))
1414 return 0; 1373 return 0;
1415 } 1374 }
1416 return -2; 1375 return -2;
1417#endif 1376#endif
@@ -1957,12 +1916,15 @@ int ata_init(void)
1957 } 1916 }
1958 1917
1959 rc = identify(); 1918 rc = identify();
1919
1960 if (rc) 1920 if (rc)
1961 return -40 + rc; 1921 return -40 + rc;
1922
1962 multisectors = identify_info[47] & 0xff; 1923 multisectors = identify_info[47] & 0xff;
1963 DEBUGF("ata: %d sectors per ata request\n",multisectors); 1924 DEBUGF("ata: %d sectors per ata request\n",multisectors);
1964 1925
1965 rc = freeze_lock(); 1926 rc = freeze_lock();
1927
1966 if (rc) 1928 if (rc)
1967 return -50 + rc; 1929 return -50 + rc;
1968 1930
@@ -1977,7 +1939,6 @@ int ata_init(void)
1977 sizeof(ata_stack), ata_thread_name); 1939 sizeof(ata_stack), ata_thread_name);
1978 initialized = true; 1940 initialized = true;
1979 1941
1980
1981 } 1942 }
1982 rc = set_multiple_mode(multisectors); 1943 rc = set_multiple_mode(multisectors);
1983 if (rc) 1944 if (rc)
diff --git a/firmware/drivers/serial.c b/firmware/drivers/serial.c
index f1cee96d51..46280bc8cc 100644
--- a/firmware/drivers/serial.c
+++ b/firmware/drivers/serial.c
@@ -28,10 +28,7 @@
28#include "serial.h" 28#include "serial.h"
29 29
30 30
31#if (CONFIG_CPU != MCF5249) && (CONFIG_CPU != TCC730) && \ 31#if CONFIG_CPU == SH7034
32 (CONFIG_CPU != PP5020) && (CONFIG_CPU != PNX0101) && \
33 (CONFIG_CPU != PP5002) && (CONFIG_CPU != MCF5250) && \
34 (CONFIG_CPU != PP5024)
35 32
36/* FIX: this doesn't work on iRiver or Gmini or iPod yet */ 33/* FIX: this doesn't work on iRiver or Gmini or iPod yet */
37/* iFP7xx has no remote */ 34/* iFP7xx has no remote */
diff --git a/firmware/export/button.h b/firmware/export/button.h
index 92c9415372..0e11da9da5 100644
--- a/firmware/export/button.h
+++ b/firmware/export/button.h
@@ -261,31 +261,6 @@ bool remote_button_hold(void);
261 261
262#define BUTTON_REMOTE 0 262#define BUTTON_REMOTE 0
263 263
264#elif CONFIG_KEYPAD == GIGABEAT_PAD
265/* Toshiba Gigabeat specific button codes */
266
267#define BUTTON_POWER 0x00000001
268#define BUTTON_MENU 0x00000002
269
270#define BUTTON_LEFT 0x00000004
271#define BUTTON_RIGHT 0x00000008
272#define BUTTON_UP 0x00000010
273#define BUTTON_DOWN 0x00000020
274
275#define BUTTON_VOL_UP 0x00000040
276#define BUTTON_VOL_DOWN 0x00000080
277
278#define BUTTON_SELECT 0x00000100
279#define BUTTON_A 0x00000200
280
281
282#define BUTTON_MAIN (BUTTON_POWER|BUTTON_MENU|BUTTON_LEFT|BUTTON_RIGHT\
283 |BUTTON_UP|BUTTON_DOWN|BUTTON_VOL_UP|BUTTON_VOL_DOWN\
284 |BUTTON_SELECT|BUTTON_A)
285
286
287#define BUTTON_REMOTE 0
288
289#elif 0 264#elif 0
290 265
291/* 266/*
diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h
index 1ebbdbf908..fee2b79b2e 100644
--- a/firmware/export/config-gigabeat.h
+++ b/firmware/export/config-gigabeat.h
@@ -1,6 +1,8 @@
1/* 1/*
2 * This config file is for toshiba Gigabeat F 2 * This config file is for toshiba Gigabeat F
3 */ 3 */
4#define TARGET_TREE /* this target is using the target tree system */
5
4#define TOSHIBA_GIGABEAT_F 1 6#define TOSHIBA_GIGABEAT_F 1
5 7
6/* For Rolo and boot loader */ 8/* For Rolo and boot loader */
@@ -25,7 +27,10 @@
25#define CONFIG_CODEC SWCODEC 27#define CONFIG_CODEC SWCODEC
26 28
27/* define this if you have a real-time clock */ 29/* define this if you have a real-time clock */
28//#define CONFIG_RTC RTC_PCF50606 30
31#if 0 /* TODO */
32#define CONFIG_RTC RTC_S3C2440
33#endif
29 34
30/* Define this for LCD backlight available */ 35/* Define this for LCD backlight available */
31#define CONFIG_BACKLIGHT BL_GIGABEAT /* port controlled PWM */ 36#define CONFIG_BACKLIGHT BL_GIGABEAT /* port controlled PWM */
@@ -42,7 +47,7 @@
42/* Define this if you have the WM8975 audio codec */ 47/* Define this if you have the WM8975 audio codec */
43#define HAVE_WM8751 48#define HAVE_WM8751
44 49
45#define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ 50#define BATTERY_CAPACITY_DEFAULT 830 /* default battery capacity */
46 51
47#ifndef SIMULATOR 52#ifndef SIMULATOR
48 53
@@ -59,7 +64,7 @@
59#define BATTERY_CAPACITY_INC 50 /* capacity increment */ 64#define BATTERY_CAPACITY_INC 50 /* capacity increment */
60#define BATTERY_TYPES_COUNT 1 /* only one type */ 65#define BATTERY_TYPES_COUNT 1 /* only one type */
61 66
62#define BATTERY_SCALE_FACTOR 23437 /* FIX: this value is picked at random */ 67#define BATTERY_SCALE_FACTOR 6852 /* FIX: this value is picked at random */
63 68
64/* Hardware controlled charging? FIXME */ 69/* Hardware controlled charging? FIXME */
65#define CONFIG_CHARGING CHARGING_SIMPLE 70#define CONFIG_CHARGING CHARGING_SIMPLE
@@ -74,7 +79,9 @@
74#define CPU_FREQ 16934400 79#define CPU_FREQ 16934400
75 80
76/* Define this if you have ATA power-off control */ 81/* Define this if you have ATA power-off control */
82#if 0 /* TODO */
77#define HAVE_ATA_POWER_OFF 83#define HAVE_ATA_POWER_OFF
84#endif
78 85
79/* Virtual LED (icon) */ 86/* Virtual LED (icon) */
80#define CONFIG_LED LED_VIRTUAL 87#define CONFIG_LED LED_VIRTUAL
@@ -87,14 +94,18 @@
87/* Offset ( in the firmware file's header ) to the real data */ 94/* Offset ( in the firmware file's header ) to the real data */
88#define FIRMWARE_OFFSET_FILE_DATA 8 95#define FIRMWARE_OFFSET_FILE_DATA 8
89 96
90#define USB_IRIVERSTYLE 97#define USB_GIGABEAT_STYLE
91 98
92/* Define this if you have adjustable CPU frequency */ 99/* Define this if you have adjustable CPU frequency */
100#if 0 /* TODO */
93#define HAVE_ADJUSTABLE_CPU_FREQ 101#define HAVE_ADJUSTABLE_CPU_FREQ
102#endif
94 103
95#define BOOTFILE_EXT "gigabeat" 104#define BOOTFILE_EXT "gigabeat"
96#define BOOTFILE "rockbox." BOOTFILE_EXT 105#define BOOTFILE "rockbox." BOOTFILE_EXT
97 106
107#if 0 /* TODO */
98#define HAVE_BACKLIGHT_BRIGHTNESS 108#define HAVE_BACKLIGHT_BRIGHTNESS
109#endif
99 110
100#endif 111#endif
diff --git a/firmware/export/s3c2440.h b/firmware/export/s3c2440.h
index 9b42256a38..799c14eb0e 100644
--- a/firmware/export/s3c2440.h
+++ b/firmware/export/s3c2440.h
@@ -143,6 +143,9 @@
143#define LCDINTMSK (*(volatile int *)0x4D00005C) /* LCD interrupt mask */ 143#define LCDINTMSK (*(volatile int *)0x4D00005C) /* LCD interrupt mask */
144#define TCONSEL (*(volatile int *)0x4D000060) /* TCON(LPC3600/LCC3600) control */ 144#define TCONSEL (*(volatile int *)0x4D000060) /* TCON(LPC3600/LCC3600) control */
145 145
146/* The following should be computed but for now, we cheat. */
147#define FRAME ( (volatile short * ) 0x31E00000 ) /* LCD Frame buffer */
148
146/* NAND Flash */ 149/* NAND Flash */
147 150
148#define NFCONF (*(volatile int *)0x4E000000) /* NAND flash configuration */ 151#define NFCONF (*(volatile int *)0x4E000000) /* NAND flash configuration */
diff --git a/firmware/kernel.c b/firmware/kernel.c
index 979dbb4759..7c5c74c662 100644
--- a/firmware/kernel.c
+++ b/firmware/kernel.c
@@ -415,7 +415,31 @@ void tick_start(unsigned int interval_in_ms)
415 415
416 TIMERR08 |= 0x80; 416 TIMERR08 |= 0x80;
417} 417}
418#elif CONFIG_CPU == S3C2440
419void tick_start(unsigned int interval_in_ms)
420{
421 unsigned long count;
422
423 /* period = (n + 1) / 128 , n = tick time count (1~127)*/
424 count = interval_in_ms / 1000 * 128 - 1;
418 425
426 if(count > 127)
427 {
428 panicf("Error! The tick interval is too long (%d ms)\n",
429 interval_in_ms);
430 return;
431 }
432
433 /* Disable the tick */
434 TICNT &= ~(1<<7);
435 /* Set the count value */
436 TICNT |= count;
437 /* Start up the ticker */
438 TICNT |= (1<<7);
439
440 /* need interrupt handler ??? */
441
442}
419#endif 443#endif
420 444
421int tick_add_task(void (*f)(void)) 445int tick_add_task(void (*f)(void))
diff --git a/firmware/pcm_playback.c b/firmware/pcm_playback.c
index f7a2de52c2..473c49f30d 100644
--- a/firmware/pcm_playback.c
+++ b/firmware/pcm_playback.c
@@ -55,6 +55,31 @@ static bool pcm_paused;
55/* the registered callback function to ask for more mp3 data */ 55/* the registered callback function to ask for more mp3 data */
56static void (*callback_for_more)(unsigned char**, size_t*) IDATA_ATTR = NULL; 56static void (*callback_for_more)(unsigned char**, size_t*) IDATA_ATTR = NULL;
57 57
58#if (CONFIG_CPU == PNX0101 || CONFIG_CPU == S3C2440)
59
60/* TODO: Implement for iFP7xx
61 For now, just implement some dummy functions.
62*/
63
64void pcm_init(void)
65{
66
67}
68
69void pcm_set_frequency(unsigned int frequency)
70{
71 (void)frequency;
72}
73
74void pcm_play_stop(void)
75{
76}
77
78size_t pcm_get_bytes_waiting(void)
79{
80 return 0;
81}
82#else
58#ifdef CPU_COLDFIRE 83#ifdef CPU_COLDFIRE
59 84
60#ifdef HAVE_SPDIF_OUT 85#ifdef HAVE_SPDIF_OUT
@@ -501,29 +526,13 @@ void pcm_init(void)
501 dma_stop(); 526 dma_stop();
502} 527}
503 528
504#elif (CONFIG_CPU == PNX0101) 529#endif
505
506/* TODO: Implement for iFP7xx
507 For now, just implement some dummy functions.
508*/
509
510void pcm_init(void)
511{
512
513}
514
515void pcm_set_frequency(unsigned int frequency)
516{
517 (void)frequency;
518}
519 530
520void pcm_play_stop(void) 531void pcm_play_stop(void)
521{ 532{
522} 533 if (pcm_playing) {
523 534 dma_stop();
524size_t pcm_get_bytes_waiting(void) 535 }
525{
526 return 0;
527} 536}
528 537
529#endif 538#endif
@@ -564,13 +573,6 @@ void pcm_mute(bool mute)
564 sleep(HZ/16); 573 sleep(HZ/16);
565} 574}
566 575
567void pcm_play_stop(void)
568{
569 if (pcm_playing) {
570 dma_stop();
571 }
572}
573
574void pcm_play_pause(bool play) 576void pcm_play_pause(bool play)
575{ 577{
576 bool needs_change = pcm_paused == play; 578 bool needs_change = pcm_paused == play;
@@ -620,11 +622,11 @@ void pcm_play_pause(bool play)
620 IISFIFO_WR = (*(p++))<<16; 622 IISFIFO_WR = (*(p++))<<16;
621 p_size-=4; 623 p_size-=4;
622 } 624 }
623#elif (CONFIG_CPU == PNX0101) /* End wmcodecs */ 625#elif (CONFIG_CPU == PNX0101 || CONFIG_CPU == S3C2440) /* End wmcodecs */
624 /* nothing yet */ 626 /* nothing yet */
625#endif 627#endif
626 } else { 628 } else {
627#if (CONFIG_CPU != PNX0101) 629#if (CONFIG_CPU != PNX0101 && CONFIG_CPU != S3C2440)
628 size_t next_size; 630 size_t next_size;
629 unsigned char *next_start; 631 unsigned char *next_start;
630 void (*get_more)(unsigned char**, size_t*) = callback_for_more; 632 void (*get_more)(unsigned char**, size_t*) = callback_for_more;
@@ -665,7 +667,7 @@ void pcm_play_pause(bool play)
665#endif 667#endif
666 668
667 disable_fiq(); 669 disable_fiq();
668#elif (CONFIG_CPU == PNX0101) /* End wmcodecs */ 670#elif (CONFIG_CPU == PNX0101 || CONFIG_CPU == S3C2440) /* End wmcodecs */
669 /* nothing yet */ 671 /* nothing yet */
670#endif 672#endif
671 } 673 }
@@ -697,7 +699,7 @@ bool pcm_is_paused(void) {
697 699
698void pcm_calculate_peaks(int *left, int *right) 700void pcm_calculate_peaks(int *left, int *right)
699{ 701{
700#if (CONFIG_CPU == PNX0101) 702#if (CONFIG_CPU == PNX0101 || CONFIG_CPU == S3C2440)
701 (void)left; 703 (void)left;
702 (void)right; 704 (void)right;
703#else 705#else
diff --git a/firmware/system.c b/firmware/system.c
index c635254a8a..2767f50edc 100644
--- a/firmware/system.c
+++ b/firmware/system.c
@@ -77,7 +77,15 @@ void cpu_idle_mode(bool on_off)
77} 77}
78 78
79#endif 79#endif
80#if CONFIG_CPU == S3C2440
80 81
82void system_reboot(void) {
83}
84
85void system_init(void) {
86}
87
88#endif
81#if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR) 89#if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR)
82bool detect_flashed_rockbox(void) 90bool detect_flashed_rockbox(void)
83{ 91{
diff --git a/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c
new file mode 100644
index 0000000000..58fec1e6a3
--- /dev/null
+++ b/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c
@@ -0,0 +1,43 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Linus Nielsen Feltzing
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 <stdbool.h>
22#include "kernel.h"
23#include "system.h"
24#include "power.h"
25#include "pcf50606.h"
26
27void ata_reset(void)
28{
29}
30
31void ata_enable(bool on)
32{
33 (void)on;
34}
35
36bool ata_is_coldstart(void)
37{
38 return true; /* TODO */
39}
40
41void ata_device_init(void)
42{
43}
diff --git a/firmware/target/arm/gigabeat/meg-fx/ata-target.h b/firmware/target/arm/gigabeat/meg-fx/ata-target.h
new file mode 100644
index 0000000000..95b66ab1bd
--- /dev/null
+++ b/firmware/target/arm/gigabeat/meg-fx/ata-target.h
@@ -0,0 +1,66 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Linus Nielsen Feltzing
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 ATA_TARGET_H
20#define ATA_TARGET_H
21
22/* Plain C read & write loops */
23#define PREFER_C_READING
24#define PREFER_C_WRITING
25
26#define ATA_IOBASE 0x18000000
27#define ATA_DATA (*((volatile unsigned short*)(ATA_IOBASE)))
28#define ATA_ERROR (*((volatile unsigned char*)(ATA_IOBASE + 0x02)))
29#define ATA_NSECTOR (*((volatile unsigned char*)(ATA_IOBASE + 0x04)))
30#define ATA_SECTOR (*((volatile unsigned char*)(ATA_IOBASE + 0x06)))
31#define ATA_LCYL (*((volatile unsigned char*)(ATA_IOBASE + 0x08)))
32#define ATA_HCYL (*((volatile unsigned char*)(ATA_IOBASE + 0x0A)))
33#define ATA_SELECT (*((volatile unsigned char*)(ATA_IOBASE + 0x0C)))
34#define ATA_COMMAND (*((volatile unsigned char*)(ATA_IOBASE + 0x0E)))
35#define ATA_CONTROL (*((volatile unsigned char*)(0x20000000 + 0x1C)))
36
37#define STATUS_BSY 0x80
38#define STATUS_RDY 0x40
39#define STATUS_DF 0x20
40#define STATUS_DRQ 0x08
41#define STATUS_ERR 0x01
42#define ERROR_ABRT 0x04
43
44#define WRITE_PATTERN1 0xa5
45#define WRITE_PATTERN2 0x5a
46#define WRITE_PATTERN3 0xaa
47#define WRITE_PATTERN4 0x55
48
49#define READ_PATTERN1 0xa5
50#define READ_PATTERN2 0x5a
51#define READ_PATTERN3 0xaa
52#define READ_PATTERN4 0x55
53
54#define READ_PATTERN1_MASK 0xff
55#define READ_PATTERN2_MASK 0xff
56#define READ_PATTERN3_MASK 0xff
57#define READ_PATTERN4_MASK 0xff
58
59#define SET_REG(reg,val) reg = (val)
60#define SET_16BITREG(reg,val) reg = (val)
61
62void ata_reset(void);
63void ata_device_init(void);
64bool ata_is_coldstart(void);
65
66#endif
diff --git a/firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c
new file mode 100644
index 0000000000..8f7c30b5d7
--- /dev/null
+++ b/firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c
@@ -0,0 +1,38 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Linus Nielsen Feltzing
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 "backlight.h"
23#include "lcd.h"
24
25void __backlight_on(void)
26{
27}
28
29void __backlight_off(void)
30{
31}
32
33void __backlight_set_brightness(int val)
34{
35 /* The SC606 LED driver of the gigabeat series
36 * can set the brightness in 64 steps */
37 val &= 0x3F;
38}
diff --git a/firmware/target/arm/gigabeat/meg-fx/backlight-target.h b/firmware/target/arm/gigabeat/meg-fx/backlight-target.h
new file mode 100644
index 0000000000..3204293131
--- /dev/null
+++ b/firmware/target/arm/gigabeat/meg-fx/backlight-target.h
@@ -0,0 +1,26 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Linus Nielsen Feltzing
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 BACKLIGHT_TARGET_H
20#define BACKLIGHT_TARGET_H
21
22void __backlight_on(void);
23void __backlight_off(void);
24void __backlight_set_brightness(int val);
25
26#endif
diff --git a/firmware/target/arm/gigabeat/meg-fx/button-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/button-meg-fx.c
new file mode 100644
index 0000000000..88a1b4de09
--- /dev/null
+++ b/firmware/target/arm/gigabeat/meg-fx/button-meg-fx.c
@@ -0,0 +1,84 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Linus Nielsen Feltzing
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#include <stdlib.h>
21#include "config.h"
22#include "cpu.h"
23#include "system.h"
24#include "button.h"
25#include "kernel.h"
26#include "backlight.h"
27#include "adc.h"
28#include "system.h"
29
30void button_init_device(void)
31{
32 /* Power, Remote Play & Hold switch */
33}
34
35bool button_hold(void)
36{
37 return (GPGDAT & (1 << 15));
38}
39
40int button_read_device(void)
41{
42 int btn = BUTTON_NONE;
43 int touchpad = GPJDAT;
44 int buttons = GPGDAT;
45
46 /* Check for hold first */
47 if (buttons & (1 << 15))
48 return btn;
49
50 /* the side buttons */
51 if (buttons & (1 << 0))
52 btn |= BUTTON_POWER;
53
54 if (buttons & (1 << 1))
55 btn |= BUTTON_MENU;
56
57 if (buttons & (1 << 2))
58 btn |= BUTTON_VOL_UP;
59
60 if (buttons & (1 << 3))
61 btn |= BUTTON_VOL_DOWN;
62
63 if (buttons & (1 << 4))
64 btn |= BUTTON_A;
65
66 /* the touchpad */
67 if (touchpad & (1 << 0))
68 btn |= BUTTON_UP;
69
70 if (touchpad & (1 << 12))
71 btn |= BUTTON_RIGHT;
72
73 if (touchpad & (1 << 6))
74 btn |= BUTTON_DOWN;
75
76 if (touchpad & (1 << 7))
77 btn |= BUTTON_LEFT;
78
79 if (touchpad & (1 << 3))
80 btn |= BUTTON_SELECT;
81
82 return btn;
83}
84
diff --git a/firmware/target/arm/gigabeat/meg-fx/button-target.h b/firmware/target/arm/gigabeat/meg-fx/button-target.h
new file mode 100644
index 0000000000..95fb72e601
--- /dev/null
+++ b/firmware/target/arm/gigabeat/meg-fx/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 Linus Nielsen Feltzing
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 _BUTTON_TARGET_H_
20#define _BUTTON_TARGET_H_
21
22#include <stdbool.h>
23#include "config.h"
24
25#define HAS_BUTTON_HOLD
26
27bool button_hold(void);
28void button_init_device(void);
29int button_read_device(void);
30
31/* Toshiba Gigabeat specific button codes */
32
33#define BUTTON_POWER 0x00000001
34#define BUTTON_MENU 0x00000002
35
36#define BUTTON_LEFT 0x00000004
37#define BUTTON_RIGHT 0x00000008
38#define BUTTON_UP 0x00000010
39#define BUTTON_DOWN 0x00000020
40
41#define BUTTON_VOL_UP 0x00000040
42#define BUTTON_VOL_DOWN 0x00000080
43
44#define BUTTON_SELECT 0x00000100
45#define BUTTON_A 0x00000200
46
47
48#define BUTTON_MAIN (BUTTON_POWER|BUTTON_MENU|BUTTON_LEFT|BUTTON_RIGHT\
49 |BUTTON_UP|BUTTON_DOWN|BUTTON_VOL_UP|BUTTON_VOL_DOWN\
50 |BUTTON_SELECT|BUTTON_A)
51
52
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/gigabeat/meg-fx/lcd-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c
new file mode 100644
index 0000000000..5ec62271ad
--- /dev/null
+++ b/firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c
@@ -0,0 +1,31 @@
1#include "config.h"
2#include "cpu.h"
3#include "lcd.h"
4#include "kernel.h"
5#include "system.h"
6
7void lcd_init_device(void);
8void lcd_update_rec(int, int, int, int);
9void lcd_update(void);
10
11/* LCD init */
12void lcd_init_device(void)
13{
14}
15
16/* Update a fraction of the display. */
17void lcd_update_rect(int x, int y, int width, int height)
18{
19 (void)x;
20 (void)y;
21 (void)width;
22 (void)height;
23 memcpy(FRAME, &lcd_framebuffer, sizeof(lcd_framebuffer));
24}
25
26/* Update the display.
27 This must be called after all other LCD functions that change the display. */
28void lcd_update(void)
29{
30 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
31}
diff --git a/firmware/target/arm/gigabeat/meg-fx/power-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/power-meg-fx.c
new file mode 100644
index 0000000000..688b44eaa6
--- /dev/null
+++ b/firmware/target/arm/gigabeat/meg-fx/power-meg-fx.c
@@ -0,0 +1,75 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Linus Nielsen Feltzing
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 <stdbool.h>
22#include "kernel.h"
23#include "system.h"
24#include "power.h"
25#include "pcf50606.h"
26
27#ifndef SIMULATOR
28
29void power_init(void)
30{
31 /* Charger detect */
32}
33
34bool charger_inserted(void)
35{
36 return !(GPFDAT & (1 << 4));
37}
38
39void ide_power_enable(bool on)
40{
41 (void)on;
42}
43
44bool ide_powered(void)
45{
46 return true;
47}
48
49void power_off(void)
50{
51}
52
53#else /* SIMULATOR */
54
55bool charger_inserted(void)
56{
57 return false;
58}
59
60void charger_enable(bool on)
61{
62 (void)on;
63}
64
65void power_off(void)
66{
67}
68
69void ide_power_enable(bool on)
70{
71 (void)on;
72}
73
74#endif /* SIMULATOR */
75
diff --git a/firmware/target/arm/gigabeat/meg-fx/usb-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/usb-meg-fx.c
new file mode 100644
index 0000000000..6e0f31e8c7
--- /dev/null
+++ b/firmware/target/arm/gigabeat/meg-fx/usb-meg-fx.c
@@ -0,0 +1,52 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Linus Nielsen Feltzing
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 <stdbool.h>
21#include "cpu.h"
22#include "system.h"
23
24void usb_init_device(void)
25{
26}
27
28bool usb_detect(void)
29{
30 return (GPFDAT & 1) ? false : true;
31}
32
33void usb_enable(bool on)
34{
35 if(on) {
36 int i;
37
38 GPBDAT &= 0x7EF;
39 GPBCON |= 1<<8;
40
41 GPGDAT &= 0xE7FF;
42 GPGDAT |= 1<<11;
43
44 for (i = 0; i < 10000000; i++) {continue;}
45
46 GPBCON &= 0x2FFCFF;
47 GPBDAT |= 1<<5;
48 GPBDAT |= 1<<6;
49 } else {
50 /* TODO how turn USB mode back off again? */
51 }
52}
diff --git a/firmware/target/arm/gigabeat/meg-fx/usb-target.h b/firmware/target/arm/gigabeat/meg-fx/usb-target.h
new file mode 100644
index 0000000000..baeb539b38
--- /dev/null
+++ b/firmware/target/arm/gigabeat/meg-fx/usb-target.h
@@ -0,0 +1,26 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Linus Nielsen Feltzing
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 USB_TARGET_H
20#define USB_TARGET_H
21
22bool usb_init_device(void);
23bool usb_detect(void);
24void usb_enable(bool on);
25
26#endif
diff --git a/firmware/thread.c b/firmware/thread.c
index 7cde9f5e9f..0013d49519 100644
--- a/firmware/thread.c
+++ b/firmware/thread.c
@@ -279,6 +279,8 @@ void switch_thread(void)
279 0x1f seems to trigger a reset; 279 0x1f seems to trigger a reset;
280 0x0f is the only one other argument used by Archos. 280 0x0f is the only one other argument used by Archos.
281 */ 281 */
282#elif CONFIG_CPU == S3C2440
283 CLKCON |= 2;
282#endif 284#endif
283 } 285 }
284#endif 286#endif
diff --git a/firmware/usb.c b/firmware/usb.c
index a8a3e6b3eb..6be5fda093 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -77,6 +77,9 @@ void screen_dump(void); /* Nasty again. Defined in apps/ too */
77#elif CONFIG_KEYPAD == IRIVER_H300_PAD 77#elif CONFIG_KEYPAD == IRIVER_H300_PAD
78#define USBPOWER_BUTTON BUTTON_REC 78#define USBPOWER_BUTTON BUTTON_REC
79#define USBPOWER_BTN_IGNORE BUTTON_ON 79#define USBPOWER_BTN_IGNORE BUTTON_ON
80#elif CONFIG_KEYPAD == GIGABEAT_PAD
81#define USBPOWER_BUTTON BUTTON_MENU
82#define USBPOWER_BTN_IGNORE BUTTON_POWER
80#endif 83#endif
81#endif /* HAVE_USB_POWER */ 84#endif /* HAVE_USB_POWER */
82 85
@@ -191,6 +194,8 @@ void usb_enable(bool on)
191 (void) on; 194 (void) on;
192#elif defined(USB_X5STYLE) 195#elif defined(USB_X5STYLE)
193 /* TODO X5 */ 196 /* TODO X5 */
197#elif defined(USB_GIGABEAT_STYLE)
198 /* TODO gigabeat */
194#else 199#else
195#ifdef HAVE_LCD_BITMAP 200#ifdef HAVE_LCD_BITMAP
196 if(read_hw_mask() & USB_ACTIVE_HIGH) 201 if(read_hw_mask() & USB_ACTIVE_HIGH)
diff --git a/tools/configure b/tools/configure
index 78fb0d7812..449041094a 100755
--- a/tools/configure
+++ b/tools/configure
@@ -871,6 +871,10 @@ toolsdir='\$(ROOTDIR)/tools'
871 plugins="yes" 871 plugins="yes"
872 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a" 872 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
873 toolset=$genericbitmaptools 873 toolset=$genericbitmaptools
874 # architecture, manufacturer and model for the target-tree build
875 t_cpu="arm"
876 t_manufacturer="gigabeat"
877 t_model="meg-fx"
874 ;; 878 ;;
875 879
876 21) 880 21)