Skip to contentSkip to conversation

Suggestion regarding alsa driver writing documentation.

DISCUSSION James Courtier-Dutton 2 participants 2 messages May 8, 2004 – May 10, 2004

lore
Share & tools
lore
#0 lore raw

I have been helping some people with writing alsa drivers.
One thing that they did not totally understand from the alsa documentation was the concept of frames. To help with this, could we add a html link between in the following document: -
http://www.alsa-project.org/~iwai/writing-an-alsa-driver/x490.htm

In section: -
/* pointer callback */

pointing to: -
http://www.alsa-project.org/~iwai/writing-an-alsa-driver/x537.htm

In Section: -
PCM Configurations

Where it explains about what a "frame" is.
I think it would be helpful to also explain that the document: -
http://www.alsa-project.org/~iwai/writing-an-alsa-driver/x490.htm

has a line: -
current_ptr = mychip_get_hw_pointer(chip);

I think that comments should be added close to that line to say: -
"
The pointer value obtained from the hardware is likely to be a byte offset within the buffer. In order to convert this value to a type "snd_pcm_uframes_t" , that is required as the return value, use the following code: - return bytes_to_frames(substream->runtime, pointer);

An explanation of what a "frame" is can be found at http://xyz
"

Or just change the document example code: -
/* pointer callback */
static snd_pcm_uframes_t snd_mychip_pcm_pointer(snd_pcm_substream_t *substream)

  {
          mychip_t *chip = snd_pcm_substream_chip(substream);

- unsigned int current_ptr;
+ unsigned int current_byte_ptr;

          // get the current hardware pointer
-          current_ptr = mychip_get_hw_pointer(chip);
-          return current_ptr;
+          current_byte_ptr = mychip_get_hw_pointer(chip);
+          return bytes_to_frames(substream->runtime, current_byte_ptr);
  }

Cheers
James

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3

#1 lore raw

Hi James,

could you create a patch to the source (alsa-kernel/Documentation/DocBook/writing-an-alsa-driver.tmpl)?

it's just a DocBook format. the tmpl extension is used to allow the inclusion from the kernel source, although this document doesn't do it.

thank,s

Takashi

At Sat, 08 May 2004 19:33:51 +0000,

Quoted 57 lines · James Courtier-Dutton

I have been helping some people with writing alsa drivers. One thing that they did not totally understand from the alsa documentation was the concept of frames.
To help with this, could we add a html link between in the following
document: -
http://www.alsa-project.org/~iwai/writing-an-alsa-driver/x490.htm

In section: -
/* pointer callback */

pointing to: -
http://www.alsa-project.org/~iwai/writing-an-alsa-driver/x537.htm

In Section: -
PCM Configurations

Where it explains about what a "frame" is.
I think it would be helpful to also explain that the document: -
http://www.alsa-project.org/~iwai/writing-an-alsa-driver/x490.htm

has a line: -
current_ptr = mychip_get_hw_pointer(chip);

I think that comments should be added close to that line to say: - "
The pointer value obtained from the hardware is likely to be a byte offset within the buffer. In order to convert this value to a type "snd_pcm_uframes_t" , that is required as the return value, use the following code: -
return bytes_to_frames(substream->runtime, pointer);

An explanation of what a "frame" is can be found at http://xyz
"

Or just change the document example code: -
/* pointer callback */
static snd_pcm_uframes_t snd_mychip_pcm_pointer(snd_pcm_substream_t *substream)

   {
           mychip_t *chip = snd_pcm_substream_chip(substream);
(quoted diff) +3 -3
-          unsigned int current_ptr;
+          unsigned int current_byte_ptr;
 
           // get the current hardware pointer
-          current_ptr = mychip_get_hw_pointer(chip);
-          return current_ptr;
+          current_byte_ptr = mychip_get_hw_pointer(chip);
+          return bytes_to_frames(substream->runtime, current_byte_ptr);
 
   }

Cheers
James

Quoted 10 lines

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3