Defines | |
#define | edt_has_chanreg(edt_p) (ID_HAS_CHANREG(edt_p->devid)) |
#define | edt_has_combined_fpga(edt_p) (ID_HAS_COMBINED_FPGA(edt_p->devid)) |
#define | edt_has_irigb(edt_p) (ID_HAS_IRIGB(edt_p->devid)) |
#define | edt_is_1553(edt_p) (ID_IS_1553(edt_p->devid)) |
#define | edt_is_16bit_prom(edt_p) (ID_HAS_16BIT_PROM(edt_p->devid)) |
#define | edt_is_16channel(edt_p) (ID_IS_16CHANNEL(edt_p->devid)) |
#define | edt_is_1lane(edt_p) (ID_IS_1LANE(edt_p->devid)) |
#define | edt_is_1or4channel(edt_p) (ID_IS_1OR4CHANNEL(edt_p->devid)) |
#define | edt_is_2channel(edt_p) (ID_IS_2CHANNEL(edt_p->devid)) |
#define | edt_is_32channel(edt_p) (ID_IS_32CHANNEL(edt_p->devid)) |
#define | edt_is_3channel(edt_p) (ID_IS_3CHANNEL(edt_p->devid)) |
#define | edt_is_4channel(edt_p) (ID_IS_4CHANNEL(edt_p->devid)) |
#define | edt_is_4lane(edt_p) (ID_IS_4LANE(edt_p->devid)) |
#define | edt_is_8lane(edt_p) (ID_IS_8LANE(edt_p->devid)) |
#define | edt_is_dummy(edt_p) (ID_IS_DUMMY(edt_p->devid)) |
#define | edt_is_dv_multichannel(edt_p) (edt_is_dvcl(edt_p) || edt_is_dvfox(edt_p) || edt_p->devid == PDVAERO_ID) |
#define | edt_is_dvcl(edt_p) (ID_IS_DVCL(edt_p->devid)) |
#define | edt_is_dvcl2(edt_p) (ID_IS_DVCL2(edt_p->devid)) |
#define | edt_is_dvcls(edt_p) (ID_IS_DVCLS(edt_p->devid)) |
#define | edt_is_dvfox(edt_p) (ID_IS_DVFOX(edt_p->devid)) |
#define | edt_is_fciusps(edt_p) (ID_IS_FCIUSPS(edt_p->devid)) |
#define | edt_is_micron_prom(edt_p) (ID_IS_MICRON_PROM(edt_p->devid)) |
#define | edt_is_multichan(edt_p) (ID_IS_MULTICHAN(edt_p->devid)) |
#define | edt_is_pcd(edt_p) (ID_IS_PCD(edt_p->devid)) |
#define | edt_is_pcie_dvfox(edt_p) (ID_IS_PCIE_DVFOX(edt_p->devid)) |
#define | edt_is_pdv(edt_p) (ID_IS_PDV(edt_p->devid)) |
#define | edt_is_simulator(edt_p) (ID_IS_DVCL2(edt_p->devid)) |
#define | edt_is_unknown(edt_p) (ID_IS_UNKNOWN(edt_p->devid)) |
#define | edt_stores_macaddrs(edt_p) (ID_STORES_MACADDRS(edt_p->devid)) |
#define | has_pcda_direction_bit(edt_p) (ID_HAS_PCD_DIR_BIT(edt_p->devid)) |
Functions | |
int | edt_access (char *fname, int perm) |
Determines file access, independent of operating system. | |
int | edt_check_version (EdtDev *edt_p) |
compares version strings between library and driver, returns 0 if they aren't the same | |
int | edt_device_id (EdtDev *edt_p) |
Gets the device ID of the specified device. | |
const char * | edt_envvar_from_devstr (const char *devstr) |
const char * | edt_envvar_from_devtype (const int devtype) |
u_int | edt_errno (void) |
Returns an operating system-dependent error number. | |
int | edt_find_xpn (char *part_number, char *fpga) |
Reads the default part number->fpga cross-reference file edt_parts.xpn in the current directory, and provides the FPGA if a match is found. | |
u_char | edt_flipbits (u_char val) |
int | edt_get_bitname (EdtDev *edt_p, char *bitpath, int size) |
Obtains the name of the currently loaded interface bitfile from the driver. | |
int | edt_get_bitpath (EdtDev *edt_p, char *bitpath, int size) |
Obtains pathname to the currently loaded interface bitfile from the driver. | |
u_int | edt_get_board_id (EdtDev *edt_p) |
Gets the mezzanine id. | |
u_int | edt_get_dma_info (EdtDev *edt_p, edt_dma_info *dmainfo) |
Gets information about active dma. | |
int | edt_get_driver_buildid (EdtDev *edt_p, char *build, int size) |
Gets the full build ID of the EDT library. | |
int | edt_get_driver_version (EdtDev *edt_p, char *versionstr, int size) |
Gets the version of the EDT driver. | |
void | edt_get_esn (EdtDev *edt_p, char *esn) |
Retrieve the board's embedded information string from the PCI xilinx information header. | |
u_int | edt_get_full_board_id (EdtDev *edt_p, int *extended_n, int *rev_id, u_int *extended_data) |
Gets the mezzanine id including extended data. | |
char * | edt_get_last_bitpath (EdtDev *edt_p) |
int | edt_get_library_buildid (EdtDev *edt_p, char *build, int size) |
Gets the full build ID of the EDT library. | |
int | edt_get_library_version (EdtDev *edt_p, char *versionstr, int size) |
Gets the version (number and date) of the EDT library. | |
int | edt_get_mezz_bitpath (EdtDev *edt_p, char *bitpath, int size) |
Obtains pathname to the currently loaded mezzanine bitfile from the driver. | |
int | edt_get_mezz_chan_bitpath (EdtDev *edt_p, char *bitpath, int size, int channel) |
Obtains pathname to the currently loaded mezzanine bitfile from the driver. | |
u_int | edt_get_mezz_id (EdtDev *edt_p) |
void | edt_get_osn (EdtDev *edt_p, char *osn) |
Retrieve the board OEM's embedded information string from the PCI xilinx information header. | |
void | edt_get_sns_sector (EdtDev *edt_p, char *esn, char *osn, int sector) |
Retrieve the board's manufacturer and OEM embedded information strings strings from the PCI xilinx information header. | |
u_int | edt_get_version_number () |
int | edt_get_xref_info (const char *path, const char *pn, char *fpga, char *sn, char *mtype, char *moffs, char *mcount, char *desc, char *rsvd1, char *rsvd2) |
Reads a part number->fpga cross-reference file and provides the fpga and base serial number if a match is found. | |
const char * | edt_home_dir (EdtDev *edt_p) |
char * | edt_idstr (int id) |
Converts the board ID returned by edt_device_id to a human readable form (original version, sans promcode). | |
char * | edt_idstring (int id, int promcode) |
Converts the board ID returned by edt_device_id to a human readable form (new version, with promcode). | |
uint_t | edt_overflow (EdtDev *edt_p) |
int | edt_parse_devinfo (char *str, Edt_embinfo *ei) |
Parse the board's embedded information string. | |
int | edt_parse_esn (char *str, Edt_embinfo *ei) |
int | edt_parse_unit (const char *str, char *dev, const char *default_dev) |
Parses an EDT device name string. | |
int | edt_parse_unit_channel (const char *str, char *dev, const char *default_dev, int *channel) |
parse -u argument returning the device and unit. | |
void | edt_perror (char *str) |
Formats and prints a system error. | |
int | edt_set_bitpath (EdtDev *edt_p, const char *bitpath) |
Sets pathname to the currently loaded user interface bitfile in the driver. | |
int | edt_set_mezz_bitpath (EdtDev *edt_p, const char *bitpath) |
Sets pathname to the currently loaded mezzanine bitfile in the driver. | |
int | edt_set_mezz_chan_bitpath (EdtDev *edt_p, const char *bitpath, int channel) |
Sets pathname to the currently loaded mezzanine bitfile in the driver. | |
u_int | edt_set_mezz_id (EdtDev *edt_p) |
int | edt_system (const char *cmdstr) |
Performs a UNIX-like system() call which passes the argument strings to a shell or command interpreter, then returns the exit status of the command or the shell so that errors can be detected. | |
char * | edt_timestring (u_int *timep) |
int edt_access | ( | char * | fname, | |
int | perm | |||
) |
Determines file access, independent of operating system.
This a convenience routine that maps to access() on Unix/Linux systems and _access() on Windows systems.
fname | path name of file to check access permissions | |
perm | permission flag(s) to test for. See documentation for access() (Unix/Linux) or _access() (Windows) for valid values. |
if(edt_access("file.ras", F_OK)) printf("Warning: overwriting file %s\n", "file.ras");
Definition at line 452 of file edt_os_nt.c.
int edt_device_id | ( | EdtDev * | edt_p | ) |
Gets the device ID of the specified device.
The board ID can be compared to specific board IDs listed in edtreg.h. To check if the specific board is part of a broader type, like PCD or PDV, macros such as edt_is_pcd and edt_is_pdv can be used.
edt_p | pointer to edt device structure returned by edt_open or edt_open_channel |
u_int edt_errno | ( | void | ) |
Returns an operating system-dependent error number.
if ((edt_p = edt_open("pcd", 0)) == NULL) { edt_perror("edt_open failed"); exit(edt_errno()); }
int edt_find_xpn | ( | char * | part_number, | |
char * | fpga | |||
) |
Reads the default part number->fpga cross-reference file edt_parts.xpn in the current directory, and provides the FPGA if a match is found.
Equivalent to calling edt_find_get_xref_info with edt_parts.xpn as the filename. See /ref edt_find_xref_fpga for complete description.
fpga | is a character array into which the fpga type will be stored (e.g. 'xc2s100e' will be returned for the part_number '01901933'). An array of 128 bytes will be more than enough for the foreseeable future. |
int edt_get_bitname | ( | EdtDev * | edt_p, | |
char * | bitpath, | |||
int | size | |||
) |
Obtains the name of the currently loaded interface bitfile from the driver.
The program bitload sets this string in the driver when an interface bitfile is successfully loaded.
edt_p | pointer to edt device structure returned by edt_open or edt_open_channel | |
bitpath | address of a character buffer of at least 128 bytes | |
size | number of bytes in the above character buffer |
int edt_get_bitpath | ( | EdtDev * | edt_p, | |
char * | bitpath, | |||
int | size | |||
) |
Obtains pathname to the currently loaded interface bitfile from the driver.
The program bitload sets this string in the driver when an interface bitfile is successfully loaded.
edt_p | pointer to edt device structure returned by edt_open or edt_open_channel | |
bitpath | address of a character buffer of at least 128 bytes | |
size | number of bytes in the above character buffer |
u_int edt_get_board_id | ( | EdtDev * | edt_p | ) |
u_int edt_get_dma_info | ( | EdtDev * | edt_p, | |
edt_dma_info * | dmainfo | |||
) |
Gets information about active dma.
Use this function to determine whether this or another open process has enabled DMA or image acquisition on any channel of a specific board (unit)
edt_p | pointer to edt device structure returned by edt_open or edt_open_channel | |
dmainfo | pointer to struct of type edt_dma_info (defined in libedt.h ), which has three fields containing hex values, with each bit in a field representing a channel that has been used, allocated or is currently active, as follows: typedef struct { uint_t used_dma ; // which channels have started dma within current open/close uint_t alloc_dma ; // which channels have has allocated > 1 ring buffer uint_t active_dma ; // which channels have dma active right now } edt_dma_info ; |
// this code checks whether this or some other process has done or is // currently doing DMA on a given unit / channel, and prints out a warning // if there is a possibility of a conflict based on the results edt_dma_info tmpinfo ; EdtDev *edt_p = edt_open_channel(EDT_INTERFACE, unit, channel); u_int tmpmask = edt_get_dma_info(edt_p, &tmpinfo); if (tmpinfo.active_dma & (1 << channel)) { printf("Warning: DMA is currently active on unit %d ch. %d.\n", unit, channel); printf("It is not safe to start another DMA on this unit/channel at this time.\n"); } if (tmpinfo.used_dma & 1 << channel)) { printf("Warning: this or another process has already opened and done DMA on unit %d channel %d.\n", unit, channel); printf("It may not be safe to start DMA on this unit/channel outside the currently opened process.\n"); }
int edt_get_driver_buildid | ( | EdtDev * | edt_p, | |
char * | build, | |||
int | size | |||
) |
Gets the full build ID of the EDT library.
The build ID string is the same format as that returned by edt_get_library_buildid.
edt_p | pointer to edt device structure returned by edt_open or edt_open_channel | |
build | a string large enough to hold the build information (128 bytes is sufficient). | |
size | the size, in bytes, of the user-allocated string |
int edt_get_driver_version | ( | EdtDev * | edt_p, | |
char * | version, | |||
int | size | |||
) |
Gets the version of the EDT driver.
The version string is the same format as that returned by edt_get_library_version.
edt_p | pointer to edt device structure returned by edt_open or edt_open_channel | |
version | a string large enough to hold the version information (64 bytes is sufficient). | |
size | the size, in bytes, of the user-allocated string |
void edt_get_esn | ( | EdtDev * | edt_p, | |
char * | esn | |||
) |
Retrieve the board's embedded information string from the PCI xilinx information header.
The EDT manufacturer's part numbers is embedded in an unused area of the Xilinx FPGA PROM, and is preserved across reloads (via pciload, hubload, etc.) unless options to overwrite are invoked in one of those utilities. This subroutine retrieves the EDT serial number portion of that information.
The data is an ASCII string, with the following colon-separated fields:
serial number:part number:clock speed:options:revision:interface xilinx:macaddrs:
(To see the information string, run pciload with no arguments.)
edt_p | pointer to edt device structure returned by edt_open | |
esn | the EDT part number without dashes. |
Definition at line 812 of file edt_flash.c.
u_int edt_get_full_board_id | ( | EdtDev * | edt_p, | |
int * | extended_n, | |||
int * | rev_id, | |||
u_int * | extended_data | |||
) |
Gets the mezzanine id including extended data.
edt_p | ||
extended_n | pointer to int to receive the number of extended data elements | |
rev_id | pointer to int to fill in with the mezzanine rev_id | |
extended_data | pointer to array to fill in with extended data elements |
The following values could be returned instead of the mezzanine id, if the mezzanine id couldn't be determined:
MEZZ_ERR_NO_BITFILE | Indicates that no UI bitfile is loaded, so the mezzanine id couldn't be determined.
|
MEZZ_ERR_BAD_BITSTREAM | Indicates an error while looking up the extended board info. Before EDT ticket #95 is fixed, this could also result when the ui bitfile is pciss4test and the mezz. board is 3X3G.
|
MEZZ_ERR_NO_REGISTER | Indicates that a bitfile has been loaded into the UI which doesn't support the extended board id register. All EDT UI bitfiles should support this, so contact EDT if this occurs.
|
MEZZ_UNKN_EXTBDID | Indicates that the board id is extended but the UI bitfile doesn't support this functionality. This is also unlikely - contact EDT if you see this. |
If any of those values are returned, load a bitfile which supports the extended board id register, such as pciss1test, pciss4test, or pciss16test (depending on channels), or 3x3g.bit for the 3X3G board.
int edt_get_library_buildid | ( | EdtDev * | edt_p, | |
char * | build, | |||
int | size | |||
) |
Gets the full build ID of the EDT library.
edt_p | pointer to edt device structure returned by edt_open or edt_open_channel | |
build | a string large enough to hold the build information (128 bytes is sufficient). | |
size | the size, in bytes, of the user-allocated string |
int edt_get_library_version | ( | EdtDev * | edt_p, | |
char * | version, | |||
int | size | |||
) |
Gets the version (number and date) of the EDT library.
edt_p | pointer to edt device structure returned by edt_open or edt_open_channel | |
version | a string large enough to hold the version information (64 bytes is sufficient). | |
size | the size, in bytes, of the user-allocated string |
int edt_get_mezz_bitpath | ( | EdtDev * | edt_p, | |
char * | bitpath, | |||
int | size | |||
) |
Obtains pathname to the currently loaded mezzanine bitfile from the driver.
The edt_bitload sets this string in the driver when a mezzanine bitfile is successfully loaded.
edt_p | pointer to edt device structure returned by edt_open or edt_open_channel | |
bitpath | address of a character buffer of at least 128 bytes | |
size | number of bytes in the above character buffer |
int edt_get_mezz_chan_bitpath | ( | EdtDev * | edt_p, | |
char * | bitpath, | |||
int | size, | |||
int | channel | |||
) |
Obtains pathname to the currently loaded mezzanine bitfile from the driver.
The edt_bitload sets this string in the driver when a mezzanine bitfile is successfully loaded.
edt_p | pointer to edt device structure returned by edt_open or edt_open_channel | |
bitpath | address of a character buffer of at least 128 bytes | |
size | number of bytes in the above character buffer |
void edt_get_osn | ( | EdtDev * | edt_p, | |
char * | osn | |||
) |
Retrieve the board OEM's embedded information string from the PCI xilinx information header.
Some OEMs embed part number or other information about the board in an unused area of the Xilinx FPGA PROM. This information is preserved across reloads (via pciload, hubload, etc.) unless options to overwrite are invoked in one of those utilities. This subroutine retrieves the OEM serial number portion of that information.
edt_p | pointer to edt device structure returned by edt_open | |
osn | the OEM's part number, if present. |
Definition at line 834 of file edt_flash.c.
void edt_get_sns_sector | ( | EdtDev * | edt_p, | |
char * | esn, | |||
char * | osn, | |||
int | sector | |||
) |
Retrieve the board's manufacturer and OEM embedded information strings strings from the PCI xilinx information header.
Certain information about the board, including manufacturer's part number, serial number, clock speed, Xilinx FPGA, and options, is embedded in an unused area of the Xilinx FPGA PROM at the time of manufacture. This information is preserved across reloads (via pciload, hubload, etc.) unless options overwrite are invoked in the utility. This subroutine retrieves EDT and OEM (if present) information. The data is an ASCII string, with the following colon-separated fields:
serial number:part number:clock speed:options:revision:interface xilinx:
(To see the information string, run pciload with no arguments.)
edt_p | pointer to edt device structure returned by edt_open | |
esn | the EDT part number without dashes. | |
osn | the OEM's part number, if present. |
Definition at line 1011 of file edt_flash.c.
int edt_get_xref_info | ( | const char * | path, | |
const char * | pn, | |||
char * | fpga, | |||
char * | sn, | |||
char * | mtype, | |||
char * | moffs, | |||
char * | mcount, | |||
char * | desc, | |||
char * | rsvd1, | |||
char * | rsvd2 | |||
) |
Reads a part number->fpga cross-reference file and provides the fpga and base serial number if a match is found.
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:
part_number fpga serial description (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 # and copies that if so, otherwise sets the first character null.
path | const character array containing path of the xref fpga file (typ. edt_parts.xpn). | |
part_number | character array in which to store the part number, should be 8 or 10 digits. The last 2 digits of 10 digit part no. are the rev no. 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. | |
fpga | a character array (64-bytes is sufficient) into which the fpga will be stored (e.g. xc2s100e' will be returned for the part_number '01901933'). If NULL this parameter will be ignored. | |
serial | a character array into which the base serial number will be stored. An array of 64 bytes is sufficient, or NULL (ignored). | |
mac_type,: | a character array (8 bytes is sufficient) into which the mac address board type (as a character string) will be stored. If NULL this parameter will be ignored. | |
mac_offset,: | a character array (8 bytes is sufficient) into which the mac address offset will be stored. If NULL this parameter will be ignored. | |
nmacs,: | a character array (8 bytes is sufficient) into which the number of mac addresses (as a character string) for this board type will be stored. If NULL this parameter will be ignored. | |
rsvd1,: | reserved | |
rsvd2,: | reserved |
char* edt_idstr | ( | int | id | ) |
Converts the board ID returned by edt_device_id to a human readable form (original version, sans promcode).
For new 'a' boards that used the same devid as older versions (i.e. PCIe8 DV C-Link, PCIe4 DVa c-link, PCIe8 DV CLS) this subroutine will return without the 'a' suffix; therefore this subroutine should no longer be called directly; instead use edt_idstring() to make sure those boards get properly IDd.
id | the board's hardware ID |
char* edt_idstring | ( | int | id, | |
int | promcode | |||
) |
Converts the board ID returned by edt_device_id to a human readable form (new version, with promcode).
Supersedes edt_idstr which didn't take promcode now needed with new 'a' boards, some of which are detected via combination of ID and PROM code.
id | the board's hardware ID | |
promcode | the board's prom code, as defined in libedt.h |
int edt_parse_devinfo | ( | char * | str, | |
Edt_embinfo * | ei | |||
) |
Parse the board's embedded information string.
During manufacturing programming, EDT embeds selected information is embedded into an unused area of the FPGA PROM. This information is preserved across reloads (via pciload, hubload, etc.) unless options to overwrite are invoked in one of those utilities. This subroutine takes as an argument the full information string, as retrieved from edt_get_esn, edt_get_osn or edt_get_sns, into the fields indicated by the Edt_embinfo structure.
(To see the information string, run pciload with no arguments.)
str | embedded inforamtion string, with information from one of the serial number retrieval subroutines (edt_get_esn, etc.) | |
ei | Edt_embinfo structure into which the the parsed information will be put |
Definition at line 2686 of file edt_flash.c.
int edt_parse_unit | ( | const char * | str, | |
char * | dev, | |||
const char * | default_dev | |||
) |
Parses 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 susubroutine to allow users to specify either a unit number alone or a device/unit number concatenation.
For example, if you are using a PCI CD, then either xtest -u 0 or xtest -u pcd0 could both be used, since xtest sends the argument to edt_parse_unit, and the subroutine parses the string and returns the device and unit number separately.
str | device name string from command line. Should be either a unit number ("0" - "8") or device/unit concantenation ("pcd0," "pcd1," etc.) | |
dev | array to hold the device device string; filled in by ths routine. | |
default_dev | device name to use if none is given in the str argument. If NULL, will be filled in by the default device for the package in use. For example, if the code base is from a PCI CD package, the default_dev will be set to "pcd." |
int edt_parse_unit_channel | ( | const char * | instr, | |
char * | dev, | |||
const char * | default_dev, | |||
int * | channel_ptr | |||
) |
parse -u argument returning the device and unit.
instr | The input string. The argument of the -u option (like "0" or "pcd0" for example). | |
dev | An array large enough to hold the device name, which is set by this function. | |
default_dev | The default device to copy to dev if instr doesn't specify device. If NULL, EDT_INTERFACE will be used (which is "pcd" for pcd boards, "pdv" for dv boards, etc.). | |
channel_ptr | The channel specified in instr, or 0 (set by this function). If channel_ptr is NULL or -1, it is ignored and unchanged. |
void edt_perror | ( | char * | errstr | ) |
int edt_set_bitpath | ( | EdtDev * | edt_p, | |
const char * | bitpath | |||
) |
Sets pathname to the currently loaded user interface bitfile in the driver.
edt_p | pointer to edt device structure returned by edt_open or edt_open_channel | |
bitpath | address of a character buffer of at most 128 bytes |
int edt_set_mezz_bitpath | ( | EdtDev * | edt_p, | |
const char * | bitpath | |||
) |
Sets pathname to the currently loaded mezzanine bitfile in the driver.
edt_p | pointer to edt device structure returned by edt_open or edt_open_channel | |
bitpath | address of a character buffer of at most 128 bytes |
int edt_set_mezz_chan_bitpath | ( | EdtDev * | edt_p, | |
const char * | bitpath, | |||
int | channel | |||
) |
Sets pathname to the currently loaded mezzanine bitfile in the driver.
edt_p | pointer to edt device structure returned by edt_open or edt_open_channel | |
bitpath | address of a character buffer of at most 128 bytes | |
channel | which of two channels (0 or 1) this refers to |
int edt_system | ( | const char * | cmdstr | ) |
Performs a UNIX-like system() call which passes the argument strings to a shell or command interpreter, then returns the exit status of the command or the shell so that errors can be detected.
In WINDOWS spawnl() must be used instead of system() for this purpose.