M1M3 Support System
Loading...
Searching...
No Matches
IFPGA.h
1/*
2 * This file is part of LSST M1M3 support system package.
3 *
4 * Developed for the Vera C. Rubin Telescope and Site System.
5 * This product includes software developed by the LSST Project
6 * (https://www.lsst.org).
7 * See the COPYRIGHT file at the top-level directory of this distribution
8 * for details of code ownership.
9 *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#ifndef LSST_M1M3_SS_FPGA_IFPGA_H_
25#define LSST_M1M3_SS_FPGA_IFPGA_H_
26
27#include <cRIO/FPGA.h>
28
29#include <HealthAndStatusFPGAData.h>
30#include <SupportFPGAData.h>
31
32namespace LSST {
33namespace M1M3 {
34namespace SS {
35
46class IFPGA : public cRIO::FPGA {
47public:
48 IFPGA() : cRIO::FPGA(cRIO::SS) {}
49 virtual ~IFPGA() {}
50
51 static IFPGA &get();
52
53 uint16_t getTxCommand(uint8_t bus) override;
54 uint16_t getRxCommand(uint8_t bus) override;
55 uint32_t getIrq(uint8_t bus) override;
56
62 SupportFPGAData *getSupportFPGAData() { return &supportFPGAData; }
63
69 HealthAndStatusFPGAData *getHealthAndStatusFPGAData() { return &healthAndStatusFPGAData; }
70
82 virtual void waitForOuterLoopClock(uint32_t timeout) = 0;
83
89 virtual void ackOuterLoopClock() = 0;
90
102 virtual void waitForPPS(uint32_t timeout) = 0;
103
109 virtual void ackPPS() = 0;
110
121 virtual void waitForModbusIRQs(uint32_t warning_timeout, uint32_t error_timeout) = 0;
122
129 virtual void ackModbusIRQs() = 0;
130
136 virtual void pullTelemetry() = 0;
137
143 virtual void pullHealthAndStatus() = 0;
144
154 virtual void writeTimestampFIFO(uint64_t timestamp) = 0;
155
160 virtual void readU8ResponseFIFO(uint8_t *data, size_t length, uint32_t timeoutInMs) = 0;
161
178 virtual void writeHealthAndStatusFIFO(uint16_t request, uint16_t param = 0) = 0;
179
189 virtual void readHealthAndStatusFIFO(uint64_t *data, size_t length, uint32_t timeoutInMs = 10) = 0;
190
199 virtual void readRawAccelerometerFIFO(uint64_t *raw, size_t samples) = 0;
200
207 void setPower(bool aux, bool network);
208
215 void setPower(const bool aux[4], const bool network[4]);
216
217protected:
218 SupportFPGAData supportFPGAData;
219 HealthAndStatusFPGAData healthAndStatusFPGAData;
220
221private:
222 IFPGA &operator=(const IFPGA &) = delete;
223 IFPGA(const IFPGA &) = delete;
224};
225
226} /* namespace SS */
227} /* namespace M1M3 */
228} /* namespace LSST */
229
230#endif /* LSST_M1M3_SS_FPGA_IFPGA_H_ */
Health and status reader.
Definition HealthAndStatusFPGAData.h:64
virtual void readRawAccelerometerFIFO(uint64_t *raw, size_t samples)=0
Reads raw accelerometer FIFO.
virtual void readU8ResponseFIFO(uint8_t *data, size_t length, uint32_t timeoutInMs)=0
virtual void waitForPPS(uint32_t timeout)=0
Waits for Peer-to-Peer Synchronization interrupt (10).
virtual void ackModbusIRQs()=0
Acknowledge ModBus interrupt reception.
void setPower(bool aux, bool network)
Sets all auxiliary and network buses power (A-D).
Definition IFPGA.cpp:69
virtual void waitForOuterLoopClock(uint32_t timeout)=0
Wait for outer loop clock interrupt for synchronization between C++ and FPGA code.
virtual void writeTimestampFIFO(uint64_t timestamp)=0
Write current timestamp value into timestampFIFO.
virtual void writeHealthAndStatusFIFO(uint16_t request, uint16_t param=0)=0
Requests HealthAndStatus data.
virtual void pullTelemetry()=0
Retrieve telemetry data.
virtual void waitForModbusIRQs(uint32_t warning_timeout, uint32_t error_timeout)=0
Wait for ModBus interrupts.
virtual void pullHealthAndStatus()=0
Retrieve Health&Status data.
virtual void ackPPS()=0
Acknowledge (clear) Peer-to-Peer Synchronization interrupt.
virtual void ackOuterLoopClock()=0
Acknowledge (clear interrupt 0) outer loop clock.
virtual void readHealthAndStatusFIFO(uint64_t *data, size_t length, uint32_t timeoutInMs=10)=0
Copy HealthAndStatus data into supplied data buffer.
HealthAndStatusFPGAData * getHealthAndStatusFPGAData()
Call after pullHealthAndStatus to retrieve HealthAndStatus data.
Definition IFPGA.h:69
SupportFPGAData * getSupportFPGAData()
Call after pullTelemetry to retrieve telemetry data.
Definition IFPGA.h:62
FPGA support data.
Definition SupportFPGAData.h:36