4164
|
1 /*
|
|
2 This file is based on:
|
|
3 $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $
|
|
4 Modified for readability by Nick Kurshev
|
|
5 */
|
|
6 #include <sys/file.h>
|
|
7 #include <machine/console.h>
|
|
8 #ifndef GCCUSESGAS
|
|
9 #define GCCUSESGAS
|
|
10 #endif
|
|
11
|
|
12 static int io_fd;
|
|
13
|
|
14 static __inline__ void enable_os_io(void)
|
|
15 {
|
|
16 io_fd = -1 ;
|
|
17 if ((io_fd = open("/dev/console", O_RDWR, 0)) < 0) {
|
|
18 perror("/dev/console");
|
|
19 exit(1);
|
|
20 }
|
|
21 if (ioctl(io_fd, KDENABIO, 0) < 0) {
|
|
22 perror("ioctl(KDENABIO)");
|
|
23 exit(1);
|
|
24 }
|
|
25 }
|
|
26
|
|
27 static __inline__ void disable_os_io(void)
|
|
28 {
|
|
29 if (ioctl(io_fd, KDDISABIO, 0) < 0) {
|
|
30 perror("ioctl(KDDISABIO)");
|
|
31 close(io_fd);
|
|
32 exit(1);
|
|
33 }
|
|
34 close(io_fd);
|
|
35 }
|