On 8/27/2023 7:49 PM, Nathan Hartman wrote:

I don't know whether you've had a chance to read [1] yet, but if not, it
might help visualize the two-part structure of device drivers in NuttX. (If
you've already read it, then never mind, and apologies for the noise. :-)

The audio subsystem is different from typical character drivers (I used the name lower half, but that really isn't really accurate).  It is a chain of audio processing nodes; audio buffers are passed from one node to the next.  Two special nodes are the source and the sink.  The Class D driver is a sink node.  It receives audio buffers and disposes of them... usually by interacting with hardware to "make sounds".

The source node is the one that receives unprocessed audio data. It is audio/audio.c and it registers itself as character driver. It received unprocessed audio data from the application and passes the audio buffers down the chain.

The board level logic can string together the audio processing nodes in most any order.  But only the source node is registered by calling audio_register() in audio/audio.c which registers the character driver in /dev/audio/XXX where only XXX is provided by the board logic.  None of the other nodes are capable of being registered as character devices.

Audio applications like nxplayer may, for example, open a file, read audio data, and pass the audio data to the audio/audio.c driver which will transfer it down the chain, eventually, "playing" the file.

Only the audio/audio.c is registered and it is the only character driver.  It has no lower half.


Reply via email to