woops... fix the header and bump the plugin API
[kugel-rb.git] / firmware / export / sd.h
blobeb0f065b4993be33718c0aae49c3de48612c9eba
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
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 ****************************************************************************/
22 #ifndef __SD_H__
23 #define __SD_H__
25 #include <stdbool.h>
26 #include "mv.h" /* for HAVE_MULTIVOLUME or not */
28 struct storage_info;
30 void sd_enable(bool on);
31 void sd_spindown(int seconds);
32 void sd_sleep(void);
33 bool sd_disk_is_active(void);
34 int sd_soft_reset(void);
35 int sd_init(void);
36 void sd_close(void);
37 int sd_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf);
38 int sd_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf);
39 void sd_spin(void);
41 #ifdef STORAGE_GET_INFO
42 void sd_get_info(IF_MV2(int drive,) struct storage_info *info);
43 #endif
44 #ifdef HAVE_HOTSWAP
45 bool sd_removable(IF_MV_NONVOID(int drive));
46 bool sd_present(IF_MV_NONVOID(int drive));
47 #endif
49 long sd_last_disk_activity(void);
51 /* SD States */
52 #define SD_IDLE 0
53 #define SD_READY 1
54 #define SD_IDENT 2
55 #define SD_STBY 3
56 #define SD_TRAN 4
57 #define SD_DATA 5
58 #define SD_RCV 6
59 #define SD_PRG 7
60 #define SD_DIS 8
62 /* SD Commands */
63 #define SD_GO_IDLE_STATE 0
64 #define SD_ALL_SEND_CID 2
65 #define SD_SEND_RELATIVE_ADDR 3
66 #define SD_SET_DSR 4
67 #define SD_SWITCH_FUNC 6
68 #define SD_SELECT_CARD 7
69 #define SD_DESELECT_CARD 7
70 #define SD_SEND_IF_COND 8
71 #define SD_SEND_CSD 9
72 #define SD_SEND_CID 10
73 #define SD_STOP_TRANSMISSION 12
74 #define SD_SEND_STATUS 13
75 #define SD_GO_INACTIVE_STATE 15
76 #define SD_SET_BLOCKLEN 16
77 #define SD_READ_SINGLE_BLOCK 17
78 #define SD_READ_MULTIPLE_BLOCK 18
79 #define SD_SEND_NUM_WR_BLOCKS 22
80 #define SD_WRITE_BLOCK 24
81 #define SD_WRITE_MULTIPLE_BLOCK 25
82 #define SD_ERASE_WR_BLK_START 32
83 #define SD_ERASE_WR_BLK_END 33
84 #define SD_ERASE 38
85 #define SD_APP_CMD 55
87 /* Application Specific commands */
88 #define SD_SET_BUS_WIDTH 6
89 #define SD_APP_OP_COND 41
91 #endif