hw/core/register.c: Don't use '#' flag of printf format
[qemu/ar7.git] / tests / qtest / libqos / sdhci.h
blob22d647b1fd51fd06c485c386574bf5abe716e1fb
1 /*
2 * libqos driver framework
4 * Copyright (c) 2018 Emanuele Giuseppe Esposito <e.emanuelegiuseppe@gmail.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License version 2.1 as published by the Free Software Foundation.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>
19 #ifndef QGRAPH_QSDHCI_H
20 #define QGRAPH_QSDHCI_H
22 #include "qgraph.h"
23 #include "pci.h"
25 typedef struct QSDHCI QSDHCI;
26 typedef struct QSDHCI_MemoryMapped QSDHCI_MemoryMapped;
27 typedef struct QSDHCI_PCI QSDHCI_PCI;
28 typedef struct QSDHCIProperties QSDHCIProperties;
30 /* Properties common to all QSDHCI devices */
31 struct QSDHCIProperties {
32 uint8_t version;
33 uint8_t baseclock;
34 struct {
35 bool sdma;
36 uint64_t reg;
37 } capab;
40 struct QSDHCI {
41 uint16_t (*readw)(QSDHCI *s, uint32_t reg);
42 uint64_t (*readq)(QSDHCI *s, uint32_t reg);
43 void (*writeq)(QSDHCI *s, uint32_t reg, uint64_t val);
44 QSDHCIProperties props;
47 /* Memory Mapped implementation of QSDHCI */
48 struct QSDHCI_MemoryMapped {
49 QOSGraphObject obj;
50 QTestState *qts;
51 QSDHCI sdhci;
52 uint64_t addr;
55 /* PCI implementation of QSDHCI */
56 struct QSDHCI_PCI {
57 QOSGraphObject obj;
58 QPCIDevice dev;
59 QSDHCI sdhci;
60 QPCIBar mem_bar;
63 /**
64 * qos_init_sdhci_mm(): external constructor used by all drivers/machines
65 * that "contain" a #QSDHCI_MemoryMapped driver
67 void qos_init_sdhci_mm(QSDHCI_MemoryMapped *sdhci, QTestState *qts,
68 uint32_t addr, QSDHCIProperties *common);
70 #endif