diff options
author | Frank Gevaerts <frank@gevaerts.be> | 2010-06-05 21:12:16 +0000 |
---|---|---|
committer | Frank Gevaerts <frank@gevaerts.be> | 2010-06-05 21:12:16 +0000 |
commit | a0557b23f0c984576fd5a72657593211df148ca4 (patch) | |
tree | db0d1f7a3826bc6fb74965b100d25fb0870e553b /firmware/sdmmc.c | |
parent | 8bd527eaa00a9b256f2e371d79677445d34658fb (diff) | |
download | rockbox-a0557b23f0c984576fd5a72657593211df148ca4.tar.gz rockbox-a0557b23f0c984576fd5a72657593211df148ca4.zip |
remane hotswap.* to sdmmc.*. The contents have nothing at all to do with hotswapping things
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26598 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/sdmmc.c')
-rw-r--r-- | firmware/sdmmc.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/firmware/sdmmc.c b/firmware/sdmmc.c new file mode 100644 index 0000000000..f499ffae08 --- /dev/null +++ b/firmware/sdmmc.c | |||
@@ -0,0 +1,53 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2004 by Jens Arnold | ||
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 | #include <stdbool.h> | ||
22 | #include "config.h" | ||
23 | #if (CONFIG_STORAGE & STORAGE_MMC) | ||
24 | #include "ata_mmc.h" | ||
25 | #else | ||
26 | #include "sdmmc.h" | ||
27 | #endif | ||
28 | |||
29 | /* helper function to extract n (<=32) bits from an arbitrary position. | ||
30 | counting from MSB to LSB */ | ||
31 | unsigned long card_extract_bits( | ||
32 | const unsigned long *p, /* the start of the bitfield array */ | ||
33 | unsigned int start, /* bit no. to start reading */ | ||
34 | unsigned int size) /* how many bits to read */ | ||
35 | { | ||
36 | unsigned int long_index, bit_index; | ||
37 | unsigned long result; | ||
38 | |||
39 | /* we assume words of CSD/CID are stored most significant word first */ | ||
40 | start = 127 - start; | ||
41 | |||
42 | long_index = start / 32; | ||
43 | bit_index = start % 32; | ||
44 | |||
45 | result = p[long_index] << bit_index; | ||
46 | |||
47 | if (bit_index + size > 32) /* crossing longword boundary */ | ||
48 | result |= p[long_index+1] >> (32 - bit_index); | ||
49 | |||
50 | result >>= 32 - size; | ||
51 | |||
52 | return result; | ||
53 | } | ||