ChimeraTK-DeviceAccess 03.25.00
Loading...
Searching...
No Matches
GenericMuxedInterruptDistributor.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2// SPDX-License-Identifier: LGPL-3.0-or-later
3#pragma once
4#include "../NDRegisterAccessor.h"
5#include "../RegisterPath.h"
7
8#include <bitset>
9
10namespace ChimeraTK::async {
11
13 ISR = 0, // Interrupt Status Register
14 IER, // Interrupt Enable Register
15 MER, // Master Enable Register,
16 MIE, // Master Interrupt Enable Functionally equivalent to MER
17 GIE, // Global Interrupt Enable, Functionally equivalent to MER
18 ICR, // Interrupt Clear Register
19 IAR, // Interrupt Acknowledge Register
20 IPR, // Interrupt Pending Register =ISR & IER, a convenience feature for software.
21 SIE, // Set Interrupt Enable
22 CIE, // Clear Interrupt Enable
23 IMaskR, // Interrupt Mask Register. IMR Acronym Collision. Temporarily not allowed. See
24 IModeR, // Interrupt Mode Register. IMR Acronym Collision, defined in the standard but not allowed; REMOVE?
25 IVR, // defined in the standard but not allowed; REMOVE?
26 ILR, // defined in the standard but not allowed; REMOVE?
27 IVAR, // defined in the standard but not allowed; REMOVE?
28 IVEAR, // defined in the standard but not allowed; REMOVE?
29 OPTION_CODE_COUNT, // used for counting how many valid enums there are here & setting list lengths
31 };
32
33 /********************************************************************************************************************/
34
36 public:
37 explicit GenericMuxedInterruptDistributor(const boost::shared_ptr<SubDomain<std::nullptr_t>>& parent,
38 const std::string& registerPath, std::bitset<(ulong)GmidOptionCode::OPTION_CODE_COUNT> optionRegisterSettings);
40
44 void handle(VersionNumber version) override;
45
46 void activate(VersionNumber version) override;
47
53 static std::unique_ptr<GenericMuxedInterruptDistributor> create(std::string const& description, // THE JSON SNIPPET
54 const boost::shared_ptr<SubDomain<std::nullptr_t>>& parent);
55
56 protected:
59 bool _hasMer;
60 uint32_t _activeInterrupts{0}; // like a local copy of IER
61
62 boost::shared_ptr<NDRegisterAccessor<uint32_t>> _isr;
63 boost::shared_ptr<NDRegisterAccessor<uint32_t>> _ier; // May point to IER or Imaskr
64 boost::shared_ptr<NDRegisterAccessor<uint32_t>> _icr; // May point to ICR, IAR, or ISR, which act identically
65 boost::shared_ptr<NDRegisterAccessor<uint32_t>> _mer; // May point to MER, MIE, or GIE, all act identically.
66 // We can have at most 1 of {MIE, GIE, MER}
67 boost::shared_ptr<NDRegisterAccessor<uint32_t>> _sie; // We either have both SIE or CIE or neither.
68 boost::shared_ptr<NDRegisterAccessor<uint32_t>> _cie;
69
70 RegisterPath _path; // just a string path, with the added overwritten / operator etc.
71
77 void clearInterruptsFromMask(uint32_t mask);
78
79 inline void clearOneInterrupt(uint32_t ithInterrupt);
80
81 inline void clearAllInterrupts();
82
83 inline void clearAllEnabledInterrupts();
84
89 void disableInterruptsFromMask(uint32_t mask);
90
91 inline void disableOneInterrupt(uint32_t ithInterrupt);
92
97 void enableInterruptsFromMask(uint32_t mask);
98
99 inline void enableOneInterrupt(uint32_t ithInterrupt);
100
101 void activateSubDomain(SubDomain<std::nullptr_t>& subDomain, VersionNumber const& version) override;
102 };
103
104} // namespace ChimeraTK::async
Class to store a register path name.
Class for generating and holding version numbers without exposing a numeric representation.
void clearInterruptsFromMask(uint32_t mask)
In mask, 1 bits clear the corresponding registers, 0 bits do nothing.
void enableInterruptsFromMask(uint32_t mask)
For each bit in mask that is a 1, the corresponding interrupt gets enabled, and the internal copy of ...
void disableInterruptsFromMask(uint32_t mask)
Disables each interrupt corresponding to the 1 bits in mask, and updates _activeInterrupts.
boost::shared_ptr< NDRegisterAccessor< uint32_t > > _ier
boost::shared_ptr< NDRegisterAccessor< uint32_t > > _cie
boost::shared_ptr< NDRegisterAccessor< uint32_t > > _isr
boost::shared_ptr< NDRegisterAccessor< uint32_t > > _sie
void handle(VersionNumber version) override
Handle gets called when a trigger comes in.
void activateSubDomain(SubDomain< std::nullptr_t > &subDomain, VersionNumber const &version) override
Function to activate a (new) single SubDomain if the MuxedInterruptDistributor is already active.
boost::shared_ptr< NDRegisterAccessor< uint32_t > > _icr
boost::shared_ptr< NDRegisterAccessor< uint32_t > > _mer
static std::unique_ptr< GenericMuxedInterruptDistributor > create(std::string const &description, const boost::shared_ptr< SubDomain< std::nullptr_t > > &parent)
Create parses the json configuration snippet 'description', and calls the constructor.
Interface base class for interrupt controller handlers.
Send backend-specific asynchronous data to different distributors:
Definition SubDomain.h:33