DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Terminology for graphics driver writers

I/O ports, accessing from C

On SVR5 and SCO OpenServer 5, I/O ports are accessed from a C routine with the following functions:


outb(port, value)
outputs the least significant byte of value to port.

outw(port, value)
outputs the least significant 2-byte word of value to port.

outd(port, value)
outputs the 4-byte double word of value to port.

value = inb(port)
inputs a byte from port and stores it in value.

value = inw(port)
inputs a word from port and stores it in value.

value = ind(port)
inputs a double word from port and stores it in value.
On SVR5 and SCO OpenServer 5, the C compiler converts inb(), outb(), inw(), and outw() directly to hardware instructions without the overhead of a C function call if the C file is compiled with at least -Oi as part of the optimization flags. If you compile with debugging, (use the -g flag with the compile command) then all the I/O calls in your source become real C function calls. This helps when using debuggers that can trace specific function calls.

These routines are not used in NFB drivers on AIX 5L. Instead, all access to the I/O registers on the video card is performed through the PCI bus memory-mapped I/O regions. Use the grafGetMemInfo(D3nfb) function to obtain the address of the registers: For example, the following code is used in the xxxInit( ) routine:

   	grafData *grafinfo = DDX_GRAFINFO(pScreen);
   	unsigned char *IOreg_ptr;
   	unsigned char *FrameBuffer_ptr;
   	
       	grafGetMemInfo(grafinfo, "REGS", NULL, NULL, &IOreg_ptr))
       	grafGetMemInfo(grafinfo, "APERTURE", NULL, NULL, &FrameBuffer_ptr))

See ``Porting SVR5 NFB drivers to AIX 5L'' for additional information about accessing PCI configuration space in AIX 5L drivers.


© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005