SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
i3c_master_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_MASTER_EXTENSION_H
15#define SIMICS_SYSTEMC_IFACE_I3C_MASTER_EXTENSION_H
16
19
20namespace simics {
21namespace systemc {
22namespace iface {
23
24class I3cMasterExtension : public Extension<I3cMasterExtension,
25 I3cMasterInterface> {
26 public:
27 void call(I3cMasterInterface *device) override {
28 switch (method_.value<Method>()) {
29 case ACKNOWLEDGE:
30 device->acknowledge(method_input_[0].value<types::i3c_ack_t>());
31 break;
32 case READ_RESPONSE:
33 device->read_response(method_input_[0].value<uint8_t>(),
34 method_input_[1].value<bool>());
35 break;
36 case DAA_RESPONSE:
37 device->daa_response(method_input_[0].value<uint64_t>(),
38 method_input_[1].value<uint8_t>(),
39 method_input_[2].value<uint8_t>());
40 break;
41 case IBI_REQUEST:
42 device->ibi_request();
43 break;
44 case IBI_ADDRESS:
45 device->ibi_address(method_input_[0].value<uint8_t>());
46 break;
47 }
48 }
49
50 void acknowledge(types::i3c_ack_t ack) override {
51 method_input_.push_back(ack);
52 method_ = ACKNOWLEDGE;
53 send();
54 }
55 void read_response(uint8_t value, bool more) override {
56 method_input_.push_back(value);
57 method_input_.push_back(more);
58 method_ = READ_RESPONSE;
59 send();
60 }
61 void daa_response(uint64_t id, uint8_t bcr, uint8_t dcr) override {
62 method_input_.push_back(id);
63 method_input_.push_back(bcr);
64 method_input_.push_back(dcr);
65 method_ = DAA_RESPONSE;
66 send();
67 }
68 void ibi_request() override {
69 method_ = IBI_REQUEST;
70 send();
71 }
72 void ibi_address(uint8_t address) override {
73 method_input_.push_back(address);
74 method_ = IBI_ADDRESS;
75 send();
76 }
77
78 private:
79 enum Method {
80 ACKNOWLEDGE,
81 READ_RESPONSE,
82 DAA_RESPONSE,
83 IBI_REQUEST,
84 IBI_ADDRESS
85 };
86};
87
88} // namespace iface
89} // namespace systemc
90} // namespace simics
91
92#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_master_extension.h:25
void read_response(uint8_t value, bool more) override
Definition: i3c_master_extension.h:55
void daa_response(uint64_t id, uint8_t bcr, uint8_t dcr) override
Definition: i3c_master_extension.h:61
void ibi_request() override
Definition: i3c_master_extension.h:68
void call(I3cMasterInterface *device) override
Definition: i3c_master_extension.h:27
void acknowledge(types::i3c_ack_t ack) override
Definition: i3c_master_extension.h:50
void ibi_address(uint8_t address) override
Definition: i3c_master_extension.h:72
Simics i3c_master interface.
Definition: i3c_master_interface.h:25
virtual void daa_response(uint64_t id, uint8_t bcr, uint8_t dcr)=0
virtual void ibi_address(uint8_t address)=0
virtual void acknowledge(types::i3c_ack_t ack)=0
virtual void read_response(uint8_t value, bool more)=0
T value()
Definition: any_type.h:87
i3c_ack_t
Definition: i3c_ack.h:20
Definition: adapter.h:79