SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
Loading...
Searching...
No Matches
device_access.h
Go to the documentation of this file.
1
// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3
/*
4
© 2018 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_DEVICE_ACCESS_H
17
#define SIMICS_SYSTEMC_DEVICE_ACCESS_H
18
19
#include <
simics/systemc/context.h
>
20
#include <
simics/systemc/iface/simulation_interface.h
>
21
#include <
simics/systemc/kernel_state_modifier.h
>
22
23
namespace
simics
{
24
namespace
systemc {
25
27
template
<
typename
T>
28
class
DeviceAccess
{
29
public
:
30
explicit
DeviceAccess
(
iface::SimulationInterface
*simulation,
31
T *device_pointer)
32
:
context_
(simulation),
kernel_state_modifier_
(simulation),
33
device_pointer_
(device_pointer) {
34
}
35
T &
operator*
() {
36
return
*
device_pointer_
;
37
}
38
const
T &
operator*
()
const
{
39
return
*
device_pointer_
;
40
}
41
T *
operator->
() {
42
return
device_pointer_
;
43
}
44
const
T *
operator->
()
const
{
45
return
device_pointer_
;
46
}
47
virtual
~DeviceAccess
() {
48
}
49
50
protected
:
51
Context
context_
;
52
KernelStateModifier
kernel_state_modifier_
;
53
T *
device_pointer_
;
54
};
55
56
}
// namespace systemc
57
}
// namespace simics
58
59
#endif
simics::systemc::Context
Utility class that handles the context switching, using RAII methodology.
Definition:
context.h:31
simics::systemc::DeviceAccess
Definition:
device_access.h:28
simics::systemc::DeviceAccess::~DeviceAccess
virtual ~DeviceAccess()
Definition:
device_access.h:47
simics::systemc::DeviceAccess::DeviceAccess
DeviceAccess(iface::SimulationInterface *simulation, T *device_pointer)
Definition:
device_access.h:30
simics::systemc::DeviceAccess::device_pointer_
T * device_pointer_
Definition:
device_access.h:53
simics::systemc::DeviceAccess::kernel_state_modifier_
KernelStateModifier kernel_state_modifier_
Definition:
device_access.h:52
simics::systemc::DeviceAccess::operator->
const T * operator->() const
Definition:
device_access.h:44
simics::systemc::DeviceAccess::operator*
T & operator*()
Definition:
device_access.h:35
simics::systemc::DeviceAccess::operator->
T * operator->()
Definition:
device_access.h:41
simics::systemc::DeviceAccess::context_
Context context_
Definition:
device_access.h:51
simics::systemc::KernelStateModifier
Definition:
kernel_state_modifier.h:30
simics::systemc::iface::SimulationInterface
Interface to the SystemC simulation.
Definition:
simulation_interface.h:27
context.h
kernel_state_modifier.h
simics
Definition:
pci_bus_interface.h:24
simulation_interface.h