diff options
Diffstat (limited to 'firmware/target/arm/sandisk/sansa-e200')
-rw-r--r-- | firmware/target/arm/sandisk/sansa-e200/ata-e200.c | 11 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-e200/audio-e200.c | 103 |
2 files changed, 109 insertions, 5 deletions
diff --git a/firmware/target/arm/sandisk/sansa-e200/ata-e200.c b/firmware/target/arm/sandisk/sansa-e200/ata-e200.c index 29fe0d9109..10c13cdb2e 100644 --- a/firmware/target/arm/sandisk/sansa-e200/ata-e200.c +++ b/firmware/target/arm/sandisk/sansa-e200/ata-e200.c | |||
@@ -223,6 +223,7 @@ void sd_wait_for_state(tSDCardInfo* card, unsigned int state) | |||
223 | while(((response >> 9) & 0xf) != state) | 223 | while(((response >> 9) & 0xf) != state) |
224 | { | 224 | { |
225 | sd_send_command(SEND_STATUS, (card->rca) << 16, 1); | 225 | sd_send_command(SEND_STATUS, (card->rca) << 16, 1); |
226 | priority_yield(); | ||
226 | sd_read_response(&response, 1); | 227 | sd_read_response(&response, 1); |
227 | /* TODO: Add a timeout and error handling */ | 228 | /* TODO: Add a timeout and error handling */ |
228 | } | 229 | } |
@@ -442,7 +443,7 @@ void sd_init_device(void) | |||
442 | dataptr += (FIFO_SIZE*2); /* Advance one chunk of 16 words */ | 443 | dataptr += (FIFO_SIZE*2); /* Advance one chunk of 16 words */ |
443 | } | 444 | } |
444 | } | 445 | } |
445 | mutex_init(&sd_mtx); | 446 | spinlock_init(&sd_mtx); |
446 | } | 447 | } |
447 | 448 | ||
448 | /* API Functions */ | 449 | /* API Functions */ |
@@ -472,7 +473,7 @@ int ata_read_sectors(IF_MV2(int drive,) | |||
472 | #ifdef HAVE_MULTIVOLUME | 473 | #ifdef HAVE_MULTIVOLUME |
473 | (void)drive; /* unused for now */ | 474 | (void)drive; /* unused for now */ |
474 | #endif | 475 | #endif |
475 | mutex_lock(&sd_mtx); | 476 | spinlock_lock(&sd_mtx); |
476 | 477 | ||
477 | last_disk_activity = current_tick; | 478 | last_disk_activity = current_tick; |
478 | spinup_start = current_tick; | 479 | spinup_start = current_tick; |
@@ -530,7 +531,7 @@ int ata_read_sectors(IF_MV2(int drive,) | |||
530 | ata_led(false); | 531 | ata_led(false); |
531 | ata_enable(false); | 532 | ata_enable(false); |
532 | 533 | ||
533 | mutex_unlock(&sd_mtx); | 534 | spinlock_unlock(&sd_mtx); |
534 | 535 | ||
535 | return ret; | 536 | return ret; |
536 | } | 537 | } |
@@ -551,7 +552,7 @@ int ata_write_sectors(IF_MV2(int drive,) | |||
551 | long timeout; | 552 | long timeout; |
552 | tSDCardInfo *card = &card_info[current_card]; | 553 | tSDCardInfo *card = &card_info[current_card]; |
553 | 554 | ||
554 | mutex_lock(&sd_mtx); | 555 | spinlock_lock(&sd_mtx); |
555 | ata_enable(true); | 556 | ata_enable(true); |
556 | ata_led(true); | 557 | ata_led(true); |
557 | if(current_card == 0) | 558 | if(current_card == 0) |
@@ -607,7 +608,7 @@ retry: | |||
607 | sd_wait_for_state(card, TRAN); | 608 | sd_wait_for_state(card, TRAN); |
608 | ata_led(false); | 609 | ata_led(false); |
609 | ata_enable(false); | 610 | ata_enable(false); |
610 | mutex_unlock(&sd_mtx); | 611 | spinlock_unlock(&sd_mtx); |
611 | 612 | ||
612 | return ret; | 613 | return ret; |
613 | } | 614 | } |
diff --git a/firmware/target/arm/sandisk/sansa-e200/audio-e200.c b/firmware/target/arm/sandisk/sansa-e200/audio-e200.c new file mode 100644 index 0000000000..a3f3284b98 --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-e200/audio-e200.c | |||
@@ -0,0 +1,103 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
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 "system.h" | ||
20 | #include "cpu.h" | ||
21 | #include "audio.h" | ||
22 | #include "sound.h" | ||
23 | |||
24 | int audio_channels = 2; | ||
25 | int audio_output_source = AUDIO_SRC_PLAYBACK; | ||
26 | |||
27 | void audio_set_output_source(int source) | ||
28 | { | ||
29 | int oldmode = set_fiq_status(FIQ_DISABLED); | ||
30 | |||
31 | if ((unsigned)source >= AUDIO_NUM_SOURCES) | ||
32 | source = AUDIO_SRC_PLAYBACK; | ||
33 | |||
34 | audio_output_source = source; | ||
35 | |||
36 | if (source != AUDIO_SRC_PLAYBACK) | ||
37 | IISCONFIG |= (1 << 29); | ||
38 | |||
39 | set_fiq_status(oldmode); | ||
40 | } /* audio_set_output_source */ | ||
41 | |||
42 | void audio_set_source(int source, unsigned flags) | ||
43 | { | ||
44 | static int last_source = AUDIO_SRC_PLAYBACK; | ||
45 | #if 0 | ||
46 | static bool last_recording = false; | ||
47 | bool recording = flags & SRCF_RECORDING; | ||
48 | #endif | ||
49 | (void)flags; | ||
50 | |||
51 | switch (source) | ||
52 | { | ||
53 | default: /* playback - no recording */ | ||
54 | source = AUDIO_SRC_PLAYBACK; | ||
55 | case AUDIO_SRC_PLAYBACK: | ||
56 | audio_channels = 2; | ||
57 | if (source != last_source) | ||
58 | { | ||
59 | audiohw_set_monitor(false); | ||
60 | audiohw_disable_recording(); | ||
61 | } | ||
62 | break; | ||
63 | |||
64 | case AUDIO_SRC_MIC: /* recording only */ | ||
65 | audio_channels = 1; | ||
66 | if (source != last_source) | ||
67 | { | ||
68 | audiohw_set_monitor(false); | ||
69 | audiohw_enable_recording(true); /* source mic */ | ||
70 | } | ||
71 | break; | ||
72 | |||
73 | #if 0 | ||
74 | case AUDIO_SRC_FMRADIO: /* recording and playback */ | ||
75 | audio_channels = 2; | ||
76 | |||
77 | if (!recording) | ||
78 | audiohw_set_recvol(23, 23, AUDIO_GAIN_LINEIN); | ||
79 | |||
80 | if (source == last_source && recording == last_recording) | ||
81 | break; | ||
82 | |||
83 | last_recording = recording; | ||
84 | |||
85 | if (recording) | ||
86 | { | ||
87 | audiohw_set_monitor(false); | ||
88 | audiohw_enable_recording(false); | ||
89 | } | ||
90 | else | ||
91 | { | ||
92 | audiohw_disable_recording(); | ||
93 | audiohw_set_monitor(true); /* line 1 analog audio path */ | ||
94 | } | ||
95 | |||
96 | break; | ||
97 | #endif | ||
98 | } /* end switch */ | ||
99 | |||
100 | last_source = source; | ||
101 | } /* audio_set_source */ | ||
102 | |||
103 | |||