Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jan 2001 12:18:20 -0800
From:      Mike Smith <msmith@freebsd.org>
To:        Steve Price <sprice@hiwaay.net>
Cc:        Dan Nelson <dnelson@emsphone.com>, hackers@FreeBSD.ORG
Subject:   Re: synchronous IO 
Message-ID:  <200101122018.f0CKIKQ00952@mass.osd.bsdi.com>
In-Reply-To: Your message of "Fri, 12 Jan 2001 13:56:05 CST." <20010112135605.J36120@bonsai.knology.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
> Thanks for the info.  I don't think I was very clear in my first
> explanation.  I have an RF transmitter that I control via a serial
> port on a FreeBSD box.  I also have a sound card in that same
> computer connected to the transmitter.  I'm sending commands to
> the transmitter in a sequence that looks like this.
> 
>         DIGITAL_BURST (commands sent via serial port)
>         AUDIO         (.wav files being played by the computer)
>         TEXT_ECHO     (text to display on the radio)
> 
> I use DTR and RTS to control a set of relays in the transmitter to
> select which source of data to broadcast to the radios.  I set the
> bits appropriately and I send the digital burst via the serial port.
> I need to make sure all of these bits have made it to the controller
> before I reset the bits to tell the transmitter to start sending
> the WAV file I'm playing on the computer.  In the same respect I
> need to know when all of the sound data is completely sent so that
> I can put the controller back in serial IO mode and transmit the
> text to display on the radio.

You can ensure the serial output is drained with tcdrain().  There's is 
probably an interface for checking the status of the sound buffer.

Looking in sys/soundcard.h, I would suggest calling SNDCTL_DSP_GETOSPACE 
while the card is idle to determine the total amount of output space, 
then poll while you're waiting for the sample play to end until it 
returns to the "empty" level.

-- 
... every activity meets with opposition, everyone who acts has his
rivals and unfortunately opponents also.  But not because people want
to be opponents, rather because the tasks and relationships force
people to take different points of view.  [Dr. Fritz Todt]
           V I C T O R Y   N O T   V E N G E A N C E




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101122018.f0CKIKQ00952>