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