3 BOOLEAN
DMAOutputISR(PKINTERRUPT Interrupt
, PVOID ServiceContext
)
9 void sb16_play(WAVE_HDR
* wave
)
15 PKINTERRUPT IrqObject
;
16 unsigned int mask
,newmask
;
19 unsigned int tmp
[255];
24 tmp
[i
++]=get_dma_page(0x0fffff+IDMAP_BASE
);
25 printk("0x%x ",tmp
[i
-1]);
27 while((tmp
[i
-1]&0xffff)!=0);
28 free_page((tmp
[0])-IDMAP_BASE
,i
-1);
29 sb16
.buffer
=((unsigned char*)tmp
[i
-1]);
32 * Because this is used by alomost every subsystem including irqs it
33 * must be atomic. The following code sequence disables interrupts after
34 * saving the previous state of the interrupt flag
37 __asm__("pushf\n\tpop %0\n\tcli\n\t"
41 memcpy(sb16
.buffer
,(&wave
->data
),wave
->dLen
);
44 MappedIrq
= HalGetInterruptVector(Internal
,0,0,8+sb16
.irq
,&Dirql
,&Affinity
);
48 IoConnectInterrupt(&IrqObject
,DMAOutputISR
,0,NULL
,MappedIrq
,Dirql
,Dirql
,0,FALSE
,Affinity
,FALSE
);
51 newmask
=((int)1<<sb16
.irq
);
52 outb(0x21,(mask
&~newmask
));
54 // Restore the interrupt flag
55 __asm__("push %0\n\tpopf\n\t"
61 disable_dma(sb16
.dma8
);
65 set_dma_count(1,wave
->dLen
);
66 set_dma_mode(1,DMA_MODE_WRITE
);
68 //outb(0x3,(wave->dLen)&0xff);
69 //outb(0x3,((unsigned int)(wave->dLen)>>8)&0xff);
70 set_dma_addr(sb16
.dma8
,(unsigned int)sb16
.buffer
-IDMAP_BASE
);
71 //outb(0x83,(((unsigned int)(sb16.buffer-IDMAP_BASE)>>16))&0xf);
72 //outb(0x2,((unsigned int)sb16.buffer&0xff));
73 //outb(0x2,(((unsigned int)(sb16.buffer-IDMAP_BASE)>>8))&0xff);
74 enable_dma(sb16
.dma8
);
77 write_dsp(sb16
.base
,0x00D1);
79 write_dsp(sb16
.base
,0x40);
80 write_dsp(sb16
.base
,((unsigned char)256-(1000000/wave
->nSamplesPerSec
)));
82 outb(sb16
.base
+ 4, (int) 0xa);
83 outb(sb16
.base
+ 5, (int) 0x00);
85 outb(sb16
.base
+ 4, (int) 4);
86 outb(sb16
.base
+ 5, (int) 0xFF);
88 outb(sb16
.base
+ 4, (int) 0x22);
89 outb(sb16
.base
+ 5, (int) 0xFF);
91 write_dsp(sb16
.base
,0x14);
92 write_dsp(sb16
.base
,(wave
->dLen
&0x00ff));
93 write_dsp(sb16
.base
,((wave
->dLen
)&0xff00)>>8);
95 // write_dsp(sb16.base,0xc0);
96 // write_dsp(sb16.base,0x0);
97 // OldIRQ=HalGetInterruptVector(Internal,0,0,irq+8,&irql,&affinity);
98 // printk("OldIRQ: 0x%x\n",OldIRQ);
100 // status=IoConnectInterrupt(&IrqObject,playRoutine,0,NULL,OldIRQ,irql,irql,0,FALSE,affinity,FALSE);
101 // if(status!=STATUS_SUCCESS) printk("Couldn't set irq\n");
102 // else printk("IRQ set\n");
106 void dump_wav(WAVE_HDR
* wave
)
108 printk("wave.rID: %c%c%c%c\n",wave
->rID
[0],wave
->rID
[1],wave
->rID
[2],wave
->rID
[3]);
109 printk("wave.rLen: 0x%x\n",wave
->rLen
);
110 printk("wave.wID: %c%c%c%c\n",wave
->wID
[0],wave
->wID
[1],wave
->wID
[2],wave
->wID
[3]);
111 printk("wave.fID: %c%c%c%c\n",wave
->fID
[0],wave
->fID
[1],wave
->fID
[2],wave
->fID
[3]);
112 printk("wave.fLen: 0x%x\n",wave
->fLen
);
113 printk("wave.wFormatTag: 0x%x\n",wave
->wFormatTag
);
114 printk("wave.nChannels: 0x%x\n",wave
->nChannels
);
115 printk("wave.nSamplesPerSec: 0x%x\n",wave
->nSamplesPerSec
);
116 printk("wave.nAvgBytesPerSec: 0x%x\n",wave
->nAvgBytesPerSec
);
117 printk("wave.nBlockAlign: 0x%x\n",wave
->nBlockAlign
);
118 printk("wave.FormatSpecific: 0x%x\n",wave
->FormatSpecific
);
119 printk("wave.dID: %c%c%c%c\n",wave
->dID
[0],wave
->dID
[1],wave
->dID
[2],wave
->dID
[3]);
120 printk("wave.dLen: 0x%x\n",wave
->dLen
);
123 BOOLEAN
playRoutine(PKINTERRUPT Interrupt
,PVOID ServiceContext
)