Revision f9e92e97 hw/sb16.c
b/hw/sb16.c | ||
---|---|---|
25 | 25 |
#include <stdlib.h> |
26 | 26 |
#include <inttypes.h> |
27 | 27 |
|
28 |
#include "cpu.h" |
|
28 | 29 |
#include "vl.h" |
29 | 30 |
|
30 | 31 |
#define MIN(a, b) ((a)>(b)?(b):(a)) |
... | ... | |
569 | 570 |
static int write_audio (uint32_t addr, int len, int size) |
570 | 571 |
{ |
571 | 572 |
int temp, net; |
573 |
uint8_t tmpbuf[4096]; |
|
572 | 574 |
|
573 | 575 |
temp = size; |
574 | 576 |
|
... | ... | |
582 | 584 |
left_till_end = len - dsp.dma_pos; |
583 | 585 |
|
584 | 586 |
to_copy = MIN (temp, left_till_end); |
585 |
|
|
586 |
copied = AUD_write ((void *) (addr + dsp.dma_pos), to_copy); |
|
587 |
if (to_copy > sizeof(tmpbuf)) |
|
588 |
to_copy = sizeof(tmpbuf); |
|
589 |
cpu_physical_memory_read(addr + dsp.dma_pos, tmpbuf, to_copy); |
|
590 |
copied = AUD_write (tmpbuf, to_copy); |
|
587 | 591 |
|
588 | 592 |
temp -= copied; |
589 | 593 |
dsp.dma_pos += copied; |
... | ... | |
601 | 605 |
return net; |
602 | 606 |
} |
603 | 607 |
|
604 |
static int SB_read_DMA (uint32_t addr, int size, int *_irq)
|
|
608 |
static int SB_read_DMA (void *opaque, target_ulong addr, int size)
|
|
605 | 609 |
{ |
606 | 610 |
int free, till, copy, written; |
607 | 611 |
|
... | ... | |
644 | 648 |
mixer.regs[0x82] |= mixer.regs[0x80]; |
645 | 649 |
if (0 == noirq) { |
646 | 650 |
ldebug ("request irq\n"); |
647 |
*_irq = sb.irq;
|
|
651 |
pic_set_irq(sb.irq, 1);
|
|
648 | 652 |
} |
649 | 653 |
|
650 | 654 |
if (0 == dsp.dma_auto) { |
... | ... | |
663 | 667 |
return dsp.dma_pos; |
664 | 668 |
} |
665 | 669 |
|
666 |
static int dma_misc_handler (int moo) |
|
667 |
{ |
|
668 |
return -1; |
|
669 |
} |
|
670 |
|
|
671 | 670 |
static int magic_of_irq (int irq) |
672 | 671 |
{ |
673 | 672 |
switch (irq) { |
... | ... | |
731 | 730 |
register_ioport_read (sb.port + 0x5, 1, mixer_read, 1); |
732 | 731 |
register_ioport_write (sb.port + 0x5, 1, mixer_write_datab, 1); |
733 | 732 |
|
734 |
DMA_register_channel (sb.hdma, SB_read_DMA, dma_misc_handler);
|
|
735 |
DMA_register_channel (sb.dma, SB_read_DMA, dma_misc_handler);
|
|
733 |
DMA_register_channel (sb.hdma, SB_read_DMA, NULL);
|
|
734 |
DMA_register_channel (sb.dma, SB_read_DMA, NULL);
|
|
736 | 735 |
} |
Also available in: Unified diff