SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
inject_serial_device.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_SERIAL_DEVICE_H
15#define SIMICS_SYSTEMC_INJECTION_EXTENSION_INJECT_SERIAL_DEVICE_H
16
17
18
22
23#include <string>
24
25namespace simics {
26namespace systemc {
27namespace injection {
28namespace extension {
29
31template <typename TPAYLOAD>
32class InjectSerialDevice : public InjectBase<TPAYLOAD> {
33 public:
34 ATTR_DICT_PARSER_NAMESPACE("serial_device.")
35
36 bool setValue(AttrDictParser *parser, const std::string &key,
37 attr_value_t *attr, TPAYLOAD *gp) override {
38 if (key == "write") {
39 int v = 0;
40 if (!parser->value(&v))
41 return false;
42
44 ->write(v);
45 return true;
46 } else if (key == "receive_ready") {
48 ->receive_ready();
49 return true;
50 }
51
52 return false;
53 }
54};
55
56} // namespace extension
57} // namespace injection
58} // namespace systemc
59} // namespace simics
60
61#endif
#define ATTR_DICT_PARSER_NAMESPACE(ns)
Definition: attr_dict_parser.h:32
Definition: attr_dict_parser.h:38
Definition: inject_base.h:43
bool setValue(AttrDictParser *parser, const std::string &key, attr_value_t *attr, TPAYLOAD *gp) override
Definition: inject_serial_device.h:36
Definition: adapter.h:79