hm60x/hm801: Fix blinking white screen.
[maemo-rb.git] / firmware / export / mmc.h
blob8d20f8123666b4c5d6ca0cb665ec674d736fe192
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 __MMC_H__
23 #define __MMC_H__
25 #include <stdbool.h>
26 #include "config.h"
27 #include "mv.h" /* for HAVE_MULTIDRIVE or not */
29 struct storage_info;
31 void mmc_enable(bool on);
32 void mmc_spindown(int seconds);
33 void mmc_sleep(void);
34 void mmc_sleepnow(void);
35 bool mmc_disk_is_active(void);
36 int mmc_soft_reset(void);
37 int mmc_init(void) STORAGE_INIT_ATTR;
38 void mmc_close(void);
39 int mmc_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf);
40 int mmc_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf);
41 void mmc_spin(void);
42 int mmc_spinup_time(void);
44 #ifdef STORAGE_GET_INFO
45 void mmc_get_info(IF_MD2(int drive,) struct storage_info *info);
46 #endif
47 #ifdef HAVE_HOTSWAP
48 bool mmc_removable(IF_MD_NONVOID(int drive));
49 bool mmc_present(IF_MD_NONVOID(int drive));
50 #endif
52 long mmc_last_disk_activity(void);
54 #ifdef CONFIG_STORAGE_MULTI
55 int mmc_num_drives(int first_drive);
56 #endif
58 /* MMC States */
59 #define MMC_IDLE 0
60 #define MMC_READY 1
61 #define MMC_IDENT 2
62 #define MMC_STBY 3
63 #define MMC_TRAN 4
64 #define MMC_DATA 5
65 #define MMC_RCV 6
66 #define MMC_PRG 7
67 #define MMC_DIS 8
68 #define MMC_BTST 9
70 /* MMC Commands */
71 #define MMC_GO_IDLE_STATE 0
72 #define MMC_SEND_OP_COND 1
73 #define MMC_ALL_SEND_CID 2
74 #define MMC_SET_RELATIVE_ADDR 3
75 #define MMC_SET_DSR 4
76 #define MMC_SWITCH 6
77 #define MMC_SELECT_CARD 7 /* with card's rca */
78 #define MMC_DESELECT_CARD 7 /* with rca = 0 */
79 #define MMC_SEND_EXT_CSD 8
80 #define MMC_SEND_CSD 9
81 #define MMC_SEND_CID 10
82 #define MMC_READ_DAT_UNTIL_STOP 11
83 #define MMC_STOP_TRANSMISSION 12
84 #define MMC_SEND_STATUS 13
85 #define MMC_BUSTEST_R 14
86 #define MMC_GO_INACTIVE_STATE 15
87 #define MMC_SET_BLOCKLEN 16
88 #define MMC_READ_SINGLE_BLOCK 17
89 #define MMC_READ_MULTIPLE_BLOCK 18
90 #define MMC_BUSTEST_W 19
91 #define MMC_WRITE_DAT_UNTIL_STOP 20
92 #define MMC_SET_BLOCK_COUNT 23
93 #define MMC_WRITE_BLOCK 24
94 #define MMC_WRITE_MULTIPLE_BLOCK 25
95 #define MMC_PROGRAM_CID 26
96 #define MMC_PROGRAM_CSD 27
97 #define MMC_SET_WRITE_PROT 28
98 #define MMC_CLR_WRITE_PROT 29
99 #define MMC_SEND_WRITE_PROT 30
100 #define MMC_ERASE_GROUP_START 35
101 #define MMC_ERASE_GROUP_END 36
102 #define MMC_ERASE 38
103 #define MMC_FAST_IO 39
104 #define MMC_GO_IRQ_STATE 40
105 #define MMC_LOCK_UNLOCK 42
106 #define MMC_APP_CMD 55
107 #define MMC_GEN_CMD 56
109 #endif