Commit bc0b1dc1eb30b729dc9cd5ee218370162033afaa
1 parent
630be16f
sb16 patch (malc)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@561 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
23 additions
and
10 deletions
hw/sb16.c
@@ -37,6 +37,7 @@ | @@ -37,6 +37,7 @@ | ||
37 | abort (); \ | 37 | abort (); \ |
38 | } while (0) | 38 | } while (0) |
39 | 39 | ||
40 | +/* #define DEBUG_SB16 */ | ||
40 | #ifdef DEBUG_SB16 | 41 | #ifdef DEBUG_SB16 |
41 | #define lwarn(...) fprintf (stderr, "sb16: " __VA_ARGS__) | 42 | #define lwarn(...) fprintf (stderr, "sb16: " __VA_ARGS__) |
42 | #define linfo(...) fprintf (stderr, "sb16: " __VA_ARGS__) | 43 | #define linfo(...) fprintf (stderr, "sb16: " __VA_ARGS__) |
@@ -60,7 +61,7 @@ static struct { | @@ -60,7 +61,7 @@ static struct { | ||
60 | int hdma; | 61 | int hdma; |
61 | int port; | 62 | int port; |
62 | int mix_block; | 63 | int mix_block; |
63 | -} sb = {4, 5, 5, 1, 5, 0x220, -1}; | 64 | +} sb = {5, 4, 5, 1, 5, 0x220, -1}; |
64 | 65 | ||
65 | static int mix_block, noirq; | 66 | static int mix_block, noirq; |
66 | 67 | ||
@@ -205,7 +206,7 @@ static void command (uint8_t cmd) | @@ -205,7 +206,7 @@ static void command (uint8_t cmd) | ||
205 | { | 206 | { |
206 | char *msg; | 207 | char *msg; |
207 | 208 | ||
208 | - msg = (char *)-1; | 209 | + msg = (char *) -1; |
209 | 210 | ||
210 | linfo ("%#x\n", cmd); | 211 | linfo ("%#x\n", cmd); |
211 | 212 | ||
@@ -225,6 +226,12 @@ static void command (uint8_t cmd) | @@ -225,6 +226,12 @@ static void command (uint8_t cmd) | ||
225 | } | 226 | } |
226 | else { | 227 | else { |
227 | switch (cmd) { | 228 | switch (cmd) { |
229 | + case 0x00: | ||
230 | + case 0x03: | ||
231 | + case 0xe7: | ||
232 | + /* IMS uses those when probing for sound devices */ | ||
233 | + return; | ||
234 | + | ||
228 | case 0x10: | 235 | case 0x10: |
229 | dsp.needed_bytes = 1; | 236 | dsp.needed_bytes = 1; |
230 | break; | 237 | break; |
@@ -328,7 +335,7 @@ static void command (uint8_t cmd) | @@ -328,7 +335,7 @@ static void command (uint8_t cmd) | ||
328 | 335 | ||
329 | case 0xf2: | 336 | case 0xf2: |
330 | dsp.out_data[dsp.out_data_len++] = 0xaa; | 337 | dsp.out_data[dsp.out_data_len++] = 0xaa; |
331 | - mixer.regs[0x82] |= 1; | 338 | + mixer.regs[0x82] |= mixer.regs[0x80]; |
332 | pic_set_irq (sb.irq, 1); | 339 | pic_set_irq (sb.irq, 1); |
333 | return; | 340 | return; |
334 | 341 | ||
@@ -500,13 +507,19 @@ static IO_READ_PROTO (dsp_read) | @@ -500,13 +507,19 @@ static IO_READ_PROTO (dsp_read) | ||
500 | goto error; | 507 | goto error; |
501 | 508 | ||
502 | case 0xe: /* data available status | irq 8 ack */ | 509 | case 0xe: /* data available status | irq 8 ack */ |
510 | + /* XXX drop pic irq line here? */ | ||
511 | + ldebug ("8 ack\n"); | ||
503 | retval = (0 == dsp.out_data_len) ? 0 : 0x80; | 512 | retval = (0 == dsp.out_data_len) ? 0 : 0x80; |
513 | + mixer.regs[0x82] &= ~mixer.regs[0x80]; | ||
514 | + pic_set_irq (sb.irq, 0); | ||
504 | break; | 515 | break; |
505 | 516 | ||
506 | case 0xf: /* irq 16 ack */ | 517 | case 0xf: /* irq 16 ack */ |
507 | - retval = 0xff; | ||
508 | - mixer.regs[0x82] &= ~2; | 518 | + /* XXX drop pic irq line here? */ |
509 | ldebug ("16 ack\n"); | 519 | ldebug ("16 ack\n"); |
520 | + retval = 0xff; | ||
521 | + mixer.regs[0x82] &= ~mixer.regs[0x80]; | ||
522 | + pic_set_irq (sb.irq, 0); | ||
510 | break; | 523 | break; |
511 | 524 | ||
512 | default: | 525 | default: |
@@ -514,8 +527,8 @@ static IO_READ_PROTO (dsp_read) | @@ -514,8 +527,8 @@ static IO_READ_PROTO (dsp_read) | ||
514 | } | 527 | } |
515 | 528 | ||
516 | if ((0xc != iport) && (0xe != iport)) { | 529 | if ((0xc != iport) && (0xe != iport)) { |
517 | - ldebug ("(nport=%#x, size=%d) iport %#x = %#x\n", | ||
518 | - nport, size, iport, retval); | 530 | + ldebug ("nport=%#x iport %#x = %#x\n", |
531 | + nport, iport, retval); | ||
519 | } | 532 | } |
520 | 533 | ||
521 | return retval; | 534 | return retval; |
@@ -617,8 +630,6 @@ static int SB_read_DMA (uint32_t addr, int size, int *_irq) | @@ -617,8 +630,6 @@ static int SB_read_DMA (uint32_t addr, int size, int *_irq) | ||
617 | 630 | ||
618 | ldebug ("addr:%#010x free:%d till:%d size:%d\n", | 631 | ldebug ("addr:%#010x free:%d till:%d size:%d\n", |
619 | addr, free, till, size); | 632 | addr, free, till, size); |
620 | -/* linfo ("pos %d free %d size %d till %d copy %d auto %d noirq %d\n", */ | ||
621 | -/* dsp.dma_pos, free, size, till, copy, dsp.dma_auto, noirq); */ | ||
622 | if (till <= copy) { | 633 | if (till <= copy) { |
623 | if (0 == dsp.dma_auto) { | 634 | if (0 == dsp.dma_auto) { |
624 | copy = till; | 635 | copy = till; |
@@ -631,8 +642,10 @@ static int SB_read_DMA (uint32_t addr, int size, int *_irq) | @@ -631,8 +642,10 @@ static int SB_read_DMA (uint32_t addr, int size, int *_irq) | ||
631 | 642 | ||
632 | if (dsp.left_till_irq <= 0) { | 643 | if (dsp.left_till_irq <= 0) { |
633 | mixer.regs[0x82] |= mixer.regs[0x80]; | 644 | mixer.regs[0x82] |= mixer.regs[0x80]; |
634 | - if (0 == noirq) | 645 | + if (0 == noirq) { |
646 | + ldebug ("request irq\n"); | ||
635 | *_irq = sb.irq; | 647 | *_irq = sb.irq; |
648 | + } | ||
636 | 649 | ||
637 | if (0 == dsp.dma_auto) { | 650 | if (0 == dsp.dma_auto) { |
638 | control (0); | 651 | control (0); |