diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-07-14 15:03:10 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-07-14 15:03:10 +0000 |
commit | 0709f0a5c60b5525ff98708887f5f1e5b0b570c2 (patch) | |
tree | 849fd125aa7b217228d584212d2930d8259ff5d8 /firmware/target/mips/ingenic_jz47xx/onda_vx747 | |
parent | 4f199817488708ba60724accb6ce76886f855af8 (diff) | |
download | rockbox-0709f0a5c60b5525ff98708887f5f1e5b0b570c2.tar.gz rockbox-0709f0a5c60b5525ff98708887f5f1e5b0b570c2.zip |
Add preliminary support for the Onda VX747 (MIPS target)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18032 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx/onda_vx747')
8 files changed, 600 insertions, 0 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/adc-target.h b/firmware/target/mips/ingenic_jz47xx/onda_vx747/adc-target.h new file mode 100755 index 0000000000..e74f008a3e --- /dev/null +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/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_vx747/backlight-onda_vx747.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx747.c new file mode 100755 index 0000000000..9deab7712a --- /dev/null +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx747.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 | |||
30 | static 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 | |||
54 | bool _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 | } | ||
65 | void _backlight_on(void) | ||
66 | { | ||
67 | set_backlight(300, 7); | ||
68 | } | ||
69 | void _backlight_off(void) | ||
70 | { | ||
71 | set_backlight(300, 0); | ||
72 | } | ||
73 | |||
74 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | ||
75 | void _backlight_set_brightness(int brightness) | ||
76 | { | ||
77 | (void)brightness; | ||
78 | return; | ||
79 | } | ||
80 | #endif | ||
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-target.h b/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-target.h new file mode 100755 index 0000000000..4170f96cc0 --- /dev/null +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/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 | |||
32 | bool _backlight_init(void); | ||
33 | void _backlight_on(void); | ||
34 | void _backlight_off(void); | ||
35 | void _backlight_set_brightness(int brightness); | ||
36 | |||
37 | #endif /* BACKLIGHT_TARGET_H */ | ||
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/button-onda_vx747.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/button-onda_vx747.c new file mode 100755 index 0000000000..e42325bcb3 --- /dev/null +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/button-onda_vx747.c | |||
@@ -0,0 +1,123 @@ | |||
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 "button-target.h" | ||
25 | |||
26 | #define BTN_VOL_DOWN (1 << 27) | ||
27 | #define BTN_VOL_UP (1 << 0) | ||
28 | #define BTN_MENU (1 << 1) | ||
29 | #define BTN_OFF (1 << 29) | ||
30 | #define BTN_HOLD (1 << 16) | ||
31 | #define BTN_MASK (BTN_VOL_DOWN | BTN_VOL_UP \ | ||
32 | | BTN_MENU | BTN_OFF ) | ||
33 | |||
34 | #define SADC_CFG_INIT ( \ | ||
35 | (2 << SADC_CFG_CLKOUT_NUM_BIT) | \ | ||
36 | SADC_CFG_XYZ1Z2 | \ | ||
37 | SADC_CFG_SNUM_5 | \ | ||
38 | (1 << SADC_CFG_CLKDIV_BIT) | \ | ||
39 | SADC_CFG_PBAT_HIGH | \ | ||
40 | SADC_CFG_CMD_INT_PEN ) | ||
41 | |||
42 | bool button_hold(void) | ||
43 | { | ||
44 | return (REG_GPIO_PXPIN(3) ^ BTN_HOLD ? 1 : 0); | ||
45 | } | ||
46 | |||
47 | void button_init_device(void) | ||
48 | { | ||
49 | REG_SADC_ENA = 0; | ||
50 | REG_SADC_STATE &= (~REG_SADC_STATE); | ||
51 | REG_SADC_CTRL = 0x1f; | ||
52 | |||
53 | __cpm_start_sadc(); | ||
54 | REG_SADC_CFG = SADC_CFG_INIT; | ||
55 | |||
56 | REG_SADC_SAMETIME = 1; | ||
57 | REG_SADC_WAITTIME = 1000; //per 100 HZ | ||
58 | REG_SADC_STATE &= (~REG_SADC_STATE); | ||
59 | REG_SADC_CTRL &= (~(SADC_CTRL_PENDM | SADC_CTRL_TSRDYM)); | ||
60 | REG_SADC_ENA = SADC_ENA_TSEN; // | REG_SADC_ENA;//SADC_ENA_TSEN | SADC_ENA_PBATEN | SADC_ENA_SADCINEN; | ||
61 | } | ||
62 | |||
63 | static int touch_to_pixels(short x, short y) | ||
64 | { | ||
65 | /* X:300 -> 3800 Y:300->3900 */ | ||
66 | x -= 300; | ||
67 | y -= 300; | ||
68 | |||
69 | x /= 3200 / LCD_WIDTH; | ||
70 | y /= 3600 / LCD_HEIGHT; | ||
71 | |||
72 | return (x << 16) | y; | ||
73 | } | ||
74 | |||
75 | int button_read_device(int *data) | ||
76 | { | ||
77 | unsigned int key = ~REG_GPIO_PXPIN(3); | ||
78 | int ret = 0; | ||
79 | if(key & BTN_MASK) | ||
80 | { | ||
81 | if(key & BTN_VOL_DOWN) | ||
82 | ret |= BUTTON_VOL_DOWN; | ||
83 | if(key & BTN_VOL_UP) | ||
84 | ret |= BUTTON_VOL_UP; | ||
85 | if(key & BTN_MENU) | ||
86 | ret |= BUTTON_MENU; | ||
87 | if(key & BTN_OFF) | ||
88 | ret |= BUTTON_POWER; | ||
89 | } | ||
90 | |||
91 | if(REG_SADC_STATE & (SADC_CTRL_TSRDYM|SADC_STATE_PEND)) | ||
92 | { | ||
93 | if(REG_SADC_STATE & SADC_CTRL_PENDM) | ||
94 | { | ||
95 | REG_SADC_CTRL &= (~(SADC_CTRL_PENUM | SADC_CTRL_TSRDYM)); | ||
96 | REG_SADC_CTRL |= (SADC_CTRL_PENDM); | ||
97 | unsigned int dat; | ||
98 | unsigned short xData,yData; | ||
99 | short tsz1Data,tsz2Data; | ||
100 | |||
101 | dat = REG_SADC_TSDAT; | ||
102 | |||
103 | xData = (dat >> 0) & 0xfff; | ||
104 | yData = (dat >> 16) & 0xfff; | ||
105 | |||
106 | dat = REG_SADC_TSDAT; | ||
107 | tsz1Data = (dat >> 0) & 0xfff; | ||
108 | tsz2Data = (dat >> 16) & 0xfff; | ||
109 | |||
110 | *data = touch_to_pixels(xData, yData); | ||
111 | |||
112 | tsz1Data = tsz2Data - tsz1Data; | ||
113 | } | ||
114 | REG_SADC_STATE = 0; | ||
115 | //__intc_unmask_irq(IRQ_SADC); | ||
116 | } | ||
117 | |||
118 | return ret; | ||
119 | } | ||
120 | void button_set_touch_available(void) | ||
121 | { | ||
122 | return; | ||
123 | } | ||
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/button-target.h b/firmware/target/mips/ingenic_jz47xx/onda_vx747/button-target.h new file mode 100755 index 0000000000..23ce386cb1 --- /dev/null +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/button-target.h | |||
@@ -0,0 +1,69 @@ | |||
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 | |||
25 | #include <stdbool.h> | ||
26 | #include "config.h" | ||
27 | |||
28 | #define HAS_BUTTON_HOLD | ||
29 | |||
30 | bool button_hold(void); | ||
31 | void button_init_device(void); | ||
32 | int button_read_device(int *data); | ||
33 | void button_set_touch_available(void); | ||
34 | |||
35 | /* Main unit's buttons */ | ||
36 | #define BUTTON_POWER 0x00000001 | ||
37 | #define BUTTON_VOL_UP 0x00000002 | ||
38 | #define BUTTON_VOL_DOWN 0x00000004 | ||
39 | #define BUTTON_MENU 0x00000008 | ||
40 | |||
41 | /* Compatibility hacks for flipping. Needs a somewhat better fix. */ | ||
42 | #define BUTTON_LEFT BUTTON_MIDLEFT | ||
43 | #define BUTTON_RIGHT BUTTON_MIDRIGHT | ||
44 | #define BUTTON_UP BUTTON_TOPMIDDLE | ||
45 | #define BUTTON_DOWN BUTTON_BOTTOMMIDDLE | ||
46 | |||
47 | /* Touchpad Screen Area Buttons */ | ||
48 | #define BUTTON_TOPLEFT 0x00000010 | ||
49 | #define BUTTON_TOPMIDDLE 0x00000020 | ||
50 | #define BUTTON_TOPRIGHT 0x00000040 | ||
51 | #define BUTTON_MIDLEFT 0x00000080 | ||
52 | #define BUTTON_CENTER 0x00000100 | ||
53 | #define BUTTON_MIDRIGHT 0x00000200 | ||
54 | #define BUTTON_BOTTOMLEFT 0x00000400 | ||
55 | #define BUTTON_BOTTOMMIDDLE 0x00000800 | ||
56 | #define BUTTON_BOTTOMRIGHT 0x00001000 | ||
57 | |||
58 | #define BUTTON_TOUCH 0x00002000 | ||
59 | |||
60 | #define BUTTON_MAIN 0x3FFF | ||
61 | |||
62 | /* No remote */ | ||
63 | #define BUTTON_REMOTE 0 | ||
64 | |||
65 | /* Software power-off */ | ||
66 | #define POWEROFF_BUTTON BUTTON_POWER | ||
67 | #define POWEROFF_COUNT 10 | ||
68 | |||
69 | #endif /* BUTTON_TARGET_H */ | ||
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-onda_vx747.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-onda_vx747.c new file mode 100755 index 0000000000..d46cee6884 --- /dev/null +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-onda_vx747.c | |||
@@ -0,0 +1,201 @@ | |||
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 | |||
29 | #define my__gpio_as_lcd_16bit() \ | ||
30 | do { \ | ||
31 | REG_GPIO_PXFUNS(2) = 0x001cffff; \ | ||
32 | REG_GPIO_PXSELC(2) = 0x001cffff; \ | ||
33 | REG_GPIO_PXPES(2) = 0x001cffff; \ | ||
34 | } while (0) | ||
35 | |||
36 | |||
37 | #define SLEEP(x) for(i=0; i<x; i++) asm("nop"); asm("nop"); | ||
38 | #define DELAY SLEEP(700000); | ||
39 | static void _display_pin_init(void) | ||
40 | { | ||
41 | int i; | ||
42 | my__gpio_as_lcd_16bit(); | ||
43 | __gpio_as_output(PIN_CS_N); | ||
44 | __gpio_as_output(PIN_RESET_N); | ||
45 | __gpio_clear_pin(PIN_CS_N); | ||
46 | |||
47 | __gpio_set_pin(PIN_RESET_N); | ||
48 | DELAY; | ||
49 | __gpio_clear_pin(PIN_RESET_N); | ||
50 | DELAY; | ||
51 | __gpio_set_pin(PIN_RESET_N); | ||
52 | DELAY; | ||
53 | } | ||
54 | |||
55 | #define WAIT_ON_SLCD while(REG_SLCD_STATE & SLCD_STATE_BUSY); | ||
56 | #define SLCD_SET_DATA(x) WAIT_ON_SLCD; REG_SLCD_DATA = (x) | SLCD_DATA_RS_DATA; | ||
57 | #define SLCD_SET_COMMAND(x) WAIT_ON_SLCD; REG_SLCD_DATA = (x) | SLCD_DATA_RS_COMMAND; | ||
58 | #define SLCD_SEND_COMMAND(cmd,val) SLCD_SET_COMMAND(cmd); SLCD_SET_DATA(val); | ||
59 | static void _display_on(void) | ||
60 | { | ||
61 | int i; | ||
62 | |||
63 | SLCD_SEND_COMMAND(0x600, 1); | ||
64 | SLEEP(700000); | ||
65 | SLCD_SEND_COMMAND(0x600, 0); | ||
66 | SLEEP(700000); | ||
67 | SLCD_SEND_COMMAND(0x606, 0); | ||
68 | |||
69 | SLCD_SEND_COMMAND(1, 0x100); | ||
70 | SLCD_SEND_COMMAND(2, 0x100); | ||
71 | SLCD_SEND_COMMAND(3, 0x1028); | ||
72 | SLCD_SEND_COMMAND(8, 0x503); | ||
73 | SLCD_SEND_COMMAND(9, 1); | ||
74 | SLCD_SEND_COMMAND(0xB, 0x10); | ||
75 | SLCD_SEND_COMMAND(0xC, 0); | ||
76 | SLCD_SEND_COMMAND(0xF, 0); | ||
77 | SLCD_SEND_COMMAND(7, 1); | ||
78 | SLCD_SEND_COMMAND(0x10, 0x12); | ||
79 | SLCD_SEND_COMMAND(0x11, 0x202); | ||
80 | SLCD_SEND_COMMAND(0x12, 0x300); | ||
81 | SLCD_SEND_COMMAND(0x20, 0x21e); | ||
82 | SLCD_SEND_COMMAND(0x21, 0x202); | ||
83 | SLCD_SEND_COMMAND(0x22, 0x100); | ||
84 | SLCD_SEND_COMMAND(0x90, 0x8000); | ||
85 | SLCD_SEND_COMMAND(0x100, 0x16b0); | ||
86 | SLCD_SEND_COMMAND(0x101, 0x147); | ||
87 | SLCD_SEND_COMMAND(0x102, 0x1bd); | ||
88 | SLCD_SEND_COMMAND(0x103, 0x2f00); | ||
89 | SLCD_SEND_COMMAND(0x107, 0); | ||
90 | SLCD_SEND_COMMAND(0x110, 1); | ||
91 | SLCD_SEND_COMMAND(0x200, 0); /* set cursor at x_start */ | ||
92 | SLCD_SEND_COMMAND(0x201, 0); /* set cursor at y_start */ | ||
93 | SLCD_SEND_COMMAND(0x210, 0); /* y_start*/ | ||
94 | SLCD_SEND_COMMAND(0x211, 239); /* y_end */ | ||
95 | SLCD_SEND_COMMAND(0x212, 0); /* x_start */ | ||
96 | SLCD_SEND_COMMAND(0x213, 399); /* x_end */ | ||
97 | SLCD_SEND_COMMAND(0x280, 0); | ||
98 | SLCD_SEND_COMMAND(0x281, 6); | ||
99 | SLCD_SEND_COMMAND(0x282, 0); | ||
100 | SLCD_SEND_COMMAND(0x300, 0x101); | ||
101 | SLCD_SEND_COMMAND(0x301, 0xb27); | ||
102 | SLCD_SEND_COMMAND(0x302, 0x132a); | ||
103 | SLCD_SEND_COMMAND(0x303, 0x2a13); | ||
104 | SLCD_SEND_COMMAND(0x304, 0x270b); | ||
105 | SLCD_SEND_COMMAND(0x305, 0x101); | ||
106 | SLCD_SEND_COMMAND(0x306, 0x1205); | ||
107 | SLCD_SEND_COMMAND(0x307, 0x512); | ||
108 | SLCD_SEND_COMMAND(0x308, 5); | ||
109 | SLCD_SEND_COMMAND(0x309, 3); | ||
110 | SLCD_SEND_COMMAND(0x30a, 0xf04); | ||
111 | SLCD_SEND_COMMAND(0x30b, 0xf00); | ||
112 | SLCD_SEND_COMMAND(0x30c, 0xf); | ||
113 | SLCD_SEND_COMMAND(0x30d, 0x40f); | ||
114 | SLCD_SEND_COMMAND(0x30e, 0x300); | ||
115 | SLCD_SEND_COMMAND(0x30f, 0x500); | ||
116 | SLCD_SEND_COMMAND(0x400, 0x3100); | ||
117 | SLCD_SEND_COMMAND(0x401, 1); | ||
118 | SLCD_SEND_COMMAND(0x404, 0); | ||
119 | SLCD_SEND_COMMAND(0x500, 0); | ||
120 | SLCD_SEND_COMMAND(0x501, 0); | ||
121 | SLCD_SEND_COMMAND(0x502, 0); | ||
122 | SLCD_SEND_COMMAND(0x503, 0); | ||
123 | SLCD_SEND_COMMAND(0x504, 0); | ||
124 | SLCD_SEND_COMMAND(0x505, 0); | ||
125 | SLCD_SEND_COMMAND(0x606, 0); | ||
126 | SLCD_SEND_COMMAND(0x6f0, 0); | ||
127 | SLCD_SEND_COMMAND(0x7f0, 0x5420); | ||
128 | SLCD_SEND_COMMAND(0x7f3, 0x288a); | ||
129 | SLCD_SEND_COMMAND(0x7f4, 0x22); | ||
130 | SLCD_SEND_COMMAND(0x7f5, 1); | ||
131 | SLCD_SEND_COMMAND(0x7f0, 0); | ||
132 | |||
133 | SLCD_SEND_COMMAND(7, 0x173); | ||
134 | SLEEP(3500000); | ||
135 | SLCD_SEND_COMMAND(7, 0x171); | ||
136 | SLEEP(3500000); | ||
137 | SLCD_SEND_COMMAND(7, 0x173); | ||
138 | SLEEP(3500000); | ||
139 | } | ||
140 | |||
141 | static void _set_lcd_bus(void) | ||
142 | { | ||
143 | REG_LCD_CFG &= ~LCD_CFG_LCDPIN_MASK; | ||
144 | REG_LCD_CFG |= LCD_CFG_LCDPIN_SLCD; | ||
145 | |||
146 | REG_SLCD_CFG = (SLCD_CFG_BURST_8_WORD | SLCD_CFG_DWIDTH_16 | SLCD_CFG_CWIDTH_16BIT | ||
147 | | SLCD_CFG_CS_ACTIVE_LOW | SLCD_CFG_RS_CMD_LOW | SLCD_CFG_CLK_ACTIVE_FALLING | ||
148 | | SLCD_CFG_TYPE_PARALLEL); | ||
149 | |||
150 | REG_SLCD_CTRL = SLCD_CTRL_DMA_EN; | ||
151 | } | ||
152 | |||
153 | static void _set_lcd_clock(void) | ||
154 | { | ||
155 | unsigned int val; | ||
156 | int pll_div; | ||
157 | |||
158 | __cpm_stop_lcd(); | ||
159 | pll_div = ( REG_CPM_CPCCR & CPM_CPCCR_PCS ); /* clock source,0:pllout/2 1: pllout */ | ||
160 | pll_div = pll_div ? 1 : 2 ; | ||
161 | val = ( __cpm_get_pllout()/pll_div ) / 336000000; | ||
162 | val--; | ||
163 | if ( val > 0x1ff ) | ||
164 | { | ||
165 | //printf("CPM_LPCDR too large, set it to 0x1ff\n"); | ||
166 | val = 0x1ff; | ||
167 | } | ||
168 | __cpm_set_pixdiv(val); | ||
169 | __cpm_start_lcd(); | ||
170 | } | ||
171 | |||
172 | void lcd_init_controller(void) | ||
173 | { | ||
174 | int i; | ||
175 | _display_pin_init(); | ||
176 | _set_lcd_bus(); | ||
177 | _set_lcd_clock(); | ||
178 | SLEEP(1000); | ||
179 | _display_on(); | ||
180 | } | ||
181 | |||
182 | void lcd_set_target(short x, short y, short width, short height) | ||
183 | { | ||
184 | SLCD_SEND_COMMAND(0x210, y); /* y_start */ | ||
185 | SLCD_SEND_COMMAND(0x211, y+height); /* y_end */ | ||
186 | SLCD_SEND_COMMAND(0x212, x); /* x_start */ | ||
187 | SLCD_SEND_COMMAND(0x213, x+width); /* x_end */ | ||
188 | SLCD_SEND_COMMAND(0x200, x); /* set cursor at x_start */ | ||
189 | SLCD_SEND_COMMAND(0x201, y); /* set cursor at y_start */ | ||
190 | SLCD_SET_COMMAND(0x202); /* write data? */ | ||
191 | } | ||
192 | |||
193 | void lcd_on(void) | ||
194 | { | ||
195 | _display_on(); | ||
196 | } | ||
197 | |||
198 | void lcd_off(void) | ||
199 | { | ||
200 | return; | ||
201 | } | ||
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-target.h b/firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-target.h new file mode 100755 index 0000000000..e643608d56 --- /dev/null +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-target.h | |||
@@ -0,0 +1,36 @@ | |||
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 LCD_TARGET_H | ||
22 | #define LCD_TARGET_H | ||
23 | |||
24 | #include <stdbool.h> | ||
25 | |||
26 | void lcd_enable(bool state); | ||
27 | bool lcd_enabled(void); | ||
28 | void lcd_init_device(void); | ||
29 | |||
30 | |||
31 | void lcd_init_controller(void); | ||
32 | void lcd_set_target(short x, short y, short width, short height); | ||
33 | void lcd_on(void); | ||
34 | void lcd_off(void); | ||
35 | |||
36 | #endif /* LCD_TARGET_H */ | ||
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/usb-target.h b/firmware/target/mips/ingenic_jz47xx/onda_vx747/usb-target.h new file mode 100755 index 0000000000..30893aaaa3 --- /dev/null +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/usb-target.h | |||
@@ -0,0 +1,26 @@ | |||
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 USB_TARGET_H | ||
22 | #define USB_TARGET_H | ||
23 | |||
24 | void usb_init_device(void); | ||
25 | |||
26 | #endif | ||