Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!ncar!gatech!bloom-beacon!eru!kth.se!sunic!mcsun!corton!inria!gna!axis-design!axis-design!john From: john@axis-design.fr (John Hughes) Newsgroups: comp.unix.sysv386 Subject: Re: how do I use ioctl(,MCAIO,) in ISC2.2 Message-ID: Date: 9 Apr 91 17:16:10 GMT References: <9492@cognos.UUCP> Sender: john@axis-design.axis-design.fr (John Hughes) Organization: A misspelling of organisation Lines: 31 In-Reply-To: dbullis@cognos.UUCP's message of 3 Apr 91 17:42:33 GMT In article <9492@cognos.UUCP> dbullis@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 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@axis-design.fr, maybe)