linux_lowio.c
Go to the documentation of this file.
00001 /* linux_lowio.c */
00002 /* -O optimization flag is needed */
00003 /* % gcc -c -Di386 -DLinux -DGCC -fpic -O linux_lowio.c -I/usr/local/eus/include
00004 /* % ld -shared -o linux_lowio.so linux_lowio.o
00005 
00006 */
00007 
00008 #include "eus.h"
00009 #include <asm/io.h>
00010 
00011 
00012 pointer IOPERM(context *ctx, int n, pointer argv[])
00013 { int val, stat;
00014   val= intval(argv[0]);
00015   stat= ioperm(0, 0x3ff, val);
00016   if (stat<0) {
00017     error("IOPERM failed because of insufficient priviledge");}
00018   return(T); }
00019 
00020 pointer OUTB(context *ctx, int n, pointer argv[])
00021 { int port, val;
00022   port=intval(argv[0]);
00023   val=intval(argv[1]);
00024   outb(val, port);
00025   return(argv[1]);
00026   }
00027 
00028 pointer INB(context *ctx, int n, pointer argv[])
00029 { int port, val;
00030   port=intval(argv[0]);
00031   val=inb(port);
00032   return(makeint(val));
00033   }
00034 
00035 pointer linux_lowio(context *ctx, int n, pointer argv[], pointer env)
00036 { pointer p=Spevalof(PACKAGE);
00037   pointer mod;
00038 
00039   mod = argv[0];
00040 
00041   /* Spevalof(PACKAGE)=unixpkg; */
00042 
00043   printf("ioperm, outb, inb\n");
00044 
00045   defun(ctx,"IOPERM", mod, IOPERM);
00046   defun(ctx,"OUTB", mod, OUTB);
00047   defun(ctx,"INB", mod, INB);
00048 
00049   printf("linux low level IO functions defined.\n");
00050 
00051   return(NIL);
00052   }
00053 
00054 
00055 


euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Mar 9 2017 04:57:50