Revision bc24a225 hw/ide.c
b/hw/ide.c | ||
---|---|---|
3859 | 3859 |
#define METADATA_SIZE 0x20 |
3860 | 3860 |
|
3861 | 3861 |
/* DSCM-1XXXX Microdrive hard disk with CF+ II / PCMCIA interface. */ |
3862 |
struct md_s {
|
|
3862 |
typedef struct {
|
|
3863 | 3863 |
IDEState ide[2]; |
3864 |
struct pcmcia_card_s card;
|
|
3864 |
PCMCIACardState card;
|
|
3865 | 3865 |
uint32_t attr_base; |
3866 | 3866 |
uint32_t io_base; |
3867 | 3867 |
|
... | ... | |
3873 | 3873 |
uint8_t ctrl; |
3874 | 3874 |
uint16_t io; |
3875 | 3875 |
int cycle; |
3876 |
}; |
|
3876 |
} MicroDriveState;
|
|
3877 | 3877 |
|
3878 | 3878 |
/* Register bitfields */ |
3879 | 3879 |
enum md_opt { |
... | ... | |
3902 | 3902 |
CTRL_SRST = 0x04, |
3903 | 3903 |
}; |
3904 | 3904 |
|
3905 |
static inline void md_interrupt_update(struct md_s *s)
|
|
3905 |
static inline void md_interrupt_update(MicroDriveState *s)
|
|
3906 | 3906 |
{ |
3907 | 3907 |
if (!s->card.slot) |
3908 | 3908 |
return; |
... | ... | |
3915 | 3915 |
|
3916 | 3916 |
static void md_set_irq(void *opaque, int irq, int level) |
3917 | 3917 |
{ |
3918 |
struct md_s *s = (struct md_s *) opaque;
|
|
3918 |
MicroDriveState *s = (MicroDriveState *) opaque;
|
|
3919 | 3919 |
if (level) |
3920 | 3920 |
s->stat |= STAT_INT; |
3921 | 3921 |
else |
... | ... | |
3924 | 3924 |
md_interrupt_update(s); |
3925 | 3925 |
} |
3926 | 3926 |
|
3927 |
static void md_reset(struct md_s *s)
|
|
3927 |
static void md_reset(MicroDriveState *s)
|
|
3928 | 3928 |
{ |
3929 | 3929 |
s->opt = OPT_MODE_MMAP; |
3930 | 3930 |
s->stat = 0; |
... | ... | |
3936 | 3936 |
|
3937 | 3937 |
static uint8_t md_attr_read(void *opaque, uint32_t at) |
3938 | 3938 |
{ |
3939 |
struct md_s *s = (struct md_s *) opaque;
|
|
3939 |
MicroDriveState *s = (MicroDriveState *) opaque;
|
|
3940 | 3940 |
if (at < s->attr_base) { |
3941 | 3941 |
if (at < s->card.cis_len) |
3942 | 3942 |
return s->card.cis[at]; |
... | ... | |
3969 | 3969 |
|
3970 | 3970 |
static void md_attr_write(void *opaque, uint32_t at, uint8_t value) |
3971 | 3971 |
{ |
3972 |
struct md_s *s = (struct md_s *) opaque;
|
|
3972 |
MicroDriveState *s = (MicroDriveState *) opaque;
|
|
3973 | 3973 |
at -= s->attr_base; |
3974 | 3974 |
|
3975 | 3975 |
switch (at) { |
... | ... | |
4000 | 4000 |
|
4001 | 4001 |
static uint16_t md_common_read(void *opaque, uint32_t at) |
4002 | 4002 |
{ |
4003 |
struct md_s *s = (struct md_s *) opaque;
|
|
4003 |
MicroDriveState *s = (MicroDriveState *) opaque;
|
|
4004 | 4004 |
uint16_t ret; |
4005 | 4005 |
at -= s->io_base; |
4006 | 4006 |
|
... | ... | |
4059 | 4059 |
|
4060 | 4060 |
static void md_common_write(void *opaque, uint32_t at, uint16_t value) |
4061 | 4061 |
{ |
4062 |
struct md_s *s = (struct md_s *) opaque;
|
|
4062 |
MicroDriveState *s = (MicroDriveState *) opaque;
|
|
4063 | 4063 |
at -= s->io_base; |
4064 | 4064 |
|
4065 | 4065 |
switch (s->opt & OPT_MODE) { |
... | ... | |
4120 | 4120 |
|
4121 | 4121 |
static void md_save(QEMUFile *f, void *opaque) |
4122 | 4122 |
{ |
4123 |
struct md_s *s = (struct md_s *) opaque;
|
|
4123 |
MicroDriveState *s = (MicroDriveState *) opaque;
|
|
4124 | 4124 |
int i; |
4125 | 4125 |
uint8_t drive1_selected; |
4126 | 4126 |
|
... | ... | |
4142 | 4142 |
|
4143 | 4143 |
static int md_load(QEMUFile *f, void *opaque, int version_id) |
4144 | 4144 |
{ |
4145 |
struct md_s *s = (struct md_s *) opaque;
|
|
4145 |
MicroDriveState *s = (MicroDriveState *) opaque;
|
|
4146 | 4146 |
int i; |
4147 | 4147 |
uint8_t drive1_selected; |
4148 | 4148 |
|
... | ... | |
4351 | 4351 |
|
4352 | 4352 |
static int dscm1xxxx_attach(void *opaque) |
4353 | 4353 |
{ |
4354 |
struct md_s *md = (struct md_s *) opaque;
|
|
4354 |
MicroDriveState *md = (MicroDriveState *) opaque;
|
|
4355 | 4355 |
md->card.attr_read = md_attr_read; |
4356 | 4356 |
md->card.attr_write = md_attr_write; |
4357 | 4357 |
md->card.common_read = md_common_read; |
... | ... | |
4371 | 4371 |
|
4372 | 4372 |
static int dscm1xxxx_detach(void *opaque) |
4373 | 4373 |
{ |
4374 |
struct md_s *md = (struct md_s *) opaque;
|
|
4374 |
MicroDriveState *md = (MicroDriveState *) opaque;
|
|
4375 | 4375 |
md_reset(md); |
4376 | 4376 |
return 0; |
4377 | 4377 |
} |
4378 | 4378 |
|
4379 |
struct pcmcia_card_s *dscm1xxxx_init(BlockDriverState *bdrv)
|
|
4379 |
PCMCIACardState *dscm1xxxx_init(BlockDriverState *bdrv)
|
|
4380 | 4380 |
{ |
4381 |
struct md_s *md = (struct md_s *) qemu_mallocz(sizeof(struct md_s));
|
|
4381 |
MicroDriveState *md = (MicroDriveState *) qemu_mallocz(sizeof(MicroDriveState));
|
|
4382 | 4382 |
md->card.state = md; |
4383 | 4383 |
md->card.attach = dscm1xxxx_attach; |
4384 | 4384 |
md->card.detach = dscm1xxxx_detach; |
Also available in: Unified diff