linux-4.4.1/snd_dma_alloc_pages()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#m915da3d]
#backlinks
*説明 [#hedbbced]
-パス: [[linux-4.4.1/sound/core/memalloc.c]]
-FIXME: これは何?
--説明
type によって呼ばれるメモリ確保の関数が異なる。
-SNDRV_DMA_TYPE_CONTINUOUS
--snd_malloc_pages()
-SNDRV_DMA_TYPE_DEV_IRAM
--snd_malloc_dev_iram()
-SNDRV_DMA_TYPE_DEV
--snd_malloc_dev_pages()
-SNDRV_DMA_TYPE_DEV_SG
--snd_malloc_sgbuf_pages()
**引数 [#q372a1b2]
-int type
--確保する DMA バッファの種類
-struct device *device
--
--[[linux-4.4.1/device]]
-size_t size
--
-struct snd_dma_buffer *dmab
--
--[[linux-4.4.1/snd_dma_buffer]]
**返り値 [#xfdd4bb7]
-int
--0 なら成功、負のエラー値なら失敗。
**参考 [#b4aedf2c]
*実装 [#m61fe59c]
/**
* snd_dma_alloc_pages - allocate the buffer area accord...
* @type: the DMA buffer type
* @device: the device pointer
* @size: the buffer size to allocate
* @dmab: buffer allocation record to store the allocate...
*
* Calls the memory-allocator function for the correspon...
* buffer type.
*
* Return: Zero if the buffer with the given size is all...
* otherwise a negative value on error.
*/
int snd_dma_alloc_pages(int type, struct device *device,...
struct snd_dma_buffer *dmab)
{
if (WARN_ON(!size))
return -ENXIO;
if (WARN_ON(!dmab))
return -ENXIO;
-
--[[linux-4.4.1/WARN_ON()]]
dmab->dev.type = type;
dmab->dev.dev = device;
dmab->bytes = 0;
switch (type) {
case SNDRV_DMA_TYPE_CONTINUOUS:
dmab->area = snd_malloc_pages(size,
(__force gfp_t)(...
dmab->addr = 0;
break;
-
--[[linux-4.4.1/snd_malloc_pages()]]
-
--[[linux-4.4.1/__force]]
-
--[[linux-4.4.1/gfp_t]]
#ifdef CONFIG_HAS_DMA
#ifdef CONFIG_GENERIC_ALLOCATOR
-
--[[linux-4.4.1/CONFIG_HAS_DMA]]
-
--[[linux-4.4.1/CONFIG_GENERIC_ALLOCATOR]]
case SNDRV_DMA_TYPE_DEV_IRAM:
snd_malloc_dev_iram(dmab, size);
if (dmab->area)
break;
-
--[[linux-4.4.1/snd_malloc_dev_iram()]]
/* Internal memory might have limited si...
* so if we fail to malloc, try to fetch...
*/
dmab->dev.type = SNDRV_DMA_TYPE_DEV;
#endif /* CONFIG_GENERIC_ALLOCATOR */
case SNDRV_DMA_TYPE_DEV:
dmab->area = snd_malloc_dev_pages(device...
break;
-
--[[linux-4.4.1/snd_malloc_dev_pages()]]
#endif
#ifdef CONFIG_SND_DMA_SGBUF
-
--[[linux-4.4.1/CONFIG_SND_DMA_SGBUF]]
case SNDRV_DMA_TYPE_DEV_SG:
snd_malloc_sgbuf_pages(device, size, dma...
break;
-
--[[linux-4.4.1/snd_malloc_sgbuf_pages()]]
#endif
default:
pr_err("snd-malloc: invalid device type ...
dmab->area = NULL;
dmab->addr = 0;
return -ENXIO;
-
--[[linux-4.4.1/pr_err()]]
}
if (! dmab->area)
return -ENOMEM;
dmab->bytes = size;
return 0;
}
...
EXPORT_SYMBOL(snd_dma_alloc_pages);
-
--[[linux-4.4.1/EXPORT_SYMBOL()]]
*コメント [#i991a653]
終了行:
*参照元 [#m915da3d]
#backlinks
*説明 [#hedbbced]
-パス: [[linux-4.4.1/sound/core/memalloc.c]]
-FIXME: これは何?
--説明
type によって呼ばれるメモリ確保の関数が異なる。
-SNDRV_DMA_TYPE_CONTINUOUS
--snd_malloc_pages()
-SNDRV_DMA_TYPE_DEV_IRAM
--snd_malloc_dev_iram()
-SNDRV_DMA_TYPE_DEV
--snd_malloc_dev_pages()
-SNDRV_DMA_TYPE_DEV_SG
--snd_malloc_sgbuf_pages()
**引数 [#q372a1b2]
-int type
--確保する DMA バッファの種類
-struct device *device
--
--[[linux-4.4.1/device]]
-size_t size
--
-struct snd_dma_buffer *dmab
--
--[[linux-4.4.1/snd_dma_buffer]]
**返り値 [#xfdd4bb7]
-int
--0 なら成功、負のエラー値なら失敗。
**参考 [#b4aedf2c]
*実装 [#m61fe59c]
/**
* snd_dma_alloc_pages - allocate the buffer area accord...
* @type: the DMA buffer type
* @device: the device pointer
* @size: the buffer size to allocate
* @dmab: buffer allocation record to store the allocate...
*
* Calls the memory-allocator function for the correspon...
* buffer type.
*
* Return: Zero if the buffer with the given size is all...
* otherwise a negative value on error.
*/
int snd_dma_alloc_pages(int type, struct device *device,...
struct snd_dma_buffer *dmab)
{
if (WARN_ON(!size))
return -ENXIO;
if (WARN_ON(!dmab))
return -ENXIO;
-
--[[linux-4.4.1/WARN_ON()]]
dmab->dev.type = type;
dmab->dev.dev = device;
dmab->bytes = 0;
switch (type) {
case SNDRV_DMA_TYPE_CONTINUOUS:
dmab->area = snd_malloc_pages(size,
(__force gfp_t)(...
dmab->addr = 0;
break;
-
--[[linux-4.4.1/snd_malloc_pages()]]
-
--[[linux-4.4.1/__force]]
-
--[[linux-4.4.1/gfp_t]]
#ifdef CONFIG_HAS_DMA
#ifdef CONFIG_GENERIC_ALLOCATOR
-
--[[linux-4.4.1/CONFIG_HAS_DMA]]
-
--[[linux-4.4.1/CONFIG_GENERIC_ALLOCATOR]]
case SNDRV_DMA_TYPE_DEV_IRAM:
snd_malloc_dev_iram(dmab, size);
if (dmab->area)
break;
-
--[[linux-4.4.1/snd_malloc_dev_iram()]]
/* Internal memory might have limited si...
* so if we fail to malloc, try to fetch...
*/
dmab->dev.type = SNDRV_DMA_TYPE_DEV;
#endif /* CONFIG_GENERIC_ALLOCATOR */
case SNDRV_DMA_TYPE_DEV:
dmab->area = snd_malloc_dev_pages(device...
break;
-
--[[linux-4.4.1/snd_malloc_dev_pages()]]
#endif
#ifdef CONFIG_SND_DMA_SGBUF
-
--[[linux-4.4.1/CONFIG_SND_DMA_SGBUF]]
case SNDRV_DMA_TYPE_DEV_SG:
snd_malloc_sgbuf_pages(device, size, dma...
break;
-
--[[linux-4.4.1/snd_malloc_sgbuf_pages()]]
#endif
default:
pr_err("snd-malloc: invalid device type ...
dmab->area = NULL;
dmab->addr = 0;
return -ENXIO;
-
--[[linux-4.4.1/pr_err()]]
}
if (! dmab->area)
return -ENOMEM;
dmab->bytes = size;
return 0;
}
...
EXPORT_SYMBOL(snd_dma_alloc_pages);
-
--[[linux-4.4.1/EXPORT_SYMBOL()]]
*コメント [#i991a653]
ページ名: