annotate rathaxes_add_lkm_ethernet_sample.patch @ 40:0ff39df29c46

Add the code to reset the card
author Louis Opter <louis@lse.epitech.net>
date Sun, 08 Jan 2012 15:52:18 +0100
parents d761c8c625d3
children 87704b867fb0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
1 # HG changeset patch
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
2 # Parent b995d8934956b83383c144303178f3eb383d0acf
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
3 rathaxes: add the PCI/Ethernet part of a Linux Intel e1000 network card driver
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
4
40
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
5 diff --git a/maintainers/CMakeScripts/UseRathaxes.cmake b/maintainers/CMakeScripts/UseRathaxes.cmake
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
6 --- a/maintainers/CMakeScripts/UseRathaxes.cmake
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
7 +++ b/maintainers/CMakeScripts/UseRathaxes.cmake
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
8 @@ -193,6 +193,8 @@
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
9
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
10 SET(KERNEL_OBJECT_NAME "${RATHAXES_SOURCE}_${SYSTEM}.ko")
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
11 ADD_CUSTOM_COMMAND(OUTPUT "${KERNEL_OBJECT_NAME}"
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
12 + # …
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
13 + COMMAND "sed" "-i" "/TARTE/ d" "${RATHAXES_SOURCE}_${SYSTEM}.c"
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
14 # The linux Makefile to build kernel module is quite
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
15 # picky about file location and its own name. Let's
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
16 # copy our source side by side with the Makefile:
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
17 diff --git a/rathaxes/samples/CMakeLists.txt b/rathaxes/samples/CMakeLists.txt
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
18 --- a/rathaxes/samples/CMakeLists.txt
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
19 +++ b/rathaxes/samples/CMakeLists.txt
10
44a25ffd5c8c Reorganize the patch queue a bit: put the cmake patch first then the LKM patch then the PCI part
Louis Opter <louis@lse.epitech.net>
parents: 3
diff changeset
20 @@ -1,2 +1,3 @@
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
21 ADD_SUBDIRECTORY(helloworld)
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
22 +ADD_SUBDIRECTORY(lkm)
10
44a25ffd5c8c Reorganize the patch queue a bit: put the cmake patch first then the LKM patch then the PCI part
Louis Opter <louis@lse.epitech.net>
parents: 3
diff changeset
23 ADD_SUBDIRECTORY(syntax)
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
24 diff --git a/rathaxes/samples/lkm/CMakeLists.txt b/rathaxes/samples/lkm/CMakeLists.txt
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
25 new file mode 100644
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
26 --- /dev/null
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
27 +++ b/rathaxes/samples/lkm/CMakeLists.txt
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
28 @@ -0,0 +1,7 @@
39
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
29 +ADD_RATHAXES_SOURCES(lkm_src lkm.rtx
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
30 + RTI log.rti lkm.rti pci.rti socket.rti ethernet.rti e1000.rti
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
31 + BLT log.blt lkm.blt pci.blt socket.blt ethernet.blt e1000.blt)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
32 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
33 +# We can't name lkm since it's already used as the target name to generate the
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
34 +# source (with ADD_RATHAXES_SOURCES).
39
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
35 +ADD_RATHAXES_LKM(lkm lkm_src)
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
36 diff --git a/rathaxes/samples/lkm/e1000.blt b/rathaxes/samples/lkm/e1000.blt
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
37 new file mode 100644
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
38 --- /dev/null
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
39 +++ b/rathaxes/samples/lkm/e1000.blt
40
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
40 @@ -0,0 +1,267 @@
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
41 +with e1000, Ethernet, Socket, PCI, LKM, Log
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
42 +{
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
43 + template type e1000::Context()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
44 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
45 + chunk LKM::includes()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
46 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
47 + /*
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
48 + * Force the generation of the structure in the "headers" part, we
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
49 + * have to do this since we do not use the structure in this blt
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
50 + * (we hacked a bit and used it in ethernet.blt directly).
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
51 + */
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
52 + typedef int ${e1000::Context}; /* CNorm __std__ workaround */
39
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
53 + static const ${e1000::Context} force_struct_rtx_10000_ctx_decl;
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
54 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
55 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
56 + chunk ::decl()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
57 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
58 + struct rtx_e1000_ctx
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
59 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
60 + int bars;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
61 + unsigned char /* __iomem */ *ioaddr;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
62 + };
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
63 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
64 +
39
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
65 + chunk ::init(bars, ioaddr)
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
66 + {
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
67 + ${self}.bars = ${bars};
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
68 + ${self}.ioaddr = ${ioaddr};
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
69 + }
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
70 +
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
71 + map
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
72 + {
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
73 + }
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
74 + }
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
75 +
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
76 + template type e1000::Register()
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
77 + {
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
78 + chunk LKM::includes()
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
79 + {
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
80 + typedef int ${e1000::Register};
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
81 + static const ${e1000::Register} force_enum_rtx_e1000_registers_decl;
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
82 + }
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
83 +
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
84 + chunk ::decl()
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
85 + {
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
86 + enum rtx_e1000_registers
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
87 + {
40
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
88 + E1000_CTRL = 0x00000, /* Device Control - RW */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
89 + E1000_CTRL_DUP = 0x00004, /* Device Control Duplicate (Shadow) - RW */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
90 + E1000_STATUS = 0x00008, /* Device Status - RO */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
91 + E1000_EEPROM_FLASH = 0x00010, /* EEPROM/Flash Control - RW */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
92 + E1000_EEPROM_READ = 0x00014, /* EEPROM Read - RW */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
93 + E1000_CTRL_EXT = 0x00018, /* Extended Device Control - RW */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
94 + E1000_FLA = 0x0001C, /* Flash Access - RW */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
95 + E1000_MDIC = 0x00020 /* MDI Control - RW */
39
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
96 + };
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
97 + }
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
98 +
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
99 + chunk ::init(value)
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
100 + {
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
101 + ${self} = ${value};
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
102 + }
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
103 +
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
104 + map
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
105 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
106 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
107 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
108 +
40
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
109 + template type e1000::Commands()
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
110 + {
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
111 + chunk LKM::includes()
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
112 + {
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
113 + typedef int ${e1000::Commands};
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
114 + static const ${e1000::Commands} force_enum_rtx_e1000_commands_decls;
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
115 + }
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
116 +
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
117 + chunk ::decl()
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
118 + {
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
119 + enum rtx_e1000_commands
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
120 + {
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
121 + E1000_CMD_FD = 0x00000001, /* Full duplex.0=half; 1=full */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
122 + E1000_CMD_BEM = 0x00000002, /* Endian Mode.0=little,1=big */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
123 + E1000_CMD_PRIOR = 0x00000004, /* Priority on PCI. 0=rx,1=fair */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
124 + E1000_CMD_GIO_MASTER_DISABLE = 0x00000004, /* Blocks new Master requests */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
125 + E1000_CMD_LRST = 0x00000008, /* Link reset. 0=normal,1=reset */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
126 + E1000_CMD_TME = 0x00000010, /* Test mode. 0=normal,1=test */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
127 + E1000_CMD_SLE = 0x00000020, /* Serial Link on 0=dis,1=en */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
128 + E1000_CMD_ASDE = 0x00000020, /* Auto-speed detect enable */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
129 + E1000_CMD_SLU = 0x00000040, /* Set link up (Force Link) */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
130 + E1000_CMD_ILOS = 0x00000080, /* Invert Loss-Of Signal */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
131 + E1000_CMD_SPD_SEL = 0x00000300, /* Speed Select Mask */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
132 + E1000_CMD_SPD_10 = 0x00000000, /* Force 10Mb */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
133 + E1000_CMD_SPD_100 = 0x00000100, /* Force 100Mb */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
134 + E1000_CMD_SPD_1000 = 0x00000200, /* Force 1Gb */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
135 + E1000_CMD_BEM32 = 0x00000400, /* Big Endian 32 mode */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
136 + E1000_CMD_FRCSPD = 0x00000800, /* Force Speed */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
137 + E1000_CMD_FRCDPX = 0x00001000, /* Force Duplex */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
138 + E1000_CMD_D_UD_EN = 0x00002000, /* Dock/Undock enable */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
139 + E1000_CMD_D_UD_POLARITY = 0x00004000, /* Defined polarity of Dock/Undock indication in SDP[0] */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
140 + E1000_CMD_FORCE_PHY_RESET = 0x00008000, /* Reset both PHY ports, through PHYRST_N pin */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
141 + E1000_CMD_EXT_LINK_EN = 0x00010000, /* enable link status from external LINK_0 and LINK_1 pins */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
142 + E1000_CMD_SWDPIN0 = 0x00040000, /* SWDPIN 0 value */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
143 + E1000_CMD_SWDPIN1 = 0x00080000, /* SWDPIN 1 value */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
144 + E1000_CMD_SWDPIN2 = 0x00100000, /* SWDPIN 2 value */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
145 + E1000_CMD_SWDPIN3 = 0x00200000, /* SWDPIN 3 value */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
146 + E1000_CMD_SWDPIO0 = 0x00400000, /* SWDPIN 0 Input or output */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
147 + E1000_CMD_SWDPIO1 = 0x00800000, /* SWDPIN 1 input or output */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
148 + E1000_CMD_SWDPIO2 = 0x01000000, /* SWDPIN 2 input or output */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
149 + E1000_CMD_SWDPIO3 = 0x02000000, /* SWDPIN 3 input or output */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
150 + E1000_CMD_RST = 0x04000000, /* Global reset */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
151 + E1000_CMD_RFCE = 0x08000000, /* Receive Flow Control enable */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
152 + E1000_CMD_TFCE = 0x10000000, /* Transmit flow control enable */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
153 + E1000_CMD_RTE = 0x20000000, /* Routing tag enable */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
154 + E1000_CMD_VME = 0x40000000, /* IEEE VLAN mode enable */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
155 + E1000_CMD_PHY_RST = 0x80000000, /* PHY Reset */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
156 + E1000_CMD_SW2FW_INT = 0x02000000 /* Initiate an interrupt to manageability engine */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
157 + };
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
158 + }
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
159 +
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
160 + map
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
161 + {
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
162 + }
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
163 + }
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
164 +
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
165 + template sequence e1000::create_device()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
166 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
167 + chunk Ethernet::create_device()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
168 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
169 + rtx_ether_ctx->hw_ctx.bars = pci_select_bars(pdev, IORESOURCE_MEM);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
170 + if (pci_enable_device_mem(pdev))
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
171 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
172 + ${Log::info("e1000::create: pci_enable_device_mem failed")};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
173 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
174 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
175 + if (pci_request_selected_regions(pdev, rtx_ether_ctx->hw_ctx.bars, ${config.name}))
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
176 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
177 + ${Log::info("e1000::create: pci_request_selected_regions failed")};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
178 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
179 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
180 + if (${config.set_master})
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
181 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
182 + pci_set_master(pdev);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
183 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
184 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
185 + /* 0 here is for BAR_0: */
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
186 + rtx_ether_ctx->hw_ctx.ioaddr = pci_ioremap_bar(pdev, 0);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
187 + if (!rtx_ether_ctx->hw_ctx.ioaddr)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
188 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
189 + ${Log::info("e1000::create: pci_ioremap_bar failed")};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
190 + }
39
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
191 +
40
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
192 + rtx_e1000_print_status(&rtx_ether_ctx->hw_ctx);
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
193 + /* Reset the card */
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
194 + rtx_e1000_register_write32(&rtx_ether_ctx->hw_ctx, E1000_CTRL, E1000_CMD_RST);
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
195 + rtx_e1000_print_status(&rtx_ether_ctx->hw_ctx);
39
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
196 +
40
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
197 + /* Now we can load its mac address */
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
198 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
199 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
200 + chunk ::CALL
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
201 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
202 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
203 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
204 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
205 + template sequence e1000::destroy_device()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
206 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
207 + chunk Ethernet::destroy_device
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
208 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
209 + /*
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
210 + * Here, we should have some checks to avoid to free resources that
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
211 + * haven't been allocated. (e.g: in case of previous errors).
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
212 + */
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
213 + struct rtx_ethernet_dev* rtx_ether_ctx = netdev_priv(net_dev);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
214 + iounmap(rtx_ether_ctx->hw_ctx.ioaddr);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
215 + pci_release_selected_regions(pdev, rtx_ether_ctx->hw_ctx.bars);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
216 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
217 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
218 + chunk ::CALL
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
219 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
220 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
221 + }
39
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
222 +
40
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
223 + template sequence e1000::print_status()
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
224 + {
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
225 + chunk LKM::prototypes()
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
226 + {
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
227 + static void rtx_e1000_print_status(struct rtx_e1000_ctx *);
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
228 + }
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
229 +
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
230 + chunk LKM::code()
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
231 + {
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
232 + static void rtx_e1000_print_status(struct rtx_e1000_ctx *ctx)
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
233 + {
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
234 + unsigned int status = rtx_e1000_register_read32(ctx, E1000_STATUS);
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
235 + pr_info("rtx_e1000 status: \n");
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
236 + pr_info("\tRegister value: 0x%x\n", status);
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
237 + pr_info("\tMode: %s\n", (status & 1) ? "Full": "Half");
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
238 + pr_info("\tLink: %s\n", (status & 2) ? "Up" : "Down");
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
239 + pr_info("\tTransmission: %s\n", (status & 4) ? "Paused" : "Ok");
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
240 + pr_info("\tInterface: %s\n", (status & 3) == 3 ? "Up" : "Down");
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
241 + }
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
242 + }
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
243 +
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
244 + chunk ::CALL
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
245 + {
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
246 + }
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
247 + }
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
248 +
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
249 + /*
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
250 + * We should have been able to do something along those lines, but
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
251 + * it didn't work so we made the call manually.
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
252 + *
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
253 + * Ideally:
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
254 + * ${e1000::register_read32(rtx_ether_ctx->hw_ctx, E1000_STATUS)};
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
255 + *
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
256 + * Ideally2, not sure about the syntax on the register parameter:
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
257 + * ${e1000::register_read32(rtx_ether_ctx->hw_ctx, ${e1000::Register.E1000_STATUS})};
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
258 + *
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
259 + * "Acceptable":
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
260 + * typedef int ${e1000::Register}; // cnorm __std__ workaround
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
261 + * ${e1000::Register} reg_status;
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
262 + * ${e1000.init(E1000_STATUS); // didn't work, so we used the next line
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
263 + * reg_status = E1000_STATUS;
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
264 + * ${e1000::register_read32(rtx_ether_ctx->hw_ctx, reg_status)};
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
265 + */
39
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
266 + template sequence e1000::register_read32(e1000::Context ctx, e1000::Register reg_offset)
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
267 + {
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
268 + chunk LKM::prototypes()
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
269 + {
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
270 + static unsigned int rtx_e1000_register_read32(struct rtx_e1000_ctx *, unsigned int);
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
271 + }
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
272 +
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
273 + chunk LKM::code()
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
274 + {
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
275 + static unsigned int rtx_e1000_register_read32(struct rtx_e1000_ctx *ctx, unsigned int reg_offset)
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
276 + {
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
277 + return ioread32(ctx->ioaddr + reg_offset);
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
278 + }
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
279 + }
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
280 +
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
281 + chunk ::CALL()
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
282 + {
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
283 + rtx_e1000_register_read32(&${ctx}, ${reg_offset});
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
284 + }
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
285 + }
40
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
286 +
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
287 + template sequence e1000::register_write32(e1000::Context ctx, e1000::Register reg_offset, ::number value)
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
288 + {
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
289 + chunk LKM::prototypes()
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
290 + {
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
291 + static void rtx_e1000_register_write32(struct rtx_e1000_ctx *, unsigned int, unsigned int);
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
292 + }
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
293 +
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
294 + chunk LKM::code()
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
295 + {
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
296 + static void rtx_e1000_register_write32(struct rtx_e1000_ctx *ctx, unsigned int reg_offset, unsigned int value)
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
297 + {
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
298 + iowrite32(value, ctx->ioaddr + reg_offset);
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
299 + }
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
300 + }
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
301 +
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
302 + chunk ::CALL()
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
303 + {
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
304 + rtx_e1000_register_write32(&${ctx}, ${reg_offset});
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
305 + }
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
306 + }
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
307 +}
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
308 diff --git a/rathaxes/samples/lkm/e1000.rti b/rathaxes/samples/lkm/e1000.rti
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
309 new file mode 100644
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
310 --- /dev/null
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
311 +++ b/rathaxes/samples/lkm/e1000.rti
40
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
312 @@ -0,0 +1,51 @@
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
313 +interface e1000 : Socket, Ethernet, PCI, LKM
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
314 +{
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
315 + provided type e1000::Context;
39
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
316 + provided type e1000::Register;
40
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
317 + provided type e1000::Commands;
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
318 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
319 + /*
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
320 + * This sequence should receive an argument like Ethernet::Device, but it is
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
321 + * unclear about how this argument should be bound to a variable/argument in
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
322 + * the instrumented C code.
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
323 + *
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
324 + * Here again, we rely on the fact that *we* wrote the parent context and
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
325 + * named the C variables we need/use with the same name everywhere.
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
326 + */
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
327 + provided sequence e1000::create_device()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
328 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
329 + provided chunk Ethernet::create_device;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
330 + provided chunk ::CALL;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
331 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
332 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
333 + provided sequence e1000::destroy_device()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
334 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
335 + provided chunk Ethernet::destroy_device;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
336 + provided chunk ::CALL;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
337 + }
39
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
338 +
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
339 + /*
40
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
340 + * This should take an e1000::Context as the first argument but this was
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
341 + * not working as wished.
39
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
342 + */
40
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
343 + provided sequence e1000::print_status()
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
344 + {
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
345 + provided chunk LKM::prototypes;
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
346 + provided chunk LKM::code;
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
347 + provided chunk ::CALL;
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
348 + }
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
349 +
39
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
350 + provided sequence e1000::register_read32(e1000::Context, e1000::Register)
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
351 + {
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
352 + provided chunk LKM::prototypes;
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
353 + provided chunk LKM::code;
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
354 + provided chunk ::CALL;
d761c8c625d3 Try to read a register on the card
Louis Opter <louis@lse.epitech.net>
parents: 38
diff changeset
355 + }
40
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
356 +
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
357 + provided sequence e1000::register_write32(e1000::Context, e1000::Register, ::number)
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
358 + {
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
359 + provided chunk LKM::prototypes;
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
360 + provided chunk LKM::code;
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
361 + provided chunk ::CALL;
0ff39df29c46 Add the code to reset the card
Louis Opter <louis@lse.epitech.net>
parents: 39
diff changeset
362 + }
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
363 +}
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
364 diff --git a/rathaxes/samples/lkm/ethernet.blt b/rathaxes/samples/lkm/ethernet.blt
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
365 new file mode 100644
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
366 --- /dev/null
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
367 +++ b/rathaxes/samples/lkm/ethernet.blt
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
368 @@ -0,0 +1,207 @@
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
369 +with Ethernet, PCI, LKM, Log
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
370 +{
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
371 + template type Ethernet::Device()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
372 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
373 + chunk LKM::includes()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
374 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
375 + #include <linux/netdevice.h>
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
376 + #include <linux/etherdevice.h>
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
377 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
378 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
379 + chunk ::decl()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
380 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
381 + struct rtx_ethernet_dev
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
382 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
383 + /*
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
384 + * I think it's useless to use the ${PCI::Device} "abstraction"
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
385 + * here, since we are already in a Linux specific context here.
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
386 + */
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
387 + struct pci_dev *pci_dev;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
388 + struct net_device *net_dev;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
389 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
390 + /* while waiting on issue #8 */
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
391 + struct rtx_e1000_ctx hw_ctx;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
392 + };
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
393 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
394 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
395 + chunk ::init(net_dev)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
396 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
397 + ${self} = ${net_dev};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
398 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
399 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
400 + map
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
401 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
402 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
403 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
404 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
405 + template sequence Ethernet::open(Ethernet::Device dev)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
406 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
407 + chunk LKM::prototypes()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
408 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
409 + static int rtx_ethernet_open(struct net_device *);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
410 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
411 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
412 + chunk LKM::code()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
413 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
414 + static int rtx_ethernet_open(struct net_device *dev)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
415 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
416 + ${pointcut ::IMPLEMENTATION};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
417 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
418 + return 0;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
419 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
420 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
421 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
422 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
423 + template sequence Ethernet::send(Ethernet::Device dev, Socket::SKBuff skb)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
424 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
425 + chunk LKM::prototypes()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
426 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
427 + static int rtx_ethernet_xmit(struct sk_buff* skb, struct net_device *dev);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
428 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
429 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
430 + chunk LKM::code()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
431 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
432 + static int rtx_ethernet_xmit(struct sk_buff* skb, struct net_device *dev)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
433 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
434 + ${pointcut ::IMPLEMENTATION};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
435 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
436 + return 0;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
437 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
438 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
439 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
440 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
441 + template sequence Ethernet::close(Ethernet::Device dev)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
442 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
443 + chunk LKM::prototypes()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
444 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
445 + static int rtx_ethernet_close(struct net_device *);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
446 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
447 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
448 + chunk LKM::code()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
449 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
450 + static int rtx_ethernet_close(struct net_device *dev)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
451 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
452 + ${pointcut ::IMPLEMENTATION};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
453 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
454 + return 0;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
455 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
456 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
457 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
458 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
459 + template sequence Ethernet::interrupt_handler(Ethernet::Device dev)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
460 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
461 + /*
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
462 + * We can't use the irqreturn_t type here because CNornm doesn't know
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
463 + * it.
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
464 + */
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
465 + chunk LKM::prototypes()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
466 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
467 + static enum irqreturn rtx_ethernet_interrupt_handler(int, void *);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
468 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
469 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
470 + chunk LKM::code()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
471 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
472 + static enum irqreturn rtx_ethernet_interrupt_handler(int irq, void *dev_id)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
473 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
474 + ${pointcut ::IMPLEMENTATION};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
475 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
476 + return IRQ_NONE;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
477 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
478 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
479 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
480 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
481 + template sequence Ethernet::init(PCI::Device pdev)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
482 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
483 + chunk LKM::data()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
484 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
485 + static const struct net_device_ops rtx_ether_ops =
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
486 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
487 + .ndo_open = rtx_ethernet_open,
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
488 + .ndo_stop = rtx_ethernet_close,
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
489 + .ndo_start_xmit = rtx_ethernet_xmit,
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
490 + };
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
491 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
492 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
493 + chunk PCI::pci_probe_hook()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
494 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
495 + /*
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
496 + * This typedef is needed to workaround a bug in CNorm __std__
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
497 + * dialect.
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
498 + */
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
499 + typedef int ${Ethernet::Device};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
500 + ${Ethernet::Device} *rtx_ether_ctx;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
501 + struct net_device *net_dev;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
502 + int error;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
503 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
504 + error = 0;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
505 + net_dev = alloc_etherdev(sizeof(*rtx_ether_ctx));
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
506 + if (net_dev == 0)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
507 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
508 + ${Log::info("Cannot allocate memory")};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
509 + /*
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
510 + * Again, the error should be "raised" in the parent context.
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
511 + *
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
512 + * Here we know that we should return ENOMEM because *we* wrote
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
513 + * the parent context.
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
514 + */
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
515 + return -ENOMEM;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
516 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
517 + strlcpy(net_dev->name, ${config.ifname}, sizeof(net_dev->name));
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
518 + net_dev->irq = pdev->irq;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
519 + // Maybe we should try ${rtx_ether_ctx.init()} here:
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
520 + rtx_ether_ctx = netdev_priv(net_dev);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
521 + //rtx_ether_ctx->pci_dev = ${pdev};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
522 + rtx_ether_ctx->pci_dev = pdev; // In the meantime do it directly
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
523 + rtx_ether_ctx->net_dev = net_dev;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
524 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
525 + /*
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
526 + * The substitution of ${pdev} fails here. I also tried to add a
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
527 + * "substitute method" to the PCI::Device that was just doing
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
528 + * "${self}" but it didn't work either (it was subsituted by a
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
529 + * placeholder, e.g: _1).
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
530 + *
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
531 + * That's why we cheated a bit and named all the arguments pdev.
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
532 + */
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
533 + //SET_NETDEV_DEV(net_dev, &${pdev}->dev);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
534 + SET_NETDEV_DEV(net_dev, &pdev->dev);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
535 + net_dev->netdev_ops = &rtx_ether_ops;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
536 + if ((error = register_netdev(net_dev)))
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
537 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
538 + ${Log::info("Cannot register the driver")};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
539 + return error;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
540 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
541 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
542 + /* same problem as above with ${pdev} */
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
543 + //pci_set_drvdata(${pdev}, net_dev);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
544 + pci_set_drvdata(pdev, net_dev);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
545 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
546 + ${pointcut Ethernet::create_device};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
547 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
548 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
549 + chunk ::CALL
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
550 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
551 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
552 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
553 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
554 + template sequence Ethernet::exit(PCI::Device pdev)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
555 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
556 + chunk PCI::pci_remove_hook()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
557 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
558 + struct net_device *net_dev = pci_get_drvdata(pdev);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
559 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
560 + ${pointcut Ethernet::destroy_device};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
561 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
562 + unregister_netdev(net_dev);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
563 + /*
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
564 + * If we had some cleanup todo with struct rtx_ether_ctx we would
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
565 + * do a netdev_priv(net_dev) here and do it.
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
566 + */
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
567 + free_netdev(net_dev);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
568 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
569 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
570 + chunk ::CALL
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
571 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
572 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
573 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
574 +}
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
575 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
576 diff --git a/rathaxes/samples/lkm/ethernet.rti b/rathaxes/samples/lkm/ethernet.rti
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
577 new file mode 100644
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
578 --- /dev/null
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
579 +++ b/rathaxes/samples/lkm/ethernet.rti
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
580 @@ -0,0 +1,47 @@
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
581 +interface Ethernet : Socket, PCI, LKM
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
582 +{
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
583 + provided type Ethernet::Device;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
584 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
585 + required variable ::string Ethernet::ifname;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
586 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
587 + required sequence Ethernet::open(Ethernet::Device)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
588 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
589 + provided chunk LKM::prototypes;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
590 + provided chunk LKM::code;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
591 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
592 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
593 + required sequence Ethernet::send(Ethernet::Device dev, Socket::SKBuff skb)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
594 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
595 + provided chunk LKM::prototypes;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
596 + provided chunk LKM::code;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
597 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
598 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
599 + required sequence Ethernet::close(Ethernet::Device)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
600 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
601 + provided chunk LKM::prototypes;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
602 + provided chunk LKM::code;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
603 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
604 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
605 + required sequence Ethernet::interrupt_handler(Ethernet::Device)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
606 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
607 + provided chunk LKM::prototypes;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
608 + provided chunk LKM::code;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
609 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
610 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
611 + provided sequence Ethernet::init(PCI::Device)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
612 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
613 + provided chunk LKM::data;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
614 + provided chunk PCI::pci_probe_hook;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
615 + provided chunk ::CALL;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
616 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
617 + provided pointcut Ethernet::create_device;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
618 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
619 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
620 + provided sequence Ethernet::exit(PCI::Device)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
621 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
622 + provided chunk ::CALL;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
623 + provided chunk PCI::pci_remove_hook;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
624 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
625 + provided pointcut Ethernet::destroy_device;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
626 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
627 +}
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
628 diff --git a/rathaxes/samples/lkm/lkm.blt b/rathaxes/samples/lkm/lkm.blt
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
629 new file mode 100644
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
630 --- /dev/null
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
631 +++ b/rathaxes/samples/lkm/lkm.blt
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
632 @@ -0,0 +1,55 @@
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
633 +with LKM
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
634 +{
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
635 + /* Skel of the generated C file: */
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
636 + ${pointcut LKM::includes};
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
637 + ${pointcut LKM::prototypes};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
638 + ${pointcut LKM::data};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
639 + ${pointcut LKM::code};
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
640 +
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
641 + template sequence LKM::init()
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
642 + {
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
643 + chunk LKM::includes()
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
644 + {
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
645 + #include <linux/module.h>
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
646 + #include <linux/kernel.h>
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
647 + }
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
648 +
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
649 + chunk LKM::data()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
650 + {
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
651 + MODULE_DESCRIPTION(${config.description});
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
652 + MODULE_AUTHOR(${config.author});
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
653 + MODULE_LICENSE(${config.license});
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
654 + }
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
655 +
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
656 + chunk LKM::code()
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
657 + {
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
658 + /*
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
659 + * Rathaxes doesn't yet support arbitrary "decorators" like __init
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
660 + * or __exit.
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
661 + */
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
662 + static int __attribute__((__section__(".init.text"))) rtx_module_init(void)
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
663 + {
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
664 + ${pointcut ::IMPLEMENTATION};
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
665 + ${pointcut LKM::init_bus_hook};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
666 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
667 + return 0;
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
668 + }
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
669 +
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
670 + module_init(rtx_module_init);
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
671 + }
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
672 + }
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
673 +
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
674 + template sequence LKM::exit()
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
675 + {
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
676 + chunk LKM::code()
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
677 + {
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
678 + static void __attribute__((__section__(".exit.text"))) rtx_module_exit(void)
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
679 + {
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
680 + ${pointcut ::IMPLEMENTATION};
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
681 + ${pointcut LKM::deinit_bus_hook};
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
682 + }
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
683 +
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
684 + module_exit(rtx_module_exit);
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
685 + }
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
686 + }
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
687 +}
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
688 diff --git a/rathaxes/samples/lkm/lkm.rti b/rathaxes/samples/lkm/lkm.rti
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
689 new file mode 100644
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
690 --- /dev/null
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
691 +++ b/rathaxes/samples/lkm/lkm.rti
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
692 @@ -0,0 +1,25 @@
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
693 +interface LKM
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
694 +{
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
695 + provided pointcut LKM::includes;
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
696 + /* maybe it should be possible to use chunk ::decl in sequence templates? */
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
697 + provided pointcut LKM::prototypes;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
698 + provided pointcut LKM::data;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
699 + provided pointcut LKM::code;
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
700 +
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
701 + required variable ::string LKM::author;
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
702 + required variable ::string LKM::description;
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
703 + required variable ::string LKM::license;
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
704 +
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
705 + required sequence LKM::init()
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
706 + {
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
707 + provided chunk LKM::includes;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
708 + provided chunk LKM::code;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
709 + provided pointcut LKM::init_bus_hook;
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
710 + }
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
711 +
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
712 + required sequence LKM::exit()
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
713 + {
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
714 + provided chunk LKM::code;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
715 + provided pointcut LKM::deinit_bus_hook;
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
716 + }
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
717 +}
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
718 diff --git a/rathaxes/samples/lkm/lkm.rtx b/rathaxes/samples/lkm/lkm.rtx
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
719 new file mode 100644
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
720 --- /dev/null
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
721 +++ b/rathaxes/samples/lkm/lkm.rtx
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
722 @@ -0,0 +1,46 @@
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
723 +device LKM use LKM, PCI, Ethernet, Log
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
724 +{
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
725 + Ethernet::open(Ethernet::Device dev)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
726 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
727 + Log::info("Open the device");
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
728 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
729 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
730 + Ethernet::close(Ethernet::Device dev)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
731 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
732 + Log::info("Close the device");
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
733 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
734 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
735 + Ethernet::interrupt_handler(Ethernet::Device dev)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
736 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
737 + Log::info("Got an interruption");
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
738 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
739 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
740 + Ethernet::send(Ethernet::Device dev, Socket::SKBuff skb)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
741 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
742 + Log::info("We have one packet to transmit!");
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
743 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
744 +
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
745 + LKM::init()
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
746 + {
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
747 + Log::info("Hello this is LKM");
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
748 + }
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
749 +
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
750 + LKM::exit()
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
751 + {
10
44a25ffd5c8c Reorganize the patch queue a bit: put the cmake patch first then the LKM patch then the PCI part
Louis Opter <louis@lse.epitech.net>
parents: 3
diff changeset
752 + Log::info("Good bye this was LKM");
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
753 + }
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
754 +}
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
755 +
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
756 +configuration
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
757 +{
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
758 + LKM::name = "hello";
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
759 + LKM::author = "Rathaxes";
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
760 + LKM::description = "Hello World Loadable Kernel Module (LKM)";
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
761 + LKM::license = "GPL";
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
762 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
763 + PCI::vendor_id = 0x8086;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
764 + PCI::product_id = 0x100f;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
765 + PCI::set_master = true;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
766 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
767 + Ethernet::ifname = "rtx%d";
3
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
768 +}
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
769 diff --git a/rathaxes/samples/lkm/log.blt b/rathaxes/samples/lkm/log.blt
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
770 new file mode 100644
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
771 --- /dev/null
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
772 +++ b/rathaxes/samples/lkm/log.blt
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
773 @@ -0,0 +1,10 @@
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
774 +with Log
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
775 +{
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
776 + template sequence Log::info(::string msg)
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
777 + {
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
778 + chunk ::CALL
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
779 + {
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
780 + pr_info("%s\n", ${msg});
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
781 + }
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
782 + }
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
783 +}
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
784 diff --git a/rathaxes/samples/lkm/log.rti b/rathaxes/samples/lkm/log.rti
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
785 new file mode 100644
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
786 --- /dev/null
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
787 +++ b/rathaxes/samples/lkm/log.rti
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
788 @@ -0,0 +1,7 @@
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
789 +interface Log
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
790 +{
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
791 + provided sequence Log::info(::string)
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
792 + {
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
793 + provided chunk ::CALL;
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
794 + }
2389c2bc501f Start to write a queue for the LKM
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
795 +}
38
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
796 diff --git a/rathaxes/samples/lkm/pci.blt b/rathaxes/samples/lkm/pci.blt
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
797 new file mode 100644
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
798 --- /dev/null
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
799 +++ b/rathaxes/samples/lkm/pci.blt
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
800 @@ -0,0 +1,143 @@
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
801 +with PCI, LKM, Log
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
802 +{
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
803 + template type PCI::Device()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
804 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
805 + chunk LKM::includes()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
806 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
807 + #include <linux/pci.h>
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
808 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
809 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
810 + chunk ::decl()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
811 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
812 + struct pci_dev;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
813 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
814 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
815 + chunk ::init(pci_dev)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
816 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
817 + ${self} = ${pci_dev};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
818 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
819 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
820 + map
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
821 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
822 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
823 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
824 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
825 + template sequence PCI::probe(PCI::Device pdev)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
826 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
827 + chunk LKM::prototypes()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
828 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
829 + static int /* __devinit */ rtx_pci_probe(struct pci_dev *,
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
830 + const struct pci_device_id *);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
831 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
832 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
833 + chunk LKM::code()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
834 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
835 + static int /* __devinit */ rtx_pci_probe(struct pci_dev *pdev,
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
836 + const struct pci_device_id *pdev_id)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
837 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
838 + int err;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
839 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
840 + err = pci_enable_device(pdev);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
841 + if (err < 0)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
842 + goto fail;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
843 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
844 + ${pointcut PCI::pci_probe_hook};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
845 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
846 + return 0;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
847 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
848 + fail:
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
849 + return err;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
850 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
851 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
852 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
853 + chunk ::CALL
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
854 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
855 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
856 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
857 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
858 + template sequence PCI::remove(PCI::Device pdev)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
859 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
860 + chunk LKM::prototypes()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
861 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
862 + static void rtx_pci_remove(struct pci_dev *);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
863 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
864 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
865 + chunk LKM::code()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
866 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
867 + static void rtx_pci_remove(struct pci_dev *pdev)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
868 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
869 + ${pointcut PCI::pci_remove_hook};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
870 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
871 + pci_disable_device(pdev);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
872 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
873 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
874 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
875 + chunk ::CALL()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
876 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
877 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
878 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
879 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
880 + template sequence PCI::register()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
881 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
882 + chunk LKM::data()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
883 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
884 + /*
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
885 + * CNorm doesn't seem to like "dynamic" arrays (i.e: you always
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
886 + * have to specify the exact size).
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
887 + */
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
888 + static struct pci_device_id rtx_pci_device_table[2] = {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
889 + { ${config.vendor_id}, ${config.product_id}, PCI_ANY_ID, PCI_ANY_ID },
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
890 + { 0, }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
891 + };
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
892 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
893 + static struct pci_driver rtx_pci_driver = {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
894 + .name = ${config.name},
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
895 + .id_table = rtx_pci_device_table,
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
896 + .probe = rtx_pci_probe,
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
897 + .remove = rtx_pci_remove
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
898 + };
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
899 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
900 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
901 + chunk LKM::init_bus_hook()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
902 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
903 + int error;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
904 + if ((error = pci_register_driver(&rtx_pci_driver)))
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
905 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
906 + ${Log::info("Cannot register pci driver")};
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
907 + /*
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
908 + * So we catched the error but how do we return it to the
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
909 + * parent context?
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
910 + *
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
911 + * Here we know that we can just return error, but that's just
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
912 + * a coincidence (and, in this case, *we* wrote the parent
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
913 + * context).
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
914 + */
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
915 + return error;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
916 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
917 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
918 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
919 + chunk ::CALL()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
920 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
921 + /*
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
922 + * The implementation of ::CALL is empty. This template sequence is
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
923 + * actually not provided nor required.
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
924 + *
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
925 + * This sequence is just "intermediate" code that will just inject
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
926 + * itself in the hook LKM::init_bus_hook for which this sequence
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
927 + * has a chunk (see above chunk).
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
928 + */
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
929 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
930 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
931 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
932 + template sequence PCI::unregister()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
933 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
934 + chunk LKM::deinit_bus_hook()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
935 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
936 + pci_unregister_driver(&rtx_pci_driver);
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
937 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
938 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
939 + chunk ::CALL
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
940 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
941 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
942 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
943 +}
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
944 diff --git a/rathaxes/samples/lkm/pci.rti b/rathaxes/samples/lkm/pci.rti
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
945 new file mode 100644
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
946 --- /dev/null
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
947 +++ b/rathaxes/samples/lkm/pci.rti
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
948 @@ -0,0 +1,36 @@
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
949 +interface PCI : LKM
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
950 +{
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
951 + provided type PCI::Device;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
952 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
953 + required variable ::number PCI::vendor_id;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
954 + required variable ::number PCI::product_id;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
955 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
956 + provided sequence PCI::register()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
957 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
958 + provided chunk ::CALL;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
959 + provided chunk LKM::data;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
960 + provided chunk LKM::init_bus_hook;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
961 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
962 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
963 + provided sequence PCI::unregister()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
964 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
965 + provided chunk ::CALL;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
966 + provided chunk LKM::deinit_bus_hook;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
967 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
968 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
969 + provided sequence PCI::probe(PCI::Device)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
970 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
971 + provided chunk LKM::prototypes;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
972 + provided chunk LKM::code;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
973 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
974 + provided pointcut PCI::pci_probe_hook;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
975 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
976 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
977 + provided sequence PCI::remove(PCI::Device)
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
978 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
979 + provided chunk LKM::prototypes;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
980 + provided chunk LKM::code;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
981 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
982 + provided pointcut PCI::pci_remove_hook;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
983 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
984 +}
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
985 diff --git a/rathaxes/samples/lkm/socket.blt b/rathaxes/samples/lkm/socket.blt
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
986 new file mode 100644
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
987 --- /dev/null
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
988 +++ b/rathaxes/samples/lkm/socket.blt
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
989 @@ -0,0 +1,27 @@
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
990 +with Socket, LKM
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
991 +{
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
992 + template type Socket::SKBuff()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
993 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
994 + chunk LKM::includes()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
995 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
996 + #include <linux/skbuff.h>
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
997 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
998 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
999 + chunk ::decl()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1000 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1001 + struct sk_buff;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1002 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1003 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1004 + chunk ::init()
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1005 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1006 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1007 +
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1008 + map
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1009 + {
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1010 + // some work may have to be done here in order
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1011 + // to access to some field of the sk_buff.
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1012 + // We should determine if all the sk_buff managment
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1013 + // can be abstracted from the user.
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1014 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1015 + }
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1016 +}
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1017 diff --git a/rathaxes/samples/lkm/socket.rti b/rathaxes/samples/lkm/socket.rti
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1018 new file mode 100644
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1019 --- /dev/null
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1020 +++ b/rathaxes/samples/lkm/socket.rti
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1021 @@ -0,0 +1,4 @@
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1022 +interface Socket : LKM
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1023 +{
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1024 + provided type Socket::SKBuff;
f43900ad7e66 Fold All The Patches on the LKM Sample
Louis Opter <louis@lse.epitech.net>
parents: 10
diff changeset
1025 +}