wiki:IoPorts
close Warning: Can't synchronize with repository "(default)" (/project/movitz/svn does not appear to be a Subversion repository.). Look in the Trac log for more information.

Version 1 (modified by mxb, 10 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.