Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
VILLASframework
VILLASfpga
VILLASfpga
Commits
e59065bb
Commit
e59065bb
authored
Jul 26, 2018
by
Daniel Krebs
Browse files
rtds2gpu: update register type to work for more complex payloads
parent
a65482a7
Pipeline
#65235
failed with stages
in 59 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
include/villas/fpga/ips/rtds2gpu/register_types.hpp
View file @
e59065bb
...
...
@@ -3,6 +3,7 @@
#include
<stdint.h>
#include
<cstddef>
#include
<cstdint>
union
axilite_reg_status_t
{
uint32_t
value
;
...
...
@@ -26,16 +27,31 @@ union reg_doorbell_t {
count
:
6
,
is_valid
:
1
;
};
constexpr
reg_doorbell_t
()
:
value
(
0
)
{}
};
template
<
size_t
N
,
typename
T
=
uint32_t
>
struct
Rtds2GpuMemoryBuffer
{
static
constexpr
size_t
valueCount
=
N
;
static
constexpr
size_t
dataOffset
=
offsetof
(
Rtds2GpuMemoryBuffer
,
data
);
static
constexpr
size_t
doorbellOffset
=
offsetof
(
Rtds2GpuMemoryBuffer
,
doorbell
);
// this type is only for memory interpretation, it makes no sense to create
// an instance so it's forbidden
Rtds2GpuMemoryBuffer
()
=
delete
;
// T can be a more complex type that wraps multiple values
static
constexpr
size_t
rawValueCount
=
N
*
(
sizeof
(
T
)
/
4
);
// As of C++14, offsetof() is not working for non-standard layout types (i.e.
// composed of non-POD members). This might work in C++17 though.
// More info: https://gist.github.com/graphitemaster/494f21190bb2c63c5516
//static constexpr size_t doorbellOffset = offsetof(Rtds2GpuMemoryBuffer, doorbell);
//static constexpr size_t dataOffset = offsetof(Rtds2GpuMemoryBuffer, data);
// HACK: This might break horribly, let's just hope C++17 will be there soon
static
constexpr
size_t
dataOffset
=
0
;
static
constexpr
size_t
doorbellOffset
=
N
*
sizeof
(
Rtds2GpuMemoryBuffer
::
data
);
T
data
[
N
];
reg_doorbell_t
doorbell
;
}
__attribute__
((
packed
))
;
};
#endif // REGISTER_TYPES_H
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment