Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
58c445e7
Commit
58c445e7
authored
19 years ago
by
wierenga
Browse files
Options
Downloads
Patches
Plain Diff
BugID: 708
Move expected result definition to RCUProtocolWrite.cc.
parent
5c787fb5
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
MAC/APL/PIC/RSPDriver/src/RCUResultRead.cc
+7
-25
7 additions, 25 deletions
MAC/APL/PIC/RSPDriver/src/RCUResultRead.cc
MAC/APL/PIC/RSPDriver/src/RCUResultRead.h
+0
-1
0 additions, 1 deletion
MAC/APL/PIC/RSPDriver/src/RCUResultRead.h
with
7 additions
and
26 deletions
MAC/APL/PIC/RSPDriver/src/RCUResultRead.cc
+
7
−
25
View file @
58c445e7
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include
<string.h>
#include
<string.h>
#include
"StationSettings.h"
#include
"StationSettings.h"
#include
"RCUProtocolWrite.h"
#include
"RCUResultRead.h"
#include
"RCUResultRead.h"
#include
"Cache.h"
#include
"Cache.h"
...
@@ -37,22 +38,10 @@ using namespace LOFAR;
...
@@ -37,22 +38,10 @@ using namespace LOFAR;
using
namespace
RSP
;
using
namespace
RSP
;
using
namespace
EPA_Protocol
;
using
namespace
EPA_Protocol
;
#define RESULT_DELAY_PERIOD 2
namespace
LOFAR
{
namespace
RSP
{
// construct expected i2c result
static
uint8
i2c_result
[]
=
{
0x00
,
// PROTOCOL_C_SEND_BLOCK OK
0xFF
,
// <<< replace with expected data >>>
0xFF
,
// <<< replace with expected data >>>
0xFF
,
// <<< replace with expected data >>>
0x00
,
// PROTOCOL_C_RECEIVE_BLOCK OK
0x00
,
// PROTOCOL_C_END OK
};
};
};
RCUResultRead
::
RCUResultRead
(
GCFPortInterface
&
board_port
,
int
board_id
)
RCUResultRead
::
RCUResultRead
(
GCFPortInterface
&
board_port
,
int
board_id
)
:
SyncAction
(
board_port
,
board_id
,
StationSettings
::
instance
()
->
nrBlpsPerBoard
()
*
MEPHeader
::
N_POL
)
,
m_delay
(
0
)
// *N_POL for X and Y
:
SyncAction
(
board_port
,
board_id
,
StationSettings
::
instance
()
->
nrBlpsPerBoard
()
*
MEPHeader
::
N_POL
)
// *N_POL for X and Y
{
{
memset
(
&
m_hdr
,
0
,
sizeof
(
MEPHeader
));
memset
(
&
m_hdr
,
0
,
sizeof
(
MEPHeader
));
}
}
...
@@ -73,23 +62,16 @@ void RCUResultRead::sendrequest()
...
@@ -73,23 +62,16 @@ void RCUResultRead::sendrequest()
return
;
return
;
}
}
// delay 4 periods
if
(
m_delay
++
<
4
)
{
setContinue
(
true
);
return
;
}
m_delay
=
0
;
// set appropriate header
// set appropriate header
MEPHeader
::
FieldsType
hdr
;
MEPHeader
::
FieldsType
hdr
;
if
(
0
==
global_rcu
%
2
)
{
if
(
0
==
global_rcu
%
MEPHeader
::
N_POL
)
{
hdr
=
MEPHeader
::
RCU_RESULTX_HDR
;
hdr
=
MEPHeader
::
RCU_RESULTX_HDR
;
}
else
{
}
else
{
hdr
=
MEPHeader
::
RCU_RESULTY_HDR
;
hdr
=
MEPHeader
::
RCU_RESULTY_HDR
;
}
}
EPAReadEvent
rcuresult
;
EPAReadEvent
rcuresult
;
rcuresult
.
hdr
.
set
(
hdr
,
1
<<
(
getCurrentIndex
()
/
MEPHeader
::
N_POL
),
MEPHeader
::
READ
,
sizeof
(
i2c_result
));
rcuresult
.
hdr
.
set
(
hdr
,
1
<<
(
getCurrentIndex
()
/
MEPHeader
::
N_POL
),
MEPHeader
::
READ
,
sizeof
(
RCUProtocolWrite
::
i2c_result
));
m_hdr
=
rcuresult
.
hdr
;
// remember header to match with ack
m_hdr
=
rcuresult
.
hdr
;
// remember header to match with ack
getBoardPort
().
send
(
rcuresult
);
getBoardPort
().
send
(
rcuresult
);
...
@@ -121,9 +103,9 @@ GCFEvent::TResult RCUResultRead::handleack(GCFEvent& event, GCFPortInterface& /*
...
@@ -121,9 +103,9 @@ GCFEvent::TResult RCUResultRead::handleack(GCFEvent& event, GCFPortInterface& /*
// reverse and copy control bytes into i2c_result
// reverse and copy control bytes into i2c_result
RCUSettings
::
Control
&
rcucontrol
=
Cache
::
getInstance
().
getBack
().
getRCUSettings
()()((
global_rcu
));
RCUSettings
::
Control
&
rcucontrol
=
Cache
::
getInstance
().
getBack
().
getRCUSettings
()()((
global_rcu
));
uint32
control
=
htonl
(
rcucontrol
.
getRaw
());
uint32
control
=
htonl
(
rcucontrol
.
getRaw
());
memcpy
(
i2c_result
+
1
,
&
control
,
3
);
memcpy
(
RCUProtocolWrite
::
i2c_result
+
1
,
&
control
,
3
);
if
(
0
==
memcmp
(
i2c_result
,
ack
.
result
,
sizeof
(
i2c_result
)))
{
if
(
0
==
memcmp
(
RCUProtocolWrite
::
i2c_result
,
ack
.
result
,
sizeof
(
RCUProtocolWrite
::
i2c_result
)))
{
Cache
::
getInstance
().
getRCUProtocolState
().
confirmed
(
global_rcu
);
Cache
::
getInstance
().
getRCUProtocolState
().
confirmed
(
global_rcu
);
}
else
{
}
else
{
LOG_ERROR
(
"RCUResultRead::handleack: unexpected I2C result response"
);
LOG_ERROR
(
"RCUResultRead::handleack: unexpected I2C result response"
);
...
...
This diff is collapsed.
Click to expand it.
MAC/APL/PIC/RSPDriver/src/RCUResultRead.h
+
0
−
1
View file @
58c445e7
...
@@ -60,7 +60,6 @@ namespace LOFAR {
...
@@ -60,7 +60,6 @@ namespace LOFAR {
private:
private:
EPA_Protocol
::
MEPHeader
m_hdr
;
EPA_Protocol
::
MEPHeader
m_hdr
;
int
m_delay
;
// used to delay reading back results
};
};
};
};
};
};
...
...
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