Mercurial > archived > louis > epitech > mq > rathaxes
diff rathaxes_samples_e1000_add_a_dma_abstraction.patch @ 117:f3c7e9b0c5cf
WIP on the DMA API
author | Louis Opter <louis@lse.epita.fr> |
---|---|
date | Thu, 25 Jul 2013 16:45:13 -0700 |
parents | 5a663f8f0e54 |
children | ad21d8a182ad |
line wrap: on
line diff
--- a/rathaxes_samples_e1000_add_a_dma_abstraction.patch Mon Jul 22 16:04:12 2013 -0700 +++ b/rathaxes_samples_e1000_add_a_dma_abstraction.patch Thu Jul 25 16:45:13 2013 -0700 @@ -1,5 +1,5 @@ # HG changeset patch -# Parent af7a1f8589d632497e2f2574570f5153cae59b91 +# Parent 61470dc5e775a696da551b5227663bf2659f8f4b e1000: start a DMA allocation/mapping abstraction It currently matches a lot the Linux DMA API but it should be usable by @@ -35,7 +35,7 @@ new file mode 100644 --- /dev/null +++ b/rathaxes/samples/e1000/dma.blt -@@ -0,0 +1,89 @@ +@@ -0,0 +1,103 @@ +with DMA, Builtin, LKM, Device +{ + template type DMA::AbstractDMAHandle() @@ -52,7 +52,21 @@ + + map + { -+ k_dma_handle: ((dma_addr_t)${self}); ++ k_dma_handle: (dma_addr_t)(${self}); ++ } ++ } ++ ++ template type DMA::DMAHandle() ++ { ++ decl data_types() ++ { ++ ${DMA::AbstractDMAHandle} data; ++ } ++ ++ map ++ { ++ /* XXX: we should use ${DMA::AbstractDMAHandle} here: */ ++ dma_handle: (dma_addr_t)(${self}); + } + } + @@ -65,7 +79,7 @@ + + map + { -+ k_dma_direction: ((enum dma_data_direction)${self}); ++ k_dma_direction: (enum dma_data_direction)(${self}); + } + } + @@ -81,7 +95,7 @@ + map + { + /* XXX: we should use ${DMA::AbstractDMADirection} here: */ -+ dma_direction: ((enum dma_data_direction)${self}); ++ dma_direction: (enum dma_data_direction)(${self}); + } + } + @@ -89,7 +103,7 @@ + { + chunk ::CALL() + { -+ ((${DMA::DMA::AbstractDMAHandle})dma_map_single(${dev.k_device}, ${buf}, ${size}, ${dir.dma_direction})); ++ ((${DMA::DMAHandle})dma_map_single(${dev.k_device}, ${buf}, ${size}, ${dir.dma_direction})); + } + } + @@ -129,7 +143,7 @@ new file mode 100644 --- /dev/null +++ b/rathaxes/samples/e1000/dma.rti -@@ -0,0 +1,48 @@ +@@ -0,0 +1,54 @@ +interface DMA : Builtin, LKM, Device +{ + provided type AbstractDMAHandle @@ -139,6 +153,12 @@ + attribute Builtin::symbol.scalar k_dma_handle; + } + ++ provided type DMAHandle ++ { ++ decl data_types(); ++ attribute AbstractDMAHandle.scalar dma_handle; ++ } ++ + provided type AbstractDMADirection + { + decl data_types();