2007-06-30 02:08:27 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 by Jens Arnold
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2007-06-30 02:08:27 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef __HOTSWAP_H__
|
|
|
|
#define __HOTSWAP_H__
|
|
|
|
|
2008-09-14 20:33:24 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2007-06-30 02:08:27 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2008-09-14 20:33:24 +00:00
|
|
|
bool initialized;
|
2007-06-30 02:08:27 +00:00
|
|
|
|
2009-07-01 10:07:22 +00:00
|
|
|
unsigned long read_timeout; /* n * 8 clock cycles */
|
|
|
|
unsigned long write_timeout; /* n * 8 clock cycles */
|
|
|
|
|
|
|
|
unsigned long ocr; /* OCR register */
|
|
|
|
unsigned long csd[4]; /* CSD register, 16 bytes */
|
|
|
|
unsigned long cid[4]; /* CID register, 16 bytes */
|
|
|
|
unsigned long speed; /* bit/s */
|
|
|
|
unsigned int nsac; /* clock cycles */
|
|
|
|
unsigned long taac; /* n * 0.1 ns */
|
2007-06-30 02:08:27 +00:00
|
|
|
unsigned int r2w_factor;
|
2009-07-01 10:07:22 +00:00
|
|
|
unsigned long numblocks; /* size in flash blocks */
|
|
|
|
unsigned int blocksize; /* block size in bytes */
|
|
|
|
|
|
|
|
#if (CONFIG_STORAGE & STORAGE_MMC)
|
|
|
|
unsigned char bitrate_register;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (CONFIG_STORAGE & STORAGE_SD)
|
|
|
|
unsigned long rca; /* RCA register */
|
|
|
|
unsigned int current_bank;
|
|
|
|
#endif
|
2007-06-30 02:08:27 +00:00
|
|
|
} tCardInfo;
|
|
|
|
|
2008-10-31 21:25:04 +00:00
|
|
|
#if (CONFIG_STORAGE & STORAGE_SD)
|
2009-07-01 10:07:22 +00:00
|
|
|
|
|
|
|
#include "sd.h"
|
2008-03-12 11:08:41 +00:00
|
|
|
#define card_detect card_detect_target
|
|
|
|
#define card_get_info card_get_info_target
|
2009-07-01 10:07:22 +00:00
|
|
|
tCardInfo *card_get_info_target(int card_no);
|
2009-07-01 21:49:13 +00:00
|
|
|
void sd_parse_csd(tCardInfo *card);
|
2009-07-01 10:07:22 +00:00
|
|
|
|
2008-05-13 02:50:31 +00:00
|
|
|
#ifdef HAVE_HOTSWAP
|
2008-03-12 11:08:41 +00:00
|
|
|
#define card_enable_monitoring card_enable_monitoring_target
|
2008-05-13 02:50:31 +00:00
|
|
|
#endif
|
2009-07-01 10:07:22 +00:00
|
|
|
|
2008-10-31 21:25:04 +00:00
|
|
|
#else /* STORAGE_MMC */
|
2009-07-01 10:07:22 +00:00
|
|
|
|
2007-06-30 02:08:27 +00:00
|
|
|
#include "ata_mmc.h"
|
|
|
|
#define card_detect mmc_detect
|
|
|
|
#define card_get_info mmc_card_info
|
2009-07-01 10:07:22 +00:00
|
|
|
tCardInfo *mmc_card_info(int card_no);
|
2007-06-30 02:08:27 +00:00
|
|
|
#define card_touched mmc_touched
|
|
|
|
#define card_enable_monitoring mmc_enable_monitoring
|
2009-07-01 10:07:22 +00:00
|
|
|
|
2007-06-30 02:08:27 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* helper function to extract n (<=32) bits from an arbitrary position.
|
|
|
|
counting from MSB to LSB */
|
|
|
|
unsigned long card_extract_bits(
|
|
|
|
const unsigned long *p, /* the start of the bitfield array */
|
|
|
|
unsigned int start, /* bit no. to start reading */
|
|
|
|
unsigned int size); /* how many bits to read */
|
|
|
|
#endif
|