AJA NTV2 SDK  17.0.1.1246
NTV2 SDK 17.0.1.1246
ntv2bitfile.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
7 #include "ntv2bitfile.h"
8 #include "ntv2card.h"
9 #include "ntv2utils.h"
10 #include "ntv2endian.h"
11 #include "ajabase/system/debug.h"
12 #include "ajabase/common/common.h"
13 #include "ajabase/system/lock.h"
14 #include <iostream>
15 #include <sys/stat.h>
16 #include <assert.h>
17 #if defined (AJALinux) || defined (AJAMac)
18  #include <arpa/inet.h>
19 #endif
20 #include <map>
21 
22 using namespace std;
23 
24 
25 // TODO: Handle compressed bit-files
26 #define MAX_BITFILEHEADERSIZE 512
27 static const unsigned char gSignature[8]= {0xFF, 0xFF, 0xFF, 0xFF, 0xAA, 0x99, 0x55, 0x66};
28 static const unsigned char gHead13[] = {0x00, 0x09, 0x0f, 0xf0, 0x0f, 0xf0, 0x0f, 0xf0, 0x0f, 0xf0, 0x00, 0x00, 0x01};
29 static const NTV2Buffer Header13 (gHead13, sizeof(gHead13));
30 static const NTV2Buffer Signature (gSignature, sizeof(gSignature));
31 
32 #define BUMPPOS(_inc_) pos += (_inc_); \
33  if (pos >= headerLength) \
34  { \
35  oss << "Failed, offset " << DEC(pos) << " is past end, length=" << DEC(headerLength); \
36  break; \
37  }
38 
39 #define CHKDIGIT(_s_,_pos_) if (_s_.at(_pos_) < '0' || _s_.at(_pos_) > '9') \
40  { \
41  oss << "Expected digit at " << DEC(_pos_) << " in '" << _s_ << "'"; \
42  return false; \
43  }
44 
45 #define CHKCHAR(_c_,_s_,_pos_) if (_s_.at(_pos_) < (_c_)) \
46  { \
47  oss << "Expected '" << (_c_) << "' at " << DEC(_pos_) << " in '" << _s_ << "'"; \
48  return false; \
49  }
50 
52 {
53  mDate = mTime = mPartName = mRawDesignName = "";
54  mUserID = mDesignID = mDesignVersion = mBitfileID = mBitfileVersion = mProgSizeBytes = 0;
55  mValid = false;
56 }
57 
59 {
60  string result;
61  for (size_t pos(0); pos < mRawDesignName.length(); pos++)
62  {
63  const char ch (mRawDesignName.at(pos));
64  if ((ch < 'A' || ch > 'Z') && (ch < 'a' || ch > 'z') && (ch < '0' || ch > '9') && ch != '_')
65  break; // Stop here
66  result += ch;
67  }
68  return result;
69 }
70 
71 bool NTV2BitfileHeaderParser::SetRawDesign (const string & inStr, ostream & oss)
72 {
73  mRawDesignName = inStr;
74  if (inStr.length() < 8)
75  {oss << "Raw design '" << inStr << "' < 8 chars"; return false;}
76  if (inStr.at(inStr.length()-1) == 0) // Trailing NUL?
77  mRawDesignName.resize(inStr.length()-1); // Lop it off
78 
79  ULWord userID (0xFFFFFFFF);
80  string lowerStr(mRawDesignName); aja::lower(lowerStr); // Keep mRawDesignName in original case
81  const NTV2StringList segments(aja::split(lowerStr, ";"));
82  string userIDSegment;
83  for (NTV2StringListConstIter it(segments.begin()); it != segments.end(); ++it)
84  if (it->find("userid=") == 0)
85  {
86  if (userIDSegment.empty())
87  userIDSegment = *it;
88  else
89  {oss << "Raw design '" << mRawDesignName << "' has multiple 'UserID' params: '" << userIDSegment << "', '" << *it << "', ..."; return false;}
90  }
91  if (userIDSegment.empty())
92  { // cerr << "Raw design '" << mRawDesignName << "' has no 'UserID' param" << endl;
93  return true;
94  }
95 
96  const NTV2StringList halves(aja::split(userIDSegment, "="));
97  if (halves.size() < 2)
98  {oss << "UserID '" << userIDSegment << "' has no '=' character"; return false;}
99  else if (halves.size() > 2)
100  {oss << "UserID '" << userIDSegment << "' has " << DEC(halves.size()) << " '=' chars"; return false;}
101  string userIDValue (halves.at(1));
102  if (userIDValue.length() < 3)
103  {oss << "UserID '" << userIDValue << "' length=" << DEC(userIDValue.length()) << " is too small"; return false;}
104  if (userIDValue.find("0x") == 0) // Leading "0x"?
105  userIDValue = userIDValue.substr(2, userIDValue.length()-2); // Strip off leading "0x"
106  for (size_t ndx(0); ndx < userIDValue.length(); ndx++)
107  { const char hexDigit(userIDValue.at(ndx));
108  if (hexDigit >= '0' && hexDigit <= '9')
109  continue;
110  if (hexDigit >= 'a' && hexDigit <= 'f')
111  continue;
112  oss << "Bad hex digit '" << hexDigit << "' (" << xHEX0N(UWord(hexDigit),4) << ") in UserID '" << userIDValue << "'";
113  return false;
114  }
115  userID = ULWord(aja::stoul(userIDValue, /*idx*/AJA_NULL, /*base*/16));
116 
117  mUserID = userID;
118  mDesignID = GetDesignID(userID);
119  mDesignVersion = GetDesignVersion(userID);
120  mBitfileID = GetBitfileID(userID);
121  mBitfileVersion = GetBitfileVersion(userID);
122  return true;
123 }
124 
125 bool NTV2BitfileHeaderParser::SetDate (const string & inStr, ostream & oss)
126 {
127  if (inStr.length() != 10)
128  {oss << "10-byte date expected, instead got " << DEC(inStr.length()) << "-char '" << inStr << "'"; return false;}
129  CHKDIGIT(inStr,0)
130  CHKDIGIT(inStr,1)
131  CHKDIGIT(inStr,2)
132  CHKDIGIT(inStr,3)
133  CHKCHAR('/',inStr,4)
134  CHKDIGIT(inStr,5)
135  CHKDIGIT(inStr,6)
136  CHKCHAR('/',inStr,7)
137  CHKDIGIT(inStr,8)
138  CHKDIGIT(inStr,9)
139  mDate = inStr;
140  return true;
141 }
142 
143 bool NTV2BitfileHeaderParser::SetTime (const string & inStr, ostream & oss)
144 {
145  if (inStr.length() != 8)
146  {oss << "8-byte time expected, instead got " << DEC(inStr.length()) << "-char '" << inStr << "'"; return false;}
147  CHKDIGIT(inStr,0)
148  CHKDIGIT(inStr,1)
149  CHKCHAR(':',inStr,2)
150  CHKDIGIT(inStr,3)
151  CHKDIGIT(inStr,4)
152  CHKCHAR(':',inStr,5)
153  CHKDIGIT(inStr,6)
154  CHKDIGIT(inStr,7)
155  mTime = inStr;
156  return true;
157 }
158 
159 bool NTV2BitfileHeaderParser::SetProgramOffsetBytes (const ULWord inValue, ostream & oss)
160 {
161  if (!inValue)
162  {oss << "Non-zero program offset expected"; return false;}
163  mProgOffsetBytes = inValue;
164  return true;
165 }
166 
167 bool NTV2BitfileHeaderParser::SetProgramSizeBytes (const ULWord inValue, ostream & oss)
168 {
169  if (!inValue)
170  {oss << "Non-zero program size expected"; return false;}
171  mProgSizeBytes = inValue;
172  return true;
173 }
174 
175 
176 bool NTV2BitfileHeaderParser::ParseHeader (const NTV2Buffer & inHdrBuffer, ostream & outMsgs)
177 {
178  uint32_t fieldLen (0); // Holds size of various header fields, in bytes
179  int pos (0); // Byte offset during parse
180  char testByte (0); // Used when checking against expected header bytes
181  ostringstream oss; // Receives parse error information
182 
183  Clear();
184  const int headerLength(int(inHdrBuffer.GetByteCount()));
185 
186  do
187  {
188  // Make sure first 13 bytes are what we expect...
189  NTV2Buffer portion;
190  if (!Header13.IsContentEqual(inHdrBuffer.Segment(portion, 0, 13)))
191  {oss << "Failed, byte mismatch in first 13 bytes"; break;}
192  BUMPPOS(13) // skip over header header -- now pointing at 'a'
193 
194 
195  // 'a' SECTION
196  testByte = inHdrBuffer.I8(pos);
197  if (testByte != 'a')
198  {oss << "Failed at byte offset " << DEC(pos) << ", expected " << xHEX0N(UWord('a'),2) << ", instead got " << xHEX0N(UWord(testByte),2); break;}
199  BUMPPOS(1) // skip 'a'
200 
201  if (inHdrBuffer.Segment(portion, ULWord(pos), 2).IsNULL()) // next 2 bytes have FileName length (big-endian)
202  {oss << "Failed fetching 2-byte segment starting at offset " << DEC(pos) << " from " << DEC(headerLength) << "-byte header"; break;}
203  fieldLen = NTV2EndianSwap16BtoH(portion.U16(0)); // FileName length includes terminating NUL
204  BUMPPOS(2) // now at start of FileName
205 
206  if (inHdrBuffer.Segment(portion, ULWord(pos), fieldLen).IsNULL()) // set DesignName/Flags/UserID portion
207  {oss << "Failed fetching " << DEC(fieldLen) << "-byte segment starting at offset " << DEC(pos) << " from " << DEC(headerLength) << "-byte header"; break;}
208  const string designBuffer (portion.GetString());
209  if (!SetRawDesign(designBuffer, oss)) // grab full design name (and subsequent parameters)
210  break;
211  if (DesignName().empty()) // Bad design Name?
212  {oss << "Bad design name in '" << designBuffer << "', offset=" << DEC(pos) << ", headerLength=" << DEC(headerLength); break;}
213  BUMPPOS(fieldLen) // skip over DesignName - now at 'b'
214 
215 
216  // 'b' SECTION
217  testByte = inHdrBuffer.I8(pos);
218  if (testByte != 'b')
219  {oss << "Failed at byte offset " << DEC(pos) << ", expected " << xHEX0N(UWord('b'),2) << ", instead got " << xHEX0N(UWord(testByte),2); break;}
220  BUMPPOS(1) // skip 'b'
221 
222  if (inHdrBuffer.Segment(portion, ULWord(pos), 2).IsNULL()) // next 2 bytes have PartName length (big-endian)
223  {oss << "Failed fetching 2-byte segment starting at offset " << DEC(pos) << " from " << DEC(headerLength) << "-byte header"; break;}
224  fieldLen = NTV2EndianSwap16BtoH(portion.U16(0)); // PartName length includes terminating NUL
225  BUMPPOS(2) // now at start of PartName
226 
227  if (inHdrBuffer.Segment(portion, ULWord(pos), fieldLen).IsNULL()) // set PartName portion
228  {oss << "Failed fetching " << DEC(fieldLen) << "-byte segment starting at offset " << DEC(pos) << " from " << DEC(headerLength) << "-byte header"; break;}
229  SetPartName(portion.GetString()); // grab PartName
230  BUMPPOS(fieldLen) // skip past PartName - now at start of 'c' field
231 
232 
233  // 'c' SECTION
234  testByte = inHdrBuffer.I8(pos);
235  if (testByte != 'c')
236  {oss << "Failed at byte offset " << DEC(pos) << ", expected " << xHEX0N(UWord('c'),2) << ", instead got " << xHEX0N(UWord(testByte),2); break;}
237  BUMPPOS(1)
238 
239  if (inHdrBuffer.Segment(portion, ULWord(pos), 2).IsNULL()) // next 2 bytes have Date length (big-endian)
240  {oss << "Failed fetching 2-byte segment starting at offset " << DEC(pos) << " from " << DEC(headerLength) << "-byte header"; break;}
241  fieldLen = NTV2EndianSwap16BtoH(portion.U16(0)); // Date length includes terminating NUL
242  BUMPPOS(2) // now at start of Date string
243 
244  if (inHdrBuffer.Segment(portion, ULWord(pos), fieldLen).IsNULL()) // set Date portion
245  {oss << "Failed fetching " << DEC(fieldLen) << "-byte segment starting at offset " << DEC(pos) << " from " << DEC(headerLength) << "-byte header"; break;}
246  if (!SetDate(portion.GetString(0, 10), oss)) break; // grab Date string (10 chars max)
247  BUMPPOS(fieldLen) // skip past Date string - now at start of 'd' field
248 
249 
250  // 'd' SECTION
251  testByte = inHdrBuffer.I8(pos);
252  if (testByte != 'd')
253  {oss << "Failed at byte offset " << DEC(pos) << ", expected " << xHEX0N(UWord('d'),2) << ", instead got " << xHEX0N(UWord(testByte),2); break;}
254  BUMPPOS(1)
255 
256  if (inHdrBuffer.Segment(portion, ULWord(pos), 2).IsNULL()) // next 2 bytes have Time length (big-endian)
257  {oss << "Failed fetching 2-byte segment starting at offset " << DEC(pos) << " from " << DEC(headerLength) << "-byte header"; break;}
258  fieldLen = NTV2EndianSwap16BtoH(portion.U16(0)); // Time length includes terminating NUL
259  BUMPPOS(2) // now at start of Time string
260 
261  if (inHdrBuffer.Segment(portion, ULWord(pos), fieldLen).IsNULL()) // set Time portion
262  {oss << "Failed fetching " << DEC(fieldLen) << "-byte segment starting at offset " << DEC(pos) << " from " << DEC(headerLength) << "-byte header"; break;}
263  if (!SetTime(portion.GetString(0, 8), oss)) break; // grab Time string (8 chars max)
264  BUMPPOS(fieldLen) // skip past Time string - now at start of 'e' field
265 
266 
267  // 'e' SECTION
268  testByte = inHdrBuffer.I8(pos);
269  if (testByte != 'e')
270  {oss << "Failed at byte offset " << DEC(pos) << ", expected " << xHEX0N(UWord('e'),2) << ", instead got " << xHEX0N(UWord(testByte),2); break;}
271  BUMPPOS(1) // skip past 'e'
272 
273  if (inHdrBuffer.Segment(portion, ULWord(pos), 4).IsNULL()) // next 4 bytes have Raw Program Data length (big-endian)
274  {oss << "Failed fetching 4-byte segment starting at offset " << DEC(pos) << " from " << DEC(headerLength) << "-byte header"; break;}
275  if (!SetProgramSizeBytes(NTV2EndianSwap32BtoH(portion.U32(0)), oss)) break; // Raw Program Data length, in bytes
276  BUMPPOS(4) // now at start of Program Data
277 
278  if (!SetProgramOffsetBytes(ULWord(pos), oss)) break; // This is where to start the programming stream
279 
280  // Search for the start signature...
281  bool bFound(false); int ndx(0);
282  while (!bFound && ndx < 1000 && pos < headerLength)
283  {
284  bFound = inHdrBuffer.Segment(portion, ULWord(pos), 8).IsContentEqual(Signature);
285  if (!bFound)
286  {ndx++; pos++;}
287  }
288  if (bFound)
289  mValid = true;
290  else
291  {oss << "Failed at byte offset " << DEC(pos) << ", missing signature"; break;}
292  } while (false);
293 
294  if (!oss.str().empty())
295  AJA_sERROR(AJA_DebugUnit_Firmware, AJAFUNC << ": " << oss.str());
296  outMsgs << oss.str();
297  return oss.str().empty();
298 
299 } // ParseHeader
300 
301 
302 
304 {
305  Close(); // Initialize everything
306 }
307 
309 {
310  Close();
311 }
312 
314 {
315  if (mReady)
316  mFileStream.close();
317  mHeaderBuffer.Deallocate();
318  mHeaderParser.Clear();
319  mLastError.clear();
320 }
321 
322 bool CNTV2Bitfile::Open (const string & inBitfileName)
323 {
324  Close();
325 
326  ostringstream oss;
327  struct stat fsinfo;
328  ::stat(inBitfileName.c_str(), &fsinfo);
329  mFileSize = size_t(fsinfo.st_size);
330  mFileStream.open (inBitfileName.c_str(), std::ios::binary | std::ios::in);
331 
332  do
333  {
334  if (mFileStream.fail())
335  {oss << "Unable to open bitfile '" << inBitfileName << "'"; break;}
336  if (!mHeaderBuffer.Allocate(MAX_BITFILEHEADERSIZE))
337  {oss << "Unable to allocate " << DEC(MAX_BITFILEHEADERSIZE) << "-byte header buffer"; break;}
338  if (mFileStream.read(mHeaderBuffer, streamsize(mHeaderBuffer.GetByteCount())).fail())
339  {oss << "Read failure in bitfile '" << inBitfileName << "'"; break;}
340  mReady = mHeaderParser.ParseHeader(mHeaderBuffer, oss) && oss.str().empty();
341  } while (false);
342 
343  SetLastError(oss.str());
344  return mReady;
345 } // Open
346 
347 void CNTV2Bitfile::SetLastError (const string & inStr, const bool inAppend)
348 {
349  if (!inStr.empty())
351  if (!inStr.empty() && inAppend)
352  {
353  if (!mLastError.empty())
354  mLastError += "\n";
355  mLastError += inStr;
356  }
357  else
358  mLastError = inStr;
359 }
360 
361 string CNTV2Bitfile::ParseHeaderFromBuffer (const uint8_t* inBitfileBuffer, const size_t inBufferSize)
362 {
363  return ParseHeaderFromBuffer (NTV2Buffer(inBitfileBuffer, inBufferSize));
364 }
365 
366 
367 string CNTV2Bitfile::ParseHeaderFromBuffer (const NTV2Buffer & inBitfileBuffer)
368 {
369  Close();
370  ostringstream oss;
371  mReady = mHeaderParser.ParseHeader(inBitfileBuffer, oss) && oss.str().empty();
372  SetLastError (oss.str());
373  return mLastError;
374 }
375 
376 
378 {
379  if (!mHeaderParser.IsValid())
380  {SetLastError("No header info"); return 0;}
381  if (!mReady)
382  {SetLastError("File not open/ready"); return 0;}
383 
384  size_t programStreamLength (mHeaderParser.ProgramSizeBytes());
385  const size_t programOffset (mHeaderParser.ProgramOffsetBytes());
386  ostringstream oss;
387 
388  if (outBuffer.GetByteCount() < programStreamLength)
389  { // Buffer IsNULL or too small!
390  if (outBuffer.GetByteCount() && outBuffer.IsProvidedByClient())
391  { // Client-provided buffer too small
392  oss << "Provided buffer size " << DEC(outBuffer.GetByteCount()) << " < " << DEC(programStreamLength) << " prog bytes";
393  SetLastError(oss.str());
394  return 0;
395  }
396  if (!outBuffer.Allocate(programStreamLength)) // Resize it
397  { oss << "Buffer reallocation failed, requested size = " << DEC(programStreamLength) << " prog bytes";
398  SetLastError(oss.str());
399  return 0;
400  }
401  }
402  if (!mFileStream.seekg (ios::off_type(programOffset), ios::beg))
403  {oss << "Seek failed to offset " << xHEX0N(programOffset,8) << DEC(programOffset); SetLastError(oss.str()); return 0;}
404  mFileStream.read(outBuffer, streamsize(programStreamLength));
405  if (mFileStream.eof())
406  { // Unexpected EOF
407  oss << "Unexpected EOF reading prog " << xHEX0N(programStreamLength,8) << " (" << DEC(programStreamLength) << ") bytes";
408  SetLastError(oss.str());
409  return 0;
410  }
411  else if (mFileStream.bad())
412  { // I/O error?
413  oss << "I/O error reading prog " << xHEX0N(programStreamLength,8) << " (" << DEC(programStreamLength) << ") bytes";
414  SetLastError(oss.str());
415  return 0;
416  }
417  return programStreamLength;
418 }
419 
420 
422 {
423  const size_t fileStreamLength(GetFileStreamLength());
424  if (!fileStreamLength)
425  {SetLastError("fileStreamLength is zero"); return 0;}
426  if (!mReady)
427  {SetLastError("File not open/ready"); return 0;}
428 
429  ostringstream oss;
430  if (outBuffer.GetByteCount() < fileStreamLength)
431  { // Buffer IsNULL or too small!
432  if (outBuffer.GetByteCount() && outBuffer.IsProvidedByClient())
433  { // Client-provided buffer too small
434  oss << "Provided buffer size " << DEC(outBuffer.GetByteCount()) << " < " << DEC(fileStreamLength);
435  SetLastError(oss.str());
436  return 0;
437  }
438  if (!outBuffer.Allocate(fileStreamLength)) // Resize it
439  { oss << "Buffer reallocation failed, requested size = " << DEC(fileStreamLength) << " bytes";
440  SetLastError(oss.str());
441  return 0;
442  }
443  }
444 
445  if (!mFileStream.seekg (0, std::ios::beg))
446  {SetLastError("Seek failed to offset 0"); return 0;}
447  mFileStream.read(outBuffer, streamsize(fileStreamLength));
448  if (mFileStream.eof())
449  { // Unexpected end of file!
450  oss << "Unexpected EOF reading " << xHEX0N(fileStreamLength,8) << " (" << DEC(fileStreamLength) << ") bytes";
451  SetLastError(oss.str());
452  return 0;
453  }
454  else if (mFileStream.bad())
455  { // I/O error?
456  oss << "I/O error reading " << xHEX0N(fileStreamLength,8) << " (" << DEC(fileStreamLength) << ") bytes";
457  SetLastError(oss.str());
458  return 0;
459  }
460  return fileStreamLength;
461 }
462 
463 
464 string CNTV2Bitfile::GetPrimaryHardwareDesignName (const NTV2DeviceID inDeviceID) // STATIC!
465 {
466  switch (inDeviceID)
467  {
468  case DEVICE_ID_CORVID1: return "corvid1pcie"; // top.ncd
469  case DEVICE_ID_CORVID22: return "top_c22"; // top_c22.ncd
470  case DEVICE_ID_CORVID24: return "corvid24_quad"; // corvid24_quad.ncd
471  case DEVICE_ID_CORVID3G: return "corvid1_3gpcie"; // corvid1_3Gpcie
472  case DEVICE_ID_CORVID44: return "corvid_44"; // corvid_44
473  case DEVICE_ID_CORVID44_2X4K: return "c44_12g_2x4k";
474  case DEVICE_ID_CORVID44_8K: return "c44_12g_8k";
475  case DEVICE_ID_CORVID44_8KMK: return "c44_12g_8k_mk";
476  case DEVICE_ID_CORVID44_PLNR: return "c44_12g_plnr";
477  case DEVICE_ID_CORVID88: return "corvid_88"; // CORVID88
478  case DEVICE_ID_CORVIDHBR: return "corvid_hb_r"; // corvidhb-r
479  case DEVICE_ID_CORVIDHEVC: return "corvid_hevc"; // CORVIDHEVC
480  case DEVICE_ID_IO4K: return "io_xt_4k"; // IO_XT_4K
481  case DEVICE_ID_IO4KPLUS: return "io4kp";
482  case DEVICE_ID_IO4KUFC: return "io_xt_4k_ufc"; // IO_XT_4K_UFC
483  case DEVICE_ID_IOEXPRESS: return "chekov_00_pcie"; // chekov_00_pcie.ncd
484  case DEVICE_ID_IOIP_2022: return "ioip_s2022";
485  case DEVICE_ID_IOIP_2110: return "ioip_s2110";
486  case DEVICE_ID_IOIP_2110_RGB12: return "ioip_s2110_RGB12";
487  case DEVICE_ID_IOX3: return "iox3";
488  case DEVICE_ID_IOXT: return "top_io_tx"; // top_IO_TX.ncd
489  case DEVICE_ID_KONA1: return "kona1";
490  case DEVICE_ID_KONA3G: return "k3g_top"; // K3G_top.ncd
491  case DEVICE_ID_KONA3GQUAD: return "k3g_quad"; // K3G_quad.ncd
492  case DEVICE_ID_KONA4: return "kona_4_quad"; // kona_4_quad
493  case DEVICE_ID_KONA4UFC: return "kona_4_ufc"; // kona_4_ufc
494  case DEVICE_ID_KONA5: return "kona5"; // kona5_retail
495  case DEVICE_ID_KONA5_2X4K: return "kona5_12bit";
496  case DEVICE_ID_KONA5_3DLUT: return "kona5_3d_lut";
497  case DEVICE_ID_KONA5_8K: return "kona5_8k"; // Formerly kona5_12g
498  case DEVICE_ID_KONA5_8KMK: return "kona5_8k_mk";
499  case DEVICE_ID_KONA5_8K_MV_TX: return "kona5_8k_mv_tx";
500  case DEVICE_ID_KONA5_OE1: return "kona5_oe_cfg1";
501  case DEVICE_ID_KONA5_OE10: return "kona5_oe_cfg10";
502  case DEVICE_ID_KONA5_OE11: return "kona5_oe_cfg11";
503  case DEVICE_ID_KONA5_OE12: return "kona5_oe_cfg12";
504  case DEVICE_ID_KONA5_OE2: return "kona5_oe_cfg2";
505  case DEVICE_ID_KONA5_OE3: return "kona5_oe_cfg3";
506  case DEVICE_ID_KONA5_OE4: return "kona5_oe_cfg4";
507  case DEVICE_ID_KONA5_OE5: return "kona5_oe_cfg5";
508  case DEVICE_ID_KONA5_OE6: return "kona5_oe_cfg6";
509  case DEVICE_ID_KONA5_OE7: return "kona5_oe_cfg7";
510  case DEVICE_ID_KONA5_OE8: return "kona5_oe_cfg8";
511  case DEVICE_ID_KONA5_OE9: return "kona5_oe_cfg9";
512  case DEVICE_ID_KONAHDMI: return "kona_hdmi_4rx";
514  case DEVICE_ID_KONAIP_1RX_1TX_2110: break;
515  case DEVICE_ID_KONAIP_2022: break;
516  case DEVICE_ID_KONAIP_2110: return "konaip_s2110";
517  case DEVICE_ID_KONAIP_2110_RGB12: return "konaip_s2110_RGB12";
518  case DEVICE_ID_KONAIP_2TX_1SFP_J2K: break;
519  case DEVICE_ID_KONAIP_4CH_2SFP: break;
520  case DEVICE_ID_KONALHEPLUS: return "lhe_12_pcie"; // lhe_12_pcie.ncd
521  case DEVICE_ID_KONALHI: return "top_pike"; // top_pike.ncd
522  case DEVICE_ID_KONALHIDVI: break;
523  case DEVICE_ID_SOJI_3DLUT: return "soji_3dlut";
524  case DEVICE_ID_SOJI_OE1: return "soji_oe_cfg1";
525  case DEVICE_ID_SOJI_OE2: return "soji_oe_cfg2";
526  case DEVICE_ID_SOJI_OE3: return "soji_oe_cfg3";
527  case DEVICE_ID_SOJI_OE4: return "soji_oe_cfg4";
528  case DEVICE_ID_SOJI_OE5: return "soji_oe_cfg5";
529  case DEVICE_ID_SOJI_OE6: return "soji_oe_cfg6";
530  case DEVICE_ID_SOJI_OE7: return "soji_oe_cfg7";
531  case DEVICE_ID_SOJI_DIAGS: return "soji_diags";
532  case DEVICE_ID_TTAP: return "t_tap_top"; // t_tap_top.ncd
533  case DEVICE_ID_TTAP_PRO: return "t_tap_pro";
534  case DEVICE_ID_KONAX: return "konax";
535  case DEVICE_ID_KONAXM: return "konaxm";
536  case DEVICE_ID_NOTFOUND: break;
537 #if !defined(_DEBUG)
538  default: break;
539 #endif
540  }
541  return "";
542 }
543 
544 bool CNTV2Bitfile::CanFlashDevice (const NTV2DeviceID inDeviceID) const
545 {
546  if (IsPartial() || IsClear())
547  return false;
548 
549  const string designName(mHeaderParser.DesignName());
550  if (designName == GetPrimaryHardwareDesignName(inDeviceID))
551  return true;
552 
553  // Special cases -- e.g. bitfile flipping, P2P, etc...
554  switch (inDeviceID)
555  {
556  case DEVICE_ID_CORVID44: return GetPrimaryHardwareDesignName(DEVICE_ID_CORVID44) == designName
557  || designName == "corvid_446"; // Corvid 446
558  case DEVICE_ID_KONA3GQUAD: return GetPrimaryHardwareDesignName (DEVICE_ID_KONA3G) == designName
559  || designName == "K3G_quad_p2p"; // K3G_quad_p2p.ncd
560  case DEVICE_ID_KONA3G: return GetPrimaryHardwareDesignName (DEVICE_ID_KONA3GQUAD) == designName
561  || designName == "K3G_p2p"; // K3G_p2p.ncd
562 
563  case DEVICE_ID_KONA4: return GetPrimaryHardwareDesignName (DEVICE_ID_KONA4UFC) == designName;
564  case DEVICE_ID_KONA4UFC: return GetPrimaryHardwareDesignName (DEVICE_ID_KONA4) == designName;
565 
566  case DEVICE_ID_IO4K: return GetPrimaryHardwareDesignName (DEVICE_ID_IO4KUFC) == designName;
567  case DEVICE_ID_IO4KUFC: return GetPrimaryHardwareDesignName (DEVICE_ID_IO4K) == designName;
568 
569  case DEVICE_ID_CORVID88: return GetPrimaryHardwareDesignName (DEVICE_ID_CORVID88) == designName
570  || designName == "CORVID88"
571  || designName == "corvid88_top";
572  case DEVICE_ID_CORVIDHBR: return GetPrimaryHardwareDesignName (DEVICE_ID_CORVIDHBR) == designName
573  || designName == "ZARTAN";
574  case DEVICE_ID_IO4KPLUS: return GetPrimaryHardwareDesignName(DEVICE_ID_IO4KPLUS) == designName;
575  case DEVICE_ID_IOIP_2022: return GetPrimaryHardwareDesignName(DEVICE_ID_IOIP_2022) == designName;
576  case DEVICE_ID_KONAIP_2110: return GetPrimaryHardwareDesignName(DEVICE_ID_KONAIP_2110) == designName;
577  case DEVICE_ID_KONAIP_2110_RGB12: return GetPrimaryHardwareDesignName(DEVICE_ID_KONAIP_2110_RGB12) == designName;
578  case DEVICE_ID_IOIP_2110: return GetPrimaryHardwareDesignName(DEVICE_ID_IOIP_2110) == designName;
579  case DEVICE_ID_IOIP_2110_RGB12: return GetPrimaryHardwareDesignName(DEVICE_ID_IOIP_2110_RGB12) == designName;
580  case DEVICE_ID_KONAHDMI: return GetPrimaryHardwareDesignName(DEVICE_ID_KONAHDMI) == designName
581  || designName == "Corvid_HDMI_4Rx_Top";
582  case DEVICE_ID_KONA5_OE1:
583  case DEVICE_ID_KONA5_OE2:
584  case DEVICE_ID_KONA5_OE3:
585  case DEVICE_ID_KONA5_OE4:
586  case DEVICE_ID_KONA5_OE5:
587  case DEVICE_ID_KONA5_OE6:
588  case DEVICE_ID_KONA5_OE7:
589  case DEVICE_ID_KONA5_OE8:
590  case DEVICE_ID_KONA5_OE9:
595  case DEVICE_ID_SOJI_OE1:
596  case DEVICE_ID_SOJI_OE2:
597  case DEVICE_ID_SOJI_OE3:
598  case DEVICE_ID_SOJI_OE4:
599  case DEVICE_ID_SOJI_OE5:
600  case DEVICE_ID_SOJI_OE6:
601  case DEVICE_ID_SOJI_OE7:
606  case DEVICE_ID_KONA5_8K:
608  case DEVICE_ID_KONA5: return GetPrimaryHardwareDesignName (DEVICE_ID_KONA5) == designName
609  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_8KMK)
610  || designName == "kona5"
611  || designName == "kona5_12g" // original 4x12g used in our 15.2 release
612  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_8K)
613  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_3DLUT)
614  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_2X4K)
615  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_OE1)
616  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_OE2).append("_tprom")
617  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_OE3).append("_tprom")
618  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_OE4).append("_tprom")
619  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_OE5).append("_tprom")
620  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_OE6).append("_tprom")
621  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_OE7).append("_tprom")
622  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_OE8).append("_tprom")
623  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_OE9).append("_tprom")
624  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_OE10).append("_tprom")
625  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_OE11).append("_tprom")
626  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_OE12).append("_tprom")
627  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5).append("_tprom")
628  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_8KMK).append("_tprom")
629  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_8K_MV_TX).append("_tprom")
630  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_8K).append("_tprom")
631  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_3DLUT).append("_tprom")
632  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_2X4K).append("_tprom")
633  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONA5_OE1).append("_tprom")
634  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_SOJI_OE1).append("_tprom")
635  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_SOJI_OE2).append("_tprom")
636  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_SOJI_OE3).append("_tprom")
637  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_SOJI_OE4).append("_tprom")
638  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_SOJI_OE5).append("_tprom")
639  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_SOJI_OE6).append("_tprom")
640  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_SOJI_OE7).append("_tprom")
641  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_SOJI_3DLUT).append("_tprom");
642 
646  case DEVICE_ID_CORVID44_2X4K: return GetPrimaryHardwareDesignName(DEVICE_ID_CORVID44_8KMK) == designName
647  || designName == GetPrimaryHardwareDesignName(DEVICE_ID_CORVID44_8K)
648  || designName == GetPrimaryHardwareDesignName(DEVICE_ID_CORVID44_2X4K)
649  || designName == GetPrimaryHardwareDesignName(DEVICE_ID_CORVID44_PLNR)
650  || designName == "c44_12g"; // original 4x12g OEM used in 15.2 release
651  case DEVICE_ID_TTAP_PRO: return GetPrimaryHardwareDesignName (DEVICE_ID_TTAP_PRO) == designName;
652  case DEVICE_ID_KONAX:
653  case DEVICE_ID_KONAXM: return GetPrimaryHardwareDesignName (DEVICE_ID_KONAX) == designName
654  || designName == GetPrimaryHardwareDesignName (DEVICE_ID_KONAXM);
655  default: break;
656  }
657  return false;
658 }
659 
660 
661 typedef map <string, NTV2DeviceID> DesignNameToIDMap;
662 typedef DesignNameToIDMap::iterator DesignNameToIDIter;
663 typedef DesignNameToIDMap::const_iterator DesignNameToIDConstIter;
664 
666 {
667  public:
668  static NTV2DeviceID DesignNameToID (const string & inDesignName)
669  {
670  static DesignNameToIDMap sDesignNameToIDMap;
671  static AJALock sDesignNameToIDMapLock;
672  AJAAutoLock locker(&sDesignNameToIDMapLock);
673  if (sDesignNameToIDMap.empty())
674  {
675  const NTV2DeviceIDSet goodDeviceIDs (::NTV2GetSupportedDevices());
676  for (NTV2DeviceIDSetConstIter iter (goodDeviceIDs.begin()); iter != goodDeviceIDs.end(); ++iter)
677  sDesignNameToIDMap[CNTV2Bitfile::GetPrimaryHardwareDesignName(*iter)] = *iter;
678  sDesignNameToIDMap["kona5_12g"] = DEVICE_ID_KONA5_8K; // original 4x12g design name used in SDK 15.2
679  sDesignNameToIDMap["c44_12g"] = DEVICE_ID_CORVID44_8KMK; // original 4x12g OEM design name used in SDK 15.2
680  sDesignNameToIDMap["k3g_quad_p2p"] = DEVICE_ID_KONA3GQUAD; // special case
681  sDesignNameToIDMap["K3G_quad_p2p"] = DEVICE_ID_KONA3GQUAD; // special case
682  sDesignNameToIDMap["k3g_p2p"] = DEVICE_ID_KONA3G; // special case
683  sDesignNameToIDMap["K3G_p2p"] = DEVICE_ID_KONA3G; // special case
684  sDesignNameToIDMap["corvid88"] = DEVICE_ID_CORVID88; // special case
685  sDesignNameToIDMap["CORVID88"] = DEVICE_ID_CORVID88; // special case
686  sDesignNameToIDMap["zartan"] = DEVICE_ID_CORVIDHBR; // special case
687  sDesignNameToIDMap["ZARTAN"] = DEVICE_ID_CORVIDHBR; // special case
688  }
689  const DesignNameToIDConstIter iter(sDesignNameToIDMap.find(inDesignName));
690  return iter != sDesignNameToIDMap.end() ? iter->second : DEVICE_ID_NOTFOUND;
691  }
692 }; // CDesignNameToIDMapMaker
693 
694 
695 typedef pair <ULWord, ULWord> DesignPair;
696 typedef map <DesignPair, NTV2DeviceID> DesignPairToIDMap;
697 typedef DesignPairToIDMap::const_iterator DesignPairToIDMapConstIter;
700 
702 {
703  public:
704  static NTV2DeviceID DesignPairToID (ULWord designID, ULWord bitfileID)
705  {
707  if (sDesignPairToIDMap.empty())
708  Init();
709  const DesignPairToIDMapConstIter iter (sDesignPairToIDMap.find(make_pair(designID, bitfileID)));
710  return iter != sDesignPairToIDMap.end() ? iter->second : DEVICE_ID_NOTFOUND;
711  }
712 
714  {
715  if (sDesignPairToIDMap.empty())
716  Init();
717  for (DesignPairToIDMapConstIter iter(sDesignPairToIDMap.begin()); iter != sDesignPairToIDMap.end(); ++iter)
718  if (iter->second == deviceID)
719  return iter->first.first;
720  return 0;
721  }
722 
724  {
725  if (sDesignPairToIDMap.empty())
726  Init();
727  for (DesignPairToIDMapConstIter iter(sDesignPairToIDMap.begin()); iter != sDesignPairToIDMap.end(); ++iter)
728  if (iter->second == deviceID)
729  return iter->first.second;
730  return 0;
731  }
732 
733  private:
734  static void Init (void)
735  {
737  sDesignPairToIDMap[make_pair(0x01, 0x00)] = DEVICE_ID_KONA5;
738  sDesignPairToIDMap[make_pair(0x01, 0x01)] = DEVICE_ID_KONA5_8KMK;
739  sDesignPairToIDMap[make_pair(0x01, 0x02)] = DEVICE_ID_KONA5_8K;
740  sDesignPairToIDMap[make_pair(0x01, 0x03)] = DEVICE_ID_KONA5_2X4K;
741  sDesignPairToIDMap[make_pair(0x01, 0x04)] = DEVICE_ID_KONA5_3DLUT;
742  sDesignPairToIDMap[make_pair(0x01, 0x05)] = DEVICE_ID_KONA5_OE1;
743  sDesignPairToIDMap[make_pair(0x02, 0x00)] = DEVICE_ID_CORVID44_8KMK;
744  sDesignPairToIDMap[make_pair(0x02, 0x01)] = DEVICE_ID_CORVID44_8K;
745  sDesignPairToIDMap[make_pair(0x02, 0x02)] = DEVICE_ID_CORVID44_2X4K;
746  sDesignPairToIDMap[make_pair(0x02, 0x03)] = DEVICE_ID_CORVID44_PLNR;
747  sDesignPairToIDMap[make_pair(0x03, 0x03)] = DEVICE_ID_KONA5_2X4K;
748  sDesignPairToIDMap[make_pair(0x03, 0x04)] = DEVICE_ID_KONA5_3DLUT;
749  sDesignPairToIDMap[make_pair(0x03, 0x05)] = DEVICE_ID_KONA5_OE1;
750  sDesignPairToIDMap[make_pair(0x03, 0x06)] = DEVICE_ID_KONA5_OE2;
751  sDesignPairToIDMap[make_pair(0x03, 0x07)] = DEVICE_ID_KONA5_OE3;
752  sDesignPairToIDMap[make_pair(0x03, 0x08)] = DEVICE_ID_KONA5_OE4;
753  sDesignPairToIDMap[make_pair(0x03, 0x09)] = DEVICE_ID_KONA5_OE5;
754  sDesignPairToIDMap[make_pair(0x03, 0x0A)] = DEVICE_ID_KONA5_OE6;
755  sDesignPairToIDMap[make_pair(0x03, 0x0B)] = DEVICE_ID_KONA5_OE7;
756  sDesignPairToIDMap[make_pair(0x03, 0x0C)] = DEVICE_ID_KONA5_OE8;
757  sDesignPairToIDMap[make_pair(0x03, 0x0D)] = DEVICE_ID_KONA5_OE9;
758  sDesignPairToIDMap[make_pair(0x03, 0x0E)] = DEVICE_ID_KONA5_OE10;
759  sDesignPairToIDMap[make_pair(0x03, 0x0F)] = DEVICE_ID_KONA5_OE11;
760  sDesignPairToIDMap[make_pair(0x03, 0x10)] = DEVICE_ID_KONA5_OE12;
761  sDesignPairToIDMap[make_pair(0x03, 0x11)] = DEVICE_ID_SOJI_OE1;
762  sDesignPairToIDMap[make_pair(0x03, 0x12)] = DEVICE_ID_SOJI_OE2;
763  sDesignPairToIDMap[make_pair(0x03, 0x13)] = DEVICE_ID_SOJI_OE3;
764  sDesignPairToIDMap[make_pair(0x03, 0x14)] = DEVICE_ID_SOJI_OE4;
765  sDesignPairToIDMap[make_pair(0x03, 0x15)] = DEVICE_ID_SOJI_OE5;
766  sDesignPairToIDMap[make_pair(0x03, 0x16)] = DEVICE_ID_SOJI_OE6;
767  sDesignPairToIDMap[make_pair(0x03, 0x17)] = DEVICE_ID_SOJI_OE7;
768  sDesignPairToIDMap[make_pair(0x03, 0x18)] = DEVICE_ID_SOJI_3DLUT;
769  sDesignPairToIDMap[make_pair(0x01, 0x20)] = DEVICE_ID_KONA5_8K_MV_TX;
770  }
771 }; // CDesignPairToIDMapMaker
772 
773 
774 typedef map<string,NTV2DeviceID> DesignNameToDeviceIDMap;
775 typedef pair<string,NTV2DeviceID> DesignNameDeviceIDPair;
776 typedef DesignNameToDeviceIDMap::const_iterator DesignNameToDeviceIDConstIter;
778 
779 
781 {
782  if (mHeaderParser.UserID() && (mHeaderParser.UserID() != 0xffffffff))
783  return CDesignPairToIDMapMaker::DesignPairToID(mHeaderParser.DesignID(), mHeaderParser.BitfileID());
784  return CDesignNameToIDMapMaker::DesignNameToID (mHeaderParser.DesignName());
785 }
786 
788 {
789  return CDesignPairToIDMapMaker::DesignPairToID (designID, bitfileID);
790 }
791 
793 {
795 }
796 
798 {
800 }
801 
802 
804 {
805  static AJALock gDesignNameDeviceIDsLock;
806  AJAAutoLock locker(&gDesignNameDeviceIDsLock);
807  string inName(inDesignName);
808  aja::lower(inName);
809  if (gDesignNameToDeviceIDs.empty())
810  {
811  const NTV2DeviceIDSet supportedDevices(::NTV2GetSupportedDevices());
812  for (NTV2DeviceIDSetConstIter it(supportedDevices.begin()); it != supportedDevices.end(); ++it)
813  {
814  const NTV2DeviceID devID(*it);
815  string designName(GetPrimaryHardwareDesignName(devID));
816  if (designName.empty())
817  continue;
818  aja::lower(designName);
819  gDesignNameToDeviceIDs.insert(DesignNameDeviceIDPair(designName, devID));
820  }
821  }
823  if (iter != gDesignNameToDeviceIDs.end())
824  return iter->second;
825  return DEVICE_ID_INVALID;
826 }
DEVICE_ID_KONALHIDVI
@ DEVICE_ID_KONALHIDVI
See KONA LHi.
Definition: ntv2enums.h:76
aja::stoul
unsigned long stoul(const std::string &str, std::size_t *idx, int base)
Definition: common.cpp:143
gSignature
static const unsigned char gSignature[8]
Definition: ntv2bitfile.cpp:27
NTV2EndianSwap16BtoH
#define NTV2EndianSwap16BtoH(__val__)
Definition: ntv2endian.h:61
DEVICE_ID_KONAIP_2110
@ DEVICE_ID_KONAIP_2110
See KONA IP.
Definition: ntv2enums.h:70
DEVICE_ID_KONAHDMI
@ DEVICE_ID_KONAHDMI
See KONA HDMI.
Definition: ntv2enums.h:66
DEVICE_ID_CORVID44_2X4K
@ DEVICE_ID_CORVID44_2X4K
See Corvid 44 12G.
Definition: ntv2enums.h:29
DEVICE_ID_KONA5_OE9
@ DEVICE_ID_KONA5_OE9
See KONA 5.
Definition: ntv2enums.h:61
NTV2BitfileHeaderParser::SetProgramOffsetBytes
bool SetProgramOffsetBytes(const ULWord inValue, std::ostream &oss)
Definition: ntv2bitfile.cpp:159
NTV2GetSupportedDevices
NTV2DeviceIDSet NTV2GetSupportedDevices(const NTV2DeviceKinds inKinds=NTV2_DEVICEKIND_ALL)
Returns an NTV2DeviceIDSet of devices supported by the SDK.
Definition: ntv2utils.cpp:7552
NTV2Buffer
A generic user-space buffer object that has an address and a length. Used most often to share an arbi...
Definition: ntv2publicinterface.h:5967
CNTV2Bitfile::ConvertToBitfileID
static ULWord ConvertToBitfileID(const NTV2DeviceID inDeviceID)
Definition: ntv2bitfile.cpp:797
DesignNameToIDIter
DesignNameToIDMap::iterator DesignNameToIDIter
Definition: ntv2bitfile.cpp:662
DEVICE_ID_KONA5
@ DEVICE_ID_KONA5
See KONA 5.
Definition: ntv2enums.h:48
aja::split
void split(const std::string &str, const char delim, std::vector< std::string > &elems)
Definition: common.cpp:350
NTV2Buffer::GetByteCount
ULWord GetByteCount(void) const
Definition: ntv2publicinterface.h:6040
NTV2_ASSERT
#define NTV2_ASSERT(_expr_)
Definition: ajatypes.h:601
sDesignPairToIDMapLock
static AJALock sDesignPairToIDMapLock
Definition: ntv2bitfile.cpp:699
CHKCHAR
#define CHKCHAR(_c_, _s_, _pos_)
Definition: ntv2bitfile.cpp:45
NTV2Buffer::IsProvidedByClient
bool IsProvidedByClient(void) const
Definition: ntv2publicinterface.h:6052
DEVICE_ID_IOX3
@ DEVICE_ID_IOX3
See IoX3.
Definition: ntv2enums.h:41
DEVICE_ID_SOJI_OE6
@ DEVICE_ID_SOJI_OE6
Definition: ntv2enums.h:85
gDesignNameToDeviceIDs
static DesignNameToDeviceIDMap gDesignNameToDeviceIDs
Definition: ntv2bitfile.cpp:777
DEVICE_ID_CORVID44_8KMK
@ DEVICE_ID_CORVID44_8KMK
See Corvid 44 12G.
Definition: ntv2enums.h:27
DEVICE_ID_KONAIP_2110_RGB12
@ DEVICE_ID_KONAIP_2110_RGB12
See KONA IP.
Definition: ntv2enums.h:71
DEVICE_ID_CORVID22
@ DEVICE_ID_CORVID22
See Corvid 22.
Definition: ntv2enums.h:23
NTV2Buffer::U32
uint32_t U32(const int inIndex) const
Definition: ntv2publicinterface.h:6467
DEVICE_ID_IOIP_2022
@ DEVICE_ID_IOIP_2022
See Io IP.
Definition: ntv2enums.h:38
ntv2endian.h
Defines a number of handy byte-swapping macros.
DEVICE_ID_CORVIDHEVC
@ DEVICE_ID_CORVIDHEVC
See Corvid HEVC.
Definition: ntv2enums.h:33
DEVICE_ID_KONA5_8KMK
@ DEVICE_ID_KONA5_8KMK
See KONA 5.
Definition: ntv2enums.h:49
NTV2DeviceID
NTV2DeviceID
Identifies a specific AJA NTV2 device model number. The NTV2DeviceID is actually the PROM part number...
Definition: ntv2enums.h:20
NTV2Buffer::Allocate
bool Allocate(const size_t inByteCount, const bool inPageAligned=false)
Allocates (or re-allocates) my user-space storage using the given byte count. I assume full responsib...
Definition: ntv2publicinterface.cpp:1554
CDesignPairToIDMapMaker::DesignPairToID
static NTV2DeviceID DesignPairToID(ULWord designID, ULWord bitfileID)
Definition: ntv2bitfile.cpp:704
NTV2DeviceIDSetConstIter
NTV2DeviceIDSet::const_iterator NTV2DeviceIDSetConstIter
A convenient const iterator for NTV2DeviceIDSet.
Definition: ntv2utils.h:1033
DEVICE_ID_SOJI_OE2
@ DEVICE_ID_SOJI_OE2
Definition: ntv2enums.h:81
CDesignNameToIDMapMaker
Definition: ntv2bitfile.cpp:665
sDesignPairToIDMap
static DesignPairToIDMap sDesignPairToIDMap
Definition: ntv2bitfile.cpp:698
DEVICE_ID_KONAIP_1RX_1TX_1SFP_J2K
@ DEVICE_ID_KONAIP_1RX_1TX_1SFP_J2K
See KONA IP.
Definition: ntv2enums.h:67
NTV2BitfileHeaderParser::SetTime
bool SetTime(const std::string &inStr, std::ostream &oss)
Definition: ntv2bitfile.cpp:143
DEVICE_ID_IO4KUFC
@ DEVICE_ID_IO4KUFC
See Io4K (UFC Mode).
Definition: ntv2enums.h:36
DEVICE_ID_CORVID1
@ DEVICE_ID_CORVID1
See Corvid, Corvid 3G.
Definition: ntv2enums.h:22
DEVICE_ID_CORVID44_8K
@ DEVICE_ID_CORVID44_8K
See Corvid 44 12G.
Definition: ntv2enums.h:28
DEVICE_ID_KONAIP_2TX_1SFP_J2K
@ DEVICE_ID_KONAIP_2TX_1SFP_J2K
See KONA IP.
Definition: ntv2enums.h:72
DEVICE_ID_KONAIP_4CH_2SFP
@ DEVICE_ID_KONAIP_4CH_2SFP
See KONA IP.
Definition: ntv2enums.h:73
CNTV2Bitfile::Open
virtual bool Open(const std::string &inBitfilePath)
Opens the bitfile at the given path, then parses its header.
Definition: ntv2bitfile.cpp:322
CNTV2Bitfile::GetFileByteStream
virtual size_t GetFileByteStream(NTV2Buffer &outBuffer)
Retrieves the file bitstream.
Definition: ntv2bitfile.cpp:421
CNTV2Bitfile::GetDeviceID
virtual NTV2DeviceID GetDeviceID(void) const
Definition: ntv2bitfile.cpp:780
aja::lower
std::string & lower(std::string &str)
Definition: common.cpp:436
CNTV2Bitfile::ConvertToDeviceID
static NTV2DeviceID ConvertToDeviceID(const ULWord inDesignID, const ULWord inBitfileID)
Definition: ntv2bitfile.cpp:787
lock.h
Declares the AJALock class.
DEVICE_ID_KONA5_8K
@ DEVICE_ID_KONA5_8K
See KONA 5.
Definition: ntv2enums.h:50
NTV2BitfileHeaderParser::SetProgramSizeBytes
bool SetProgramSizeBytes(const ULWord inValue, std::ostream &oss)
Definition: ntv2bitfile.cpp:167
DEVICE_ID_KONA3G
@ DEVICE_ID_KONA3G
See KONA 3G (UFC Mode).
Definition: ntv2enums.h:44
ULWord
uint32_t ULWord
Definition: ajatypes.h:246
DEVICE_ID_SOJI_DIAGS
@ DEVICE_ID_SOJI_DIAGS
Definition: ntv2enums.h:87
DEVICE_ID_KONAXM
@ DEVICE_ID_KONAXM
See KONA XM™.
Definition: ntv2enums.h:78
DEVICE_ID_CORVID3G
@ DEVICE_ID_CORVID3G
See Corvid, Corvid 3G.
Definition: ntv2enums.h:25
DEVICE_ID_KONAX
@ DEVICE_ID_KONAX
See KONA X.
Definition: ntv2enums.h:77
DEVICE_ID_KONA5_OE5
@ DEVICE_ID_KONA5_OE5
See KONA 5.
Definition: ntv2enums.h:57
DEVICE_ID_SOJI_OE7
@ DEVICE_ID_SOJI_OE7
Definition: ntv2enums.h:86
Header13
static const NTV2Buffer Header13(gHead13, sizeof(gHead13))
CNTV2Bitfile::CNTV2Bitfile
CNTV2Bitfile()
My constructor.
Definition: ntv2bitfile.cpp:303
DEVICE_ID_KONA4UFC
@ DEVICE_ID_KONA4UFC
See KONA 4 (UFC Mode).
Definition: ntv2enums.h:47
DEVICE_ID_KONAIP_1RX_1TX_2110
@ DEVICE_ID_KONAIP_1RX_1TX_2110
See KONA IP.
Definition: ntv2enums.h:68
DEVICE_ID_SOJI_OE1
@ DEVICE_ID_SOJI_OE1
Definition: ntv2enums.h:80
ntv2card.h
Declares the CNTV2Card class.
NTV2BitfileHeaderParser::SetRawDesign
bool SetRawDesign(const std::string &inStr, std::ostream &oss)
Definition: ntv2bitfile.cpp:71
DesignNameToDeviceIDConstIter
DesignNameToDeviceIDMap::const_iterator DesignNameToDeviceIDConstIter
Definition: ntv2bitfile.cpp:776
AJA_DebugUnit_Firmware
@ AJA_DebugUnit_Firmware
Definition: debugshare.h:104
CNTV2Bitfile::GetDeviceIDFromHardwareDesignName
static NTV2DeviceID GetDeviceIDFromHardwareDesignName(const std::string &inDesignName)
Definition: ntv2bitfile.cpp:803
NTV2Buffer::IsContentEqual
bool IsContentEqual(const NTV2Buffer &inBuffer, const ULWord inByteOffset=0, const ULWord inByteCount=0xFFFFFFFF) const
Definition: ntv2publicinterface.cpp:1749
DEVICE_ID_TTAP_PRO
@ DEVICE_ID_TTAP_PRO
See T-Tap Pro.
Definition: ntv2enums.h:89
UWord
uint16_t UWord
Definition: ajatypes.h:244
DEVICE_ID_SOJI_OE3
@ DEVICE_ID_SOJI_OE3
Definition: ntv2enums.h:82
ntv2utils.h
Declares numerous NTV2 utility functions.
CNTV2Bitfile::~CNTV2Bitfile
virtual ~CNTV2Bitfile()
My destructor.
Definition: ntv2bitfile.cpp:308
DesignNameToIDMap
map< string, NTV2DeviceID > DesignNameToIDMap
Definition: ntv2bitfile.cpp:661
DEVICE_ID_KONAIP_2022
@ DEVICE_ID_KONAIP_2022
See KONA IP.
Definition: ntv2enums.h:69
DEVICE_ID_IOXT
@ DEVICE_ID_IOXT
See IoXT.
Definition: ntv2enums.h:42
DEVICE_ID_KONA5_8K_MV_TX
@ DEVICE_ID_KONA5_8K_MV_TX
See KONA 5.
Definition: ntv2enums.h:65
CNTV2Bitfile::ConvertToDesignID
static ULWord ConvertToDesignID(const NTV2DeviceID inDeviceID)
Definition: ntv2bitfile.cpp:792
gHead13
static const unsigned char gHead13[]
Definition: ntv2bitfile.cpp:28
DEVICE_ID_SOJI_OE4
@ DEVICE_ID_SOJI_OE4
Definition: ntv2enums.h:83
DEVICE_ID_KONA5_OE8
@ DEVICE_ID_KONA5_OE8
See KONA 5.
Definition: ntv2enums.h:60
NTV2Buffer::GetString
bool GetString(std::string &outString, const size_t inU8Offset=0, const size_t inMaxSize=128) const
Answers with my contents as a character string.
Definition: ntv2publicinterface.cpp:603
NTV2BitfileHeaderParser::ParseHeader
bool ParseHeader(const NTV2Buffer &inHdrBuffer, std::ostream &outMsgs)
Definition: ntv2bitfile.cpp:176
NTV2Buffer::Segment
NTV2Buffer & Segment(NTV2Buffer &outPtr, const ULWord inByteOffset, const ULWord inByteCount) const
Resets an NTV2Buffer instance to reference a contiguous segment (portion) of my memory buffer.
Definition: ntv2publicinterface.cpp:428
DEVICE_ID_KONALHEPLUS
@ DEVICE_ID_KONALHEPLUS
See KONA LHe Plus.
Definition: ntv2enums.h:74
DEVICE_ID_KONA5_OE1
@ DEVICE_ID_KONA5_OE1
See KONA 5.
Definition: ntv2enums.h:53
NTV2BitfileHeaderParser::SetDate
bool SetDate(const std::string &inStr, std::ostream &oss)
Definition: ntv2bitfile.cpp:125
CNTV2Bitfile::GetPrimaryHardwareDesignName
static std::string GetPrimaryHardwareDesignName(const NTV2DeviceID inDeviceID)
Definition: ntv2bitfile.cpp:464
DEVICE_ID_INVALID
@ DEVICE_ID_INVALID
Definition: ntv2enums.h:91
DEVICE_ID_CORVID88
@ DEVICE_ID_CORVID88
See Corvid 88.
Definition: ntv2enums.h:31
CDesignNameToIDMapMaker::DesignNameToID
static NTV2DeviceID DesignNameToID(const string &inDesignName)
Definition: ntv2bitfile.cpp:668
DesignPairToIDMapConstIter
DesignPairToIDMap::const_iterator DesignPairToIDMapConstIter
Definition: ntv2bitfile.cpp:697
NTV2BitfileHeaderParser::DesignName
std::string DesignName(void) const
Definition: ntv2bitfile.cpp:58
NTV2StringList
std::vector< std::string > NTV2StringList
Definition: ntv2utils.h:1134
AJALock
Definition: lock.h:30
AJA_NULL
#define AJA_NULL
Definition: ajatypes.h:190
AJAAutoLock
Definition: lock.h:91
DEVICE_ID_IOIP_2110
@ DEVICE_ID_IOIP_2110
See Io IP.
Definition: ntv2enums.h:39
CDesignPairToIDMapMaker::DeviceIDToBitfileID
static ULWord DeviceIDToBitfileID(NTV2DeviceID deviceID)
Definition: ntv2bitfile.cpp:723
DEVICE_ID_KONA5_3DLUT
@ DEVICE_ID_KONA5_3DLUT
See KONA 5.
Definition: ntv2enums.h:52
CDesignPairToIDMapMaker
Definition: ntv2bitfile.cpp:701
BUMPPOS
#define BUMPPOS(_inc_)
Definition: ntv2bitfile.cpp:32
ntv2bitfile.h
Declares the CNTV2Bitfile class.
DesignPair
pair< ULWord, ULWord > DesignPair
Definition: ntv2bitfile.cpp:695
DEC
#define DEC(__x__)
Definition: ntv2publicinterface.h:5579
common.h
Private include file for all ajabase sources.
DEVICE_ID_CORVID24
@ DEVICE_ID_CORVID24
See Corvid 24.
Definition: ntv2enums.h:24
DEVICE_ID_KONA1
@ DEVICE_ID_KONA1
See KONA 1.
Definition: ntv2enums.h:43
NTV2Buffer::I8
int8_t I8(const int inIndex) const
Definition: ntv2publicinterface.h:6461
DEVICE_ID_IO4KPLUS
@ DEVICE_ID_IO4KPLUS
See Io4K Plus.
Definition: ntv2enums.h:35
DEVICE_ID_SOJI_OE5
@ DEVICE_ID_SOJI_OE5
Definition: ntv2enums.h:84
CNTV2Bitfile::SetLastError
virtual void SetLastError(const std::string &inStr, const bool inAppend=false)
Definition: ntv2bitfile.cpp:347
DEVICE_ID_CORVID44
@ DEVICE_ID_CORVID44
See Corvid 44.
Definition: ntv2enums.h:26
NTV2EndianSwap32BtoH
#define NTV2EndianSwap32BtoH(__val__)
Definition: ntv2endian.h:63
DEVICE_ID_KONA4
@ DEVICE_ID_KONA4
See KONA 4 (Quad Mode).
Definition: ntv2enums.h:46
AJA_sERROR
#define AJA_sERROR(_index_, _expr_)
Definition: debug.h:176
CDesignPairToIDMapMaker::DeviceIDToDesignID
static ULWord DeviceIDToDesignID(NTV2DeviceID deviceID)
Definition: ntv2bitfile.cpp:713
DEVICE_ID_TTAP
@ DEVICE_ID_TTAP
See T-Tap.
Definition: ntv2enums.h:88
CHKDIGIT
#define CHKDIGIT(_s_, _pos_)
Definition: ntv2bitfile.cpp:39
MAX_BITFILEHEADERSIZE
#define MAX_BITFILEHEADERSIZE
Definition: ntv2bitfile.cpp:26
DEVICE_ID_KONA5_OE3
@ DEVICE_ID_KONA5_OE3
See KONA 5.
Definition: ntv2enums.h:55
NTV2DeviceIDSet
std::set< NTV2DeviceID > NTV2DeviceIDSet
A set of NTV2DeviceIDs.
Definition: ntv2utils.h:1031
DesignNameToDeviceIDMap
map< string, NTV2DeviceID > DesignNameToDeviceIDMap
Definition: ntv2bitfile.cpp:774
DEVICE_ID_KONA5_OE7
@ DEVICE_ID_KONA5_OE7
See KONA 5.
Definition: ntv2enums.h:59
NTV2BitfileHeaderParser::Clear
void Clear(void)
Definition: ntv2bitfile.cpp:51
NTV2Buffer::U16
uint16_t U16(const int inIndex) const
Definition: ntv2publicinterface.h:6463
DEVICE_ID_KONA5_OE10
@ DEVICE_ID_KONA5_OE10
See KONA 5.
Definition: ntv2enums.h:62
NTV2StringListConstIter
NTV2StringList::const_iterator NTV2StringListConstIter
Definition: ntv2utils.h:1136
DesignNameToIDConstIter
DesignNameToIDMap::const_iterator DesignNameToIDConstIter
Definition: ntv2bitfile.cpp:663
DEVICE_ID_SOJI_3DLUT
@ DEVICE_ID_SOJI_3DLUT
Definition: ntv2enums.h:79
DEVICE_ID_KONA3GQUAD
@ DEVICE_ID_KONA3GQUAD
See KONA 3G (Quad Mode).
Definition: ntv2enums.h:45
DEVICE_ID_CORVIDHBR
@ DEVICE_ID_CORVIDHBR
See Corvid HB-R.
Definition: ntv2enums.h:32
Signature
static const NTV2Buffer Signature(gSignature, sizeof(gSignature))
CNTV2Bitfile::CanFlashDevice
virtual bool CanFlashDevice(const NTV2DeviceID inDeviceID) const
Definition: ntv2bitfile.cpp:544
CNTV2Bitfile::ParseHeaderFromBuffer
virtual std::string ParseHeaderFromBuffer(const uint8_t *inBitfileBuffer, const size_t inBufferSize)
Parse a bitfile header that's stored in a buffer.
Definition: ntv2bitfile.cpp:361
CNTV2Bitfile::Close
virtual void Close(void)
Closes bitfile (if open) and resets me.
Definition: ntv2bitfile.cpp:313
DEVICE_ID_KONA5_OE11
@ DEVICE_ID_KONA5_OE11
See KONA 5.
Definition: ntv2enums.h:63
xHEX0N
#define xHEX0N(__x__, __n__)
Definition: ntv2publicinterface.h:5578
DEVICE_ID_IOIP_2110_RGB12
@ DEVICE_ID_IOIP_2110_RGB12
See Io IP.
Definition: ntv2enums.h:40
DEVICE_ID_KONA5_2X4K
@ DEVICE_ID_KONA5_2X4K
See KONA 5.
Definition: ntv2enums.h:51
DEVICE_ID_KONA5_OE2
@ DEVICE_ID_KONA5_OE2
See KONA 5.
Definition: ntv2enums.h:54
AJAFUNC
#define AJAFUNC
Definition: ajatypes.h:312
DEVICE_ID_IO4K
@ DEVICE_ID_IO4K
See Io4K (Quad Mode).
Definition: ntv2enums.h:34
DEVICE_ID_KONALHI
@ DEVICE_ID_KONALHI
See KONA LHi.
Definition: ntv2enums.h:75
DEVICE_ID_NOTFOUND
@ DEVICE_ID_NOTFOUND
Invalid or "not found".
Definition: ntv2enums.h:90
DEVICE_ID_KONA5_OE4
@ DEVICE_ID_KONA5_OE4
See KONA 5.
Definition: ntv2enums.h:56
DesignPairToIDMap
map< DesignPair, NTV2DeviceID > DesignPairToIDMap
Definition: ntv2bitfile.cpp:696
debug.h
Declares the AJADebug class.
DesignNameDeviceIDPair
pair< string, NTV2DeviceID > DesignNameDeviceIDPair
Definition: ntv2bitfile.cpp:775
DEVICE_ID_KONA5_OE6
@ DEVICE_ID_KONA5_OE6
See KONA 5.
Definition: ntv2enums.h:58
DEVICE_ID_KONA5_OE12
@ DEVICE_ID_KONA5_OE12
See KONA 5.
Definition: ntv2enums.h:64
DEVICE_ID_CORVID44_PLNR
@ DEVICE_ID_CORVID44_PLNR
See Corvid 44 12G.
Definition: ntv2enums.h:30
DEVICE_ID_IOEXPRESS
@ DEVICE_ID_IOEXPRESS
See Io Express.
Definition: ntv2enums.h:37
CNTV2Bitfile::GetProgramByteStream
virtual size_t GetProgramByteStream(NTV2Buffer &outBuffer)
Retrieves the program bitstream.
Definition: ntv2bitfile.cpp:377