SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
pci_express_simics_adapter.h
Go to the documentation of this file.
1/*
2 © 2014 Intel Corporation
3
4 This software and the related documents are Intel copyrighted materials, and
5 your use of them is governed by the express license under which they were
6 provided to you ("License"). Unless the License provides otherwise, you may
7 not use, modify, copy, publish, distribute, disclose or transmit this software
8 or the related documents without Intel's prior written permission.
9
10 This software and the related documents are provided as is, with no express or
11 implied warranties, other than those that are expressly stated in the License.
12*/
13
14#ifndef SIMICS_SYSTEMC_IFACE_PCI_EXPRESS_SIMICS_ADAPTER_H
15#define SIMICS_SYSTEMC_IFACE_PCI_EXPRESS_SIMICS_ADAPTER_H
16
17#if defined SIMICS_6_API || defined SHOW_OBSOLETE_API
18
19#include <simics/devs/pci.h>
22
23#include <string>
24#include <vector>
25
26namespace simics {
27namespace systemc {
28namespace iface {
29
31template<typename TBase, typename TInterface = PciExpressInterface>
32class PciExpressSimicsAdapter : public SimicsAdapter<pci_express_interface_t> {
33 public:
34 PciExpressSimicsAdapter()
35 : SimicsAdapter<pci_express_interface_t>(
36 PCI_EXPRESS_INTERFACE, init_iface()) {
37 }
38
39 protected:
40 static int send_message(conf_object_t *obj, conf_object_t *src,
41 pcie_message_type_t type, byte_string_t payload) {
42 // Need to convert between Simics byte_string_t and C++ type
43 std::vector<uint8_t> p(payload.str, payload.str+payload.len);
44 return adapter<TBase, TInterface>(obj)->send_message(type, p);
45 }
46
47 private:
48 std::vector<std::string> description(conf_object_t *obj,
49 DescriptionType type) override {
50 return descriptionBase<TBase, TInterface>(obj, type);
51 }
52 pci_express_interface_t init_iface() {
53 pci_express_interface_t iface = {};
54 iface.send_message = send_message;
55 return iface;
56 }
57};
58
59} // namespace iface
60} // namespace systemc
61} // namespace simics
62
63#endif
64#endif
Definition: adapter.h:79