SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
pci_device_extension.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2015 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_EXTENSION_H
17#define SIMICS_SYSTEMC_IFACE_PCI_DEVICE_EXTENSION_H
18
21
22namespace simics {
23namespace systemc {
24namespace iface {
25
27class PciDeviceExtension : public Extension<PciDeviceExtension,
28 PciDeviceInterface> {
29 public:
30 virtual void call(PciDeviceInterface *device) {
31 switch (method_.value<Method>()) {
32 case BUS_RESET:
33 device->bus_reset();
34 break;
35 case SYSTEM_ERROR:
36 device->system_error();
37 break;
38 case INTERRUPT_RAISED:
39 device->interrupt_raised(method_input_[0].value<int>());
40 break;
41 case INTERRUPT_LOWERED:
42 device->interrupt_lowered(method_input_[0].value<int>());
43 break;
44 }
45 }
46
47 virtual void bus_reset() {
48 method_ = BUS_RESET;
49 send();
50 }
51 virtual void system_error() {
52 method_ = SYSTEM_ERROR;
53 send();
54 }
55 virtual void interrupt_raised(int pin) {
56 method_input_.push_back(pin);
57 method_ = INTERRUPT_RAISED;
58 send();
59 }
60 virtual void interrupt_lowered(int pin) {
61 method_input_.push_back(pin);
62 method_ = INTERRUPT_LOWERED;
63 send();
64 }
65
66 private:
67 enum Method {
68 BUS_RESET,
69 SYSTEM_ERROR,
70 INTERRUPT_RAISED,
71 INTERRUPT_LOWERED
72 };
73};
74
75} // namespace iface
76} // namespace systemc
77} // namespace simics
78
79#endif
Base class for TLM2 extension, responsible for marshal/unmarshal of a Simics interface.
Definition: extension.h:40
std::vector< types::AnyType > method_input_
Definition: extension.h:118
Extension for Simics pci_device interface.
Definition: pci_device_extension.h:28
virtual void bus_reset()
Definition: pci_device_extension.h:47
virtual void system_error()
Definition: pci_device_extension.h:51
virtual void call(PciDeviceInterface *device)
Definition: pci_device_extension.h:30
virtual void interrupt_raised(int pin)
Definition: pci_device_extension.h:55
virtual void interrupt_lowered(int pin)
Definition: pci_device_extension.h:60
Simics pci_device interface.
Definition: pci_device_interface.h:26
virtual void interrupt_raised(int pin)=0
virtual void interrupt_lowered(int pin)=0
T value()
Definition: any_type.h:84
Definition: pci_bus_interface.h:24