1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 by Alan Korr
11 * Copyright (C) 2008 by Frank Gevaerts
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ****************************************************************************/
26 #include "mv.h" /* for HAVE_MULTIDRIVE or not */
28 #define SD_BLOCK_SIZE 512 /* XXX : support other sizes ? */
32 void sd_enable(bool on
);
33 void sd_spindown(int seconds
);
35 void sd_sleepnow(void);
36 bool sd_disk_is_active(void);
37 int sd_soft_reset(void);
40 int sd_read_sectors(IF_MD2(int drive
,) unsigned long start
, int count
, void* buf
);
41 int sd_write_sectors(IF_MD2(int drive
,) unsigned long start
, int count
, const void* buf
);
43 int sd_spinup_time(void); /* ticks */
45 #ifdef STORAGE_GET_INFO
46 void sd_get_info(IF_MD2(int drive
,) struct storage_info
*info
);
49 bool sd_removable(IF_MV_NONVOID(int drive
));
50 bool sd_present(IF_MV_NONVOID(int drive
));
51 void card_enable_monitoring_target(bool on
);
54 bool card_detect_target(void);
56 long sd_last_disk_activity(void);
58 #ifdef CONFIG_STORAGE_MULTI
59 int sd_num_drives(int first_drive
);
75 #define SD_GO_IDLE_STATE 0
76 #define SD_ALL_SEND_CID 2
77 #define SD_SEND_RELATIVE_ADDR 3
79 #define SD_SWITCH_FUNC 6
80 #define SD_SET_BUS_WIDTH 6 /* acmd6 */
81 #define SD_SELECT_CARD 7
82 #define SD_DESELECT_CARD 7
83 #define SD_SEND_IF_COND 8
85 #define SD_SEND_CID 10
86 #define SD_STOP_TRANSMISSION 12
87 #define SD_SEND_STATUS 13
88 #define SD_GO_INACTIVE_STATE 15
89 #define SD_SET_BLOCKLEN 16
90 #define SD_READ_SINGLE_BLOCK 17
91 #define SD_READ_MULTIPLE_BLOCK 18
92 #define SD_SEND_NUM_WR_BLOCKS 22
93 #define SD_WRITE_BLOCK 24
94 #define SD_WRITE_MULTIPLE_BLOCK 25
95 #define SD_ERASE_WR_BLK_START 32
96 #define SD_ERASE_WR_BLK_END 33
98 #define SD_APP_OP_COND 41
99 #define SD_LOCK_UNLOCK 42
100 #define SD_SEND_SCR 51 /* acmd51 */
101 #define SD_APP_CMD 55