Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

io.h

Go to the documentation of this file.
00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT!         -*- c++ -*-
00002 
00003 #ifndef io_h
00004 #define io_h
00005 
00006 #include "types.h"
00007 
00008 //
00009 // INTERFACE definition follows 
00010 //
00011 
00012 
00016 class Io
00017 {
00018 public:
00019 
00021   static void iodelay();
00022 
00023   template< typename T >
00024   static T read( Address address );
00025 
00026   template< typename T >
00027   static void write( T value, Address address );
00028 
00032   static Unsigned8  in8 ( unsigned long port );
00033 
00037   static Unsigned16 in16( unsigned long port );
00038 
00042   static Unsigned32 in32( unsigned long port );
00043 
00047   static void out8 ( Unsigned8  val, unsigned long port );
00048 
00052   static void out16( Unsigned16 val, unsigned long port );
00053 
00057   static void out32( Unsigned32 val, unsigned long port );
00058 
00060 
00061 
00065   static Unsigned8  in8_p ( unsigned long port );
00066 
00070   static Unsigned16 in16_p( unsigned long port );
00071 
00075   static Unsigned32 in32_p( unsigned long port );
00076 
00080   static void out8_p ( Unsigned8  val, unsigned long port );
00081 
00085   static void out16_p( Unsigned16 val, unsigned long port );
00086 
00090   static void out32_p( Unsigned32 val, unsigned long port );
00092 
00093 };
00094 
00095 //
00096 // IMPLEMENTATION of inline functions (and needed classes)
00097 //
00098 
00099 
00100 
00101 
00102 inline Unsigned8  Io::in8_p( unsigned long port )
00103 {
00104   Unsigned8 tmp = in8(port);
00105   iodelay();
00106   return tmp;
00107 }
00108 
00109 
00110 
00111 inline Unsigned16 Io::in16_p( unsigned long port )
00112 {
00113   Unsigned16 tmp = in16(port);
00114   iodelay();
00115   return tmp;
00116 }
00117 
00118 
00119 
00120 inline Unsigned32 Io::in32_p( unsigned long port )
00121 {
00122   Unsigned32 tmp = in32(port);
00123   iodelay();
00124   return tmp;
00125 }
00126 
00127 
00128 
00129 inline void Io::out8_p( Unsigned8  val, unsigned long port )
00130 {
00131   out8(val,port); iodelay();
00132 }
00133 
00134 
00135 
00136 inline void Io::out16_p( Unsigned16 val, unsigned long port )
00137 {
00138   out16(val,port); iodelay();
00139 }
00140 
00141 
00142 inline void Io::out32_p( Unsigned32 val, unsigned long port )
00143 {
00144   out32(val,port); iodelay();
00145 }
00146 
00147 
00148 
00149 /* This is a more reliable delay than a few short jmps. */
00150 
00151 inline void Io::iodelay() 
00152 {
00153   asm("inb $0x80,%%al; inb $0x80,%%al" : : : "eax");
00154 }
00155 
00156 
00157 
00158 inline Unsigned8  Io::in8( unsigned long port )
00159 {
00160   Unsigned8 tmp;
00161   asm volatile ("inb %w1, %b0": "=a"(tmp) : "Nd"(port) );
00162   return tmp;
00163 }
00164 
00165 
00166 
00167 inline Unsigned16 Io::in16( unsigned long port )
00168 {
00169   Unsigned16 tmp;
00170   asm volatile ("inw %w1, %w0": "=a"(tmp) : "Nd"(port) );
00171   return tmp;
00172 }
00173 
00174 
00175 
00176 inline Unsigned32 Io::in32( unsigned long port )
00177 {
00178   Unsigned32 tmp;
00179   asm volatile ("in %w1, %0": "=a"(tmp) : "Nd"(port) );
00180   return tmp;
00181 }
00182 
00183 
00184 
00185 inline void Io::out8( Unsigned8  val, unsigned long port )
00186 {
00187   asm volatile ("outb %b0, %w1": : "a"(val), "Nd"(port) );
00188 }
00189 
00190 
00191 
00192 inline void Io::out16( Unsigned16 val, unsigned long port )
00193 {
00194   asm volatile ("outw %w0, %w1": : "a"(val), "Nd"(port) );
00195 }
00196 
00197 
00198 
00199 inline void Io::out32( Unsigned32 val, unsigned long port )
00200 {
00201   asm volatile ("out %0, %w1": : "a"(val), "Nd"(port) );
00202 }
00203 
00204 #endif // io_h

Generated on Mon Sep 26 14:20:10 2005 for Fiasco by  doxygen 1.4.2