summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm')
-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
10 files changed, 499 insertions, 0 deletions
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