cs4231a.c (a3dcca567a1d4a5c79fb9c8fe2d9a21a4a7cebd5) | cs4231a.c (db895a1e6a97e919f9b86d60c969377357b05066) |
---|---|
1/* 2 * QEMU Crystal CS4231 audio chip emulation 3 * 4 * Copyright (c) 2006 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 630 unchanged lines hidden (view full) --- 639 .read = cs_read, 640 .write = cs_write, 641 .impl = { 642 .min_access_size = 1, 643 .max_access_size = 1, 644 } 645}; 646 | 1/* 2 * QEMU Crystal CS4231 audio chip emulation 3 * 4 * Copyright (c) 2006 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 630 unchanged lines hidden (view full) --- 639 .read = cs_read, 640 .write = cs_write, 641 .impl = { 642 .min_access_size = 1, 643 .max_access_size = 1, 644 } 645}; 646 |
647static int cs4231a_initfn (ISADevice *dev) | 647static void cs4231a_initfn (Object *obj) |
648{ | 648{ |
649 CSState *s = CS4231A (obj); 650 651 memory_region_init_io (&s->ioports, &cs_ioport_ops, s, "cs4231a", 4); 652} 653 654static void cs4231a_realizefn (DeviceState *dev, Error **errp) 655{ 656 ISADevice *d = ISA_DEVICE (dev); |
|
649 CSState *s = CS4231A (dev); 650 | 657 CSState *s = CS4231A (dev); 658 |
651 isa_init_irq (dev, &s->pic, s->irq); | 659 isa_init_irq (d, &s->pic, s->irq); |
652 | 660 |
653 memory_region_init_io (&s->ioports, &cs_ioport_ops, s, "cs4231a", 4); 654 isa_register_ioport (dev, &s->ioports, s->port); | 661 isa_register_ioport (d, &s->ioports, s->port); |
655 656 DMA_register_channel (s->dma, cs_dma_read, s); 657 658 AUD_register_card ("cs4231a", &s->card); | 662 663 DMA_register_channel (s->dma, cs_dma_read, s); 664 665 AUD_register_card ("cs4231a", &s->card); |
659 return 0; | |
660} 661 662static int cs4231a_init (ISABus *bus) 663{ 664 isa_create_simple (bus, TYPE_CS4231A); 665 return 0; 666} 667 668static Property cs4231a_properties[] = { 669 DEFINE_PROP_HEX32 ("iobase", CSState, port, 0x534), 670 DEFINE_PROP_UINT32 ("irq", CSState, irq, 9), 671 DEFINE_PROP_UINT32 ("dma", CSState, dma, 3), 672 DEFINE_PROP_END_OF_LIST (), 673}; 674 675static void cs4231a_class_initfn (ObjectClass *klass, void *data) 676{ 677 DeviceClass *dc = DEVICE_CLASS (klass); | 666} 667 668static int cs4231a_init (ISABus *bus) 669{ 670 isa_create_simple (bus, TYPE_CS4231A); 671 return 0; 672} 673 674static Property cs4231a_properties[] = { 675 DEFINE_PROP_HEX32 ("iobase", CSState, port, 0x534), 676 DEFINE_PROP_UINT32 ("irq", CSState, irq, 9), 677 DEFINE_PROP_UINT32 ("dma", CSState, dma, 3), 678 DEFINE_PROP_END_OF_LIST (), 679}; 680 681static void cs4231a_class_initfn (ObjectClass *klass, void *data) 682{ 683 DeviceClass *dc = DEVICE_CLASS (klass); |
678 ISADeviceClass *ic = ISA_DEVICE_CLASS (klass); 679 ic->init = cs4231a_initfn; | 684 685 dc->realize = cs4231a_realizefn; |
680 dc->reset = cs4231a_reset; 681 dc->desc = "Crystal Semiconductor CS4231A"; 682 dc->vmsd = &vmstate_cs4231a; 683 dc->props = cs4231a_properties; 684} 685 686static const TypeInfo cs4231a_info = { 687 .name = TYPE_CS4231A, 688 .parent = TYPE_ISA_DEVICE, 689 .instance_size = sizeof (CSState), | 686 dc->reset = cs4231a_reset; 687 dc->desc = "Crystal Semiconductor CS4231A"; 688 dc->vmsd = &vmstate_cs4231a; 689 dc->props = cs4231a_properties; 690} 691 692static const TypeInfo cs4231a_info = { 693 .name = TYPE_CS4231A, 694 .parent = TYPE_ISA_DEVICE, 695 .instance_size = sizeof (CSState), |
696 .instance_init = cs4231a_initfn, |
|
690 .class_init = cs4231a_class_initfn, 691}; 692 693static void cs4231a_register_types (void) 694{ 695 type_register_static (&cs4231a_info); 696 isa_register_soundhw("cs4231a", "CS4231A", cs4231a_init); 697} 698 699type_init (cs4231a_register_types) | 697 .class_init = cs4231a_class_initfn, 698}; 699 700static void cs4231a_register_types (void) 701{ 702 type_register_static (&cs4231a_info); 703 isa_register_soundhw("cs4231a", "CS4231A", cs4231a_init); 704} 705 706type_init (cs4231a_register_types) |