SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
pci_device_simics_adapter.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2014 Intel Corporation
5
6 This software and the related documents are Intel copyrighted materials, and
7 your use of them is governed by the express license under which they were
8 provided to you ("License"). Unless the License provides otherwise, you may
9 not use, modify, copy, publish, distribute, disclose or transmit this software
10 or the related documents without Intel's prior written permission.
11
12 This software and the related documents are provided as is, with no express or
13 implied warranties, other than those that are expressly stated in the License.
14*/
15
16#ifndef SIMICS_SYSTEMC_IFACE_PCI_DEVICE_SIMICS_ADAPTER_H
17#define SIMICS_SYSTEMC_IFACE_PCI_DEVICE_SIMICS_ADAPTER_H
18
19#include <simics/devs/pci.h>
22
23#include <string>
24#include <vector>
25
26namespace simics {
27namespace systemc {
28namespace iface {
29
30#if defined SIMICS_5_API
31#define DEPRECATED_FUNC(f) f
32#else
33#define DEPRECATED_FUNC(f) _deprecated_ ## f
34#endif
35
37template<typename TBase, typename TInterface = PciDeviceInterface>
38class PciDeviceSimicsAdapter : public SimicsAdapter<pci_device_interface_t> {
39 public:
41 : SimicsAdapter<pci_device_interface_t>(
42 PCI_DEVICE_INTERFACE, init_iface()) {
43 }
44
45 protected:
46 static void bus_reset(conf_object_t *obj) {
47 adapter<TBase, TInterface>(obj)->bus_reset();
48 }
49 static void system_error(conf_object_t *obj) {
50 adapter<TBase, TInterface>(obj)->system_error();
51 }
52 static void interrupt_raised(conf_object_t *obj, int pin) {
53 adapter<TBase, TInterface>(obj)->interrupt_raised(pin);
54 }
55 static void interrupt_lowered(conf_object_t *obj, int pin) {
56 adapter<TBase, TInterface>(obj)->interrupt_lowered(pin);
57 }
58
59 private:
60 std::vector<std::string> description(conf_object_t *obj,
61 DescriptionType type) {
62 return descriptionBase<TBase, TInterface>(obj, type);
63 }
64 pci_device_interface_t init_iface() {
65 pci_device_interface_t iface = {};
66 iface.bus_reset = bus_reset;
67 iface.DEPRECATED_FUNC(interrupt_acknowledge) = NULL;
68 iface.DEPRECATED_FUNC(special_cycle) = NULL;
69 iface.system_error = system_error;
70 iface.interrupt_raised = interrupt_raised;
71 iface.interrupt_lowered = interrupt_lowered;
72 return iface;
73 }
74};
75
76#undef DEPRECATED_FUNC
77
78} // namespace iface
79} // namespace systemc
80} // namespace simics
81
82#endif
Adapter for Simics pci_device interface.
Definition: pci_device_simics_adapter.h:38
static void system_error(conf_object_t *obj)
Definition: pci_device_simics_adapter.h:49
static void interrupt_raised(conf_object_t *obj, int pin)
Definition: pci_device_simics_adapter.h:52
static void interrupt_lowered(conf_object_t *obj, int pin)
Definition: pci_device_simics_adapter.h:55
static void bus_reset(conf_object_t *obj)
Definition: pci_device_simics_adapter.h:46
PciDeviceSimicsAdapter()
Definition: pci_device_simics_adapter.h:40
Base class for mapping Simics interface to a C++ interface.
Definition: simics_adapter.h:47
DescriptionType
Definition: description_interface.h:25
Definition: pci_bus_interface.h:24