diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2007-06-30 02:08:27 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2007-06-30 02:08:27 +0000 |
commit | 1167e3c72f5d0d581b81fd2cb8f2580a1524ca5a (patch) | |
tree | 501f9901636d5586271067d0c157204e500a2cfd /firmware/hotswap.c | |
parent | 189a5f812f47e43e5704a44c3abb85a4c37c8662 (diff) | |
download | rockbox-1167e3c72f5d0d581b81fd2cb8f2580a1524ca5a.tar.gz rockbox-1167e3c72f5d0d581b81fd2cb8f2580a1524ca5a.zip |
Accept FS#7134 - Sansa: external sd card support by Antonius Hellmann with some tweaks. All testers have given the green light. (Now for the RED ?? ;).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13741 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/hotswap.c')
-rw-r--r-- | firmware/hotswap.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/firmware/hotswap.c b/firmware/hotswap.c new file mode 100644 index 0000000000..5620edf10b --- /dev/null +++ b/firmware/hotswap.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2004 by Jens Arnold | ||
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 <stdbool.h> | ||
20 | #include "config.h" | ||
21 | #ifdef TARGET_TREE | ||
22 | #include "hotswap-target.h" | ||
23 | #else | ||
24 | #include "ata_mmc.h" | ||
25 | #endif | ||
26 | |||
27 | /* helper function to extract n (<=32) bits from an arbitrary position. | ||
28 | counting from MSB to LSB */ | ||
29 | unsigned long card_extract_bits( | ||
30 | const unsigned long *p, /* the start of the bitfield array */ | ||
31 | unsigned int start, /* bit no. to start reading */ | ||
32 | unsigned int size) /* how many bits to read */ | ||
33 | { | ||
34 | unsigned int long_index = start / 32; | ||
35 | unsigned int bit_index = start % 32; | ||
36 | unsigned long result; | ||
37 | |||
38 | result = p[long_index] << bit_index; | ||
39 | |||
40 | if (bit_index + size > 32) /* crossing longword boundary */ | ||
41 | result |= p[long_index+1] >> (32 - bit_index); | ||
42 | |||
43 | result >>= 32 - size; | ||
44 | |||
45 | return result; | ||
46 | } | ||
47 | |||
48 | #ifdef TARGET_TREE | ||
49 | bool card_detect(void) | ||
50 | { | ||
51 | return card_detect_target(); | ||
52 | } | ||
53 | |||
54 | tCardInfo *card_get_info(int card_no) | ||
55 | { | ||
56 | return card_get_info_target(card_no); | ||
57 | } | ||
58 | #endif | ||