Commit bc0b1dc1eb30b729dc9cd5ee218370162033afaa

Authored by bellard
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 37 abort (); \
38 38 } while (0)
39 39  
  40 +/* #define DEBUG_SB16 */
40 41 #ifdef DEBUG_SB16
41 42 #define lwarn(...) fprintf (stderr, "sb16: " __VA_ARGS__)
42 43 #define linfo(...) fprintf (stderr, "sb16: " __VA_ARGS__)
... ... @@ -60,7 +61,7 @@ static struct {
60 61 int hdma;
61 62 int port;
62 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 66 static int mix_block, noirq;
66 67  
... ... @@ -205,7 +206,7 @@ static void command (uint8_t cmd)
205 206 {
206 207 char *msg;
207 208  
208   - msg = (char *)-1;
  209 + msg = (char *) -1;
209 210  
210 211 linfo ("%#x\n", cmd);
211 212  
... ... @@ -225,6 +226,12 @@ static void command (uint8_t cmd)
225 226 }
226 227 else {
227 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 235 case 0x10:
229 236 dsp.needed_bytes = 1;
230 237 break;
... ... @@ -328,7 +335,7 @@ static void command (uint8_t cmd)
328 335  
329 336 case 0xf2:
330 337 dsp.out_data[dsp.out_data_len++] = 0xaa;
331   - mixer.regs[0x82] |= 1;
  338 + mixer.regs[0x82] |= mixer.regs[0x80];
332 339 pic_set_irq (sb.irq, 1);
333 340 return;
334 341  
... ... @@ -500,13 +507,19 @@ static IO_READ_PROTO (dsp_read)
500 507 goto error;
501 508  
502 509 case 0xe: /* data available status | irq 8 ack */
  510 + /* XXX drop pic irq line here? */
  511 + ldebug ("8 ack\n");
503 512 retval = (0 == dsp.out_data_len) ? 0 : 0x80;
  513 + mixer.regs[0x82] &= ~mixer.regs[0x80];
  514 + pic_set_irq (sb.irq, 0);
504 515 break;
505 516  
506 517 case 0xf: /* irq 16 ack */
507   - retval = 0xff;
508   - mixer.regs[0x82] &= ~2;
  518 + /* XXX drop pic irq line here? */
509 519 ldebug ("16 ack\n");
  520 + retval = 0xff;
  521 + mixer.regs[0x82] &= ~mixer.regs[0x80];
  522 + pic_set_irq (sb.irq, 0);
510 523 break;
511 524  
512 525 default:
... ... @@ -514,8 +527,8 @@ static IO_READ_PROTO (dsp_read)
514 527 }
515 528  
516 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 534 return retval;
... ... @@ -617,8 +630,6 @@ static int SB_read_DMA (uint32_t addr, int size, int *_irq)
617 630  
618 631 ldebug ("addr:%#010x free:%d till:%d size:%d\n",
619 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 633 if (till <= copy) {
623 634 if (0 == dsp.dma_auto) {
624 635 copy = till;
... ... @@ -631,8 +642,10 @@ static int SB_read_DMA (uint32_t addr, int size, int *_irq)
631 642  
632 643 if (dsp.left_till_irq <= 0) {
633 644 mixer.regs[0x82] |= mixer.regs[0x80];
634   - if (0 == noirq)
  645 + if (0 == noirq) {
  646 + ldebug ("request irq\n");
635 647 *_irq = sb.irq;
  648 + }
636 649  
637 650 if (0 == dsp.dma_auto) {
638 651 control (0);
... ...