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// -*- 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_EXPRESS_SIMICS_ADAPTER_H
17#define SIMICS_SYSTEMC_IFACE_PCI_EXPRESS_SIMICS_ADAPTER_H
18
19#if defined SIMICS_5_API || defined SIMICS_6_API
20
21#include <simics/devs/pci.h>
24
25#include <string>
26#include <vector>
27
28namespace simics {
29namespace systemc {
30namespace iface {
31
33template<typename TBase, typename TInterface = PciExpressInterface>
34class PciExpressSimicsAdapter : public SimicsAdapter<pci_express_interface_t> {
35 public:
36 PciExpressSimicsAdapter()
37 : SimicsAdapter<pci_express_interface_t>(
38 PCI_EXPRESS_INTERFACE, init_iface()) {
39 }
40
41 protected:
42 static int send_message(conf_object_t *obj, conf_object_t *src,
43 pcie_message_type_t type, byte_string_t payload) {
44 // Need to convert between Simics byte_string_t and C++ type
45 std::vector<uint8_t> p(payload.str, payload.str+payload.len);
46 return adapter<TBase, TInterface>(obj)->send_message(type, p);
47 }
48
49 private:
50 std::vector<std::string> description(conf_object_t *obj,
51 DescriptionType type) {
52 return descriptionBase<TBase, TInterface>(obj, type);
53 }
54 pci_express_interface_t init_iface() {
55 pci_express_interface_t iface = {};
56 iface.send_message = send_message;
57 return iface;
58 }
59};
60
61} // namespace iface
62} // namespace systemc
63} // namespace simics
64
65#endif
66#endif
Definition: pci_bus_interface.h:24