SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
serial_device_simics_adapter.h
Go to the documentation of this file.
1/*
2 © 2015 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_SERIAL_DEVICE_SIMICS_ADAPTER_H
15#define SIMICS_SYSTEMC_IFACE_SERIAL_DEVICE_SIMICS_ADAPTER_H
16
17#include <simics/devs/serial-device.h>
20
21#include <string>
22#include <vector>
23
24namespace simics {
25namespace systemc {
26namespace iface {
27
28template<typename TBase,
29 typename TInterface = SerialDeviceInterface>
31 : public SimicsAdapter<serial_device_interface_t> {
32 public:
34 : SimicsAdapter<serial_device_interface_t>(
35 SERIAL_DEVICE_INTERFACE, init_iface()) {
36 }
37
38 protected:
39 static int write(conf_object_t *obj, int value) {
40 return adapter<TBase, TInterface>(obj)->write(value);
41 }
42 static void receive_ready(conf_object_t *obj) {
43 adapter<TBase, TInterface>(obj)->receive_ready();
44 }
45
46 private:
47 std::vector<std::string> description(conf_object_t *obj,
48 DescriptionType type) override {
49 return descriptionBase<TBase, TInterface>(obj, type);
50 }
51 serial_device_interface_t init_iface() {
52 serial_device_interface_t iface = {};
53 iface.write = write;
54 iface.receive_ready = receive_ready;
55 return iface;
56 }
57};
58
59} // namespace iface
60} // namespace systemc
61} // namespace simics
62
63#endif
Definition: serial_device_simics_adapter.h:31
SerialDeviceSimicsAdapter()
Definition: serial_device_simics_adapter.h:33
static void receive_ready(conf_object_t *obj)
Definition: serial_device_simics_adapter.h:42
static int write(conf_object_t *obj, int value)
Definition: serial_device_simics_adapter.h:39
Base class for mapping Simics interface to a C++ interface.
Definition: simics_adapter.h:45
DescriptionType
Definition: description_interface.h:23
Definition: adapter.h:79