FS#8961 - Anti-Aliased Fonts.
[kugel-rb.git] / firmware / export / sd.h
blob0b64bd768dd8af3b83f70ec4efec0e4725c75961
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_MULTIDRIVE or not */
28 #define SD_BLOCK_SIZE 512 /* XXX : support other sizes ? */
30 struct storage_info;
32 void sd_enable(bool on);
33 void sd_spindown(int seconds);
34 void sd_sleep(void);
35 void sd_sleepnow(void);
36 bool sd_disk_is_active(void);
37 int sd_soft_reset(void);
38 int sd_init(void);
39 void sd_close(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);
42 void sd_spin(void);
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);
47 #endif
48 #ifdef HAVE_HOTSWAP
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);
52 #endif
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);
60 #endif
63 /* SD States */
64 #define SD_IDLE 0
65 #define SD_READY 1
66 #define SD_IDENT 2
67 #define SD_STBY 3
68 #define SD_TRAN 4
69 #define SD_DATA 5
70 #define SD_RCV 6
71 #define SD_PRG 7
72 #define SD_DIS 8
74 /* SD Commands */
75 #define SD_GO_IDLE_STATE 0
76 #define SD_ALL_SEND_CID 2
77 #define SD_SEND_RELATIVE_ADDR 3
78 #define SD_SET_DSR 4
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
84 #define SD_SEND_CSD 9
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
97 #define SD_ERASE 38
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
103 #endif