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// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2015 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_I2C_MASTER_V2_EXTENSION_H
17#define SIMICS_SYSTEMC_IFACE_I2C_MASTER_V2_EXTENSION_H
18
21
22namespace simics {
23namespace systemc {
24namespace iface {
25
26class I2cMasterV2Extension : public Extension<I2cMasterV2Extension,
27 I2cMasterV2Interface> {
28 public:
29 virtual void call(I2cMasterV2Interface *device) {
30 switch (method_.value<Method>()) {
31 case ACKNOWLEDGE:
32 device->acknowledge(method_input_[0].value<types::i2c_ack_t>());
33 break;
34 case READ_RESPONSE:
35 device->read_response(method_input_[0].value<uint8_t>());
36 break;
37 }
38 }
39
40 virtual void acknowledge(types::i2c_ack_t ack) {
41 method_input_.push_back(ack);
42 method_ = ACKNOWLEDGE;
43 send();
44 }
45 virtual void read_response(uint8_t value) {
46 method_input_.push_back(value);
47 method_ = READ_RESPONSE;
48 send();
49 }
50
51 private:
52 enum Method {
53 ACKNOWLEDGE,
54 READ_RESPONSE
55 };
56};
57
58} // namespace iface
59} // namespace systemc
60} // namespace simics
61
62#endif
Base class for TLM2 extension, responsible for marshal/unmarshal of a Simics interface.
Definition: extension.h:40
std::vector< types::AnyType > method_input_
Definition: extension.h:118
Definition: i2c_master_v2_extension.h:27
virtual void acknowledge(types::i2c_ack_t ack)
Definition: i2c_master_v2_extension.h:40
virtual void read_response(uint8_t value)
Definition: i2c_master_v2_extension.h:45
virtual void call(I2cMasterV2Interface *device)
Definition: i2c_master_v2_extension.h:29
Simics i2c_master_v2 interface.
Definition: i2c_master_v2_interface.h:27
virtual void acknowledge(types::i2c_ack_t ack)=0
virtual void read_response(uint8_t value)=0
T value()
Definition: any_type.h:84
i2c_ack_t
Definition: i2c_ack.h:22
Definition: pci_bus_interface.h:24