Mercurial > archived > louis > epitech > mq > rathaxes
comparison 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 |
comparison
equal
deleted
inserted
replaced
113:b22983cb9e3a | 114:8eac160e5f1c |
---|---|
1 # HG changeset patch | 1 # HG changeset patch |
2 # Parent 05460906d5aba5d3671969d9ac53182d0ac91649 | 2 # Parent 5a53813ed1306484aa98dd95fe1d284ed24111ab |
3 Replace Linux specific code in Socket by DMA calls | 3 Replace Linux specific code in Socket by DMA calls |
4 | 4 |
5 diff --git a/rathaxes/samples/e1000/dma.blt b/rathaxes/samples/e1000/dma.blt | 5 diff --git a/rathaxes/samples/e1000/dma.blt b/rathaxes/samples/e1000/dma.blt |
6 --- a/rathaxes/samples/e1000/dma.blt | 6 --- a/rathaxes/samples/e1000/dma.blt |
7 +++ b/rathaxes/samples/e1000/dma.blt | 7 +++ b/rathaxes/samples/e1000/dma.blt |
8 @@ -14,7 +14,7 @@ | 8 @@ -1,6 +1,6 @@ |
9 with DMA, Builtin, LKM, Device | |
10 { | |
11 - template type AbstractDMAHandle() | |
12 + template type DMA::AbstractDMAHandle() | |
13 { | |
14 chunk LKM::includes() | |
15 { | |
16 @@ -14,11 +14,11 @@ | |
9 | 17 |
10 map | 18 map |
11 { | 19 { |
12 - k_dma_handle: ((dma_addr_t *)${self}); | 20 - k_dma_handle: ((dma_addr_t *)${self}); |
13 + k_dma_handle: ((dma_addr_t)${self}); | 21 + k_dma_handle: ((dma_addr_t)${self}); |
14 } | 22 } |
15 } | 23 } |
16 | 24 |
17 @@ -51,7 +51,7 @@ | 25 - template type AbstractDMADirection() |
26 + template type DMA::AbstractDMADirection() | |
27 { | |
28 decl data_types() | |
29 { | |
30 @@ -42,7 +42,7 @@ | |
31 | |
32 map | |
33 { | |
34 - /* XXX: we should use ${AbstractDMADirection} here: */ | |
35 + /* XXX: we should use ${DMA::AbstractDMADirection} here: */ | |
36 dma_direction: ((enum dma_data_direction)${self}); | |
37 } | |
38 } | |
39 @@ -51,11 +51,11 @@ | |
18 { | 40 { |
19 chunk ::CALL() | 41 chunk ::CALL() |
20 { | 42 { |
21 - dma_map_single(${dev.k_device}, ${buf}, ${size}, ${dir.dma_direction}); | 43 - dma_map_single(${dev.k_device}, ${buf}, ${size}, ${dir.dma_direction}); |
22 + ((${DMA::AbstractDMAHandle})dma_map_single(${dev.k_device}, ${buf}, ${size}, ${dir.dma_direction})); | 44 + ((${DMA::DMA::AbstractDMAHandle})dma_map_single(${dev.k_device}, ${buf}, ${size}, ${dir.dma_direction})); |
23 } | 45 } |
24 } | 46 } |
25 | 47 |
26 @@ -63,11 +63,19 @@ | 48 - template sequence unmap(Device::AbstractDevice dev, AbstractDMAHandle handle, Builtin::number size, DMADirection dir) |
27 } | 49 + template sequence unmap(Device::AbstractDevice dev, DMA::AbstractDMAHandle handle, Builtin::number size, DMADirection dir) |
28 } | 50 { |
29 | 51 chunk ::CALL() |
30 + template sequence mapping_error(Device::AbstractDevice dev, AbstractDMAHandle handle) | 52 { |
53 @@ -63,15 +63,23 @@ | |
54 } | |
55 } | |
56 | |
57 - template sequence alloc_coherent(Device::AbstractDevice dev, Builtin::number size, AbstractDMAHandle handle) | |
58 + template sequence mapping_error(Device::AbstractDevice dev, DMA::AbstractDMAHandle handle) | |
31 + { | 59 + { |
32 + chunk ::CALL() | 60 + chunk ::CALL() |
33 + { | 61 + { |
34 + dma_mapping_error(${dev.k_device}, ${handle.k_dma_handle}); | 62 + dma_mapping_error(${dev.k_device}, ${handle.k_dma_handle}); |
35 + } | 63 + } |
36 + } | 64 + } |
37 + | 65 + |
38 template sequence alloc_coherent(Device::AbstractDevice dev, Builtin::number size, AbstractDMAHandle handle) | 66 + template sequence alloc_coherent(Device::AbstractDevice dev, Builtin::number size, DMA::AbstractDMAHandle handle) |
39 { | 67 { |
40 chunk ::CALL() | 68 chunk ::CALL() |
41 { | 69 { |
42 - dma_alloc_coherent(${dev.k_device}, ${size}, ${handle.k_dma_handle}, GFP_KERNEL); | 70 - dma_alloc_coherent(${dev.k_device}, ${size}, ${handle.k_dma_handle}, GFP_KERNEL); |
43 + dma_alloc_coherent(${dev.k_device}, ${size}, &${handle.k_dma_handle}, GFP_KERNEL); | 71 + dma_alloc_coherent(${dev.k_device}, ${size}, &${handle.k_dma_handle}, GFP_KERNEL); |
44 } | 72 } |
45 } | 73 } |
46 | 74 |
75 - template sequence free_coherent(Device::AbstractDevice dev, Builtin::number size, Builtin::symbol addr, AbstractDMAHandle handle) | |
76 + template sequence free_coherent(Device::AbstractDevice dev, Builtin::number size, Builtin::symbol addr, DMA::AbstractDMAHandle handle) | |
77 { | |
78 chunk ::CALL() | |
79 { | |
47 diff --git a/rathaxes/samples/e1000/dma.rti b/rathaxes/samples/e1000/dma.rti | 80 diff --git a/rathaxes/samples/e1000/dma.rti b/rathaxes/samples/e1000/dma.rti |
48 --- a/rathaxes/samples/e1000/dma.rti | 81 --- a/rathaxes/samples/e1000/dma.rti |
49 +++ b/rathaxes/samples/e1000/dma.rti | 82 +++ b/rathaxes/samples/e1000/dma.rti |
50 @@ -29,6 +29,12 @@ | 83 @@ -29,6 +29,12 @@ |
51 provided chunk ::CALL(); | 84 provided chunk ::CALL(); |