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
7a44fe29
Commit
7a44fe29
authored
4 years ago
by
Tomasz Kozak
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug that lastWriteToFlash was accesed in wrong place
parent
933afdd0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/include/TecDummy.h
+15
-13
15 additions, 13 deletions
tests/include/TecDummy.h
tests/src/TecDummy.cc
+6
-4
6 additions, 4 deletions
tests/src/TecDummy.cc
with
21 additions
and
17 deletions
tests/include/TecDummy.h
+
15
−
13
View file @
7a44fe29
...
...
@@ -10,21 +10,20 @@
struct
TecDummy
:
ChimeraTK
::
DummyBackend
{
TecDummy
(
std
::
string
mapFileName
)
:
DummyBackend
(
mapFileName
)
{
// inititialize write to flash as disabled on startup;
// inititialize write to flash as disabled on startup;
rawValues
[
TecFrame
::
ParameterSystemFlashSaveOff
]
=
1
;
}
~
TecDummy
()
override
{}
enum
class
TecFramePart
{
MARKER
,
ADDRESS
,
SEQUENCE
,
COMMAND
,
PARAMETER_ID
,
CHANNEL
,
PAYLOAD
,
CRC
,
MARKER
,
ADDRESS
,
SEQUENCE
,
COMMAND
,
PARAMETER_ID
,
CHANNEL
,
PAYLOAD
,
CRC
,
};
// getter and setter functions for parameters
...
...
@@ -35,7 +34,10 @@ struct TecDummy : ChimeraTK::DummyBackend {
// 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
];
}
bool
getLastWriteToFlash
(
TecFrame
::
TecParameter
param
)
{
if
(
lastWriteToFlash
.
find
(
param
)
!=
lastWriteToFlash
.
end
())
return
lastWriteToFlash
.
at
(
param
);
return
false
;
}
// flag whether timeouts should be simulated. This simulates e.g. a broken UART connection between FPGA and TEC device
bool
simulateSerialTimeout
{
false
};
...
...
@@ -75,8 +77,8 @@ struct TecDummy : ChimeraTK::DummyBackend {
void
read
(
uint8_t
bar
,
uint32_t
address
,
int32_t
*
data
,
size_t
sizeInBytes
)
override
;
std
::
map
<
TecFramePart
,
std
::
string
>
splitFrame
(
const
std
::
string
&
command
);
std
::
string
getCrc
(
std
::
string
&
frame
);
std
::
map
<
TecFramePart
,
std
::
string
>
splitFrame
(
const
std
::
string
&
command
);
std
::
string
getCrc
(
std
::
string
&
frame
);
// In this function the TEC device is actually simulated.
std
::
string
processFrame
(
const
std
::
string
&
command
);
...
...
This diff is collapsed.
Click to expand it.
tests/src/TecDummy.cc
+
6
−
4
View file @
7a44fe29
...
...
@@ -160,6 +160,11 @@ std::string TecDummy::processFrame(const std::string& command) {
rawValues
[
parameterId
]
=
value
;
result
=
"!"
+
parsedFrame
[
TecFramePart
::
ADDRESS
]
+
parsedFrame
[
TecFramePart
::
SEQUENCE
];
result
+=
getCrc
(
result
);
//
// mark received parameter as written to flash or not
auto
isLastWriteToFlash
=
(
not
rawValues
.
at
(
TecFrame
::
ParameterSystemFlashSaveOff
))
?
true
:
false
;
lastWriteToFlash
[
parameterId
]
=
isLastWriteToFlash
;
}
else
if
(
parsedFrame
[
TecFramePart
::
COMMAND
]
==
"?VR"
)
{
// Handle read command
...
...
@@ -170,10 +175,7 @@ std::string TecDummy::processFrame(const std::string& command) {
result
+=
getCrc
(
result
);
}
//
// mark received parameter as written to flash or not
auto
isLastWriteToFlash
=
(
not
rawValues
.
at
(
TecFrame
::
ParameterSystemFlashSaveOff
))
?
true
:
false
;
lastWriteToFlash
[
parameterId
]
=
isLastWriteToFlash
;
std
::
cout
<<
"Returning result "
<<
result
<<
std
::
endl
;
...
...
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