how do I use ioctl(,MCAIO,) in ISC2.2
John Hughes
john at axis-design.fr
Wed Apr 10 03:16:10 AEST 1991
In article <9492 at cognos.UUCP> dbullis at cognos.UUCP (Dave Bullis) writes:
I am trying to set my Herculus mono-graphics board into graphics
mode with following code. However the 'ioctl(0,MCAIO,&arg)' call
fails with 'Invalid argument' on the first call to outb().
'ioctl(0,KDDISPTYPE,)' tell me that 0x3bf is a valid port, so
what's going on?
It took me AGES! to figure this one out a year or so ago.
The answer is simple, forget about MCAIO and just do the "outb" instruction
yourself. When you map the Herc memory in with KDMAPDISP set the "kd.ioflag"
flag. You will then be allowed to issue outb instructions to the Herc I/O
ports.
If you're using cc include <sys/inline.h> to get the "outb" instruction,
if you're using gcc then you can use this:
static inline void outb (unsigned short port, unsigned char val) {
asm volatile ("outb (%0)" : : "d" (port), "a" (val));
}
static inline unsigned char inb (unsigned short port) {
unsigned char val;
asm volatile ("inb (%1)" : "=a" (val) : "d" (port));
return val;
}
John Hughes (john at axis-design.fr, maybe)
More information about the Comp.unix.sysv386
mailing list