SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
i2c_master_v2_simics_adapter.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2018 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_SIMICS_ADAPTER_H
17#define SIMICS_SYSTEMC_IFACE_I2C_MASTER_V2_SIMICS_ADAPTER_H
18
19#include <simics/devs/i2c.h>
23
24#include <string>
25#include <vector>
26
27namespace simics {
28namespace systemc {
29namespace iface {
30
31template<typename TBase, typename TInterface = I2cMasterV2Interface>
33 : public SimicsAdapter<i2c_master_v2_interface_t> {
34 public:
36 : SimicsAdapter<i2c_master_v2_interface_t>(
37 I2C_MASTER_V2_INTERFACE, init_iface()) {
38 }
39
40 protected:
41 static void acknowledge(conf_object_t *obj, ::i2c_ack_t ack) {
42 adapter<TBase, TInterface>(obj)->acknowledge(
43 ack == I2C_ack ? types::I2C_ack : types::I2C_noack);
44 }
45 static void read_response(conf_object_t *obj, uint8_t value) {
46 adapter<TBase, TInterface>(obj)->read_response(value);
47 }
48
49 private:
50 std::vector<std::string> description(conf_object_t *obj,
51 DescriptionType type) {
52 return descriptionBase<TBase, TInterface>(obj, type);
53 }
54 i2c_master_v2_interface_t init_iface() {
55 i2c_master_v2_interface_t iface = {};
56 iface.acknowledge = acknowledge;
57 iface.read_response = read_response;
58 return iface;
59 }
60};
61
62} // namespace iface
63} // namespace systemc
64} // namespace simics
65
66#endif
Definition: i2c_master_v2_simics_adapter.h:33
static void acknowledge(conf_object_t *obj, ::i2c_ack_t ack)
Definition: i2c_master_v2_simics_adapter.h:41
I2cMasterV2SimicsAdapter()
Definition: i2c_master_v2_simics_adapter.h:35
static void read_response(conf_object_t *obj, uint8_t value)
Definition: i2c_master_v2_simics_adapter.h:45
Base class for mapping Simics interface to a C++ interface.
Definition: simics_adapter.h:47
DescriptionType
Definition: description_interface.h:25
@ I2C_ack
Definition: i2c_ack.h:23
@ I2C_noack
Definition: i2c_ack.h:24
Definition: pci_bus_interface.h:24