add link to homepage to about window.
[Rockbox.git] / firmware / hotswap.c
blob5620edf10bb86080fa59d5a5e9830a5bb7b6d72c
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2004 by Jens Arnold
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.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
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
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 */
34 unsigned int long_index = start / 32;
35 unsigned int bit_index = start % 32;
36 unsigned long result;
38 result = p[long_index] << bit_index;
40 if (bit_index + size > 32) /* crossing longword boundary */
41 result |= p[long_index+1] >> (32 - bit_index);
43 result >>= 32 - size;
45 return result;
48 #ifdef TARGET_TREE
49 bool card_detect(void)
51 return card_detect_target();
54 tCardInfo *card_get_info(int card_no)
56 return card_get_info_target(card_no);
58 #endif