|
1 README file for the Meilhaus ME8100 driver. |
|
2 |
|
3 |
|
4 1) What you should have got: |
|
5 ============================ |
|
6 These files should be in your directory: |
|
7 - me8100.c the source code of the device driver |
|
8 - me8100.h a header file included from me8100.c |
|
9 - Makefile the makefile to compile the driver |
|
10 - me8100-driver a shell script to load and unload the driver |
|
11 - sysdep.h compatibility file down to kernel 2.0 |
|
12 - pci-compat.h compatibility file for pci stuff down to 2.0 |
|
13 - me8100_test_counter.c test program for counters |
|
14 - me8100_test_dio.c test program for digital I/O |
|
15 - me8100_test_int.c test program for interrupts |
|
16 - GNU_GPL a file containing the General Public License |
|
17 - README this file :-) |
|
18 |
|
19 2) How to compile the driver |
|
20 =========================== |
|
21 Be sure to have installed the kernel sources on your system. |
|
22 Normally you simply type |
|
23 make |
|
24 at your command prompt. If you have got a file me8100.o |
|
25 the make process worked. :-) |
|
26 |
|
27 |
|
28 3) How to install the driver: |
|
29 ============================= |
|
30 3.1) Automatic installation |
|
31 --------------------------- |
|
32 Make sure you are root and run |
|
33 ./me8100-driver start |
|
34 |
|
35 To get rid of the driver use |
|
36 ./me8100-driver stop |
|
37 |
|
38 A look at the me8100-driver shell script will give you |
|
39 closer informations about using it. |
|
40 |
|
41 3.2) Do it yourself installation |
|
42 -------------------------------- |
|
43 Make sure you are root and type |
|
44 insmod me8100.o |
|
45 A |
|
46 lsmod |
|
47 should print the modules loaded, including me8100. |
|
48 |
|
49 You must make a node for your driver e.g. |
|
50 mknod /dev/me8100 c <major> <minor> |
|
51 |
|
52 The major number has to be unique! The standard configuration is |
|
53 to automatically choose the major number. Type |
|
54 cat /proc/devices | grep me8100 |
|
55 you will get a line like this: |
|
56 254 me8100 |
|
57 |
|
58 In this example 254 is your major number. |
|
59 |
|
60 Now make a node in your file system: |
|
61 mknod /dev/me8100 c <major> <minor> |
|
62 |
|
63 The major number you already know. <minor> is the board number. |
|
64 Your first board is minor=0, second board minor=1 .... |
|
65 If you have only one board and the major number given in the example |
|
66 you would type: |
|
67 (make sure you are root !) |
|
68 mknod /dev/me8100 c 254 0 |
|
69 |
|
70 |
|
71 That's it! --> Enjoy |
|
72 |
|
73 |
|
74 4) How to use the driver |
|
75 ======================== |
|
76 4.1) Open the device |
|
77 -------------------- |
|
78 If you have used the install script described in 3.1), you have four nodes |
|
79 for your me8100 board in the /dev directroy, named me8100_0 to me8100_3. |
|
80 Before you can use the board, you have to open a path to the board: |
|
81 |
|
82 int file_handle; |
|
83 |
|
84 . |
|
85 . |
|
86 |
|
87 main(void){ |
|
88 |
|
89 . |
|
90 . |
|
91 |
|
92 file_handle = open("/dev/me8100_0", 0_RDWR, 0); |
|
93 |
|
94 . |
|
95 . |
|
96 |
|
97 } |
|
98 |
|
99 When the device is opend, the board is reset. This means, that the outputs are |
|
100 set to "0" and the interrupt logic is disabled. |
|
101 |
|
102 4.2) IOCTL's of the board |
|
103 ------------------------ |
|
104 Now the board is ready to use. In order to work with the board, you have |
|
105 to use the ioctl systemcall. You can find the defined ioctl's in the end of |
|
106 the headerfile me8100.h. |
|
107 |
|
108 In order to use this definitions you have to include the file me8100.h in |
|
109 your program. The ioctl systemcall will look something like this: |
|
110 |
|
111 |
|
112 #include "me8100.h" |
|
113 |
|
114 unsigned short mask; |
|
115 |
|
116 . |
|
117 . |
|
118 |
|
119 main(void){ |
|
120 |
|
121 . |
|
122 . |
|
123 |
|
124 ioctl(file_handle, ME8100_WRITE_MASK_A, &mask); |
|
125 |
|
126 . |
|
127 . |
|
128 |
|
129 } |
|
130 |
|
131 |
|
132 You have to pass the address of a variable to the driver. What type is |
|
133 necessary, you can get from the definitions of the ioctl's in |
|
134 the headerfile me8100.h. Please look at the source code to get closer |
|
135 information about the purpose of the diffrent ioctl's. |
|
136 |
|
137 4.3) Interrupt |
|
138 -------------- |
|
139 In order to get information about, how to handle the interrupt |
|
140 functionality of the driver refer to the source code of the test |
|
141 program. |
|
142 |
|
143 |
|
144 4.3) Close the device |
|
145 --------------------- |
|
146 If the work is done, you have to close the device. You have to use the |
|
147 systemcall close for this purpose: |
|
148 |
|
149 close(file_handle); |
|
150 |
|
151 When the device is closed, the board is reset. |
|
152 |
|
153 |
|
154 =============================================================================== |
|
155 Because live is never as simple as this you can read on if you got any problem. |
|
156 =============================================================================== |
|
157 |
|
158 The driver has been developed and tested under SuSE-Linux 7.1 kernel 2.4.0. |
|
159 If you want to know what your kernel version is, type |
|
160 cat /proc/version |
|
161 It will not run on older Linux versions then 2.4 down to 2.0. |
|
162 It should work with newer kernels, |
|
163 provided Linus did not change the interface for modules again. |
|
164 |
|
165 If you want to get closer informations about how to use the driver, |
|
166 please refer to the source code of the test programs. |
|
167 |
|
168 The handbook is also a good source to get informations, about the behavior |
|
169 of the board. |
|
170 |
|
171 - Meilhaus Electronic |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |