[alsa-devel] [PATCH RFC 01/11] ALSA: pcm: introduce an alias of prototype to copy PCM frames

Takashi Sakamoto o-takashi at sakamocchi.jp
Wed May 24 02:52:45 CEST 2017


Usage of the same function prototype between core and driver implementation
dedicates code lucidity. Especially, in a view of device driver developers,
if core implementation includes functions with the prototype, it's good
examples.

In current design of ALSA PCM core, when devices doesn't use DMA between
kernel space and device memory or platforms don't have good cache coherent
protocol, then drivers need to have own implementation for data
transmittion, without existent implementation inner ALSA PCM core.

However, for this purpose, ALSA PCM core includes inefficient
implementation. Additionally, in a point to which I addressed, it includes
complicated codes.

This commit introduces 'snd_pcm_copy_frames_t' to produce unified
interface for the devices and core implementations.

Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
---
 include/sound/pcm.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index c609b891c4c2..6cb8df081787 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -63,6 +63,10 @@ struct snd_pcm_substream;
 struct snd_pcm_audio_tstamp_config; /* definitions further down */
 struct snd_pcm_audio_tstamp_report;
 
+typedef int (*snd_pcm_copy_frames_t)(struct snd_pcm_substream *substream,
+				     unsigned int hwoff, unsigned int long data,
+				     unsigned int off, snd_pcm_uframes_t count);
+
 struct snd_pcm_ops {
 	int (*open)(struct snd_pcm_substream *substream);
 	int (*close)(struct snd_pcm_substream *substream);
-- 
2.11.0



More information about the Alsa-devel mailing list