summaryrefslogtreecommitdiff
path: root/firmware/export/hotswap.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export/hotswap.h')
-rw-r--r--firmware/export/hotswap.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/firmware/export/hotswap.h b/firmware/export/hotswap.h
new file mode 100644
index 0000000000..c6a657d731
--- /dev/null
+++ b/firmware/export/hotswap.h
@@ -0,0 +1,59 @@
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#ifndef __HOTSWAP_H__
20#define __HOTSWAP_H__
21
22typedef struct
23{
24 bool initialized;
25 unsigned char bitrate_register;
26 unsigned long read_timeout; /* n * 8 clock cycles */
27 unsigned long write_timeout; /* n * 8 clock cycles */
28
29 unsigned long ocr; /* OCR register */
30 unsigned long csd[4]; /* CSD register, 16 bytes */
31 unsigned long cid[4]; /* CID register, 16 bytes */
32 unsigned long speed; /* bit/s */
33 unsigned int nsac; /* clock cycles */
34 unsigned long tsac; /* n * 0.1 ns */
35 unsigned int r2w_factor;
36 unsigned long size; /* size in bytes */
37 unsigned long numblocks; /* size in flash blocks */
38 unsigned int blocksize; /* block size in bytes */
39 unsigned int block_exp; /* block size exponent */
40} tCardInfo;
41
42#ifdef TARGET_TREE
43bool card_detect(void);
44tCardInfo *card_get_info(int card_no);
45#else /* HAVE_MMC */
46#include "ata_mmc.h"
47#define card_detect mmc_detect
48#define card_get_info mmc_card_info
49#define card_touched mmc_touched
50#define card_enable_monitoring mmc_enable_monitoring
51#endif
52
53/* helper function to extract n (<=32) bits from an arbitrary position.
54 counting from MSB to LSB */
55unsigned long card_extract_bits(
56 const unsigned long *p, /* the start of the bitfield array */
57 unsigned int start, /* bit no. to start reading */
58 unsigned int size); /* how many bits to read */
59#endif