comparison rathaxes_samples_e1000_add_a_dma_abstraction.patch @ 111:b072f682823d

Start a new series to refactor e1000::set_up_device
author Louis Opter <louis@lse.epita.fr>
date Sun, 14 Jul 2013 23:14:33 -0700
parents
children bfe10def90e3
comparison
equal deleted inserted replaced
110:b83b0432a45b 111:b072f682823d
1 # HG changeset patch
2 # Parent 0f12e80e810de1a9927db1f25dbea49acd73ae3c
3 e1000: start a DMA allocation/mapping abstraction
4
5 It currently matches a lot the Linux DMA API but it should be usable by
6 other OSes too. The Linux DMA API is described at the end of the chapter
7 15 in the LDD3.
8
9 This will be useful to remove Linux specific DMA code from
10 e1000::set_up_device which should be only device independent code.
11
12
13 diff --git a/rathaxes/samples/e1000/dma.rti b/rathaxes/samples/e1000/dma.rti
14 new file mode 100644
15 --- /dev/null
16 +++ b/rathaxes/samples/e1000/dma.rti
17 @@ -0,0 +1,34 @@
18 +interface DMA : Builtin, LKM, Device
19 +{
20 + provided type AbstractDMAHandle
21 + {
22 + chunk LKM::includes();
23 + decl data_types();
24 + attribute Builtin::symbol.scalar k_dma_handle;
25 + }
26 +
27 + provided type Direction
28 + {
29 + decl data_types();
30 + }
31 +
32 + provided sequence map(Device::AbstractDevice, Builtin::symbol, Builtin::number, Direction)
33 + {
34 + provided chunk ::CALL(); /* -> AbstractDMAHandle */
35 + }
36 +
37 + provided sequence unmap(Device::AbstractDevice, AbstractDMAHandle, Builtin::number, Direction)
38 + {
39 + provided chunk ::CALL();
40 + }
41 +
42 + provided sequence alloc_coherent(Device::AbstractDevice, Builtin::number, Builtin::symbol)
43 + {
44 + provided chunk ::CALL(); /* -> AbstractDMAHandle + addr returned via the symbol */
45 + }
46 +
47 + provided sequence free_coherent(Device::AbstractDevice, Builtin::number, Builtin::symbol, AbstractDMAHandle)
48 + {
49 + provided chunk ::CALL();
50 + }
51 +}