2012년 6월 5일 화요일

DMA related kernel APIs

dma_map_single
  ==> map DMA address for virtual memory,
  ==>use kmalloc if continuous memory is not enough, it returens fail
dma_unmap_single
  ==> free memory by allocating dma_map_single
dma_alloc_cohernet
  ==> allocate coherent memory for DMA
  ==> it allocates memory in conherent area,
  ==> refer to memory.h in architecture
  ==> it can be decided by CONSISTENT_DMA_SIZE

other APIs
  ==> dma_pool_create
  ==> dma_pool_alloc
  ==> dma_pool_free
  ==> dma_pool_destory
  ==> dma_alloc_writecombine

Also you can decide dma memory attributes by using kernel APIs

For more detail,  refer to dma-api.txt in kernel doc

condiserations when you alloc DMA memory

1. allocate meory in coherent area ?
2. use memory as like pool?
3. how mush you are using coherent memory
4. swap area is used or not

But everytime you can not have enough memory......if you have, it's not real