Revision bc24a225 hw/pxa2xx_pcmcia.c

b/hw/pxa2xx_pcmcia.c
11 11
#include "pcmcia.h"
12 12
#include "pxa.h"
13 13

  
14
struct pxa2xx_pcmcia_s {
15
    struct pcmcia_socket_s slot;
16
    struct pcmcia_card_s *card;
14
struct PXA2xxPCMCIAState {
15
    PCMCIASocket slot;
16
    PCMCIACardState *card;
17 17

  
18 18
    qemu_irq irq;
19 19
    qemu_irq cd_irq;
......
22 22
static uint32_t pxa2xx_pcmcia_common_read(void *opaque,
23 23
                target_phys_addr_t offset)
24 24
{
25
    struct pxa2xx_pcmcia_s *s = (struct pxa2xx_pcmcia_s *) opaque;
25
    PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
26 26

  
27 27
    if (s->slot.attached) {
28 28
        return s->card->common_read(s->card->state, offset);
......
34 34
static void pxa2xx_pcmcia_common_write(void *opaque,
35 35
                target_phys_addr_t offset, uint32_t value)
36 36
{
37
    struct pxa2xx_pcmcia_s *s = (struct pxa2xx_pcmcia_s *) opaque;
37
    PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
38 38

  
39 39
    if (s->slot.attached) {
40 40
        s->card->common_write(s->card->state, offset, value);
......
44 44
static uint32_t pxa2xx_pcmcia_attr_read(void *opaque,
45 45
                target_phys_addr_t offset)
46 46
{
47
    struct pxa2xx_pcmcia_s *s = (struct pxa2xx_pcmcia_s *) opaque;
47
    PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
48 48

  
49 49
    if (s->slot.attached) {
50 50
        return s->card->attr_read(s->card->state, offset);
......
56 56
static void pxa2xx_pcmcia_attr_write(void *opaque,
57 57
                target_phys_addr_t offset, uint32_t value)
58 58
{
59
    struct pxa2xx_pcmcia_s *s = (struct pxa2xx_pcmcia_s *) opaque;
59
    PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
60 60

  
61 61
    if (s->slot.attached) {
62 62
        s->card->attr_write(s->card->state, offset, value);
......
66 66
static uint32_t pxa2xx_pcmcia_io_read(void *opaque,
67 67
                target_phys_addr_t offset)
68 68
{
69
    struct pxa2xx_pcmcia_s *s = (struct pxa2xx_pcmcia_s *) opaque;
69
    PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
70 70

  
71 71
    if (s->slot.attached) {
72 72
        return s->card->io_read(s->card->state, offset);
......
78 78
static void pxa2xx_pcmcia_io_write(void *opaque,
79 79
                target_phys_addr_t offset, uint32_t value)
80 80
{
81
    struct pxa2xx_pcmcia_s *s = (struct pxa2xx_pcmcia_s *) opaque;
81
    PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
82 82

  
83 83
    if (s->slot.attached) {
84 84
        s->card->io_write(s->card->state, offset, value);
......
123 123

  
124 124
static void pxa2xx_pcmcia_set_irq(void *opaque, int line, int level)
125 125
{
126
    struct pxa2xx_pcmcia_s *s = (struct pxa2xx_pcmcia_s *) opaque;
126
    PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
127 127
    if (!s->irq)
128 128
        return;
129 129

  
130 130
    qemu_set_irq(s->irq, level);
131 131
}
132 132

  
133
struct pxa2xx_pcmcia_s *pxa2xx_pcmcia_init(target_phys_addr_t base)
133
PXA2xxPCMCIAState *pxa2xx_pcmcia_init(target_phys_addr_t base)
134 134
{
135 135
    int iomemtype;
136
    struct pxa2xx_pcmcia_s *s;
136
    PXA2xxPCMCIAState *s;
137 137

  
138
    s = (struct pxa2xx_pcmcia_s *)
139
            qemu_mallocz(sizeof(struct pxa2xx_pcmcia_s));
138
    s = (PXA2xxPCMCIAState *)
139
            qemu_mallocz(sizeof(PXA2xxPCMCIAState));
140 140

  
141 141
    /* Socket I/O Memory Space */
142 142
    iomemtype = cpu_register_io_memory(0, pxa2xx_pcmcia_io_readfn,
......
166 166
}
167 167

  
168 168
/* Insert a new card into a slot */
169
int pxa2xx_pcmcia_attach(void *opaque, struct pcmcia_card_s *card)
169
int pxa2xx_pcmcia_attach(void *opaque, PCMCIACardState *card)
170 170
{
171
    struct pxa2xx_pcmcia_s *s = (struct pxa2xx_pcmcia_s *) opaque;
171
    PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
172 172
    if (s->slot.attached)
173 173
        return -EEXIST;
174 174

  
......
188 188
/* Eject card from the slot */
189 189
int pxa2xx_pcmcia_dettach(void *opaque)
190 190
{
191
    struct pxa2xx_pcmcia_s *s = (struct pxa2xx_pcmcia_s *) opaque;
191
    PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
192 192
    if (!s->slot.attached)
193 193
        return -ENOENT;
194 194

  
......
209 209
/* Who to notify on card events */
210 210
void pxa2xx_pcmcia_set_irq_cb(void *opaque, qemu_irq irq, qemu_irq cd_irq)
211 211
{
212
    struct pxa2xx_pcmcia_s *s = (struct pxa2xx_pcmcia_s *) opaque;
212
    PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
213 213
    s->irq = irq;
214 214
    s->cd_irq = cd_irq;
215 215
}

Also available in: Unified diff