From owner-freebsd-bugs Sun Nov 19 3:50:15 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 5531237B479 for ; Sun, 19 Nov 2000 03:50:04 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id DAA35233; Sun, 19 Nov 2000 03:50:04 -0800 (PST) (envelope-from gnats@FreeBSD.org) Date: Sun, 19 Nov 2000 03:50:04 -0800 (PST) Message-Id: <200011191150.DAA35233@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: oh Subject: Re: kern/22874: newpcm CS461x sound problems Reply-To: oh Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR kern/22874; it has been noted by GNATS. From: oh To: freebsd-gnats-submit@FreeBSD.org Cc: Subject: Re: kern/22874: newpcm CS461x sound problems Date: Sun, 19 Nov 2000 11:45:56 +0000 This is a multi-part message in MIME format. --------------A6AB57816D389CF3F9D7AC4B Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit This driver also fails to work in full duplex mode, blocking or non-blocking, on Lars' machine. Lars reported that rat did not work with this driver and so we've conducted a few experiments (rat problems mostly caused card by not supporting 8kHz sampling and newpcm accepting and reporting this as an acceptable rate, rat driver interface fixed and patch submitted to check rate bounds in dsp.c). The attached test program results in read buffer overruns, causing dump messages on syslog, at the lowest supported sampling rate (11025kHz). Lars observes: > [larse@hbo: ~] ./a.out -r 11025 > Device Caps: > Sample rates: 11025 -- 48000 Hz > Formats: 0x90000010 > DMA buffer size: 65536 bytes > Mixers: 0x00000001 Inputs: 0x017049f1 > Levels: 100 (left), 100 (right) > Set play rate 11025 fmt 16 > Set record rate 11025 fmt 16 > Got play rate 11025 fmt 16 > Got record rate 11025 fmt 16 > Block size requested 1024, play 1024, rec 1024 > Output buffer status: frags 2 frags total 2 fragsize 1024 bytes 2048 > Input buffer status: frags 0 frags total 2 fragsize 1024 bytes 0 > |^C > > Saw this in syslog during that run: > Nov 17 10:14:10 hbo /kernel: pcm0: record overrun, dumping 22528 bytes > Nov 17 10:14:26 hbo last message repeated 16 times Kind Regards - Orion --------------A6AB57816D389CF3F9D7AC4B Content-Type: text/plain; charset=us-ascii; name="full-duplex-blocking-audio-test3.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="full-duplex-blocking-audio-test3.c" #include #include #include #include #include #include #include #define SAMPLE_BLKSZ 1024 #define AUDIO_IOCTL(fd, cmd, val) \ if (ioctl((fd), (cmd), (val)) < 0) { \ fprintf(stderr, "Failed %s - line %d\n",#cmd, __LINE__); \ exit(EX_UNAVAILABLE); \ } static void progress() { const char sym[]="-\\|/"; static int n; int m = n % (sizeof(sym) - 1); if (n == 0) { printf(" "); } printf("%c%c", '\b', sym[m]); fflush(stdout); n++; } int main(int argc, char *argv[]) { char *thedev = "/dev/audio"; uint16_t buf[SAMPLE_BLKSZ]; int c, fd, rlen, wlen, rate = 8000; while((c = getopt(argc, argv, "f:r:")) != -1) { switch(c) { case 'f': thedev = optarg; break; case 'r': rate = atoi(optarg); break; default: fprintf(stderr, "%s -f flag specifies audio device to test.\n", argv[0]); exit(EX_USAGE); } } fd = open(thedev, O_RDWR); if (fd > 0) { snd_chan_param pa; struct snd_size sz; audio_buf_info abi; snd_capabilities sc; int fragsz; AUDIO_IOCTL(fd, AIOGCAP, &sc); printf("Device Caps:\n\tSample rates: %d -- %d Hz\n", sc.rate_min, sc.rate_max); printf("\tFormats: 0x%08x\n\tDMA buffer size: %d bytes\n", sc.formats, sc.bufsize); printf("\tMixers: 0x%08x Inputs: 0x%08x\n", sc.mixers, sc.inputs); printf("\tLevels: %d (left), %d (right)\n", sc.left, sc.right); pa.play_rate = rate; pa.play_format = AFMT_S16_LE; pa.rec_rate = rate; pa.rec_format = AFMT_S16_LE; AUDIO_IOCTL(fd, AIOSFMT, &pa); fprintf(stdout, "Set play rate %d fmt %d\n", pa.play_rate, pa.play_format); fprintf(stdout, "Set record rate %d fmt %d\n", pa.rec_rate, pa.rec_format); AUDIO_IOCTL(fd, AIOGFMT, &pa); fprintf(stdout, "Got play rate %d fmt %d\n", pa.play_rate, pa.play_format); fprintf(stdout, "Got record rate %d fmt %d\n", pa.rec_rate, pa.rec_format); /* Put device in block mode and set block size */ sz.play_size = SAMPLE_BLKSZ; sz.rec_size = SAMPLE_BLKSZ; /* AUDIO_IOCTL(fd, AIOSSIZE, &sz); */ AUDIO_IOCTL(fd, AIOGSIZE, &sz); fprintf(stdout, "Block size requested %d, play %d, rec %d\n", SAMPLE_BLKSZ, sz.play_size, sz.rec_size); /* Set large number of fragment */ fragsz = SAMPLE_BLKSZ; AUDIO_IOCTL(fd, SNDCTL_DSP_SETFRAGMENT, &fragsz); AUDIO_IOCTL(fd, SNDCTL_DSP_GETOSPACE, &abi); fprintf(stdout, "Output buffer status: frags %d frags total %d fragsize %d bytes %d\n", abi.fragments, abi.fragstotal, abi.fragsize, abi.bytes); AUDIO_IOCTL(fd, SNDCTL_DSP_GETISPACE, &abi); fprintf(stdout, "Input buffer status: frags %d frags total %d fragsize %d bytes %d\n", abi.fragments, abi.fragstotal, abi.fragsize, abi.bytes); memset(buf, 0, sizeof(buf) / sizeof(buf[0])); while((rlen = read(fd, buf, sizeof(buf))) > 0) { fprintf(stderr, "Read %d\n", rlen); progress(); wlen = write(fd, buf, rlen); if (wlen != rlen) { fprintf(stderr, "write failed %d != %d\n", wlen, rlen); exit(EX_IOERR); } } } else { fprintf(stderr, "Could not open %s O_RDWR\n", thedev); exit(EX_OSFILE); } return 0; } --------------A6AB57816D389CF3F9D7AC4B-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message