SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
i2c_master_v2_extension.h
Go to the documentation of this file.
1/*
2 © 2015 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_I2C_MASTER_V2_EXTENSION_H
15#define SIMICS_SYSTEMC_IFACE_I2C_MASTER_V2_EXTENSION_H
16
19
20namespace simics {
21namespace systemc {
22namespace iface {
23
24class I2cMasterV2Extension : public Extension<I2cMasterV2Extension,
25 I2cMasterV2Interface> {
26 public:
27 void call(I2cMasterV2Interface *device) override {
28 switch (method_.value<Method>()) {
29 case ACKNOWLEDGE:
30 device->acknowledge(method_input_[0].value<types::i2c_ack_t>());
31 break;
32 case READ_RESPONSE:
33 device->read_response(method_input_[0].value<uint8_t>());
34 break;
35 }
36 }
37
38 void acknowledge(types::i2c_ack_t ack) override {
39 method_input_.push_back(ack);
40 method_ = ACKNOWLEDGE;
41 send();
42 }
43 void read_response(uint8_t value) override {
44 method_input_.push_back(value);
45 method_ = READ_RESPONSE;
46 send();
47 }
48
49 private:
50 enum Method {
51 ACKNOWLEDGE,
52 READ_RESPONSE
53 };
54};
55
56} // namespace iface
57} // namespace systemc
58} // namespace simics
59
60#endif
Base class for TLM2 extension, responsible for marshal/unmarshal of a Simics interface.
Definition: extension.h:38
std::vector< types::AnyType > method_input_
Definition: extension.h:116
Definition: i2c_master_v2_extension.h:25
void read_response(uint8_t value) override
Definition: i2c_master_v2_extension.h:43
void call(I2cMasterV2Interface *device) override
Definition: i2c_master_v2_extension.h:27
void acknowledge(types::i2c_ack_t ack) override
Definition: i2c_master_v2_extension.h:38
Simics i2c_master_v2 interface.
Definition: i2c_master_v2_interface.h:25
virtual void acknowledge(types::i2c_ack_t ack)=0
virtual void read_response(uint8_t value)=0
T value()
Definition: any_type.h:87
i2c_ack_t
Definition: i2c_ack.h:20
Definition: adapter.h:79