Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TEC ApplicationModule
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MSK-SW
Infrastructure and Support
TEC
TEC ApplicationModule
Commits
b172645e
Commit
b172645e
authored
5 years ago
by
Martin Christoph Hierholzer
Browse files
Options
Downloads
Patches
Plain Diff
extend interface for more advanced tests (timeout, write to flash etc.)
parent
bb963f0d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/include/TecDummy.h
+27
-7
27 additions, 7 deletions
tests/include/TecDummy.h
with
27 additions
and
7 deletions
tests/include/TecDummy.h
+
27
−
7
View file @
b172645e
...
...
@@ -10,21 +10,41 @@ struct TecDummy : ChimeraTK::DummyBackend {
TecDummy
(
std
::
string
mapFileName
)
:
DummyBackend
(
mapFileName
)
{}
~
TecDummy
()
override
{}
// getter and setter functions for parameters
int
getInt
(
TecFrame
::
TecParameter
param
)
{
return
rawValues
[
param
];
}
float
getFloat
(
TecFrame
::
TecParameter
param
)
{
return
*
(
reinterpret_cast
<
float
*>
(
&
(
rawValues
[
param
])));
}
void
set
(
TecFrame
::
TecParameter
param
,
int
value
)
{
rawValues
[
param
]
=
value
;
}
void
set
(
TecFrame
::
TecParameter
param
,
float
value
)
{
rawValues
[
param
]
=
*
(
reinterpret_cast
<
int
*>
(
&
value
));
}
// returns whether the last write operation for the given parameter was stored in flash or not. Will return false
// if the parameter has not been yet at all.
bool
getLastWriteToFlash
(
TecFrame
::
TecParameter
param
)
{
return
lastWriteToFlash
[
param
];
}
// flag whether timeouts should be simulated. This simulates e.g. a broken UART connection between FPGA and TEC device
bool
simulateSerialTimeout
{
false
};
// Number of read operations on the LOOP_DONE register required before the communication is simulated and LOOP_DONE is
// set to 1. If this value is 0, it will happen on the first read operation. A value of 1 requires one additional read
// before. After each communication cycle, this value will end up to be 0. A test needs hence to set this value every
// time again.
size_t
loopDoneDelay
{
0
};
protected
:
// hardcoded addresses used by the dummy, need to match addresses of map file
constexpr
static
uint8_t
TecDummy_bar
{
0
};
constexpr
static
uint32_t
TecDummy_address_loopDone
{
8
};
// Map
s
contining the values of the TEC parameters. These map
s
will be filled / read by the dummy during the
// Map cont
a
ining the values of the TEC parameters. These map will be filled / read by the dummy during the
// communication with the TEC library. It can also be used by tests to read / change values in the dummy.
// If a value is not in the map, it means the value has not yet been written / read.
// For accessing the values within unit tests, use the getter/setter functions
below
.
// For accessing the values within unit tests, use the getter/setter functions
above
.
std
::
map
<
TecFrame
::
TecParameter
,
int32_t
>
rawValues
;
//
getter and s
et
t
er
functions for parameters
int
getInt
(
TecFrame
::
TecParameter
param
)
{
return
rawValues
[
param
];
}
float
getFloat
(
TecFrame
::
TecParameter
param
)
{
return
*
(
reinterpret_cast
<
float
*>
(
&
(
rawValues
[
param
])));
}
void
set
(
TecFrame
::
TecParam
eter
param
,
int
value
)
{
rawValues
[
param
]
=
value
;
}
void
set
(
TecFrame
::
TecParameter
param
,
float
value
)
{
rawValues
[
param
]
=
*
(
reinterpret_cast
<
int
*>
(
&
value
));
}
//
Map containing the flags wh
et
h
er
the last write of a TEC parameter was to flash.
std
::
map
<
TecFrame
::
TecParameter
,
bool
>
lastWriteToFlash
;
// Flag wh
et
h
er
writes currently go to flash or not.
bool
currentWritesToFlash
{
false
};
// TODO: Verify default value from TEC hardware documentation!
// Accessors for the registers
ChimeraTK
::
DummyRegisterAccessor
<
uint32_t
>
reg_loopStart
{
this
,
"UNIO0"
,
"BIT_TEC1091_CMD_LOOP_START"
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment