summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorMark Arigo <markarigo@gmail.com>2008-01-09 07:24:43 +0000
committerMark Arigo <markarigo@gmail.com>2008-01-09 07:24:43 +0000
commite66ddd754fba4171e3fd99c5a1b911ed3f9faa3f (patch)
tree918000a401ae36817091cc4561573a5578f87ba5 /firmware
parentf59a327f674c36487ed04e6cf36369a622da7f40 (diff)
downloadrockbox-e66ddd754fba4171e3fd99c5a1b911ed3f9faa3f.tar.gz
rockbox-e66ddd754fba4171e3fd99c5a1b911ed3f9faa3f.zip
Initial commit for the Olympus m:robe 100 port (PP5020). The LCD driver works. The ADC driver was copied from the H10 port (they can probably be combined later), but the battery readings aren't right and it shuts down. The touch pad buttons do not work. Install the bootloader and rockbox the H10 way. Still lots of work to do.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16030 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/SOURCES16
-rw-r--r--firmware/app.lds1
-rw-r--r--firmware/common/disk.c7
-rw-r--r--firmware/export/config.h16
-rw-r--r--firmware/export/usb.h3
-rw-r--r--firmware/target/arm/olympus/mrobe-100/adc-mr100.c141
-rw-r--r--firmware/target/arm/olympus/mrobe-100/adc-target.h39
-rw-r--r--firmware/target/arm/olympus/mrobe-100/backlight-mr100.c57
-rw-r--r--firmware/target/arm/olympus/mrobe-100/backlight-target.h41
-rw-r--r--firmware/target/arm/olympus/mrobe-100/button-mr100.c60
-rw-r--r--firmware/target/arm/olympus/mrobe-100/button-target.h64
-rw-r--r--firmware/target/arm/olympus/mrobe-100/lcd-mr100.c192
-rw-r--r--firmware/target/arm/olympus/mrobe-100/power-mr100.c62
-rw-r--r--firmware/target/arm/olympus/mrobe-100/powermgmt-mr100.c59
14 files changed, 747 insertions, 11 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 5424ed910e..ca06d8602f 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -652,6 +652,22 @@ target/arm/tms320dm320/dsp-dm320.c
652#endif /* SIMULATOR */ 652#endif /* SIMULATOR */
653#endif /* MROBE_500 */ 653#endif /* MROBE_500 */
654 654
655#ifdef MROBE_100
656#ifndef SIMULATOR
657target/arm/ata-as-arm.S
658target/arm/ata-pp5020.c
659target/arm/wmcodec-pp.c
660target/arm/i2s-pp.c
661target/arm/olympus/mrobe-100/adc-mr100.c
662target/arm/olympus/mrobe-100/backlight-mr100.c
663target/arm/olympus/mrobe-100/button-mr100.c
664target/arm/olympus/mrobe-100/lcd-mr100.c
665target/arm/olympus/mrobe-100/power-mr100.c
666target/arm/olympus/mrobe-100/powermgmt-mr100.c
667target/arm/usb-fw-pp502x.c
668#endif /* SIMULATOR */
669#endif /* MROBE_100 */
670
655#ifdef ELIO_TPJ1022 671#ifdef ELIO_TPJ1022
656#ifndef SIMULATOR 672#ifndef SIMULATOR
657target/arm/ata-as-arm.S 673target/arm/ata-as-arm.S
diff --git a/firmware/app.lds b/firmware/app.lds
index 552b4bac45..9b83537dfe 100644
--- a/firmware/app.lds
+++ b/firmware/app.lds
@@ -156,6 +156,7 @@ SECTIONS
156 *(.icode) 156 *(.icode)
157 *(.irodata) 157 *(.irodata)
158 *(.idata) 158 *(.idata)
159 . = ALIGN(0x4);
159 _iramend = .; 160 _iramend = .;
160 } > IRAM AT> DRAM 161 } > IRAM AT> DRAM
161 162
diff --git a/firmware/common/disk.c b/firmware/common/disk.c
index cb35a8d7b0..9fb73f0070 100644
--- a/firmware/common/disk.c
+++ b/firmware/common/disk.c
@@ -137,7 +137,6 @@ static int get_free_volume(void)
137 137
138int disk_mount(int drive) 138int disk_mount(int drive)
139{ 139{
140 int i;
141 int mounted = 0; /* reset partition-on-drive flag */ 140 int mounted = 0; /* reset partition-on-drive flag */
142 int volume = get_free_volume(); 141 int volume = get_free_volume();
143 struct partinfo* pinfo = disk_init(IF_MV(drive)); 142 struct partinfo* pinfo = disk_init(IF_MV(drive));
@@ -146,14 +145,14 @@ int disk_mount(int drive)
146 { 145 {
147 return 0; 146 return 0;
148 } 147 }
149#ifndef ELIO_TPJ1022 148#if !defined(ELIO_TPJ1022) && !defined(MROBE_100)
150 /* The Elio's hard drive has no partition table and probing for partitions causes 149 /* 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 150 Rockbox to crash - so we temporarily disable the probing until we fix the
152 real problem. */ 151 real problem. */
153#ifdef TOSHIBA_GIGABEAT_S 152#ifdef TOSHIBA_GIGABEAT_S
154 i = 1; /* For the Gigabeat S, we mount the second partition */ 153 int i = 1; /* For the Gigabeat S, we mount the second partition */
155#else 154#else
156 i = 0; 155 int i = 0;
157#endif 156#endif
158 for (; volume != -1 && i<4; i++) 157 for (; volume != -1 && i<4; i++)
159 { 158 {
diff --git a/firmware/export/config.h b/firmware/export/config.h
index f377697b70..a3c2390f84 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -71,10 +71,11 @@
71#define SANSA_C200_PAD 14 71#define SANSA_C200_PAD 14
72#define ELIO_TPJ1022_PAD 15 72#define ELIO_TPJ1022_PAD 15
73#define ARCHOS_AV300_PAD 16 73#define ARCHOS_AV300_PAD 16
74#define MROBE500_PAD 17 74#define MROBE100_PAD 17
75#define GIGABEAT_S_PAD 18 75#define MROBE500_PAD 18
76#define LOGIK_DAX_PAD 19 76#define GIGABEAT_S_PAD 19
77#define IAUDIO67_PAD 20 77#define LOGIK_DAX_PAD 20
78#define IAUDIO67_PAD 21
78 79
79/* CONFIG_REMOTE_KEYPAD */ 80/* CONFIG_REMOTE_KEYPAD */
80#define H100_REMOTE 1 81#define H100_REMOTE 1
@@ -107,8 +108,9 @@
107#define LCD_DSC25 16 /* as used by Archos AV300 */ 108#define LCD_DSC25 16 /* as used by Archos AV300 */
108#define LCD_C200 17 /* as used by Sandisk Sansa c200 */ 109#define LCD_C200 17 /* as used by Sandisk Sansa c200 */
109#define LCD_MROBE500 18 /* as used by Olympus M:Robe 500i */ 110#define LCD_MROBE500 18 /* as used by Olympus M:Robe 500i */
110#define LCD_LOGIKDAX 19 /* as used by Logik DAX - SSD1815 */ 111#define LCD_MROBE100 19 /* as used by Olympus M:Robe 100 */
111#define LCD_IAUDIO67 20 /* as used by iAudio 6/7 - unknown */ 112#define LCD_LOGIKDAX 20 /* as used by Logik DAX - SSD1815 */
113#define LCD_IAUDIO67 21 /* as used by iAudio 6/7 - unknown */
112 114
113/* LCD_PIXELFORMAT */ 115/* LCD_PIXELFORMAT */
114#define HORIZONTAL_PACKING 1 116#define HORIZONTAL_PACKING 1
@@ -221,6 +223,8 @@
221#include "config-c200.h" 223#include "config-c200.h"
222#elif defined(ELIO_TPJ1022) 224#elif defined(ELIO_TPJ1022)
223#include "config-tpj1022.h" 225#include "config-tpj1022.h"
226#elif defined(MROBE_100)
227#include "config-mrobe100.h"
224#elif defined(MROBE_500) 228#elif defined(MROBE_500)
225#include "config-mrobe500.h" 229#include "config-mrobe500.h"
226#elif defined(LOGIK_DAX) 230#elif defined(LOGIK_DAX)
diff --git a/firmware/export/usb.h b/firmware/export/usb.h
index 0977ff4d7d..c2487f3563 100644
--- a/firmware/export/usb.h
+++ b/firmware/export/usb.h
@@ -50,7 +50,8 @@
50#elif CONFIG_KEYPAD == GIGABEAT_S_PAD 50#elif CONFIG_KEYPAD == GIGABEAT_S_PAD
51#define USBPOWER_BUTTON BUTTON_MENU 51#define USBPOWER_BUTTON BUTTON_MENU
52#define USBPOWER_BTN_IGNORE BUTTON_BACK 52#define USBPOWER_BTN_IGNORE BUTTON_BACK
53#elif CONFIG_KEYPAD == IRIVER_H10_PAD 53#elif (CONFIG_KEYPAD == IRIVER_H10_PAD) || \
54 (CONFIG_KEYPAD == MROBE100_PAD)
54#define USBPOWER_BUTTON BUTTON_RIGHT 55#define USBPOWER_BUTTON BUTTON_RIGHT
55#define USBPOWER_BTN_IGNORE BUTTON_POWER 56#define USBPOWER_BTN_IGNORE BUTTON_POWER
56#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \ 57#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
diff --git a/firmware/target/arm/olympus/mrobe-100/adc-mr100.c b/firmware/target/arm/olympus/mrobe-100/adc-mr100.c
new file mode 100644
index 0000000000..f63e8b8013
--- /dev/null
+++ b/firmware/target/arm/olympus/mrobe-100/adc-mr100.c
@@ -0,0 +1,141 @@
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
26static unsigned short adcdata[NUM_ADC_CHANNELS];
27
28/* Scan ADC so that adcdata[channel] gets updated. */
29unsigned short adc_scan(int channel)
30{
31 unsigned int adc_data_1;
32 unsigned int adc_data_2;
33
34 /* Start conversion */
35 ADC_ADDR |= 0x80000000;
36
37 /* Wait for conversion to complete */
38 while((ADC_STATUS & (0x40<<8*channel))==0);
39
40 /* Stop conversion */
41 ADC_ADDR &=~ 0x80000000;
42
43 /* ADC_DATA_1 and ADC_DATA_2 are both four bytes, one byte per channel.
44 For each channel, ADC_DATA_1 stores the 8-bit msb, ADC_DATA_2 stores the
45 2-bit lsb (in bits 0 and 1). Each channel is 10 bits total. */
46 adc_data_1 = ((ADC_DATA_1 >> (8*channel)) & 0xff);
47 adc_data_2 = ((ADC_DATA_2 >> (8*channel+6)) & 0x3);
48
49 adcdata[channel] = (adc_data_1<<2 | adc_data_2);
50
51 /* ADC values read low if PLL is enabled */
52 if(PLL_CONTROL & 0x80000000){
53 adcdata[channel] += 0x14;
54 if(adcdata[channel] > 0x400)
55 adcdata[channel] = 0x400;
56 }
57
58 return adcdata[channel];
59}
60
61/* Read 10-bit channel data */
62unsigned short adc_read(int channel)
63{
64 return adcdata[channel];
65}
66
67static int adc_counter;
68
69static void adc_tick(void)
70{
71 if(++adc_counter == HZ)
72 {
73 adc_counter = 0;
74 adc_scan(ADC_BATTERY);
75 adc_scan(ADC_UNKNOWN_1);
76 adc_scan(ADC_REMOTE);
77 adc_scan(ADC_SCROLLPAD);
78 }
79}
80
81/* Figured out from how the OF does things */
82void adc_init(void)
83{
84 ADC_INIT |= 1;
85 ADC_INIT |= 0x40000000;
86 udelay(100);
87
88 /* Reset ADC */
89 DEV_RS2 |= 0x20;
90 udelay(100);
91
92 DEV_RS2 &=~ 0x20;
93 udelay(100);
94
95 /* Enable ADC */
96 DEV_EN2 |= 0x20;
97 udelay(100);
98
99 ADC_CLOCK_SRC |= 0x3;
100 udelay(100);
101
102 ADC_ADDR |= 0x40;
103 ADC_ADDR |= 0x20000000;
104 udelay(100);
105
106 ADC_INIT;
107 ADC_INIT = 0;
108 udelay(100);
109
110 ADC_STATUS = 0;
111
112 /* Enable channel 0 (battery) */
113 DEV_INIT1 &=~0x3;
114 ADC_ADDR |= 0x1000000;
115 ADC_STATUS |= 0x20;
116
117 /* Enable channel 1 (unknown, temperature?) */
118 DEV_INIT1 &=~30;
119 ADC_ADDR |= 0x2000000;
120 ADC_STATUS |= 0x2000;
121
122 /* Enable channel 2 (remote) */
123 DEV_INIT1 &=~0x300;
124 DEV_INIT1 |= 0x100;
125 ADC_ADDR |= 0x4000000;
126 ADC_STATUS |= 0x200000;
127
128 /* Enable channel 3 (scroll pad) */
129 DEV_INIT1 &=~0x3000;
130 DEV_INIT1 |= 0x1000;
131 ADC_ADDR |= 0x8000000;
132 ADC_STATUS |= 0x20000000;
133
134 /* Force a scan of all channels to get initial values */
135 adc_scan(ADC_BATTERY);
136 adc_scan(ADC_UNKNOWN_1);
137 adc_scan(ADC_REMOTE);
138 adc_scan(ADC_SCROLLPAD);
139
140 tick_add_task(adc_tick);
141}
diff --git a/firmware/target/arm/olympus/mrobe-100/adc-target.h b/firmware/target/arm/olympus/mrobe-100/adc-target.h
new file mode 100644
index 0000000000..f761e761ef
--- /dev/null
+++ b/firmware/target/arm/olympus/mrobe-100/adc-target.h
@@ -0,0 +1,39 @@
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_ADDR (*(volatile unsigned long*)(0x7000ad00))
23#define ADC_STATUS (*(volatile unsigned long*)(0x7000ad04))
24#define ADC_DATA_1 (*(volatile unsigned long*)(0x7000ad20))
25#define ADC_DATA_2 (*(volatile unsigned long*)(0x7000ad24))
26#define ADC_INIT (*(volatile unsigned long*)(0x7000ad2c))
27
28#define NUM_ADC_CHANNELS 4
29
30#define ADC_BATTERY 0
31#define ADC_UNKNOWN_1 1
32#define ADC_REMOTE 2
33#define ADC_SCROLLPAD 3
34#define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */
35
36/* Force a scan now */
37unsigned short adc_scan(int channel);
38
39#endif
diff --git a/firmware/target/arm/olympus/mrobe-100/backlight-mr100.c b/firmware/target/arm/olympus/mrobe-100/backlight-mr100.c
new file mode 100644
index 0000000000..10a7f666e5
--- /dev/null
+++ b/firmware/target/arm/olympus/mrobe-100/backlight-mr100.c
@@ -0,0 +1,57 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Mark Arigo
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 "backlight-target.h"
21#include "system.h"
22#include "lcd.h"
23#include "backlight.h"
24#include "i2c-pp.h"
25
26void _backlight_on(void)
27{
28}
29
30void _backlight_off(void)
31{
32}
33
34void _buttonlight_on(void)
35{
36 /* turn on all touchpad leds */
37 GPIOA_OUTPUT_VAL |= BUTTONLIGHT_ALL;
38
39#if 0
40 /* Writing to 0x7000a010 controls the brightness of the leds.
41 This routine fades the leds from dim to bright, like when
42 you first turn the unit on. */
43 unsigned long val = 0x80ff08ff;
44 int i = 0;
45 for (i = 0; i < 16; i++)
46 outl(val, 0x7000a010);
47 udelay(100000);
48 val -= 0x110000;
49 }
50#endif
51}
52
53void _buttonlight_off(void)
54{
55 /* turn off all touchpad leds */
56 GPIOA_OUTPUT_VAL &= ~BUTTONLIGHT_ALL;
57}
diff --git a/firmware/target/arm/olympus/mrobe-100/backlight-target.h b/firmware/target/arm/olympus/mrobe-100/backlight-target.h
new file mode 100644
index 0000000000..e6c8387222
--- /dev/null
+++ b/firmware/target/arm/olympus/mrobe-100/backlight-target.h
@@ -0,0 +1,41 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Mark Arigo
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 BACKLIGHT_TARGET_H
21#define BACKLIGHT_TARGET_H
22
23#define _backlight_init() true
24void _backlight_on(void);
25void _backlight_off(void);
26
27/* Button lights are controlled by GPIOA_OUTPUT_VAL */
28#define BUTTONLIGHT_PLAY 0x01
29#define BUTTONLIGHT_MENU 0x02
30#define BUTTONLIGHT_DISPLAY 0x04
31#define BUTTONLIGHT_LEFT 0x08
32#define BUTTONLIGHT_RIGHT 0x10
33#define BUTTONLIGHT_SCROLL 0x20
34#define BUTTONLIGHT_ALL (BUTTONLIGHT_PLAY | BUTTONLIGHT_MENU | \
35 BUTTONLIGHT_DISPLAY | BUTTONLIGHT_LEFT | \
36 BUTTONLIGHT_RIGHT | BUTTONLIGHT_SCROLL)
37
38void _buttonlight_on(void);
39void _buttonlight_off(void);
40
41#endif
diff --git a/firmware/target/arm/olympus/mrobe-100/button-mr100.c b/firmware/target/arm/olympus/mrobe-100/button-mr100.c
new file mode 100644
index 0000000000..141a6d5b0c
--- /dev/null
+++ b/firmware/target/arm/olympus/mrobe-100/button-mr100.c
@@ -0,0 +1,60 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Mark Arigo
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 "backlight-target.h"
28#include "system.h"
29
30void button_int(void)
31{
32}
33
34void button_init_device(void)
35{
36 /* taken from the mr-100 bootloader (offset 0x1e72) */
37 //~ DEV_EN |= 0x20000; /* enable the touchpad ?? */
38
39 /* enable touchpad leds */
40 GPIOA_ENABLE |= 0xff;
41 GPIOA_OUTPUT_EN |= BUTTONLIGHT_ALL;
42}
43
44/*
45 * Get button pressed from hardware
46 */
47int button_read_device(void)
48{
49 return BUTTON_NONE;
50}
51
52bool button_hold(void)
53{
54 return (GPIOD_INPUT_VAL & BUTTON_HOLD) ? false : true;
55}
56
57bool headphones_inserted(void)
58{
59 return (GPIOD_INPUT_VAL & 0x80) ? true : false;
60}
diff --git a/firmware/target/arm/olympus/mrobe-100/button-target.h b/firmware/target/arm/olympus/mrobe-100/button-target.h
new file mode 100644
index 0000000000..99f17bb09b
--- /dev/null
+++ b/firmware/target/arm/olympus/mrobe-100/button-target.h
@@ -0,0 +1,64 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Mark Arigo
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
28bool button_hold(void);
29void button_init_device(void);
30int button_read_device(void);
31
32/* Power button is on GPIOA */
33#define BUTTON_POWER 0x80
34#define POWEROFF_BUTTON BUTTON_POWER
35#define POWEROFF_COUNT 10
36
37/* Hold button is on GPIOD */
38#define BUTTON_HOLD 0x10
39
40/* FIXME: Until the buttons are figured out, we use the button definitions
41 for the H10 keypad & remote. THESE ARE NOT CORRECT! */
42
43/* Main unit's buttons */
44#define BUTTON_LEFT 0x00000002
45#define BUTTON_RIGHT 0x00000004
46#define BUTTON_REW 0x00000008
47#define BUTTON_PLAY 0x00000010
48#define BUTTON_FF 0x00000020
49#define BUTTON_SCROLL_UP 0x00000040
50#define BUTTON_SCROLL_DOWN 0x00000080
51#define BUTTON_MAIN (BUTTON_POWER|BUTTON_O|BUTTON_BACK|BUTTON_REW\
52 |BUTTON_PLAY|BUTTON_FF)
53
54/* Remote control's buttons */
55#define BUTTON_RC_REW 0x00080000
56#define BUTTON_RC_PLAY 0x00100000
57#define BUTTON_RC_FF 0x00200000
58#define BUTTON_RC_VOL_UP 0x00400000
59#define BUTTON_RC_VOL_DOWN 0x00800000
60#define BUTTON_REMOTE (BUTTON_RC_PLAY|BUTTON_RC_VOL_UP|BUTTON_RC_VOL_DOWN\
61 |BUTTON_RC_REW|BUTTON_RC_FF)
62#define RC_POWEROFF_BUTTON BUTTON_RC_PLAY
63
64#endif /* _BUTTON_TARGET_H_ */
diff --git a/firmware/target/arm/olympus/mrobe-100/lcd-mr100.c b/firmware/target/arm/olympus/mrobe-100/lcd-mr100.c
new file mode 100644
index 0000000000..501a0942e5
--- /dev/null
+++ b/firmware/target/arm/olympus/mrobe-100/lcd-mr100.c
@@ -0,0 +1,192 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Mark Arigo
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/* send LCD data */
26static void lcd_send_data(unsigned data)
27{
28 while (LCD1_CONTROL & LCD1_BUSY_MASK); /* wait for LCD */
29 LCD1_DATA = data;
30}
31
32/* send LCD command */
33static void lcd_send_command(unsigned cmd)
34{
35 while (LCD1_CONTROL & LCD1_BUSY_MASK); /* wait for LCD */
36 LCD1_CMD = cmd;
37}
38
39/* LCD init */
40void lcd_init_device(void)
41{
42 int i;
43
44 DEV_INIT1 &= ~0xfc000000;
45
46 i = DEV_INIT1;
47 DEV_INIT1 = i;
48
49 DEV_INIT2 &= ~0x400;
50 udelay(10000);
51
52 LCD1_CONTROL &= ~0x4;
53 udelay(15);
54
55 LCD1_CONTROL |= 0x4;
56 udelay(10);
57
58 LCD1_CONTROL = 0x690;
59 LCD1_CONTROL = 0x694;
60
61 /* OF just reads these */
62 i = LCD1_CONTROL;
63 i = inl(0x70003004);
64 i = LCD1_CMD;
65 i = inl(0x7000300c);
66
67#if 0
68 /* this is skipped in the OF */
69 LCD1_CONTROL &= ~0x200;
70 LCD1_CONTROL &= ~0x800;
71 LCD1_CONTROL &= ~0x400;
72#endif
73
74 LCD1_CONTROL |= 0x1;
75 udelay(15000);
76
77 lcd_send_command(0xe2);
78 lcd_send_command(0x2f);
79 lcd_send_command(0x26);
80 lcd_send_command(0xcc);
81 lcd_send_command(0xe8);
82 lcd_send_command(0x81);
83 lcd_send_command(0);
84 lcd_send_command(0x40);
85 lcd_send_command(0xa6);
86 lcd_send_command(0x88);
87 lcd_send_command(0xb0);
88 lcd_send_command(0x10);
89 lcd_send_command(0);
90}
91
92/*** hardware configuration ***/
93int lcd_default_contrast(void)
94{
95 return DEFAULT_CONTRAST_SETTING;
96}
97
98void lcd_set_contrast(int val)
99{
100 lcd_send_command(0x81);
101 lcd_send_command(val);
102}
103
104void lcd_set_invert_display(bool yesno)
105{
106 /* TODO: Implement lcd_set_invert_display() */
107 (void)yesno;
108}
109
110/* turn the display upside down (call lcd_update() afterwards) */
111void lcd_set_flip(bool yesno)
112{
113 /* TODO: Implement lcd_set_flip() */
114 (void)yesno;
115}
116
117/*** update functions ***/
118
119/* Performance function that works with an external buffer
120 note that by and bheight are in 4-pixel units! */
121void lcd_blit(const fb_data* data, int x, int by, int width,
122 int bheight, int stride)
123{
124 /* TODO: Implement lcd_blit() */
125 (void)data;
126 (void)x;
127 (void)by;
128 (void)width;
129 (void)bheight;
130 (void)stride;
131}
132
133/* Performance function to blit a YUV bitmap directly to the LCD */
134void lcd_yuv_blit(unsigned char * const src[3],
135 int src_x, int src_y, int stride,
136 int x, int y, int width, int height)
137{
138 (void)src;
139 (void)src_x;
140 (void)src_y;
141 (void)stride;
142 (void)x;
143 (void)y;
144 (void)width;
145 (void)height;
146}
147
148/* Update the display.
149 This must be called after all other LCD functions that change the display. */
150void lcd_update(void)
151{
152 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
153}
154
155/* Update a fraction of the display. */
156void lcd_update_rect(int x0, int y0, int width, int height)
157{
158 unsigned char *addr;
159 unsigned int cmd0, cmd1, cmd2;
160 int r, c, x1, y1, start_row, last_row;
161
162 x1 = (x0 + width) - 1;
163 y1 = (y0 + height) - 1;
164 if ((x1 <= 0) || (y1 <= 0))
165 return;
166
167 if(x1 >= LCD_WIDTH)
168 x1 = LCD_WIDTH - 1;
169
170 if(y1 >= LCD_HEIGHT)
171 y1 = LCD_HEIGHT - 1;
172
173 start_row = y0/8;
174 last_row = y1/8;
175
176 cmd1 = (x0 & 0xff) >> 4;
177 cmd1 = (cmd1 + 5) | 0x10;
178 cmd2 = x0 & 0xf;
179
180 for (r = start_row; r <= last_row; r++) {
181 cmd0 = (r & 0xff) | 0xb0;
182 lcd_send_command(cmd0);
183 lcd_send_command(cmd1);
184 lcd_send_command(cmd2);
185
186 addr = (unsigned char*)&lcd_framebuffer[r][x0];
187 for (c = x0; c <= x1; c++)
188 lcd_send_data(*(addr++));
189 }
190
191 lcd_send_command(0xaf);
192}
diff --git a/firmware/target/arm/olympus/mrobe-100/power-mr100.c b/firmware/target/arm/olympus/mrobe-100/power-mr100.c
new file mode 100644
index 0000000000..1fb2ecb958
--- /dev/null
+++ b/firmware/target/arm/olympus/mrobe-100/power-mr100.c
@@ -0,0 +1,62 @@
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#include "config.h"
21#include "cpu.h"
22#include <stdbool.h>
23#include "adc.h"
24#include "kernel.h"
25#include "system.h"
26#include "power.h"
27#include "logf.h"
28#include "usb.h"
29
30#if CONFIG_CHARGING == CHARGING_CONTROL
31bool charger_enabled;
32#endif
33
34void power_init(void)
35{
36}
37
38bool charger_inserted(void)
39{
40 return false;
41}
42
43void ide_power_enable(bool on)
44{
45 (void)on;
46 /* We do nothing on the iPod */
47}
48
49
50bool ide_powered(void)
51{
52 /* pretend we are always powered - we don't turn it off on the ipod */
53 return true;
54}
55
56void power_off(void)
57{
58 /* Give things a second to settle before cutting power */
59 sleep(HZ);
60
61 //GPIOF_OUTPUT_VAL &=~ 0x20;
62}
diff --git a/firmware/target/arm/olympus/mrobe-100/powermgmt-mr100.c b/firmware/target/arm/olympus/mrobe-100/powermgmt-mr100.c
new file mode 100644
index 0000000000..1b6a52f517
--- /dev/null
+++ b/firmware/target/arm/olympus/mrobe-100/powermgmt-mr100.c
@@ -0,0 +1,59 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese
11 * Revisions copyright (C) 2005 by Gerald Van Baren
12 *
13 * All files in this archive are subject to the GNU General Public License.
14 * See the file COPYING in the source tree root for full license agreement.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21#include "config.h"
22#include "adc.h"
23#include "powermgmt.h"
24
25/* FIXME: All voltages copied from H10/Tatung Elio. This will need changing
26 proper power management. */
27
28const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
29{
30 3760
31};
32
33const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
34{
35 3650
36};
37
38/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
39const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
40{
41 { 3760, 3800, 3850, 3870, 3900, 3950, 4020, 4070, 4110, 4180, 4240 }
42};
43
44#if CONFIG_CHARGING
45/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
46const unsigned short percent_to_volt_charge[11] =
47{
48 3990, 4030, 4060, 4080, 4100, 4120, 4150, 4180, 4220, 4260, 4310
49};
50#endif /* CONFIG_CHARGING */
51
52#define BATTERY_SCALE_FACTOR 4650
53/* full-scale ADC readout (2^10) in millivolt */
54
55/* Returns battery voltage from ADC [millivolts] */
56unsigned int battery_adc_voltage(void)
57{
58 return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
59}