|
AJA NTV2 SDK
17.5.0.1492
NTV2 SDK 17.5.0.1492
|
Go to the documentation of this file.
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__)
26 static const ULWord sMasks[] = { 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 };
43 if (regNum > maxRegNum)
58 if (GetConnectedOutput (outInputXpt, tmpOutputXpt))
59 if (tmpOutputXpt == inOutputXpt)
79 if (GetConnectedOutput (inputXpt, tmpOutputXpt))
80 if (tmpOutputXpt == inOutputXpt)
81 outInputXpts.insert(inputXpt);
83 return !outInputXpts.empty();
106 if (regNum > maxRegNum)
110 bool changed (
false);
112 changed = ReadRegister(regNum, outputXpt,
sMasks[ndx],
sShifts[ndx]) && outputXpt;
116 if (result && changed)
135 bool isConnectedToBlack (
false);
136 if (!IsConnectedTo (inInputXpt,
NTV2_XptBlack, isConnectedToBlack))
139 outIsConnected = !isConnectedToBlack;
146 outIsConnected =
false;
147 if (!GetConnectedOutput (inConnection.first, outputID))
150 outIsConnected = outputID == inConnection.second;
161 outCanConnect =
false;
181 {outCanConnect =
true;
return true;}
194 + 4UL * uint32_t(inConnection.first
196 for (uint32_t ndx(0); ndx < 4; ndx++)
200 ReadRegister(regBase + ndx, regVal);
202 ROUTEWARN(GetDisplayName() <<
": GetRouteROMInfoFromReg failed for register " <<
DEC(regBase+ndx)
208 outCanConnect = legalOutputXpts.find(inConnection.second) != legalOutputXpts.end();
215 return Disconnect (inConnection.first);
218 bool canConnect (
true);
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;}
224 {
ROUTEFAIL(GetDisplayName() <<
": GetCrosspointSelectGroupRegisterInfo returned bad index '" <<
DEC(ndx) <<
"' for inputXpt=" <<
DEC(inConnection.first));
return false;}
227 if (CanConnect(inConnection, canConnect))
230 ROUTEFAIL (GetDisplayName() <<
": Unsupported connection '" << inConnection <<
"': reg=" <<
DEC(regNum)
239 const bool result (WriteRegister(regNum, inConnection.second,
sMasks[ndx],
sShifts[ndx]));
243 ROUTEFAIL(GetDisplayName() <<
": Failed to connect '" << inConnection <<
": reg=" <<
DEC(regNum)
244 <<
" val=" <<
DEC(inConnection.second) <<
" mask=" <<
xHEX0N(
sMasks[ndx],8)
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");
266 for (uint32_t ndx(0); ndx < 4; ndx++)
270 if (ReadRegister(regBase + ndx, regVal))
273 return !outputXpts.empty();
280 if (!ClearRouting ())
287 return WriteRegisters (registerWrites);
293 if (!ClearRouting ())
296 unsigned failures(0);
300 return failures == 0;
305 unsigned failures(0);
307 if (!Disconnect(iter->first))
309 return failures == 0;
317 unsigned nFailures (0);
321 if (*it <= maxRegisterNumber)
323 if (ReadRegister (*it, num))
325 if (!WriteRegister (*it, 0))
329 if (tally && !nFailures)
330 ROUTEINFO(GetDisplayName() <<
": Routing cleared");
332 ROUTEDBG(GetDisplayName() <<
": Routing already clear, nothing changed");
334 ROUTEFAIL(GetDisplayName() <<
": " <<
DEC(nFailures) <<
" register write(s) failed");
335 return nFailures == 0;
349 ROUTEDBG(GetDisplayName() <<
": '" << ::
NTV2DeviceIDToString(GetDeviceID()) <<
"' has " << validWidgets.size() <<
" widgets: " << validWidgets);
363 if (!GetConnectedOutput (*pInputID, outputID))
375 ROUTEDBG(GetDisplayName() <<
": Returning " << outRouting);
382 outConnections.clear();
387 && ReadRegisters(regInfos)
404 if (IS_CHANNEL_INVALID(inChannel))
408 inputXptQueue.push_back(SDIOutInputs[inChannel]);
412 while (!inputXptQueue.empty())
419 inputXptQueue.pop_front();
425 if (!GetConnectedOutput (inputXpt, outputXpt))
437 if (wgtIDs.find(widgetID) == wgtIDs.end())
443 inputXptQueue.push_back(*it);
447 ROUTEDBG(GetDisplayName() <<
": Channel " <<
DEC(inChannel+1) <<
" routing: " << outRouting);
NTV2InputCrosspointQueue::const_iterator NTV2InputCrosspointQueueConstIter
deque< NTV2InputCrosspointID > NTV2InputCrosspointQueue
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.
virtual bool GetConnections(NTV2XptConnections &outConnections)
Answers with the device's current widget routing connections.
ULWordSetConstIter NTV2RegNumSetConstIter
A const iterator that iterates over a set of distinct NTV2RegisterNumbers.
std::set< NTV2InputXptID > NTV2InputCrosspointIDSet
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).
std::set< NTV2InputXptID > NTV2InputXptIDSet
A collection of distinct NTV2InputXptID values.
@ kDeviceHasXptConnectROM
True if device has a crosspoint connection ROM (New in SDK 17.0)
NTV2XptConnections::const_iterator NTV2XptConnectionsConstIter
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
static const ULWord sShifts[]
NTV2InputCrosspointQueue::iterator NTV2InputCrosspointQueueIter
@ NTV2_FIRST_INPUT_CROSSPOINT
Originally 0x01. Changed to 0x00 in SDK 17.1.
static bool GetConnectionsFromRegs(const NTV2InputXptIDSet &inInputXptIDs, const NTV2RegisterReads &inRegValues, NTV2XptConnections &outConnections)
Converts a set of crosspoint registers into a set of crosspoint connections.
virtual bool GetRegisterWrites(NTV2RegisterWrites &outRegWrites) const
Returns a sequence of NTV2RegInfo values that can be written to an NTV2 device using its WriteRegiste...
static const ULWord sMasks[]
virtual bool IsConnected(const NTV2InputCrosspointID inInputXpt, bool &outIsConnected)
Answers whether or not the given widget signal input (sink) is connected to another output (source).
virtual bool ClearRouting(void)
Removes all existing signal path connections between any and all widgets on the AJA device.
std::pair< NTV2InputXptID, NTV2OutputXptID > NTV2XptConnection
virtual bool ApplySignalRoute(const CNTV2SignalRouter &inRouter, const bool inReplace=(0))
Applies the given routing table to the AJA device.
enum NTV2InputCrosspointID NTV2InputXptID
@ NTV2_OUTPUT_CROSSPOINT_INVALID
static bool GetAllRoutingRegInfos(const NTV2InputXptIDSet &inInputs, NTV2RegisterWrites &outRegInfos)
Returns all routing registers for the given set of input crosspoints.
#define NTV2_IS_VALID_InputCrosspointID(__s__)
NTV2RegisterNumberSet NTV2RegNumSet
A set of distinct NTV2RegisterNumbers.
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....
NTV2WidgetIDSet::const_iterator NTV2WidgetIDSetConstIter
An iterator for iterating over a read-only NTV2WidgetIDSet.
std::set< ULWord > ULWordSet
A collection of unique ULWord (uint32_t) values.
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.
std::string NTV2DeviceIDToString(const NTV2DeviceID inValue, const bool inForRetailDisplay=false)
Declares the CNTV2Card class.
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).
@ kDeviceGetMaxRegisterNumber
The highest register number for the device.
std::string NTV2InputCrosspointIDToString(const NTV2InputCrosspointID inValue, const bool inForRetailDisplay=false)
NTV2RegWrites NTV2RegisterReads
Declares numerous NTV2 utility functions.
virtual bool Disconnect(const NTV2InputCrosspointID inInputXpt)
Disconnects the given widget signal input (sink) from whatever output (source) it may be connected.
NTV2InputCrosspointID
Identifies a widget input that potentially can accept a signal emitted from another widget's output (...
#define kRegClass_Routing
NTV2InputXptIDSet::const_iterator NTV2InputCrosspointIDSetConstIter
std::set< NTV2OutputXptID > NTV2OutputXptIDSet
A collection of distinct NTV2OutputXptID values.
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...
This class is a collection of widget input-to-output connections that can be applied all-at-once to a...
@ kNTV2EnumsID_WidgetID
Identifies the NTV2AudioWidgetID enumerated type.
#define NTV2_IS_VALID_OutputCrosspointID(__s__)
@ NTV2_INPUT_CROSSPOINT_INVALID
virtual bool RemoveConnections(const NTV2XptConnections &inConnections)
Removes the given widget routing connections from the AJA device.
virtual bool GetConnectedInputs(const NTV2OutputCrosspointID inOutputXpt, NTV2InputCrosspointIDSet &outInputXpts)
Answers with all of the NTV2InputCrosspointIDs that are connected to the given NTV2OutputCrosspointID...
static bool GetWidgetIDs(const NTV2DeviceID inDeviceID, NTV2WidgetIDSet &outWidgets)
Returns the widget IDs supported by the given device.
static bool GetAllWidgetInputs(const NTV2DeviceID inDeviceID, NTV2InputXptIDSet &outInputs)
Returns all supported widget input crosspoints for the given device.
NTV2OutputCrosspointID
Identifies a widget output, a signal source, that potentially can drive another widget's input (ident...
virtual bool GetRouting(CNTV2SignalRouter &outRouting)
Answers with the current signal routing between any and all widgets on the AJA device.
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).
static NTV2RegNumSet GetRegistersForClass(const std::string &inClassName)
static bool GetWidgetForOutput(const NTV2OutputXptID inOutputXpt, NTV2WidgetID &outWidgetID, const NTV2DeviceID inDeviceID=DEVICE_ID_NOTFOUND)
Returns the widget that "owns" the specified output crosspoint.
std::vector< NTV2RegInfo > NTV2RegisterWrites
std::map< NTV2InputXptID, NTV2OutputXptID > NTV2XptConnections
@ NTV2_LAST_INPUT_CROSSPOINT
@ kRegFirstValidXptROMRegister
#define LOGGING_ROUTING_CHANGES
static bool GetWidgetInputs(const NTV2WidgetID inWidgetID, NTV2InputXptIDSet &outInputs)
Returns the input crosspoints known to be "owned" by the given widget.
@ NTV2_LAST_OUTPUT_CROSSPOINT
enum NTV2OutputCrosspointID NTV2OutputXptID
#define NTV2_IS_VALID_WIDGET(__w__)
std::string NTV2OutputCrosspointIDToString(const NTV2OutputCrosspointID inValue, const bool inForRetailDisplay=false)
#define xHEX0N(__x__, __n__)
virtual bool GetRoutingForChannel(const NTV2Channel inChannel, CNTV2SignalRouter &outRouting)
Answers with the current signal routing for the given channel.
virtual void Reset(void)
Resets me, erasing any/all existing connections.
Declares the CNTV2RegisterExpert class.
std::string NTV2WidgetIDToString(const NTV2WidgetID inValue, const bool inCompactDisplay=false)
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).
std::set< NTV2WidgetID > NTV2WidgetIDSet
A collection of distinct NTV2WidgetID values.
Declares the AJADebug class.
virtual bool GetConnectedOutput(const NTV2InputCrosspointID inInputXpt, NTV2OutputCrosspointID &outOutputXpt)
Answers with the currently connected NTV2OutputCrosspointID for the given NTV2InputCrosspointID.
virtual bool GetConnectedInput(const NTV2OutputCrosspointID inOutputXpt, NTV2InputCrosspointID &outInputXpt)
Answers with a connected NTV2InputCrosspointID for the given NTV2OutputCrosspointID.