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/*
2 © 2016 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_ETHERNET_COMMON_SIMICS_ADAPTER_H
15#define SIMICS_SYSTEMC_IFACE_ETHERNET_COMMON_SIMICS_ADAPTER_H
16
17#include <simics/devs/ethernet.h>
20
21#include <string>
22#include <vector>
23
24namespace simics {
25namespace systemc {
26namespace iface {
27
28template<typename TBase,
29 typename TInterface = EthernetCommonInterface>
31 : public SimicsAdapter<ethernet_common_interface_t> {
32 public:
34 : SimicsAdapter<ethernet_common_interface_t>(
35 ETHERNET_COMMON_INTERFACE, init_iface()) {
36 }
37
38 protected:
39 static void frame(conf_object_t *obj, const frags_t *frame,
40 eth_frame_crc_status_t crc_ok) {
42 f.len = frame->len;
43 f.nfrags = frame->nfrags;
44 for (unsigned int i = 0; i <MAX_FRAGS_FRAGS; ++i) {
46 fr.len = frame->fraglist[i].len;
47 fr.start = frame->fraglist[i].start;
48 f.fraglist[i] = fr;
49 }
50
51 adapter<TBase, TInterface>(obj)->frame(&f, crc_ok);
52 }
53
54 private:
55 std::vector<std::string> description(conf_object_t *obj,
56 DescriptionType type) override {
57 return descriptionBase<TBase, TInterface>(obj, type);
58 }
59 ethernet_common_interface_t init_iface() {
60 ethernet_common_interface_t iface = {};
61 iface.frame = frame;
62 return iface;
63 }
64};
65
66} // namespace iface
67} // namespace systemc
68} // namespace simics
69
70#endif
Definition: ethernet_common_simics_adapter.h:31
static void frame(conf_object_t *obj, const frags_t *frame, eth_frame_crc_status_t crc_ok)
Definition: ethernet_common_simics_adapter.h:39
EthernetCommonSimicsAdapter()
Definition: ethernet_common_simics_adapter.h:33
Base class for mapping Simics interface to a C++ interface.
Definition: simics_adapter.h:45
#define MAX_FRAGS_FRAGS
Definition: frags.h:23
DescriptionType
Definition: description_interface.h:23
Definition: adapter.h:79
Definition: frags.h:31
size_t len
Definition: frags.h:33
const uint8_t * start
Definition: frags.h:32
Definition: frags.h:36
size_t len
Definition: frags.h:37
frags_frag_t fraglist[MAX_FRAGS_FRAGS]
Definition: frags.h:39
unsigned nfrags
Definition: frags.h:38