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

pci.h

Go to the documentation of this file.
00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT!         -*- c++ -*-
00002 
00003 #ifndef pci_h
00004 #define pci_h
00005 
00006 #include "types.h"
00007 
00008 //
00009 // INTERFACE definition follows 
00010 //
00011 
00012 
00013 class Pci
00014 {
00015   enum
00016   {
00017     Cfg_addr = 0xcf8,
00018     Cfg_data = 0xcfc,
00019   };
00020 
00021 public:  
00022   static inline Unsigned8 read_cfg8(Mword bus, Mword dev, Mword subdev, Mword reg);
00023   
00024   static inline Unsigned16 read_cfg16(Mword bus, Mword dev, Mword subdev, Mword reg);
00025   
00026   static inline Unsigned32 read_cfg32(Mword bus, Mword dev, Mword subdev, Mword reg);
00027   
00028   static inline void write_cfg8(Mword bus, Mword dev, Mword subdev, Mword reg, Unsigned8 v);
00029   
00030   static inline void write_cfg16(Mword bus, Mword dev, Mword subdev, Mword reg, Unsigned16 v);
00031   
00032   static inline void write_cfg32(Mword bus, Mword dev, Mword subdev, Mword reg, Unsigned32 v);
00033 };
00034 
00035 //
00036 // IMPLEMENTATION includes follow (for use by inline functions)
00037 //
00038 
00039 
00040 #include "io.h"
00041 
00042 //
00043 // IMPLEMENTATION of inline functions (and needed classes)
00044 //
00045 
00046 
00047 
00048 
00049 inline Unsigned8
00050 Pci::read_cfg8(Mword bus, Mword dev, Mword subdev, Mword reg)
00051 {
00052   Io::out32 (((bus    & 0xffff) << 16) |
00053              ((dev    &   0x1f) << 11) |
00054              ((subdev &   0x07) <<  8) |
00055              ((reg    &   0xff)      ) |
00056              1<<31, Cfg_addr);
00057   return Io::in8 (Cfg_data + (reg & 3));
00058 }
00059 
00060 
00061 
00062 inline Unsigned16
00063 Pci::read_cfg16(Mword bus, Mword dev, Mword subdev, Mword reg)
00064 {
00065   Io::out32 (((bus    & 0xffff) << 16) |
00066              ((dev    &   0x1f) << 11) |
00067              ((subdev &   0x07) <<  8) |
00068              ((reg    &   0xfe)      ) |
00069              1<<31, Cfg_addr);
00070   return Io::in16 (Cfg_data + (reg & 2));
00071 }
00072 
00073 
00074 
00075 inline Unsigned32
00076 Pci::read_cfg32(Mword bus, Mword dev, Mword subdev, Mword reg)
00077 {
00078   Io::out32 (((bus    & 0xffff) << 16) |
00079              ((dev    &   0x1f) << 11) |
00080              ((subdev &   0x07) <<  8) |
00081              ((reg    &   0xfc)      ) |
00082              1<<31, Cfg_addr);
00083   return Io::in32 (Cfg_data);
00084 }
00085 
00086 
00087 
00088 inline void
00089 Pci::write_cfg8(Mword bus, Mword dev, Mword subdev, Mword reg, Unsigned8 v)
00090 {
00091   Io::out32 (((bus    & 0xffff) << 16) |
00092              ((dev    &   0x1f) << 11) |
00093              ((subdev &   0x07) <<  8) |
00094              ((reg    &   0xff)      ) |
00095              1<<31, Cfg_addr);
00096   Io::out8 (v, Cfg_data + (reg & 3));
00097 }
00098 
00099 
00100 
00101 inline void
00102 Pci::write_cfg16(Mword bus, Mword dev, Mword subdev, Mword reg, Unsigned16 v)
00103 {
00104   Io::out32 (((bus    & 0xffff) << 16) |
00105              ((dev    &   0x1f) << 11) |
00106              ((subdev &   0x07) <<  8) |
00107              ((reg    &   0xfe)      ) |
00108              1<<31, Cfg_addr);
00109   Io::out16 (v, Cfg_data + (reg & 2));
00110 }
00111 
00112 
00113 
00114 inline void
00115 Pci::write_cfg32(Mword bus, Mword dev, Mword subdev, Mword reg, Unsigned32 v)
00116 {
00117   Io::out32 (((bus    & 0xffff) << 16) |
00118              ((dev    &   0x1f) << 11) |
00119              ((subdev &   0x07) <<  8) |
00120              ((reg    &   0xfc)      ) |
00121              1<<31, Cfg_addr);
00122   Io::out32 (v, Cfg_data);
00123 }
00124 
00125 #endif // pci_h

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