Defines | |
| #define | edt_is_pdv(edt_p) (ID_IS_PDV(edt_p->devid)) |
| #define | edt_is_pcd(edt_p) (ID_IS_PCD(edt_p->devid)) |
| #define | edt_is_dvfox(edt_p) (ID_IS_DVFOX(edt_p->devid)) |
| #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_dv_multichannel(edt_p) (edt_is_dvcl(edt_p) || edt_is_dvfox(edt_p) || edt_p->devid == PDVAERO_ID) |
Functions | |
| int | edt_device_id (EdtDev *edt_p) |
| Gets the device ID of the specified device. | |
| char * | edt_idstr (int id) |
| Converts the board ID returned by edt_device_id to a human readable form. | |
| 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. | |
| int | edt_find_xpn (char *partnum, char *xilinx) |
| ` Reads file 'edt_parts.xpn', comparing entries with part number, returns matching xilinx in argument 'xilinx' if match is found. | |
| uint_t | edt_overflow (EdtDev *edt_p) |
| void | edt_perror (char *str) |
| Formats and prints a system error. | |
| u_int | edt_errno (void) |
| Returns an operating system-dependent error number. | |
| char * | edt_timestring (u_int *timep) |
| 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. | |
| int | edt_parse_esn (char *str, Edt_embinfo *ei) |
| Parse the board's embedded information string. | |
| void | edt_get_sns (EdtDev *edt_p, char *esn, char *osn) |
| 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. | |
| 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_esn (EdtDev *edt_p, char *esn) |
| Retrieve the board's embedded information string from the PCI xilinx information header. | |
| int | edt_set_bitpath (EdtDev *edt_p, const char *bitpath) |
| Sets pathname to the currently loaded user interface bitfile in the driver. | |
| int | edt_get_bitpath (EdtDev *edt_p, char *bitpath, int size) |
| Obtains pathname to the currently loaded interface bitfile from the driver. | |
| 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_set_mezz_chan_bitpath (EdtDev *edt_p, const char *bitpath, int channel) |
| Sets pathname to the currently loaded mezzanine bitfile in 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. | |
| int | edt_set_mezz_bitpath (EdtDev *edt_p, const char *bitpath) |
| Sets pathname to the currently loaded mezzanine bitfile in the driver. | |
| int | edt_get_mezz_bitpath (EdtDev *edt_p, char *bitpath, int size) |
| Obtains pathname to the currently loaded mezzanine bitfile from the driver. | |
| char * | edt_get_last_bitpath (EdtDev *edt_p) |
| 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. | |
| u_int | edt_get_board_id (EdtDev *edt_p) |
| Gets the mezzanine id. | |
| u_int | edt_set_mezz_id (EdtDev *edt_p) |
| u_int | edt_get_mezz_id (EdtDev *edt_p) |
| int | edt_get_driver_version (EdtDev *edt_p, char *versionstr, int size) |
| Gets the version of the EDT driver. | |
| int | edt_get_driver_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_library_buildid (EdtDev *edt_p, char *build, int size) |
| Gets the full build ID of the EDT library. | |
| int | edt_check_version (EdtDev *edt_p) |
| compares version strings between library and driver, returns 0 if they aren't the same | |
| u_int | edt_get_dma_info (EdtDev *edt_p, edt_dma_info *dmainfo) |
| Gets information about active dma. | |
| 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 |
| 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. |
| int edt_find_xpn | ( | char * | part_number, | |
| char * | xilinx | |||
| ) |
` Reads file 'edt_parts.xpn', comparing entries with part number, returns matching xilinx in argument 'xilinx' if match is found.
File should be ASCII text, space delimited, one line per entry, as follows:
part_number xilinx description
anything after the second space is ignored, and can be blank but should be the description (name of the device)
| part_number | should be 8 or 10 digits. The last 2 digits of 10 digit part number are rev number. If a match with a 10-digit number is found, return immediately. If no 10-digit match is found but an 8-digit is found, returns with that. That way we can have some numbers return a match regardless of rev, and others that cover a specific rev that takes precedence. | |
| xilinx | is a character array into which the xilinx 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. |
| void edt_perror | ( | char * | errstr | ) |
| 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_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.
| int edt_parse_esn | ( | 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 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 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 2142 of file edt_xilinx.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 901 of file edt_xilinx.c.
| 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 747 of file edt_xilinx.c.
| 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:
(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 725 of file edt_xilinx.c.
| 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_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 |
| 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_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_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 |
| 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_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 |
| 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.
| u_int edt_get_board_id | ( | EdtDev * | edt_p | ) |
| 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 |
| 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_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_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 |
| 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"); }
1.4.7