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
d299d44f
Commit
d299d44f
authored
5 years ago
by
Martin Christoph Hierholzer
Browse files
Options
Downloads
Patches
Plain Diff
instantiate tec lib classes properly, fix byte orders in dummy
parent
935d5bf6
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
modules/src/TecModule.cc
+24
-1
24 additions, 1 deletion
modules/src/TecModule.cc
tests/src/TecDummy.cc
+7
-2
7 additions, 2 deletions
tests/src/TecDummy.cc
with
31 additions
and
3 deletions
modules/src/TecModule.cc
+
24
−
1
View file @
d299d44f
#include
"TecModule.h"
#include
"TecParameters.h"
#include
<tec/TecChimeraInterface.h>
#include
<tec/TecController.h>
/**********************************************************************************************************************/
...
...
@@ -24,7 +25,29 @@ TecModule::TecModule(EntityOwner* owner, const std::string& name, const std::str
void
TecModule
::
mainLoop
()
{
std
::
cout
<<
"Processing TecModule::mainLoop()"
<<
std
::
endl
;
TecChimeraInterface
tec
{
triggerCommands
,
responseStatus
,
commandMemoryRaw
,
true
};
auto
tecIface
=
std
::
make_shared
<
TecChimeraInterface
>
(
triggerCommands
,
responseStatus
,
commandMemoryRaw_wr
,
commandMemoryRaw_rd
,
true
);
TecController
tec
{
tecIface
};
tec
.
addFrame
(
0
,
TecFrame
::
TecParameter
::
ExpFanControlEnable
,
TecFrame
::
TecFrameType
::
TecParameterValueSet
,
1
);
std
::
cout
<<
"constructAllFrames:"
<<
std
::
endl
;
tec
.
constructAllFrames
();
for
(
uint8_t
i
=
0
;
i
<
tec
.
getFrameCount
();
i
++
)
{
tec
.
getFrameAt
(
i
)
->
print
();
}
std
::
cout
<<
"copyCommandsToHardware:"
<<
std
::
endl
;
tec
.
copyCommandsToHardware
();
std
::
cout
<<
"triggerHardwareCommands:"
<<
std
::
endl
;
tec
.
triggerHardwareCommands
();
std
::
cout
<<
"readHardwareResponses:"
<<
std
::
endl
;
tec
.
readHardwareResponses
();
std
::
cout
<<
"copyResponsesFromHardware:"
<<
std
::
endl
;
tec
.
copyResponsesFromHardware
();
std
::
cout
<<
"parseAllFrames:"
<<
std
::
endl
;
tec
.
parseAllFrames
();
for
(
uint8_t
i
=
0
;
i
<
tec
.
getFrameCount
();
i
++
)
{
tec
.
getFrameAt
(
i
)
->
print
();
}
std
::
cout
<<
"done."
<<
std
::
endl
;
// Here the group maps need to be filled by iterating the descriptor list and obtaining the corresponding inputs from
// the groupCommandMap
...
...
This diff is collapsed.
Click to expand it.
tests/src/TecDummy.cc
+
7
−
2
View file @
d299d44f
#include
"TecDummy.h"
#include
<arpa/inet.h>
TecDummy
::
BackendRegisterer
TecDummy
::
backendRegisterer
;
...
...
@@ -12,15 +13,19 @@ TecDummy::BackendRegisterer::BackendRegisterer() {
/*********************************************************************************************************************/
void
TecDummy
::
read
(
uint8_t
bar
,
uint32_t
address
,
int32_t
*
data
,
size_t
sizeInBytes
)
{
std
::
cout
<<
"HIER0"
<<
std
::
endl
;
DummyBackend
::
read
(
bar
,
address
,
data
,
sizeInBytes
);
std
::
cout
<<
"HIER1"
<<
std
::
endl
;
if
(
bar
!=
TecDummy_bar
||
address
!=
TecDummy_address_loopDone
)
return
;
std
::
cout
<<
"HIER2"
<<
std
::
endl
;
if
(
reg_loopStart
!=
1
)
return
;
std
::
cout
<<
"HIER3"
<<
std
::
endl
;
// convert command into string
// FIXME: this can be done better if the DummyRegisterRawAccessor would allow us to use the raw pointer to this...
std
::
string
commandString
(
reg_command
.
getNumberOfElements
()
*
4
,
0
);
for
(
size_t
i
=
0
;
i
<
reg_command
.
getNumberOfElements
();
++
i
)
{
uint32_t
word
=
reg_command
[
i
];
uint32_t
word
=
ntohl
(
reg_command
[
i
]
)
;
std
::
memcpy
(
&
(
commandString
[
4
*
i
]),
&
word
,
4
);
}
...
...
@@ -31,7 +36,7 @@ void TecDummy::read(uint8_t bar, uint32_t address, int32_t* data, size_t sizeInB
for
(
size_t
i
=
0
;
i
<
reply
.
length
();
++
i
)
{
uint32_t
word
;
std
::
memcpy
(
&
word
,
&
(
reply
[
4
*
i
]),
4
);
reg_command
[
i
]
=
word
;
reg_command
[
i
]
=
htonl
(
word
)
;
}
reg_loopDone
=
1
;
...
...
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