Date: Fri, 11 Dec 1998 20:21:22 -0600 From: David Kelly <dkelly@hiwaay.net> To: freebsd-hardware@FreeBSD.ORG Subject: Re: sane sound cards? Message-ID: <199812120221.UAA99134@n4hhe.ampr.org> In-Reply-To: Message from richard@pegasus.com (Richard Foulk) of "Fri, 11 Dec 1998 15:45:20 -1000." <199812120145.PAA10540@pegasus.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Richard Foulk writes: > DMA helps make transfers faster and more efficient. But the time > between DMA transfers is completely indeterminate under most Unixes, > (Windows too.) Its a PC hardware problem. I doubt software has anything to do with it. > Sound production is a realtime process. External (to the OS) buffering > is the best way to try to connect a realtime I/O process to non-realtime > operating systems. [...] > I don't think you understand how DMA works. Since the transfer is > limited to the buffer on the card it can only transfer tiny bits of data > at a time. One of us doesn't understand. I haven't participated so far. > You can't DMA a megabyte buffer full of data to a card that doesn't have > any place to put it. I wouldn't want to. If the card had someplace to put it I would rather the CPU copy that much using an interuptable instruction sequence. > So a five minute song is going to take roughly > 100,000 separate DMA transfers. That's 100,000 chances for another > process to keep the CPU busy long enough for the sound card to run out > of data. 64 bytes is only a few milliseconds of play time. Unacceptable. A busy CPU has little to do with DMA. The CPU sees wait states during DMA. The only time the CPU comes into play is on IRQ when the DMA controller indicates a DMA buffer is exhausted. *Then* one has an opportunity to drop bits going to the sound card. A solution (that might already be in use, assuming this situation is a real problem) would be for a driver to allocate two physical DMA buffer regions and ping-pong between. Fill one, start the sound running from it, while filling the second. When the first empties move the DMA pointers to the 2nd. Then refill the first. Etc. With only one DMA buffer when it empties one might have to fill it from HD. But here we're over my head. Isn't there a half-full flag or some such on the DMA? Something else to consider: DMA cycles on the ISA bus force your system to slow to 8MHz. Maybe the CPU can run at full speed thru an external DMA cycle if the CPU is running from its cache. I've been using Luigi's sound code to put myself to sleep at night. Its pretty well written so its not that good as a sleep inducer. Haven't studied the DMA section as I've been concentrating on the Crystal Semiconductor probe and initialization. -- David Kelly N4HHE, dkelly@nospam.hiwaay.net ===================================================================== The human mind ordinarily operates at only ten percent of its capacity -- the rest is overhead for the operating system. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hardware" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812120221.UAA99134>