SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
i3c_slave_extension.h
Go to the documentation of this file.
1/*
2 © 2019 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_I3C_SLAVE_EXTENSION_H
15#define SIMICS_SYSTEMC_IFACE_I3C_SLAVE_EXTENSION_H
16
19
20namespace simics {
21namespace systemc {
22namespace iface {
23
24class I3cSlaveExtension : public Extension<I3cSlaveExtension,
25 I3cSlaveInterface> {
26 public:
27 void call(I3cSlaveInterface *device) override {
28 switch (method_.value<Method>()) {
29 case START:
30 device->start(method_input_[0].value<uint8_t>());
31 break;
32 case WRITE:
33 device->write(method_input_[0].value<uint8_t>());
34 break;
35 case SDR_WRITE:
36 device->sdr_write(method_input_[0].value<types::bytes_t>());
37 break;
38 case READ:
39 device->read();
40 break;
41 case DAA_READ:
42 device->daa_read();
43 break;
44 case STOP:
45 device->stop();
46 break;
47 case IBI_START:
48 device->ibi_start();
49 break;
50 case IBI_ACKNOWLEDGE:
51 device->ibi_acknowledge(method_input_[0].value<types::i3c_ack_t>());
52 break;
53 }
54 }
55
56 void start(uint8_t address) override {
57 method_input_.push_back(address);
58 method_ = START;
59 send();
60 }
61 void write(uint8_t value) override {
62 method_input_.push_back(value);
63 method_ = WRITE;
64 send();
65 }
66 void sdr_write(types::bytes_t data) override {
67 method_input_.push_back(data);
68 method_ = SDR_WRITE;
69 send();
70 }
71 void read() override {
72 method_ = READ;
73 send();
74 }
75 void daa_read() override {
76 method_ = DAA_READ;
77 send();
78 }
79 void stop() override {
80 method_ = STOP;
81 send();
82 }
83 void ibi_start() override {
84 method_ = IBI_START;
85 send();
86 }
87 void ibi_acknowledge(types::i3c_ack_t ack) override {
88 method_input_.push_back(ack);
89 method_ = IBI_ACKNOWLEDGE;
90 send();
91 }
92
93 private:
94 enum Method {
95 START,
96 WRITE,
97 SDR_WRITE,
98 READ,
99 DAA_READ,
100 STOP,
101 IBI_START,
102 IBI_ACKNOWLEDGE
103 };
104};
105
106} // namespace iface
107} // namespace systemc
108} // namespace simics
109
110#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: i3c_slave_extension.h:25
void ibi_start() override
Definition: i3c_slave_extension.h:83
void ibi_acknowledge(types::i3c_ack_t ack) override
Definition: i3c_slave_extension.h:87
void call(I3cSlaveInterface *device) override
Definition: i3c_slave_extension.h:27
void write(uint8_t value) override
Definition: i3c_slave_extension.h:61
void start(uint8_t address) override
Definition: i3c_slave_extension.h:56
void stop() override
Definition: i3c_slave_extension.h:79
void sdr_write(types::bytes_t data) override
Definition: i3c_slave_extension.h:66
void daa_read() override
Definition: i3c_slave_extension.h:75
void read() override
Definition: i3c_slave_extension.h:71
Definition: i3c_slave_interface.h:25
virtual void start(uint8_t address)=0
virtual void sdr_write(types::bytes_t data)=0
virtual void write(uint8_t value)=0
virtual void ibi_acknowledge(types::i3c_ack_t ack)=0
T value()
Definition: any_type.h:87
i3c_ack_t
Definition: i3c_ack.h:20
Definition: adapter.h:79
Definition: bytes.h:26