snd_pcm_lib_preallocate_pages
Prev | PCM Memory Management | Next

## Name

snd_pcm_lib_preallocate_pages — pre-allocation for the given DMA type

## Synopsis

`int snd_pcm_lib_preallocate_pages (` | struct snd_pcm_substream * substream,
| int type,
| struct device * data,
| size_t size,
| size_t max`)`;

## Arguments

`substream`

  the pcm substream instance

`type`

  DMA type (SNDRV_DMA_TYPE_*)

`data`

  DMA type dependent data

`size`

  the requested pre-allocation size in bytes

`max`

  the max. allowed pre-allocation size

## Description

Do pre-allocation for the given DMA buffer type.

When substream->dma_buf_id is set, the function tries to look for the reserved buffer, and the buffer is not freed but reserved at destruction time. The dma_buf_id must be unique for all systems (in the same DMA buffer type) e.g. using `snd_dma_pci_buf_id`.

## Return

Zero if successful, or a negative error code on failure.

Prev | Up | Next
snd_pcm_lib_preallocate_free_for_all | Home | snd_pcm_lib_preallocate_pages_for_all