SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
mii_management_simics_adapter.h
Go to the documentation of this file.
1/*
2 © 2021 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_MII_MANAGEMENT_SIMICS_ADAPTER_H
15#define SIMICS_SYSTEMC_IFACE_MII_MANAGEMENT_SIMICS_ADAPTER_H
16
17#include <simics/devs/mii.h>
20
21#include <string>
22#include <vector>
23
24namespace simics {
25namespace systemc {
26namespace iface {
27
28template<typename TBase, typename TInterface = MiiManagementInterface>
30 : public SimicsAdapter<mii_management_interface_t> {
31 public:
33 : SimicsAdapter<mii_management_interface_t>(
34 MII_MANAGEMENT_INTERFACE, init_iface()) {
35 }
36
37 protected:
38 static int serial_access(conf_object_t *obj, int data_in, int clock) {
39 return adapter<TBase, TInterface>(obj)->serial_access(data_in, clock);
40 }
41 static uint16_t read_register(conf_object_t *obj, int phy, int reg) {
42 return adapter<TBase, TInterface>(obj)->read_register(phy, reg);
43 }
44 static void write_register(conf_object_t *obj, int phy, int reg,
45 uint16_t value) {
46 adapter<TBase, TInterface>(obj)->write_register(phy, reg, value);
47 }
48
49 private:
50 std::vector<std::string> description(conf_object_t *obj,
51 DescriptionType type) override {
52 return descriptionBase<TBase, TInterface>(obj, type);
53 }
54 mii_management_interface_t init_iface() {
55 mii_management_interface_t iface = {};
56 iface.serial_access = serial_access;
57 iface.read_register = read_register;
58 iface.write_register = write_register;
59 return iface;
60 }
61};
62
63} // namespace iface
64} // namespace systemc
65} // namespace simics
66
67#endif
Definition: mii_management_simics_adapter.h:30
MiiManagementSimicsAdapter()
Definition: mii_management_simics_adapter.h:32
static void write_register(conf_object_t *obj, int phy, int reg, uint16_t value)
Definition: mii_management_simics_adapter.h:44
static int serial_access(conf_object_t *obj, int data_in, int clock)
Definition: mii_management_simics_adapter.h:38
static uint16_t read_register(conf_object_t *obj, int phy, int reg)
Definition: mii_management_simics_adapter.h:41
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