summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tcc780x/cowond2
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tcc780x/cowond2')
-rw-r--r--firmware/target/arm/tcc780x/cowond2/adc-target.h26
-rw-r--r--firmware/target/arm/tcc780x/cowond2/backlight-target.h40
-rw-r--r--firmware/target/arm/tcc780x/cowond2/button-cowond2.c67
-rw-r--r--firmware/target/arm/tcc780x/cowond2/button-target.h52
-rw-r--r--firmware/target/arm/tcc780x/cowond2/i2c-target.h37
-rw-r--r--firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c346
-rw-r--r--firmware/target/arm/tcc780x/cowond2/pcm-cowond2.c86
-rw-r--r--firmware/target/arm/tcc780x/cowond2/power-cowond2.c71
-rw-r--r--firmware/target/arm/tcc780x/cowond2/powermgmt-cowond2.c59
-rw-r--r--firmware/target/arm/tcc780x/cowond2/usb-cowond2.c49
10 files changed, 833 insertions, 0 deletions
diff --git a/firmware/target/arm/tcc780x/cowond2/adc-target.h b/firmware/target/arm/tcc780x/cowond2/adc-target.h
new file mode 100644
index 0000000000..873183d721
--- /dev/null
+++ b/firmware/target/arm/tcc780x/cowond2/adc-target.h
@@ -0,0 +1,26 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 Dave Chapman
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#ifndef _ADC_TARGET_H_
20#define _ADC_TARGET_H_
21
22#define NUM_ADC_CHANNELS 4
23
24#define ADC_BUTTONS 0
25
26#endif /* _ADC_TARGET_H_ */
diff --git a/firmware/target/arm/tcc780x/cowond2/backlight-target.h b/firmware/target/arm/tcc780x/cowond2/backlight-target.h
new file mode 100644
index 0000000000..0563fc20f5
--- /dev/null
+++ b/firmware/target/arm/tcc780x/cowond2/backlight-target.h
@@ -0,0 +1,40 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Rob Purchase
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#ifndef BACKLIGHT_TARGET_H
20#define BACKLIGHT_TARGET_H
21
22#include "tcc780x.h"
23
24#define _backlight_init() true
25
26/* nb: we can set the backlight intensity using PCF50606 register 0x35 */
27
28static inline void _backlight_on(void)
29{
30 /* Enable backlight */
31 GPIOA_SET = (1<<6);
32}
33
34static inline void _backlight_off(void)
35{
36 /* Disable backlight */
37 GPIOA_CLEAR = (1<<6);
38}
39
40#endif
diff --git a/firmware/target/arm/tcc780x/cowond2/button-cowond2.c b/firmware/target/arm/tcc780x/cowond2/button-cowond2.c
new file mode 100644
index 0000000000..dccdf4e8e0
--- /dev/null
+++ b/firmware/target/arm/tcc780x/cowond2/button-cowond2.c
@@ -0,0 +1,67 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Rob Purchase
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include "config.h"
21#include "cpu.h"
22#include "button.h"
23#include "adc.h"
24
25void button_init_device(void)
26{
27 /* Nothing to do */
28}
29
30int button_read_device(void)
31{
32 int btn = BUTTON_NONE;
33 int adc;
34
35 if (GPIOB & 0x4)
36 {
37 adc = adc_read(ADC_BUTTONS);
38
39 /* The following contains some abitrary, but working, guesswork */
40 if (adc < 0x038) {
41 btn |= (BUTTON_MINUS | BUTTON_PLUS | BUTTON_MENU);
42 } else if (adc < 0x048) {
43 btn |= (BUTTON_MINUS | BUTTON_PLUS);
44 } else if (adc < 0x058) {
45 btn |= (BUTTON_PLUS | BUTTON_MENU);
46 } else if (adc < 0x070) {
47 btn |= BUTTON_PLUS;
48 } else if (adc < 0x090) {
49 btn |= (BUTTON_MINUS | BUTTON_MENU);
50 } else if (adc < 0x150) {
51 btn |= BUTTON_MINUS;
52 } else if (adc < 0x200) {
53 btn |= BUTTON_MENU;
54 }
55 }
56
57 /* TODO: Read 'fake' buttons based on touchscreen quadrants.
58 Question: How can I read from the PCF chip (I2C) in a tick task? */
59
60 if (!(GPIOA & 0x8))
61 btn |= BUTTON_HOLD;
62
63 if (!(GPIOA & 0x4))
64 btn |= BUTTON_POWER;
65
66 return btn;
67}
diff --git a/firmware/target/arm/tcc780x/cowond2/button-target.h b/firmware/target/arm/tcc780x/cowond2/button-target.h
new file mode 100644
index 0000000000..aa336f2f1f
--- /dev/null
+++ b/firmware/target/arm/tcc780x/cowond2/button-target.h
@@ -0,0 +1,52 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Rob Purchase
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#ifndef _BUTTON_TARGET_H_
21#define _BUTTON_TARGET_H_
22
23#include <stdbool.h>
24#include "config.h"
25
26void button_init_device(void);
27int button_read_device(void);
28
29/* Main unit's buttons */
30#define BUTTON_POWER 0x00000001
31#define BUTTON_HOLD 0x00000002
32#define BUTTON_PLUS 0x00000004
33#define BUTTON_MINUS 0x00000008
34#define BUTTON_MENU 0x00000010
35
36/* Faked buttons based on touchscreen quadrants (not yet read) */
37#define BUTTON_UP 0x00000020
38#define BUTTON_DOWN 0x00000040
39#define BUTTON_LEFT 0x00000080
40#define BUTTON_RIGHT 0x00000100
41#define BUTTON_SELECT 0x00000200
42
43#define BUTTON_MAIN 0x3FF
44
45/* No remote */
46#define BUTTON_REMOTE 0
47
48/* Software power-off */
49#define POWEROFF_BUTTON BUTTON_POWER
50#define POWEROFF_COUNT 40
51
52#endif /* _BUTTON_TARGET_H_ */
diff --git a/firmware/target/arm/tcc780x/cowond2/i2c-target.h b/firmware/target/arm/tcc780x/cowond2/i2c-target.h
new file mode 100644
index 0000000000..8925a9bae3
--- /dev/null
+++ b/firmware/target/arm/tcc780x/cowond2/i2c-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 Rob Purchase
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#ifndef I2C_TARGET_H
20#define I2C_TARGET_H
21
22/* Definitions for the D2 I2C bus */
23
24#define SCL_BIT (1<<0)
25#define SDA_BIT (1<<1)
26
27#define SCL (GPIOA & SCL_BIT)
28#define SCL_HI GPIOA_SET = SCL_BIT
29#define SCL_LO GPIOA_CLEAR = SCL_BIT
30
31#define SDA (GPIOA & SDA_BIT)
32#define SDA_HI GPIOA_SET = SDA_BIT
33#define SDA_LO GPIOA_CLEAR = SDA_BIT
34#define SDA_INPUT GPIOA_DIR &= ~SDA_BIT
35#define SDA_OUTPUT GPIOA_DIR |= SDA_BIT
36
37#endif /* I2C_TARGET_H */
diff --git a/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c b/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c
new file mode 100644
index 0000000000..181c58669e
--- /dev/null
+++ b/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c
@@ -0,0 +1,346 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Rob Purchase
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#include "config.h"
20
21#include "hwcompat.h"
22#include "kernel.h"
23#include "lcd.h"
24#include "system.h"
25#include "cpu.h"
26#include "i2c.h"
27
28/* GPIO A pins for LCD panel SDI interface */
29
30#define LTV250QV_CS (1<<24)
31#define LTV250QV_SCL (1<<25)
32#define LTV250QV_SDI (1<<26)
33
34/* LCD Controller registers */
35
36#define LCDC_CTRL (*(volatile unsigned long *)0xF0000000)
37#define LCDC_CLKDIV (*(volatile unsigned long *)0xF0000008)
38#define LCDC_HTIME1 (*(volatile unsigned long *)0xF000000C)
39#define LCDC_HTIME2 (*(volatile unsigned long *)0xF0000010)
40#define LCDC_VTIME1 (*(volatile unsigned long *)0xF0000014)
41#define LCDC_VTIME2 (*(volatile unsigned long *)0xF0000018)
42#define LCDC_VTIME3 (*(volatile unsigned long *)0xF000001C)
43#define LCDC_VTIME4 (*(volatile unsigned long *)0xF0000020)
44#define LCDC_DS (*(volatile unsigned long *)0xF000005C)
45#define LCDC_I1CTRL (*(volatile unsigned long *)0xF000008C)
46#define LCDC_I1POS (*(volatile unsigned long *)0xF0000090)
47#define LCDC_I1SIZE (*(volatile unsigned long *)0xF0000094)
48#define LCDC_I1BASE (*(volatile unsigned long *)0xF0000098)
49#define LCDC_I1OFF (*(volatile unsigned long *)0xF00000A8)
50#define LCDC_I1SCALE (*(volatile unsigned long *)0xF00000AC)
51
52/* Power and display status */
53static bool display_on = false; /* Is the display turned on? */
54
55
56int lcd_default_contrast(void)
57{
58 return 0x1f;
59}
60
61void lcd_set_contrast(int val)
62{
63 /* iirc there is an ltv250qv command to do this */
64 #warning function not implemented
65 (void)val;
66}
67
68
69/* LTV250QV panel functions */
70
71static void ltv250qv_write(unsigned int command)
72{
73 int i;
74
75 GPIOA_CLEAR = LTV250QV_CS;
76
77 for (i = 23; i >= 0; i--)
78 {
79 GPIOA_CLEAR = LTV250QV_SCL;
80
81 if ((command>>i) & 1)
82 GPIOA_SET = LTV250QV_SDI;
83 else
84 GPIOA_CLEAR = LTV250QV_SDI;
85
86 GPIOA_SET = LTV250QV_SCL;
87 }
88
89 GPIOA_SET = LTV250QV_CS;
90}
91
92static void lcd_write_reg(unsigned char reg, unsigned short val)
93{
94 ltv250qv_write(0x740000 | reg);
95 ltv250qv_write(0x760000 | val);
96}
97
98
99/* TODO: The existing pcf50606 drivers are target-specific, so the following
100 lonely function exists until a D2 driver exists. */
101
102void pcf50606_write_reg(unsigned char reg, unsigned char val)
103{
104 unsigned char data[] = { reg, val };
105 i2c_write(0x10, data, 2);
106}
107
108
109/*
110 TEMP: Rough millisecond delay routine used by the LCD panel init sequence.
111 PCK_TCT must first have been initialised to 2Mhz by calling clock_init().
112*/
113static void sleep_ms(unsigned int ms)
114{
115 /* disable timer */
116 TCFG1 = 0;
117
118 /* set Timer1 reference value based on 125kHz tick */
119 TREF1 = ms * 125;
120
121 /* single count, zero the counter, divider = 16 [2^(3+1)], enable */
122 TCFG1 = (1<<9) | (1<<8) | (3<<4) | 1;
123
124 /* wait until Timer1 ref reached */
125 while (!(TIREQ & TF1)) {};
126}
127
128
129static void lcd_display_on(void)
130{
131 /* power on sequence as per the D2 firmware */
132 GPIOA_SET = (1<<16);
133
134 sleep_ms(10);
135
136 lcd_write_reg(1, 0x1D);
137 lcd_write_reg(2, 0x0);
138 lcd_write_reg(3, 0x0);
139 lcd_write_reg(4, 0x0);
140 lcd_write_reg(5, 0x40A3);
141 lcd_write_reg(6, 0x0);
142 lcd_write_reg(7, 0x0);
143 lcd_write_reg(8, 0x0);
144 lcd_write_reg(9, 0x0);
145 lcd_write_reg(10, 0x0);
146 lcd_write_reg(16, 0x0);
147 lcd_write_reg(17, 0x0);
148 lcd_write_reg(18, 0x0);
149 lcd_write_reg(19, 0x0);
150 lcd_write_reg(20, 0x0);
151 lcd_write_reg(21, 0x0);
152 lcd_write_reg(22, 0x0);
153 lcd_write_reg(23, 0x0);
154 lcd_write_reg(24, 0x0);
155 lcd_write_reg(25, 0x0);
156 sleep_ms(10);
157
158 lcd_write_reg(9, 0x4055);
159 lcd_write_reg(10, 0x0);
160 sleep_ms(40);
161
162 lcd_write_reg(10, 0x2000);
163 sleep_ms(40);
164
165 lcd_write_reg(1, 0xC01D);
166 lcd_write_reg(2, 0x204);
167 lcd_write_reg(3, 0xE100);
168 lcd_write_reg(4, 0x1000);
169 lcd_write_reg(5, 0x5033);
170 lcd_write_reg(6, 0x4);
171 lcd_write_reg(7, 0x30);
172 lcd_write_reg(8, 0x41C);
173 lcd_write_reg(16, 0x207);
174 lcd_write_reg(17, 0x702);
175 lcd_write_reg(18, 0xB05);
176 lcd_write_reg(19, 0xB05);
177 lcd_write_reg(20, 0x707);
178 lcd_write_reg(21, 0x507);
179 lcd_write_reg(22, 0x103);
180 lcd_write_reg(23, 0x406);
181 lcd_write_reg(24, 0x2);
182 lcd_write_reg(25, 0x0);
183 sleep_ms(60);
184
185 lcd_write_reg(9, 0xA55);
186 lcd_write_reg(10, 0x111F);
187 sleep_ms(10);
188
189 pcf50606_write_reg(0x35, 0xe9); /* PWMC1 - backlight power (intensity) */
190 pcf50606_write_reg(0x38, 0x3); /* GPOC1 - ? */
191
192 /* tell that we're on now */
193 display_on = true;
194}
195
196static void lcd_display_off(void)
197{
198 /* block drawing operations and changing of first */
199 display_on = false;
200
201 /* LQV shutdown sequence */
202 lcd_write_reg(9, 0x55);
203 lcd_write_reg(10, 0x1417);
204 lcd_write_reg(5, 0x4003);
205 sleep_ms(10);
206
207 lcd_write_reg(9, 0x0);
208 sleep_ms(10);
209
210 /* kill power to LCD panel (unconfirmed) */
211 GPIOA_CLEAR = (1<<16);
212
213 /* also kill the backlight, otherwise LCD fade is visible on screen */
214 GPIOA_CLEAR = (1<<6);
215}
216
217
218void lcd_enable(bool on)
219{
220 if (on == display_on)
221 return;
222
223 if (on)
224 {
225 lcd_display_on(); /* Turn on display */
226 lcd_update(); /* Resync display */
227 }
228 else
229 {
230 lcd_display_off(); /* Turn off display */
231 }
232}
233
234bool lcd_enabled(void)
235{
236 return display_on;
237}
238
239
240void lcd_init_device(void)
241{
242 BCLKCTR |= 4; /* enable LCD bus clock */
243
244 /* set PCK_LCD to 108Mhz */
245 PCLK_LCD &= ~PCK_EN;
246 PCLK_LCD = PCK_EN | (CKSEL_PLL1<<24) | 1; /* source = PLL1, divided by 2 */
247
248 /* reset the LCD controller */
249 SWRESET |= 4;
250 SWRESET &= ~4;
251
252 /* set port configuration */
253 PORTCFG1 &= ~0xC0000000;
254 PORTCFG1 &= ~0x3FC0;
255 PORTCFG2 &= ~0x100;
256
257 /* set physical display size */
258 LCDC_DS = (LCD_HEIGHT<<16) | LCD_WIDTH;
259
260 LCDC_HTIME1 = (0x2d<<16) | 0x3bf;
261 LCDC_HTIME2 = (1<<16) | 1;
262 LCDC_VTIME1 = LCDC_VTIME3 = (0<<16) | 239;
263 LCDC_VTIME2 = LCDC_VTIME4 = (1<<16) | 3;
264
265 LCDC_I1BASE = (unsigned int)lcd_framebuffer; /* dirty, dirty hack */
266 LCDC_I1SIZE = (LCD_HEIGHT<<16) | LCD_WIDTH; /* image 1 size */
267 //LCDC_I1POS = (0<<16) | 0; /* position */
268 //LCDC_I1OFF = 0; /* address offset */
269 //LCDC_I1SCALE = 0; /* scaling */
270 LCDC_I1CTRL = 5; /* 565bpp (7 = 888bpp) */
271 //LCDC_CTRL &= ~(1<<28);
272
273 LCDC_CLKDIV = (LCDC_CLKDIV &~ 0xFF00FF) | (1<<16) | 2; /* and this means? */
274
275 /* set and clear various flags - not investigated yet */
276 //LCDC_CTRL &~ 0x090006AA; /* clear bits 1,3,5,7,9,10,24,27 */
277 LCDC_CTRL |= 0x02800144; /* set bits 2,6,8,25,23 */
278 LCDC_CTRL = (LCDC_CTRL &~ 0xF0000) | 0x20000;
279 //LCDC_CTRL = (LCDC_CTRL &~ 0x700000) | 0x700000;
280
281 /* enable LCD controller */
282 LCDC_CTRL |= 1;
283}
284
285
286/*** Update functions ***/
287
288
289/* Update the display.
290 This must be called after all other LCD functions that change the display. */
291void lcd_update(void) ICODE_ATTR;
292void lcd_update(void)
293{
294 #warning function not implemented
295 /* currently lcd_framebuffer is accessed directly by the hardware */
296}
297
298/* Update a fraction of the display. */
299void lcd_update_rect(int, int, int, int) ICODE_ATTR;
300void lcd_update_rect(int x, int y, int width, int height)
301{
302 #warning function not implemented
303 (void)x;
304 (void)y;
305 (void)width;
306 (void)height;
307}
308
309void lcd_set_flip(bool yesno)
310{
311 #warning function not implemented
312 (void)yesno;
313}
314
315void lcd_set_invert_display(bool yesno)
316{
317 #warning function not implemented
318 (void)yesno;
319}
320
321void lcd_blit(const fb_data* data, int bx, int y, int bwidth,
322 int height, int stride)
323{
324 #warning function not implemented
325 (void)data;
326 (void)bx;
327 (void)y;
328 (void)bwidth;
329 (void)height;
330 (void)stride;
331}
332
333void lcd_yuv_blit(unsigned char * const src[3],
334 int src_x, int src_y, int stride,
335 int x, int y, int width, int height)
336{
337 #warning function not implemented
338 (void)src;
339 (void)src_x;
340 (void)src_y;
341 (void)stride;
342 (void)x;
343 (void)y;
344 (void)width;
345 (void)height;
346}
diff --git a/firmware/target/arm/tcc780x/cowond2/pcm-cowond2.c b/firmware/target/arm/tcc780x/cowond2/pcm-cowond2.c
new file mode 100644
index 0000000000..2d50f042d9
--- /dev/null
+++ b/firmware/target/arm/tcc780x/cowond2/pcm-cowond2.c
@@ -0,0 +1,86 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Karl Kurbjun
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#include "system.h"
20#include "kernel.h"
21#include "logf.h"
22#include "audio.h"
23#include "sound.h"
24#include "file.h"
25
26void pcm_postinit(void)
27{
28 #warning function not implemented
29}
30
31const void * pcm_play_dma_get_peak_buffer(int *count)
32{
33 #warning function not implemented
34 (void) count;
35 return 0;
36}
37
38void pcm_play_dma_init(void)
39{
40 #warning function not implemented
41}
42
43void pcm_apply_settings(void)
44{
45 #warning function not implemented
46}
47
48void pcm_set_frequency(unsigned int frequency)
49{
50 #warning function not implemented
51 (void) frequency;
52}
53
54void pcm_play_dma_start(const void *addr, size_t size)
55{
56 #warning function not implemented
57 (void) addr;
58 (void) size;
59}
60
61void pcm_play_dma_stop(void)
62{
63 #warning function not implemented
64}
65
66void pcm_play_lock(void)
67{
68 #warning function not implemented
69}
70
71void pcm_play_unlock(void)
72{
73 #warning function not implemented
74}
75
76void pcm_play_dma_pause(bool pause)
77{
78 #warning function not implemented
79 (void) pause;
80}
81
82size_t pcm_get_bytes_waiting(void)
83{
84 #warning function not implemented
85 return 0;
86}
diff --git a/firmware/target/arm/tcc780x/cowond2/power-cowond2.c b/firmware/target/arm/tcc780x/cowond2/power-cowond2.c
new file mode 100644
index 0000000000..d8a58570e4
--- /dev/null
+++ b/firmware/target/arm/tcc780x/cowond2/power-cowond2.c
@@ -0,0 +1,71 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 Dave Chapman
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#include "config.h"
20#include "cpu.h"
21#include <stdbool.h>
22#include "kernel.h"
23#include "system.h"
24#include "power.h"
25
26#ifndef SIMULATOR
27
28void power_init(void)
29{
30 #warning function not implemented
31}
32
33void ide_power_enable(bool on)
34{
35 #warning function not implemented
36 (void)on;
37}
38
39bool ide_powered(void)
40{
41 #warning function not implemented
42 return true;
43}
44
45void power_off(void)
46{
47 #warning function not implemented
48}
49
50#else /* SIMULATOR */
51
52bool charger_inserted(void)
53{
54 return false;
55}
56
57void charger_enable(bool on)
58{
59 (void)on;
60}
61
62void power_off(void)
63{
64}
65
66void ide_power_enable(bool on)
67{
68 (void)on;
69}
70
71#endif /* SIMULATOR */
diff --git a/firmware/target/arm/tcc780x/cowond2/powermgmt-cowond2.c b/firmware/target/arm/tcc780x/cowond2/powermgmt-cowond2.c
new file mode 100644
index 0000000000..b3572307e9
--- /dev/null
+++ b/firmware/target/arm/tcc780x/cowond2/powermgmt-cowond2.c
@@ -0,0 +1,59 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Karl Kurbjun
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include "config.h"
21#include "adc.h"
22#include "powermgmt.h"
23#include "kernel.h"
24
25unsigned short current_voltage = 3910;
26const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
27{
28 0
29};
30
31const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
32{
33 0
34};
35
36/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
37const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
38{
39 { 100, 300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1320 },
40};
41
42/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
43const unsigned short percent_to_volt_charge[11] =
44{
45 100, 300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1320,
46};
47
48void read_battery_inputs(void)
49{
50 #warning function not implemented
51}
52
53/* Returns battery voltage from ADC [millivolts] */
54unsigned int battery_adc_voltage(void)
55{
56 #warning function not implemented
57 return 0;
58}
59
diff --git a/firmware/target/arm/tcc780x/cowond2/usb-cowond2.c b/firmware/target/arm/tcc780x/cowond2/usb-cowond2.c
new file mode 100644
index 0000000000..6ec903b917
--- /dev/null
+++ b/firmware/target/arm/tcc780x/cowond2/usb-cowond2.c
@@ -0,0 +1,49 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Rob Purchase
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include "config.h"
21#include "cpu.h"
22#include "system.h"
23#include "kernel.h"
24#include "ata.h"
25
26/* USB detect is GPIOC 26 active low */
27inline bool usb_detect(void)
28{
29 return (GPIOC & 1<<26)?false:true;
30}
31
32void usb_init_device(void)
33{
34 #warning function not implemented
35}
36
37void usb_enable(bool on)
38{
39 #warning function not implemented
40
41 if (on)
42 {
43
44 }
45 else
46 {
47
48 }
49}