merge
This commit is contained in:
parent
d11cd06c10
commit
585c561e85
2 changed files with 28 additions and 29 deletions
|
@ -65,7 +65,6 @@ static struct
|
||||||
QLock;
|
QLock;
|
||||||
Rendez vous;
|
Rendez vous;
|
||||||
int buffered; /* number of bytes en route */
|
int buffered; /* number of bytes en route */
|
||||||
int bufinit; /* boolean if buffers allocated */
|
|
||||||
int curcount; /* how much data in current buffer */
|
int curcount; /* how much data in current buffer */
|
||||||
int active; /* boolean dma running */
|
int active; /* boolean dma running */
|
||||||
int intr; /* boolean an interrupt has happened */
|
int intr; /* boolean an interrupt has happened */
|
||||||
|
@ -147,7 +146,7 @@ sbcmd(int val)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* print("#A%d: sbcmd (%#.2x) timeout\n", audio.ctlrno, val); /**/
|
print("#A%d: sbcmd (%#.2x) timeout\n", audio.ctlrno, val); /**/
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +161,7 @@ sbread(void)
|
||||||
return inb(blaster.read);
|
return inb(blaster.read);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* print("#A%d: sbread did not respond\n", audio.ctlrno); /**/
|
print("#A%d: sbread did not respond\n", audio.ctlrno); /**/
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,7 +364,7 @@ contindma(void)
|
||||||
audio.current = b;
|
audio.current = b;
|
||||||
if(b == 0)
|
if(b == 0)
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
|
iprint("d");
|
||||||
if(dmasetup(blaster.dma, b->virt, Bufsize, 0) >= 0)
|
if(dmasetup(blaster.dma, b->virt, Bufsize, 0) >= 0)
|
||||||
return;
|
return;
|
||||||
print("#A%d: dmasetup fail\n", audio.ctlrno);
|
print("#A%d: dmasetup fail\n", audio.ctlrno);
|
||||||
|
@ -406,7 +405,7 @@ sb16startdma(void)
|
||||||
sbcmd(0xbe); /* A/D, autoinit */
|
sbcmd(0xbe); /* A/D, autoinit */
|
||||||
else
|
else
|
||||||
sbcmd(0xb6); /* D/A, autoinit */
|
sbcmd(0xb6); /* D/A, autoinit */
|
||||||
sbcmd(0x30); /* stereo, 16 bit */
|
sbcmd(0x30); /* stereo, signed 16 bit */
|
||||||
sbcmd(count);
|
sbcmd(count);
|
||||||
sbcmd(count>>8);
|
sbcmd(count>>8);
|
||||||
|
|
||||||
|
@ -522,6 +521,7 @@ sb16intr(void)
|
||||||
int stat, dummy;
|
int stat, dummy;
|
||||||
|
|
||||||
stat = mxread(0x82) & 7; /* get irq status */
|
stat = mxread(0x82) & 7; /* get irq status */
|
||||||
|
iprint("i%d",stat);
|
||||||
if(stat) {
|
if(stat) {
|
||||||
dummy = 0;
|
dummy = 0;
|
||||||
if(stat & 2) {
|
if(stat & 2) {
|
||||||
|
@ -588,7 +588,7 @@ anybuf(void*)
|
||||||
* wait for some output to get
|
* wait for some output to get
|
||||||
* empty buffers back.
|
* empty buffers back.
|
||||||
*/
|
*/
|
||||||
static void
|
static int
|
||||||
waitaudio(void)
|
waitaudio(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -596,10 +596,10 @@ waitaudio(void)
|
||||||
pokeaudio();
|
pokeaudio();
|
||||||
tsleep(&audio.vous, anybuf, 0, 10000);
|
tsleep(&audio.vous, anybuf, 0, 10000);
|
||||||
if(audio.intr == 0) {
|
if(audio.intr == 0) {
|
||||||
/* print("#A%d: audio timeout\n", audio.ctlrno); /**/
|
print("#A%d: audio timeout\n", audio.ctlrno); /**/
|
||||||
audio.active = 0;
|
return -1;
|
||||||
pokeaudio();
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -690,7 +690,7 @@ audiostatus(Audio *, void *a, long n, vlong off)
|
||||||
}
|
}
|
||||||
|
|
||||||
static long
|
static long
|
||||||
audiowrite(Audio *, void *vp, long n, vlong off)
|
audiowrite(Audio *, void *vp, long n, vlong)
|
||||||
{
|
{
|
||||||
long m, n0;
|
long m, n0;
|
||||||
Buf *b;
|
Buf *b;
|
||||||
|
@ -704,22 +704,15 @@ audiowrite(Audio *, void *vp, long n, vlong off)
|
||||||
nexterror();
|
nexterror();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(off == 0){
|
|
||||||
if(audio.bufinit == 0) {
|
|
||||||
audio.bufinit = 1;
|
|
||||||
sbbufinit();
|
|
||||||
}
|
|
||||||
setempty();
|
|
||||||
audio.curcount = 0;
|
|
||||||
mxvolume();
|
|
||||||
}
|
|
||||||
|
|
||||||
while(n > 0) {
|
while(n > 0) {
|
||||||
b = audio.filling;
|
b = audio.filling;
|
||||||
if(b == 0) {
|
if(b == 0) {
|
||||||
b = getbuf(&audio.empty);
|
b = getbuf(&audio.empty);
|
||||||
if(b == 0) {
|
if(b == 0) {
|
||||||
waitaudio();
|
if(waitaudio() < 0){
|
||||||
|
audio.active = 0;
|
||||||
|
pokeaudio();
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
audio.filling = b;
|
audio.filling = b;
|
||||||
|
@ -752,6 +745,10 @@ static void
|
||||||
audioclose(Audio *)
|
audioclose(Audio *)
|
||||||
{
|
{
|
||||||
qlock(&audio);
|
qlock(&audio);
|
||||||
|
if(waserror()){
|
||||||
|
qunlock(&audio);
|
||||||
|
nexterror();
|
||||||
|
}
|
||||||
if(1) {
|
if(1) {
|
||||||
Buf *b;
|
Buf *b;
|
||||||
|
|
||||||
|
@ -767,13 +764,10 @@ audioclose(Audio *)
|
||||||
if(!audio.active && audio.full.first)
|
if(!audio.active && audio.full.first)
|
||||||
pokeaudio();
|
pokeaudio();
|
||||||
}
|
}
|
||||||
if(waserror()){
|
while(audio.active && waitaudio() == 0)
|
||||||
qunlock(&audio);
|
;
|
||||||
nexterror();
|
|
||||||
}
|
|
||||||
while(audio.active)
|
|
||||||
waitaudio();
|
|
||||||
setempty();
|
setempty();
|
||||||
|
audio.curcount = 0;
|
||||||
poperror();
|
poperror();
|
||||||
qunlock(&audio);
|
qunlock(&audio);
|
||||||
}
|
}
|
||||||
|
@ -918,7 +912,7 @@ audioprobe(Audio *adev)
|
||||||
resetlevel();
|
resetlevel();
|
||||||
|
|
||||||
outb(blaster.reset, 1);
|
outb(blaster.reset, 1);
|
||||||
delay(1); /* >3 υs */
|
delay(3); /* >3 υs */
|
||||||
outb(blaster.reset, 0);
|
outb(blaster.reset, 0);
|
||||||
delay(1);
|
delay(1);
|
||||||
|
|
||||||
|
@ -991,6 +985,11 @@ audioprobe(Audio *adev)
|
||||||
|
|
||||||
dmainit(blaster.dma, Bufsize);
|
dmainit(blaster.dma, Bufsize);
|
||||||
intrenable(sbconf.irq, pcaudiosbintr, 0, BUSUNKNOWN, "sb16");
|
intrenable(sbconf.irq, pcaudiosbintr, 0, BUSUNKNOWN, "sb16");
|
||||||
|
|
||||||
|
sbbufinit();
|
||||||
|
setempty();
|
||||||
|
mxvolume();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ dev
|
||||||
aoe
|
aoe
|
||||||
lpt
|
lpt
|
||||||
|
|
||||||
audio
|
audio dma
|
||||||
pccard
|
pccard
|
||||||
i82365 cis
|
i82365 cis
|
||||||
uart
|
uart
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue