wiki:IoPorts

Version 1 (modified by mxb, 7 years ago) (diff)

Initial page on IO ports

When accessing the hardware directly, one of the most common operations is to read and write to hardware IO ports.

There is a macro located in losp/muerte/io-ports.lisp. This macro establishes an easy to use method of using IO ports.

Reading from an IO port is accomplished through the following function call:

(io-port <address> <data-type>)

Where:

  • <address> is the io-port address.
  • <data-type> is one of the following:
    • unsigned-byte8
    • unsigned-byte16
    • unsigned-byte32
    • character
    • location

To write to an IO port you use the following construction

(setf (io-port <address> <data-type>) <value>)

Where <address> and <data-type> are from the same types are IO port reads and <value> is the data you wish to write to the port.