SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
ethernet_common_simics_adapter.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2016 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_ETHERNET_COMMON_SIMICS_ADAPTER_H
17#define SIMICS_SYSTEMC_IFACE_ETHERNET_COMMON_SIMICS_ADAPTER_H
18
19#include <simics/devs/ethernet.h>
22
23#include <string>
24#include <vector>
25
26namespace simics {
27namespace systemc {
28namespace iface {
29
30template<typename TBase,
31 typename TInterface = EthernetCommonInterface>
33 : public SimicsAdapter<ethernet_common_interface_t> {
34 public:
36 : SimicsAdapter<ethernet_common_interface_t>(
37 ETHERNET_COMMON_INTERFACE, init_iface()) {
38 }
39
40 protected:
41 static void frame(conf_object_t *obj, const frags_t *frame,
42 eth_frame_crc_status_t crc_ok) {
44 f.len = frame->len;
45 f.nfrags = frame->nfrags;
46 for (unsigned int i = 0; i <MAX_FRAGS_FRAGS; ++i) {
48 fr.len = frame->fraglist[i].len;
49 fr.start = frame->fraglist[i].start;
50 f.fraglist[i] = fr;
51 }
52
53 adapter<TBase, TInterface>(obj)->frame(&f, crc_ok);
54 }
55
56 private:
57 std::vector<std::string> description(conf_object_t *obj,
58 DescriptionType type) {
59 return descriptionBase<TBase, TInterface>(obj, type);
60 }
61 ethernet_common_interface_t init_iface() {
62 ethernet_common_interface_t iface = {};
63 iface.frame = frame;
64 return iface;
65 }
66};
67
68} // namespace iface
69} // namespace systemc
70} // namespace simics
71
72#endif
Definition: ethernet_common_simics_adapter.h:33
static void frame(conf_object_t *obj, const frags_t *frame, eth_frame_crc_status_t crc_ok)
Definition: ethernet_common_simics_adapter.h:41
EthernetCommonSimicsAdapter()
Definition: ethernet_common_simics_adapter.h:35
Base class for mapping Simics interface to a C++ interface.
Definition: simics_adapter.h:47
#define MAX_FRAGS_FRAGS
Definition: frags.h:25
DescriptionType
Definition: description_interface.h:25
Definition: pci_bus_interface.h:24
Definition: frags.h:33
size_t len
Definition: frags.h:35
const uint8_t * start
Definition: frags.h:34
Definition: frags.h:38
size_t len
Definition: frags.h:39
frags_frag_t fraglist[MAX_FRAGS_FRAGS]
Definition: frags.h:41
unsigned nfrags
Definition: frags.h:40