From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 08/12] qdev/isa: convert cs4231a sound card
Date: Wed, 9 Sep 2009 16:45:43 +0200 [thread overview]
Message-ID: <1252507547-11398-9-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1252507547-11398-1-git-send-email-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/cs4231a.c | 46 +++++++++++++++++++++++++++++++++-------------
1 files changed, 33 insertions(+), 13 deletions(-)
diff --git a/hw/cs4231a.c b/hw/cs4231a.c
index 46c71eb..91ee2aa 100644
--- a/hw/cs4231a.c
+++ b/hw/cs4231a.c
@@ -25,6 +25,7 @@
#include "audiodev.h"
#include "audio/audio.h"
#include "isa.h"
+#include "qdev.h"
#include "qemu-timer.h"
/*
@@ -40,11 +41,8 @@
/* #define DEBUG_XLAW */
static struct {
- int irq;
- int dma;
- int port;
int aci_counter;
-} conf = {9, 3, 0x534, 1};
+} conf = {1};
#ifdef DEBUG
#define dolog(...) AUD_log ("cs4231a", __VA_ARGS__)
@@ -59,12 +57,14 @@ static struct {
#define CS_DREGS 32
typedef struct CSState {
+ ISADevice dev;
QEMUSoundCard card;
qemu_irq pic;
uint32_t regs[CS_REGS];
uint8_t dregs[CS_DREGS];
- int dma;
- int port;
+ uint32_t irq;
+ uint32_t dma;
+ uint32_t port;
int shift;
int dma_running;
int audio_free;
@@ -635,16 +635,12 @@ static int cs_load (QEMUFile *f, void *opaque, int version_id)
return 0;
}
-int cs4231a_init (qemu_irq *pic)
+static int cs4231a_initfn (ISADevice *dev)
{
+ CSState *s = DO_UPCAST (CSState, dev, dev);
int i;
- CSState *s;
-
- s = qemu_mallocz (sizeof (*s));
- s->pic = isa_reserve_irq (conf.irq);
- s->dma = conf.dma;
- s->port = conf.port;
+ isa_init_irq (dev, &s->pic, s->irq);
for (i = 0; i < 4; i++) {
register_ioport_write (s->port + i, 1, 1, cs_write, s);
@@ -660,3 +656,27 @@ int cs4231a_init (qemu_irq *pic)
AUD_register_card ("cs4231a", &s->card);
return 0;
}
+
+int cs4231a_init (qemu_irq *pic)
+{
+ isa_create_simple("cs4231a");
+ return 0;
+}
+
+static ISADeviceInfo cs4231a_info = {
+ .qdev.name = "cs4231a",
+ .qdev.size = sizeof (CSState),
+ .init = cs4231a_initfn,
+ .qdev.props = (Property[]) {
+ DEFINE_PROP_HEX32 ("iobase", CSState, port, 0x534),
+ DEFINE_PROP_UINT32 ("irq", CSState, irq, 9),
+ DEFINE_PROP_UINT32 ("dma", CSState, dma, 3),
+ DEFINE_PROP_END_OF_LIST (),
+ },
+};
+
+static void cs4231a_register(void)
+{
+ isa_qdev_register(&cs4231a_info);
+}
+device_init(cs4231a_register)
--
1.6.2.5
next prev parent reply other threads:[~2009-09-09 14:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-09 14:45 [Qemu-devel] [PATCH 00/12] qdev isa patches Gerd Hoffmann
2009-09-09 14:45 ` [Qemu-devel] [PATCH 01/12] isapc: Fix irq routing Gerd Hoffmann
2009-09-09 14:45 ` [Qemu-devel] [PATCH 02/12] isapc: pick a more sane default cpu for such old hardware Gerd Hoffmann
2009-09-09 14:45 ` [Qemu-devel] [PATCH 03/12] qdev: drop iobase properties from isa bus Gerd Hoffmann
2009-09-09 14:45 ` [Qemu-devel] [PATCH 04/12] qdev: simplify isa irq assignments Gerd Hoffmann
2009-09-09 14:45 ` [Qemu-devel] [PATCH 05/12] qdev: tag isabus-bridge as no-user Gerd Hoffmann
2009-09-09 14:45 ` [Qemu-devel] [PATCH 06/12] qdev: add isa_create() function Gerd Hoffmann
2009-09-09 14:45 ` [Qemu-devel] [PATCH 07/12] qdev/isa: convert soundblaster Gerd Hoffmann
2009-09-09 14:45 ` Gerd Hoffmann [this message]
2009-09-09 14:45 ` [Qemu-devel] [PATCH 09/12] qdev/isa: convert gravis ultrasound Gerd Hoffmann
2009-09-09 14:45 ` [Qemu-devel] [PATCH 10/12] qdev/isa: convert ne2000 Gerd Hoffmann
2009-09-09 17:29 ` Markus Armbruster
2009-09-09 17:50 ` Markus Armbruster
2009-09-09 19:58 ` Gerd Hoffmann
2009-09-09 14:45 ` [Qemu-devel] [PATCH 11/12] qdev/isa: finish pckbd conversion Gerd Hoffmann
2009-09-09 14:45 ` [Qemu-devel] [PATCH 12/12] qdev/isa: convert real time clock Gerd Hoffmann
2009-09-09 19:43 ` [Qemu-devel] " Gerd Hoffmann
2009-09-11 9:29 ` Jan Kiszka
2009-09-11 9:32 ` Jan Kiszka
2009-09-09 17:56 ` [Qemu-devel] [PATCH 00/12] qdev isa patches Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1252507547-11398-9-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).