![]() |
FrontPanel API 6.0.0
|
This class encapsulates the functionality of an Opal Kelly FrontPanel-enabled device including FPGA configuration, PLL configuration, and FrontPanel endpoint access. More...
Public Member Functions | |
| okCFrontPanel () | |
| Default constructor. | |
| ~okCFrontPanel () | |
| Default destructor. | |
| ErrorCode | GetLastError () const |
| const char * | GetLastErrorMessage () const |
| void | Close () |
| Close the device. | |
| ErrorCode | ClearFPGAConfiguration () |
| Clear the current FPGA configuration. | |
| ErrorCode | ConfigureFPGA (const std::string strFilename, void(*callback)(int, int, void *)=NULL, void *arg=NULL) |
| Download an FPGA configuration from a file. | |
| ErrorCode | ConfigureFPGAWithReset (const std::string strFilename, const okTFPGAResetProfile *reset, void(*callback)(int, int, void *)=NULL, void *arg=NULL) |
| Download an FPGA configuration from a file and reset. | |
| ErrorCode | ConfigureFPGAFromMemory (const unsigned char *data, unsigned long length, void(*callback)(int, int, void *)=NULL, void *arg=NULL) |
| Download an FPGA configuration from memory. | |
| ErrorCode | ConfigureFPGAFromMemoryWithReset (const unsigned char *data, unsigned long length, const okTFPGAResetProfile *reset, void(*callback)(int, int, void *)=NULL, void *arg=NULL) |
| Download an FPGA configuration from memory. | |
| ErrorCode | ConfigureFPGAFromFlash (const unsigned long configIndex, void(*callback)(int, int, void *), void *arg) |
| Download an FPGA configuration from on-board flash. | |
| ErrorCode | GetFPGADataPortAXI (okCFPGADataPortAXI *&pProvider) |
| ErrorCode | GetFPGADataPortClassic (okCFPGADataPortClassic *&pClassicPort) |
| Retrieve the classic data port interface for the device. | |
| ErrorCode | GetDeviceInfo (okTDeviceInfo *info) |
| Fills a device information structure. | |
| ErrorCode | GetFPGAResetProfile (okEFPGAConfigurationMethod method, okTFPGAResetProfile *profile) |
| Retrieve the current FPGA configuration reset profile for the given method. | |
| ErrorCode | GetDeviceSensors (okCDeviceSensors &sensors) const |
| Fill the array with the available sensors. | |
| ErrorCode | GetDeviceSettings (okCDeviceSettings &settings) |
| Initialize the object allowing to access the device settings. | |
| ErrorCode | GetEepromPLL22150Configuration (okCPLL22150 &pll) |
| Read PLL configuration from the on-board EEPROM (PLL22150). | |
| ErrorCode | GetEepromPLL22393Configuration (okCPLL22393 &pll) |
| Read PLL configuration from the on-board EEPROM (PLL22393). | |
| long | GetLastTransferLength () |
| Returns the length of the last transfer (successful or not). | |
| ErrorCode | GetPLL22150Configuration (okCPLL22150 &pll) |
| Read the PLL configuration via the I2C bus (PLL22150). | |
| ErrorCode | GetPLL22393Configuration (okCPLL22393 &pll) |
| Read the PLL configuration via the I2C bus (PLL22393). | |
| bool | IsFrontPanelEnabled () |
| Reads a byte from the host interface to see if FrontPanel support is built in. | |
| bool | IsOpen () const |
| Returns true if a device is currently open. | |
| bool | IsRemote () const |
| Returns true if the device is connected to a remote server. | |
| ErrorCode | LoadDefaultPLLConfiguration () |
| Configures the PLL from settings stored in EEPROM. | |
| ErrorCode | ReadI2C (int addr, int length, unsigned char *data) |
| Reads I2C data from an arbitrary I2C device. | |
| ErrorCode | SetFPGAResetProfile (okEFPGAConfigurationMethod method, const okTFPGAResetProfile *profile) |
| Set the current FPGA configuration reset profile for the given method. | |
| void | SetDeviceID (const std::string &str) |
| Set the device ID in EEPROM. | |
| ErrorCode | SetPLL22150Configuration (const okCPLL22150 &pll) |
| Store the PLL configuration via the I2C bus (PLL22150). | |
| ErrorCode | SetPLL22393Configuration (const okCPLL22393 &pll) |
| Store the PLL configuration via the I2C bus (PLL22393). | |
| ErrorCode | SetEepromPLL22150Configuration (const okCPLL22150 &pll) |
| Store PLL configuration on the on-board EEPROM (PLL22150). | |
| ErrorCode | SetEepromPLL22393Configuration (const okCPLL22393 &pll) |
| Store PLL configuration on the on-board EEPROM (PLL22393). | |
| void | SetTimeout (int timeout) |
| Set the USB timeout duration (in milliseconds). | |
| ErrorCode | FlashEraseSector (UINT32 address) |
| Erases the sector at the specified address of System Flash memory. | |
| ErrorCode | FlashWrite (UINT32 address, UINT32 length, const UINT8 *buf) |
| Writes data to System Flash starting at the specified address. | |
| ErrorCode | FlashRead (UINT32 address, UINT32 length, UINT8 *buf) |
| Reads data from System Flash starting at the specified address. | |
| ErrorCode | WriteI2C (int addr, int length, const unsigned char *data) |
| Sends I2C data to an arbitrary I2C device. | |
Static Public Member Functions | |
| static const char * | GetErrorMessage (ErrorCode error) |
| static ErrorCode | AddCustomDevice (const okTDeviceMatchInfo &matchInfo, const okTDeviceInfo *devInfo=NULL) |
| static ErrorCode | RemoveCustomDevice (int productID) |
This is the class that encapsulates the functionality of the FPGA boards as well as the FrontPanel extensions such as wire and trigger endpoints.
|
static |
Adds a custom device description.
This method can used to indicate that a custom device with the IDs specified in matchInfo should be recognized as a FrontPanel device. Opening the device with these identifiers will succeed after a call to this function.
Please use OK_PRODUCT_OEM_START as offset for the product ID field, all product ID values below it are reserved for internal use.
Notice that it can be called more than once for the devices with different IDs but it is not needed to ever call it again for the same device. Typically, you would call it on the program startup before creating any okCFrontPanel objects.
The devInfo parameter is optional. If specified, some of its fields will override the values that would normally be returned from GetDeviceInfo().
| okCFrontPanel::ErrorCode okCFrontPanel::ClearFPGAConfiguration | ( | ) |
This method clears the current configuration of the FPGA.
| void okCFrontPanel::Close | ( | ) |
This method can be used to close the device to release the corresponding device at the system level, e.g. to allow another process to use it, without destroying this object itself but keeping it to be reopened later.
| okCFrontPanel::ErrorCode okCFrontPanel::ConfigureFPGA | ( | const std::string | strFilename, |
| void(* | callback )(int, int, void *) = NULL, | ||
| void * | arg = NULL ) |
| [in] | strFilename | A string containing the filename of the configuration file. |
| [in] | callback | An optional progress callback function. |
| [in] | arg | An optional argument to the callback function. |
This method downloads a configuration file to the FPGA. The filename should be that of a valid Xilinx bitfile (generated from bitgen). The callback is optional and used to track progress. The prototype for a valid callback would look like:
References ConfigureFPGAFromMemory().
| okCFrontPanel::ErrorCode okCFrontPanel::ConfigureFPGAFromFlash | ( | const unsigned long | configIndex, |
| void(* | callback )(int, int, void *), | ||
| void * | arg ) |
| [in] | configIndex | (Currently unused - reserved for future use). |
| [in] | callback | (Currently unused - reserved for future use). |
| [in] | arg | (Currently unused - reserved for future use). |
This method configures the FPGA with a configuration file that has previously been stored in on-board Flash memory using the FlashWrite() method.
Device Support: This method is only available for USB 3.0 devices.
| okCFrontPanel::ErrorCode okCFrontPanel::ConfigureFPGAFromMemory | ( | const unsigned char * | data, |
| unsigned long | length, | ||
| void(* | callback )(int, int, void *) = NULL, | ||
| void * | arg = NULL ) |
| [in] | data | Pointer to a memory buffer containing the configuration. |
| [in] | length | Length of the configuration memory. |
| [in] | callback | An optional progress callback function. |
| [in] | arg | An optional argument to the callback function. |
This method downloads a configuration file to the FPGA that has been read and stored in memory. The data buffer must contain a loaded Xilinx bitfile (generated from bitgen).
Referenced by ConfigureFPGA().
| okCFrontPanel::ErrorCode okCFrontPanel::ConfigureFPGAFromMemoryWithReset | ( | const unsigned char * | data, |
| unsigned long | length, | ||
| const okTFPGAResetProfile * | reset, | ||
| void(* | callback )(int, int, void *) = NULL, | ||
| void * | arg = NULL ) |
| [in] | data | Pointer to a memory buffer containing the configuration. |
| [in] | length | Length of the configuration memory. |
| [in] | reset | Pointer to an FPGA Reset Profile to perform after configuration. |
| [in] | callback | An optional progress callback function. |
| [in] | arg | An optional argument to the callback function. |
This method downloads a configuration file to the FPGA that has been read and stored in memory. The data buffer must contain a loaded Xilinx bitfile (generated from bitgen). After successful configuration, the FPGA is reset according to the provided reset profile.
Device Support: This method is only available for USB 3.0 devices.
| okCFrontPanel::ErrorCode okCFrontPanel::ConfigureFPGAWithReset | ( | const std::string | strFilename, |
| const okTFPGAResetProfile * | reset, | ||
| void(* | callback )(int, int, void *) = NULL, | ||
| void * | arg = NULL ) |
| [in] | strFilename | A string containing the filename of the configuration file. |
| [in] | callback | An optional progress callback function. |
| [in] | reset | FPGA Reset profile to perform after configuration. |
| [in] | arg | An optional argument to the callback function. |
This method downloads a configuration file to the FPGA and performs the specified Reset Profile after configuration. The filename should be that of a valid Xilinx bitfile (generated from bitgen). The callback is optional and used to track progress. The prototype for a valid callback would look like:
After successful configuration, the FPGA is reset according to the provided Reset Profile, an example of which is below:
Device Support: This method is only available for USB 3.0 devices.
| okCFrontPanel::ErrorCode okCFrontPanel::FlashEraseSector | ( | UINT32 | address | ) |
| [in] | address | Address within the sector to erase. |
Erases a single sector in System Flash memory. The sector to erase is determined based on the provided address. Any address within the sector will specify that the entire sector be erased. The sector specified must be in the acceptable range for the user area of Flash memory for the device. See the device User's Manual for Flash memory layout details.
The method blocks and returns when the operation completes. Sector erase times vary, but are approximately one second per sector.
Refer to the device-specific User's Manual for Flash layout and restrictions.
| okCFrontPanel::ErrorCode okCFrontPanel::FlashRead | ( | UINT32 | address, |
| UINT32 | length, | ||
| UINT8 * | buf ) |
| [in] | address | Byte address to begin read operation. |
| [in] | length | Length of data to read (in bytes). |
| [in] | buf | Pointer to data buffer. |
Reads data from System Flash memory starting at the specified address. The address and length must both be integer multiples of the System Flash page size.
Refer to the device-specific User's Manual for Flash layout and restrictions.
Python Note: Within Python, the 'length' parameter is not used and the 'data' parameter is of the mutable type bytearray. For example,
| okCFrontPanel::ErrorCode okCFrontPanel::FlashWrite | ( | UINT32 | address, |
| UINT32 | length, | ||
| const UINT8 * | buf ) |
| [in] | address | Byte address to begin write operation. |
| [in] | length | Length of data to write (in bytes). |
| [in] | buf | Pointer to data to write. |
Writes data to System Flash memory starting at the specified address. The address and length must both be integer multiples of the System Flash page size. This method will not erase the sector prior to writing. You must use FlashEraseSector to erase a sector prior to writing.
Refer to the device-specific User's Manual for Flash layout and restrictions.
Python Note: Within Python, the 'length' parameter is not used and the 'data' parameter is of the mutable type bytearray. For example,
| okCFrontPanel::ErrorCode okCFrontPanel::GetDeviceInfo | ( | okTDeviceInfo * | info | ) |
| [in] | info | Pointer to an allocated okDeviceInfo structure. |
size argument to okFrontPanel_GetDeviceInfoWithSize() function. Fills the okTDeviceInfo structure with information about the device.
| okCFrontPanel::ErrorCode okCFrontPanel::GetDeviceSensors | ( | okCDeviceSensors & | sensors | ) | const |
| [out] | sensors | An instance of okCDeviceSensors that will be modified with the sensor information. |
Device Support: This method is only available for USB 3.0 devices.
Example:
| okCFrontPanel::ErrorCode okCFrontPanel::GetDeviceSettings | ( | okCDeviceSettings & | settings | ) |
| [out] | settings | An instance of okCDeviceSettings that will operate on device settings. |
Device Support: This method is only available for USB 3.0 devices.
| okCFrontPanel::ErrorCode okCFrontPanel::GetEepromPLL22150Configuration | ( | okCPLL22150 & | pll | ) |
| [out] | pll | A reference to an okCPLL22150 object. |
This method retrieves the current PLL configuration from the on-board XEM EEPROM. The pll object is then initialized with this configuration.
| okCFrontPanel::ErrorCode okCFrontPanel::GetEepromPLL22393Configuration | ( | okCPLL22393 & | pll | ) |
| [out] | pll | A reference to an okCPLL22393 object. |
This method retrieves the current PLL configuration from the on-board XEM EEPROM. The pll object is then initialized with this configuration.
|
static |
Return the error message corresponding to the given error code.
This method can be used to get a human-readable message corresponding to the given FrontPanel error code.
Note that GetLastErrorMessage() should be preferred to calling this function as the last error message may contain additional details not present in the generic message returned by this function.
Returns NULL if the error code is not recognized.
Referenced by GetLastErrorMessage().
| okCFrontPanel::ErrorCode okCFrontPanel::GetFPGADataPortAXI | ( | okCFPGADataPortAXI *& | pProvider | ) |
Retrieve the AXI data port interface for the device.
| [out] | pProvider | Pointer to the AXI data port interface. |
Retrieves the AXI data port interface for the open device. The returned interface provides access to AXI-Lite, AXI-Full, and AXI-Stream sub-interfaces via GetAXILite(), GetAXIFull(), and GetAXIStream().
| okCFrontPanel::ErrorCode okCFrontPanel::GetFPGADataPortClassic | ( | okCFPGADataPortClassic *& | pClassicPort | ) |
| [out] | pClassicPort | Pointer to the classic data port interface. |
Retrieves the classic data port interface for the open device. The returned interface provides access to wires, triggers, pipes, and registers.
| okCFrontPanel::ErrorCode okCFrontPanel::GetFPGAResetProfile | ( | okEFPGAConfigurationMethod | method, |
| okTFPGAResetProfile * | profile ) |
| [in] | method | Indicates which reset profile should be retrieved. |
| [out] | profile | Boot FPGA Reset Profile |
This method queries the firmware for the current FPGA Boot or JTAG Reset Profile. The result is returned in the Reset Profile pointed to by profile.
Note: This method is only available in the C/C++ DLL.
|
inline |
Get the error code of the last operation.
Returns one of ErrorCode values, possibly NoError.
Note that GetLastErrorMessage() should be preferred to calling this function and GetErrorMessage(), as the last error message may contain additional details not present in the generic error message returned from GetErrorMessage().
| const char * okCFrontPanel::GetLastErrorMessage | ( | ) | const |
Get the message corresponding to the last error, if any.
This method can be used after any of the other methods of this class returning ErrorCode returns an error code different from NoError to check if there is an associated error message further explaining the problem.
Note that the returned pointer only remains valid until the next call to a method of this object or its destruction, so it should be either used immediately or a copy of the string needs to be made by caller.
Returns NULL if there is no error message (which doesn't mean that the error hadn't occurred, but just that there is no additional information about it).
References GetErrorMessage().
| long okCFrontPanel::GetLastTransferLength | ( | ) |
The last transfer length is updated by pipe-related functions, i.e. WriteToBlockPipeIn(), WriteToPipeIn(), ReadFromBlockPipeOut() and ReadFromPipeOut().
This function doesn't change the last error if it was set by a previously called pipe IO function, but does set it to DeviceNotOpen if the device is not currently open.
| okCFrontPanel::ErrorCode okCFrontPanel::GetPLL22150Configuration | ( | okCPLL22150 & | pll | ) |
| [in] | pll | A reference to an okCPLL22150 object. |
Reads the current PLL configuration over the I2C bus and modifies the pll argument to reflect that configuration.
| okCFrontPanel::ErrorCode okCFrontPanel::GetPLL22393Configuration | ( | okCPLL22393 & | pll | ) |
| [in] | pll | A reference to an okCPLL22393 object. |
Reads the current PLL configuration over the I2C bus and modifies the pll argument to reflect that configuration.
| bool okCFrontPanel::IsFrontPanelEnabled | ( | ) |
This method checks to see if the FrontPanel Host Interface has been instantiated in the FPGA design. If it is detected, FrontPanel support is enabled and endpoint functionality is available.
| bool okCFrontPanel::IsOpen | ( | ) | const |
| bool okCFrontPanel::IsRemote | ( | ) | const |
| okCFrontPanel::ErrorCode okCFrontPanel::LoadDefaultPLLConfiguration | ( | ) |
Configures the on-board PLL using the default configuration setup in the EEPROM. For a device with the Cypress CY22150 PLL, this is equivalent to:
Similar equivalence exists for devices with the CY22393 PLL.
| okCFrontPanel::ErrorCode okCFrontPanel::ReadI2C | ( | int | addr, |
| int | length, | ||
| unsigned char * | data ) |
| [in] | addr | I2C address of the target device. |
| [in] | length | Length of data (in bytes). |
| [in] | data | Pointer receive data buffer. |
This method reads a string of bytes from the target I2C address. This transfer does not utilize the FPGA and can be done prior to configuration.
|
static |
Remove a previously added custom device description.
This method can be used to forget about the device defined by a previous call to AddCustomDevice().
| void okCFrontPanel::SetDeviceID | ( | const std::string & | str | ) |
| [in] | str | A string containing the new Device ID. |
This method modifies the XEM Device ID string with the new string. The Device ID string is a user-programmable string of up to 32 characters that can be used to uniquely identify a particular XEM. The string will be truncated if it exceeds 32 characters.
GetLastError() can be used to check whether an error has occurred after calling this method.
| okCFrontPanel::ErrorCode okCFrontPanel::SetEepromPLL22150Configuration | ( | const okCPLL22150 & | pll | ) |
| [in] | pll | A reference to an okCPLL22150 object. |
This method programs the on-board XEM EEPROM with the PLL configuration in pll.
| okCFrontPanel::ErrorCode okCFrontPanel::SetEepromPLL22393Configuration | ( | const okCPLL22393 & | pll | ) |
| [in] | pll | A reference to an okCPLL22393 object. |
This method programs the on-board XEM EEPROM with the PLL configuration in pll.
| okCFrontPanel::ErrorCode okCFrontPanel::SetFPGAResetProfile | ( | okEFPGAConfigurationMethod | method, |
| const okTFPGAResetProfile * | profile ) |
| [in] | method | Indicates which reset profile should be set. |
| [in] | profile | Boot FPGA Reset Profile |
The Boot Reset Profile is the Reset Profile that defines how (and if) the firmware should configure the FPGA on boot and the sequence performed after configuration. If a valid Reset Profile is stored, the firmware will use that profile to boot and setup the FPGA at power-on.
The JTAG Reset Profile is the Reset Profile that defines the configuration sequence that should be followed after the FPGA is configured via JTAG. If a valid Reset Profile is stored, the firmware will method that profile to setup the FPGA if it detects completion of a JTAG-based configuration completion.
Example:
An empty Reset Profile (with u32Length=0) specifies that an FPGA configuration is not to be loaded on boot. For example:
Note: This method is only available in the C/C++ DLL.
| okCFrontPanel::ErrorCode okCFrontPanel::SetPLL22150Configuration | ( | const okCPLL22150 & | pll | ) |
| [in] | pll | A reference to an okCPLL22150 object. |
Configures the on-board PLL via the I2C bus using the configuration information in the pll object.
| okCFrontPanel::ErrorCode okCFrontPanel::SetPLL22393Configuration | ( | const okCPLL22393 & | pll | ) |
| [in] | pll | A reference to an okCPLL22393 object. |
Configures the on-board PLL via the I2C bus using the configuration information in the pll object.
| void okCFrontPanel::SetTimeout | ( | int | timeout | ) |
| [in] | timeout | Timeout duration specified in milliseconds. |
This method sets the timeout value used by USB transactions when communicating with the target device. Note that this is not necessarily the timeout for a particular API call. By default, the timeout is set to 10 seconds).
Note that a timeout is not always provided by the underlying calls nor by the operating system. Most generally, the timeout will apply to pipe transfers and FPGA configuration transfers.
Use GetLastError() to check whether timeout was set successfully.
| okCFrontPanel::ErrorCode okCFrontPanel::WriteI2C | ( | int | addr, |
| int | length, | ||
| const unsigned char * | data ) |
| [in] | addr | I2C address of the target device. |
| [in] | length | Length of data (in bytes). |
| [in] | data | Pointer to data to be written. |
This method writes a string of bytes to the target I2C address. This transfer does not utilize the FPGA and can be done prior to configuration.