diff options
author | Robert Keevil <rkeevil+rockbox@gmail.com> | 2009-07-13 21:09:39 +0000 |
---|---|---|
committer | Robert Keevil <rkeevil+rockbox@gmail.com> | 2009-07-13 21:09:39 +0000 |
commit | eea149bd1399e749a6dae8b3a6fe5ff076ead985 (patch) | |
tree | a131998421757859c25c567c657223ece0430c31 /firmware/target/arm | |
parent | 5f6998bde9b8a7a7aa61df602202ff41feb13ea1 (diff) | |
download | rockbox-eea149bd1399e749a6dae8b3a6fe5ff076ead985.tar.gz rockbox-eea149bd1399e749a6dae8b3a6fe5ff076ead985.zip |
FS#10436 - add the Sansa View to the build system. The bootloader builds but doesn't do anything useful yet.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21848 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm')
-rw-r--r-- | firmware/target/arm/sandisk/boot.lds | 5 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-view/adc-view.c | 33 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-view/backlight-target.h | 34 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-view/backlight-view.c | 50 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-view/button-target.h | 62 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-view/button-view.c | 37 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-view/i2c-view.c | 26 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-view/lcd-view.c | 428 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-view/power-view.c | 28 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-view/powermgmt-view.c | 55 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-view/usb-view.c | 36 |
11 files changed, 794 insertions, 0 deletions
diff --git a/firmware/target/arm/sandisk/boot.lds b/firmware/target/arm/sandisk/boot.lds index f2178651cd..622695f5b6 100644 --- a/firmware/target/arm/sandisk/boot.lds +++ b/firmware/target/arm/sandisk/boot.lds | |||
@@ -7,7 +7,12 @@ STARTUP(target/arm/crt0-pp-bl.o) | |||
7 | 7 | ||
8 | #define DRAMSIZE (MEMORYSIZE * 0x100000) | 8 | #define DRAMSIZE (MEMORYSIZE * 0x100000) |
9 | 9 | ||
10 | #ifdef SANSA_VIEW | ||
11 | #define DRAMORIG 0x10f00000 | ||
12 | #else | ||
10 | #define DRAMORIG 0x10000000 | 13 | #define DRAMORIG 0x10000000 |
14 | #endif | ||
15 | |||
11 | #ifndef IRAMORIG | 16 | #ifndef IRAMORIG |
12 | #define IRAMORIG 0x40000000 | 17 | #define IRAMORIG 0x40000000 |
13 | #endif | 18 | #endif |
diff --git a/firmware/target/arm/sandisk/sansa-view/adc-view.c b/firmware/target/arm/sandisk/sansa-view/adc-view.c new file mode 100644 index 0000000000..deb8de2471 --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/adc-view.c | |||
@@ -0,0 +1,33 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Robert Keevil | ||
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 "adc-target.h" | ||
23 | |||
24 | void adc_init(void) | ||
25 | { | ||
26 | } | ||
27 | |||
28 | /* Called to get the recent ADC reading */ | ||
29 | inline unsigned short adc_read(int channel) | ||
30 | { | ||
31 | (void)channel; | ||
32 | return 0; | ||
33 | } | ||
diff --git a/firmware/target/arm/sandisk/sansa-view/backlight-target.h b/firmware/target/arm/sandisk/sansa-view/backlight-target.h new file mode 100644 index 0000000000..a2282ba316 --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/backlight-target.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Robert Keevil | ||
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 | #ifndef BACKLIGHT_TARGET_H | ||
23 | #define BACKLIGHT_TARGET_H | ||
24 | |||
25 | #include <stdbool.h> | ||
26 | |||
27 | #define _backlight_init() true | ||
28 | void _backlight_on(void); | ||
29 | void _backlight_off(void); | ||
30 | |||
31 | void _buttonlight_on(void); | ||
32 | void _buttonlight_off(void); | ||
33 | |||
34 | #endif | ||
diff --git a/firmware/target/arm/sandisk/sansa-view/backlight-view.c b/firmware/target/arm/sandisk/sansa-view/backlight-view.c new file mode 100644 index 0000000000..20932c8607 --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/backlight-view.c | |||
@@ -0,0 +1,50 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Robert Keevil | ||
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 | #include "config.h" | ||
22 | #include "backlight-target.h" | ||
23 | #include "system.h" | ||
24 | #include "lcd.h" | ||
25 | #include "backlight.h" | ||
26 | |||
27 | void _backlight_set_brightness(int brightness) | ||
28 | { | ||
29 | (void)brightness; | ||
30 | } | ||
31 | |||
32 | void _backlight_off(void) | ||
33 | { | ||
34 | GPIO_SET_BITWISE(GPIOD_ENABLE, 1<<8); | ||
35 | } | ||
36 | |||
37 | void _backlight_on(void) | ||
38 | { | ||
39 | GPIO_SET_BITWISE(GPIOD_ENABLE, 1); | ||
40 | } | ||
41 | |||
42 | void _buttonlight_on(void) | ||
43 | { | ||
44 | GPIO_CLEAR_BITWISE(GPIOA_ENABLE, 0x2); | ||
45 | } | ||
46 | |||
47 | void _buttonlight_off(void) | ||
48 | { | ||
49 | GPIO_SET_BITWISE(GPIOA_ENABLE, 0x2); | ||
50 | } | ||
diff --git a/firmware/target/arm/sandisk/sansa-view/button-target.h b/firmware/target/arm/sandisk/sansa-view/button-target.h new file mode 100644 index 0000000000..18931da700 --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/button-target.h | |||
@@ -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 | * 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 | #ifndef _BUTTON_TARGET_H_ | ||
23 | #define _BUTTON_TARGET_H_ | ||
24 | |||
25 | #include <stdbool.h> | ||
26 | #include "config.h" | ||
27 | |||
28 | #define HAS_BUTTON_HOLD | ||
29 | |||
30 | void button_init_device(void); | ||
31 | bool button_hold(void); | ||
32 | int button_read_device(void); | ||
33 | /* Sandisk Sansa View button codes */ | ||
34 | |||
35 | /* Main unit's buttons */ | ||
36 | #define BUTTON_HOME 0x00000001 | ||
37 | |||
38 | #define BUTTON_DOWN 0x00000002 | ||
39 | #define BUTTON_RIGHT 0x00000004 | ||
40 | |||
41 | #define BUTTON_LEFT 0x00000008 | ||
42 | #define BUTTON_SELECT 0x00000010 | ||
43 | #define BUTTON_UP 0x00000020 | ||
44 | #define BUTTON_POWER 0x00000040 | ||
45 | |||
46 | #define BUTTON_SCROLL_BACK 0x00000080 | ||
47 | #define BUTTON_SCROLL_FWD 0x00000100 | ||
48 | |||
49 | #define BUTTON_HOLD 0x00000400 | ||
50 | |||
51 | #define BUTTON_MAIN (BUTTON_HOME|BUTTON_DOWN|BUTTON_RIGHT|BUTTON_LEFT \ | ||
52 | |BUTTON_SELECT|BUTTON_UP|BUTTON_POWER \ | ||
53 | |BUTTON_SCROLL_BACK|BUTTON_SCROLL_FWD \ | ||
54 | |BUTTON_HOLD) | ||
55 | |||
56 | /* No Remote control */ | ||
57 | #define BUTTON_REMOTE 0 | ||
58 | |||
59 | #define POWEROFF_BUTTON BUTTON_POWER | ||
60 | #define POWEROFF_COUNT 10 | ||
61 | |||
62 | #endif /* _BUTTON_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/sandisk/sansa-view/button-view.c b/firmware/target/arm/sandisk/sansa-view/button-view.c new file mode 100644 index 0000000000..e1a0bbbcaf --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/button-view.c | |||
@@ -0,0 +1,37 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Robert Keevil | ||
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 "button.h" | ||
23 | |||
24 | void button_init_device(void) | ||
25 | { | ||
26 | |||
27 | } | ||
28 | |||
29 | bool button_hold(void) | ||
30 | { | ||
31 | return false; | ||
32 | } | ||
33 | |||
34 | int button_read_device(void) | ||
35 | { | ||
36 | return 0; | ||
37 | } | ||
diff --git a/firmware/target/arm/sandisk/sansa-view/i2c-view.c b/firmware/target/arm/sandisk/sansa-view/i2c-view.c new file mode 100644 index 0000000000..a8ded7d2bf --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/i2c-view.c | |||
@@ -0,0 +1,26 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Robert Keevil | ||
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 "i2c.h" | ||
23 | |||
24 | void i2c_init(void) | ||
25 | { | ||
26 | } | ||
diff --git a/firmware/target/arm/sandisk/sansa-view/lcd-view.c b/firmware/target/arm/sandisk/sansa-view/lcd-view.c new file mode 100644 index 0000000000..39b0d574eb --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/lcd-view.c | |||
@@ -0,0 +1,428 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Rockbox driver for Sansa View LCDs | ||
11 | * | ||
12 | * Copyright (c) 2009 Robert Keevil | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | #include <string.h> | ||
24 | #include "cpu.h" | ||
25 | #include "system.h" | ||
26 | #include "backlight-target.h" | ||
27 | #include "lcd.h" | ||
28 | |||
29 | #include "bitmaps/rockboxlogo.h" | ||
30 | |||
31 | /* Power and display status */ | ||
32 | static bool power_on = false; /* Is the power turned on? */ | ||
33 | static bool display_on SHAREDBSS_ATTR = false; /* Is the display turned on? */ | ||
34 | static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0; | ||
35 | |||
36 | #define LCD_DATA_OUT_GPIO GPIOH_OUTPUT_VAL | ||
37 | #define LCD_DATA_OUT_PIN 4 | ||
38 | |||
39 | #define LCD_CLOCK_GPIO GPIOH_OUTPUT_VAL | ||
40 | #define LCD_CLOCK_PIN 6 | ||
41 | |||
42 | #define LCD_CS_GPIO GPIOH_OUTPUT_VAL | ||
43 | #define LCD_CS_PIN 7 | ||
44 | |||
45 | #ifdef BOOTLOADER | ||
46 | static void lcd_init_gpio(void) | ||
47 | { | ||
48 | // OF: 0x5CC8 | ||
49 | |||
50 | outl(inl(0x70000010) | 0xFC000000, 0x70000010); | ||
51 | outl(inl(0x70000014) | 0xC300000, 0x70000014); | ||
52 | |||
53 | GPIOE_ENABLE = 0; | ||
54 | /* TODO: check GPIOM exists and isn't just atomic access */ | ||
55 | /* GPIOM_ENABLE &= ~0x3; */ | ||
56 | GPIOJ_ENABLE &= ~0x1a; | ||
57 | GPIOB_ENABLE &= ~0x8; | ||
58 | GPIOH_OUTPUT_VAL |= 0x80; | ||
59 | GPIOH_OUTPUT_EN |= 0x80; | ||
60 | GPIOH_ENABLE |= 0x80; | ||
61 | GPIOH_OUTPUT_VAL |= 0x40; | ||
62 | GPIOH_OUTPUT_EN |= 0x40; | ||
63 | GPIOH_ENABLE |= 0x40; | ||
64 | GPIOH_OUTPUT_VAL |= 0x20; | ||
65 | GPIOH_OUTPUT_EN |= 0x20; | ||
66 | GPIOH_ENABLE |= 0x20; | ||
67 | GPIOH_OUTPUT_VAL |= 0x10; | ||
68 | GPIOH_OUTPUT_EN |= 0x10; | ||
69 | GPIOH_ENABLE |= 0x10; | ||
70 | // GPIOD_OUTOUT_VAL &= ~0x1; //backlight on | ||
71 | // GPIOD_ENABLE |= 0x1; | ||
72 | GPIOB_OUTPUT_VAL |= 0x4; | ||
73 | GPIOB_ENABLE |= 0x4; | ||
74 | GPIOB_OUTPUT_EN |= 0x4; | ||
75 | GPIOG_ENABLE |= 0x8; | ||
76 | GPIOG_OUTPUT_EN &= ~0x8; | ||
77 | |||
78 | // more to add here... | ||
79 | } | ||
80 | #endif | ||
81 | |||
82 | static void lcd_send_msg(unsigned char count, unsigned int data) | ||
83 | { | ||
84 | // OF: 0x645C | ||
85 | int i; | ||
86 | |||
87 | LCD_CLOCK_GPIO |= (1 << LCD_CLOCK_PIN); | ||
88 | LCD_CS_GPIO &= ~(1 << LCD_CS_PIN); | ||
89 | |||
90 | for (i = count - 1; i >= 0; i--) | ||
91 | { | ||
92 | if (data & (1 << count)) | ||
93 | { | ||
94 | // LCD_DATA_OUT_GPIO &= ~(1 << LCD_DATA_OUT_PIN); | ||
95 | LCD_DATA_OUT_GPIO |= (1 << LCD_DATA_OUT_PIN); | ||
96 | } else { | ||
97 | // LCD_DATA_OUT_GPIO |= (1 << LCD_DATA_OUT_PIN); | ||
98 | LCD_DATA_OUT_GPIO &= ~(1 << LCD_DATA_OUT_PIN); | ||
99 | } | ||
100 | LCD_CLOCK_GPIO &= ~(1 << LCD_CLOCK_PIN); | ||
101 | udelay(1); | ||
102 | LCD_CLOCK_GPIO |= (1 << LCD_CLOCK_PIN); | ||
103 | udelay(2); | ||
104 | } | ||
105 | |||
106 | LCD_CS_GPIO |= (1 << LCD_CS_PIN); | ||
107 | LCD_CLOCK_GPIO |= (1 << LCD_CLOCK_PIN); | ||
108 | udelay(1); | ||
109 | } | ||
110 | |||
111 | /* | ||
112 | static void lcd_write_reg(unsigned int reg, unsigned int data) | ||
113 | { | ||
114 | // OF: 0x6278 - referenced from 0x62840 | ||
115 | |||
116 | // So far this function is always called with shift = 0x0 ? | ||
117 | // If so can remove and simplify | ||
118 | |||
119 | unsigned int cmd; | ||
120 | unsigned int shift = 0; | ||
121 | |||
122 | cmd = shift << 0x2; | ||
123 | cmd |= 0x70; | ||
124 | cmd = cmd << 0x10; | ||
125 | cmd |= reg; | ||
126 | lcd_send_msg(0x18, cmd); | ||
127 | |||
128 | cmd = shift << 0x2; | ||
129 | cmd |= 0x72; | ||
130 | cmd = cmd << 0x10; | ||
131 | cmd |= data; | ||
132 | lcd_send_msg(0x18, cmd); | ||
133 | |||
134 | // lcd_send_msg(0x70, reg); | ||
135 | // lcd_send_msg(0x72, data); | ||
136 | } | ||
137 | */ | ||
138 | |||
139 | static void lcd_write_cmd(unsigned int cmd) | ||
140 | { | ||
141 | lcd_send_msg(0x18, (0x700000 | cmd)); | ||
142 | } | ||
143 | |||
144 | static void lcd_write_info(unsigned int data) | ||
145 | { | ||
146 | lcd_send_msg(0x18, (0x720000 | data)); | ||
147 | } | ||
148 | |||
149 | static void lcd_write_reg(unsigned int cmd, unsigned int data) | ||
150 | { | ||
151 | lcd_write_cmd(cmd); | ||
152 | lcd_write_info(data); | ||
153 | } | ||
154 | |||
155 | /* Run the powerup sequence for the driver IC */ | ||
156 | static void lcd_power_on(void) | ||
157 | { | ||
158 | /* OF: 0x5DC0 * | ||
159 | * r2: cmd * | ||
160 | * r3: data */ | ||
161 | lcd_write_reg(0xE5, 0x8000); | ||
162 | lcd_write_reg(0x0, 0x1); | ||
163 | lcd_write_reg(0x1, 0x100); | ||
164 | lcd_write_reg(0x2, 0x700); | ||
165 | lcd_write_reg(0x3, 0x1230); | ||
166 | lcd_write_reg(0x4, 0x0); | ||
167 | lcd_write_reg(0x8, 0x408); | ||
168 | lcd_write_reg(0x9, 0x0); | ||
169 | lcd_write_reg(0xa, 0x0); | ||
170 | lcd_write_reg(0xd, 0x0); | ||
171 | lcd_write_reg(0xf, 0x2); | ||
172 | lcd_write_reg(0x10, 0x0); | ||
173 | lcd_write_reg(0x11, 0x0); | ||
174 | lcd_write_reg(0x12, 0x0); | ||
175 | lcd_write_reg(0x13, 0x0); | ||
176 | sleep(HZ/5); | ||
177 | lcd_write_reg(0x10, 0x17B0); | ||
178 | lcd_write_reg(0x11, 0x7); | ||
179 | sleep(HZ/20); | ||
180 | lcd_write_reg(0x12, 0x13c); | ||
181 | sleep(HZ/20); | ||
182 | |||
183 | // OF: BNE 0x5fb2 | ||
184 | |||
185 | // two different models in use?!? | ||
186 | if (1) | ||
187 | { | ||
188 | lcd_write_reg(0x13, 0x1800); | ||
189 | lcd_write_reg(0x29, 0x13); | ||
190 | sleep(HZ/10); | ||
191 | lcd_write_reg(0x20, 0x0); | ||
192 | lcd_write_reg(0x21, 0x0); | ||
193 | |||
194 | lcd_write_reg(0x30, 0x2); | ||
195 | lcd_write_reg(0x31, 0xF07); // 0x37 option in other controller | ||
196 | lcd_write_reg(0x32, 0x403); // 0x31 option in other controller | ||
197 | lcd_write_reg(0x35, 0x206); | ||
198 | lcd_write_reg(0x36, 0x504); | ||
199 | lcd_write_reg(0x37, 0x707); | ||
200 | lcd_write_reg(0x38, 0x403); | ||
201 | } | ||
202 | else | ||
203 | { | ||
204 | // OF: last func continues, 0x5EFC | ||
205 | lcd_write_reg(0x13, 0x1700); | ||
206 | lcd_write_reg(0x29, 0x10); | ||
207 | sleep(HZ/10); | ||
208 | lcd_write_reg(0x20, 0x0); | ||
209 | lcd_write_reg(0x21, 0x0); | ||
210 | |||
211 | lcd_write_reg(0x30, 0x7); | ||
212 | lcd_write_reg(0x31, 0x403); | ||
213 | lcd_write_reg(0x32, 0x400); | ||
214 | lcd_write_reg(0x35, 0x3); | ||
215 | lcd_write_reg(0x36, 0xF07); | ||
216 | lcd_write_reg(0x37, 0x403); | ||
217 | lcd_write_reg(0x37, 0x106); | ||
218 | } | ||
219 | |||
220 | // OF: b 0x6066 | ||
221 | lcd_write_reg(0x39, 0x7); | ||
222 | lcd_write_reg(0x3c, 0x700); | ||
223 | lcd_write_reg(0x3d, 0x700); | ||
224 | |||
225 | lcd_write_reg(0x50, 0x0); | ||
226 | lcd_write_reg(0x51, 0xef); // 239 - LCD_WIDTH | ||
227 | lcd_write_reg(0x52, 0x0); | ||
228 | lcd_write_reg(0x53, 0x13f); // 319 - LCD_HEIGHT | ||
229 | |||
230 | // OF: b 0x6114 | ||
231 | lcd_write_reg(0x60, 0x2700); | ||
232 | lcd_write_reg(0x61, 0x1); | ||
233 | lcd_write_reg(0x6a, 0x0); | ||
234 | |||
235 | lcd_write_reg(0x80, 0x0); | ||
236 | lcd_write_reg(0x81, 0x0); | ||
237 | lcd_write_reg(0x82, 0x0); | ||
238 | lcd_write_reg(0x83, 0x0); | ||
239 | lcd_write_reg(0x84, 0x0); | ||
240 | lcd_write_reg(0x85, 0x0); | ||
241 | |||
242 | // OF: 0x61A8 | ||
243 | lcd_write_reg(0x90, 0x10); | ||
244 | lcd_write_reg(0x92, 0x0); | ||
245 | lcd_write_reg(0x93, 0x3); | ||
246 | lcd_write_reg(0x95, 0x110); | ||
247 | lcd_write_reg(0x97, 0x0); | ||
248 | lcd_write_reg(0x98, 0x0); | ||
249 | |||
250 | lcd_write_reg(0xc, 0x110); | ||
251 | lcd_write_reg(0x7, 0x173); | ||
252 | sleep(HZ/10); | ||
253 | lcd_write_cmd(0x22); | ||
254 | |||
255 | power_on = true; | ||
256 | } | ||
257 | |||
258 | void unknown01(void) | ||
259 | { | ||
260 | // OF: 0x62C4 | ||
261 | |||
262 | lcd_write_reg(0x10, 0x17B0); | ||
263 | udelay(100); | ||
264 | lcd_write_reg(0x7, 0x173); | ||
265 | } | ||
266 | |||
267 | void unknown02(void) | ||
268 | { | ||
269 | // OF: 0x6308 | ||
270 | |||
271 | lcd_write_reg(0x7, 0x160); | ||
272 | lcd_write_reg(0x10, 0x17B1); | ||
273 | } | ||
274 | |||
275 | void unknown03(void) | ||
276 | { | ||
277 | // OF: 0x6410 | ||
278 | GPIOJ_ENABLE |= 0x2; | ||
279 | GPIOJ_OUTPUT_EN |= 0x2; | ||
280 | GPIOJ_OUTPUT_VAL &= ~0x02; | ||
281 | } | ||
282 | |||
283 | void unknown04(void) | ||
284 | { | ||
285 | // OF: 0x623C | ||
286 | |||
287 | GPIOB_OUTPUT_VAL |= 0x4; | ||
288 | udelay(1000); | ||
289 | GPIOB_OUTPUT_VAL &= ~0x4; | ||
290 | sleep(HZ/10); | ||
291 | GPIOB_OUTPUT_VAL |= 0x4; | ||
292 | udelay(1000); | ||
293 | } | ||
294 | |||
295 | /* Run the display on sequence for the driver IC */ | ||
296 | static void lcd_display_on(void) | ||
297 | { | ||
298 | display_on = true; | ||
299 | } | ||
300 | |||
301 | |||
302 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | ||
303 | bool lcd_active(void) | ||
304 | { | ||
305 | return display_on; | ||
306 | } | ||
307 | |||
308 | /* Turn off visible display operations */ | ||
309 | static void lcd_display_off(void) | ||
310 | { | ||
311 | display_on = false; | ||
312 | } | ||
313 | #endif | ||
314 | |||
315 | void lcd_init_device(void) | ||
316 | { | ||
317 | |||
318 | #ifdef BOOTLOADER /* Bother at all to do this again? */ | ||
319 | //#if 0 | ||
320 | /* Init GPIO ports */ | ||
321 | lcd_init_gpio(); | ||
322 | lcd_power_on(); | ||
323 | lcd_display_on(); | ||
324 | #else | ||
325 | |||
326 | power_on = true; | ||
327 | display_on = true; | ||
328 | |||
329 | lcd_set_invert_display(false); | ||
330 | lcd_set_flip(false); | ||
331 | #endif | ||
332 | } | ||
333 | |||
334 | #if defined(HAVE_LCD_ENABLE) | ||
335 | void lcd_enable(bool on) | ||
336 | { | ||
337 | (void)on; | ||
338 | } | ||
339 | #endif | ||
340 | |||
341 | #if defined(HAVE_LCD_SLEEP) | ||
342 | void lcd_sleep(void) | ||
343 | { | ||
344 | |||
345 | } | ||
346 | #endif | ||
347 | |||
348 | void lcd_update(void) | ||
349 | { | ||
350 | const fb_data *addr; | ||
351 | |||
352 | addr = &lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH]; | ||
353 | |||
354 | lcd_write_reg(0x20, 0x0); | ||
355 | lcd_write_reg(0x21, 0x0); | ||
356 | |||
357 | int i,j; | ||
358 | for(i=0; i < LCD_HEIGHT; i++) | ||
359 | { | ||
360 | for(j=0; j < LCD_WIDTH; j++) | ||
361 | { | ||
362 | lcd_write_reg(0x22, *addr); | ||
363 | addr++; | ||
364 | } | ||
365 | } | ||
366 | } | ||
367 | |||
368 | /* Update a fraction of the display. */ | ||
369 | void lcd_update_rect(int x, int y, int width, int height) | ||
370 | { | ||
371 | (void)x; | ||
372 | (void)y; | ||
373 | (void)width; | ||
374 | (void)height; | ||
375 | lcd_update(); | ||
376 | } | ||
377 | |||
378 | |||
379 | /*** hardware configuration ***/ | ||
380 | |||
381 | void lcd_set_contrast(int val) | ||
382 | { | ||
383 | (void)val; | ||
384 | } | ||
385 | |||
386 | void lcd_set_invert_display(bool yesno) | ||
387 | { | ||
388 | (void)yesno; | ||
389 | } | ||
390 | |||
391 | /* turn the display upside down (call lcd_update() afterwards) */ | ||
392 | void lcd_set_flip(bool yesno) | ||
393 | { | ||
394 | (void)yesno; | ||
395 | } | ||
396 | |||
397 | /* Blitting functions */ | ||
398 | |||
399 | void lcd_yuv_set_options(unsigned options) | ||
400 | { | ||
401 | lcd_yuv_options = options; | ||
402 | } | ||
403 | |||
404 | /* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ | ||
405 | extern void lcd_write_yuv420_lines(fb_data *dst, | ||
406 | unsigned char const * const src[3], | ||
407 | int width, | ||
408 | int stride); | ||
409 | extern void lcd_write_yuv420_lines_odither(fb_data *dst, | ||
410 | unsigned char const * const src[3], | ||
411 | int width, | ||
412 | int stride, | ||
413 | int x_screen, /* To align dither pattern */ | ||
414 | int y_screen); | ||
415 | |||
416 | void lcd_blit_yuv(unsigned char * const src[3], | ||
417 | int src_x, int src_y, int stride, | ||
418 | int x, int y, int width, int height) | ||
419 | { | ||
420 | (void)src; | ||
421 | (void)src_x; | ||
422 | (void)src_y; | ||
423 | (void)stride; | ||
424 | (void)x; | ||
425 | (void)y; | ||
426 | (void)width; | ||
427 | (void)height; | ||
428 | } | ||
diff --git a/firmware/target/arm/sandisk/sansa-view/power-view.c b/firmware/target/arm/sandisk/sansa-view/power-view.c new file mode 100644 index 0000000000..7df7296718 --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/power-view.c | |||
@@ -0,0 +1,28 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Robert Keevil | ||
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 | void power_init(void) | ||
23 | { | ||
24 | } | ||
25 | |||
26 | void power_off(void) | ||
27 | { | ||
28 | } | ||
diff --git a/firmware/target/arm/sandisk/sansa-view/powermgmt-view.c b/firmware/target/arm/sandisk/sansa-view/powermgmt-view.c new file mode 100644 index 0000000000..459b60dd45 --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/powermgmt-view.c | |||
@@ -0,0 +1,55 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Robert Keevil | ||
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 "adc.h" | ||
24 | #include "powermgmt.h" | ||
25 | |||
26 | unsigned int battery_adc_voltage(void) | ||
27 | { | ||
28 | return 0; | ||
29 | } | ||
30 | |||
31 | /* FIXME - next 4 functions taken from e200 - last 2 will need | ||
32 | to be updated */ | ||
33 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
34 | { | ||
35 | 3400 | ||
36 | }; | ||
37 | |||
38 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
39 | { | ||
40 | 3300 | ||
41 | }; | ||
42 | |||
43 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
44 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
45 | { | ||
46 | /* Sansa Li Ion 750mAH FIXME */ | ||
47 | { 3300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160 }, | ||
48 | }; | ||
49 | |||
50 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
51 | const unsigned short percent_to_volt_charge[11] = | ||
52 | { | ||
53 | /* Sansa Li Ion 750mAH FIXME */ | ||
54 | 3300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160 | ||
55 | }; | ||
diff --git a/firmware/target/arm/sandisk/sansa-view/usb-view.c b/firmware/target/arm/sandisk/sansa-view/usb-view.c new file mode 100644 index 0000000000..6356ee6ffd --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/usb-view.c | |||
@@ -0,0 +1,36 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Robert Keevil | ||
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 "usb.h" | ||
23 | |||
24 | int usb_detect(void) | ||
25 | { | ||
26 | return.0; | ||
27 | } | ||
28 | |||
29 | void usb_enable(bool on) | ||
30 | { | ||
31 | (void)on; | ||
32 | } | ||
33 | |||
34 | void usb_init_device(void) | ||
35 | { | ||
36 | } | ||