- 追加された行はこの色です。
- 削除された行はこの色です。
*参照元 [#r1326de3]
#backlinks
*説明 [#ka114d9b]
FIXME: なにをするもの?
-とぴっく
--解説
**主要 API [#r3de2f60]
-Using large DMA-coherent buffers
--[[linux-4.4.1/dma_alloc_coherent()]]
--[[linux-4.4.1/dma_zalloc_coherent()]]
--[[linux-4.4.1/dma_free_coherent()]]
-Using small DMA-coherent buffers
--[[linux-4.4.1/dma_pool_create()]]
--[[linux-4.4.1/dma_pool_zalloc()]]
--[[linux-4.4.1/dma_pool_alloc()]]
--[[linux-4.4.1/dma_pool_free()]]
--[[linux-4.4.1/dma_pool_destroy()]]
-DMA addressing limitations
--[[linux-4.4.1/dma_set_mask_and_coherent()]]
--[[linux-4.4.1/dma_set_mask()]]
--[[linux-4.4.1/dma_set_coherent_mask()]]
--[[linux-4.4.1/dma_get_required_mask()]]
-Streaming DMA mappings
--[[linux-4.4.1/dma_map_single()]]
--[[linux-4.4.1/dma_unmap_single()]]
--[[linux-4.4.1/dma_map_page()]]
--[[linux-4.4.1/dma_unmap_page()]]
--[[linux-4.4.1/dma_mapping_error()]]
--[[linux-4.4.1/dma_map_sg()]]
int i, count = dma_map_sg(dev, sglist, nents, direction);
struct scatterlist *sg;
for_each_sg(sglist, sg, count, i) {
hw_address[i] = sg_dma_address(sg);
hw_len[i] = sg_dma_len(sg);
}
--[[linux-4.4.1/dma_unmap_sg()]]
--[[linux-4.4.1/dma_sync_single_for_cpu()]]
--[[linux-4.4.1/dma_sync_single_for_device()]]
--[[linux-4.4.1/dma_sync_sg_for_cpu()]]
--[[linux-4.4.1/dma_sync_sg_for_device()]]
--[[linux-4.4.1/dma_map_single_attrs()]]
--[[linux-4.4.1/dma_unmap_single_attrs()]]
--[[linux-4.4.1/dma_map_sg_attrs()]]
--[[linux-4.4.1/dma_unmap_sg_attrs()]]
#include <linux/dma-attrs.h>
/* DMA_ATTR_FOO should be defined in linux/dma-attrs.h and
* documented in Documentation/DMA-attributes.txt */
...
DEFINE_DMA_ATTRS(attrs);
dma_set_attr(DMA_ATTR_FOO, &attrs);
....
n = dma_map_sg_attrs(dev, sg, nents, DMA_TO_DEVICE, &attr);
....
void whizco_dma_map_sg_attrs(struct device *dev, dma_addr_t dma_addr,
size_t size, enum dma_data_direction dir,
struct dma_attrs *attrs)
{
....
int foo = dma_get_attr(DMA_ATTR_FOO, attrs);
....
if (foo)
/* twizzle the frobnozzle */
....
-Advanced dma_ usage
--[[linux-4.4.1/dma_alloc_noncoherent()]]
--[[linux-4.4.1/dma_free_noncoherent()]]
--[[linux-4.4.1/dma_get_cache_alignment()]]
--[[linux-4.4.1/dma_cache_sync()]]
--[[linux-4.4.1/dma_declare_coherent_memory()]]
--[[linux-4.4.1/dma_mark_declared_memory_occupied()]]
**参考 [#n14c90c7]
https://www.kernel.org/doc/Documentation/DMA-API.txt
**関連モジュール [#p7eb18b5]
*コメント [#h36c76a6]