Overview   API Reference  

dummy_device.hpp

00001 #if !defined(__DUMMY_HPP__)
00002 #define __DUMMY_HPP__
00003 
00004 //
00005 // local includes
00006 //
00007 #include "devices/common.hpp"
00008 
00009 #if __GNUC__ <= 3
00010     //
00011     // FIXME: GCC3
00012     // circumvent a bug in GCC 3.3 and 3.4 which caused code from pci_device_base,
00013     //     instantiated with its default argument, to be accidentally removed.
00014     //     probably only, if several devices use the same instantiation, so make
00015     //     them all unique by introducing a dummy class, which massively increases
00016     //     the code size, so never use GCC 3 anymore.
00017     //
00018     struct dummy_device_config_space : public pci_config_space
00019     {};
00020 
00021     #define DUMMY_DEVICE_CONFIG_SPACE  dummy_device_config_space
00022 #else
00023     #define DUMMY_DEVICE_CONFIG_SPACE
00024 #endif
00025 
00032 struct dummy_device : public pci_device_base<DUMMY_DEVICE_CONFIG_SPACE>
00033 {
00034   protected:
00035     typedef pci_device_base<DUMMY_DEVICE_CONFIG_SPACE> super_type;
00036 
00037     config_space_type init_config_space;
00038 
00039   public:
00040     dummy_device(machine_base &machine, const string &device_name,
00041                  const config_space_type &init_config_space);
00042 
00043     //
00044     // pci_device: override reset & PCI configuration space write handler
00045     //
00046     virtual int reset(void);
00047     virtual int write_config_space(pci_config_header16::offset_t offset,
00048                                    l4_umword_t data, access_size access_size);
00049 
00050   public:
00051     static pci_device *create(machine_base &machine, config_node &device_node);
00052 };
00053 
00054 #endif
00055 
00056 // ***** end of source ***** //
00057 

L4vmm Reference Manual, written by Mario Schwalbe  © 2006-2008