diff options
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx/onda_vx767')
6 files changed, 464 insertions, 0 deletions
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 | |||
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_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 | |||
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_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 | |||
35 | bool button_hold(void) | ||
36 | { | ||
37 | return (~REG_GPIO_PXPIN(3) & BTN_HOLD ? 1 : 0); | ||
38 | } | ||
39 | |||
40 | void 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 | |||
49 | int 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 | |||
29 | bool button_hold(void); | ||
30 | void button_init_device(void); | ||
31 | int 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() \ | ||
31 | do { \ | ||
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); | ||
40 | static 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); | ||
65 | static 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 | |||
132 | static void _display_on(void) | ||
133 | { | ||
134 | } | ||
135 | |||
136 | static void _display_off(void) | ||
137 | { | ||
138 | } | ||
139 | |||
140 | static 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 | |||
152 | static 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 | |||
168 | void 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 | |||
178 | void 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 | |||
187 | void lcd_on(void) | ||
188 | { | ||
189 | _display_on(); | ||
190 | } | ||
191 | |||
192 | void lcd_off(void) | ||
193 | { | ||
194 | _display_off(); | ||
195 | } | ||