SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
inject_pci_express.h
Go to the documentation of this file.
1/*
2 © 2017 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_INJECTION_EXTENSION_INJECT_PCI_EXPRESS_H
15#define SIMICS_SYSTEMC_INJECTION_EXTENSION_INJECT_PCI_EXPRESS_H
16
17#if defined SIMICS_6_API || defined SHOW_OBSOLETE_API
18
22
23#include <string>
24#include <vector>
25
26namespace simics {
27namespace systemc {
28namespace injection {
29namespace extension {
30
32template <typename TPAYLOAD>
33class InjectPciExpress : public InjectBase<TPAYLOAD> {
34 public:
35 ATTR_DICT_PARSER_NAMESPACE("pci_express.")
36
37 bool setValue(AttrDictParser *parser, const std::string &key,
38 attr_value_t *attr, TPAYLOAD *gp) override {
39 if (key == "send_message") {
40 AttrDictParser p = parser->init(attr);
41 std::vector<uint8_t> payload;
42 if (!p.lookUp("payload", &payload))
43 return false;
44
45 int type = 0;
46 if (!p.lookUp("type", &type))
47 return false;
48
49 ExtensionSetter<TPAYLOAD, iface::PciExpressExtension>(gp)
50 ->send_message(type, payload);
51 return true;
52 }
53
54 return false;
55 }
56};
57
58} // namespace extension
59} // namespace injection
60} // namespace systemc
61} // namespace simics
62
63#endif
64#endif
#define ATTR_DICT_PARSER_NAMESPACE(ns)
Definition: attr_dict_parser.h:32
Definition: adapter.h:79