next up previous contents index
Next: 10.3.8 seg.h: Segment descriptor Up: (X86) Generic Low-level Definitions Previous: 10.3.6 far_ptr.h: Far (segment:offset)

10.3.7 pio.h: Programmed I/O functions

 

SYNOPSIS

#include <oskit/x86/pio.h>

DESCRIPTION

These are macros for accessing IO-space directly on the x86. These instructions will generate traps if executed in user-mode without permissions (either IOPL in the eflags register or access via the io-bitmap in the tss).

iodelay()
  A macro used to delay the processor for a short period of time, generally to wait until programmed io can complete. The actual amount of time is indeterminate, since the delay is accomplished by doing an inb from a nonexistent port, which depends on the processor and chipset. gif The nominal delay value is 1uS for most machines.

inl(port)
   Returns 32-bit value from port
inw(port)
   Returns 16-bit value from port
inb(port)
   Returns 8-bit value from port

inl_p(port)
   inl followed immediately by iodelay
inw_p(port)
   inw followed immediately by iodelay
inb_p(port)
   inb followed immediately by iodelay

outl(port, val)
   Send 32-bit val out port.
outw(port, val)
   Send 16-bit val out port.
outb(port, val)
   Send 8-bit val out port.

outl_p(port)
   outl followed immediately by iodelay
outw_p(port)
   outw followed immediately by iodelay
outb_p(port)
   outb followed immediately by iodelay

The above macros have versions that begin with i16_, which are defined to be the same. It may be desirable to use the i16_ versions in 16-bit code in place of the normal macros for clarity.

This header file is taken from CMU's Mach kernel.



University of Utah Flux Research Group