Michael Sevakis | 1167e3c | 2007-06-30 02:08:27 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2004 by Jens Arnold |
| 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame^] | 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. |
Michael Sevakis | 1167e3c | 2007-06-30 02:08:27 +0000 | [diff] [blame] | 16 | * |
| 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 18 | * KIND, either express or implied. |
| 19 | * |
| 20 | ****************************************************************************/ |
| 21 | #ifndef __HOTSWAP_H__ |
| 22 | #define __HOTSWAP_H__ |
| 23 | |
| 24 | typedef struct |
| 25 | { |
Michael Sevakis | ea0d2cf | 2007-07-25 06:15:07 +0000 | [diff] [blame] | 26 | int initialized; |
Michael Sevakis | 1167e3c | 2007-06-30 02:08:27 +0000 | [diff] [blame] | 27 | unsigned char bitrate_register; |
| 28 | unsigned long read_timeout; /* n * 8 clock cycles */ |
| 29 | unsigned long write_timeout; /* n * 8 clock cycles */ |
| 30 | |
| 31 | unsigned long ocr; /* OCR register */ |
| 32 | unsigned long csd[4]; /* CSD register, 16 bytes */ |
| 33 | unsigned long cid[4]; /* CID register, 16 bytes */ |
| 34 | unsigned long speed; /* bit/s */ |
| 35 | unsigned int nsac; /* clock cycles */ |
| 36 | unsigned long tsac; /* n * 0.1 ns */ |
| 37 | unsigned int r2w_factor; |
| 38 | unsigned long size; /* size in bytes */ |
| 39 | unsigned long numblocks; /* size in flash blocks */ |
| 40 | unsigned int blocksize; /* block size in bytes */ |
| 41 | unsigned int block_exp; /* block size exponent */ |
| 42 | } tCardInfo; |
| 43 | |
Mark Arigo | 3e743ec | 2008-05-13 02:50:31 +0000 | [diff] [blame] | 44 | #ifdef HAVE_ATA_SD |
Mark Arigo | 7656748 | 2008-05-13 01:53:19 +0000 | [diff] [blame] | 45 | #include "ata-sd-target.h" |
Michael Sevakis | e37044f | 2008-03-12 11:08:41 +0000 | [diff] [blame] | 46 | #define card_detect card_detect_target |
| 47 | #define card_get_info card_get_info_target |
Mark Arigo | 3e743ec | 2008-05-13 02:50:31 +0000 | [diff] [blame] | 48 | #ifdef HAVE_HOTSWAP |
Michael Sevakis | e37044f | 2008-03-12 11:08:41 +0000 | [diff] [blame] | 49 | #define card_enable_monitoring card_enable_monitoring_target |
Mark Arigo | 3e743ec | 2008-05-13 02:50:31 +0000 | [diff] [blame] | 50 | #endif |
Michael Sevakis | 1167e3c | 2007-06-30 02:08:27 +0000 | [diff] [blame] | 51 | #else /* HAVE_MMC */ |
| 52 | #include "ata_mmc.h" |
| 53 | #define card_detect mmc_detect |
| 54 | #define card_get_info mmc_card_info |
| 55 | #define card_touched mmc_touched |
| 56 | #define card_enable_monitoring mmc_enable_monitoring |
| 57 | #endif |
| 58 | |
| 59 | /* helper function to extract n (<=32) bits from an arbitrary position. |
| 60 | counting from MSB to LSB */ |
| 61 | unsigned long card_extract_bits( |
| 62 | const unsigned long *p, /* the start of the bitfield array */ |
| 63 | unsigned int start, /* bit no. to start reading */ |
| 64 | unsigned int size); /* how many bits to read */ |
| 65 | #endif |