Skip to content

Commit 0d92f66

Browse files
authored
Merge pull request #21 from kostorr/ORC-103/superpage-flags
ORC-103/superpage-flags new Readout version v0.15.0 has been released to comply with the new interface. Please tag ReadoutCard and bump alidist with new versions of ReadoutCard + Readout v0.15.0 in single PR.
2 parents 1e9f51e + 96c6817 commit 0d92f66

File tree

11 files changed

+167
-118
lines changed

11 files changed

+167
-118
lines changed

include/ReadoutCard/Parameters.h

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ class Parameters
7373
/// Type for the readout mode parameter
7474
using ReadoutModeType = ReadoutMode::type;
7575

76-
/// Type for the forced unlock enabled parameter
77-
using ForcedUnlockEnabledType = bool;
78-
7976
/// Type for the link mask parameter
8077
using LinkMaskType = std::set<uint32_t>;
8178

@@ -210,28 +207,6 @@ class Parameters
210207
/// \return Reference to this object for chaining calls
211208
auto setReadoutMode(ReadoutModeType value) -> Parameters&;
212209

213-
/// Sets the ForcedUnlockEnabled parameter
214-
///
215-
/// The channel uses two locks to enforce DMA channel exclusivity: a file lock (which is cleaned up automatically on/
216-
/// a process exit) and a mutex (which remains locked in the case of a crash).
217-
///
218-
/// Normally, when the mutex is left locked because of a crash, it must be cleaned up manually through
219-
/// administrative action before the channel can be acquired again.
220-
/// But in some cases, it can be safe to clean up the lock automatically.
221-
/// For example, when the file lock is unlocked, the mutex is not, and the user process knows for sure it is not
222-
/// holding the mutex itself.
223-
///
224-
/// When this parameter is set to true, the channel will assume that it's safe to force the mutex.
225-
/// The channel will first try to acquire the channel lock normally.
226-
/// If it fails to acquire the mutex, it will forcibly clean up and acquire the lock.
227-
/// A warning will be logged when the forced acquire is used.
228-
///
229-
/// Note that this is a dangerous operation that can cause the system to crash if the assumption does not hold.
230-
///
231-
/// \param value The value to set
232-
/// \return Reference to this object for chaining calls
233-
auto setForcedUnlockEnabled(ForcedUnlockEnabledType value) -> Parameters&;
234-
235210
/// Sets the LinkMask parameter
236211
///
237212
/// The BAR channel may transfer data from multiple links.
@@ -290,10 +265,6 @@ class Parameters
290265
/// \return The value wrapped in an optional if it is present, or an empty optional if it was not
291266
auto getReadoutMode() const -> boost::optional<ReadoutModeType>;
292267

293-
/// Gets the ForcedUnlockEnabled parameter
294-
/// \return The value wrapped in an optional if it is present, or an empty optional if it was not
295-
auto getForcedUnlockEnabled() const -> boost::optional<ForcedUnlockEnabledType>;
296-
297268
/// Gets the LinkMask parameter
298269
/// \return The value wrapped in an optional if it is present, or an empty optional if it was not
299270
auto getLinkMask() const -> boost::optional<LinkMaskType>;
@@ -351,11 +322,6 @@ class Parameters
351322
/// \return The value
352323
auto getReadoutModeRequired() const -> ReadoutModeType;
353324

354-
/// Gets the ForcedUnlockEnabled parameter
355-
/// \exception ParameterException The parameter was not present
356-
/// \return The value
357-
auto getForcedUnlockEnabledRequired() const -> ForcedUnlockEnabledType;
358-
359325
/// Gets the LinkMask parameter
360326
/// \exception ParameterException The parameter was not present
361327
/// \return The value

include/ReadoutCard/Superpage.h

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/// \file Superpage.h
2-
/// \brief Definition of the SuperpageStatus struct
2+
/// \brief Definition of the Superpage struct
33
///
44
/// \author Pascal Boeschoten (pascal.boeschoten@cern.ch)
5+
/// \author Kostas Alexopoulos (kostas.alexopoulos@cern.ch)
56

67
#ifndef ALICEO2_INCLUDE_READOUTCARD_SUPERPAGE_H_
78
#define ALICEO2_INCLUDE_READOUTCARD_SUPERPAGE_H_
@@ -14,55 +15,87 @@ namespace roc {
1415
/// Simple struct for holding basic info about a superpage
1516
struct Superpage
1617
{
18+
public:
1719
Superpage() = default;
1820

1921
Superpage(size_t offset, size_t size, void* userData = nullptr)
20-
: offset(offset), size(size), userData(userData)
22+
: mOffset(offset), mSize(size), mUserData(userData)
2123
{
2224
}
2325

2426
/// Returns true if the superpage is ready, meaning the transfer is complete. This does not necessarily mean the
2527
/// superpage is filled.
2628
bool isReady() const
2729
{
28-
return ready;
30+
return mReady;
2931
}
3032

3133
/// Returns true if the superpage is completely filled
3234
bool isFilled() const
3335
{
34-
return received == getSize();
36+
return mReceived == getSize();
3537
}
3638

3739
/// Offset from the start of the DMA buffer to the start of the superpage.
3840
size_t getOffset() const
3941
{
40-
return offset;
42+
return mOffset;
4143
}
4244

4345
/// Size of the superpage in bytes
4446
size_t getSize() const
4547
{
46-
return size;
48+
return mSize;
4749
}
4850

4951
/// Size of the received data in bytes
5052
size_t getReceived() const
5153
{
52-
return received;
54+
return mReceived;
5355
}
5456

5557
/// Get the user data pointer
5658
void* getUserData() const
5759
{
58-
return userData;
60+
return mUserData;
5961
}
6062

61-
size_t offset = 0; ///< Offset from the start of the DMA buffer to the start of the superpage
62-
size_t size = 0; ///< Size of the superpage in bytes
63-
void* userData = nullptr; ///< Pointer that users can use for whatever, e.g. to associate data with the superpage
64-
size_t received = 0; ///< Size of the received data in bytes
65-
bool ready = false; ///< Indicates this superpage is ready
63+
/// Set the ready flag
64+
void setReady(bool ready)
65+
{
66+
mReady = ready;
67+
}
68+
69+
/// Set the size of the received data in bytes
70+
void setReceived(size_t received)
71+
{
72+
mReceived = received;
73+
}
74+
75+
/// Set the offset from the start of the DMA buffer to the start of the superpage
76+
void setOffset(size_t offset)
77+
{
78+
mOffset = offset;
79+
}
80+
81+
/// Set the size of the Superpage in bytes
82+
void setSize(size_t size)
83+
{
84+
mSize = size;
85+
}
86+
87+
/// Get the user data pointer
88+
void setUserData(void* userData)
89+
{
90+
mUserData = userData;
91+
}
92+
93+
private:
94+
size_t mOffset = 0; ///< Offset from the start of the DMA buffer to the start of the superpage
95+
size_t mSize = 0; ///< Size of the superpage in bytes
96+
void* mUserData = nullptr; ///< Pointer that users can use for whatever, e.g. to associate data with the superpage
97+
size_t mReceived = 0; ///< Size of the received data in bytes
98+
bool mReady = false; ///< Indicates this superpage is ready
6699
};
67100

68101
} // namespace roc

src/CommandLineUtilities/ProgramCleanup.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class ProgramCleanup: public Program
3030
{
3131
Options::addOptionCardId(options);
3232
Options::addOptionChannel(options);
33-
options.add_options()("force",po::bool_switch(&mForceCleanup),
34-
"Force cleanup of shared state files if normal cleanup fails");
33+
//options.add_options()("force",po::bool_switch(&mForceCleanup),
34+
// "Force cleanup of shared state files if normal cleanup fails");
3535
}
3636

3737
virtual void run(const boost::program_options::variables_map& map)
@@ -43,14 +43,14 @@ class ProgramCleanup: public Program
4343
// It will not succeed if the channel was not initialized properly before the running of this program.
4444
cout << "### Attempting cleanup...\n";
4545
auto params = AliceO2::roc::Parameters::makeParameters(cardId, channelNumber);
46-
params.setForcedUnlockEnabled(mForceCleanup);
46+
//params.setForcedUnlockEnabled(mForceCleanup);
4747
params.setBufferParameters(buffer_parameters::Null());
4848
auto channel = ChannelFactory().getDmaChannel(params);
4949
cout << "### Done!\n";
5050
}
5151

5252
private:
53-
bool mForceCleanup;
53+
//bool mForceCleanup;
5454
};
5555
} // Anonymous namespace
5656

0 commit comments

Comments
 (0)