diff options
Diffstat (limited to 'firmware/target/arm/tms320dm320/creative-zvm')
15 files changed, 1474 insertions, 0 deletions
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/adc-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/adc-creativezvm.c new file mode 100644 index 0000000000..d634a71f70 --- /dev/null +++ b/firmware/target/arm/tms320dm320/creative-zvm/adc-creativezvm.c | |||
@@ -0,0 +1,32 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: adc-mr500.c 14817 2007-09-22 15:43:38Z kkurbjun $ | ||
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 "cpu.h" | ||
21 | #include "adc-target.h" | ||
22 | #include "kernel.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 | return (short)channel; | ||
32 | } | ||
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/adc-target.h b/firmware/target/arm/tms320dm320/creative-zvm/adc-target.h new file mode 100644 index 0000000000..aa0f7eb364 --- /dev/null +++ b/firmware/target/arm/tms320dm320/creative-zvm/adc-target.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: adc-target.h 14817 2007-09-22 15:43:38Z kkurbjun $ | ||
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 | #ifndef _ADC_TARGET_H_ | ||
21 | #define _ADC_TARGET_H_ | ||
22 | |||
23 | /* only two channels used by the Gigabeat */ | ||
24 | #define NUM_ADC_CHANNELS 2 | ||
25 | |||
26 | #define ADC_BATTERY 0 | ||
27 | #define ADC_HPREMOTE 1 | ||
28 | #define ADC_UNKNOWN_3 2 | ||
29 | #define ADC_UNKNOWN_4 3 | ||
30 | #define ADC_UNKNOWN_5 4 | ||
31 | #define ADC_UNKNOWN_6 5 | ||
32 | #define ADC_UNKNOWN_7 6 | ||
33 | #define ADC_UNKNOWN_8 7 | ||
34 | |||
35 | #define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */ | ||
36 | #define ADC_READ_ERROR 0xFFFF | ||
37 | |||
38 | #endif | ||
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c new file mode 100644 index 0000000000..5cbcd72415 --- /dev/null +++ b/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c | |||
@@ -0,0 +1,101 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Maurus Cuelenaere | ||
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 "kernel.h" | ||
23 | #include "thread.h" | ||
24 | #include "system.h" | ||
25 | #include "power.h" | ||
26 | #include "panic.h" | ||
27 | #include "ata-target.h" | ||
28 | |||
29 | void ide_power_enable(bool on){ | ||
30 | #if 0 | ||
31 | IO_INTC_EINT1 &= ~INTR_EINT1_EXT2; | ||
32 | if(on) | ||
33 | { | ||
34 | IO_GIO_BITSET0 = (1 << 14); | ||
35 | ata_reset(); | ||
36 | } | ||
37 | else | ||
38 | IO_GIO_BITCLR0 = (1 << 14); | ||
39 | IO_INTC_EINT1 |= INTR_EINT1_EXT2; | ||
40 | return; | ||
41 | #endif | ||
42 | } | ||
43 | |||
44 | inline bool ide_powered(){ | ||
45 | #if 0 | ||
46 | return (IO_GIO_BITSET0 & (1 << 14)); | ||
47 | #else | ||
48 | return true; | ||
49 | #endif | ||
50 | } | ||
51 | |||
52 | void ata_reset(void) | ||
53 | { | ||
54 | /* Disabled until figured out what's wrong */ | ||
55 | IO_INTC_EINT1 &= ~INTR_EINT1_EXT2; //disable GIO2 interrupt | ||
56 | if(!ide_powered()) | ||
57 | { | ||
58 | ide_power_enable(true); | ||
59 | sleep(150); | ||
60 | } | ||
61 | else | ||
62 | { | ||
63 | IO_GIO_BITSET0 = (1 << 5); | ||
64 | IO_GIO_BITCLR0 = (1 << 3); | ||
65 | sleep(1); | ||
66 | } | ||
67 | IO_GIO_BITCLR0 = (1 << 5); | ||
68 | sleep(10); | ||
69 | IO_GIO_BITSET0 = (1 << 3); | ||
70 | while(!(ATA_COMMAND & STATUS_RDY)) | ||
71 | sleep(10); | ||
72 | IO_INTC_EINT1 |= INTR_EINT1_EXT2; //enable GIO2 interrupt | ||
73 | return; | ||
74 | } | ||
75 | |||
76 | void ata_enable(bool on) | ||
77 | { | ||
78 | (void)on; | ||
79 | return; | ||
80 | } | ||
81 | |||
82 | bool ata_is_coldstart(void) | ||
83 | { | ||
84 | return true; | ||
85 | } | ||
86 | |||
87 | void ata_device_init(void) | ||
88 | { | ||
89 | IO_INTC_EINT1 |= INTR_EINT1_EXT2; //enable GIO2 interrupt | ||
90 | //TODO: mimic OF inits... | ||
91 | return; | ||
92 | } | ||
93 | |||
94 | void GIO2(void) | ||
95 | { | ||
96 | #ifdef DEBUG | ||
97 | //printf("GIO2 interrupt..."); | ||
98 | #endif | ||
99 | IO_INTC_IRQ1 = INTR_IRQ1_EXT2; //Mask GIO2 interrupt | ||
100 | return; | ||
101 | } | ||
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/ata-target.h b/firmware/target/arm/tms320dm320/creative-zvm/ata-target.h new file mode 100644 index 0000000000..b098396d5e --- /dev/null +++ b/firmware/target/arm/tms320dm320/creative-zvm/ata-target.h | |||
@@ -0,0 +1,68 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Maurus Cuelenaere | ||
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 ATA_TARGET_H | ||
21 | #define ATA_TARGET_H | ||
22 | |||
23 | /* Plain C read & write loops */ | ||
24 | #define PREFER_C_READING | ||
25 | #define PREFER_C_WRITING | ||
26 | |||
27 | #define ATA_IOBASE 0x50FEE000 | ||
28 | #define ATA_DATA (*((volatile unsigned short*)(ATA_IOBASE))) | ||
29 | #define ATA_ERROR (*((volatile unsigned char*)(ATA_IOBASE+0x2))) | ||
30 | #define ATA_NSECTOR (*((volatile unsigned char*)(ATA_IOBASE+0x4))) | ||
31 | #define ATA_SECTOR (*((volatile unsigned char*)(ATA_IOBASE+0x6))) | ||
32 | #define ATA_LCYL (*((volatile unsigned char*)(ATA_IOBASE+0x8))) | ||
33 | #define ATA_HCYL (*((volatile unsigned char*)(ATA_IOBASE+0xA))) | ||
34 | #define ATA_SELECT (*((volatile unsigned char*)(ATA_IOBASE+0xC))) | ||
35 | #define ATA_COMMAND (*((volatile unsigned char*)(ATA_IOBASE+0xE))) | ||
36 | #define ATA_CONTROL (*((volatile unsigned char*)(ATA_IOBASE+0x800C))) | ||
37 | |||
38 | #define STATUS_BSY 0x80 | ||
39 | #define STATUS_RDY 0x40 | ||
40 | #define STATUS_DF 0x20 | ||
41 | #define STATUS_DRQ 0x08 | ||
42 | #define STATUS_ERR 0x01 | ||
43 | #define ERROR_ABRT 0x04 | ||
44 | |||
45 | #define WRITE_PATTERN1 0xa5 | ||
46 | #define WRITE_PATTERN2 0x5a | ||
47 | #define WRITE_PATTERN3 0xaa | ||
48 | #define WRITE_PATTERN4 0x55 | ||
49 | |||
50 | #define READ_PATTERN1 0xa5 | ||
51 | #define READ_PATTERN2 0x5a | ||
52 | #define READ_PATTERN3 0xaa | ||
53 | #define READ_PATTERN4 0x55 | ||
54 | |||
55 | #define READ_PATTERN1_MASK 0xff | ||
56 | #define READ_PATTERN2_MASK 0xff | ||
57 | #define READ_PATTERN3_MASK 0xff | ||
58 | #define READ_PATTERN4_MASK 0xff | ||
59 | |||
60 | #define SET_REG(reg,val) reg = (val) | ||
61 | #define SET_16BITREG(reg,val) reg = (val) | ||
62 | |||
63 | void ata_reset(void); | ||
64 | void ata_device_init(void); | ||
65 | bool ata_is_coldstart(void); | ||
66 | void ide_power_enable(bool on); | ||
67 | |||
68 | #endif | ||
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/audio-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/audio-creativezvm.c new file mode 100644 index 0000000000..1e5676b19e --- /dev/null +++ b/firmware/target/arm/tms320dm320/creative-zvm/audio-creativezvm.c | |||
@@ -0,0 +1,44 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: audio-c200_e200.c 14624 2007-09-06 03:01:41Z lowlight $ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Michael Sevakis | ||
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 "cpu.h" | ||
20 | #include "kernel.h" | ||
21 | #include "sound.h" | ||
22 | |||
23 | const struct sound_settings_info audiohw_settings[] = { | ||
24 | [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25}, | ||
25 | [SOUND_BASS] = {"dB", 1, 15, -60, 90, 0}, | ||
26 | [SOUND_TREBLE] = {"dB", 1, 15, -60, 90, 0}, | ||
27 | [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, | ||
28 | [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, | ||
29 | [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, | ||
30 | }; | ||
31 | |||
32 | |||
33 | void audiohw_init(void) | ||
34 | { | ||
35 | } | ||
36 | |||
37 | void audiohw_close(void) | ||
38 | { | ||
39 | } | ||
40 | |||
41 | void audiohw_mute(bool mute) | ||
42 | { | ||
43 | (void) mute; | ||
44 | } | ||
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/backlight-target.h b/firmware/target/arm/tms320dm320/creative-zvm/backlight-target.h new file mode 100644 index 0000000000..446c5640aa --- /dev/null +++ b/firmware/target/arm/tms320dm320/creative-zvm/backlight-target.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: backlight-target.h 15599 2007-11-12 18:49:53Z amiconn $ | ||
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 | #ifndef BACKLIGHT_TARGET_H | ||
21 | #define BACKLIGHT_TARGET_H | ||
22 | |||
23 | bool _backlight_init(void); | ||
24 | void _backlight_on(void); | ||
25 | void _backlight_off(void); | ||
26 | void _backlight_set_brightness(int brightness); | ||
27 | |||
28 | /* true: backlight fades off - false: backlight fades on */ | ||
29 | void __backlight_dim(bool dim); | ||
30 | |||
31 | #endif | ||
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/button-target.h b/firmware/target/arm/tms320dm320/creative-zvm/button-target.h new file mode 100644 index 0000000000..1b63895374 --- /dev/null +++ b/firmware/target/arm/tms320dm320/creative-zvm/button-target.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Maurus Cuelenaere | ||
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 "config.h" | ||
24 | |||
25 | #define BUTTON_BACK (1 << 0) | ||
26 | #define BUTTON_CUSTOM (1 << 1) | ||
27 | #define BUTTON_MENU (1 << 2) | ||
28 | |||
29 | #define BUTTON_LEFT (1 << 3) | ||
30 | #define BUTTON_RIGHT (1 << 4) | ||
31 | #define BUTTON_UP (1 << 5) | ||
32 | #define BUTTON_DOWN (1 << 6) | ||
33 | #define BUTTON_SELECT (1 << 7) | ||
34 | |||
35 | #define BUTTON_POWER (1 << 8) | ||
36 | #define BUTTON_PLAY (1 << 9) | ||
37 | |||
38 | #define BUTTON_HOLD (1 << 10) | ||
39 | |||
40 | #define BUTTON_REMOTE 0 | ||
41 | |||
42 | #define BUTTON_MAIN ( BUTTON_BACK | BUTTON_MENU | BUTTON_LEFT | BUTTON_RIGHT \ | ||
43 | | BUTTON_UP | BUTTON_DOWN | BUTTON_SELECT | BUTTON_POWER \ | ||
44 | | BUTTON_PLAY | BUTTON_HOLD | BUTTON_CUSTOM ) | ||
45 | |||
46 | #define POWEROFF_BUTTON BUTTON_POWER | ||
47 | #define POWEROFF_COUNT 10 | ||
48 | |||
49 | void button_init_device(void); | ||
50 | int button_read_device(void); | ||
51 | bool headphones_inserted(void); | ||
52 | bool button_hold(void); | ||
53 | bool button_usb_connected(void); | ||
54 | |||
55 | int get_debug_info(int choice); | ||
56 | |||
57 | #endif /* _BUTTON_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c new file mode 100644 index 0000000000..dec20ad72f --- /dev/null +++ b/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c | |||
@@ -0,0 +1,405 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Maurus Cuelenaere | ||
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 "memory.h" | ||
26 | #include "cpu.h" | ||
27 | #include "spi.h" | ||
28 | #include "spi-target.h" | ||
29 | #include "lcd-target.h" | ||
30 | |||
31 | /* Power and display status */ | ||
32 | static bool display_on = true; /* Is the display turned on? */ | ||
33 | static bool direct_fb_access = false; /* Does the DM320 has direct access to the FB? */ | ||
34 | |||
35 | int lcd_default_contrast(void) | ||
36 | { | ||
37 | return 0x1f; | ||
38 | } | ||
39 | |||
40 | void lcd_set_contrast(int val) | ||
41 | { | ||
42 | /* iirc there is an ltv250qv command to do this */ | ||
43 | #warning function not implemented | ||
44 | (void)val; | ||
45 | } | ||
46 | |||
47 | void lcd_set_invert_display(bool yesno) { | ||
48 | (void) yesno; | ||
49 | // TODO: | ||
50 | } | ||
51 | |||
52 | void lcd_set_flip(bool yesno) { | ||
53 | (void) yesno; | ||
54 | // TODO: | ||
55 | } | ||
56 | |||
57 | |||
58 | /* LTV250QV panel functions */ | ||
59 | |||
60 | static void lcd_write_reg(unsigned char reg, unsigned short val) | ||
61 | { | ||
62 | unsigned char block[3]; | ||
63 | block[0] = 0x74; | ||
64 | block[1] = 0; | ||
65 | block[2] = reg | 0xFF; | ||
66 | spi_block_transfer(SPI_target_LTV250QV, block, sizeof(block), NULL, 0); | ||
67 | block[0] = 0x76; | ||
68 | block[1] = (val >> 8) & 0xFF; | ||
69 | block[2] = val & 0xFF; | ||
70 | spi_block_transfer(SPI_target_LTV250QV, block, sizeof(block), NULL, 0); | ||
71 | } | ||
72 | |||
73 | static void sleep_ms(unsigned int ms) | ||
74 | { | ||
75 | sleep(ms*HZ/1000); | ||
76 | } | ||
77 | |||
78 | static void lcd_display_on(void) | ||
79 | { | ||
80 | /* Enable main power */ | ||
81 | IO_GIO_BITSET2 |= (1 << 3); | ||
82 | |||
83 | /* power on sequence as per the ZVM firmware */ | ||
84 | sleep_ms(250); | ||
85 | IO_GIO_BITSET1 = (1 << 13); | ||
86 | sleep_ms(5); | ||
87 | IO_GIO_BITSET2 = (1 << 5); | ||
88 | IO_GIO_BITSET2 = (1 << 8); | ||
89 | sleep_ms(1); | ||
90 | |||
91 | //Init SPI here... | ||
92 | sleep_ms(32); | ||
93 | |||
94 | IO_GIO_BITSET2 = (1 << 0); | ||
95 | sleep_ms(5); | ||
96 | IO_GIO_BITSET2 = (1 << 7); | ||
97 | sleep_ms(5); | ||
98 | IO_GIO_BITSET2 = (1 << 4); | ||
99 | sleep_ms(5); | ||
100 | IO_GIO_BITCLR2 = (1 << 8); | ||
101 | //TODO: figure out what OF does after this... | ||
102 | IO_GIO_BITSET2 = (1 << 8); | ||
103 | sleep_ms(1); | ||
104 | |||
105 | lcd_write_reg(1, 0x1D); | ||
106 | lcd_write_reg(2, 0x0); | ||
107 | lcd_write_reg(3, 0x0); | ||
108 | lcd_write_reg(4, 0x0); | ||
109 | lcd_write_reg(5, 0x40A3); | ||
110 | lcd_write_reg(6, 0x0); | ||
111 | lcd_write_reg(7, 0x0); | ||
112 | lcd_write_reg(8, 0x0); | ||
113 | lcd_write_reg(9, 0x0); | ||
114 | lcd_write_reg(10, 0x0); | ||
115 | lcd_write_reg(16, 0x0); | ||
116 | lcd_write_reg(17, 0x0); | ||
117 | lcd_write_reg(18, 0x0); | ||
118 | lcd_write_reg(19, 0x0); | ||
119 | lcd_write_reg(20, 0x0); | ||
120 | lcd_write_reg(21, 0x0); | ||
121 | lcd_write_reg(22, 0x0); | ||
122 | lcd_write_reg(23, 0x0); | ||
123 | lcd_write_reg(24, 0x0); | ||
124 | lcd_write_reg(25, 0x0); | ||
125 | sleep_ms(10); | ||
126 | |||
127 | lcd_write_reg(9, 0x4055); | ||
128 | lcd_write_reg(10, 0x0); | ||
129 | sleep_ms(40); | ||
130 | |||
131 | lcd_write_reg(10, 0x2000); | ||
132 | sleep_ms(40); | ||
133 | |||
134 | lcd_write_reg(1, 0x401D); | ||
135 | lcd_write_reg(2, 0x204); | ||
136 | lcd_write_reg(3, 0x100); | ||
137 | lcd_write_reg(4, 0x1000); | ||
138 | lcd_write_reg(5, 0x5033); | ||
139 | lcd_write_reg(6, 0x5); | ||
140 | lcd_write_reg(7, 0x1B); | ||
141 | lcd_write_reg(8, 0x800); | ||
142 | lcd_write_reg(16, 0x203); | ||
143 | lcd_write_reg(17, 0x302); | ||
144 | lcd_write_reg(18, 0xC08); | ||
145 | lcd_write_reg(19, 0xC08); | ||
146 | lcd_write_reg(20, 0x707); | ||
147 | lcd_write_reg(21, 0x707); | ||
148 | lcd_write_reg(22, 0x104); | ||
149 | lcd_write_reg(23, 0x306); | ||
150 | lcd_write_reg(24, 0x0); | ||
151 | lcd_write_reg(25, 0x0); | ||
152 | sleep_ms(60); | ||
153 | |||
154 | lcd_write_reg(9, 0xA55); | ||
155 | lcd_write_reg(10, 0x111A); | ||
156 | sleep_ms(10); | ||
157 | |||
158 | //TODO: other stuff! | ||
159 | |||
160 | /* tell that we're on now */ | ||
161 | display_on = true; | ||
162 | } | ||
163 | |||
164 | static void lcd_display_off(void) | ||
165 | { | ||
166 | display_on = false; | ||
167 | |||
168 | /* LQV shutdown sequence */ | ||
169 | lcd_write_reg(9, 0x855); | ||
170 | sleep_ms(20); | ||
171 | |||
172 | lcd_write_reg(9, 0x55); | ||
173 | lcd_write_reg(5, 0x4033); | ||
174 | lcd_write_reg(10, 0x0); | ||
175 | sleep_ms(20); | ||
176 | |||
177 | lcd_write_reg(9, 0x0); | ||
178 | sleep_ms(10); | ||
179 | unsigned char temp[1]; | ||
180 | temp[0] = 0; | ||
181 | spi_block_transfer(SPI_target_LTV250QV, temp, sizeof(temp), NULL, 0); | ||
182 | |||
183 | IO_GIO_BITCLR2 = (1 << 4); | ||
184 | sleep_ms(5); | ||
185 | IO_GIO_BITCLR2 = (1 << 7); | ||
186 | sleep_ms(5); | ||
187 | IO_GIO_BITCLR2 = (1 << 0); | ||
188 | sleep_ms(2); | ||
189 | IO_GIO_BITCLR2 = (1 << 8); | ||
190 | IO_GIO_BITCLR2 = (1 << 5); | ||
191 | |||
192 | /* Disable main power */ | ||
193 | IO_GIO_BITCLR2 |= (1 << 3); | ||
194 | } | ||
195 | |||
196 | |||
197 | |||
198 | void lcd_enable(bool on) | ||
199 | { | ||
200 | if (on == display_on) | ||
201 | return; | ||
202 | |||
203 | if (on) | ||
204 | { | ||
205 | display_on = true; //TODO: remove me! | ||
206 | //lcd_display_on(); /* Turn on display */ | ||
207 | lcd_update(); /* Resync display */ | ||
208 | } | ||
209 | else | ||
210 | { | ||
211 | display_on = false; //TODO: remove me! | ||
212 | //lcd_display_off(); /* Turn off display */ | ||
213 | } | ||
214 | } | ||
215 | |||
216 | bool lcd_enabled(void) | ||
217 | { | ||
218 | return display_on; | ||
219 | } | ||
220 | |||
221 | void lcd_set_direct_fb(bool yes) | ||
222 | { | ||
223 | unsigned int addr; | ||
224 | direct_fb_access = yes; | ||
225 | if(yes) | ||
226 | addr = ((unsigned int)&lcd_framebuffer-CONFIG_SDRAM_START) / 32; | ||
227 | else | ||
228 | addr = ((unsigned int)FRAME-CONFIG_SDRAM_START) / 32; | ||
229 | IO_OSD_OSDWINADH = addr >> 16; | ||
230 | IO_OSD_OSDWIN0ADL = addr & 0xFFFF; | ||
231 | } | ||
232 | |||
233 | bool lcd_get_direct_fb(void) | ||
234 | { | ||
235 | return direct_fb_access; | ||
236 | } | ||
237 | |||
238 | void lcd_init_device(void) | ||
239 | { | ||
240 | /* Based on lcd-mr500.c from Catalin Patulea */ | ||
241 | unsigned int addr; | ||
242 | |||
243 | /* Clear the Frame */ | ||
244 | memset16(FRAME, 0x0000, LCD_WIDTH*LCD_HEIGHT); | ||
245 | |||
246 | IO_OSD_MODE = 0x00ff; | ||
247 | IO_OSD_VIDWINMD = 0x0002; | ||
248 | IO_OSD_OSDWINMD0 = 0x2001; | ||
249 | IO_OSD_OSDWINMD1 = 0x0002; | ||
250 | IO_OSD_ATRMD = 0x0000; | ||
251 | IO_OSD_RECTCUR = 0x0000; | ||
252 | |||
253 | IO_OSD_OSDWIN0OFST = (LCD_WIDTH*16) / 256; | ||
254 | addr = ((unsigned int)FRAME-CONFIG_SDRAM_START) / 32; | ||
255 | IO_OSD_OSDWINADH = addr >> 16; | ||
256 | IO_OSD_OSDWIN0ADL = addr & 0xFFFF; | ||
257 | |||
258 | #ifndef ZEN_VISION | ||
259 | IO_OSD_BASEPX=26; | ||
260 | IO_OSD_BASEPY=5; | ||
261 | #else | ||
262 | IO_OSD_BASEPX=80; | ||
263 | IO_OSD_BASEPY=0; | ||
264 | #endif | ||
265 | |||
266 | IO_OSD_OSDWIN0XP = 0; | ||
267 | IO_OSD_OSDWIN0YP = 0; | ||
268 | IO_OSD_OSDWIN0XL = LCD_WIDTH; | ||
269 | IO_OSD_OSDWIN0YL = LCD_HEIGHT; | ||
270 | #if 0 | ||
271 | //TODO: set LCD clock! | ||
272 | IO_CLK_MOD1 &= ~0x18; // disable OSD clock and VENC clock | ||
273 | IO_CLK_02DIV = 3; | ||
274 | IO_CLK_OSEL = (IO_CLK_OSEL & ~0xF00) | 0x400; // reset 'General purpose clock output (GIO26, GIO34)' and set to 'PLLIN clock' | ||
275 | IO_CLK_SEL1 = (IO_CLK_SEL1 | 7) | 0x1000; // set to 'GP clock output 2 (GIO26, GIO34)' and turn on 'VENC clock' | ||
276 | IO_CLK_MOD1 |= 0x18; // enable OSD clock and VENC clock | ||
277 | |||
278 | /* Set LCD values in OSD */ | ||
279 | IO_VID_ENC_VMOD = ( ( (IO_VID_ENC_VMOD & 0xFFFF8C00) | 0x14) | 0x2400 ); // disable NTSC/PAL encoder & set mode to RGB666 parallel 18 bit | ||
280 | IO_VID_ENC_VDCTL = ( ( (IO_VID_ENC_VDCTL & 0xFFFFCFE8) | 0x20) | 0x4000 ); | ||
281 | //TODO: finish this... | ||
282 | #endif | ||
283 | } | ||
284 | |||
285 | |||
286 | /*** Update functions ***/ | ||
287 | |||
288 | |||
289 | |||
290 | /* Update a fraction of the display. */ | ||
291 | void lcd_update_rect(int x, int y, int width, int height) | ||
292 | { | ||
293 | register fb_data *dst, *src; | ||
294 | |||
295 | if (!display_on || direct_fb_access) | ||
296 | return; | ||
297 | |||
298 | if (x + width > LCD_WIDTH) | ||
299 | width = LCD_WIDTH - x; /* Clip right */ | ||
300 | if (x < 0) | ||
301 | width += x, x = 0; /* Clip left */ | ||
302 | if (width <= 0) | ||
303 | return; /* nothing left to do */ | ||
304 | |||
305 | if (y + height > LCD_HEIGHT) | ||
306 | height = LCD_HEIGHT - y; /* Clip bottom */ | ||
307 | if (y < 0) | ||
308 | height += y, y = 0; /* Clip top */ | ||
309 | if (height <= 0) | ||
310 | return; /* nothing left to do */ | ||
311 | |||
312 | #if CONFIG_ORIENTATION == SCREEN_PORTAIT | ||
313 | dst = (fb_data *)FRAME + LCD_WIDTH*y + x; | ||
314 | src = &lcd_framebuffer[y][x]; | ||
315 | |||
316 | /* Copy part of the Rockbox framebuffer to the second framebuffer */ | ||
317 | if (width < LCD_WIDTH) | ||
318 | { | ||
319 | /* Not full width - do line-by-line */ | ||
320 | lcd_copy_buffer_rect(dst, src, width, height); | ||
321 | } | ||
322 | else | ||
323 | { | ||
324 | /* Full width - copy as one line */ | ||
325 | lcd_copy_buffer_rect(dst, src, LCD_WIDTH*height, 1); | ||
326 | } | ||
327 | #else | ||
328 | src = &lcd_framebuffer[y][x]; | ||
329 | |||
330 | register int xc, yc; | ||
331 | register fb_data *start=FRAME + LCD_HEIGHT*(LCD_WIDTH-x-1) + y + 1; | ||
332 | |||
333 | for(yc=0;yc<height;yc++) | ||
334 | { | ||
335 | dst=start+yc; | ||
336 | for(xc=0; xc<width; xc++) | ||
337 | { | ||
338 | *dst=*src++; | ||
339 | dst-=LCD_HEIGHT; | ||
340 | } | ||
341 | src+=x; | ||
342 | } | ||
343 | #endif | ||
344 | } | ||
345 | |||
346 | /* Update the display. | ||
347 | This must be called after all other LCD functions that change the display. */ | ||
348 | void lcd_update(void) | ||
349 | { | ||
350 | if (!display_on || direct_fb_access) | ||
351 | return; | ||
352 | #if CONFIG_ORIENTATION == SCREEN_PORTAIT | ||
353 | lcd_copy_buffer_rect((fb_data *)FRAME, &lcd_framebuffer[0][0], | ||
354 | LCD_WIDTH*LCD_HEIGHT, 1); | ||
355 | #else | ||
356 | lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); | ||
357 | #endif | ||
358 | } | ||
359 | |||
360 | /* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ | ||
361 | extern void lcd_write_yuv420_lines(fb_data *dst, | ||
362 | unsigned char chroma_buf[LCD_HEIGHT/2*3], | ||
363 | unsigned char const * const src[3], | ||
364 | int width, | ||
365 | int stride); | ||
366 | /* Performance function to blit a YUV bitmap directly to the LCD */ | ||
367 | /* For the Gigabeat - show it rotated */ | ||
368 | /* So the LCD_WIDTH is now the height */ | ||
369 | void lcd_blit_yuv(unsigned char * const src[3], | ||
370 | int src_x, int src_y, int stride, | ||
371 | int x, int y, int width, int height) | ||
372 | { | ||
373 | /* Caches for chroma data so it only need be recalculated every other | ||
374 | line */ | ||
375 | unsigned char chroma_buf[LCD_HEIGHT/2*3]; /* 480 bytes */ | ||
376 | unsigned char const * yuv_src[3]; | ||
377 | off_t z; | ||
378 | |||
379 | if (!display_on || direct_fb_access) | ||
380 | return; | ||
381 | |||
382 | /* Sorry, but width and height must be >= 2 or else */ | ||
383 | width &= ~1; | ||
384 | height >>= 1; | ||
385 | |||
386 | fb_data *dst = (fb_data*)FRAME + x * LCD_WIDTH + (LCD_WIDTH - y) - 1; | ||
387 | |||
388 | z = stride*src_y; | ||
389 | yuv_src[0] = src[0] + z + src_x; | ||
390 | yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); | ||
391 | yuv_src[2] = src[2] + (yuv_src[1] - src[1]); | ||
392 | |||
393 | do | ||
394 | { | ||
395 | lcd_write_yuv420_lines(dst, chroma_buf, yuv_src, width, | ||
396 | stride); | ||
397 | |||
398 | yuv_src[0] += stride << 1; /* Skip down two luma lines */ | ||
399 | yuv_src[1] += stride >> 1; /* Skip down one chroma line */ | ||
400 | yuv_src[2] += stride >> 1; | ||
401 | dst -= 2; | ||
402 | } | ||
403 | while (--height > 0); | ||
404 | } | ||
405 | |||
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/lcd-target.h b/firmware/target/arm/tms320dm320/creative-zvm/lcd-target.h new file mode 100644 index 0000000000..da63187637 --- /dev/null +++ b/firmware/target/arm/tms320dm320/creative-zvm/lcd-target.h | |||
@@ -0,0 +1,28 @@ | |||
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 | #ifndef _LCD_TARGET_H_ | ||
21 | #define _LCD_TARGET_H_ | ||
22 | |||
23 | extern void lcd_enable(bool state); | ||
24 | |||
25 | void lcd_set_direct_fb(bool yes); | ||
26 | bool lcd_get_direct_fb(void); | ||
27 | |||
28 | #endif | ||
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/pcm-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/pcm-creativezvm.c new file mode 100644 index 0000000000..6501125f9e --- /dev/null +++ b/firmware/target/arm/tms320dm320/creative-zvm/pcm-creativezvm.c | |||
@@ -0,0 +1,81 @@ | |||
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 | |||
26 | void pcm_postinit(void) | ||
27 | { | ||
28 | |||
29 | } | ||
30 | |||
31 | const void * pcm_play_dma_get_peak_buffer(int *count) | ||
32 | { | ||
33 | (void) count; | ||
34 | return 0; | ||
35 | } | ||
36 | |||
37 | void pcm_play_dma_init(void) | ||
38 | { | ||
39 | |||
40 | } | ||
41 | |||
42 | void pcm_apply_settings(void) | ||
43 | { | ||
44 | |||
45 | } | ||
46 | |||
47 | void pcm_set_frequency(unsigned int frequency) | ||
48 | { | ||
49 | (void) frequency; | ||
50 | } | ||
51 | |||
52 | void pcm_play_dma_start(const void *addr, size_t size) | ||
53 | { | ||
54 | (void) addr; | ||
55 | (void) size; | ||
56 | } | ||
57 | |||
58 | void pcm_play_dma_stop(void) | ||
59 | { | ||
60 | |||
61 | } | ||
62 | |||
63 | void pcm_play_lock(void) | ||
64 | { | ||
65 | |||
66 | } | ||
67 | |||
68 | void pcm_play_unlock(void) | ||
69 | { | ||
70 | |||
71 | } | ||
72 | |||
73 | void pcm_play_dma_pause(bool pause) | ||
74 | { | ||
75 | (void) pause; | ||
76 | } | ||
77 | |||
78 | size_t pcm_get_bytes_waiting(void) | ||
79 | { | ||
80 | return 0; | ||
81 | } | ||
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c new file mode 100644 index 0000000000..35e6bd31fb --- /dev/null +++ b/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c | |||
@@ -0,0 +1,323 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Maurus Cuelenaere | ||
11 | * | ||
12 | * Creative Zen Vision:M interrupt based PIC driver | ||
13 | * | ||
14 | * All files in this archive are subject to the GNU General Public License. | ||
15 | * See the file COPYING in the source tree root for full license agreement. | ||
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 "kernel.h" | ||
25 | #include "button-target.h" | ||
26 | #include "i2c-dm320.h" | ||
27 | |||
28 | |||
29 | #include "lcd-target.h" | ||
30 | #include "lcd.h" | ||
31 | #include "sprintf.h" | ||
32 | #include "font.h" | ||
33 | |||
34 | #ifndef ZEN_VISION | ||
35 | /* Creative Zen Vision:M */ | ||
36 | #define BTN_LEFT 0x5F00 | ||
37 | #define BTN_RIGHT 0x4F00 | ||
38 | #define BTN_BACK 0xBF00 | ||
39 | #define BTN_CUSTOM 0x8F00 | ||
40 | #define BTN_PLAY 0x2F00 | ||
41 | #define BTN_POWER 0x0F00 | ||
42 | #define BTN_MENU 0x9F00 | ||
43 | #define BTN_HOLD 0x9F06 | ||
44 | #define BTN_UNHOLD 0xAF06 | ||
45 | |||
46 | #define BTN_REL 1 | ||
47 | |||
48 | #define BTN_TOUCHPAD_PRESS 0x1F00 | ||
49 | #define BTN_TOUCHPAD_CORNER_DOWN 0xAF00 | ||
50 | #define BTN_TOUCHPAD_CORNER_UP 0x3F00 | ||
51 | |||
52 | #define HEADPHONE_PLUGIN_A 0x5707 | ||
53 | #define HEADPHONE_PLUGIN_B 0x5F07 | ||
54 | #define HEADPHONE_UNPLUG_A 0x3707 | ||
55 | #define HEADPHONE_UNPLUG_B 0x3F07 | ||
56 | |||
57 | #define DOCK_INSERT 0x6707 | ||
58 | #define DOCK_UNPLUG 0xDF06 | ||
59 | #define DOCK_USB_INSERT 0x2F06 | ||
60 | #define DOCK_USB_UNPLUG 0x3F06 | ||
61 | #define DOCK_POWER_INSERT 0x2707 | ||
62 | #define DOCK_POWER_UNPLUG 0x2F07 | ||
63 | |||
64 | #else | ||
65 | /* Creative Zen Vision */ | ||
66 | #define BTN_LEFT 0xCF00 | ||
67 | #define BTN_RIGHT 0xEF00 | ||
68 | #define BTN_BACK 0xBF00 | ||
69 | #define BTN_CUSTOM 0x0 | ||
70 | #define BTN_PLAY 0x2F00 | ||
71 | #define BTN_POWER 0x0F00 | ||
72 | #define BTN_MENU 0x9F00 | ||
73 | #define BTN_HOLD 0x9F06 | ||
74 | #define BTN_UNHOLD 0xAF06 | ||
75 | /* TODO: other values | ||
76 | First number is just pressing it, second is when you release it or keep it pressed a bit longer | ||
77 | On/Off = 0F00 && 0F01 | ||
78 | Hold = 9F06 && AF06 | ||
79 | Volume Up = 6F00 && 6F01 | ||
80 | Vol Down = 7F00 && 7F01 | ||
81 | Up = DF00 && DF01 | ||
82 | Right = EF00 && EF01 | ||
83 | Down = FF00 && FF01 | ||
84 | Left = CF00 && CF01 | ||
85 | Back = BF00 && BF01 | ||
86 | Menu = 9F00 && Etcetera | ||
87 | Ok = 1F00 | ||
88 | Play = 2F00 | ||
89 | Next = 4F00 | ||
90 | Prev = 5F00 | ||
91 | |||
92 | USB = 2F06 | ||
93 | USB ouot = 3F06 | ||
94 | Headphones= AF06 | ||
95 | Hdphns out= BF06 | ||
96 | Charger = 4F06 -> 9F05 | ||
97 | Chgrout = 5F06 -> 8F05 | ||
98 | AV in = 8F06 | ||
99 | AV out = 9F06 */ | ||
100 | |||
101 | #define BTN_REL 1 | ||
102 | |||
103 | #define BTN_TOUCHPAD_PRESS 0x8F00 | ||
104 | #define BTN_TOUCHPAD_LONG_PRESS 0x0F00 | ||
105 | #define BTN_TOUCHPAD_CORNER_DOWN 0xD700 | ||
106 | #define BTN_TOUCHPAD_CORNER_LONG_DOWN 0x5700 | ||
107 | #define BTN_TOUCHPAD_CORNER_UP 0x9F00 | ||
108 | #define BTN_TOUCHPAD_CORNER_LONG_UP 0x1F00 | ||
109 | |||
110 | #define HEADPHONE_PLUGIN_A 0xAF06 | ||
111 | #define HEADPHONE_PLUGIN_B 0xAF06 | ||
112 | #define HEADPHONE_UNPLUG_A 0xBF06 | ||
113 | #define HEADPHONE_UNPLUG_B 0xBF06 | ||
114 | |||
115 | #define DOCK_INSERT 0x0 | ||
116 | #define DOCK_UNPLUG 0x0 | ||
117 | #define DOCK_USB_INSERT 0x2F06 | ||
118 | #define DOCK_USB_UNPLUG_A 0x3F06 | ||
119 | #define DOCK_USB_UNPLUG_B 0x3F06 | ||
120 | #define DOCK_POWER_INSERT 0x4F06 | ||
121 | #define DOCK_POWER_UNPLUG 0x5F06 | ||
122 | #define DOCK_AV_INSERT 0x8F06 | ||
123 | #define DOCK_AV_UNPLUG 0x9F06 | ||
124 | #endif | ||
125 | |||
126 | #define PIC_ADR 0x07 | ||
127 | |||
128 | #define MASK_TV_OUT(x) ((x >> 14) & 1) | ||
129 | #define MASK_xx1(x) ((x >> 9) & 3) | ||
130 | #define MASK_xx2(x) ((x >> 4) & 1) | ||
131 | #define MASK_xx3(x) ((x >> 5) & 1) | ||
132 | #define MASK_xx4(x) ((x >> 6) & 1) | ||
133 | #define MASK_xx5(x) ((x >> 13) & 1) | ||
134 | #define MASK_xx6(x) ((x >> 12) & 1) | ||
135 | #define MASK_xx7(x) ((x >> 11) & 1) | ||
136 | |||
137 | #define NONBUTTON_HEADPHONE (1 << 0) | ||
138 | #define NONBUTTON_DOCK (1 << 1) | ||
139 | #define NONBUTTON_USB (1 << 2) | ||
140 | #define NONBUTTON_POWER (1 << 3) | ||
141 | #define NONBUTTON_VIDEOUT (1 << 4) | ||
142 | |||
143 | static unsigned int btn; | ||
144 | static bool hold_switch; | ||
145 | static unsigned char nonbtn; | ||
146 | static unsigned int pic_init_value; | ||
147 | static unsigned int pic_init2_value; | ||
148 | static unsigned int last_btn; | ||
149 | static long last_tick; | ||
150 | static int tick_diff; | ||
151 | |||
152 | #define TICK_MIN 0x33 | ||
153 | #define TICK_MAX 0x34 | ||
154 | |||
155 | /* Taken from scramble.c and modified */ | ||
156 | static inline unsigned short le2short(unsigned char* buf) | ||
157 | { | ||
158 | return (unsigned short)((buf[1] << 8) | buf[0]); | ||
159 | } | ||
160 | |||
161 | #define map_button(BtN,BtN2) case BtN: \ | ||
162 | btn ^= BtN2; \ | ||
163 | btn &= BtN2; \ | ||
164 | break; \ | ||
165 | case BtN ^ BTN_REL: \ | ||
166 | btn ^= BtN2; \ | ||
167 | btn &= BtN2; \ | ||
168 | break; | ||
169 | |||
170 | #ifdef BUTTON_DEBUG | ||
171 | static bool sw = false; | ||
172 | #endif | ||
173 | |||
174 | void GIO0(void) | ||
175 | { | ||
176 | unsigned char msg[4]; | ||
177 | i2c_read(PIC_ADR, msg, sizeof(msg)); | ||
178 | tick_diff = current_tick - last_tick; | ||
179 | last_tick = current_tick; | ||
180 | unsigned short btn_press = le2short(msg); | ||
181 | if(tick_diff >= TICK_MIN && tick_diff <= TICK_MAX) | ||
182 | { | ||
183 | /* Ignore this, as it is a hold event */ | ||
184 | IO_INTC_IRQ1 = INTR_IRQ1_EXT0; | ||
185 | return; | ||
186 | } | ||
187 | last_btn = btn_press; | ||
188 | switch(btn_press) | ||
189 | { | ||
190 | map_button(BTN_LEFT, BUTTON_LEFT); | ||
191 | map_button(BTN_RIGHT, BUTTON_RIGHT); | ||
192 | map_button(BTN_BACK, BUTTON_BACK); | ||
193 | map_button(BTN_CUSTOM, BUTTON_CUSTOM); | ||
194 | map_button(BTN_MENU, BUTTON_MENU); | ||
195 | map_button(BTN_PLAY, BUTTON_PLAY); | ||
196 | map_button(BTN_POWER, BUTTON_POWER); | ||
197 | map_button(BTN_TOUCHPAD_PRESS, BUTTON_SELECT); | ||
198 | map_button(BTN_TOUCHPAD_CORNER_DOWN, BUTTON_DOWN); | ||
199 | map_button(BTN_TOUCHPAD_CORNER_UP, BUTTON_UP); | ||
200 | case BTN_HOLD: | ||
201 | hold_switch = true; | ||
202 | break; | ||
203 | case BTN_UNHOLD: | ||
204 | hold_switch = false; | ||
205 | break; | ||
206 | case HEADPHONE_PLUGIN_A: | ||
207 | case HEADPHONE_PLUGIN_B: | ||
208 | nonbtn |= NONBUTTON_HEADPHONE; | ||
209 | break; | ||
210 | case HEADPHONE_UNPLUG_A: | ||
211 | case HEADPHONE_UNPLUG_B: | ||
212 | nonbtn &= ~NONBUTTON_HEADPHONE; | ||
213 | break; | ||
214 | case DOCK_INSERT: | ||
215 | nonbtn |= NONBUTTON_DOCK; | ||
216 | break; | ||
217 | case DOCK_UNPLUG: | ||
218 | nonbtn &= ~(NONBUTTON_DOCK | NONBUTTON_USB | NONBUTTON_POWER); | ||
219 | break; | ||
220 | case DOCK_USB_INSERT: | ||
221 | nonbtn |= NONBUTTON_USB; | ||
222 | break; | ||
223 | case DOCK_USB_UNPLUG: | ||
224 | nonbtn &= ~NONBUTTON_USB; | ||
225 | break; | ||
226 | case DOCK_POWER_INSERT: | ||
227 | nonbtn |= NONBUTTON_POWER; | ||
228 | break; | ||
229 | case DOCK_POWER_UNPLUG: | ||
230 | nonbtn &= ~NONBUTTON_POWER; | ||
231 | break; | ||
232 | } | ||
233 | #ifdef BUTTON_DEBUG | ||
234 | unsigned char weergvn[10]; | ||
235 | #ifdef BOOTLOADER | ||
236 | lcd_set_foreground((sw ? LCD_RGBPACK(255,0,0) : LCD_RGBPACK(0,255,0) )); | ||
237 | #endif | ||
238 | snprintf(weergvn, sizeof(char)*10, "%x", (unsigned int)((msg[3] << 24) | (msg[2] << 16) | (msg[1] << 8) | msg[0])); | ||
239 | lcd_putsxy(LCD_WIDTH-SYSFONT_WIDTH*10, LCD_HEIGHT-SYSFONT_HEIGHT*10, weergvn); | ||
240 | snprintf(weergvn, sizeof(char)*10, "%x", btn); | ||
241 | lcd_putsxy(LCD_WIDTH-SYSFONT_WIDTH*10, LCD_HEIGHT-SYSFONT_HEIGHT*7, weergvn); | ||
242 | #ifdef BOOTLOADER | ||
243 | lcd_set_foreground(LCD_BLACK); | ||
244 | #endif | ||
245 | lcd_update(); | ||
246 | sw = !sw; | ||
247 | #endif | ||
248 | /* Mask GIO0 interrupt */ | ||
249 | IO_INTC_IRQ1 = INTR_IRQ1_EXT0; | ||
250 | } | ||
251 | |||
252 | void send_command_to_pic(unsigned char in, unsigned char* out, unsigned int length) | ||
253 | { | ||
254 | /* Disable GIO0 interrupt */ | ||
255 | IO_INTC_EINT1 &= ~INTR_EINT1_EXT0; | ||
256 | /* Clear EXT0 interrupt */ | ||
257 | IO_INTC_IRQ1 = INTR_IRQ1_EXT0; | ||
258 | /* Write command to I²C */ | ||
259 | restart: | ||
260 | i2c_write(PIC_ADR, &in, 1); | ||
261 | /* Wait for PIC */ | ||
262 | int i = 0; | ||
263 | while(!(IO_INTC_IRQ1 & INTR_IRQ1_EXT0)) | ||
264 | { | ||
265 | sleep(0); | ||
266 | i++; | ||
267 | if(i > 50) | ||
268 | goto restart; | ||
269 | } | ||
270 | /* Read return from I²C */ | ||
271 | i2c_read(PIC_ADR, out, length); | ||
272 | /* Re-enable GIO0 interrupt */ | ||
273 | IO_INTC_EINT1 |= INTR_EINT1_EXT0; | ||
274 | } | ||
275 | |||
276 | bool headphones_inserted(void) | ||
277 | { | ||
278 | return (bool)(nonbtn & NONBUTTON_HEADPHONE); | ||
279 | } | ||
280 | |||
281 | void button_init_device(void) | ||
282 | { | ||
283 | /* TODO: I suppose GIO0 has to be set to input and enable interrupts on it? */ | ||
284 | /* Enable GIO0 interrupt */ | ||
285 | IO_INTC_EINT1 |= INTR_EINT1_EXT0; | ||
286 | btn = nonbtn = pic_init_value = pic_init2_value = last_btn = hold_switch = 0; | ||
287 | /* Initialize PIC */ | ||
288 | send_command_to_pic(1, &pic_init_value, sizeof(pic_init_value)); | ||
289 | send_command_to_pic(2, &pic_init2_value, sizeof(pic_init2_value)); | ||
290 | } | ||
291 | |||
292 | int get_debug_info(int choice) | ||
293 | { | ||
294 | switch(choice) | ||
295 | { | ||
296 | case 1: | ||
297 | return pic_init_value; | ||
298 | case 2: | ||
299 | return pic_init2_value; | ||
300 | case 3: | ||
301 | return last_btn; | ||
302 | case 4: | ||
303 | return nonbtn; | ||
304 | case 5: | ||
305 | return tick_diff; | ||
306 | } | ||
307 | return -1; | ||
308 | } | ||
309 | |||
310 | int button_read_device(void) | ||
311 | { | ||
312 | return btn; | ||
313 | } | ||
314 | |||
315 | bool button_hold(void) | ||
316 | { | ||
317 | return hold_switch; | ||
318 | } | ||
319 | |||
320 | bool button_usb_connected(void) | ||
321 | { | ||
322 | return (bool)(nonbtn & NONBUTTON_USB); | ||
323 | } | ||
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/power-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/power-creativezvm.c new file mode 100644 index 0000000000..5a72deced9 --- /dev/null +++ b/firmware/target/arm/tms320dm320/creative-zvm/power-creativezvm.c | |||
@@ -0,0 +1,68 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: power-mr500.c 15599 2007-11-12 18:49:53Z amiconn $ | ||
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 "cpu.h" | ||
22 | #include <stdbool.h> | ||
23 | #include "kernel.h" | ||
24 | #include "system.h" | ||
25 | #include "power.h" | ||
26 | #include "backlight.h" | ||
27 | #include "backlight-target.h" | ||
28 | |||
29 | #ifndef SIMULATOR | ||
30 | |||
31 | void power_init(void) | ||
32 | { | ||
33 | /* Initialize IDE power pin */ | ||
34 | /* set ATA power on and output */ | ||
35 | /* Charger detect */ | ||
36 | } | ||
37 | |||
38 | bool charger_inserted(void) | ||
39 | { | ||
40 | return false; | ||
41 | } | ||
42 | |||
43 | /* Returns true if the unit is charging the batteries. */ | ||
44 | bool charging_state(void) { | ||
45 | return false; | ||
46 | } | ||
47 | |||
48 | void power_off(void) | ||
49 | { | ||
50 | } | ||
51 | |||
52 | #else /* SIMULATOR */ | ||
53 | |||
54 | bool charger_inserted(void) | ||
55 | { | ||
56 | return false; | ||
57 | } | ||
58 | |||
59 | void charger_enable(bool on) | ||
60 | { | ||
61 | (void)on; | ||
62 | } | ||
63 | |||
64 | void power_off(void) | ||
65 | { | ||
66 | } | ||
67 | |||
68 | #endif /* SIMULATOR */ | ||
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/powermgmt-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/powermgmt-creativezvm.c new file mode 100644 index 0000000000..6e8ea7cae5 --- /dev/null +++ b/firmware/target/arm/tms320dm320/creative-zvm/powermgmt-creativezvm.c | |||
@@ -0,0 +1,57 @@ | |||
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 | |||
25 | /* THIS CONTAINS CURRENTLY DUMMY CODE! */ | ||
26 | |||
27 | unsigned short current_voltage = 3910; | ||
28 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
29 | { | ||
30 | 0 | ||
31 | }; | ||
32 | |||
33 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
34 | { | ||
35 | 0 | ||
36 | }; | ||
37 | |||
38 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
39 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
40 | { | ||
41 | { 100, 300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1320 }, | ||
42 | }; | ||
43 | |||
44 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
45 | const unsigned short percent_to_volt_charge[11] = | ||
46 | { | ||
47 | 100, 300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1320, | ||
48 | }; | ||
49 | void read_battery_inputs(void) | ||
50 | { | ||
51 | } | ||
52 | |||
53 | /* Returns battery voltage from ADC [millivolts] */ | ||
54 | unsigned int battery_adc_voltage(void) | ||
55 | { | ||
56 | return current_voltage; | ||
57 | } | ||
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/usb-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/usb-creativezvm.c new file mode 100644 index 0000000000..6bbd08c135 --- /dev/null +++ b/firmware/target/arm/tms320dm320/creative-zvm/usb-creativezvm.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Maurus Cuelenaere | ||
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 "system.h" | ||
22 | #include "kernel.h" | ||
23 | #include "usb.h" | ||
24 | #include "usb-target.h" | ||
25 | #include "usb_drv.h" | ||
26 | #include "usb_core.h" | ||
27 | #include "isp1583.h" | ||
28 | |||
29 | #define printf | ||
30 | |||
31 | bool usb_drv_connected(void) | ||
32 | { | ||
33 | return button_usb_connected(); | ||
34 | } | ||
35 | |||
36 | int usb_detect(void) | ||
37 | { | ||
38 | if(button_usb_connected()) | ||
39 | return USB_INSERTED; | ||
40 | else | ||
41 | return USB_EXTRACTED; | ||
42 | } | ||
43 | |||
44 | void usb_init_device(void) | ||
45 | { | ||
46 | return; | ||
47 | } | ||
48 | |||
49 | void usb_enable(bool on) | ||
50 | { | ||
51 | if(on) | ||
52 | usb_core_init(); | ||
53 | else | ||
54 | usb_core_exit(); | ||
55 | } | ||
56 | |||
57 | void GIO7(void) | ||
58 | { | ||
59 | #ifdef DEBUG | ||
60 | //printf("GIO7 interrupt... [%d]", current_tick); | ||
61 | #endif | ||
62 | usb_drv_int(); | ||
63 | |||
64 | IO_INTC_IRQ1 = INTR_IRQ1_EXT7; | ||
65 | } | ||
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/usb-target.h b/firmware/target/arm/tms320dm320/creative-zvm/usb-target.h new file mode 100644 index 0000000000..4e3303911c --- /dev/null +++ b/firmware/target/arm/tms320dm320/creative-zvm/usb-target.h | |||
@@ -0,0 +1,76 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Maurus Cuelenaere | ||
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 USB_TARGET_H | ||
21 | #define USB_TARGET_H | ||
22 | |||
23 | #include "dm320.h" | ||
24 | |||
25 | #define ISP1583_IOBASE 0x60FFC000 | ||
26 | #define ISP1583_H_OVERRIDE | ||
27 | |||
28 | #define ISP1583_INIT_ADDRESS (*((volatile unsigned char*)(ISP1583_IOBASE+0x0))) //char | ||
29 | #define ISP1583_INIT_MODE (*((volatile unsigned short*)(ISP1583_IOBASE+0xC*2))) | ||
30 | #define ISP1583_INIT_INTCONF (*((volatile unsigned char*)(ISP1583_IOBASE+0x10*2))) //char | ||
31 | #define ISP1583_INIT_OTG (*((volatile unsigned char*)(ISP1583_IOBASE+0x12*2))) //char | ||
32 | #define ISP1583_INIT_INTEN_A (*((volatile unsigned short*)(ISP1583_IOBASE+0x14*2))) | ||
33 | #define ISP1583_INIT_INTEN_B (*((volatile unsigned short*)(ISP1583_IOBASE+0x14*2+4))) | ||
34 | #define ISP1583_INIT_INTEN_READ (unsigned long)( (ISP1583_INIT_INTEN_A & 0xFFFF) | ((ISP1583_INIT_INTEN_B & 0xFFFF) << 16) ) | ||
35 | /* Data flow registers */ | ||
36 | #define ISP1583_DFLOW_EPINDEX (*((volatile unsigned char*)(ISP1583_IOBASE+0xC2*2))) //char | ||
37 | #define ISP1583_DFLOW_CTRLFUN (*((volatile unsigned char*)(ISP1583_IOBASE+0x28*2))) //char | ||
38 | #define ISP1583_DFLOW_DATA (*((volatile unsigned short*)(ISP1583_IOBASE+0x20*2))) | ||
39 | #define ISP1583_DFLOW_BUFLEN (*((volatile unsigned short*)(ISP1583_IOBASE+0x1C*2))) | ||
40 | #define ISP1583_DFLOW_BUFSTAT (*((volatile unsigned char*)(ISP1583_IOBASE+0x1E*2))) //char | ||
41 | #define ISP1583_DFLOW_MAXPKSZ (*((volatile unsigned short*)(ISP1583_IOBASE+0x04*2))) | ||
42 | #define ISP1583_DFLOW_EPTYPE (*((volatile unsigned short*)(ISP1583_IOBASE+0x08*2))) | ||
43 | /* DMA registers */ | ||
44 | #define ISP1583_DMA_ENDPOINT (*((volatile unsigned char*)(ISP1583_IOBASE+0x58*2))) | ||
45 | /* General registers */ | ||
46 | #define ISP1583_GEN_INT_A (*((volatile unsigned short*)(ISP1583_IOBASE+0x18*2))) | ||
47 | #define ISP1583_GEN_INT_B (*((volatile unsigned short*)(ISP1583_IOBASE+0x18*2+4))) | ||
48 | #define ISP1583_GEN_INT_READ (unsigned long)( (ISP1583_GEN_INT_A & 0xFFFF) | ((ISP1583_GEN_INT_B & 0xFFFF) << 16)) | ||
49 | #define ISP1583_GEN_CHIPID_A (*((volatile unsigned short*)(ISP1583_IOBASE+0x70*2))) | ||
50 | #define ISP1583_GEN_CHIPID_B (*((volatile unsigned char*)(ISP1583_IOBASE+0x70*2+4))) //char | ||
51 | #define ISP1583_GEN_CHIPID (unsigned long)( (ISP1583_GEN_CHIPID_A & 0xFFFF) | ((ISP1583_GEN_CHIPID_B & 0xFFFF) << 16) ) | ||
52 | #define ISP1583_GEN_FRAMEN0 (*((volatile unsigned short*)(ISP1583_IOBASE+0x74*2))) | ||
53 | #define ISP1583_GEN_SCRATCH (*((volatile unsigned short*)(ISP1583_IOBASE+0x78*2))) | ||
54 | #define ISP1583_GEN_UNLCKDEV (*((volatile unsigned short*)(ISP1583_IOBASE+0x7C*2))) | ||
55 | #define ISP1583_GEN_TSTMOD (*((volatile unsigned char*)(ISP1583_IOBASE+0x84*2))) //char | ||
56 | |||
57 | #define EN_INT_CPU_TARGET IO_INTC_EINT1 |= INTR_EINT1_EXT7 | ||
58 | #define DIS_INT_CPU_TARGET IO_INTC_EINT1 &= ~INTR_EINT1_EXT7 | ||
59 | #define INT_CONF_TARGET 0 | ||
60 | //#define INT_CONF_TARGET 2 | ||
61 | #define set_int_value(a,b,value) a = value & 0xFFFF; \ | ||
62 | b = value >> 16; | ||
63 | |||
64 | |||
65 | #define ZVM_SPECIFIC asm volatile( \ | ||
66 | "LDR R12, =0x50FFC000\n" \ | ||
67 | "LDRH R12, [R12]\n" \ | ||
68 | : : : "r12") | ||
69 | //#define ZVM_SPECIFIC | ||
70 | |||
71 | #include "kernel.h" | ||
72 | int usb_detect(void); | ||
73 | void usb_init_device(void); | ||
74 | bool usb_drv_connected(void); | ||
75 | |||
76 | #endif | ||