|
| 1 | +// Copyright CERN and copyright holders of ALICE O2. This software is |
| 2 | +// distributed under the terms of the GNU General Public License v3 (GPL |
| 3 | +// Version 3), copied verbatim in the file "COPYING". |
| 4 | +// |
| 5 | +// See http://alice-o2.web.cern.ch/license for full licensing information. |
| 6 | +// |
| 7 | +// In applying this license CERN does not waive the privileges and immunities |
| 8 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 9 | +// or submit itself to any jurisdiction. |
| 10 | + |
| 11 | +/// \file ScBase.h |
| 12 | +/// \brief Definition of ALICE Lowlevel Frontend (ALF) SC base class |
| 13 | +/// |
| 14 | +/// \author Kostas Alexopoulos ([email protected]) |
| 15 | + |
| 16 | +#ifndef O2_ALF_INC_SCBASE_H |
| 17 | +#define O2_ALF_INC_SCBASE_H |
| 18 | + |
| 19 | +#include "ReadoutCard/BarInterface.h" |
| 20 | +#include "ReadoutCard/Parameters.h" |
| 21 | + |
| 22 | +#include "Common.h" |
| 23 | +#include "Alf/Lla.h" |
| 24 | + |
| 25 | +namespace roc = AliceO2::roc; |
| 26 | + |
| 27 | +namespace o2 |
| 28 | +{ |
| 29 | +namespace alf |
| 30 | +{ |
| 31 | + |
| 32 | +/// Class for interfacing with the C-RORC's(?) and CRU's Slow-Control Adapter (SCA) |
| 33 | +class ScBase |
| 34 | +{ |
| 35 | + public: |
| 36 | + /// Internal constructor for the AlfServer |
| 37 | + /// \param link AlfLink holding useful information coming from the AlfServer class |
| 38 | + ScBase(AlfLink link, std::shared_ptr<lla::Session> llaSession); |
| 39 | + |
| 40 | + /// External constructor |
| 41 | + /// \param cardId The card ID for which to get the SC handle. |
| 42 | + /// \param linkId The link ID to set the channel to (optional). |
| 43 | + ScBase(const roc::Parameters::CardIdType& cardId, int linkId = -1); |
| 44 | + |
| 45 | + /// External constructor |
| 46 | + /// \param cardId The card ID for which to get the SC handle. |
| 47 | + /// \param linkId The link ID to set the channel to (optional). |
| 48 | + ScBase(std::string cardId, int linkId = -1); |
| 49 | + |
| 50 | + /// Sets the SC channel |
| 51 | + /// \param gbtChannel The channel to set |
| 52 | + void setChannel(int gbtChannel); |
| 53 | + |
| 54 | + /// Executes a global SC reset |
| 55 | + void scReset(); |
| 56 | + |
| 57 | + /// Checks if an SCA channel has been selected |
| 58 | + /// \throws o2::alf::ScaException if no SCA channel selected |
| 59 | + void checkChannelSet(); |
| 60 | + |
| 61 | + protected: |
| 62 | + uint32_t barRead(uint32_t index); |
| 63 | + void barWrite(uint32_t index, uint32_t data); |
| 64 | + |
| 65 | + AlfLink mLink; |
| 66 | + std::unique_ptr<LlaSession> mLlaSession; |
| 67 | + |
| 68 | + private: |
| 69 | + /// Does the necessary initializations after an object creating |
| 70 | + void init(const roc::Parameters::CardIdType& cardId, int linkId); |
| 71 | + |
| 72 | +/// Interface for BAR 2 |
| 73 | + std::shared_ptr<roc::BarInterface> mBar2; |
| 74 | +}; |
| 75 | + |
| 76 | +} // namespace alf |
| 77 | +} // namespace o2 |
| 78 | + |
| 79 | +#endif // O2_ALF_INC_SCBASE_H |
0 commit comments