12 void hex_to_bytes(
char *hex, uint8_t *output, uint32_t array_length)
17 for (i = 0, j = 0; i < array_length; i++, j+=2)
19 uint8_t bottom = hex[j+1] - (hex[j+1] >
'9' ?
'A' - 10 :
'0');
20 uint8_t top = hex[j] - (hex[j] >
'9' ?
'A' - 10 :
'0');
21 output[i] = (top * 16) + bottom;
65 uint32_t count = 0, errorCount = 0, totalBytes = 0;
68 uint8_t writeBytes[256];
69 uint32_t outFreq1 = 0, outFreq2 = 0, outFreq3 = 0, outFreq4 = 0, outFreq5 = 0;
70 uint8_t dpll0Status[1] = { 0 };
76 while ((gdat->
size != 0))
79 if (!SPIGenlock2Write(gdat->
size, gdat->
addr, writeBytes,
true))
83 totalBytes += gdat->
size;
87 uint8_t readBytes[256];
89 if (SPIGenlock2Read(gdat->
addr, readBytes, gdat->
size))
91 for (i = 0; i < gdat->
size; i++)
93 SPIGenlock2Read(gdat->
addr+i, readBytes+i, 1);
94 if (readBytes[i] != writeBytes[i])
98 ntv2Message(
"Bytes did not match i : %d read : %02X write : %02X\n", i, readBytes[i], writeBytes[i]);
122 while( (outFreq1 & 0xffffff00) != 0x08D9EE00 &&
123 (outFreq2 & 0xffffff00) != 0x08D7AA00 &&
124 (outFreq3 & 0xffffff00) != 0x019BFC00 &&
125 (outFreq4 & 0xffffff00) != 0x00BB8000 &&
126 (outFreq5 & 0xffffff00) != 0x08D9EE00 &&
168 ULWord vpidDS1(0), vpidDS2(0);
171 isValidVPID = inputVPID.
IsValid();
175 bool is3G (
false), is6G (
false), is12G (
false);
197 bool NTV2MetalE2E::SPIWaitWriteEmpty (
void)
199 uint32_t dtrStatus = 0;
214 bool NTV2MetalE2E::SPIWaitReadNotEmpty (
void)
228 bool NTV2MetalE2E::ResetDTRStatus (
void)
239 bool NTV2MetalE2E::SPIGenlock2Write (uint32_t
size, uint16_t
addr, uint8_t*
data,
bool triggerWait)
242 uint8_t page_select_buffer[10];
252 page_select_buffer[0] =
addr & 0x80;
253 page_select_buffer[1] =
addr >> 8;
254 page_select_buffer[2] = 0x10;
255 page_select_buffer[3] = 0x20;
257 SPIGenlock2Write(4, 0x7C, page_select_buffer,
true);
263 for (i = 0; i <
size; i++)
276 controlVal &= ~0x100;
295 bool NTV2MetalE2E::SPIGenlock2Read (uint16_t
addr, uint8_t*
data, uint32_t numBytes)
297 uint32_t val, status;
298 uint8_t tx_buffer[10];
307 tx_buffer[0] =
addr & 0x80;
308 tx_buffer[1] =
addr >> 8;
312 SPIGenlock2Write(4, 0x7C, tx_buffer,
true);
323 for (i = 0; i < numBytes; i++)
326 if (!SPIWaitWriteEmpty())
332 if(!SPIWaitReadNotEmpty())
338 for (i = 0; i < numBytes; i++)
341 if(!SPIWaitReadNotEmpty())
344 data[i] = (uint8_t)val;
352 bool NTV2MetalE2E::WaitGenlock2 (uint32_t numMicrosSeconds)
354 uint32_t usTicks = 0;
355 uint32_t timeoutCount = 0;
358 while (usTicks < numMicrosSeconds)
360 usTicks = RegRead(0x3606);
365 void NTV2MetalE2E::SPIReset (
void)
375 void NTV2MetalE2E::SPIResetFIFOs (
void)
380 uint32_t NTV2MetalE2E::RegRead (uint32_t reg)
virtual bool SetReference(const NTV2ReferenceSource inRefSource, const bool inKeepFramePulseSelect=(0))
Sets the device's clock reference source. See Video Output Clocking & Synchronization for more inform...
virtual bool GetSDIInput3GPresent(bool &outValue, const NTV2Channel channel)
virtual bool SetVideoFormat(const NTV2VideoFormat inVideoFormat, const bool inIsAJARetail=(!(0)), const bool inKeepVancSettings=(0), const NTV2Channel inChannel=NTV2_CHANNEL1)
Configures the AJA device to handle a specific video format.
virtual bool SetSDIOut6GEnable(const NTV2Channel inChannel, const bool inEnable)
enum _NTV2VideoFormat NTV2VideoFormat
Identifies a particular video format.
#define AJA_FAILURE(_status_)
virtual bool ReadSDIInVPID(const NTV2Channel inSDIInput, ULWord &outValueA, ULWord &outValueB)
virtual bool SetSDIOutVPID(const ULWord inValueA, const ULWord inValueB, const UWord inOutputSpigot=NTV2_CHANNEL1)
virtual bool GetVPIDValidA(const NTV2Channel inChannel)
virtual bool Open(const UWord inDeviceIndex)
Opens a local/physical AJA device so it can be monitored/controlled.
virtual bool GetSDIInput12GPresent(bool &outValue, const NTV2Channel channel)
virtual bool ClearRouting(void)
Removes all existing signal path connections between any and all widgets on the AJA device...
virtual bool SetSDIOut3GEnable(const NTV2Channel inChannel, const bool inEnable)
NTV2Standard
Identifies a particular video standard.
NTV2DeviceID
Identifies a specific AJA NTV2 device model number. The NTV2DeviceID is actually the PROM part number...
virtual bool SetSDITransmitEnable(const NTV2Channel inChannel, const bool inEnable)
Sets the specified bidirectional SDI connector to act as an input or an output.
virtual NTV2VideoFormat GetInputVideoFormat(const NTV2InputSource inVideoSource=NTV2_INPUTSOURCE_SDI1, const bool inIsProgressive=(0))
Returns the video format of the signal that is present on the given input source. ...
Specifies channel or FrameStore 2 (or the 2nd item).
virtual NTV2DeviceID GetDeviceID(void)
Specifies the SDI In 1 connector.
virtual bool GetSDIInput6GPresent(bool &outValue, const NTV2Channel channel)
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...
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).
virtual CNTV2VPID & SetVPID(const ULWord inData)
virtual bool WriteRegister(const ULWord inRegNum, const ULWord inValue, const ULWord inMask=0xFFFFFFFF, const ULWord inShift=0)
Updates or replaces all or part of the 32-bit contents of a specific register (real or virtual) on th...
Specifies channel or FrameStore 1 (or the first item).
A convenience class that simplifies encoding or decoding the 4-byte VPID payload that can be read or ...
NTV2Standard GetNTV2StandardFromVideoFormat(const NTV2VideoFormat inVideoFormat)
virtual bool SetSDIOutputStandard(const UWord inOutputSpigot, const NTV2Standard inValue)
Sets the SDI output spigot's video standard.
Identifies the 1st SDI video input.
virtual bool SetSDIOut12GEnable(const NTV2Channel inChannel, const bool inEnable)
virtual bool IsValid(void) const
virtual bool EnableChannel(const NTV2Channel inChannel)
Enables the given FrameStore.