From: Richard Miller <miller@hamnavoe.demon.co.uk>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] SB16
Date: Fri, 2 Nov 2001 15:22:51 +0000 [thread overview]
Message-ID: <20011102161329.B21EF1998A@mail.cse.psu.edu> (raw)
[-- Attachment #1: Type: text/plain, Size: 470 bytes --]
> There's an sbpro driver for 2nd Edition on Charles Forsyth's Plan 9 software
> page. It may be a SMOP to port it to 3rd Edition.
Here's an update to the 3rd edition version of /sys/src/9/port/devaudio.c for
sbpro support. It's been found to work on a real sbpro and at least two
impostors; it doesn't work on the Thinkpad T21.
I think my resampling of sound data in b8to16() and b16to8() isn't quite right.
Would somebody like to comment?
-- Richard
[-- Attachment #2: devaudio.bod --]
[-- Type: text/plain, Size: 5196 bytes --]
#!/bin/rc
#
# command: /bin/boddle /sys/src/9/port/devaudio.c devaudio.c
# srcdir: /sys/src/9/port
# version: 1004714078
# date: Fri Nov 2 15:14:38 GMT 2001
#
myname=$0
doextract=no
fn usage{
echo $myname: usage: $myname '[-X] [src-directory]' >[1=2]
exit usage
}
fn sigint{
rm -rf 1004714078
exit interrupt
}
while(~ $1 -*){
switch($1){
case -X
doextract=yes
case -*
usage
}
shift
}
switch($#*){
case 0
srcdir=/sys/src/9/port
case 1
srcdir=$1
case *
usage
}
if(! ~ $doextract yes){
echo This shell file contains a bundle of diffs representing changes
echo to original source files in the Plan 9 distribution. It will run
echo against the files in
echo ' ' $srcdir
echo '(unless overridden by the optional source directory argument)'
echo and create a directory 1004714078 containing the updated files.
echo It will NOT automatically update the original files.
echo
echo Invoke with argument -X to perform the actual extraction.
exit 0
}
rm -rf 1004714078
mkdir 1004714078
target=1004714078/devaudio.c
echo -n '1004714078/devaudio.c: '
if(! test -f $srcdir/devaudio.c || ! test -r $srcdir/devaudio.c){
echo $srcdir/devaudio.c unreadable
exit unreadable
}
sum=`{sum < $srcdir/devaudio.c}
if(! ~ 010c638720395 $sum(1)^$sum(2)){
echo $srcdir/devaudio.c is not the original distribution file
exit original
}
cp $srcdir/devaudio.c 1004714078/devaudio.c
sed s/.// <<'//GO.SYSIN DD VADIM devaudio.c' | ed 1004714078/devaudio.c >/dev/null >[2=1]
-1203a
-}
-
-static void
-b8to16(uchar *a)
-{
- uchar *p, *q;
-
- p = a + Bufsize/2;
- q = a + Bufsize - 2;
- do {
- q[1] = (*--p)^0x80;
- q[0] = 0;
- } while ((q -= 2) >= a);
-}
-
-static void
-b16to8(uchar *a)
-{
- uchar *p, *ep, *q;
-
- p = a + 1;
- ep = a + Bufsize;
- q = a - 1;
- do
- *++q = *p^0x80;
- while ((p += 2) < ep);
-.
-1175c
- if(audio.major == 3)
- b16to8(b->virt);
- else
- swab(b->virt);
-.
-987c
- if(audio.major == 3)
- b8to16(b->virt);
- else
- swab(b->virt);
-.
-928c
- if(audio.major == 3)
- b16to8(b->virt);
- else
- swab(b->virt);
-.
-861c
- if(audio.major != 4 && audio.major != 3)
-.
-833a
- }
-
-.
-819a
- if(audio.major == 4) {
-
-.
-793d
-788,789c
- if(audio.major == 3) {
- if(audio.minor == 1 && !ess1688(&sbconf))
- audio.major = 4;
- else
- blaster.startdma = sbprostartdma;
- } else {
- print("#A: model 0x%.2x 0x%.2x; not SB 16/PRO compatible\n",
-.
-730c
- if(cistrcmp(sbconf.type, "sbpro") == 0)
- sbconf.dma = 1;
- else if((cistrcmp(sbconf.type, "sb16") != 0) && (cistrcmp(sbconf.type, "ess1688") != 0))
-.
-410a
-static void
-sbprostartdma(void)
-{
- ulong count;
- int speed;
-
- ilock(&blaster);
- dmaend(blaster.dma);
- if(audio.amode == Aread) {
- sbcmd(0xd3); /* speaker off */
- speed = audio.livol[Vspeed];
- } else {
- sbcmd(0xd1); /* speaker on */
- speed = audio.lovol[Vspeed];
- }
- speed *= 2;
- sbcmd(0x40);
- sbcmd((65536 - 256000000/speed) >> 8);
-
- count = (Bufsize >> 1) - 1;
- sbcmd(0x48); /* block size */
- sbcmd(count);
- sbcmd(count>>8);
- if(audio.amode == Aread) {
- sbcmd(0xa8); /* stereo */
- sbcmd(0x98); /* high speed input, autoinit */
- } else {
- mxcmd(0x0e, mxread(0x0e)|0x22); /* stereo, no output filter */
- sbcmd(0x90); /* high speed output, autoinit */
- }
-
- audio.active = 1;
- audio.tottime = todget(nil);
- contindma();
- iunlock(&blaster);
-}
-
-.
-369a
- }
-.
-367a
- if(audio.major == 3) { /* sbpro */
- outb(blaster.reset, 1);
- microdelay(3);
- outb(blaster.reset, 0);
- } else { /* sb16 */
-.
-361c
- if(dmasetup(blaster.dma, b->virt, (audio.major == 3? Bufsize/2 : Bufsize), audio.amode == Aread) >= 0)
-.
-304a
- break;
-
- case 3: /* sbpro */
-
- mxcmd(0x22, 255); /* left/right master */
- mxcmds2(0x04, left[Vaudio], right[Vaudio]);
- mxcmds2(0x26, left[Vsynth], right[Vsynth]);
- mxcmds2(0x28, left[Vcd], right[Vcd]);
- mxcmds2(0x2e, left[Vline], right[Vline]);
- mxcmdss(0x0a, left[Vmic]);
-
- source = 0;
- if(audio.livol[Vcd])
- source = 2;
- else if(audio.livol[Vline])
- source = 6;
- mxcmd(0x0c, 0x20|source); /* no input filter */
- break;
- }
-
-.
-255a
- switch (audio.major) {
- case 4: /* sb16 */
-
-.
-229a
-mxcmds2(int s, int v, int w)
-{
-
- if(v > 100)
- v = 100;
- if(v < 0)
- v = 0;
- if(w > 100)
- w = 100;
- if(w < 0)
- w = 0;
- mxcmd(s, (((v*15)/100)<<4) | ((w*15)/100));
-}
-
-static void
-mxcmdss(int s, int v)
-{
- if(v > 100)
- v = 100;
- if(v < 0)
- v = 0;
- mxcmd(s, (v*7)/100);
-}
-
-static void
-.
-132a
-static void b16to8(uchar*);
-static void b8to16(uchar*);
-.
-79,80c
- int major; /* SB major version number (sb16=4, sbpro=3) */
- int minor; /* SB minor version number */
-.
-wq
//GO.SYSIN DD VADIM devaudio.c
sum=`{sum < 1004714078/devaudio.c}
if(~ 0d74360d22810 $sum(1)^$sum(2))
echo
if not{
echo 1004714078/devaudio.c checksum error creating updated file
exit checksum
}
next reply other threads:[~2001-11-02 15:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-02 15:22 Richard Miller [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-01-26 0:01 [9fans] sb16 gas
2008-01-26 0:07 ` Pietro Gagliardi
2008-01-26 0:25 ` gas
2008-01-26 0:40 ` Tharaneedharan Vilwanathan
2008-01-26 14:28 ` Russ Cox
2008-01-26 16:16 ` gas
2001-11-01 3:42 [9fans] SB16 Carlos Eduardo Lenz
2001-11-01 2:57 okamoto
2001-11-01 13:31 ` plan9
2001-11-02 3:54 ` Carlos Eduardo Lenz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20011102161329.B21EF1998A@mail.cse.psu.edu \
--to=miller@hamnavoe.demon.co.uk \
--cc=9fans@cse.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).