1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # drivers_tdaq: Starts TDAQ related drivers
|
---|
4 | #
|
---|
5 | # Version: @(#) /etc/rc.d/init.d/drivers_tdaq 1.1
|
---|
6 | #
|
---|
7 | # chkconfig: 5 95 5
|
---|
8 | # description: Starts and stops tdaq drivers at boot time and shutdown.
|
---|
9 | #
|
---|
10 | # hide: true
|
---|
11 |
|
---|
12 | # Source function library.
|
---|
13 | . /etc/rc.d/init.d/functions
|
---|
14 |
|
---|
15 | export DRIVER_PATH=/usr/atlas/driver
|
---|
16 | export LD_LIBRARY_PATH=/usr/atlas/lib
|
---|
17 | export BINARY_PATH=/usr/atlas/bin
|
---|
18 | export VMETAB_PATH=/usr/atlas/driver
|
---|
19 |
|
---|
20 | # See how we were called.
|
---|
21 | case "$1" in
|
---|
22 | start)
|
---|
23 | echo "Starting CMEM_RCC driver "
|
---|
24 | # load the module
|
---|
25 | /sbin/insmod -f $DRIVER_PATH/cmem_rcc-`uname -r`.ko
|
---|
26 | # remove old device node
|
---|
27 | rm -f /dev/cmem_rcc
|
---|
28 | # get major number
|
---|
29 | major=`awk "\\$2==\"cmem_rcc\" {print \\$1}" /proc/devices`
|
---|
30 | echo major number is $major
|
---|
31 | # make device node
|
---|
32 | mknod /dev/cmem_rcc c $major 0
|
---|
33 | #give permissions
|
---|
34 | chmod 666 /dev/cmem_rcc
|
---|
35 | echo
|
---|
36 |
|
---|
37 | echo "Starting IO_RCC driver "
|
---|
38 | # load the module
|
---|
39 | /sbin/insmod -f $DRIVER_PATH/io_rcc-`uname -r`.ko
|
---|
40 | # remove old device node
|
---|
41 | rm -f /dev/io_rcc
|
---|
42 | # get major number
|
---|
43 | major=`awk "\\$2==\"io_rcc\" {print \\$1}" /proc/devices`
|
---|
44 | echo major number is $major
|
---|
45 | # make device node
|
---|
46 | mknod /dev/io_rcc c $major 0
|
---|
47 | # give permissions
|
---|
48 | chmod 666 /dev/io_rcc
|
---|
49 | echo
|
---|
50 |
|
---|
51 | export NROBINS=`/sbin/lspci -n | grep -c "10dc:0144"`
|
---|
52 | echo $NROBINS Robin cards found
|
---|
53 | if [ $NROBINS -gt 0 ]; then
|
---|
54 | echo "Starting ROBIN driver "
|
---|
55 | # load the module
|
---|
56 | /sbin/insmod -f $DRIVER_PATH/robin-`uname -r`.ko
|
---|
57 | # remove old device node
|
---|
58 | rm -f /dev/robin
|
---|
59 | # get major number
|
---|
60 | major=`awk "\\$2==\"robin\" {print \\$1}" /proc/devices`
|
---|
61 | echo major number is $major
|
---|
62 | # make device node
|
---|
63 | mknod /dev/robin c $major 0
|
---|
64 | # give permissions
|
---|
65 | chmod 666 /dev/robin
|
---|
66 | if [ $NROBINS -gt 0 ]; then
|
---|
67 | $BINARY_PATH/robinconfig 0 5
|
---|
68 | fi
|
---|
69 | if [ $NROBINS -gt 1 ]; then
|
---|
70 | $BINARY_PATH/robinconfig 1 5
|
---|
71 | fi
|
---|
72 | if [ $NROBINS -gt 2 ]; then
|
---|
73 | $BINARY_PATH/robinconfig 2 5
|
---|
74 | fi
|
---|
75 | if [ $NROBINS -gt 3 ]; then
|
---|
76 | $BINARY_PATH/robinconfig 3 5
|
---|
77 | fi
|
---|
78 | if [ $NROBINS -gt 4 ]; then
|
---|
79 | echo configuring robin 4
|
---|
80 | $BINARY_PATH/robinconfig 4 5
|
---|
81 | fi
|
---|
82 | echo
|
---|
83 | fi
|
---|
84 |
|
---|
85 | /sbin/lspci -n | grep "10e3:0000"
|
---|
86 | if [ $? = 0 ]; then
|
---|
87 | echo "Starting VME_RCC driver "
|
---|
88 | # load the module
|
---|
89 | /sbin/insmod -f $DRIVER_PATH/vme_rcc-`uname -r`.ko
|
---|
90 | # remove old device node
|
---|
91 | rm -f /dev/vme_rcc
|
---|
92 | # get major number
|
---|
93 | major=`awk "\\$2==\"vme_rcc\" {print \\$1}" /proc/devices`
|
---|
94 | echo major number is $major
|
---|
95 | # make device node
|
---|
96 | mknod /dev/vme_rcc c $major 0
|
---|
97 | # give permissions
|
---|
98 | chmod 666 /dev/vme_rcc
|
---|
99 | # Initialize the Universe chip
|
---|
100 | $BINARY_PATH/vmeconfig -a $VMETAB_PATH/vmetab
|
---|
101 | echo
|
---|
102 | fi
|
---|
103 |
|
---|
104 | /sbin/lspci -n | grep "10dc:001b"
|
---|
105 | if [ $? = 0 ]; then
|
---|
106 | echo "Starting QUEST driver "
|
---|
107 | # load the module
|
---|
108 | /sbin/insmod -f $DRIVER_PATH/quest-`uname -r`.ko
|
---|
109 | # remove old device node
|
---|
110 | rm -f /dev/quest
|
---|
111 | # get major number
|
---|
112 | major=`awk "\\$2==\"quest\" {print \\$1}" /proc/devices`
|
---|
113 | echo major number is $major
|
---|
114 | # make device node
|
---|
115 | mknod /dev/quest c $major 0
|
---|
116 | # give permissions
|
---|
117 | chmod 666 /dev/quest
|
---|
118 | echo
|
---|
119 | fi
|
---|
120 |
|
---|
121 | /sbin/lspci -n | grep "10dc:0017"
|
---|
122 | if [ $? = 0 ]; then
|
---|
123 | echo "Starting SOLAR driver "
|
---|
124 | # load the module
|
---|
125 | /sbin/insmod -f $DRIVER_PATH/solar-`uname -r`.ko
|
---|
126 | # remove old device node
|
---|
127 | rm -f /dev/solar
|
---|
128 | # get major number
|
---|
129 | major=`awk "\\$2==\"solar\" {print \\$1}" /proc/devices`
|
---|
130 | echo major number is $major
|
---|
131 | # make device node
|
---|
132 | mknod /dev/solar c $major 0
|
---|
133 | # give permissions
|
---|
134 | chmod 666 /dev/solar
|
---|
135 | echo
|
---|
136 | fi
|
---|
137 |
|
---|
138 | /sbin/lspci -n | grep "10dc:0014"
|
---|
139 | if [ $? = 0 ]; then
|
---|
140 | echo "Starting FILAR driver "
|
---|
141 | # load the module
|
---|
142 | /sbin/insmod -f $DRIVER_PATH/filar-`uname -r`.ko
|
---|
143 | # remove old device node
|
---|
144 | rm -f /dev/filar
|
---|
145 | # get major number
|
---|
146 | major=`awk "\\$2==\"filar\" {print \\$1}" /proc/devices`
|
---|
147 | echo major number is $major
|
---|
148 | # make device node
|
---|
149 | mknod /dev/filar c $major 0
|
---|
150 | # give permissions
|
---|
151 | chmod 666 /dev/filar
|
---|
152 | echo
|
---|
153 | fi
|
---|
154 | ;;
|
---|
155 |
|
---|
156 | stop)
|
---|
157 | echo "Shutting down CMEM_RCC driver "
|
---|
158 | /sbin/rmmod cmem_rcc
|
---|
159 |
|
---|
160 | echo "Shutting down IO_RCC driver "
|
---|
161 | /sbin/rmmod io_rcc
|
---|
162 |
|
---|
163 | /sbin/lsmod | grep robin
|
---|
164 | if [ $? = 0 ]; then
|
---|
165 | echo "Shutting down ROBIN driver "
|
---|
166 | /sbin/rmmod robin
|
---|
167 | fi
|
---|
168 |
|
---|
169 | /sbin/lsmod | grep vme_rcc
|
---|
170 | if [ $? = 0 ]; then
|
---|
171 | echo "Shutting down VME_RCC driver "
|
---|
172 | /sbin/rmmod vme_rcc
|
---|
173 | fi
|
---|
174 |
|
---|
175 | /sbin/lsmod | grep filar
|
---|
176 | if [ $? = 0 ]; then
|
---|
177 | echo "Shutting down FILAR driver "
|
---|
178 | /sbin/rmmod filar
|
---|
179 | fi
|
---|
180 |
|
---|
181 | /sbin/lsmod | grep quest
|
---|
182 | if [ $? = 0 ]; then
|
---|
183 | echo "Shutting down QUEST driver "
|
---|
184 | /sbin/rmmod quest
|
---|
185 | fi
|
---|
186 |
|
---|
187 | /sbin/lsmod | grep solar
|
---|
188 | if [ $? = 0 ]; then
|
---|
189 | echo "Shutting down SOLAR driver "
|
---|
190 | /sbin/rmmod solar
|
---|
191 | fi
|
---|
192 |
|
---|
193 | /sbin/lsmod | grep robintty
|
---|
194 | if [ $? = 0 ]; then
|
---|
195 | echo "Shutting down robin TTY driver "
|
---|
196 | /sbin/rmmod robintty
|
---|
197 | fi
|
---|
198 | ;;
|
---|
199 |
|
---|
200 | start_robin_tty)
|
---|
201 | /sbin/lsmod | grep robin-`uname -r`
|
---|
202 | if [ $? = 0 ]; then
|
---|
203 | echo "Starting robin TTY driver "
|
---|
204 | # load the module
|
---|
205 | /sbin/insmod -f $DRIVER_PATH/robintty-`uname -r`.ko
|
---|
206 | # remove old device node
|
---|
207 | rm -f /dev/robintty_*
|
---|
208 | # get major number
|
---|
209 | major=`awk "\\$2==\"tty_robin\" {print \\$1}" /proc/devices`
|
---|
210 | echo major number is $major
|
---|
211 | # make device node
|
---|
212 | mknod /dev/robin_tty0 c $major 0
|
---|
213 | mknod /dev/robin_tty1 c $major 1
|
---|
214 | mknod /dev/robin_tty2 c $major 2
|
---|
215 | mknod /dev/robin_tty3 c $major 3
|
---|
216 | mknod /dev/robin_tty4 c $major 4
|
---|
217 | mknod /dev/robin_tty5 c $major 5
|
---|
218 | # give permissions
|
---|
219 | chmod 666 /dev/robin_tty0
|
---|
220 | chmod 666 /dev/robin_tty1
|
---|
221 | chmod 666 /dev/robin_tty2
|
---|
222 | chmod 666 /dev/robin_tty3
|
---|
223 | chmod 666 /dev/robin_tty4
|
---|
224 | chmod 666 /dev/robin_tty5
|
---|
225 | echo
|
---|
226 | fi
|
---|
227 | ;;
|
---|
228 |
|
---|
229 | stop_robin_tty)
|
---|
230 | echo "Shutting down robin TTY driver "
|
---|
231 | /sbin/rmmod robintty-`uname -r`
|
---|
232 | echo
|
---|
233 | ;;
|
---|
234 |
|
---|
235 | status)
|
---|
236 | echo "Status of the cmem_rcc driver"
|
---|
237 | more /proc/cmem_rcc
|
---|
238 |
|
---|
239 | echo "Status of the io_rcc driver"
|
---|
240 | more /proc/io_rcc
|
---|
241 |
|
---|
242 | /sbin/lsmod | grep robin-`uname -r`
|
---|
243 | if [ $? = 0 ]; then
|
---|
244 | echo "Status of the ROBIN driver "
|
---|
245 | more /proc/robin
|
---|
246 | fi
|
---|
247 |
|
---|
248 | /sbin/lsmod | grep vme_rcc-`uname -r`
|
---|
249 | if [ $? = 0 ]; then
|
---|
250 | echo "Status of the VME_RCC driver "
|
---|
251 | more /proc/vme_rcc
|
---|
252 | fi
|
---|
253 |
|
---|
254 | /sbin/lsmod | grep filar-`uname -r`
|
---|
255 | if [ $? = 0 ]; then
|
---|
256 | echo "Status of the FILAR driver "
|
---|
257 | more /proc/filar
|
---|
258 | fi
|
---|
259 |
|
---|
260 | /sbin/lsmod | grep quest-`uname -r`
|
---|
261 | if [ $? = 0 ]; then
|
---|
262 | echo "Status of the QUEST driver "
|
---|
263 | more /proc/quest
|
---|
264 | fi
|
---|
265 |
|
---|
266 | /sbin/lsmod | grep solar-`uname -r`
|
---|
267 | if [ $? = 0 ]; then
|
---|
268 | echo "Status of the SOLAR driver "
|
---|
269 | /more /proc/solar
|
---|
270 | fi
|
---|
271 | ;;
|
---|
272 | *)
|
---|
273 | echo "*** Usage: drivers_tdaq {start|stop|status|start_robin_tty|stop_robin_tty}"
|
---|
274 | exit 1
|
---|
275 |
|
---|
276 | esac
|
---|
277 |
|
---|
278 | exit 0
|
---|