FrontPanel API 6.0.0
Loading...
Searching...
No Matches
okCFrontPanel Class Reference

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)
 

Detailed Description

This is the class that encapsulates the functionality of the FPGA boards as well as the FrontPanel extensions such as wire and trigger endpoints.

Member Function Documentation

◆ AddCustomDevice()

okCFrontPanel::ErrorCode okCFrontPanel::AddCustomDevice ( const okTDeviceMatchInfo & matchInfo,
const okTDeviceInfo * devInfo = NULL )
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().

◆ ClearFPGAConfiguration()

okCFrontPanel::ErrorCode okCFrontPanel::ClearFPGAConfiguration ( )
Returns
NoError - Configuration clear completed successfully.
DeviceNotOpen - Communication with a device is not established.
TransferError - USB error has occurred during download.
CommunicationError - Communication error with the firmware.
UnsupportedFeature - Configuration call not supported on this device or in this configuration.

This method clears the current configuration of the FPGA.

◆ Close()

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.

◆ ConfigureFPGA()

okCFrontPanel::ErrorCode okCFrontPanel::ConfigureFPGA ( const std::string strFilename,
void(* callback )(int, int, void *) = NULL,
void * arg = NULL )
Parameters
[in]strFilenameA string containing the filename of the configuration file.
[in]callbackAn optional progress callback function.
[in]argAn optional argument to the callback function.
Returns
NoError - Configuration completed successfully.
DeviceNotOpen - Communication with a device is not established.
FileError - File error occurred during open or read.
InvalidBitstream - The bitstream is not properly formatted.
DoneNotHigh - FPGA DONE signal did not assert after configuration.
TransferError - USB error has occurred during download.
CommunicationError - Communication error with the firmware.
UnsupportedFeature - Configuration call not supported on this device or in this configuration.

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:

void downloadCallback(int length, int count, void *arg);
See also
ConfigureFPGAFromMemory
ConfigureFPGAFromMemoryWithReset (USB 3.0 only)
ConfigureFPGAWithReset (USB 3.0 only)

References ConfigureFPGAFromMemory().

◆ ConfigureFPGAFromFlash()

okCFrontPanel::ErrorCode okCFrontPanel::ConfigureFPGAFromFlash ( const unsigned long configIndex,
void(* callback )(int, int, void *),
void * arg )
Parameters
[in]configIndex(Currently unused - reserved for future use).
[in]callback(Currently unused - reserved for future use).
[in]arg(Currently unused - reserved for future use).
Returns
ErrorCode - See ConfigureFPGA for details.

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.

See also
ConfigureFPGA
ConfigureFPGAFromMemory
ConfigureFPGAFromMemoryWithReset (USB 3.0 only)
ConfigureFPGAWithReset (USB 3.0 only)

◆ ConfigureFPGAFromMemory()

okCFrontPanel::ErrorCode okCFrontPanel::ConfigureFPGAFromMemory ( const unsigned char * data,
unsigned long length,
void(* callback )(int, int, void *) = NULL,
void * arg = NULL )
Parameters
[in]dataPointer to a memory buffer containing the configuration.
[in]lengthLength of the configuration memory.
[in]callbackAn optional progress callback function.
[in]argAn optional argument to the callback function.
Returns
ErrorCode - See ConfigureFPGA for details.

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).

See also
ConfigureFPGA
ConfigureFPGAFromMemoryWithReset (USB 3.0 only)
ConfigureFPGAWithReset (USB 3.0 only)

Referenced by ConfigureFPGA().

◆ ConfigureFPGAFromMemoryWithReset()

okCFrontPanel::ErrorCode okCFrontPanel::ConfigureFPGAFromMemoryWithReset ( const unsigned char * data,
unsigned long length,
const okTFPGAResetProfile * reset,
void(* callback )(int, int, void *) = NULL,
void * arg = NULL )
Parameters
[in]dataPointer to a memory buffer containing the configuration.
[in]lengthLength of the configuration memory.
[in]resetPointer to an FPGA Reset Profile to perform after configuration.
[in]callbackAn optional progress callback function.
[in]argAn optional argument to the callback function.
Returns
ErrorCode - See ConfigureFPGA for details.

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.

See also
ConfigureFPGA
ConfigureFPGAFromMemory
ConfigureFPGAWithReset (USB 3.0 only)

◆ ConfigureFPGAWithReset()

okCFrontPanel::ErrorCode okCFrontPanel::ConfigureFPGAWithReset ( const std::string strFilename,
const okTFPGAResetProfile * reset,
void(* callback )(int, int, void *) = NULL,
void * arg = NULL )
Parameters
[in]strFilenameA string containing the filename of the configuration file.
[in]callbackAn optional progress callback function.
[in]resetFPGA Reset profile to perform after configuration.
[in]argAn optional argument to the callback function.
Returns
NoError - Configuration completed successfully.
DeviceNotOpen - Communication with a device is not established.
FileError - File error occurred during open or read.
InvalidBitstream - The bitstream is not properly formatted.
DoneNotHigh - FPGA DONE signal did not assert after configuration.
TransferError - USB error has occurred during download.
CommunicationError - Communication error with the firmware.

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:

void downloadCallback(int length, int count, void *arg);

After successful configuration, the FPGA is reset according to the provided Reset Profile, an example of which is below:

okTFPGAResetProfile resetProfile;
resetProfile.u32DoneWaitUS = 1000;
resetProfile.u32ResetWaitUS = 10000;
resetProfile.u32RegisterWaitUS = 10000;
resetProfile.u32WireInValues[0] = 0xFEEDA55A;
resetProfile.u32WireInValues[1] = 0x12345678;
resetProfile.u32NumTriggerEntries = 2;
resetProfile.u32NumRegisterEntries = 1;
resetProfile.trigEntries[0].u32Trigger = 0x40;
resetProfile.trigEntries[0].u32Mask = 0x00000002;
resetProfile.trigEntries[1].u32Trigger = 0x40;
resetProfile.trigEntries[1].u32Mask = 0x00000002;
resetProfile.regEntries[0].u32Address = 0x0;
resetProfile.regEntries[0].u32Data = 0xBEEFF00D;
xem->ConfigureFPGAWithReset("counters.bit", &resetProfile);
Describes the sequence of events to perform after an FPGA configuration.
Definition okFPTypes.h:344

Device Support: This method is only available for USB 3.0 devices.

See also
ConfigureFPGA
ConfigureFPGAFromMemory
ConfigureFPGAFromMemoryWithReset (USB 3.0 only)

◆ FlashEraseSector()

okCFrontPanel::ErrorCode okCFrontPanel::FlashEraseSector ( UINT32 address)
Parameters
[in]addressAddress within the sector to erase.
Returns
NoError - The operation was successful.
Failed - The operation could not be completed.
DeviceNotOpen - A device is not open.
UnsupportedFeature - Method not supported on this device or configuration.
InvalidParameter - Address specified is invalid for erase operation.
Timeout - The operation did not complete in the expected time.

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.

Note
This method is only supported for USB 3.0 devices.
See also
FlashWrite
FlashRead

◆ FlashRead()

okCFrontPanel::ErrorCode okCFrontPanel::FlashRead ( UINT32 address,
UINT32 length,
UINT8 * buf )
Parameters
[in]addressByte address to begin read operation.
[in]lengthLength of data to read (in bytes).
[in]bufPointer to data buffer.
Returns
NoError - The operation was successful.
Failed - The operation could not be completed.
DeviceNotOpen - A device is not open.
UnsupportedFeature - Method not supported on this device or configuration.
InvalidParameter - Address or length specified is invalid.
Timeout - The operation did not complete in the expected time.

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.

Note
This method is only supported for USB 3.0 devices.

Python Note: Within Python, the 'length' parameter is not used and the 'data' parameter is of the mutable type bytearray. For example,

buf = bytearray(4096)
xem.FlashRead(0x0, buf)
ErrorCode FlashRead(UINT32 address, UINT32 length, UINT8 *buf)
Reads data from System Flash starting at the specified address.
Definition okCFrontPanel_NVRAM.cpp:119
See also
FlashEraseSector
FlashWrite

◆ FlashWrite()

okCFrontPanel::ErrorCode okCFrontPanel::FlashWrite ( UINT32 address,
UINT32 length,
const UINT8 * buf )
Parameters
[in]addressByte address to begin write operation.
[in]lengthLength of data to write (in bytes).
[in]bufPointer to data to write.
Returns
NoError - The operation was successful.
Failed - The operation could not be completed.
DeviceNotOpen - A device is not open.
UnsupportedFeature - Method not supported on this device or configuration.
InvalidParameter - Address or length specified is invalid.
Timeout - The operation did not complete in the expected time.

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.

Note
This method is only supported for USB 3.0 devices.

Python Note: Within Python, the 'length' parameter is not used and the 'data' parameter is of the mutable type bytearray. For example,

buf = bytearray(4096)
xem.FlashWrite(0x0, buf)
ErrorCode FlashWrite(UINT32 address, UINT32 length, const UINT8 *buf)
Writes data to System Flash starting at the specified address.
Definition okCFrontPanel_NVRAM.cpp:81
See also
FlashEraseSector
FlashRead

◆ GetDeviceInfo()

okCFrontPanel::ErrorCode okCFrontPanel::GetDeviceInfo ( okTDeviceInfo * info)
Parameters
[in]infoPointer to an allocated okDeviceInfo structure.
Returns
NoError - Operation completed successfully.
DeviceNotOpen - Device is not open.
InvalidParameter - The provided okTDeviceInfo pointer is null or points to an incorrectly sized structure which is too small. The latter can realistically only happen when using C API and passing incorrect size argument to okFrontPanel_GetDeviceInfoWithSize() function.
UnsupportedFeature - The application uses a version of the library which is too old and doesn't have all the fields present in okTDeviceInfo struct. Either a newer version of the library must be used or the application must be recompiled with the older version of the SDK.

Fills the okTDeviceInfo structure with information about the device.

◆ GetDeviceSensors()

okCFrontPanel::ErrorCode okCFrontPanel::GetDeviceSensors ( okCDeviceSensors & sensors) const
Parameters
[out]sensorsAn instance of okCDeviceSensors that will be modified with the sensor information.
Returns
NoError - Write has completed successfully.
Failed - Retrieving sensors from the device failed.
DeviceNotOpen - Communication with a XEM is not established.
UnsupportedFeature - Unless the device supports Device Sensors.

Device Support: This method is only available for USB 3.0 devices.

Example:

int count;
dev.GetDeviceSensors(sensors);
count = sensors.GetSensorCount(); // Returns the number of sensors.
sensor = sensors.GetSensor(0); // Returns the first sensor in the list.
Represents the set of read-only sensors available on certain devices.
Definition okCFrontPanel.h:51
int GetSensorCount() const
Retrieve the number of sensors.
Definition okCFrontPanel.h:89
okTDeviceSensor GetSensor(int index) const
Retrieve a single sensor.
Describes a single device sensor reading.
Definition okFPTypes.h:89

◆ GetDeviceSettings()

okCFrontPanel::ErrorCode okCFrontPanel::GetDeviceSettings ( okCDeviceSettings & settings)
Parameters
[out]settingsAn instance of okCDeviceSettings that will operate on device settings.
Returns
NoError - Completed successfully.
DeviceNotOpen - Communication with a device is not established.
UnsupportedFeature - Unless the device supports Device Settings.

Device Support: This method is only available for USB 3.0 devices.

See also
okCDeviceSettings

◆ GetEepromPLL22150Configuration()

okCFrontPanel::ErrorCode okCFrontPanel::GetEepromPLL22150Configuration ( okCPLL22150 & pll)
Parameters
[out]pllA reference to an okCPLL22150 object.
Returns
NoError - Operation complete successfully.
DeviceNotOpen - Device is not open.

This method retrieves the current PLL configuration from the on-board XEM EEPROM. The pll object is then initialized with this configuration.

See also
GetPLL22150Configuration
LoadDefaultPLLConfiguration
SetPLL22150Configuration
SetEepromPLL22150Configuration

◆ GetEepromPLL22393Configuration()

okCFrontPanel::ErrorCode okCFrontPanel::GetEepromPLL22393Configuration ( okCPLL22393 & pll)
Parameters
[out]pllA reference to an okCPLL22393 object.
Returns
NoError - Operation complete successfully.
DeviceNotOpen - Device is not open.

This method retrieves the current PLL configuration from the on-board XEM EEPROM. The pll object is then initialized with this configuration.

See also
GetPLL22393Configuration
LoadDefaultPLLConfiguration
SetPLL22393Configuration
SetEepromPLL22393Configuration

◆ GetErrorMessage()

const char * okCFrontPanel::GetErrorMessage ( ErrorCode error)
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.

See also
GetLastErrorMessage()

Referenced by GetLastErrorMessage().

◆ GetFPGADataPortAXI()

okCFrontPanel::ErrorCode okCFrontPanel::GetFPGADataPortAXI ( okCFPGADataPortAXI *& pProvider)

Retrieve the AXI data port interface for the device.

Note
AXI data port support will be available in a future release. No currently supported devices provide this interface.
Parameters
[out]pProviderPointer to the AXI data port interface.
Returns
NoError - Operation completed successfully.
DeviceNotOpen - Device is not open.

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().

Note
AXI data port support will be available in a future release. No currently supported devices provide this interface.
See also
okCFPGADataPortAXI

◆ GetFPGADataPortClassic()

okCFrontPanel::ErrorCode okCFrontPanel::GetFPGADataPortClassic ( okCFPGADataPortClassic *& pClassicPort)
Parameters
[out]pClassicPortPointer to the classic data port interface.
Returns
NoError - Operation completed successfully.
DeviceNotOpen - Device is not open.
UnsupportedFeature - Device does not support classic endpoints.

Retrieves the classic data port interface for the open device. The returned interface provides access to wires, triggers, pipes, and registers.

See also
okCFPGADataPortClassic

◆ GetFPGAResetProfile()

okCFrontPanel::ErrorCode okCFrontPanel::GetFPGAResetProfile ( okEFPGAConfigurationMethod method,
okTFPGAResetProfile * profile )
Parameters
[in]methodIndicates which reset profile should be retrieved.
[out]profileBoot FPGA Reset Profile
Returns
NoError - Write has completed successfully.
DeviceNotOpen - Communication with a device is not established.
UnsupportedFeature - Method not supported for this device.
InvalidParameter - Invalid configuration method or NULL profile pointer.
Failed - Request failed.

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.

See also
SetFPGAResetProfile

◆ GetLastError()

ErrorCode okCFrontPanel::GetLastError ( ) const
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().

See also
GetLastErrorMessage()

◆ GetLastErrorMessage()

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).

See also
GetLastError(), GetErrorMessage()

References GetErrorMessage().

◆ GetLastTransferLength()

long okCFrontPanel::GetLastTransferLength ( )
Returns
Returns the length of the last transfer, possibly 0 if it failed.

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.

◆ GetPLL22150Configuration()

okCFrontPanel::ErrorCode okCFrontPanel::GetPLL22150Configuration ( okCPLL22150 & pll)
Parameters
[in]pllA reference to an okCPLL22150 object.
Returns
NoError - Operation complete successfully.
DeviceNotOpen - Device is not open.

Reads the current PLL configuration over the I2C bus and modifies the pll argument to reflect that configuration.

See also
GetEepromPLL22150Configuration
LoadDefaultPLLConfiguration
SetPLL22150Configuration
SetEepromPLL22150Configuration

◆ GetPLL22393Configuration()

okCFrontPanel::ErrorCode okCFrontPanel::GetPLL22393Configuration ( okCPLL22393 & pll)
Parameters
[in]pllA reference to an okCPLL22393 object.
Returns
NoError - Operation complete successfully.
DeviceNotOpen - Device is not open.

Reads the current PLL configuration over the I2C bus and modifies the pll argument to reflect that configuration.

See also
GetEepromPLL22393Configuration
LoadDefaultPLLConfiguration
SetPLL22393Configuration
SetEepromPLL22393Configuration

◆ IsFrontPanelEnabled()

bool okCFrontPanel::IsFrontPanelEnabled ( )
Returns
True if FrontPanel support is present, false otherwise.

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.

◆ IsOpen()

bool okCFrontPanel::IsOpen ( ) const
Returns
true - Device is open.
false - Device is not open.

◆ IsRemote()

bool okCFrontPanel::IsRemote ( ) const
Returns
true If the device is connected to a remote server and, hence, operations with it have much higher latency, requiring the use of server-side scripts for acceptable performance.

◆ LoadDefaultPLLConfiguration()

okCFrontPanel::ErrorCode okCFrontPanel::LoadDefaultPLLConfiguration ( )
Returns
NoError - Operation complete successfully.
DeviceNotOpen - Device is not open.
UnsupportedFeature - The device does not have a supported PLL.

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:

xem->GetEepromPLL22150Configuration(pll);
xem->SetPLL22150Configuration(pll);
Container class which holds the appropriate configuration parameters for a Cypress 22150 PLL.
Definition okCPLL22150.h:59

Similar equivalence exists for devices with the CY22393 PLL.

See also
GetEepromPLL22150Configuration
GetEepromPLL22393Configuration
SetPLL22150Configuration
SetPLL22393Configuration

◆ ReadI2C()

okCFrontPanel::ErrorCode okCFrontPanel::ReadI2C ( int addr,
int length,
unsigned char * data )
Parameters
[in]addrI2C address of the target device.
[in]lengthLength of data (in bytes).
[in]dataPointer receive data buffer.
Returns
NoError - Write has completed successfully.
DeviceNotOpen - Communication with a XEM is not established.
CommunicationError - Communication error with the firmware.
I2CRestrictedAddress - Write to a restricted I2C address.
I2CBitError - I2C bit error occurred.
I2CNack - I2C device responded with NACK.
I2CUnknownStatus - Unknown result status.

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.

Note
This method is only available for USB 2.0 devices.

◆ RemoveCustomDevice()

okCFrontPanel::ErrorCode okCFrontPanel::RemoveCustomDevice ( int productID)
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().

◆ SetDeviceID()

void okCFrontPanel::SetDeviceID ( const std::string & str)
Parameters
[in]strA 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.

◆ SetEepromPLL22150Configuration()

okCFrontPanel::ErrorCode okCFrontPanel::SetEepromPLL22150Configuration ( const okCPLL22150 & pll)
Parameters
[in]pllA reference to an okCPLL22150 object.
Returns
NoError - Operation complete successfully.
DeviceNotOpen - Device is not open.

This method programs the on-board XEM EEPROM with the PLL configuration in pll.

See also
GetEepromPLL22150Configuration
GetPLL22150Configuration
LoadDefaultPLLConfiguration
SetPLL22150Configuration

◆ SetEepromPLL22393Configuration()

okCFrontPanel::ErrorCode okCFrontPanel::SetEepromPLL22393Configuration ( const okCPLL22393 & pll)
Parameters
[in]pllA reference to an okCPLL22393 object.
Returns
NoError - Operation complete successfully.
DeviceNotOpen - Device is not open.

This method programs the on-board XEM EEPROM with the PLL configuration in pll.

See also
GetEepromPLL22393Configuration
GetPLL22393Configuration
LoadDefaultPLLConfiguration
SetPLL22393Configuration

◆ SetFPGAResetProfile()

okCFrontPanel::ErrorCode okCFrontPanel::SetFPGAResetProfile ( okEFPGAConfigurationMethod method,
const okTFPGAResetProfile * profile )
Parameters
[in]methodIndicates which reset profile should be set.
[in]profileBoot FPGA Reset Profile
Returns
NoError - Write has completed successfully.
DeviceNotOpen - Communication with a device is not established.
UnsupportedFeature - Method not supported for this device.
InvalidParameter - Invalid configuration method or NULL profile pointer.
Failed - Request failed.

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:

okTFPGAResetProfile resetProfile;
memset(&p, 0, sizeof(okTFPGAResetProfile));
resetProfile.u32DoneWaitUS = 1000; // Wait 1ms after DONE before Wire/Register setup
resetProfile.u32WireInValues[0] = 0x000000f0;
resetProfile.u32WireInValues[1] = 0x000000a0;
resetProfile.u32NumRegisterEntries = 1;
resetProfile.regEntries[0].u32Address = 0x1234;
resetProfile.regEntries[0].u32Data = 0xAAAAAAAA;
resetProfile.u32RegisterWaitUS = 10000; // Wait 1ms after Wire/Register setup
resetProfile.u32ResetWaitUS = 10000; // Wait 1ms after RESET deasserts
resetProfile.u32NumTriggerEntries = 2;
resetProfile.trigEntries[0].u32Trigger = 0x40;
resetProfile.trigEntries[0].u32Mask = 0x00000002;
resetProfile.trigEntries[1].u32Trigger = 0x40;
resetProfile.trigEntries[1].u32Mask = 0x00000002;
resetProfile.u32Location = 16; // Bitfile stored at first user sector
resetProfile.u32Length = 689900; // Bitfile size
dev->SetFPGAResetProfile(ok_FPGAConfigurationMethod_NVRAM, &resetProfile);

An empty Reset Profile (with u32Length=0) specifies that an FPGA configuration is not to be loaded on boot. For example:

// Set an empty Reset Profile (u32Length=0) to prevent an FPGA configuration
// from being loaded at power-up.
memset(&p, 0, sizeof(okTFPGAResetProfile));
dev->SetFPGAResetProfile(ok_FPGAConfigurationMethod_NVRAM, &p));

Note: This method is only available in the C/C++ DLL.

See also
GetFPGAResetProfile

◆ SetPLL22150Configuration()

okCFrontPanel::ErrorCode okCFrontPanel::SetPLL22150Configuration ( const okCPLL22150 & pll)
Parameters
[in]pllA reference to an okCPLL22150 object.
Returns
NoError - Operation complete successfully.
DeviceNotOpen - Device is not open.

Configures the on-board PLL via the I2C bus using the configuration information in the pll object.

See also
GetEepromPLL22150Configuration
GetPLL22150Configuration
LoadDefaultPLLConfiguration
SetEepromPLL22150Configuration

◆ SetPLL22393Configuration()

okCFrontPanel::ErrorCode okCFrontPanel::SetPLL22393Configuration ( const okCPLL22393 & pll)
Parameters
[in]pllA reference to an okCPLL22393 object.
Returns
NoError - Operation complete successfully.
DeviceNotOpen - Device is not open.

Configures the on-board PLL via the I2C bus using the configuration information in the pll object.

See also
GetEepromPLL22393Configuration
GetPLL22393Configuration
LoadDefaultPLLConfiguration
SetEepromPLL22393Configuration

◆ SetTimeout()

void okCFrontPanel::SetTimeout ( int timeout)
Parameters
[in]timeoutTimeout 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.

◆ WriteI2C()

okCFrontPanel::ErrorCode okCFrontPanel::WriteI2C ( int addr,
int length,
const unsigned char * data )
Parameters
[in]addrI2C address of the target device.
[in]lengthLength of data (in bytes).
[in]dataPointer to data to be written.
Returns
NoError - Write has completed successfully.
DeviceNotOpen - Communication with a XEM is not established.
CommunicationError - Communication error with the firmware.
I2CRestrictedAddress - Write to a restricted I2C address.
I2CBitError - I2C bit error occurred.
I2CNack - I2C device responded with NACK.
I2CUnknownStatus - Unknown result status.

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.

Note
This method is only available for USB 2.0 devices.

Copyright (c) 2005-2025 Opal Kelly Incorporated