1 #ifndef HW_PCMCIA_H 2 #define HW_PCMCIA_H 3 4 /* PCMCIA/Cardbus */ 5 6 #include "hw/qdev-core.h" 7 #include "qom/object.h" 8 9 typedef struct PCMCIASocket { 10 qemu_irq irq; 11 bool attached; 12 } PCMCIASocket; 13 14 #define TYPE_PCMCIA_CARD "pcmcia-card" 15 typedef struct PCMCIACardClass PCMCIACardClass; 16 typedef struct PCMCIACardState PCMCIACardState; 17 DECLARE_OBJ_CHECKERS(PCMCIACardState, PCMCIACardClass, 18 PCMCIA_CARD, TYPE_PCMCIA_CARD) 19 20 struct PCMCIACardState { 21 /*< private >*/ 22 DeviceState parent_obj; 23 /*< public >*/ 24 25 PCMCIASocket *slot; 26 }; 27 28 struct PCMCIACardClass { 29 /*< private >*/ 30 DeviceClass parent_class; 31 /*< public >*/ 32 33 int (*attach)(PCMCIACardState *state); 34 int (*detach)(PCMCIACardState *state); 35 36 const uint8_t *cis; 37 int cis_len; 38 39 /* Only valid if attached */ 40 uint8_t (*attr_read)(PCMCIACardState *card, uint32_t address); 41 void (*attr_write)(PCMCIACardState *card, uint32_t address, uint8_t value); 42 uint16_t (*common_read)(PCMCIACardState *card, uint32_t address); 43 void (*common_write)(PCMCIACardState *card, 44 uint32_t address, uint16_t value); 45 uint16_t (*io_read)(PCMCIACardState *card, uint32_t address); 46 void (*io_write)(PCMCIACardState *card, uint32_t address, uint16_t value); 47 }; 48 49 #define CISTPL_DEVICE 0x01 /* 5V Device Information Tuple */ 50 #define CISTPL_NO_LINK 0x14 /* No Link Tuple */ 51 #define CISTPL_VERS_1 0x15 /* Level 1 Version Tuple */ 52 #define CISTPL_JEDEC_C 0x18 /* JEDEC ID Tuple */ 53 #define CISTPL_JEDEC_A 0x19 /* JEDEC ID Tuple */ 54 #define CISTPL_CONFIG 0x1a /* Configuration Tuple */ 55 #define CISTPL_CFTABLE_ENTRY 0x1b /* 16-bit PCCard Configuration */ 56 #define CISTPL_DEVICE_OC 0x1c /* Additional Device Information */ 57 #define CISTPL_DEVICE_OA 0x1d /* Additional Device Information */ 58 #define CISTPL_DEVICE_GEO 0x1e /* Additional Device Information */ 59 #define CISTPL_DEVICE_GEO_A 0x1f /* Additional Device Information */ 60 #define CISTPL_MANFID 0x20 /* Manufacture ID Tuple */ 61 #define CISTPL_FUNCID 0x21 /* Function ID Tuple */ 62 #define CISTPL_FUNCE 0x22 /* Function Extension Tuple */ 63 #define CISTPL_END 0xff /* Tuple End */ 64 #define CISTPL_ENDMARK 0xff 65 66 /* dscm1xxxx.c */ 67 PCMCIACardState *dscm1xxxx_init(DriveInfo *bdrv); 68 69 #endif 70