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 
NIL
pointer NIL
Definition: eus.c:110
defun
defun("ADR_TO_STRING", mod, ADR_TO_STRING)
makeint
#define makeint(v)
Definition: sfttest.c:2
context
Definition: eus.h:524
PACKAGE
pointer PACKAGE
Definition: eus.c:110
intval
#define intval(p)
Definition: sfttest.c:1
T
pointer T
Definition: eus.c:110
linux_lowio
pointer linux_lowio(context *ctx, int n, pointer argv[], pointer env)
Definition: linux_lowio.c:35
eus.h
OUTB
pointer OUTB(context *ctx, int n, pointer argv[])
Definition: linux_lowio.c:20
NULL
#define NULL
Definition: transargv.c:8
error
pointer error(enum errorcode ec,...) pointer error(va_alist) va_dcl
Definition: eus.c:297
INB
pointer INB(context *ctx, int n, pointer argv[])
Definition: linux_lowio.c:28
cell
Definition: eus.h:381
IOPERM
pointer IOPERM(context *ctx, int n, pointer argv[])
Definition: linux_lowio.c:12
n
GLfloat n[6][3]
Definition: cube.c:15


euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 15 2023 02:06:43