Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
pcm_memory.c File Reference
#include <asm/io.h>
#include <linux/time.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/moduleparam.h>
#include <linux/vmalloc.h>
#include <linux/export.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/info.h>
#include <sound/initval.h>

Go to the source code of this file.

Macros

#define preallocate_info_init(s)
 

Functions

 module_param (preallocate_dma, int, 0444)
 
 MODULE_PARM_DESC (preallocate_dma,"Preallocate DMA memory when the PCM devices are initialized.")
 
 module_param (maximum_substreams, int, 0444)
 
 MODULE_PARM_DESC (maximum_substreams,"Maximum substreams with preallocated DMA memory.")
 
int snd_pcm_lib_preallocate_free (struct snd_pcm_substream *substream)
 
int snd_pcm_lib_preallocate_free_for_all (struct snd_pcm *pcm)
 
 EXPORT_SYMBOL (snd_pcm_lib_preallocate_free_for_all)
 
int snd_pcm_lib_preallocate_pages (struct snd_pcm_substream *substream, int type, struct device *data, size_t size, size_t max)
 
 EXPORT_SYMBOL (snd_pcm_lib_preallocate_pages)
 
int snd_pcm_lib_preallocate_pages_for_all (struct snd_pcm *pcm, int type, void *data, size_t size, size_t max)
 
 EXPORT_SYMBOL (snd_pcm_lib_preallocate_pages_for_all)
 
int snd_pcm_lib_malloc_pages (struct snd_pcm_substream *substream, size_t size)
 
 EXPORT_SYMBOL (snd_pcm_lib_malloc_pages)
 
int snd_pcm_lib_free_pages (struct snd_pcm_substream *substream)
 
 EXPORT_SYMBOL (snd_pcm_lib_free_pages)
 
int _snd_pcm_lib_alloc_vmalloc_buffer (struct snd_pcm_substream *substream, size_t size, gfp_t gfp_flags)
 
 EXPORT_SYMBOL (_snd_pcm_lib_alloc_vmalloc_buffer)
 
int snd_pcm_lib_free_vmalloc_buffer (struct snd_pcm_substream *substream)
 
 EXPORT_SYMBOL (snd_pcm_lib_free_vmalloc_buffer)
 
struct pagesnd_pcm_lib_get_vmalloc_page (struct snd_pcm_substream *substream, unsigned long offset)
 
 EXPORT_SYMBOL (snd_pcm_lib_get_vmalloc_page)
 

Macro Definition Documentation

#define preallocate_info_init (   s)

Definition at line 232 of file pcm_memory.c.

Function Documentation

int _snd_pcm_lib_alloc_vmalloc_buffer ( struct snd_pcm_substream substream,
size_t  size,
gfp_t  gfp_flags 
)

Definition at line 415 of file pcm_memory.c.

EXPORT_SYMBOL ( snd_pcm_lib_preallocate_pages  )
EXPORT_SYMBOL ( snd_pcm_lib_malloc_pages  )
EXPORT_SYMBOL ( snd_pcm_lib_free_pages  )
EXPORT_SYMBOL ( _snd_pcm_lib_alloc_vmalloc_buffer  )
EXPORT_SYMBOL ( snd_pcm_lib_free_vmalloc_buffer  )
EXPORT_SYMBOL ( snd_pcm_lib_get_vmalloc_page  )
module_param ( preallocate_dma  ,
int  ,
0444   
)
module_param ( maximum_substreams  ,
int  ,
0444   
)
MODULE_PARM_DESC ( preallocate_dma  ,
"Preallocate DMA memory when the PCM devices are initialized."   
)
MODULE_PARM_DESC ( maximum_substreams  ,
"Maximum substreams with preallocated DMA memory."   
)
int snd_pcm_lib_free_pages ( struct snd_pcm_substream substream)

snd_pcm_lib_free_pages - release the allocated DMA buffer. : the substream to release the DMA buffer

Releases the DMA buffer allocated via snd_pcm_lib_malloc_pages().

Returns zero if successful, or a negative error code on failure.

Definition at line 395 of file pcm_memory.c.

int snd_pcm_lib_free_vmalloc_buffer ( struct snd_pcm_substream substream)

snd_pcm_lib_free_vmalloc_buffer - free vmalloc buffer : the substream with a buffer allocated by snd_pcm_lib_alloc_vmalloc_buffer()

Definition at line 441 of file pcm_memory.c.

struct page* snd_pcm_lib_get_vmalloc_page ( struct snd_pcm_substream substream,
unsigned long  offset 
)
read

snd_pcm_lib_get_vmalloc_page - map vmalloc buffer offset to page struct : the substream with a buffer allocated by snd_pcm_lib_alloc_vmalloc_buffer() : offset in the buffer

This function is to be used as the page callback in the PCM ops.

Definition at line 462 of file pcm_memory.c.

int snd_pcm_lib_malloc_pages ( struct snd_pcm_substream substream,
size_t  size 
)

snd_pcm_lib_malloc_pages - allocate the DMA buffer : the substream to allocate the DMA buffer to : the requested buffer size in bytes

Allocates the DMA buffer on the BUS type given earlier to snd_pcm_lib_preallocate_xxx_pages().

Returns 1 if the buffer is changed, 0 if not changed, or a negative code on failure.

Definition at line 343 of file pcm_memory.c.

int snd_pcm_lib_preallocate_free ( struct snd_pcm_substream substream)

snd_pcm_lib_preallocate_free - release the preallocated buffer of the specified substream. : the pcm substream instance

Releases the pre-allocated buffer of the given substream.

Returns zero if successful, or a negative error code on failure.

Definition at line 100 of file pcm_memory.c.

int snd_pcm_lib_preallocate_free_for_all ( struct snd_pcm pcm)

snd_pcm_lib_preallocate_free_for_all - release all pre-allocated buffers on the pcm : the pcm instance

Releases all the pre-allocated buffers on the given pcm.

Returns zero if successful, or a negative error code on failure.

Definition at line 120 of file pcm_memory.c.

int snd_pcm_lib_preallocate_pages ( struct snd_pcm_substream substream,
int  type,
struct device data,
size_t  size,
size_t  max 
)

snd_pcm_lib_preallocate_pages - pre-allocation for the given DMA type : the pcm substream instance : DMA type (SNDRV_DMA_TYPE_*) : DMA type dependent data : the requested pre-allocation size in bytes : the max. allowed pre-allocation size

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().

Returns zero if successful, or a negative error code on failure.

Definition at line 270 of file pcm_memory.c.

int snd_pcm_lib_preallocate_pages_for_all ( struct snd_pcm pcm,
int  type,
void data,
size_t  size,
size_t  max 
)

snd_pcm_lib_preallocate_pages_for_all - pre-allocation for continuous memory type (all substreams) : the pcm instance : DMA type (SNDRV_DMA_TYPE_*) : DMA type dependent data : the requested pre-allocation size in bytes : the max. allowed pre-allocation size

Do pre-allocation to all substreams of the given pcm for the specified DMA type.

Returns zero if successful, or a negative error code on failure.

Definition at line 294 of file pcm_memory.c.