SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
i2c_slave_v2_gasket_adapter.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2014 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_SIMICS2TLM_I2C_SLAVE_V2_GASKET_ADAPTER_H
17#define SIMICS_SYSTEMC_SIMICS2TLM_I2C_SLAVE_V2_GASKET_ADAPTER_H
18
20
24
25#include <stdint.h>
26#include <vector>
27
28namespace simics {
29namespace systemc {
30namespace simics2tlm {
31
37 public GasketAdapter<iface::I2cSlaveV2Interface> {
38 public:
39 I2cSlaveV2GasketAdapter(I2cSlaveV2Interface *i2cslavev2,
41 : i2cslavev2_(i2cslavev2), simulation_(simulation) {
42 }
43 void start(uint8_t address) override {
44 Context context(simulation_);
45 i2cslavev2_->start(address);
46 }
47 void read() override {
48 Context context(simulation_);
49 i2cslavev2_->read();
50 }
51 void write(uint8_t value) override {
52 Context context(simulation_);
53 i2cslavev2_->write(value);
54 }
55 void stop() override {
56 Context context(simulation_);
57 i2cslavev2_->stop();
58 }
59 std::vector<uint8_t> addresses() override {
60 Context context(simulation_);
61 return i2cslavev2_->addresses();
62 }
64 return dynamic_cast<simics2tlm::GasketOwner *>(i2cslavev2_);
65 }
66
67 private:
68 I2cSlaveV2Interface *i2cslavev2_;
69 iface::SimulationInterface *simulation_;
70};
71
72} // namespace simics2tlm
73} // namespace systemc
74} // namespace simics
75
76#endif
Utility class that handles the context switching, using RAII methodology.
Definition: context.h:31
Definition: i2c_slave_v2_interface.h:26
Interface to the SystemC simulation.
Definition: simulation_interface.h:27
Definition: gasket_adapter.h:45
Base class, responsible for handling a gasket.
Definition: gasket_owner.h:32
Adapter for I2cSlaveV2 gasket.
Definition: i2c_slave_v2_gasket_adapter.h:37
void start(uint8_t address) override
Definition: i2c_slave_v2_gasket_adapter.h:43
simics2tlm::GasketOwner * gasket_owner() const override
Definition: i2c_slave_v2_gasket_adapter.h:63
void read() override
Definition: i2c_slave_v2_gasket_adapter.h:47
void stop() override
Definition: i2c_slave_v2_gasket_adapter.h:55
std::vector< uint8_t > addresses() override
Definition: i2c_slave_v2_gasket_adapter.h:59
void write(uint8_t value) override
Definition: i2c_slave_v2_gasket_adapter.h:51
I2cSlaveV2GasketAdapter(I2cSlaveV2Interface *i2cslavev2, iface::SimulationInterface *simulation)
Definition: i2c_slave_v2_gasket_adapter.h:39
Definition: pci_bus_interface.h:24