Skip to content

Commit 41e4fa8

Browse files
committed
fixed soundblaster output (DMA bug)
1 parent 0626040 commit 41e4fa8

File tree

6 files changed

+17
-24
lines changed

6 files changed

+17
-24
lines changed

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ floppy.img: boot.img
2828
dd if=/dev/zero of=$@ bs=512 count=2880
2929
dd if=$< of=$@ conv=notrunc
3030

31+
pcboot.iso: floppy.img
32+
rm -rf cdrom
33+
git archive --format=tar --prefix=cdrom/ HEAD | tar xf -
34+
cp $< cdrom
35+
mkisofs -o $@ -V pcboot -b $< cdrom
36+
37+
3138
boot.img: bootldr.bin $(bin)
3239
cat bootldr.bin $(bin) >$@
3340

src/au_sb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ void sb_start(int rate, int nchan)
194194

195195
interrupt(IRQ_TO_INTR(irq), intr_handler);
196196

197+
write_dsp(CMD_ENABLE_OUTPUT);
197198
sb_set_output_rate(rate);
198199
start_dma_transfer(addr, size);
199-
write_dsp(CMD_ENABLE_OUTPUT);
200200
}
201201

202202
void sb_pause(void)
@@ -241,7 +241,7 @@ static void start_dma_transfer(uint32_t addr, int size)
241241
dma_out(dma_chan, addr, size, DMA_SINGLE);
242242

243243
/* program the DSP to accept the DMA transfer */
244-
write_dsp(CMD_START_DMA8 | CMD_FIFO);
244+
write_dsp(CMD_START_DMA8);
245245
write_dsp(xfer_mode);
246246
size--;
247247
write_dsp(size & 0xff);

src/dma.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ static void dma_io(int chan, uint32_t phyaddr, int size, unsigned int flags, uns
117117
mask(chan);
118118
outb(0, DMA_CLR_FLIPFLOP(chan));
119119

120-
/* single / block / cascade */
121-
mode = ((flags & 3) << 6) | MODE_CHAN(chan);
120+
/* first 2 bits of flags correspond to the mode bits 6,7 */
121+
mode = ((flags & 3) << 6) | dir | MODE_CHAN(chan);
122122
if(flags & DMA_DECR) mode |= MODE_DECR;
123123
if(flags & DMA_AUTO) mode |= MODE_AUTO;
124124
outb(mode, DMA_MODE(chan));

src/intr.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ struct intr_frame *get_intr_frame(void)
116116
/* set an interrupt handler function for a particular interrupt */
117117
void interrupt(int intr_num, intr_func_t func)
118118
{
119+
int iflag = get_intr_flag();
120+
disable_intr();
119121
intr_func[intr_num] = func;
122+
set_intr_flag(iflag);
120123
}
121124

122125
/* this function is called from all interrupt entry points

src/pci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static int enum_dev(int busid, int dev)
129129
if(read_dev_info(&info, busid, dev, 0) == -1) {
130130
return 0;
131131
}
132-
print_dev_info(&info, busid, dev, 0);
132+
/*print_dev_info(&info, busid, dev, 0);*/
133133

134134
count = 1;
135135

@@ -138,7 +138,7 @@ static int enum_dev(int busid, int dev)
138138
if(read_dev_info(&info, busid, dev, i) == -1) {
139139
continue;
140140
}
141-
print_dev_info(&info, busid, dev, i);
141+
/*print_dev_info(&info, busid, dev, i);*/
142142
count++;
143143
}
144144
}

src/test/vbetest.c

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -176,24 +176,7 @@ static void draw_cursor(int x, int y, uint16_t col)
176176
static int click_sound_callback(void *buffer, int size, void *cls)
177177
{
178178
if(click) {
179-
int i;
180-
signed char *ptr = buffer;
181-
signed char *src = snd_click;
182-
/*
183-
for(i=0; i<size; i++) {
184-
if((i / 32) & 1) {
185-
*ptr++ = -64;
186-
} else {
187-
*ptr++ = 64;
188-
}
189-
}
190-
*/
191-
/*memcpy(buffer, snd_click, snd_click_size);*/
192-
193-
for(i=0; i<snd_click_size; i++) {
194-
*ptr++ = *src++;
195-
}
196-
179+
memcpy(buffer, snd_click, snd_click_size);
197180
click = 0;
198181
return snd_click_size;
199182
}

0 commit comments

Comments
 (0)