EDT PCD SDK Documentation 6.1.0
|
Functions | |
int | edt_parse_unit_channel (const char *str, char *dev, const char *default_dev, int *channel) |
Parse an EDT device name string. Fills in the name of the device, with the default_device if specified, or a default determined by the package, and returns a unit number. Designed to facilitate a flexible device/unit command line argument scheme for application programs. Most EDT example/utility programs use this subroutine to allow users to specify either a unit number alone or a device/unit number concatenation. More... | |
void | edt_reset_counts (EdtDev edt_p) |
Reset timeout and overflow counters in the driver. More... | |
int | edt_device_unit (EdtDev edt_p) |
Get the 'unit' number of the specified device. More... | |
int | edt_device_channel (EdtDev edt_p) |
Get the 'channel' number of the specified device. More... | |
enum EDT_PCI_PID | edt_device_id (EdtDev edt_p) |
Get the PCI device ID (PID) of the EDT device. More... | |
const char * | edt_idstr (enum EDT_PCI_PID id) |
Get a descriptive string of a given board ID. More... | |
u_int | edt_device_mezz_id (EdtDev edt_p) |
Get the mezzanine ID value from the EDT device handle. More... | |
int | edt_parse_unit (const char *str, char *dev, const char *default_dev) |
Parse an EDT device name string. Same as edt_parse_unit_channel() but without the channel number. More... | |
int | edt_find_xpn (const char *part_number, char *fpga) |
Read the default part number->fpga cross-reference file edt_parts.xpn in the current directory, and provides the FPGA if a match is found. More... | |
int | edt_get_xref_info (const char *path, const char *pn, char *fpga, char *sn, char *mac_type, char *mac_offset, char *mac_count, char *desc, char *rsvd1, char *rsvd2) |
Read a part number->fpga cross-reference file and provides the FPGA and base serial number if a match is found. More... | |
u_int | edt_errno (void) |
Get an operating system dependent error number. More... | |
EDT_CHECK_RETURN int | edt_system (const char *cmdstr) |
Performs a UNIX-like system() call which passes the argument string to a shell or command interpreter, then returns the exit status so that errors can be detected. On Windows spawnv() will be used. More... | |
int | edt_set_bitpath (EdtDev edt_p, const char *bitpath) |
Set bitpath as the currently loaded "user interface" FPGA firmware ("bitfile") in the driver. More... | |
int | edt_get_bitpath (EdtDev edt_p, char *bitpath, int size) |
Get file path from the driver of the currently loaded interface bitfile. More... | |
int | edt_get_bitname (EdtDev edt_p, char *bitfile, int size) |
Same as edt_get_bitpath() but returns the file name without the directory. More... | |
int | edt_get_mezz_chan_bitpath (EdtDev edt_p, char *bitpath, int size, int channel) |
Obtains path of the currently loaded mezzanine bitfile from the driver. edt_bitload() sets this string when a mezzanine bitfile is successfully loaded. More... | |
int | edt_set_mezz_bitpath (EdtDev edt_p, const char *bitpath) |
Set pathname to the currently loaded mezzanine bitfile in the driver. More... | |
int | edt_get_mezz_bitpath (EdtDev edt_p, char *bitpath, int size) |
Obtains pathname to the currently loaded mezzanine bitfile from the driver. edt_bitload() sets this when a mezzanine bitfile is successfully loaded. More... | |
u_int | edt_get_board_id (EdtDev edt_p) |
Get the mezzanine board ID. Equivalent to calling edt_get_full_board_id() with NULL as all the pointer arguments. More... | |
int | edt_set_mezz_id (EdtDev edt_p) |
Set the mezzanine ID in the driver. More... | |
int | edt_get_mezz_id (EdtDev edt_p) |
Get the mezzanine ID from the driver. More... | |
int | edt_get_driver_version (EdtDev edt_p, char *version_str, size_t size) |
int | edt_get_driver_buildid (EdtDev edt_p, char *build_str, size_t size) |
Get the full build ID of the EDT driver. The build ID string is the same format as that returned by edt_get_library_buildid(). More... | |
int | edt_get_library_version (char *version_str, size_t size) |
Get the version string of the EDT library. Example: "1.2.3-rc4" More... | |
u_int | edt_get_version_number (void) |
Get the EDT library version as a packed number. Example v5.6.1 would be represented as 50601 . More... | |
int | edt_get_library_buildid (char *build_str, size_t size) |
Get the build ID of the EDT library. Example: "20210214124523.asdf1234 64 bit" More... | |
int | edt_check_version (EdtDev edt_p) |
Ensure the EDT library and the kernel driver are the same version. More... | |
uint32_t | edt_get_dma_info (EdtDev edt_p, edt_dma_info_t *dmainfo) |
Gets information about active DMA. More... | |
Utility functions.
int edt_parse_unit_channel | ( | const char * | str, |
char * | dev, | ||
const char * | default_dev, | ||
int * | channel | ||
) |
Parse an EDT device name string. Fills in the name of the device, with the default_device if specified, or a default determined by the package, and returns a unit number. Designed to facilitate a flexible device/unit command line argument scheme for application programs. Most EDT example/utility programs use this subroutine to allow users to specify either a unit number alone or a device/unit number concatenation.
[in] | str | Device name string from command line. Should be either a unit number ("0") or device/unit concatenation ("pcd0," "pcd1," etc.). |
[out] | dev | Array to hold the device name string; filled in by ths routine. |
[in] | default_dev | Device name to use if none is given in the str argument. If NULL, EDT_INTERFACE will be used. |
[out] | channel | The channel number parsed from str . If this is NULL or parsed channel number is -1, this is ignored and unchanged. |
void edt_reset_counts | ( | EdtDev | edt_p | ) |
Reset timeout and overflow counters in the driver.
edt_p | The open EDT device handle. |
int edt_device_unit | ( | EdtDev | edt_p | ) |
Get the 'unit' number of the specified device.
edt_p | EDT device handle to inspect. |
int edt_device_channel | ( | EdtDev | edt_p | ) |
Get the 'channel' number of the specified device.
edt_p | The open EDT device handle. |
enum EDT_PCI_PID edt_device_id | ( | EdtDev | edt_p | ) |
Get the PCI device ID (PID) of the EDT device.
edt_p | The open EDT device handle. |
const char * edt_idstr | ( | enum EDT_PCI_PID | id | ) |
Get a descriptive string of a given board ID.
id | PCI device id. See edt_device_id(). |
u_int edt_device_mezz_id | ( | EdtDev | edt_p | ) |
Get the mezzanine ID value from the EDT device handle.
Unlike edt_get_mezz_id(), this does not query the driver. This is useful to get any error-related mezz ID's that edt_get_full_board_id() may have set when it was querying hardware.
edt_p | The open EDT device handle. |
int edt_parse_unit | ( | const char * | str, |
char * | dev, | ||
const char * | default_dev | ||
) |
Parse an EDT device name string. Same as edt_parse_unit_channel() but without the channel number.
[in] | str | Device name string from command line. Should be either a unit number ("0") or device/unit concatenation ("pcd0," "pcd1," etc.). |
[out] | dev | Array to hold the device name string; filled in by ths routine. |
[in] | default_dev | Device name to use if none is given in the str argument. If NULL, EDT_INTERFACE will be used. |
int edt_find_xpn | ( | const char * | part_number, |
char * | fpga | ||
) |
Read the default part number->fpga cross-reference file edt_parts.xpn in the current directory, and provides the FPGA if a match is found.
[in] | part_number | EDT part number to return information about. |
[out] | fpga | A character array into which the FPGA type will be stored. For example 'xc2s100e' will be returned for the part_number '01901933'). An array of 128 bytes will be more than enough for the foreseeable future. |
Equivalent to
See edt_get_xref_info() for complete description.
int edt_get_xref_info | ( | const char * | path, |
const char * | pn, | ||
char * | fpga, | ||
char * | sn, | ||
char * | mac_type, | ||
char * | mac_offset, | ||
char * | mac_count, | ||
char * | desc, | ||
char * | rsvd1, | ||
char * | rsvd2 | ||
) |
Read a part number->fpga cross-reference file and provides the FPGA and base serial number if a match is found.
[in] | path | Path of the xref FPGA file (typ. "edt_parts.xpn"). |
[in] | pn | EDT part number to search for. Either 8 to 10 characters, meaning either with or without the last 2 characters, which is the revision number. Example: "01901933" . |
[out] | fpga | If a match is found, the FPGA part number will be returned here. Should be at least 64 bytes. If NULL, this parameter will be ignored. |
[out] | sn | The base serial number, if found. Should be at least 64 bytes. If NULL, this parameter will be ignored. |
[out] | mac_type | The MAC address board type, if found. Should be at least 8 bytes. If NULL, this parameter will be ignored. |
[out] | mac_offset | The MAC address offset found. Should be at least 8 bytes. If NULL this parameter will be ignored. |
[out] | mac_count | The MAC addresses for this board, if found. Should be at least 8 bytes. If NULL this parameter will be ignored. |
[out] | rsvd1 | Reserved. Always pass NULL. |
[out] | rsvd2 | Reserved. Always pass NULL. |
Opens the file specified in the path
argument (e.g. "edt_parts.xpn") and compares the entries with the provided part number. If a match is found, it will be copied to the fpga
argument. Will also copy a serial number if found. Format of the file is ASCII text, one line per part number, as follows:
(serial is optional and not present in earlier files)
Anything after the third item is ignored, and can be blank but should typically be the description (name of the device). Since files originally had only two fields and no serial number, an attempt is made to determine if the 3rd field looks like a serial number and copies that if so, otherwise sets the first character to NULL.
The last 2 digits of 10 digit pn
are the revision number. If a match with a 10-digit number is found, returns with the info from that one. If no 10-digit match is found but an 8-digit is found, returns with that info. That way we can have some numbers return a match regardless of rev, and others that cover a specific rev that takes precedence.
u_int edt_errno | ( | void | ) |
Get an operating system dependent error number.
errno
on UNIX, GetLastError()
on Windows.
Example:
EDT_CHECK_RETURN int edt_system | ( | const char * | cmdstr | ) |
Performs a UNIX-like system()
call which passes the argument string to a shell or command interpreter, then returns the exit status so that errors can be detected. On Windows spawnv()
will be used.
cmdstr | The command string to execute. |
int edt_set_bitpath | ( | EdtDev | edt_p, |
const char * | bitpath | ||
) |
Set bitpath
as the currently loaded "user interface" FPGA firmware ("bitfile") in the driver.
For use by edt_bitload() and the bitload
application.
edt_p | The open EDT device handle. |
bitpath | Firmware (bitfile) file name. Should be no more than 128 bytes. |
int edt_get_bitpath | ( | EdtDev | edt_p, |
char * | bitpath, | ||
int | size | ||
) |
Get file path from the driver of the currently loaded interface bitfile.
edt_bitload() sets this when an interface bitfile is successfully loaded.
edt_p | The open EDT device handle. | |
[out] | bitpath | The file path read from the driver will be returned here. Should be at least 128 bytes (edt_bitpath). |
size | Size of bitpath . |
int edt_get_bitname | ( | EdtDev | edt_p, |
char * | bitfile, | ||
int | size | ||
) |
Same as edt_get_bitpath() but returns the file name without the directory.
edt_p | The open EDT device handle. | |
[out] | bitfile | The file name read from the driver will be returned here. Should be at least 128 bytes. |
size | Size of bitfile . |
int edt_get_mezz_chan_bitpath | ( | EdtDev | edt_p, |
char * | bitpath, | ||
int | size, | ||
int | channel | ||
) |
Obtains path of the currently loaded mezzanine bitfile from the driver. edt_bitload() sets this string when a mezzanine bitfile is successfully loaded.
edt_p | The open EDT device handle. | |
[out] | bitpath | The file path read from the driver will be returned here. Should be at least 128 bytes. |
size | Size of bitpath . | |
channel | Mezzanine channel index. |
int edt_set_mezz_bitpath | ( | EdtDev | edt_p, |
const char * | bitpath | ||
) |
Set pathname to the currently loaded mezzanine bitfile in the driver.
For use by edt_bitload().
edt_p | The open EDT device handle. |
bitpath | The file path to save in the driver. Must be at least 128 bytes. |
int edt_get_mezz_bitpath | ( | EdtDev | edt_p, |
char * | bitpath, | ||
int | size | ||
) |
Obtains pathname to the currently loaded mezzanine bitfile from the driver. edt_bitload() sets this when a mezzanine bitfile is successfully loaded.
edt_p | The open EDT device handle. | |
[out] | bitpath | The file path read from the driver will be returned here. Should be at least 128 bytes. |
size | Size of bitpath . |
u_int edt_get_board_id | ( | EdtDev | edt_p | ) |
Get the mezzanine board ID. Equivalent to calling edt_get_full_board_id() with NULL as all the pointer arguments.
edt_p | The open EDT device handle. |
int edt_set_mezz_id | ( | EdtDev | edt_p | ) |
Set the mezzanine ID in the driver.
Expects mezzanine ID to be properly set in the edt_p
handle's internal EdtMezzDescriptor structure. Use edt_device_mezz_id() to get the internal mezz id value that would be saved to the driver by this function.
edt_p | The open EDT device handle. |
int edt_get_mezz_id | ( | EdtDev | edt_p | ) |
Get the mezzanine ID from the driver.
edt_p | The open EDT device handle. |
int edt_get_driver_version | ( | EdtDev | edt_p, |
char * | version_str, | ||
size_t | size | ||
) |
Get | the version of the EDT driver. The version string is the same format as that returned by edt_get_library_version(). | |
edt_p | The open EDT device handle. | |
[out] | version_str | Driver's version string will be returned here. Should be at least 64 bytes (edt_version_string). |
size | Size, in bytes, of version_str buffer. |
int edt_get_driver_buildid | ( | EdtDev | edt_p, |
char * | build_str, | ||
size_t | size | ||
) |
Get the full build ID of the EDT driver. The build ID string is the same format as that returned by edt_get_library_buildid().
edt_p | The open EDT device handle. | |
[out] | build_str | Driver's build info string will be returned here. Should be at least 128 bytes. |
size | Size, in bytes, of build_str buffer. |
int edt_get_library_version | ( | char * | version_str, |
size_t | size | ||
) |
Get the version string of the EDT library. Example: "1.2.3-rc4"
[out] | version_str | Version string from libedt_get_version_str() will be copied into this buffer. |
size | Size, in bytes, of version_str buffer. |
u_int edt_get_version_number | ( | void | ) |
Get the EDT library version as a packed number. Example v5.6.1 would be represented as 50601
.
int edt_get_library_buildid | ( | char * | build_str, |
size_t | size | ||
) |
Get the build ID of the EDT library. Example: "20210214124523.asdf1234 64 bit"
[out] | build_str | Build string from data in libedt_get_version() will be saved into this buffer. |
size | Size, in bytes, of build_str buffer. |
int edt_check_version | ( | EdtDev | edt_p | ) |
Ensure the EDT library and the kernel driver are the same version.
While uncommon, it is possible for package updates to fail, causing an older EDT driver to be left in the system. User applications may wish to run this sanity check early, to ensure the library and driver match before they encounter errors due to an incompatibility.
edt_p | The open EDT device handle. |
uint32_t edt_get_dma_info | ( | EdtDev | edt_p, |
edt_dma_info_t * | dmainfo | ||
) |
Gets information about active DMA.
Determine whether this or another open process has enabled DMA or image acquisition on any channel of a specific board (unit).
edt_p | The open EDT device handle. | |
[out] | dmainfo | DMA information result. |
used_dma
, alloc_dma
and active_dma
masks OR'd together.Example: