aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-01-19 21:11:02 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-01-19 21:11:02 +0000
commit3504fe171b62bb0362191e1fd66538ff7c4f4210 (patch)
treef7521be1fdd6cf73cfacb662a3a5a86c18f1754f /hw
parentab1f142ba0b667679ea2ed55598f22551c19dac4 (diff)
16 bit DMA fix (malc)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@572 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw')
-rw-r--r--hw/dma.c38
1 files changed, 10 insertions, 28 deletions
diff --git a/hw/dma.c b/hw/dma.c
index a1e77f591e..ee7cc42ec9 100644
--- a/hw/dma.c
+++ b/hw/dma.c
@@ -136,7 +136,7 @@ static uint32_t read_chan (CPUState *env, uint32_t nport)
return (val >> (ncont + (ff << 3))) & 0xff;
}
-static void write_chan (uint32_t nport, int size, uint32_t data)
+static void write_chan (CPUState *env, uint32_t nport, uint32_t data)
{
int ncont, ichan, nreg;
struct dma_regs *r;
@@ -146,28 +146,12 @@ static void write_chan (uint32_t nport, int size, uint32_t data)
nreg = (nport >> ncont) & 1;
r = dma_controllers[ncont].regs + ichan;
- if (2 == size) {
- r->base[nreg] = data;
+ if (getff (ncont)) {
+ r->base[nreg] = (r->base[nreg] & 0xff) | ((data << 8) & 0xff00);
init_chan (ncont, ichan);
+ } else {
+ r->base[nreg] = (r->base[nreg] & 0xff00) | (data & 0xff);
}
- else {
- if (getff (ncont)) {
- r->base[nreg] = (r->base[nreg] & 0xff) | ((data << 8) & 0xff00);
- init_chan (ncont, ichan);
- }
- else {
- r->base[nreg] = (r->base[nreg] & 0xff00) | (data & 0xff);
- }
- }
-}
-static void write_chanb (CPUState *env, uint32_t nport, uint32_t data)
-{
- write_chan (nport, 1, data);
-}
-
-static void write_chanw (CPUState *env, uint32_t nport, uint32_t data)
-{
- write_chan (nport, 2, data);
}
static void write_cont (CPUState *env, uint32_t nport, uint32_t data)
@@ -370,14 +354,12 @@ void DMA_init (void)
int page_port_list[] = { 0x1, 0x2, 0x3, 0x7 };
for (i = 0; i < 8; i++) {
- register_ioport_write (i, 1, write_chanb, 1);
- register_ioport_write (i, 1, write_chanw, 2);
+ register_ioport_write (i, 1, write_chan, 1);
- register_ioport_write (0xc0 + (i << 1), 1, write_chanb, 1);
- register_ioport_write (0xc0 + (i << 1), 1, write_chanw, 2);
+ register_ioport_write (0xc0 + (i << 1), 1, write_chan, 1);
register_ioport_read (i, 1, read_chan, 1);
- register_ioport_read (0xc0 + (i << 1), 1, read_chan, 2);
+ register_ioport_read (0xc0 + (i << 1), 1, read_chan, 1);
}
for (i = 0; i < LENOFA (page_port_list); i++) {
@@ -390,6 +372,6 @@ void DMA_init (void)
register_ioport_write (0xd0 + (i << 1), 1, write_cont, 1);
}
- write_cont (NULL, 0xd, 0);
- write_cont (NULL, 0xdd, 0);
+ write_cont (NULL, 0x0d, 0);
+ write_cont (NULL, 0xda, 0);
}