GCC Code Coverage Report


Directory: ./
File: non-gpl/BBB48String/BBB48String.h
Date: 2026-12-01 12:27:28
Exec Total Coverage
Lines: 2 3 66.7%
Functions: 1 2 50.0%
Branches: 1 2 50.0%

Line Branch Exec Source
1 #pragma once
2 /*
3 * This file is part of the Falcon Player (FPP) and is Copyright (C)
4 * 2013-2022 by the Falcon Player Developers.
5 *
6 * The Falcon Player (FPP) is free software, and is covered under
7 * multiple Open Source licenses. Please see the included 'LICENSES'
8 * file for descriptions of what files are covered by each license.
9 *
10 * This source file is covered under the CC-BY-ND as described in the
11 * included LICENSE.CC-BY-ND file. This file may be modified for
12 * personal use, but modified copies MAY NOT be redistributed in any form.
13 */
14
15 #include <array>
16 #include <string>
17 #include "fpp-json-fwd.h"
18 #include <vector>
19
20 #include "channeloutput/ChannelOutput.h"
21 #include "channeloutput/PixelString.h"
22 #include "util/BBBPruUtils.h"
23
24 #define MAX_WS2811_TIMINGS 128
25
26 // structure of the data at the start of the PRU ram
27 // that the pru program expects to see
28 typedef struct {
29 // in the DDR shared with the PRU
30 uint32_t address_dma;
31
32 // write data length to start, 0xFFFF to abort
33 volatile uint32_t command;
34 volatile uint32_t response;
35
36 uint16_t timings[MAX_WS2811_TIMINGS];
37 } __attribute__((__packed__)) BBB48StringData;
38
39 class BBB48StringOutput : public ChannelOutput {
40 public:
41 BBB48StringOutput(unsigned int startChannel, unsigned int channelCount);
42 virtual ~BBB48StringOutput();
43
44 110 virtual std::string GetOutputType() const {
45
1/2
✓ Branch 0 taken 110 times.
✗ Branch 1 not taken.
220 return "BBB Pixel Strings";
46 }
47
48 virtual int Init(Json::Value config) override;
49 virtual int Close(void) override;
50
51 virtual int SendData(unsigned char* channelData) override;
52 virtual void PrepData(unsigned char* channelData) override;
53 virtual void DumpConfig(void) override;
54
55 virtual void GetRequiredChannelRanges(const std::function<void(int, int)>& addRange) override;
56
57 virtual void OverlayTestData(unsigned char* channelData, int cycleNum, float percentOfCycle, int testType, const Json::Value& config) override;
58 ✗ virtual bool SupportsTesting() const { return true; }
59
60 private:
61 void StopPRU(bool wait = true);
62 int StartPRU(bool both);
63
64 std::string m_subType;
65
66 class FrameData {
67 public:
68 std::vector<int> gpioStringMap;
69 // The two frame buffers the PRU reads, in the shared DDR region.
70 // Write-only from the ARM: the region is not cache coherent with the
71 // PRU, so anything that reads a buffer pulls its lines into the cache
72 // and the next frame's writes to them never reach DDR (GH #3200).
73 uint8_t* lastData = nullptr;
74 uint8_t* curData = nullptr;
75 // The frame is formatted and compared here, in ordinary memory, then
76 // copied to the PRU memories and to curData.
77 std::vector<uint8_t> fmtCur;
78 std::vector<uint8_t> fmtLast;
79 uint32_t frameSize = 0;
80 int maxStringLen = 0;
81 bool copyToPru = true;
82 uint32_t outputStringLen;
83 // the Falcon V4 config packet for the chain heads this PRU drives,
84 // pre-transposed into the frame's byte-lane format; empty when none
85 std::vector<uint8_t> falconPacketLanes;
86 } m_gpio0Data, m_gpioData;
87 std::vector<PixelString*> m_strings;
88 // per string, per virtual string: nonzero when chMap[i+3] == chMap[i]+3
89 // for the whole map, letting prepData skip the map indirection
90 std::vector<std::vector<uint8_t>> m_vsAffine;
91
92 uint32_t m_curFrame;
93 int m_stallCount;
94 uint32_t m_licensedOutputs;
95
96 BBBPru* m_pru;
97 BBB48StringData* m_pruData;
98
99 BBBPru* m_pru0;
100 BBB48StringData* m_pru0Data;
101
102 int m_testCycle = -1;
103 int m_testType = 0;
104 float m_testPercent = 0.0f;
105 std::list<std::string> m_autoCreatedModelNames;
106
107 // Falcon V4 (send-only) smart receiver support: the chains, and the
108 // m_strings index of each chain's first port. The config packet rides
109 // in each FrameData's falconPacketLanes, appended to the frame and sent
110 // by the firmware every twelfth frame.
111 class FalconV5Support* falconV5Support = nullptr;
112 std::vector<int> m_falconChainHeads;
113 bool m_sendFalconPacket = false;
114
115 void prepData(FrameData& d, unsigned char* channelData);
116 void sendData(FrameData& d, uint32_t* dptr);
117 void createOutputLengths(FrameData& d, const std::string& pfx, std::vector<std::string>& args);
118 void groupFalconV4Chains();
119 void setupFalconV4Lanes(FrameData& d, const std::vector<std::array<uint8_t, 64>>& packets,
120 Json::Value& root, std::vector<std::string>& args);
121 void setupFalconV4Support(Json::Value& root, std::vector<std::string>& args1, std::vector<std::string>& args0);
122 };
123