Skip to content
GitLab
Explore
Sign in
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
1075fa95
Commit
1075fa95
authored
12 years ago
by
Jan David Mol
Browse files
Options
Downloads
Patches
Plain Diff
Task #3696: Removed obsolete RSPBoard.h
parent
6ba8ebee
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
.gitattributes
+0
-1
0 additions, 1 deletion
.gitattributes
RTCP/InputProc/src/RSPBoard.h
+0
-196
0 additions, 196 deletions
RTCP/InputProc/src/RSPBoard.h
with
0 additions
and
197 deletions
.gitattributes
+
0
−
1
View file @
1075fa95
...
...
@@ -3626,7 +3626,6 @@ RTCP/InputProc/src/Generator.cc -text
RTCP/InputProc/src/Generator.h -text
RTCP/InputProc/src/OMPThread.h -text
RTCP/InputProc/src/Poll.h -text
RTCP/InputProc/src/RSPBoard.h -text
RTCP/InputProc/src/Ranges.h -text
RTCP/InputProc/src/SampleBuffer.h -text
RTCP/InputProc/src/SampleBufferReader.h -text
...
...
This diff is collapsed.
Click to expand it.
RTCP/InputProc/src/RSPBoard.h
deleted
100644 → 0
+
0
−
196
View file @
6ba8ebee
#ifndef __RSPBOARD__
#define __RSPBOARD__
#include
<Common/LofarLogger.h>
#include
<Stream/Stream.h>
#include
<Interface/RSPTimeStamp.h>
#include
<IONProc/RSP.h>
#include
<IONProc/WallClockTime.h>
#include
"SampleBuffer.h"
#include
"Ranges.h"
#include
"BufferSettings.h"
#include
"time.h"
#include
<string>
namespace
LOFAR
{
namespace
RTCP
{
/* Receives input of one RSP board and stores it in shared memory. */
template
<
typename
T
>
class
RSPBoard
{
public:
RSPBoard
(
Stream
&
inputStream
,
SampleBuffer
<
T
>
&
buffer
,
unsigned
boardNr
,
const
struct
BufferSettings
&
settings
);
// RSP board number
const
unsigned
nr
;
bool
readPacket
();
void
writePacket
();
void
logStatistics
();
private:
const
std
::
string
logPrefix
;
Stream
&
inputStream
;
const
bool
supportPartialReads
;
struct
RSP
packet
;
TimeStamp
last_timestamp
;
time_t
last_logtime
;
SampleBuffer
<
T
>
&
buffer
;
Ranges
&
flags
;
const
struct
BufferSettings
settings
;
const
size_t
firstBeamlet
;
size_t
nrReceived
,
nrBadSize
,
nrBadTime
,
nrBadData
,
nrBadMode
,
nrOutOfOrder
;
};
template
<
typename
T
>
RSPBoard
<
T
>::
RSPBoard
(
Stream
&
inputStream
,
SampleBuffer
<
T
>
&
buffer
,
unsigned
boardNr
,
const
struct
BufferSettings
&
settings
)
:
nr
(
boardNr
),
logPrefix
(
str
(
boost
::
format
(
"[station %s %s board %u] [RSPBoard] "
)
%
settings
.
station
.
stationName
%
settings
.
station
.
antennaSet
%
nr
)),
inputStream
(
inputStream
),
supportPartialReads
(
dynamic_cast
<
SocketStream
*>
(
&
inputStream
)
==
0
||
dynamic_cast
<
SocketStream
&>
(
inputStream
).
protocol
!=
SocketStream
::
UDP
),
last_logtime
(
0
),
buffer
(
buffer
),
flags
(
buffer
.
flags
[
boardNr
]),
settings
(
settings
),
firstBeamlet
(
settings
.
nrBeamlets
/
settings
.
nrBoards
*
boardNr
),
nrReceived
(
0
),
nrBadSize
(
0
),
nrBadTime
(
0
),
nrBadData
(
0
),
nrBadMode
(
0
),
nrOutOfOrder
(
0
)
{
ASSERTSTR
(
boardNr
<
settings
.
nrBoards
,
"Invalid board number: "
<<
boardNr
<<
", nrBoards: "
<<
settings
.
nrBoards
);
}
template
<
typename
T
>
void
RSPBoard
<
T
>::
writePacket
()
{
const
uint8
&
nrBeamlets
=
packet
.
header
.
nrBeamlets
;
const
uint8
&
nrTimeslots
=
packet
.
header
.
nrBlocks
;
ASSERT
(
nrBeamlets
<=
settings
.
nrBeamlets
/
settings
.
nrBoards
);
// the timestamp is of the last read packet by definition
const
TimeStamp
&
timestamp
=
last_timestamp
;
const
size_t
from_offset
=
(
int64
)
timestamp
%
settings
.
nrSamples
;
size_t
to_offset
=
((
int64
)
timestamp
+
nrTimeslots
)
%
settings
.
nrSamples
;
if
(
to_offset
==
0
)
to_offset
=
settings
.
nrSamples
;
// mark data we overwrite as invalid
flags
.
excludeBefore
(
timestamp
+
nrTimeslots
-
settings
.
nrSamples
);
// transpose
const
T
*
beamlets
=
reinterpret_cast
<
const
T
*>
(
&
packet
.
data
);
const
size_t
wrap
=
from_offset
<
to_offset
?
0
:
settings
.
nrSamples
-
from_offset
;
for
(
uint8
b
=
0
;
b
<
nrBeamlets
;
++
b
)
{
T
*
dst1
=
&
buffer
.
beamlets
[
firstBeamlet
+
b
][
from_offset
];
if
(
wrap
>
0
)
{
T
*
dst2
=
&
buffer
.
beamlets
[
firstBeamlet
+
b
][
0
];
memcpy
(
dst1
,
beamlets
,
wrap
*
sizeof
(
T
));
memcpy
(
dst2
,
beamlets
,
to_offset
*
sizeof
(
T
));
}
else
{
memcpy
(
dst1
,
beamlets
,
nrTimeslots
*
sizeof
(
T
));
}
beamlets
+=
nrTimeslots
;
}
// mark as valid
flags
.
include
(
timestamp
,
timestamp
+
nrTimeslots
);
}
template
<
typename
T
>
bool
RSPBoard
<
T
>::
readPacket
()
{
bool
valid
=
true
;
if
(
supportPartialReads
)
{
// read header first
inputStream
.
read
(
&
packet
,
sizeof
(
struct
RSP
::
Header
));
// read rest of packet
inputStream
.
read
(
&
packet
.
data
,
packet
.
packetSize
()
-
sizeof
(
struct
RSP
::
Header
));
++
nrReceived
;
}
else
{
// read full packet at once -- numbytes will tell us how much we've actually read
size_t
numbytes
=
inputStream
.
tryRead
(
&
packet
,
sizeof
packet
);
++
nrReceived
;
if
(
numbytes
<
sizeof
(
struct
RSP
::
Header
)
||
numbytes
!=
packet
.
packetSize
()
)
{
LOG_WARN_STR
(
logPrefix
<<
"Packet is "
<<
numbytes
<<
" bytes, but should be "
<<
packet
.
packetSize
()
<<
" bytes"
);
++
nrBadSize
;
valid
=
false
;
}
}
// illegal timestamp means illegal packet
if
(
valid
&&
packet
.
header
.
timestamp
==
~
0U
)
{
++
nrBadTime
;
valid
=
false
;
}
if
(
valid
)
{
// check sanity of packet
const
TimeStamp
timestamp
(
packet
.
header
.
timestamp
,
packet
.
header
.
blockSequenceNumber
,
settings
.
station
.
clock
);
// don't accept out-of-order data
if
(
last_timestamp
>
timestamp
)
{
++
nrOutOfOrder
;
valid
=
false
;
}
// packet has legal timestamp
last_timestamp
=
timestamp
;
// discard packets with errors
if
(
packet
.
payloadError
())
{
++
nrBadData
;
valid
=
false
;
}
// check whether the station configuration matches ours
if
(
packet
.
clockMHz
()
*
1000000
!=
settings
.
station
.
clock
||
packet
.
bitMode
()
!=
settings
.
station
.
bitmode
)
{
++
nrBadMode
;
valid
=
false
;
}
}
return
valid
;
}
template
<
typename
T
>
void
RSPBoard
<
T
>::
logStatistics
()
{
LOG_INFO_STR
(
logPrefix
<<
"Received "
<<
nrReceived
<<
" packets: "
<<
nrOutOfOrder
<<
" out of order, "
<<
nrBadTime
<<
" bad timestamps, "
<<
nrBadSize
<<
" bad sizes, "
<<
nrBadData
<<
" payload errors, "
<<
nrBadMode
<<
" mode errors"
);
nrReceived
=
0
;
nrBadTime
=
0
;
nrBadSize
=
0
;
nrBadData
=
0
;
nrBadMode
=
0
;
nrOutOfOrder
=
0
;
}
}
}
#endif
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