*参照元 [#u692c950] #backlinks *説明 [#vb9b7b1f] -パス: [[linux-2.6.33/arch/arm/common/dmabounce.c]] -パス: --CONFIG_DMABOUNCE 有効時: [[linux-2.6.33/arch/arm/common/dmabounce.c]] --CONFIG_DMABOUNCE 無効時: [[linux-2.6.33/arch/arm/include/asm/dma-mapping.h]] -FIXME: これは何? --説明 **引数 [#ce7ecf78] -struct device *dev -- --[[linux-2.6.33/device]] -dma_addr_t addr -- --[[linux-2.6.33/dma_addr_t]] -unsigned long off -- -size_t sz -- -enum dma_data_direction dir -- --[[linux-2.6.33/dma_data_direction]] **返り値 [#fda0200e] -int -- **参考 [#d310da54] *実装 [#g7281733] **CONFIG_DMABOUNCE 有効時: linux-2.6.33/arch/arm/common/dmabounce.c [#v3bbc50f] int dmabounce_sync_for_cpu(struct device *dev, dma_addr_t addr, unsigned long off, size_t sz, enum dma_data_direction dir) { struct safe_buffer *buf; - --[[linux-2.6.33/safe_buffer]] dev_dbg(dev, "%s(dma=%#x,off=%#lx,sz=%zx,dir=%x)\n", __func__, addr, off, sz, dir); - --[[linux-2.6.33/dev_dbg()]] buf = find_safe_buffer_dev(dev, addr, __func__); if (!buf) return 1; - --[[linux-2.6.33/find_safe_buffer_dev()]] BUG_ON(buf->direction != dir); - --[[linux-2.6.33/BUG_ON()]] dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x) mapped to %p (dma=%#x)\n", __func__, buf->ptr, virt_to_dma(dev, buf->ptr), buf->safe, buf->safe_dma_addr); DO_STATS(dev->archdata.dmabounce->bounce_count++); - --[[linux-2.6.33/DO_STATS]] if (dir == DMA_FROM_DEVICE || dir == DMA_BIDIRECTIONAL) { dev_dbg(dev, "%s: copy back safe %p to unsafe %p size %d\n", __func__, buf->safe + off, buf->ptr + off, sz); memcpy(buf->ptr + off, buf->safe + off, sz); } - --[[linux-2.6.33/memcpy()]] - --[[linux-2.6.33/DMA_FROM_DEVICE]] - --[[linux-2.6.33/DMA_BIDIRECTIONAL]] return 0; } EXPORT_SYMBOL(dmabounce_sync_for_cpu); -ライセンスに関係なくシンボルを公開する。 --[[linux-2.6.33/EXPORT_SYMBOL()]] **CONFIG_DMABOUNCE 無効時: linux-2.6.33/arch/arm/include/asm/dma-mapping.h [#f8785ff2] static inline int dmabounce_sync_for_cpu(struct device *d, dma_addr_t addr, unsigned long offset, size_t size, enum dma_data_direction dir) { return 1; } *コメント [#mf63c152]