diff options
Diffstat (limited to 'firmware/target/arm/as3525/sansa-m200v4')
6 files changed, 278 insertions, 0 deletions
diff --git a/firmware/target/arm/as3525/sansa-m200v4/adc-target.h b/firmware/target/arm/as3525/sansa-m200v4/adc-target.h new file mode 100644 index 0000000000..bea0272496 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-m200v4/adc-target.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 ?? | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef _ADC_TARGET_H_ | ||
22 | #define _ADC_TARGET_H_ | ||
23 | |||
24 | #endif /* _ADC_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/as3525/sansa-m200v4/backlight-target.h b/firmware/target/arm/as3525/sansa-m200v4/backlight-target.h new file mode 100644 index 0000000000..50404f7090 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-m200v4/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 ?? | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef BACKLIGHT_TARGET_H | ||
22 | #define BACKLIGHT_TARGET_H | ||
23 | |||
24 | static inline bool _backlight_init(void) | ||
25 | { | ||
26 | GPIOD_DIR |= (1<<1); | ||
27 | return true; | ||
28 | } | ||
29 | |||
30 | static inline void _backlight_on(void) | ||
31 | { | ||
32 | GPIOD_PIN(1) = (1<<1); | ||
33 | } | ||
34 | |||
35 | static inline void _backlight_off(void) | ||
36 | { | ||
37 | GPIOD_PIN(1) = 0x00; | ||
38 | } | ||
39 | |||
40 | #endif | ||
diff --git a/firmware/target/arm/as3525/sansa-m200v4/button-m200v4.c b/firmware/target/arm/as3525/sansa-m200v4/button-m200v4.c new file mode 100644 index 0000000000..c5d6c4941d --- /dev/null +++ b/firmware/target/arm/as3525/sansa-m200v4/button-m200v4.c | |||
@@ -0,0 +1,93 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by ?? | ||
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 "cpu.h" | ||
24 | #include "button.h" | ||
25 | #include "adc.h" | ||
26 | |||
27 | void button_init_device(void) | ||
28 | { | ||
29 | GPIOA_DIR &= ~((1<<3) | (1<<2) | (1<<1) | (1<<0)); /* A3-A0 is input */ | ||
30 | GPIOA_DIR |= ((1<<6) | (1<<5) | (1<<4)); /* A4-A6 row outputs */ | ||
31 | } | ||
32 | |||
33 | int button_read_device(void) | ||
34 | { | ||
35 | int result = BUTTON_NONE; | ||
36 | |||
37 | /* direct GPIO connections */ | ||
38 | if (GPIOA_PIN(3)) | ||
39 | result |= BUTTON_MENU; | ||
40 | |||
41 | /* This is a keypad using A4-A6 as columns and A0-A2 as rows */ | ||
42 | GPIOA_PIN(4) = (1<<4); | ||
43 | |||
44 | /* A4A0 is unused */ | ||
45 | |||
46 | if (GPIOA_PIN(1)) | ||
47 | result |= BUTTON_VOLDOWN; | ||
48 | |||
49 | if (GPIOA_PIN(2)) | ||
50 | result |= BUTTON_PLAYPAUSE; | ||
51 | |||
52 | GPIOA_PIN(4) = 0x00; | ||
53 | |||
54 | GPIOA_PIN(5) = (1<<5); | ||
55 | |||
56 | if (GPIOA_PIN(0)) | ||
57 | result |= BUTTON_LEFT; | ||
58 | |||
59 | if (GPIOA_PIN(1)) | ||
60 | result |= BUTTON_SELECT; | ||
61 | |||
62 | if (GPIOA_PIN(2)) | ||
63 | result |= BUTTON_RIGHT; | ||
64 | |||
65 | GPIOA_PIN(5) = 0x00; | ||
66 | |||
67 | |||
68 | GPIOA_PIN(6) = (1<<6); | ||
69 | |||
70 | if (GPIOA_PIN(0)) | ||
71 | result |= BUTTON_REPEATAB; | ||
72 | |||
73 | if (GPIOA_PIN(1)) | ||
74 | result |= BUTTON_VOLUP; | ||
75 | |||
76 | if (GPIOA_PIN(2)) | ||
77 | result |= BUTTON_HOLD; | ||
78 | GPIOA_PIN(6) = 0x00; | ||
79 | |||
80 | return result; | ||
81 | } | ||
82 | |||
83 | bool button_hold(void) | ||
84 | { | ||
85 | bool ret = false; | ||
86 | |||
87 | GPIOA_PIN(6) = (1<<6); | ||
88 | if (GPIOA_PIN(2)) | ||
89 | ret = true; | ||
90 | GPIOA_PIN(6) = 0x00; | ||
91 | |||
92 | return ret; | ||
93 | } | ||
diff --git a/firmware/target/arm/as3525/sansa-m200v4/button-target.h b/firmware/target/arm/as3525/sansa-m200v4/button-target.h new file mode 100644 index 0000000000..779f7400bb --- /dev/null +++ b/firmware/target/arm/as3525/sansa-m200v4/button-target.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Dave Chapman | ||
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 | int button_read_device(void); | ||
32 | bool button_hold(void); | ||
33 | |||
34 | /* Main unit's buttons */ | ||
35 | #define BUTTON_MENU 0x00000001 | ||
36 | #define BUTTON_VOLUP 0x00000002 | ||
37 | #define BUTTON_VOLDOWN 0x00000004 | ||
38 | #define BUTTON_PLAYPAUSE 0x00000008 | ||
39 | #define BUTTON_REPEATAB 0x00000010 | ||
40 | #define BUTTON_LEFT 0x00000020 | ||
41 | #define BUTTON_RIGHT 0x00000040 | ||
42 | #define BUTTON_SELECT 0x00000080 | ||
43 | #define BUTTON_HOLD 0x00000100 | ||
44 | |||
45 | #define BUTTON_MAIN (BUTTON_MENU|BUTTON_VOLUP|BUTTON_VOLDOWN\ | ||
46 | |BUTTON_PLAYPAUSE|BUTTON_REPEATAB|BUTTON_LEFT\ | ||
47 | |BUTTON_RIGHT|BUTTON_SELECT|BUTTON_HOLD) | ||
48 | |||
49 | #define BUTTON_REMOTE 0 | ||
50 | |||
51 | /* Software power-off */ | ||
52 | #define POWEROFF_BUTTON BUTTON_MENU | ||
53 | #define POWEROFF_COUNT 40 | ||
54 | |||
55 | #endif /* _BUTTON_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/as3525/sansa-m200v4/system-target.h b/firmware/target/arm/as3525/sansa-m200v4/system-target.h new file mode 100644 index 0000000000..b712d1c124 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-m200v4/system-target.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 ?? | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef SYSTEM_TARGET_H | ||
22 | #define SYSTEM_TARGET_H | ||
23 | |||
24 | #include "system-arm.h" | ||
25 | |||
26 | #define CPUFREQ_MAX 250000000 | ||
27 | |||
28 | #endif /* SYSTEM_TARGET_H */ | ||
diff --git a/firmware/target/arm/as3525/sansa-m200v4/timer-target.h b/firmware/target/arm/as3525/sansa-m200v4/timer-target.h new file mode 100644 index 0000000000..b81da57885 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-m200v4/timer-target.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 ?? | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef TIMER_TARGET_H | ||
22 | #define TIMER_TARGET_H | ||
23 | |||
24 | bool __timer_set(long cycles, bool set); | ||
25 | bool __timer_register(void); | ||
26 | void __timer_unregister(void); | ||
27 | |||
28 | #define __TIMER_SET(cycles, set) \ | ||
29 | __timer_set(cycles, set) | ||
30 | |||
31 | #define __TIMER_REGISTER(reg_prio, unregister_callback, cycles, \ | ||
32 | int_prio, timer_callback) \ | ||
33 | __timer_register() | ||
34 | |||
35 | #define __TIMER_UNREGISTER(...) \ | ||
36 | __timer_unregister() | ||
37 | |||
38 | #endif /* TIMER_TARGET_H */ | ||