1#ifndef HW_PCMCIA_H
2#define HW_PCMCIA_H
3
4
5
6#include "hw/qdev.h"
7
8typedef struct PCMCIASocket {
9 qemu_irq irq;
10 bool attached;
11} PCMCIASocket;
12
13#define TYPE_PCMCIA_CARD "pcmcia-card"
14#define PCMCIA_CARD(obj) \
15 OBJECT_CHECK(PCMCIACardState, (obj), TYPE_PCMCIA_CARD)
16#define PCMCIA_CARD_GET_CLASS(obj) \
17 OBJECT_GET_CLASS(PCMCIACardClass, obj, TYPE_PCMCIA_CARD)
18#define PCMCIA_CARD_CLASS(cls) \
19 OBJECT_CLASS_CHECK(PCMCIACardClass, cls, TYPE_PCMCIA_CARD)
20
21typedef struct PCMCIACardState {
22
23 DeviceState parent_obj;
24
25
26 PCMCIASocket *slot;
27} PCMCIACardState;
28
29typedef struct PCMCIACardClass {
30
31 DeviceClass parent_class;
32
33
34 int (*attach)(PCMCIACardState *state);
35 int (*detach)(PCMCIACardState *state);
36
37 const uint8_t *cis;
38 int cis_len;
39
40
41 uint8_t (*attr_read)(PCMCIACardState *card, uint32_t address);
42 void (*attr_write)(PCMCIACardState *card, uint32_t address, uint8_t value);
43 uint16_t (*common_read)(PCMCIACardState *card, uint32_t address);
44 void (*common_write)(PCMCIACardState *card,
45 uint32_t address, uint16_t value);
46 uint16_t (*io_read)(PCMCIACardState *card, uint32_t address);
47 void (*io_write)(PCMCIACardState *card, uint32_t address, uint16_t value);
48} PCMCIACardClass;
49
50#define CISTPL_DEVICE 0x01
51#define CISTPL_NO_LINK 0x14
52#define CISTPL_VERS_1 0x15
53#define CISTPL_JEDEC_C 0x18
54#define CISTPL_JEDEC_A 0x19
55#define CISTPL_CONFIG 0x1a
56#define CISTPL_CFTABLE_ENTRY 0x1b
57#define CISTPL_DEVICE_OC 0x1c
58#define CISTPL_DEVICE_OA 0x1d
59#define CISTPL_DEVICE_GEO 0x1e
60#define CISTPL_DEVICE_GEO_A 0x1f
61#define CISTPL_MANFID 0x20
62#define CISTPL_FUNCID 0x21
63#define CISTPL_FUNCE 0x22
64#define CISTPL_END 0xff
65#define CISTPL_ENDMARK 0xff
66
67
68PCMCIACardState *dscm1xxxx_init(DriveInfo *bdrv);
69
70#endif
71