AJA NTV2 SDK  17.5.0.1492
NTV2 SDK 17.5.0.1492
ntv2regroute.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #include "ntv2card.h"
9 #include "ntv2utils.h"
10 #include "ntv2registerexpert.h"
11 #include "ajabase/system/debug.h"
12 #include <deque>
13 
14 using namespace std;
15 
16 #define HEX16(__x__) "0x" << hex << setw(16) << setfill('0') << uint64_t(__x__) << dec
17 #define INSTP(_p_) HEX16(uint64_t(_p_))
18 #define LOGGING_ROUTING_CHANGES (AJADebug::IsActive(AJA_DebugUnit_RoutingGeneric))
19 #define ROUTEFAIL(__x__) AJA_sERROR (AJA_DebugUnit_RoutingGeneric, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
20 #define ROUTEWARN(__x__) AJA_sWARNING(AJA_DebugUnit_RoutingGeneric, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
21 #define ROUTENOTE(__x__) AJA_sNOTICE (AJA_DebugUnit_RoutingGeneric, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
22 #define ROUTEINFO(__x__) AJA_sINFO (AJA_DebugUnit_RoutingGeneric, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
23 #define ROUTEDBG(__x__) AJA_sDEBUG (AJA_DebugUnit_RoutingGeneric, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
24 
25 
26 static const ULWord sMasks[] = { 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 };
27 static const ULWord sShifts[] = { 0, 8, 16, 24 };
28 
30 {
31  const ULWord maxRegNum (GetNumSupported(kDeviceGetMaxRegisterNumber));
32  uint32_t regNum (0);
33  uint32_t ndx (0);
34 
35  outOutputXpt = NTV2_OUTPUT_CROSSPOINT_INVALID;
36  if (!CNTV2RegisterExpert::GetCrosspointSelectGroupRegisterInfo (inInputXpt, regNum, ndx))
37  return false;
38 
39  if (!regNum)
40  return false; // Register number is zero
41  if (ndx > 3)
42  return false; // Bad index
43  if (regNum > maxRegNum)
44  return false; // This device doesn't have that routing register
45 
46  return CNTV2DriverInterface::ReadRegister (regNum, outOutputXpt, sMasks[ndx], sShifts[ndx]);
47 
48 } // GetConnectedOutput
49 
50 
52 {
53  for (outInputXpt = NTV2_FIRST_INPUT_CROSSPOINT;
54  outInputXpt <= NTV2_LAST_INPUT_CROSSPOINT;
55  outInputXpt = NTV2InputCrosspointID(outInputXpt+1))
56  {
58  if (GetConnectedOutput (outInputXpt, tmpOutputXpt))
59  if (tmpOutputXpt == inOutputXpt)
60  return true;
61  }
62  outInputXpt = NTV2_INPUT_CROSSPOINT_INVALID;
63  return true;
64 }
65 
66 
68 {
69  outInputXpts.clear();
70  if (!NTV2_IS_VALID_OutputCrosspointID(inOutputXpt))
71  return false;
72  if (inOutputXpt == NTV2_XptBlack)
73  return false;
75  inputXpt <= NTV2_LAST_INPUT_CROSSPOINT;
76  inputXpt = NTV2InputCrosspointID(inputXpt+1))
77  {
79  if (GetConnectedOutput (inputXpt, tmpOutputXpt))
80  if (tmpOutputXpt == inOutputXpt)
81  outInputXpts.insert(inputXpt);
82  }
83  return !outInputXpts.empty();
84 }
85 
86 
87 bool CNTV2Card::Connect (const NTV2InputCrosspointID inInputXpt, const NTV2OutputCrosspointID inOutputXpt, const bool inValidate)
88 {
89  return Connect(NTV2XptConnection(inInputXpt, inOutputXpt), inValidate);
90 }
91 
92 
94 {
95  const ULWord maxRegNum (GetNumSupported(kDeviceGetMaxRegisterNumber));
96  uint32_t regNum (0);
97  uint32_t ndx (0);
98  ULWord outputXpt (0);
99 
100  if (!CNTV2RegisterExpert::GetCrosspointSelectGroupRegisterInfo(inInputXpt, regNum, ndx))
101  return false;
102  if (!regNum)
103  return false; // Register number is zero
104  if (ndx > 3)
105  return false; // Bad index
106  if (regNum > maxRegNum)
107  return false; // This device doesn't have that routing register
108 
109  const bool isLogging (LOGGING_ROUTING_CHANGES);
110  bool changed (false);
111  if (isLogging)
112  changed = ReadRegister(regNum, outputXpt, sMasks[ndx], sShifts[ndx]) && outputXpt;
113  const bool result (WriteRegister(regNum, NTV2_XptBlack, sMasks[ndx], sShifts[ndx]));
114  if (isLogging)
115  {
116  if (result && changed)
117  ROUTENOTE(GetDisplayName() << ": Disconnected " << ::NTV2InputCrosspointIDToString(inInputXpt) << " <== " << ::NTV2OutputCrosspointIDToString(NTV2OutputXptID(outputXpt)));
118  else if (!result)
119  ROUTEFAIL(GetDisplayName() << ": Failed to disconnect " << ::NTV2InputCrosspointIDToString(inInputXpt) << " <== " << ::NTV2OutputCrosspointIDToString(NTV2OutputXptID(outputXpt))
120  << ": reg=" << DEC(regNum) << " val=0 mask=" << xHEX0N(sMasks[ndx],8) << " shift=" << DEC(sShifts[ndx]));
121  //else ROUTEDBG(GetDisplayName() << ": " << ::NTV2InputCrosspointIDToString(inInputXpt) << " <== " << ::NTV2OutputCrosspointIDToString(NTV2OutputXptID(outputXpt)) << " already disconnected");
122  }
123  return result;
124 }
125 
126 
127 bool CNTV2Card::IsConnectedTo (const NTV2InputCrosspointID inInputXpt, const NTV2OutputCrosspointID inOutputXpt, bool & outIsConnected)
128 {
129  return IsConnected(NTV2XptConnection(inInputXpt, inOutputXpt), outIsConnected);
130 }
131 
132 
133 bool CNTV2Card::IsConnected (const NTV2InputCrosspointID inInputXpt, bool & outIsConnected)
134 {
135  bool isConnectedToBlack (false);
136  if (!IsConnectedTo (inInputXpt, NTV2_XptBlack, isConnectedToBlack))
137  return false;
138 
139  outIsConnected = !isConnectedToBlack;
140  return true;
141 }
142 
143 bool CNTV2Card::IsConnected (const NTV2XptConnection inConnection, bool & outIsConnected)
144 {
146  outIsConnected = false;
147  if (!GetConnectedOutput (inConnection.first, outputID))
148  return false;
149 
150  outIsConnected = outputID == inConnection.second;
151  return true;
152 }
153 
154 bool CNTV2Card::CanConnect (const NTV2InputCrosspointID inInputXpt, const NTV2OutputCrosspointID inOutputXpt, bool & outCanConnect)
155 {
156  return CanConnect (NTV2XptConnection(inInputXpt, inOutputXpt), outCanConnect);
157 }
158 
159 bool CNTV2Card::CanConnect (const NTV2XptConnection & inConnection, bool & outCanConnect)
160 {
161  outCanConnect = false;
162  if (!IsSupported(kDeviceHasXptConnectROM))
163  return false; // No CanConnect ROM -- can't say
164 
165  // NOTE: This is not a very efficient implementation, but CanConnect probably isn't being
166  // called every frame. The good news is that this function now gets its information
167  // "straight from the horse's mouth" via the validated GetRouteROMInfoFromReg function,
168  // so its answer will be trustworthy.
169 
170  // Check for reasonable input xpt...
171  if (ULWord(inConnection.first) < ULWord(NTV2_FIRST_INPUT_CROSSPOINT)
172  || ULWord(inConnection.first) > NTV2_LAST_INPUT_CROSSPOINT)
173  {
174  ROUTEFAIL(GetDisplayName() << ": " << xHEX0N(UWord(inConnection.first),4) << " > "
175  << xHEX0N(UWord(NTV2_LAST_INPUT_CROSSPOINT),4) << " (out of range)");
176  return false;
177  }
178 
179  // Every input xpt can connect to XptBlack...
180  if (inConnection.second == NTV2_XptBlack)
181  {outCanConnect = true; return true;}
182 
183  // Check for reasonable output xpt...
184  if (ULWord(inConnection.second) >= UWord(NTV2_LAST_OUTPUT_CROSSPOINT))
185  {
186  ROUTEFAIL(GetDisplayName() << ": Bad output xpt " << xHEX0N(ULWord(inConnection.second),4) << " >= "
188  return false;
189  }
190 
191  // Determine all legal output xpts for this input xpt...
192  NTV2OutputXptIDSet legalOutputXpts;
193  const uint32_t regBase (uint32_t(kRegFirstValidXptROMRegister)
194  + 4UL * uint32_t(inConnection.first
196  for (uint32_t ndx(0); ndx < 4; ndx++)
197  {
198  ULWord regVal(0);
199  NTV2InputXptID inputXpt;
200  ReadRegister(regBase + ndx, regVal);
201  if (!CNTV2SignalRouter::GetRouteROMInfoFromReg (regBase + ndx, regVal, inputXpt, legalOutputXpts, true/*append*/))
202  ROUTEWARN(GetDisplayName() << ": GetRouteROMInfoFromReg failed for register " << DEC(regBase+ndx)
203  << ", input xpt ' " << ::NTV2InputCrosspointIDToString(inConnection.first) << "' "
204  << xHEX0N(UWord(inConnection.first),2));
205  }
206 
207  // Is the route implemented?
208  outCanConnect = legalOutputXpts.find(inConnection.second) != legalOutputXpts.end();
209  return true;
210 }
211 
212 bool CNTV2Card::Connect (const NTV2XptConnection & inConnection, const bool inValidate)
213 {
214  if (inConnection.second == NTV2_XptBlack)
215  return Disconnect (inConnection.first);
216 
217  ULWord maxRegNum(GetNumSupported(kDeviceGetMaxRegisterNumber)), regNum(0), ndx(0);
218  bool canConnect (true);
219  if (!CNTV2RegisterExpert::GetCrosspointSelectGroupRegisterInfo(inConnection.first, regNum, ndx))
220  {ROUTEFAIL(GetDisplayName() << ": GetCrosspointSelectGroupRegisterInfo failed, inputXpt=" << DEC(inConnection.first)); return false;}
221  if (!regNum || regNum > maxRegNum)
222  {ROUTEFAIL(GetDisplayName() << ": GetCrosspointSelectGroupRegisterInfo returned bad reg num '" << DEC(regNum) << "' for inputXpt=" << DEC(inConnection.first)); return false;}
223  if (ndx > 3)
224  {ROUTEFAIL(GetDisplayName() << ": GetCrosspointSelectGroupRegisterInfo returned bad index '" << DEC(ndx) << "' for inputXpt=" << DEC(inConnection.first)); return false;}
225 
226  if (inValidate) // If caller requested xpt validation
227  if (CanConnect(inConnection, canConnect)) // If answer can be trusted
228  if (!canConnect) // If route not valid
229  {
230  ROUTEFAIL (GetDisplayName() << ": Unsupported connection '" << inConnection << "': reg=" << DEC(regNum)
231  << " val=" << DEC(inConnection.second) << " mask=" << xHEX0N(sMasks[ndx],8) << " shift=" << DEC(sShifts[ndx]));
232  return false;
233  }
234 
235  ULWord outputXpt(0);
236  const bool isLogging (LOGGING_ROUTING_CHANGES);
237  if (isLogging)
238  ReadRegister(regNum, outputXpt, sMasks[ndx], sShifts[ndx]);
239  const bool result (WriteRegister(regNum, inConnection.second, sMasks[ndx], sShifts[ndx]));
240  if (isLogging)
241  {
242  if (!result)
243  ROUTEFAIL(GetDisplayName() << ": Failed to connect '" << inConnection << ": reg=" << DEC(regNum)
244  << " val=" << DEC(inConnection.second) << " mask=" << xHEX0N(sMasks[ndx],8)
245  << " shift=" << DEC(sShifts[ndx]));
246  else if (outputXpt && inConnection.second != outputXpt)
247  ROUTENOTE(GetDisplayName() << ": Connected '" << inConnection << "' -- was from "
249  else if (!outputXpt && inConnection.second != outputXpt)
250  ROUTENOTE(GetDisplayName() << ": Connected '" << inConnection << "' -- was disconnected");
251  //else ROUTEDBG(GetDisplayName() << ": Connection '" << inConnection << "' unchanged -- already connected");
252  }
253  return result;
254 }
255 
257 {
258  if (!IsSupported(kDeviceHasXptConnectROM))
259  return false; // No CanConnect ROM -- can't say
260  if (!NTV2_IS_VALID_InputCrosspointID(inInputXptID))
261  return false;
262 
263  // Determine all legal output xpts for this input xpt...
264  outputXpts.clear();
265  const uint32_t regBase(uint32_t(kRegFirstValidXptROMRegister) + 4UL * uint32_t(inInputXptID - NTV2_FIRST_INPUT_CROSSPOINT));
266  for (uint32_t ndx(0); ndx < 4; ndx++)
267  {
268  ULWord regVal(0);
269  NTV2InputXptID inputXpt;
270  if (ReadRegister(regBase + ndx, regVal))
271  CNTV2SignalRouter::GetRouteROMInfoFromReg (regBase + ndx, regVal, inputXpt, outputXpts, true/*append*/);
272  }
273  return !outputXpts.empty();
274 }
275 
276 
277 bool CNTV2Card::ApplySignalRoute (const CNTV2SignalRouter & inRouter, const bool inReplace)
278 {
279  if (inReplace)
280  if (!ClearRouting ())
281  return false;
282 
283  NTV2RegisterWrites registerWrites;
284  if (!inRouter.GetRegisterWrites (registerWrites))
285  return false;
286 
287  return WriteRegisters (registerWrites);
288 }
289 
290 bool CNTV2Card::ApplySignalRoute (const NTV2XptConnections & inConnections, const bool inReplace)
291 {
292  if (inReplace)
293  if (!ClearRouting ())
294  return false;
295 
296  unsigned failures(0);
297  for (NTV2XptConnectionsConstIter iter(inConnections.begin()); iter != inConnections.end(); ++iter)
298  if (!Connect(iter->first, iter->second, IsSupported(kDeviceHasXptConnectROM)))
299  failures++;
300  return failures == 0;
301 }
302 
304 {
305  unsigned failures(0);
306  for (NTV2XptConnectionsConstIter iter(inConnections.begin()); iter != inConnections.end(); ++iter)
307  if (!Disconnect(iter->first))
308  failures++;
309  return failures == 0;
310 }
311 
312 
314 {
316  const ULWord maxRegisterNumber (GetNumSupported(kDeviceGetMaxRegisterNumber));
317  unsigned nFailures (0);
318  ULWord tally (0);
319 
320  for (NTV2RegNumSetConstIter it(routingRegisters.begin()); it != routingRegisters.end(); ++it) // for each routing register
321  if (*it <= maxRegisterNumber) // if it's valid for this board
322  { ULWord num(0);
323  if (ReadRegister (*it, num))
324  tally += num;
325  if (!WriteRegister (*it, 0)) // then if WriteRegister fails
326  nFailures++; // then bump the failure tally
327  }
328 
329  if (tally && !nFailures)
330  ROUTEINFO(GetDisplayName() << ": Routing cleared");
331  else if (!nFailures)
332  ROUTEDBG(GetDisplayName() << ": Routing already clear, nothing changed");
333  else
334  ROUTEFAIL(GetDisplayName() << ": " << DEC(nFailures) << " register write(s) failed");
335  return nFailures == 0;
336 
337 } // ClearRouting
338 
339 
341 {
342  outRouting.Reset ();
343 
344  // First, compile a set of NTV2WidgetIDs that are legit for this device...
345  NTV2WidgetIDSet validWidgets;
346  if (!CNTV2SignalRouter::GetWidgetIDs (GetDeviceID(), validWidgets))
347  return false;
348 
349  ROUTEDBG(GetDisplayName() << ": '" << ::NTV2DeviceIDToString(GetDeviceID()) << "' has " << validWidgets.size() << " widgets: " << validWidgets);
350 
351  // Inspect every input of every widget...
352  for (NTV2WidgetIDSetConstIter pWidgetID (validWidgets.begin ()); pWidgetID != validWidgets.end (); ++pWidgetID)
353  {
354  const NTV2WidgetID curWidgetID (*pWidgetID);
355  NTV2InputXptIDSet inputs;
356 
357  CNTV2SignalRouter::GetWidgetInputs (curWidgetID, inputs);
358  ROUTEDBG(GetDisplayName() << ": " << ::NTV2WidgetIDToString(curWidgetID) << " (" << ::NTV2WidgetIDToString(curWidgetID, true) << ") has " << inputs.size() << " input(s): " << inputs);
359 
360  for (NTV2InputCrosspointIDSetConstIter pInputID (inputs.begin ()); pInputID != inputs.end (); ++pInputID)
361  {
363  if (!GetConnectedOutput (*pInputID, outputID))
364  ROUTEDBG(GetDisplayName() << ": 'GetConnectedOutput' failed for input " << ::NTV2InputCrosspointIDToString(*pInputID) << " (" << ::NTV2InputCrosspointIDToString(*pInputID, true) << ")");
365  else if (outputID == NTV2_XptBlack)
366  ROUTEDBG(GetDisplayName() << ": 'GetConnectedOutput' returned XptBlack for input '" << ::NTV2InputCrosspointIDToString(*pInputID, true) << "' (" << ::NTV2InputCrosspointIDToString(*pInputID, false) << ")");
367  else
368  {
369  outRouting.AddConnection (*pInputID, outputID); // Record this connection...
370  ROUTEDBG(GetDisplayName() << ": Connection found -- from input '" << ::NTV2InputCrosspointIDToString(*pInputID, true) << "' (" << ::NTV2InputCrosspointIDToString(*pInputID, false)
371  << ") <== to output '" << ::NTV2OutputCrosspointIDToString(outputID, true) << "' (" << ::NTV2OutputCrosspointIDToString(outputID, false) << ")");
372  }
373  } // for each input
374  } // for each valid widget
375  ROUTEDBG(GetDisplayName() << ": Returning " << outRouting);
376  return true;
377 
378 } // GetRouting
379 
381 {
382  outConnections.clear();
383  NTV2RegisterReads regInfos;
384  NTV2InputCrosspointIDSet inputXpts;
385  return CNTV2SignalRouter::GetAllWidgetInputs (_boardID, inputXpts)
386  && CNTV2SignalRouter::GetAllRoutingRegInfos (inputXpts, regInfos)
387  && ReadRegisters(regInfos)
388  && CNTV2SignalRouter::GetConnectionsFromRegs (inputXpts, regInfos, outConnections);
389 }
390 
391 
392 typedef deque <NTV2InputCrosspointID> NTV2InputCrosspointQueue;
393 typedef NTV2InputCrosspointQueue::const_iterator NTV2InputCrosspointQueueConstIter;
394 typedef NTV2InputCrosspointQueue::iterator NTV2InputCrosspointQueueIter;
395 
396 
398 {
399  NTV2InputCrosspointQueue inputXptQueue; // List of inputs to trace backward from
402  outRouting.Reset();
403 
404  if (IS_CHANNEL_INVALID(inChannel))
405  return false;
406 
407  // Seed the input crosspoint queue...
408  inputXptQueue.push_back(SDIOutInputs[inChannel]);
409  const ULWordSet wgtIDs (GetSupportedItems(kNTV2EnumsID_WidgetID));
410 
411  // Process all queued inputs...
412  while (!inputXptQueue.empty())
413  {
414  NTV2InputCrosspointID inputXpt (inputXptQueue.front());
417  NTV2InputCrosspointIDSet inputXpts;
418 
419  inputXptQueue.pop_front();
420 
421  if (inputXpt == NTV2_INPUT_CROSSPOINT_INVALID)
422  continue;
423 
424  // Find out what this input is connected to...
425  if (!GetConnectedOutput (inputXpt, outputXpt))
426  continue; // Keep processing input crosspoints, even if this fails
427 
428  if (outputXpt != NTV2_XptBlack)
429  {
430  // Make a note of this connection...
431  outRouting.AddConnection (inputXpt, outputXpt);
432 
433  // Find out what widget this output belongs to...
434  CNTV2SignalRouter::GetWidgetForOutput (outputXpt, widgetID);
435  if (!NTV2_IS_VALID_WIDGET(widgetID))
436  continue; // Keep processing input crosspoints, even if no such widget
437  if (wgtIDs.find(widgetID) == wgtIDs.end()) // widget not present?
438  continue; // Keep processing input crosspoints, even if no such widget on this device
439 
440  // Add every input of the output's widget to the queue...
441  CNTV2SignalRouter::GetWidgetInputs (widgetID, inputXpts);
442  for (NTV2InputCrosspointIDSetConstIter it (inputXpts.begin ()); it != inputXpts.end (); ++it)
443  inputXptQueue.push_back(*it);
444  } // if connected to something other than "black" output crosspoint
445  } // loop til inputXptQueue empty
446 
447  ROUTEDBG(GetDisplayName() << ": Channel " << DEC(inChannel+1) << " routing: " << outRouting);
448  return true;
449 
450 } // GetRoutingForChannel
NTV2InputCrosspointQueueConstIter
NTV2InputCrosspointQueue::const_iterator NTV2InputCrosspointQueueConstIter
Definition: ntv2regroute.cpp:393
NTV2InputCrosspointQueue
deque< NTV2InputCrosspointID > NTV2InputCrosspointQueue
Definition: ntv2regroute.cpp:392
CNTV2RegisterExpert::GetCrosspointSelectGroupRegisterInfo
static bool GetCrosspointSelectGroupRegisterInfo(const NTV2InputCrosspointID inInputXpt, uint32_t &outXptRegNum, uint32_t &outMaskIndex)
Answers with the crosspoint select register and mask information for a given widget input.
Definition: ntv2registerexpert.cpp:4731
CNTV2Card::GetConnections
virtual bool GetConnections(NTV2XptConnections &outConnections)
Answers with the device's current widget routing connections.
Definition: ntv2regroute.cpp:380
ROUTENOTE
#define ROUTENOTE(__x__)
Definition: ntv2regroute.cpp:21
NTV2RegNumSetConstIter
ULWordSetConstIter NTV2RegNumSetConstIter
A const iterator that iterates over a set of distinct NTV2RegisterNumbers.
Definition: ntv2publicinterface.h:7531
NTV2InputCrosspointIDSet
std::set< NTV2InputXptID > NTV2InputCrosspointIDSet
Definition: ntv2signalrouter.h:26
CNTV2Card::SupportedOutputXptsForInputXpt
virtual bool SupportedOutputXptsForInputXpt(const NTV2InputXptID inInputXptID, NTV2OutputXptIDSet &outOutputXpts)
Answers with the set of output (sources) that can legally be connected to the given input (sink).
Definition: ntv2regroute.cpp:256
NTV2InputXptIDSet
std::set< NTV2InputXptID > NTV2InputXptIDSet
A collection of distinct NTV2InputXptID values.
Definition: ntv2signalrouter.h:26
kDeviceHasXptConnectROM
@ kDeviceHasXptConnectROM
True if device has a crosspoint connection ROM (New in SDK 17.0)
Definition: ntv2devicefeatures.h:147
NTV2XptConnectionsConstIter
NTV2XptConnections::const_iterator NTV2XptConnectionsConstIter
Definition: ntv2signalrouter.h:40
NTV2Channel
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
Definition: ntv2enums.h:1343
sShifts
static const ULWord sShifts[]
Definition: ntv2regroute.cpp:27
NTV2InputCrosspointQueueIter
NTV2InputCrosspointQueue::iterator NTV2InputCrosspointQueueIter
Definition: ntv2regroute.cpp:394
NTV2_FIRST_INPUT_CROSSPOINT
@ NTV2_FIRST_INPUT_CROSSPOINT
Originally 0x01. Changed to 0x00 in SDK 17.1.
Definition: ntv2enums.h:2740
CNTV2SignalRouter::GetConnectionsFromRegs
static bool GetConnectionsFromRegs(const NTV2InputXptIDSet &inInputXptIDs, const NTV2RegisterReads &inRegValues, NTV2XptConnections &outConnections)
Converts a set of crosspoint registers into a set of crosspoint connections.
Definition: ntv2signalrouter.cpp:633
CNTV2SignalRouter::GetRegisterWrites
virtual bool GetRegisterWrites(NTV2RegisterWrites &outRegWrites) const
Returns a sequence of NTV2RegInfo values that can be written to an NTV2 device using its WriteRegiste...
Definition: ntv2signalrouter.cpp:132
sMasks
static const ULWord sMasks[]
Definition: ntv2regroute.cpp:26
CNTV2Card::IsConnected
virtual bool IsConnected(const NTV2InputCrosspointID inInputXpt, bool &outIsConnected)
Answers whether or not the given widget signal input (sink) is connected to another output (source).
Definition: ntv2regroute.cpp:133
CNTV2Card::ClearRouting
virtual bool ClearRouting(void)
Removes all existing signal path connections between any and all widgets on the AJA device.
Definition: ntv2regroute.cpp:313
NTV2XptConnection
std::pair< NTV2InputXptID, NTV2OutputXptID > NTV2XptConnection
Definition: ntv2signalrouter.h:38
NTV2_WIDGET_INVALID
@ NTV2_WIDGET_INVALID
Definition: ntv2enums.h:3016
NTV2_XptSDIOut7Input
@ NTV2_XptSDIOut7Input
Definition: ntv2enums.h:2797
CNTV2Card::ApplySignalRoute
virtual bool ApplySignalRoute(const CNTV2SignalRouter &inRouter, const bool inReplace=(0))
Applies the given routing table to the AJA device.
Definition: ntv2regroute.cpp:277
NTV2InputXptID
enum NTV2InputCrosspointID NTV2InputXptID
NTV2_OUTPUT_CROSSPOINT_INVALID
@ NTV2_OUTPUT_CROSSPOINT_INVALID
Definition: ntv2enums.h:2698
NTV2_XptSDIOut4Input
@ NTV2_XptSDIOut4Input
Definition: ntv2enums.h:2791
CNTV2SignalRouter::GetAllRoutingRegInfos
static bool GetAllRoutingRegInfos(const NTV2InputXptIDSet &inInputs, NTV2RegisterWrites &outRegInfos)
Returns all routing registers for the given set of input crosspoints.
Definition: ntv2signalrouter.cpp:477
NTV2_IS_VALID_InputCrosspointID
#define NTV2_IS_VALID_InputCrosspointID(__s__)
Definition: ntv2enums.h:2886
ROUTEWARN
#define ROUTEWARN(__x__)
Definition: ntv2regroute.cpp:20
NTV2RegNumSet
NTV2RegisterNumberSet NTV2RegNumSet
A set of distinct NTV2RegisterNumbers.
Definition: ntv2publicinterface.h:7530
CNTV2DriverInterface::ReadRegister
virtual bool ReadRegister(const ULWord inRegNum, ULWord &outValue, const ULWord inMask=0xFFFFFFFF, const ULWord inShift=0)
Reads all or part of the 32-bit contents of a specific register (real or virtual) on the AJA device....
Definition: ntv2driverinterface.cpp:433
NTV2WidgetIDSetConstIter
NTV2WidgetIDSet::const_iterator NTV2WidgetIDSetConstIter
An iterator for iterating over a read-only NTV2WidgetIDSet.
Definition: ntv2signalrouter.h:33
ROUTEFAIL
#define ROUTEFAIL(__x__)
Definition: ntv2regroute.cpp:19
ULWordSet
std::set< ULWord > ULWordSet
A collection of unique ULWord (uint32_t) values.
Definition: ntv2publicinterface.h:54
CNTV2SignalRouter::GetRouteROMInfoFromReg
static bool GetRouteROMInfoFromReg(const ULWord inROMRegNum, const ULWord inROMRegValue, NTV2InputXptID &outInputXpt, NTV2OutputXptIDSet &outOutputXpts, const bool inAppendOutputXpts=false)
Answers with the NTV2InputXptID and NTV2OutputXptIDSet for the given ROM register value.
Definition: ntv2signalrouter.cpp:1057
ULWord
uint32_t ULWord
Definition: ajatypes.h:255
NTV2_XptSDIOut2Input
@ NTV2_XptSDIOut2Input
Definition: ntv2enums.h:2787
NTV2DeviceIDToString
std::string NTV2DeviceIDToString(const NTV2DeviceID inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:4678
ntv2card.h
Declares the CNTV2Card class.
CNTV2Card::IsConnectedTo
virtual bool IsConnectedTo(const NTV2InputCrosspointID inInputXpt, const NTV2OutputCrosspointID inOutputXpt, bool &outIsConnected)
Answers whether or not the given widget signal input (sink) is connected to another output (source).
Definition: ntv2regroute.cpp:127
kDeviceGetMaxRegisterNumber
@ kDeviceGetMaxRegisterNumber
The highest register number for the device.
Definition: ntv2devicefeatures.h:178
NTV2InputCrosspointIDToString
std::string NTV2InputCrosspointIDToString(const NTV2InputCrosspointID inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:5879
UWord
uint16_t UWord
Definition: ajatypes.h:253
NTV2RegisterReads
NTV2RegWrites NTV2RegisterReads
Definition: ntv2publicinterface.h:4072
ntv2utils.h
Declares numerous NTV2 utility functions.
CNTV2Card::Disconnect
virtual bool Disconnect(const NTV2InputCrosspointID inInputXpt)
Disconnects the given widget signal input (sink) from whatever output (source) it may be connected.
Definition: ntv2regroute.cpp:93
NTV2InputCrosspointID
NTV2InputCrosspointID
Identifies a widget input that potentially can accept a signal emitted from another widget's output (...
Definition: ntv2enums.h:2738
kRegClass_Routing
#define kRegClass_Routing
Definition: ntv2registerexpert.h:64
NTV2InputCrosspointIDSetConstIter
NTV2InputXptIDSet::const_iterator NTV2InputCrosspointIDSetConstIter
Definition: ntv2signalrouter.h:27
NTV2OutputXptIDSet
std::set< NTV2OutputXptID > NTV2OutputXptIDSet
A collection of distinct NTV2OutputXptID values.
Definition: ntv2signalrouter.h:18
NTV2WidgetID
NTV2WidgetID
Definition: ntv2enums.h:2895
CNTV2Card::CanConnect
virtual bool CanConnect(const NTV2InputCrosspointID inInputXpt, const NTV2OutputCrosspointID inOutputXpt, bool &outCanConnect)
Answers whether or not the given widget signal input (sink) can legally be connected to the given sig...
Definition: ntv2regroute.cpp:154
ROUTEDBG
#define ROUTEDBG(__x__)
Definition: ntv2regroute.cpp:23
CNTV2SignalRouter
This class is a collection of widget input-to-output connections that can be applied all-at-once to a...
Definition: ntv2signalrouter.h:56
kNTV2EnumsID_WidgetID
@ kNTV2EnumsID_WidgetID
Identifies the NTV2AudioWidgetID enumerated type.
Definition: ntv2devicefeatures.h:250
NTV2_IS_VALID_OutputCrosspointID
#define NTV2_IS_VALID_OutputCrosspointID(__s__)
Definition: ntv2enums.h:2723
NTV2_XptBlack
@ NTV2_XptBlack
Definition: ntv2enums.h:2516
NTV2_INPUT_CROSSPOINT_INVALID
@ NTV2_INPUT_CROSSPOINT_INVALID
Definition: ntv2enums.h:2875
NTV2_XptSDIOut5Input
@ NTV2_XptSDIOut5Input
Definition: ntv2enums.h:2793
CNTV2Card::RemoveConnections
virtual bool RemoveConnections(const NTV2XptConnections &inConnections)
Removes the given widget routing connections from the AJA device.
Definition: ntv2regroute.cpp:303
CNTV2Card::GetConnectedInputs
virtual bool GetConnectedInputs(const NTV2OutputCrosspointID inOutputXpt, NTV2InputCrosspointIDSet &outInputXpts)
Answers with all of the NTV2InputCrosspointIDs that are connected to the given NTV2OutputCrosspointID...
Definition: ntv2regroute.cpp:67
CNTV2SignalRouter::GetWidgetIDs
static bool GetWidgetIDs(const NTV2DeviceID inDeviceID, NTV2WidgetIDSet &outWidgets)
Returns the widget IDs supported by the given device.
Definition: ntv2signalrouter.cpp:375
CNTV2SignalRouter::GetAllWidgetInputs
static bool GetAllWidgetInputs(const NTV2DeviceID inDeviceID, NTV2InputXptIDSet &outInputs)
Returns all supported widget input crosspoints for the given device.
Definition: ntv2signalrouter.cpp:452
NTV2OutputCrosspointID
NTV2OutputCrosspointID
Identifies a widget output, a signal source, that potentially can drive another widget's input (ident...
Definition: ntv2enums.h:2513
NTV2_XptSDIOut8Input
@ NTV2_XptSDIOut8Input
Definition: ntv2enums.h:2799
CNTV2Card::GetRouting
virtual bool GetRouting(CNTV2SignalRouter &outRouting)
Answers with the current signal routing between any and all widgets on the AJA device.
Definition: ntv2regroute.cpp:340
CNTV2Card::Connect
virtual bool Connect(const NTV2InputCrosspointID inInputXpt, const NTV2OutputCrosspointID inOutputXpt, const bool inValidate=(0))
Connects the given widget signal input (sink) to the given widget signal output (source).
Definition: ntv2regroute.cpp:87
CNTV2RegisterExpert::GetRegistersForClass
static NTV2RegNumSet GetRegistersForClass(const std::string &inClassName)
Definition: ntv2registerexpert.cpp:4696
CNTV2SignalRouter::GetWidgetForOutput
static bool GetWidgetForOutput(const NTV2OutputXptID inOutputXpt, NTV2WidgetID &outWidgetID, const NTV2DeviceID inDeviceID=DEVICE_ID_NOTFOUND)
Returns the widget that "owns" the specified output crosspoint.
Definition: ntv2signalrouter.cpp:422
DEC
#define DEC(__x__)
Definition: ntv2publicinterface.h:5647
NTV2RegisterWrites
std::vector< NTV2RegInfo > NTV2RegisterWrites
Definition: ntv2publicinterface.h:4069
NTV2XptConnections
std::map< NTV2InputXptID, NTV2OutputXptID > NTV2XptConnections
Definition: ntv2signalrouter.h:39
std
Definition: json.hpp:5362
NTV2_LAST_INPUT_CROSSPOINT
@ NTV2_LAST_INPUT_CROSSPOINT
Definition: ntv2enums.h:2874
kRegFirstValidXptROMRegister
@ kRegFirstValidXptROMRegister
Definition: ntv2publicinterface.h:845
NTV2_XptSDIOut6Input
@ NTV2_XptSDIOut6Input
Definition: ntv2enums.h:2795
LOGGING_ROUTING_CHANGES
#define LOGGING_ROUTING_CHANGES
Definition: ntv2regroute.cpp:18
CNTV2SignalRouter::GetWidgetInputs
static bool GetWidgetInputs(const NTV2WidgetID inWidgetID, NTV2InputXptIDSet &outInputs)
Returns the input crosspoints known to be "owned" by the given widget.
Definition: ntv2signalrouter.cpp:444
NTV2_LAST_OUTPUT_CROSSPOINT
@ NTV2_LAST_OUTPUT_CROSSPOINT
Definition: ntv2enums.h:2697
NTV2OutputXptID
enum NTV2OutputCrosspointID NTV2OutputXptID
NTV2_IS_VALID_WIDGET
#define NTV2_IS_VALID_WIDGET(__w__)
Definition: ntv2enums.h:3019
NTV2OutputCrosspointIDToString
std::string NTV2OutputCrosspointIDToString(const NTV2OutputCrosspointID inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:6022
xHEX0N
#define xHEX0N(__x__, __n__)
Definition: ntv2publicinterface.h:5646
CNTV2Card::GetRoutingForChannel
virtual bool GetRoutingForChannel(const NTV2Channel inChannel, CNTV2SignalRouter &outRouting)
Answers with the current signal routing for the given channel.
Definition: ntv2regroute.cpp:397
CNTV2SignalRouter::Reset
virtual void Reset(void)
Resets me, erasing any/all existing connections.
Definition: ntv2signalrouter.h:109
ntv2registerexpert.h
Declares the CNTV2RegisterExpert class.
NTV2WidgetIDToString
std::string NTV2WidgetIDToString(const NTV2WidgetID inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:6227
CNTV2SignalRouter::AddConnection
virtual bool AddConnection(const NTV2InputXptID inSignalInput, const NTV2OutputXptID inSignalOutput=NTV2_XptBlack)
Adds a connection between a widget's signal input (sink) and another widget's signal output (source).
Definition: ntv2signalrouter.cpp:62
NTV2_XptSDIOut1Input
@ NTV2_XptSDIOut1Input
Definition: ntv2enums.h:2785
NTV2WidgetIDSet
std::set< NTV2WidgetID > NTV2WidgetIDSet
A collection of distinct NTV2WidgetID values.
Definition: ntv2signalrouter.h:32
debug.h
Declares the AJADebug class.
NTV2_XptSDIOut3Input
@ NTV2_XptSDIOut3Input
Definition: ntv2enums.h:2789
CNTV2Card::GetConnectedOutput
virtual bool GetConnectedOutput(const NTV2InputCrosspointID inInputXpt, NTV2OutputCrosspointID &outOutputXpt)
Answers with the currently connected NTV2OutputCrosspointID for the given NTV2InputCrosspointID.
Definition: ntv2regroute.cpp:29
CNTV2Card::GetConnectedInput
virtual bool GetConnectedInput(const NTV2OutputCrosspointID inOutputXpt, NTV2InputCrosspointID &outInputXpt)
Answers with a connected NTV2InputCrosspointID for the given NTV2OutputCrosspointID.
Definition: ntv2regroute.cpp:51
ROUTEINFO
#define ROUTEINFO(__x__)
Definition: ntv2regroute.cpp:22