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/*
2 © 2018 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_SIMICS_ADAPTER_H
15#define SIMICS_SYSTEMC_IFACE_I2C_MASTER_V2_SIMICS_ADAPTER_H
16
17#include <simics/devs/i2c.h>
21
22#include <string>
23#include <vector>
24
25namespace simics {
26namespace systemc {
27namespace iface {
28
29template<typename TBase, typename TInterface = I2cMasterV2Interface>
31 : public SimicsAdapter<i2c_master_v2_interface_t> {
32 public:
34 : SimicsAdapter<i2c_master_v2_interface_t>(
35 I2C_MASTER_V2_INTERFACE, init_iface()) {
36 }
37
38 protected:
39 static void acknowledge(conf_object_t *obj, ::i2c_ack_t ack) {
40 adapter<TBase, TInterface>(obj)->acknowledge(
41 ack == I2C_ack ? types::I2C_ack : types::I2C_noack);
42 }
43 static void read_response(conf_object_t *obj, uint8_t value) {
44 adapter<TBase, TInterface>(obj)->read_response(value);
45 }
46
47 private:
48 std::vector<std::string> description(conf_object_t *obj,
49 DescriptionType type) override {
50 return descriptionBase<TBase, TInterface>(obj, type);
51 }
52 i2c_master_v2_interface_t init_iface() {
53 i2c_master_v2_interface_t iface = {};
54 iface.acknowledge = acknowledge;
55 iface.read_response = read_response;
56 return iface;
57 }
58};
59
60} // namespace iface
61} // namespace systemc
62} // namespace simics
63
64#endif
Definition: i2c_master_v2_simics_adapter.h:31
static void acknowledge(conf_object_t *obj, ::i2c_ack_t ack)
Definition: i2c_master_v2_simics_adapter.h:39
I2cMasterV2SimicsAdapter()
Definition: i2c_master_v2_simics_adapter.h:33
static void read_response(conf_object_t *obj, uint8_t value)
Definition: i2c_master_v2_simics_adapter.h:43
Base class for mapping Simics interface to a C++ interface.
Definition: simics_adapter.h:45
DescriptionType
Definition: description_interface.h:23
@ I2C_ack
Definition: i2c_ack.h:21
@ I2C_noack
Definition: i2c_ack.h:22
Definition: adapter.h:79