summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2008-09-05 15:09:40 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2008-09-05 15:09:40 +0000
commite1446381675be454d91081a2db1d275129970556 (patch)
treefdaaab97282d3c5e339840a13c29311fa6085fd9
parente0646947c9d36d5095659939f73294c2b425fda8 (diff)
downloadrockbox-e1446381675be454d91081a2db1d275129970556.tar.gz
rockbox-e1446381675be454d91081a2db1d275129970556.zip
Add Onda VX767 target
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18422 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--bootloader/SOURCES2
-rw-r--r--bootloader/ondavx747.c6
-rw-r--r--firmware/SOURCES6
-rw-r--r--firmware/export/config-ondavx747.h7
-rw-r--r--firmware/export/config-ondavx767.h158
-rw-r--r--firmware/export/config.h4
-rw-r--r--firmware/export/cpu.h3
-rw-r--r--firmware/target/mips/ingenic_jz47xx/lcd-target.h (renamed from firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-target.h)0
-rw-r--r--firmware/target/mips/ingenic_jz47xx/onda_vx767/adc-target.h28
-rw-r--r--firmware/target/mips/ingenic_jz47xx/onda_vx767/backlight-ondavx767.c80
-rw-r--r--firmware/target/mips/ingenic_jz47xx/onda_vx767/backlight-target.h37
-rw-r--r--firmware/target/mips/ingenic_jz47xx/onda_vx767/button-ondavx767.c70
-rw-r--r--firmware/target/mips/ingenic_jz47xx/onda_vx767/button-target.h54
-rw-r--r--firmware/target/mips/ingenic_jz47xx/onda_vx767/lcd-ondavx767.c195
-rw-r--r--firmware/target/mips/ingenic_jz47xx/system-jz4740.c122
-rwxr-xr-xtools/configure23
16 files changed, 737 insertions, 58 deletions
diff --git a/bootloader/SOURCES b/bootloader/SOURCES
index 2e78caa2a3..c1771ff24f 100644
--- a/bootloader/SOURCES
+++ b/bootloader/SOURCES
@@ -31,7 +31,7 @@ mrobe500.c
31telechips.c 31telechips.c
32#elif defined(MEIZU_M6SL) 32#elif defined(MEIZU_M6SL)
33meizu_m6sl.c 33meizu_m6sl.c
34#elif defined(ONDA_VX747) 34#elif defined(ONDA_VX747) || defined(ONDA_VX767)
35ondavx747.c 35ondavx747.c
36#elif defined(CREATIVE_ZVx) 36#elif defined(CREATIVE_ZVx)
37creativezvm.c 37creativezvm.c
diff --git a/bootloader/ondavx747.c b/bootloader/ondavx747.c
index a3a3571ac4..8dd957eca5 100644
--- a/bootloader/ondavx747.c
+++ b/bootloader/ondavx747.c
@@ -160,7 +160,11 @@ int main(void)
160#endif 160#endif
161 while(1) 161 while(1)
162 { 162 {
163#ifdef ONDA_VX747
163 btn = button_read_device(&touch); 164 btn = button_read_device(&touch);
165#else
166 btn = button_read_device();
167#endif
164#define KNOP(x,y) lcd_set_foreground(LCD_BLACK); \ 168#define KNOP(x,y) lcd_set_foreground(LCD_BLACK); \
165 if(btn & x) \ 169 if(btn & x) \
166 lcd_set_foreground(LCD_WHITE); \ 170 lcd_set_foreground(LCD_WHITE); \
@@ -184,6 +188,7 @@ int main(void)
184 { 188 {
185 power_off(); 189 power_off();
186 } 190 }
191#ifdef ONDA_VX747
187 if(btn & BUTTON_TOUCH) 192 if(btn & BUTTON_TOUCH)
188 { 193 {
189 lcd_set_foreground(LCD_RGBPACK(touch & 0xFF, (touch >> 8)&0xFF, (touch >> 16)&0xFF)); 194 lcd_set_foreground(LCD_RGBPACK(touch & 0xFF, (touch >> 8)&0xFF, (touch >> 16)&0xFF));
@@ -191,6 +196,7 @@ int main(void)
191 lcd_update(); 196 lcd_update();
192 lcd_set_foreground(LCD_WHITE); 197 lcd_set_foreground(LCD_WHITE);
193 } 198 }
199#endif
194 snprintf(datetime, 30, "%02d/%02d/%04d %02d:%02d:%02d", get_time()->tm_mday, get_time()->tm_mon, get_time()->tm_year, 200 snprintf(datetime, 30, "%02d/%02d/%04d %02d:%02d:%02d", get_time()->tm_mday, get_time()->tm_mon, get_time()->tm_year,
195 get_time()->tm_hour, get_time()->tm_min, get_time()->tm_sec); 201 get_time()->tm_hour, get_time()->tm_min, get_time()->tm_sec);
196 lcd_putsxy(LCD_WIDTH-SYSFONT_WIDTH*strlen(datetime), LCD_HEIGHT-SYSFONT_HEIGHT, datetime); 202 lcd_putsxy(LCD_WIDTH-SYSFONT_WIDTH*strlen(datetime), LCD_HEIGHT-SYSFONT_HEIGHT, datetime);
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 24be9e58ae..2075f80891 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -1093,3 +1093,9 @@ target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx747.c
1093target/mips/ingenic_jz47xx/onda_vx747/lcd-onda_vx747.c 1093target/mips/ingenic_jz47xx/onda_vx747/lcd-onda_vx747.c
1094target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c 1094target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
1095#endif 1095#endif
1096
1097#ifdef ONDA_VX767
1098target/mips/ingenic_jz47xx/onda_vx767/backlight-ondavx767.c
1099target/mips/ingenic_jz47xx/onda_vx767/button-ondavx767.c
1100target/mips/ingenic_jz47xx/onda_vx767/lcd-ondavx767.c
1101#endif
diff --git a/firmware/export/config-ondavx747.h b/firmware/export/config-ondavx747.h
index 66570d4622..e015a53374 100644
--- a/firmware/export/config-ondavx747.h
+++ b/firmware/export/config-ondavx747.h
@@ -155,13 +155,6 @@
155#define USB_VENDOR_ID 0x041e 155#define USB_VENDOR_ID 0x041e
156#define USB_PRODUCT_ID 0x4133*/ 156#define USB_PRODUCT_ID 0x4133*/
157 157
158/*DEBUGGING!*/
159#ifdef BOOTLOADER
160#define THREAD_EXTRA_CHECKS 1
161#define DEBUG 1
162#define debug(msg) printf(msg)
163#endif
164
165#include <stdbool.h> /* HACKY */ 158#include <stdbool.h> /* HACKY */
166 159
167#endif 160#endif
diff --git a/firmware/export/config-ondavx767.h b/firmware/export/config-ondavx767.h
new file mode 100644
index 0000000000..a72b73ba32
--- /dev/null
+++ b/firmware/export/config-ondavx767.h
@@ -0,0 +1,158 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Maurus Cuelenaere
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22/*
23 * This config file is for the Onda VX747
24 */
25#define TARGET_TREE /* this target is using the target tree system */
26
27#define CONFIG_SDRAM_START 0x80004000
28
29#define ONDA_VX767 1
30
31#define MODEL_NAME "Onda VX767"
32
33/* For Rolo and boot loader */
34#define MODEL_NUMBER 31
35
36/* define this if you use an ATA controller */
37//#define HAVE_ATA
38
39/* define this if you have a bitmap LCD display */
40#define HAVE_LCD_BITMAP
41
42/* define this if you have a colour LCD */
43#define HAVE_LCD_COLOR
44
45/* define this if you have access to the quickscreen */
46#define HAVE_QUICKSCREEN
47
48/* define this if you have access to the pitchscreen */
49#define HAVE_PITCHSCREEN
50
51/* define this if you would like tagcache to build on this target */
52#define HAVE_TAGCACHE
53
54/* define this if the target has volume keys which can be used in the lists */
55#define HAVE_VOLUME_IN_LIST
56
57/* LCD dimensions */
58#define CONFIG_LCD LCD_ONDAVX767
59
60#define LCD_WIDTH 320
61#define LCD_HEIGHT 240
62
63#define LCD_DEPTH 16 /* 16bit colours */
64#define LCD_PIXELFORMAT RGB565 /* rgb565 */
65
66/* Define this if your LCD can be enabled/disabled */
67//#define HAVE_LCD_ENABLE
68
69#define CONFIG_KEYPAD ONDAVX767_PAD
70#define HAS_BUTTON_HOLD
71
72/* Define this if you do software codec */
73#define CONFIG_CODEC SWCODEC
74
75/* define this if you have a real-time clock */
76#define CONFIG_RTC RTC_JZ47XX
77
78/* Define this for LCD backlight available */
79#define HAVE_BACKLIGHT
80
81#define HAVE_BACKLIGHT_BRIGHTNESS
82
83/* Main LCD backlight brightness range and defaults */
84#define MIN_BRIGHTNESS_SETTING 0 /* TODO */
85#define MAX_BRIGHTNESS_SETTING 127
86#define DEFAULT_BRIGHTNESS_SETTING 85
87#define DEFAULT_DIMNESS_SETTING 22
88
89/* Define this if you have a software controlled poweroff */
90//#define HAVE_SW_POWEROFF
91
92/* The number of bytes reserved for loadable codecs */
93#define CODEC_SIZE 0x80000
94
95/* The number of bytes reserved for loadable plugins */
96#define PLUGIN_BUFFER_SIZE 0x100000
97
98/* Define this if you have the */
99//#define HAVE_INGENIC_CODEC
100
101#define CONFIG_I2C I2C_JZ47XX
102
103/* TLV320 has no tone controls, so we use the software ones */
104//#define HAVE_SW_TONE_CONTROLS
105
106/*#define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | \
107 SAMPR_CAP_11)*/
108
109#define BATTERY_CAPACITY_DEFAULT 1250 /* default battery capacity */
110#define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */
111#define BATTERY_CAPACITY_MAX 2500 /* max. capacity selectable */
112#define BATTERY_CAPACITY_INC 100 /* capacity increment */
113#define BATTERY_TYPES_COUNT 1 /* only one type */
114
115/* Hardware controlled charging with monitoring */
116//#define CONFIG_CHARGING CHARGING_MONITOR
117
118#ifndef SIMULATOR
119
120/* Define this if you have a Ingenic JZ4732 */
121#define CONFIG_CPU JZ4732
122
123/* define this if the hardware can be powered off while charging */
124#define HAVE_POWEROFF_WHILE_CHARGING
125
126/* Define this to the CPU frequency */
127#define CPU_FREQ 3686400
128
129/* define this if you have a flash memory storage */
130#define HAVE_FLASH_STORAGE
131
132/* Virtual LED (icon) */
133#define CONFIG_LED LED_VIRTUAL
134
135/* define this if the backlight can be set to a brightness */
136#define __BACKLIGHT_INIT
137
138/* Offset ( in the firmware file's header ) to the file CRC */
139#define FIRMWARE_OFFSET_FILE_CRC 0
140
141/* Offset ( in the firmware file's header ) to the real data */
142#define FIRMWARE_OFFSET_FILE_DATA 8
143
144/* Define this if you have adjustable CPU frequency */
145/* #define HAVE_ADJUSTABLE_CPU_FREQ */
146
147#define BOOTFILE_EXT "vx767"
148#define BOOTFILE "rockbox." BOOTFILE_EXT
149#define BOOTDIR "/.rockbox"
150
151/*#define CONFIG_USBOTG USBOTG_INGENIC
152#define HAVE_USBSTACK
153#define USB_VENDOR_ID 0x041e
154#define USB_PRODUCT_ID 0x4133*/
155
156#include <stdbool.h> /* HACKY */
157
158#endif
diff --git a/firmware/export/config.h b/firmware/export/config.h
index d700a15102..bdf8743942 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -94,6 +94,7 @@
94#define PHILIPS_HDD1630_PAD 29 94#define PHILIPS_HDD1630_PAD 29
95#define MEIZU_M6SL_PAD 30 95#define MEIZU_M6SL_PAD 30
96#define ONDAVX747_PAD 31 96#define ONDAVX747_PAD 31
97#define ONDAVX767_PAD 32
97 98
98/* CONFIG_REMOTE_KEYPAD */ 99/* CONFIG_REMOTE_KEYPAD */
99#define H100_REMOTE 1 100#define H100_REMOTE 1
@@ -137,6 +138,7 @@
137#define LCD_HDD1630 27 /* as used by the Philips HDD1630 */ 138#define LCD_HDD1630 27 /* as used by the Philips HDD1630 */
138#define LCD_MEIZUM6 28 /* as used by the Meizu M6SP and M6SL (various models) */ 139#define LCD_MEIZUM6 28 /* as used by the Meizu M6SP and M6SL (various models) */
139#define LCD_ONDAVX747 29 /* as used by the Onda VX747 */ 140#define LCD_ONDAVX747 29 /* as used by the Onda VX747 */
141#define LCD_ONDAVX767 30 /* as used by the Onda VX767 */
140 142
141/* LCD_PIXELFORMAT */ 143/* LCD_PIXELFORMAT */
142#define HORIZONTAL_PACKING 1 144#define HORIZONTAL_PACKING 1
@@ -291,6 +293,8 @@
291#include "config-meizu-m6sl.h" 293#include "config-meizu-m6sl.h"
292#elif defined(ONDA_VX747) 294#elif defined(ONDA_VX747)
293#include "config-ondavx747.h" 295#include "config-ondavx747.h"
296#elif defined(ONDA_VX767)
297#include "config-ondavx767.h"
294#else 298#else
295/* no known platform */ 299/* no known platform */
296#endif 300#endif
diff --git a/firmware/export/cpu.h b/firmware/export/cpu.h
index 83beab2fdf..86efd31ef1 100644
--- a/firmware/export/cpu.h
+++ b/firmware/export/cpu.h
@@ -59,3 +59,6 @@
59#if CONFIG_CPU == S5L8700 59#if CONFIG_CPU == S5L8700
60#include "s5l8700.h" 60#include "s5l8700.h"
61#endif 61#endif
62#if CONFIG_CPU == JZ4732
63#include "jz4740.h"
64#endif
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-target.h b/firmware/target/mips/ingenic_jz47xx/lcd-target.h
index e643608d56..e643608d56 100644
--- a/firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-target.h
+++ b/firmware/target/mips/ingenic_jz47xx/lcd-target.h
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx767/adc-target.h b/firmware/target/mips/ingenic_jz47xx/onda_vx767/adc-target.h
new file mode 100644
index 0000000000..e74f008a3e
--- /dev/null
+++ b/firmware/target/mips/ingenic_jz47xx/onda_vx767/adc-target.h
@@ -0,0 +1,28 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Maurus Cuelenaere
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef _ADC_TARGET_H_
22#define _ADC_TARGET_H_
23
24#define NUM_ADC_CHANNELS 4
25
26#define ADC_BUTTONS 0
27
28#endif /* _ADC_TARGET_H_ */
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx767/backlight-ondavx767.c b/firmware/target/mips/ingenic_jz47xx/onda_vx767/backlight-ondavx767.c
new file mode 100644
index 0000000000..9deab7712a
--- /dev/null
+++ b/firmware/target/mips/ingenic_jz47xx/onda_vx767/backlight-ondavx767.c
@@ -0,0 +1,80 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Maurus Cuelenaere
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "config.h"
23#include "jz4740.h"
24#include "backlight-target.h"
25
26#define GPIO_PWM 123
27#define PWM_CHN 7
28#define PWM_FULL 101
29
30static void set_backlight(int unk, int val)
31{
32 if(val == 0)
33 __gpio_as_pwm7();
34 else
35 {
36 REG_TCU_TCSR(7) |= 2;
37 REG_TCU_TCSR(7) &= ~0x100;
38 int tmp;
39 tmp = (unk/2 + __cpm_get_rtcclk()) / unk;
40 if(tmp > 0xFFFF)
41 tmp = 0xFFFF;
42
43 __tcu_set_half_data(7, (tmp * unk * 1374389535) >> 5);
44 __tcu_set_full_data(7, tmp);
45
46 REG_TCU_TSCR = (1 << 7);
47 REG_TCU_TESR = (1 << 7);
48
49 __tcu_enable_pwm_output(7);
50 }
51 __tcu_set_count(7, 0);
52}
53
54bool _backlight_init(void)
55{
56 __gpio_as_pwm7();
57
58 __tcu_stop_counter(7);
59 __tcu_disable_pwm_output(7);
60
61 set_backlight(300, 7);
62
63 return true;
64}
65void _backlight_on(void)
66{
67 set_backlight(300, 7);
68}
69void _backlight_off(void)
70{
71 set_backlight(300, 0);
72}
73
74#ifdef HAVE_BACKLIGHT_BRIGHTNESS
75void _backlight_set_brightness(int brightness)
76{
77 (void)brightness;
78 return;
79}
80#endif
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx767/backlight-target.h b/firmware/target/mips/ingenic_jz47xx/onda_vx767/backlight-target.h
new file mode 100644
index 0000000000..4170f96cc0
--- /dev/null
+++ b/firmware/target/mips/ingenic_jz47xx/onda_vx767/backlight-target.h
@@ -0,0 +1,37 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Maurus Cuelenaere
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef BACKLIGHT_TARGET_H
22#define BACKLIGHT_TARGET_H
23
24#ifdef BOOTLOADER
25#define BACKLIGHT_DRIVER_CLOSE
26/* Force the whole driver to be built */
27#define BACKLIGHT_FULL_INIT
28#endif
29
30#include <stdbool.h>
31
32bool _backlight_init(void);
33void _backlight_on(void);
34void _backlight_off(void);
35void _backlight_set_brightness(int brightness);
36
37#endif /* BACKLIGHT_TARGET_H */
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx767/button-ondavx767.c b/firmware/target/mips/ingenic_jz47xx/onda_vx767/button-ondavx767.c
new file mode 100644
index 0000000000..8b033a1bee
--- /dev/null
+++ b/firmware/target/mips/ingenic_jz47xx/onda_vx767/button-ondavx767.c
@@ -0,0 +1,70 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Maurus Cuelenaere
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "config.h"
23#include "system.h"
24#include "jz4740.h"
25#include "button-target.h"
26
27#define BTN_VOL_DOWN (1 << 27)
28#define BTN_VOL_UP (1 << 0)
29#define BTN_MENU (1 << 1)
30#define BTN_OFF (1 << 29)
31#define BTN_HOLD (1 << 16)
32#define BTN_MASK (BTN_VOL_DOWN | BTN_VOL_UP \
33 | BTN_MENU | BTN_OFF )
34
35bool button_hold(void)
36{
37 return (~REG_GPIO_PXPIN(3) & BTN_HOLD ? 1 : 0);
38}
39
40void button_init_device(void)
41{
42 __gpio_port_as_input(3, 29);
43 __gpio_port_as_input(3, 27);
44 __gpio_port_as_input(3, 16);
45 __gpio_port_as_input(3, 1);
46 __gpio_port_as_input(3, 0);
47}
48
49int button_read_device(void)
50{
51 if(button_hold())
52 return 0;
53
54 unsigned int key = ~(__gpio_get_port(3));
55 int ret = 0;
56
57 if(key & BTN_MASK)
58 {
59 if(key & BTN_VOL_DOWN)
60 ret |= BUTTON_VOL_DOWN;
61 if(key & BTN_VOL_UP)
62 ret |= BUTTON_VOL_UP;
63 if(key & BTN_MENU)
64 ret |= BUTTON_MENU;
65 if(key & BTN_OFF)
66 ret |= BUTTON_POWER;
67 }
68
69 return ret;
70}
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx767/button-target.h b/firmware/target/mips/ingenic_jz47xx/onda_vx767/button-target.h
new file mode 100644
index 0000000000..32325d1423
--- /dev/null
+++ b/firmware/target/mips/ingenic_jz47xx/onda_vx767/button-target.h
@@ -0,0 +1,54 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Maurus Cuelenaere
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef BUTTON_TARGET_H
22#define BUTTON_TARGET_H
23
24#include <stdbool.h>
25#include "config.h"
26
27#define HAS_BUTTON_HOLD
28
29bool button_hold(void);
30void button_init_device(void);
31int button_read_device(void);
32
33/* Main unit's buttons */
34#define BUTTON_POWER 0x00000001
35#define BUTTON_VOL_UP 0x00000002
36#define BUTTON_VOL_DOWN 0x00000004
37#define BUTTON_MENU 0x00000008
38
39/* Compatibility hacks for flipping. Needs a somewhat better fix. */
40#define BUTTON_LEFT 0
41#define BUTTON_RIGHT 0
42#define BUTTON_UP 0
43#define BUTTON_DOWN 0
44
45#define BUTTON_MAIN (BUTTON_POWER | BUTTON_VOL_UP | BUTTON_VOL_DOWN | BUTTON_MENU)
46
47/* No remote */
48#define BUTTON_REMOTE 0
49
50/* Software power-off */
51#define POWEROFF_BUTTON BUTTON_POWER
52#define POWEROFF_COUNT 10
53
54#endif /* BUTTON_TARGET_H */
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx767/lcd-ondavx767.c b/firmware/target/mips/ingenic_jz47xx/onda_vx767/lcd-ondavx767.c
new file mode 100644
index 0000000000..63d1736ebe
--- /dev/null
+++ b/firmware/target/mips/ingenic_jz47xx/onda_vx767/lcd-ondavx767.c
@@ -0,0 +1,195 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Maurus Cuelenaere
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "config.h"
23#include "jz4740.h"
24#include "lcd-target.h"
25
26#define PIN_CS_N (32*1+17) /* Chip select */
27#define PIN_RESET_N (32*1+18) /* Reset */
28#define PIN_UNK_N (32*2+19)
29
30#define my__gpio_as_lcd_16bit() \
31do { \
32 REG_GPIO_PXFUNS(2) = 0x0014ffff; \
33 REG_GPIO_PXSELC(2) = 0x0014ffff; \
34 REG_GPIO_PXPES(2) = 0x0014ffff; \
35} while (0)
36
37
38#define SLEEP(x) for(i=0; i<x; i++) asm("nop"); asm("nop");
39#define DELAY SLEEP(700000);
40static void _display_pin_init(void)
41{
42 int i;
43 my__gpio_as_lcd_16bit();
44 __gpio_as_output(PIN_UNK_N);
45 __gpio_set_pin(PIN_UNK_N);
46 __gpio_as_output(PIN_CS_N);
47 __gpio_as_output(PIN_RESET_N);
48 DELAY; /* delay_ms(10); */
49
50 __gpio_clear_pin(PIN_CS_N);
51 DELAY; /* delay_ms(10); */
52
53 __gpio_set_pin(PIN_RESET_N);
54 DELAY; /* delay_ms(10); */
55 __gpio_clear_pin(PIN_RESET_N);
56 DELAY; /* delay_ms(10); */
57 __gpio_set_pin(PIN_RESET_N);
58 DELAY; /* delay_ms(10); */
59}
60
61#define WAIT_ON_SLCD while(REG_SLCD_STATE & SLCD_STATE_BUSY);
62#define SLCD_SET_DATA(x) WAIT_ON_SLCD; REG_SLCD_DATA = (x) | SLCD_DATA_RS_DATA;
63#define SLCD_SET_COMMAND(x) WAIT_ON_SLCD; REG_SLCD_DATA = (x) | SLCD_DATA_RS_COMMAND;
64#define SLCD_SEND_COMMAND(cmd,val) SLCD_SET_COMMAND(cmd); __gpio_set_pin(PIN_UNK_N); SLCD_SET_DATA(val); __gpio_clear_pin(PIN_UNK_N);
65static void _display_init(void)
66{
67 int i;
68
69 SLCD_SEND_COMMAND(0xE3, 0x8);
70 SLCD_SEND_COMMAND(0xE4, 0x1411);
71 SLCD_SEND_COMMAND(0xE5, 0x8000);
72 SLCD_SEND_COMMAND(0x0, 0x1);
73 DELAY; /* delay_ms(10); */
74
75 SLCD_SEND_COMMAND(0x1, 0x100);
76 SLCD_SEND_COMMAND(0x2, 0x400);
77 SLCD_SEND_COMMAND(0x3, 0x1028);
78 SLCD_SEND_COMMAND(0x4, 0);
79 SLCD_SEND_COMMAND(0x8, 0x202);
80 SLCD_SEND_COMMAND(0x9, 0);
81 SLCD_SEND_COMMAND(0xA, 0);
82 SLCD_SEND_COMMAND(0xC, 0);
83 SLCD_SEND_COMMAND(0xD, 0);
84 SLCD_SEND_COMMAND(0xF, 0);
85 SLCD_SEND_COMMAND(0x10, 0);
86 SLCD_SEND_COMMAND(0x11, 0x7);
87 SLCD_SEND_COMMAND(0x12, 0);
88 SLCD_SEND_COMMAND(0x13, 0);
89 SLCD_SEND_COMMAND(0x10, 0x17B0);
90 SLCD_SEND_COMMAND(0x11, 0x4);
91 SLCD_SEND_COMMAND(0x12, 0x13C);
92 SLCD_SEND_COMMAND(0x13, 0x1B00);
93 SLCD_SEND_COMMAND(0x29, 0x16);
94 SLCD_SEND_COMMAND(0x20, 0);
95 SLCD_SEND_COMMAND(0x21, 0);
96 SLCD_SEND_COMMAND(0x2B, 0x20);
97 SLCD_SEND_COMMAND(0x30, 0);
98 SLCD_SEND_COMMAND(0x31, 0x403);
99 SLCD_SEND_COMMAND(0x32, 0x400);
100 SLCD_SEND_COMMAND(0x35, 0x5);
101 SLCD_SEND_COMMAND(0x36, 0x6);
102 SLCD_SEND_COMMAND(0x37, 0x606);
103 SLCD_SEND_COMMAND(0x38, 0x106);
104 SLCD_SEND_COMMAND(0x39, 0x7);
105 SLCD_SEND_COMMAND(0x3C, 0x700);
106 SLCD_SEND_COMMAND(0x3D, 0x707);
107 SLCD_SEND_COMMAND(0x50, 0);
108 SLCD_SEND_COMMAND(0x51, 239);
109 SLCD_SEND_COMMAND(0x52, 0);
110 SLCD_SEND_COMMAND(0x53, 319);
111 SLCD_SEND_COMMAND(0x60, 0x2700);
112 SLCD_SEND_COMMAND(0x61, 0x1);
113 SLCD_SEND_COMMAND(0x6A, 0);
114 SLCD_SEND_COMMAND(0x80, 0);
115 SLCD_SEND_COMMAND(0x81, 0);
116 SLCD_SEND_COMMAND(0x82, 0);
117 SLCD_SEND_COMMAND(0x83, 0);
118 SLCD_SEND_COMMAND(0x84, 0);
119 SLCD_SEND_COMMAND(0x85, 0);
120 SLCD_SEND_COMMAND(0x90, 0x10);
121 SLCD_SEND_COMMAND(0x92, 0);
122 SLCD_SEND_COMMAND(0x93, 0x3);
123 SLCD_SEND_COMMAND(0x95, 0x110);
124 SLCD_SEND_COMMAND(0x97, 0);
125 SLCD_SEND_COMMAND(0x98, 0);
126 SLCD_SEND_COMMAND(0x7, 0x173);
127
128 SLCD_SET_COMMAND(0x22);
129 __gpio_set_pin(PIN_UNK_N);
130}
131
132static void _display_on(void)
133{
134}
135
136static void _display_off(void)
137{
138}
139
140static void _set_lcd_bus(void)
141{
142 REG_LCD_CFG &= ~LCD_CFG_LCDPIN_MASK;
143 REG_LCD_CFG |= LCD_CFG_LCDPIN_SLCD;
144
145 REG_SLCD_CFG = (SLCD_CFG_BURST_4_WORD | SLCD_CFG_DWIDTH_18 | SLCD_CFG_CWIDTH_18BIT
146 | SLCD_CFG_CS_ACTIVE_LOW | SLCD_CFG_RS_CMD_LOW | SLCD_CFG_CLK_ACTIVE_FALLING
147 | SLCD_CFG_TYPE_PARALLEL);
148
149 REG_SLCD_CTRL = SLCD_CTRL_DMA_EN;
150}
151
152static void _set_lcd_clock(void)
153{
154 unsigned int val;
155 int pll_div;
156
157 __cpm_stop_lcd();
158 pll_div = ( REG_CPM_CPCCR & CPM_CPCCR_PCS ); /* clock source, 0:pllout/2 1: pllout */
159 pll_div = pll_div ? 1 : 2 ;
160 val = ( __cpm_get_pllout()/pll_div ) / 336000000;
161 val--;
162 if ( val > 0x1ff )
163 val = 0x1ff; /* CPM_LPCDR is too large, set it to 0x1ff */
164 __cpm_set_pixdiv(val);
165 __cpm_start_lcd();
166}
167
168void lcd_init_controller(void)
169{
170 int i;
171 _display_pin_init();
172 _set_lcd_bus();
173 _set_lcd_clock();
174 SLEEP(1000);
175 _display_init();
176}
177
178void lcd_set_target(short x, short y, short width, short height)
179{
180 SLCD_SEND_COMMAND(0x50, y);
181 SLCD_SEND_COMMAND(0x51, y+height-1);
182 SLCD_SEND_COMMAND(0x52, x);
183 SLCD_SEND_COMMAND(0x53, x+width-1);
184 /* TODO */
185}
186
187void lcd_on(void)
188{
189 _display_on();
190}
191
192void lcd_off(void)
193{
194 _display_off();
195}
diff --git a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c
index 8f1c3f5c1a..61be6c60de 100644
--- a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c
+++ b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c
@@ -555,21 +555,7 @@ void dma_cache_wback_inv(unsigned long addr, unsigned long size)
555 } 555 }
556} 556}
557 557
558extern int main(void); 558#define BARRIER \
559extern void except_common_entry(void);
560
561#define mtc0_tlbw_hazard() \
562 __asm__ __volatile__( \
563 " .set noreorder \n" \
564 " nop \n" \
565 " nop \n" \
566 " nop \n" \
567 " nop \n" \
568 " nop \n" \
569 " nop \n" \
570 " .set reorder \n");
571
572#define tlbw_use_hazard() \
573 __asm__ __volatile__( \ 559 __asm__ __volatile__( \
574 " .set noreorder \n" \ 560 " .set noreorder \n" \
575 " nop \n" \ 561 " nop \n" \
@@ -580,10 +566,13 @@ extern void except_common_entry(void);
580 " nop \n" \ 566 " nop \n" \
581 " .set reorder \n"); 567 " .set reorder \n");
582 568
583 569#define DEFAULT_PAGE_SHIFT PL_4K
584#define PAGE_SHIFT PL_4K 570#define DEFAULT_PAGE_MASK PM_4K
585#define PM_DEFAULT_MASK PM_4K 571#define UNIQUE_ENTRYHI(idx, ps) (A_K0BASE + ((idx) << (ps + 1)))
586#define UNIQUE_ENTRYHI(idx) (A_K0BASE + ((idx) << (PAGE_SHIFT + 1))) 572#define ASID_MASK M_EntryHiASID
573#define VPN2_SHIFT S_EntryHiVPN2
574#define PFN_SHIFT S_EntryLoPFN
575#define PFN_MASK 0xffffff
587static void local_flush_tlb_all(void) 576static void local_flush_tlb_all(void)
588{ 577{
589 unsigned long old_ctx; 578 unsigned long old_ctx;
@@ -594,59 +583,92 @@ static void local_flush_tlb_all(void)
594 old_ctx = read_c0_entryhi(); 583 old_ctx = read_c0_entryhi();
595 write_c0_entrylo0(0); 584 write_c0_entrylo0(0);
596 write_c0_entrylo1(0); 585 write_c0_entrylo1(0);
586 BARRIER;
597 587
598 /* Blast 'em all away. */ 588 /* Blast 'em all away. */
599 for(entry = read_c0_wired(); entry < 32; entry++) 589 for(entry = 0; entry < 32; entry++)
600 { 590 {
601 /* Make sure all entries differ. */ 591 /* Make sure all entries differ. */
602 write_c0_entryhi(UNIQUE_ENTRYHI(entry)); 592 write_c0_entryhi(UNIQUE_ENTRYHI(entry, DEFAULT_PAGE_SHIFT));
603 write_c0_index(entry); 593 write_c0_index(entry);
604 mtc0_tlbw_hazard(); 594 BARRIER;
605 tlb_write_indexed(); 595 tlb_write_indexed();
606 } 596 }
607 tlbw_use_hazard(); 597 BARRIER;
608 write_c0_entryhi(old_ctx); 598 write_c0_entryhi(old_ctx);
609 599
610 restore_irq(old_irq); 600 restore_irq(old_irq);
611} 601}
612 602
603static void add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
604 unsigned long entryhi, unsigned long pagemask)
605{
606 unsigned long wired;
607 unsigned long old_pagemask;
608 unsigned long old_ctx;
609 unsigned int old_irq = disable_irq_save();
610
611 old_ctx = read_c0_entryhi() & ASID_MASK;
612 old_pagemask = read_c0_pagemask();
613 wired = read_c0_wired();
614 write_c0_wired(wired + 1);
615 write_c0_index(wired);
616 BARRIER;
617 write_c0_pagemask(pagemask);
618 write_c0_entryhi(entryhi);
619 write_c0_entrylo0(entrylo0);
620 write_c0_entrylo1(entrylo1);
621 BARRIER;
622 tlb_write_indexed();
623 BARRIER;
624
625 write_c0_entryhi(old_ctx);
626 BARRIER;
627 write_c0_pagemask(old_pagemask);
628 local_flush_tlb_all();
629 restore_irq(old_irq);
630}
631
632static void map_address(unsigned long virtual, unsigned long physical, unsigned long length)
633{
634 unsigned long entry0 = (physical & PFN_MASK) << PFN_SHIFT;
635 unsigned long entry1 = ((physical+length) & PFN_MASK) << PFN_SHIFT;
636 unsigned long entryhi = virtual & ~VPN2_SHIFT;
637
638 entry0 |= (M_EntryLoG | M_EntryLoV | (K_CacheAttrC << S_EntryLoC) );
639 entry1 |= (M_EntryLoG | M_EntryLoV | (K_CacheAttrC << S_EntryLoC) );
640
641 add_wired_entry(entry0, entry1, entryhi, DEFAULT_PAGE_MASK);
642}
643
613 644
614static void tlb_init(void) 645static void tlb_init(void)
615{ 646{
616 write_c0_pagemask(PM_DEFAULT_MASK); 647 write_c0_pagemask(DEFAULT_PAGE_MASK);
617 write_c0_wired(0); 648 write_c0_wired(0);
618 write_c0_framemask(0); 649 write_c0_framemask(0);
619 650
620 local_flush_tlb_all(); 651 local_flush_tlb_all();
652/*
653 map_address(0x80000000, 0x80000000, 0x4000);
654 map_address(0x80004000, 0x80004000, MEM * 0x100000);
655*/
621} 656}
622 657
623static void tlb_refill_handler(void) 658void tlb_refill_handler(void)
624{ 659{
625#if 1 660 panicf("TLB refill handler! [0x%x] [0x%lx]", read_c0_badvaddr(), read_c0_epc());
626 panicf("TLB refill handler! [0x%x] [0x%x]", read_c0_badvaddr(), read_c0_epc());
627#else
628 __asm__ __volatile__(
629 "mfc0 k0, C0_BADVADDR\n"
630 "lui k1, pgdc\n"
631 "lw k1, pgdc>>16(k0)\n"
632 "srl k0, k0, 22\n"
633 "sll k0, k0, 2\n"
634 "addu k1, k1, k0\n"
635 "mfc0 k0, C0_CONTEXT\n"
636 "lw k1, 0(k1)\n"
637 "andi k0, k0, 0xFFC\n"
638 "addu k1, k1, k0\n"
639 "lw k0, 0(k1)\n"
640 "nop\n"
641 "mtc0 k0, C0_ENTRYLO0\n"
642 "mfc0 k1, C0_EPC\n"
643 "tlbwr\n"
644 "jr k1\n"
645 "rfe\n"
646 );
647#endif
648} 661}
649 662
663static void tlb_call_refill(void)
664{
665 asm("la $8, tlb_refill_handler \n"
666 "jr $8 \n");
667}
668
669extern int main(void);
670extern void except_common_entry(void);
671
650void system_main(void) 672void system_main(void)
651{ 673{
652 int i; 674 int i;
@@ -657,7 +679,7 @@ void system_main(void)
657 * 0x180 - Exception/Interrupt handler 679 * 0x180 - Exception/Interrupt handler
658 * 0x200 - Special Exception Interrupt handler (when IV is set in CP0_CAUSE) 680 * 0x200 - Special Exception Interrupt handler (when IV is set in CP0_CAUSE)
659 */ 681 */
660 memcpy((void *)A_K0BASE, (void *)&tlb_refill_handler, 0x20); 682 memcpy((void *)A_K0BASE, (void *)&tlb_call_refill, 0x20);
661 memcpy((void *)(A_K0BASE + 0x100), (void *)&except_common_entry, 0x20); 683 memcpy((void *)(A_K0BASE + 0x100), (void *)&except_common_entry, 0x20);
662 memcpy((void *)(A_K0BASE + 0x180), (void *)&except_common_entry, 0x20); 684 memcpy((void *)(A_K0BASE + 0x180), (void *)&except_common_entry, 0x20);
663 memcpy((void *)(A_K0BASE + 0x200), (void *)&except_common_entry, 0x20); 685 memcpy((void *)(A_K0BASE + 0x200), (void *)&except_common_entry, 0x20);
@@ -671,7 +693,7 @@ void system_main(void)
671 for(i=0; i<IRQ_MAX; i++) 693 for(i=0; i<IRQ_MAX; i++)
672 dis_irq(i); 694 dis_irq(i);
673 695
674 tlb_init(); 696 //tlb_init();
675 697
676 sti(); 698 sti();
677 699
diff --git a/tools/configure b/tools/configure
index 728d4d39fd..2349b9efbf 100755
--- a/tools/configure
+++ b/tools/configure
@@ -700,6 +700,7 @@ cat <<EOF
700 700
701 ==Onda== 701 ==Onda==
702 120) VX747 702 120) VX747
703 121) VX767
703EOF 704EOF
704 705
705 buildfor=`input`; 706 buildfor=`input`;
@@ -1781,6 +1782,28 @@ fi
1781 t_manufacturer="ingenic_jz47xx" 1782 t_manufacturer="ingenic_jz47xx"
1782 t_model="onda_vx747" 1783 t_model="onda_vx747"
1783 ;; 1784 ;;
1785
1786 121|ondavx767)
1787 target_id=45
1788 modelname="ondavx767"
1789 target="-DONDA_VX767"
1790 memory=16 #FIXME
1791 mipselcc
1792 tool="cp"
1793 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1794 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1795 output="rockbox.vx767"
1796 appextra="recorder:gui"
1797 plugins="no" #FIXME
1798 swcodec="yes"
1799 toolset=$genericbitmaptools
1800 boottool="cp"
1801 bootoutput="rockboot.vx767"
1802 # architecture, manufacturer and model for the target-tree build
1803 t_cpu="mips"
1804 t_manufacturer="ingenic_jz47xx"
1805 t_model="onda_vx767"
1806 ;;
1784 *) 1807 *)
1785 echo "Please select a supported target platform!" 1808 echo "Please select a supported target platform!"
1786 exit 1809 exit