mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 17:04:19 +01:00
Fixed acquired dma channel problem.
This commit is contained in:
parent
60dc9be97b
commit
26ed678ef9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=31362
@ -48,6 +48,8 @@ static int dsp_stereo = 0;
|
|||||||
static int dsp_current_speed = 8000;
|
static int dsp_current_speed = 8000;
|
||||||
static int dsp_busy = 0;
|
static int dsp_busy = 0;
|
||||||
static int dma16, dma8;
|
static int dma16, dma8;
|
||||||
|
|
||||||
|
|
||||||
static int trigger_bits = 0;
|
static int trigger_bits = 0;
|
||||||
static u_long dsp_count = 0;
|
static u_long dsp_count = 0;
|
||||||
|
|
||||||
@ -198,6 +200,7 @@ sb16_dsp_open(int dev, int mode)
|
|||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
DEB(printf("sb16_dsp_open()\n"));
|
DEB(printf("sb16_dsp_open()\n"));
|
||||||
|
|
||||||
if (!sb16_dsp_ok) {
|
if (!sb16_dsp_ok) {
|
||||||
printf("SB16 Error: SoundBlaster board not installed\n");
|
printf("SB16 Error: SoundBlaster board not installed\n");
|
||||||
return -(ENXIO);
|
return -(ENXIO);
|
||||||
@ -207,6 +210,7 @@ sb16_dsp_open(int dev, int mode)
|
|||||||
|
|
||||||
sb_reset_dsp();
|
sb_reset_dsp();
|
||||||
|
|
||||||
|
|
||||||
irq_mode = IMODE_NONE;
|
irq_mode = IMODE_NONE;
|
||||||
dsp_busy = 1;
|
dsp_busy = 1;
|
||||||
trigger_bits = 0;
|
trigger_bits = 0;
|
||||||
@ -229,6 +233,8 @@ sb16_dsp_close(int dev)
|
|||||||
|
|
||||||
dsp_cleanup();
|
dsp_cleanup();
|
||||||
dsp_busy = 0;
|
dsp_busy = 0;
|
||||||
|
|
||||||
|
|
||||||
splx(flags);
|
splx(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,10 +243,12 @@ sb16_dsp_output_block(int dev, u_long buf, int count, int intrflag, int dma_rest
|
|||||||
{
|
{
|
||||||
u_long flags, cnt;
|
u_long flags, cnt;
|
||||||
|
|
||||||
|
|
||||||
cnt = count;
|
cnt = count;
|
||||||
if (dsp_16bit)
|
if (dsp_16bit)
|
||||||
cnt >>= 1;
|
cnt >>= 1;
|
||||||
cnt--;
|
cnt--;
|
||||||
|
|
||||||
if (audio_devs[dev]->flags & DMA_AUTOMODE && intrflag && cnt==dsp_count) {
|
if (audio_devs[dev]->flags & DMA_AUTOMODE && intrflag && cnt==dsp_count) {
|
||||||
irq_mode = IMODE_OUTPUT;
|
irq_mode = IMODE_OUTPUT;
|
||||||
intr_active = 1;
|
intr_active = 1;
|
||||||
@ -309,7 +317,20 @@ sb16_dsp_start_input(int dev, u_long buf, int count, int intrflag, int dma_resta
|
|||||||
static int
|
static int
|
||||||
sb16_dsp_prepare_for_input(int dev, int bsize, int bcount)
|
sb16_dsp_prepare_for_input(int dev, int bsize, int bcount)
|
||||||
{
|
{
|
||||||
|
int fudge;
|
||||||
|
struct dma_buffparms *dmap = audio_devs[dev]->dmap_in;
|
||||||
|
|
||||||
audio_devs[my_dev]->dmachan2 = dsp_16bit ? dma16 : dma8;
|
audio_devs[my_dev]->dmachan2 = dsp_16bit ? dma16 : dma8;
|
||||||
|
|
||||||
|
|
||||||
|
fudge = audio_devs[my_dev]->dmachan2 ;
|
||||||
|
|
||||||
|
if (dmap->dma_chan != fudge ) {
|
||||||
|
isa_dma_release( dmap->dma_chan);
|
||||||
|
isa_dma_acquire(fudge);
|
||||||
|
dmap->dma_chan = fudge;
|
||||||
|
}
|
||||||
|
|
||||||
dsp_count = 0;
|
dsp_count = 0;
|
||||||
dsp_cleanup();
|
dsp_cleanup();
|
||||||
if (dsp_16bit)
|
if (dsp_16bit)
|
||||||
@ -325,11 +346,16 @@ static int
|
|||||||
sb16_dsp_prepare_for_output(int dev, int bsize, int bcount)
|
sb16_dsp_prepare_for_output(int dev, int bsize, int bcount)
|
||||||
{
|
{
|
||||||
int fudge = dsp_16bit ? dma16 : dma8;
|
int fudge = dsp_16bit ? dma16 : dma8;
|
||||||
|
struct dma_buffparms *dmap = audio_devs[dev]->dmap_out;
|
||||||
|
|
||||||
isa_dma_release( audio_devs[my_dev]->dmachan1 );
|
if (dmap->dma_chan != fudge ) {
|
||||||
isa_dma_acquire(fudge);
|
isa_dma_release( dmap->dma_chan);
|
||||||
|
isa_dma_acquire(fudge);
|
||||||
|
dmap->dma_chan = fudge;
|
||||||
|
}
|
||||||
|
|
||||||
audio_devs[my_dev]->dmachan1 = fudge;
|
audio_devs[my_dev]->dmachan1 = fudge;
|
||||||
|
|
||||||
dsp_count = 0;
|
dsp_count = 0;
|
||||||
dsp_cleanup();
|
dsp_cleanup();
|
||||||
if (dsp_16bit)
|
if (dsp_16bit)
|
||||||
|
@ -50,6 +50,8 @@
|
|||||||
* variables are put in a struct sb_unit[] array
|
* variables are put in a struct sb_unit[] array
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int sbc_base = 0;
|
int sbc_base = 0;
|
||||||
int sbc_irq = 0;
|
int sbc_irq = 0;
|
||||||
static int open_mode = 0; /* Read, write or both */
|
static int open_mode = 0; /* Read, write or both */
|
||||||
@ -231,7 +233,6 @@ dsp_speed(int speed)
|
|||||||
u_long flags;
|
u_long flags;
|
||||||
int max_speed = 44100;
|
int max_speed = 44100;
|
||||||
|
|
||||||
printf("dsp_speed %d\n", speed); /* XXX lr 970601 */
|
|
||||||
if (speed < 4000)
|
if (speed < 4000)
|
||||||
speed = 4000;
|
speed = 4000;
|
||||||
|
|
||||||
@ -310,7 +311,6 @@ printf("dsp_speed %d\n", speed); /* XXX lr 970601 */
|
|||||||
speed /= 2;
|
speed /= 2;
|
||||||
|
|
||||||
dsp_current_speed = speed;
|
dsp_current_speed = speed;
|
||||||
printf("dsp_speed done %d\n", speed);
|
|
||||||
return speed;
|
return speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,6 +445,9 @@ dsp_cleanup(void)
|
|||||||
static int
|
static int
|
||||||
sb_dsp_prepare_for_input(int dev, int bsize, int bcount)
|
sb_dsp_prepare_for_input(int dev, int bsize, int bcount)
|
||||||
{
|
{
|
||||||
|
int fudge = -1;
|
||||||
|
struct dma_buffparms *dmap = audio_devs[dev]->dmap_in;
|
||||||
|
|
||||||
dsp_cleanup();
|
dsp_cleanup();
|
||||||
dsp_speaker(OFF);
|
dsp_speaker(OFF);
|
||||||
|
|
||||||
@ -470,6 +473,14 @@ sb_dsp_prepare_for_input(int dev, int bsize, int bcount)
|
|||||||
dsp_speed(dsp_current_speed); /* Speed must be recalculated
|
dsp_speed(dsp_current_speed); /* Speed must be recalculated
|
||||||
* if #channels * changes */
|
* if #channels * changes */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fudge = audio_devs[my_dev]->dmachan1;
|
||||||
|
if (dmap->dma_chan != fudge ) {
|
||||||
|
isa_dma_release( dmap->dma_chan);
|
||||||
|
isa_dma_acquire(fudge);
|
||||||
|
dmap->dma_chan = fudge;
|
||||||
|
}
|
||||||
|
|
||||||
trigger_bits = 0;
|
trigger_bits = 0;
|
||||||
sb_dsp_command(DSP_CMD_DMAHALT); /* Halt DMA */
|
sb_dsp_command(DSP_CMD_DMAHALT); /* Halt DMA */
|
||||||
return 0;
|
return 0;
|
||||||
@ -478,6 +489,10 @@ sb_dsp_prepare_for_input(int dev, int bsize, int bcount)
|
|||||||
static int
|
static int
|
||||||
sb_dsp_prepare_for_output(int dev, int bsize, int bcount)
|
sb_dsp_prepare_for_output(int dev, int bsize, int bcount)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
int fudge;
|
||||||
|
struct dma_buffparms *dmap = audio_devs[dev]->dmap_out;
|
||||||
|
|
||||||
dsp_cleanup();
|
dsp_cleanup();
|
||||||
dsp_speaker(ON);
|
dsp_speaker(ON);
|
||||||
|
|
||||||
@ -488,6 +503,7 @@ sb_dsp_prepare_for_output(int dev, int bsize, int bcount)
|
|||||||
* 16 bit specific instructions
|
* 16 bit specific instructions
|
||||||
*/
|
*/
|
||||||
audio_devs[my_dev]->dmachan1 = dsp_16bit ? dma16 : dma8;
|
audio_devs[my_dev]->dmachan1 = dsp_16bit ? dma16 : dma8;
|
||||||
|
|
||||||
if (Jazz16_detected != 2) /* SM Wave */
|
if (Jazz16_detected != 2) /* SM Wave */
|
||||||
sb_mixer_set_stereo(dsp_stereo);
|
sb_mixer_set_stereo(dsp_stereo);
|
||||||
if (dsp_stereo)
|
if (dsp_stereo)
|
||||||
@ -501,6 +517,14 @@ sb_dsp_prepare_for_output(int dev, int bsize, int bcount)
|
|||||||
* if #channels * changes */
|
* if #channels * changes */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
fudge = audio_devs[my_dev]->dmachan1;
|
||||||
|
|
||||||
|
if (dmap->dma_chan != fudge ) {
|
||||||
|
isa_dma_release( dmap->dma_chan);
|
||||||
|
isa_dma_acquire(fudge);
|
||||||
|
dmap->dma_chan = fudge;
|
||||||
|
}
|
||||||
|
|
||||||
trigger_bits = 0;
|
trigger_bits = 0;
|
||||||
sb_dsp_command(DSP_CMD_DMAHALT); /* Halt DMA */
|
sb_dsp_command(DSP_CMD_DMAHALT); /* Halt DMA */
|
||||||
return 0;
|
return 0;
|
||||||
@ -548,6 +572,7 @@ sb_dsp_open(int dev, int mode)
|
|||||||
sb_dsp_busy = 1;
|
sb_dsp_busy = 1;
|
||||||
open_mode = mode;
|
open_mode = mode;
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -569,6 +594,7 @@ sb_dsp_close(int dev)
|
|||||||
sb_dsp_busy = 0;
|
sb_dsp_busy = 0;
|
||||||
sb_dsp_highspeed = 0;
|
sb_dsp_highspeed = 0;
|
||||||
open_mode = 0;
|
open_mode = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef JAZZ16
|
#ifdef JAZZ16
|
||||||
|
Loading…
Reference in New Issue
Block a user