linux_lowio.c
Go to the documentation of this file.
1 /* linux_lowio.c */
2 /* -O optimization flag is needed */
3 /* % gcc -c -Di386 -DLinux -DGCC -fpic -O linux_lowio.c -I/usr/local/eus/include
4 /* % ld -shared -o linux_lowio.so linux_lowio.o
5 
6 */
7 
8 #include "eus.h"
9 #include <asm/io.h>
10 
11 
12 pointer IOPERM(context *ctx, int n, pointer argv[])
13 { int val, stat;
14  val= intval(argv[0]);
15  stat= ioperm(0, 0x3ff, val);
16  if (stat<0) {
17  error("IOPERM failed because of insufficient priviledge");}
18  return(T); }
19 
20 pointer OUTB(context *ctx, int n, pointer argv[])
21 { int port, val;
22  port=intval(argv[0]);
23  val=intval(argv[1]);
24  outb(val, port);
25  return(argv[1]);
26  }
27 
28 pointer INB(context *ctx, int n, pointer argv[])
29 { int port, val;
30  port=intval(argv[0]);
31  val=inb(port);
32  return(makeint(val));
33  }
34 
35 pointer linux_lowio(context *ctx, int n, pointer argv[], pointer env)
36 { pointer p=Spevalof(PACKAGE);
37  pointer mod;
38 
39  mod = argv[0];
40 
41  /* Spevalof(PACKAGE)=unixpkg; */
42 
43  printf("ioperm, outb, inb\n");
44 
45  defun(ctx,"IOPERM", mod, IOPERM,NULL);
46  defun(ctx,"OUTB", mod, OUTB,NULL);
47  defun(ctx,"INB", mod, INB,NULL);
48 
49  printf("linux low level IO functions defined.\n");
50 
51  return(NIL);
52  }
53 
54 
55 
#define makeint(v)
Definition: sfttest.c:2
Definition: eus.h:522
pointer T
Definition: eus.c:110
GLfloat n[6][3]
Definition: cube.c:15
#define intval(p)
Definition: sfttest.c:1
defun("ADR_TO_STRING", mod, ADR_TO_STRING)
Definition: eus.h:379
pointer OUTB(context *ctx, int n, pointer argv[])
Definition: linux_lowio.c:20
pointer error(enum errorcode ec,...) pointer error(va_alist) va_dcl
Definition: eus.c:297
pointer PACKAGE
Definition: eus.c:110
pointer IOPERM(context *ctx, int n, pointer argv[])
Definition: linux_lowio.c:12
#define NULL
Definition: transargv.c:8
pointer INB(context *ctx, int n, pointer argv[])
Definition: linux_lowio.c:28
pointer NIL
Definition: eus.c:110
pointer linux_lowio(context *ctx, int n, pointer argv[], pointer env)
Definition: linux_lowio.c:35


euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 6 2019 20:00:44