Mercurial > archived > louis > epitech > mq > rathaxes
annotate rathaxes_samples_e1000_use_the_dma_abstraction_in_socket.patch @ 114:8eac160e5f1c
WIP, add a new hack on the compiler
author | Louis Opter <louis@lse.epita.fr> |
---|---|
date | Mon, 22 Jul 2013 00:35:20 -0700 |
parents | b22983cb9e3a |
children | 5a663f8f0e54 |
rev | line source |
---|---|
111
b072f682823d
Start a new series to refactor e1000::set_up_device
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
1 # HG changeset patch |
114
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
2 # Parent 5a53813ed1306484aa98dd95fe1d284ed24111ab |
111
b072f682823d
Start a new series to refactor e1000::set_up_device
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
3 Replace Linux specific code in Socket by DMA calls |
b072f682823d
Start a new series to refactor e1000::set_up_device
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
4 |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
5 diff --git a/rathaxes/samples/e1000/dma.blt b/rathaxes/samples/e1000/dma.blt |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
6 --- a/rathaxes/samples/e1000/dma.blt |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
7 +++ b/rathaxes/samples/e1000/dma.blt |
114
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
8 @@ -1,6 +1,6 @@ |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
9 with DMA, Builtin, LKM, Device |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
10 { |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
11 - template type AbstractDMAHandle() |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
12 + template type DMA::AbstractDMAHandle() |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
13 { |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
14 chunk LKM::includes() |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
15 { |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
16 @@ -14,11 +14,11 @@ |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
17 |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
18 map |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
19 { |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
20 - k_dma_handle: ((dma_addr_t *)${self}); |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
21 + k_dma_handle: ((dma_addr_t)${self}); |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
22 } |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
23 } |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
24 |
114
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
25 - template type AbstractDMADirection() |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
26 + template type DMA::AbstractDMADirection() |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
27 { |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
28 decl data_types() |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
29 { |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
30 @@ -42,7 +42,7 @@ |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
31 |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
32 map |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
33 { |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
34 - /* XXX: we should use ${AbstractDMADirection} here: */ |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
35 + /* XXX: we should use ${DMA::AbstractDMADirection} here: */ |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
36 dma_direction: ((enum dma_data_direction)${self}); |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
37 } |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
38 } |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
39 @@ -51,11 +51,11 @@ |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
40 { |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
41 chunk ::CALL() |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
42 { |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
43 - dma_map_single(${dev.k_device}, ${buf}, ${size}, ${dir.dma_direction}); |
114
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
44 + ((${DMA::DMA::AbstractDMAHandle})dma_map_single(${dev.k_device}, ${buf}, ${size}, ${dir.dma_direction})); |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
45 } |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
46 } |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
47 |
114
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
48 - template sequence unmap(Device::AbstractDevice dev, AbstractDMAHandle handle, Builtin::number size, DMADirection dir) |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
49 + template sequence unmap(Device::AbstractDevice dev, DMA::AbstractDMAHandle handle, Builtin::number size, DMADirection dir) |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
50 { |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
51 chunk ::CALL() |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
52 { |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
53 @@ -63,15 +63,23 @@ |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
54 } |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
55 } |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
56 |
114
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
57 - template sequence alloc_coherent(Device::AbstractDevice dev, Builtin::number size, AbstractDMAHandle handle) |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
58 + template sequence mapping_error(Device::AbstractDevice dev, DMA::AbstractDMAHandle handle) |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
59 + { |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
60 + chunk ::CALL() |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
61 + { |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
62 + dma_mapping_error(${dev.k_device}, ${handle.k_dma_handle}); |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
63 + } |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
64 + } |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
65 + |
114
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
66 + template sequence alloc_coherent(Device::AbstractDevice dev, Builtin::number size, DMA::AbstractDMAHandle handle) |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
67 { |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
68 chunk ::CALL() |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
69 { |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
70 - dma_alloc_coherent(${dev.k_device}, ${size}, ${handle.k_dma_handle}, GFP_KERNEL); |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
71 + dma_alloc_coherent(${dev.k_device}, ${size}, &${handle.k_dma_handle}, GFP_KERNEL); |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
72 } |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
73 } |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
74 |
114
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
75 - template sequence free_coherent(Device::AbstractDevice dev, Builtin::number size, Builtin::symbol addr, AbstractDMAHandle handle) |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
76 + template sequence free_coherent(Device::AbstractDevice dev, Builtin::number size, Builtin::symbol addr, DMA::AbstractDMAHandle handle) |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
77 { |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
78 chunk ::CALL() |
8eac160e5f1c
WIP, add a new hack on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
113
diff
changeset
|
79 { |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
80 diff --git a/rathaxes/samples/e1000/dma.rti b/rathaxes/samples/e1000/dma.rti |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
81 --- a/rathaxes/samples/e1000/dma.rti |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
82 +++ b/rathaxes/samples/e1000/dma.rti |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
83 @@ -29,6 +29,12 @@ |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
84 provided chunk ::CALL(); |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
85 } |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
86 |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
87 + /* XXX: Until we have a real error handling mechanism: */ |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
88 + provided sequence mapping_error(Device::AbstractDevice, AbstractDMAHandle) |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
89 + { |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
90 + provided chunk ::CALL(); /* -> != 0 if the mapping failed */ |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
91 + } |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
92 + |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
93 provided sequence alloc_coherent(Device::AbstractDevice, Builtin::number, AbstractDMAHandle) |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
94 { |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
95 /* return the addr and the handle via the AbstractDMAHandle ptr: */ |
112 | 96 diff --git a/rathaxes/samples/e1000/socket.blt b/rathaxes/samples/e1000/socket.blt |
97 --- a/rathaxes/samples/e1000/socket.blt | |
98 +++ b/rathaxes/samples/e1000/socket.blt | |
99 @@ -1,4 +1,4 @@ | |
100 -with Socket, LKM, Device, Ethernet | |
101 +with Socket, LKM, Device, DMA, Ethernet | |
102 { | |
103 template type Socket::AbstractSKBuff() | |
104 { | |
105 @@ -22,15 +22,15 @@ | |
106 { | |
107 decl data_types() | |
108 { | |
109 - ${Socket::AbstractSKBuff.ref} skbuff; | |
110 - dma_addr_t dma_handle; | |
111 + ${Socket::AbstractSKBuff.ref} skbuff; | |
112 + ${DMA::AbstractDMAHandle.scalar} dma_handle; | |
113 } | |
114 | |
115 chunk LKM::prototypes() | |
116 { | |
117 static void rtx_socket_skbuff_dump_infos(${Socket::SKBuff.ref}); | |
118 - static int rtx_socket_skbuff_map(${Socket::SKBuff.ref}, struct device *, enum dma_data_direction); | |
119 - static void rtx_socket_skbuff_unmap_and_free(${Socket::SKBuff.ref}, struct device *, enum dma_data_direction); | |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
120 + static int rtx_socket_skbuff_map(${Socket::SKBuff.ref}, ${Device::AbstractDevice.ref}, ${DMA::DMADirection.scalar}); |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
121 + static void rtx_socket_skbuff_unmap_and_free(${Socket::SKBuff.ref}, struct device *, ${DMA::DMADirection.scalar}); |
112 | 122 } |
123 | |
124 chunk LKM::code() | |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
125 @@ -65,23 +65,21 @@ |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
126 } |
112 | 127 |
128 static int rtx_socket_skbuff_map(${Socket::SKBuff.ref} self, | |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
129 - struct device *dev, |
112 | 130 - enum dma_data_direction direction) |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
131 + ${Device::AbstractDevice.ref} dev, |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
132 + ${DMA::DMADirection.scalar} direction) |
112 | 133 { |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
134 - ${Socket::AbstractSKBuff.ref} skb = self->skbuff; |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
135 - |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
136 - WARN_ON(!${local.skb.k_sk_buff}); |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
137 - WARN_ON(self->dma_handle); |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
138 + WARN_ON(!${local.self.k_sk_buff}); |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
139 + WARN_ON(${local.self.k_dma_handle}); |
112 | 140 |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
141 self->dma_handle = dma_map_single( |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
142 - dev, |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
143 + ${dev.k_device}, |
112 | 144 ${local.skb.k_sk_buff}, |
145 skb_headlen(${local.skb.k_sk_buff}), | |
146 - direction); | |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
147 - int err = dma_mapping_error(dev, self->dma_handle); |
112 | 148 + ${local.direction.dma_direction}); |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
149 + int err = ${DMA::mapping_error(local.dev, local.self.k_dma_handle)}; |
112 | 150 if (err) |
151 { | |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
152 - self->dma_handle = 0; |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
153 + ${local.self.k_dma_handle} = 0; |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
154 return err; |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
155 } |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
156 return 0; |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
157 @@ -89,7 +87,7 @@ |
112 | 158 |
159 static void rtx_socket_skbuff_unmap_and_free(${Socket::SKBuff.ref} self, | |
160 struct device *dev, | |
161 - enum dma_data_direction direction) | |
162 + ${DMA::DMADirection} direction) | |
163 { | |
164 ${Socket::AbstractSKBuff.ref} skb = self->skbuff; | |
165 | |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
166 @@ -100,7 +98,7 @@ |
112 | 167 dma_unmap_single(dev, |
168 self->dma_handle, | |
169 skb_headlen(${local.skb.k_sk_buff}), | |
170 - direction); | |
171 + ${local.direction.dma_direction}); | |
172 self->dma_handle = 0; | |
173 } | |
174 dev_kfree_skb_any(${local.skb.k_sk_buff}); | |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
175 @@ -126,30 +124,32 @@ |
112 | 176 |
177 method map_to(Device::AbstractDevice dev) | |
178 { | |
179 - rtx_socket_skbuff_map(${self}, ${dev.k_device}, DMA_TO_DEVICE); | |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
180 + rtx_socket_skbuff_map(${self}, ${dev}, RTX_DMA_TO_DEVICE); |
112 | 181 } |
182 | |
183 method map_from(Device::AbstractDevice dev) | |
184 { | |
185 - rtx_socket_skbuff_map(${self}, ${dev.k_device}, DMA_FROM_DEVICE); | |
186 + rtx_socket_skbuff_map(${self}, ${dev.k_device}, RTX_DMA_FROM_DEVICE); | |
187 } | |
188 | |
189 method unmap_to_and_free(Device::AbstractDevice dev) | |
190 { | |
191 - rtx_socket_skbuff_unmap_and_free(${self}, ${dev.k_device}, DMA_TO_DEVICE); | |
192 + rtx_socket_skbuff_unmap_and_free(${self}, ${dev.k_device}, RTX_DMA_TO_DEVICE); | |
193 } | |
194 | |
195 method unmap_from_and_free(Device::AbstractDevice dev) | |
196 { | |
197 - rtx_socket_skbuff_unmap_and_free(${self}, ${dev.k_device}, DMA_FROM_DEVICE); | |
198 + rtx_socket_skbuff_unmap_and_free(${self}, ${dev.k_device}, RTX_DMA_FROM_DEVICE); | |
199 } | |
200 | |
201 map | |
113
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
202 { |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
203 - // some work may have to be done here in order |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
204 - // to access to some field of the sk_buff. |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
205 - // We should determine if all the sk_buff management |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
206 - // can be abstracted from the user. |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
207 + // Some work may have to be done here in order to access to some |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
208 + // field of the sk_buff. We should determine if all the sk_buff |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
209 + // management can be abstracted from the user. But this is at least |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
210 + // useful for internal use: |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
211 + k_sk_buff: ((struct skbuff *)(${self}->skbuff)); |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
212 + k_dma_handle: ((dma_addr_t)(${self}->dma_handle)); |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
213 } |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
214 } |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
215 } |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
216 diff --git a/rathaxes/samples/e1000/socket.rti b/rathaxes/samples/e1000/socket.rti |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
217 --- a/rathaxes/samples/e1000/socket.rti |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
218 +++ b/rathaxes/samples/e1000/socket.rti |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
219 @@ -1,4 +1,4 @@ |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
220 -interface Socket : LKM, Device |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
221 +interface Socket : LKM, Device, DMA |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
222 { |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
223 /* The SKBuff type from the kernel */ |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
224 provided type AbstractSKBuff |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
225 @@ -19,5 +19,8 @@ |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
226 method map_from(Device::AbstractDevice); |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
227 method unmap_to_and_free(Device::AbstractDevice); |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
228 method unmap_from_and_free(Device::AbstractDevice); |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
229 + |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
230 + attribute Socket::AbstractSKBuff.ref k_sk_buff; |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
231 + attribute DMA::AbstractDMAHandle.scalar k_dma_handle; |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
232 } |
b22983cb9e3a
WIP, thanks joa for some fixes on the compiler
Louis Opter <louis@lse.epita.fr>
parents:
112
diff
changeset
|
233 } |