xref: /openbmc/qemu/include/hw/sd/sdcard_legacy.h (revision b4b9a0e3)
1 /*
2  * SD Memory Card emulation (deprecated legacy API)
3  *
4  * Copyright (c) 2006 Andrzej Zaborowski  <balrog@zabor.org>
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in
14  *    the documentation and/or other materials provided with the
15  *    distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
19  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
21  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 #ifndef HW_SDCARD_LEGACY_H
30 #define HW_SDCARD_LEGACY_H
31 
32 #include "hw/sd/sd.h"
33 
34 /* Legacy functions to be used only by non-qdevified callers */
35 SDState *sd_init(BlockBackend *blk, bool is_spi);
36 int sd_do_command(SDState *card, SDRequest *request, uint8_t *response);
37 void sd_write_byte(SDState *card, uint8_t value);
38 uint8_t sd_read_byte(SDState *card);
39 void sd_set_cb(SDState *card, qemu_irq readonly, qemu_irq insert);
40 
41 /* sd_enable should not be used -- it is only used on the nseries boards,
42  * where it is part of a broken implementation of the MMC card slot switch
43  * (there should be two card slots which are multiplexed to a single MMC
44  * controller, but instead we model it with one card and controller and
45  * disable the card when the second slot is selected, so it looks like the
46  * second slot is always empty).
47  */
48 void sd_enable(SDState *card, bool enable);
49 
50 #endif /* HW_SDCARD_LEGACY_H */
51