SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
inject_i2c_slave_v2.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_I2C_SLAVE_V2_H
15#define SIMICS_SYSTEMC_INJECTION_EXTENSION_INJECT_I2C_SLAVE_V2_H
16
17
18
22
23#include <string>
24
25namespace simics {
26namespace systemc {
27namespace injection {
28namespace extension {
29
31template <typename TPAYLOAD>
32class InjectI2cSlaveV2 : public InjectBase<TPAYLOAD> {
33 public:
34 ATTR_DICT_PARSER_NAMESPACE("i2c_slave_v2.")
35
36 bool setValue(AttrDictParser *parser, const std::string &key,
37 attr_value_t *attr, TPAYLOAD *gp) override {
38 if (key == "start") {
39 uint8_t address = 0;
40 if (!parser->value(&address))
41 return false;
42
44 ->start(address);
45 return true;
46 } else if (key == "read") {
48 ->read();
49 return true;
50 } else if (key == "write") {
51 uint8_t value = 0;
52 if (!parser->value(&value))
53 return false;
54
56 ->write(value);
57 return true;
58 } else if (key == "stop") {
60 ->stop();
61 return true;
62 } else if (key == "addresses") {
64 ->addresses();
65 return true;
66 }
67
68 return false;
69 }
70};
71
72} // namespace extension
73} // namespace injection
74} // namespace systemc
75} // namespace simics
76
77#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_i2c_slave_v2.h:36
Definition: adapter.h:79