Documentation/sound/designs/tracepoints.rst

Source file repositories/reference/linux-study-clean/Documentation/sound/designs/tracepoints.rst

File Facts

System
Linux kernel
Corpus path
Documentation/sound/designs/tracepoints.rst
Extension
.rst
Size
7967 bytes
Lines
173
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

===================
Tracepoints in ALSA
===================

2017/07/02
Takasahi Sakamoto

Tracepoints in ALSA PCM core
============================

ALSA PCM core registers ``snd_pcm`` subsystem to kernel tracepoint system.
This subsystem includes two categories of tracepoints; for state of PCM buffer
and for processing of PCM hardware parameters. These tracepoints are available
when corresponding kernel configurations are enabled. When ``CONFIG_SND_DEBUG``
is enabled, the latter tracepoints are available. When additional
``SND_PCM_XRUN_DEBUG`` is enabled too, the former trace points are enabled.

Tracepoints for state of PCM buffer
------------------------------------

This category includes four tracepoints; ``hwptr``, ``applptr``, ``xrun`` and
``hw_ptr_error``.

Tracepoints for processing of PCM hardware parameters
-----------------------------------------------------

This category includes two tracepoints; ``hw_mask_param`` and
``hw_interval_param``.

In a design of ALSA PCM core, data transmission is abstracted as PCM substream.
Applications manage PCM substream to maintain data transmission for PCM frames.
Before starting the data transmission, applications need to configure PCM
substream. In this procedure, PCM hardware parameters are decided by
interaction between applications and ALSA PCM core. Once decided, runtime of
the PCM substream keeps the parameters.

The parameters are described in struct snd_pcm_hw_params. This
structure includes several types of parameters. Applications set preferable
value to these parameters, then execute ioctl(2) with SNDRV_PCM_IOCTL_HW_REFINE
or SNDRV_PCM_IOCTL_HW_PARAMS. The former is used just for refining available
set of parameters. The latter is used for an actual decision of the parameters.

The struct snd_pcm_hw_params structure has below members:

``flags``
        Configurable. ALSA PCM core and some drivers handle this flag to select
        convenient parameters or change their behaviour.
``masks``
        Configurable. This type of parameter is described in
        struct snd_mask and represent mask values. As of PCM protocol
        v2.0.13, three types are defined.

        - SNDRV_PCM_HW_PARAM_ACCESS
        - SNDRV_PCM_HW_PARAM_FORMAT
        - SNDRV_PCM_HW_PARAM_SUBFORMAT
``intervals``
        Configurable. This type of parameter is described in
        struct snd_interval and represent values with a range. As of
        PCM protocol v2.0.13, twelve types are defined.

        - SNDRV_PCM_HW_PARAM_SAMPLE_BITS
        - SNDRV_PCM_HW_PARAM_FRAME_BITS
        - SNDRV_PCM_HW_PARAM_CHANNELS
        - SNDRV_PCM_HW_PARAM_RATE
        - SNDRV_PCM_HW_PARAM_PERIOD_TIME
        - SNDRV_PCM_HW_PARAM_PERIOD_SIZE
        - SNDRV_PCM_HW_PARAM_PERIOD_BYTES
        - SNDRV_PCM_HW_PARAM_PERIODS
        - SNDRV_PCM_HW_PARAM_BUFFER_TIME
        - SNDRV_PCM_HW_PARAM_BUFFER_SIZE

Annotation

Implementation Notes