|
AJA NTV2 SDK
17.1.3.1410
NTV2 SDK 17.1.3.1410
|
Go to the documentation of this file.
15 #if defined (AJALinux) || defined (AJAMac)
16 #include <arpa/inet.h>
22 #define BFMFAIL(__x__) AJA_sERROR (AJA_DebugUnit_Firmware, AJAFUNC << ": " << __x__)
23 #define BFMWARN(__x__) AJA_sWARNING(AJA_DebugUnit_Firmware, AJAFUNC << ": " << __x__)
24 #define BFMNOTE(__x__) AJA_sNOTICE (AJA_DebugUnit_Firmware, AJAFUNC << ": " << __x__)
25 #define BFMINFO(__x__) AJA_sINFO (AJA_DebugUnit_Firmware, AJAFUNC << ": " << __x__)
26 #define BFMDBG(__x__) AJA_sDEBUG (AJA_DebugUnit_Firmware, AJAFUNC << ": " << __x__)
46 {
BFMFAIL(
"Bitfile path '" << inBitfilePath <<
"' not found");
return false;}
47 if (!Bitfile.
Open(inBitfilePath))
48 {
BFMFAIL(
"Bitfile '" << inBitfilePath <<
"' failed to open");
return false;}
69 {
BFMFAIL(
"Invalid design ID " <<
xHEX0N(Info.
designID,8) <<
" for bitfile '" << inBitfilePath <<
"'");
return false;}
71 {
BFMFAIL(
"Invalid design version " <<
xHEX0N(Info.
designVersion,8) <<
" for bitfile '" << inBitfilePath <<
"'");
return false;}
73 {
BFMFAIL(
"Invalid bitfile ID " <<
xHEX0N(Info.
bitfileID,8) <<
" for bitfile '" << inBitfilePath <<
"'");
return false;}
77 {
BFMFAIL(
"No flags set for bitfile '" << inBitfilePath <<
"'");
return false;}
79 {
BFMFAIL(
"Device ID is zero for bitfile '" << inBitfilePath <<
"'");
return false;}
82 _bitfileList.push_back(Info);
83 BFMNOTE(
"Bitfile '" << inBitfilePath <<
"' successfully added to bitfile manager");
93 {
BFMFAIL(
"Bitfile directory '" << inDirectory <<
"' not found");
return false;}
98 {
BFMFAIL(
"ReadDirectory '" << inDirectory <<
"' failed");
return false;}
101 const size_t origNum(_bitfileList.size());
104 BFMNOTE(
DEC(_bitfileList.size() - origNum) <<
" bitfile(s) added from directory '" << inDirectory <<
"'");
111 if (!_bitfileList.empty() || !_bitstreamList.empty())
112 BFMNOTE(
DEC(_bitfileList.size()) <<
" bitfile(s), " <<
DEC(_bitstreamList.size()) <<
" cached bitstream(s) cleared");
113 _bitfileList.clear();
114 _bitstreamList.clear();
119 return _bitfileList.size();
125 const ULWord inDesignVersion,
127 const ULWord inBitfileVersion,
128 const ULWord inBitfileFlags)
130 size_t numBitfiles (GetNumBitfiles());
131 size_t maxNdx (numBitfiles);
134 for (ndx = 0; ndx < numBitfiles; ndx++)
144 if ((maxNdx >= numBitfiles) || (info.
bitfileVersion > _bitfileList.at(maxNdx).bitfileVersion))
150 if ((inBitfileVersion == 0xff) && (maxNdx < numBitfiles))
154 if (ndx == numBitfiles)
155 {
BFMFAIL(
"No bitstream found for designID=" <<
xHEX0N(inDesignID,8) <<
" designVers=" <<
xHEX0N(inDesignVersion,8)
156 <<
" bitfileID=" <<
xHEX0N(inBitfileID,8) <<
" bitfileVers=" <<
xHEX0N(inBitfileVersion,8));
161 if (!ReadBitstream(ndx))
162 {
BFMFAIL(
"No bitstream found for designID=" <<
xHEX0N(inDesignID,8) <<
" designVers=" <<
xHEX0N(inDesignVersion,8)
163 <<
" bitfileID=" <<
xHEX0N(inBitfileID,8) <<
" bitfileVers=" <<
xHEX0N(inBitfileVersion,8));
167 outBitstream = _bitstreamList[ndx];
171 bool CNTV2BitfileManager::ReadBitstream (
const size_t inIndex)
174 if ((inIndex < _bitstreamList.size()) && !_bitstreamList.at(inIndex).IsNULL())
179 if (!Bitfile.
Open(_bitfileList.at(inIndex).bitfilePath))
180 {
BFMFAIL(
"Bitfile '" << _bitfileList.at(inIndex).bitfilePath <<
"' failed to open");
return false;}
185 {
BFMFAIL(
"GetProgramByteStream failed for bitfile '" << _bitfileList.at(inIndex).bitfilePath <<
"'");
return false;}
187 if (inIndex >= _bitstreamList.size())
188 _bitstreamList.resize(inIndex + 1);
190 _bitstreamList[inIndex] = Bitstream;
191 BFMDBG(
"Cached " <<
DEC(Bitstream.
GetByteCount()) <<
"-byte bitstream for '" << _bitfileList.at(inIndex).bitfilePath <<
"' at index " <<
DEC(inIndex));
ULWord designVersion
Version of this core.
std::string designName
The design name for this bitfile.
A generic user-space buffer object that has an address and a length. Used most often to share an arbi...
ULWord GetByteCount(void) const
Instances of me can parse a bitfile.
#define NTV2_BITFILE_FLAG_CLEAR
This is a clear bitfile.
NTV2DeviceID deviceID
The NTV2DeviceID for this firmware core+personality.
virtual bool IsClear(void) const
virtual bool IsTandem(void) const
#define NTV2_BITFILE_FLAG_PARTIAL
This is a partial bitfile.
ULWord designID
Identifies the firmware core (the design base common to all its personalities).
virtual void Clear(void)
Clear the list of bitfiles.
static AJAStatus DoesDirectoryExist(const std::string &directory)
virtual bool AddDirectory(const std::string &inDirectory)
Add the bitfile(s) at the given path to the list of bitfiles.
ULWord bitfileID
Identifies the firmware personality.
virtual bool Open(const std::string &inBitfilePath)
Opens the bitfile at the given path, then parses its header.
virtual NTV2DeviceID GetDeviceID(void) const
std::string bitfilePath
The path where this bitfile was found.
virtual ULWord GetBitfileID(void) const
virtual std::string GetDesignName(void) const
ULWord bitfileVersion
Version of this personality.
virtual bool IsPartial(void) const
Declares numerous NTV2 utility functions.
virtual size_t GetNumBitfiles(void)
Returns the number of bitfiles.
std::vector< std::string > NTV2StringList
virtual bool GetBitStream(NTV2Buffer &outBitstream, const ULWord inDesignID, const ULWord inDesignVersion, const ULWord inBitfileID, const ULWord inBitfileVersion, const ULWord inBitfileFlags)
Retrieves the bitstream specified by design ID & version, and bitfile ID & version....
Declares the CNTV2Bitfile class.
Declares the AJAFileIO class.
static bool FileExists(const std::wstring &fileName)
NTV2StringList::const_iterator NTV2StringListConstIter
virtual bool AddFile(const std::string &inBitfilePath)
Add the bitfile at the given path to the list of bitfiles.
Declares the CNTV2BitfileManager class that manages Xilinx bitfiles.
CNTV2BitfileManager()
My constructor.
static AJAStatus ReadDirectory(const std::string &directory, const std::string &filePattern, std::vector< std::string > &fileContainer)
virtual ULWord GetDesignVersion(void) const
#define xHEX0N(__x__, __n__)
#define AJA_FAILURE(_status_)
#define NTV2_BITFILE_FLAG_TANDEM
This is a tandem bitfile.
virtual ~CNTV2BitfileManager()
My destructor.
Declares the AJADebug class.
virtual ULWord GetBitfileVersion(void) const
virtual ULWord GetDesignID(void) const
virtual size_t GetProgramByteStream(NTV2Buffer &outBuffer)
Retrieves the program bitstream.