Defines | |
| #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_dvfox(edt_p) (ID_IS_DVFOX(edt_p->devid)) |
| #define | edt_is_pcd(edt_p) (ID_IS_PCD(edt_p->devid)) |
| #define | edt_is_pdv(edt_p) (ID_IS_PDV(edt_p->devid)) |
Functions | |
| int | edt_access (char *fname, int perm) |
| Determines file access, independent of operating system. | |
| uchar_t * | edt_alloc (int size) |
| Convenience routine to allocate memory in a system-independent way. | |
| void | edt_back_to_fwd (char *str) |
| back_to_fwd: for use by edt_correct_slashes | |
| int | edt_check_version (EdtDev *edt_p) |
| compares version strings between library and driver, returns 0 if they aren't the same | |
| void | edt_closedir (DIRHANDLE h) |
| Cross platform function to close a directory handle. | |
| void | edt_correct_slashes (char *str) |
| change the slashes from forward to back or vice versa depending on whether it's Wind*ws or Un*x | |
| int | edt_device_id (EdtDev *edt_p) |
| Gets the device ID of the specified device. | |
| double | edt_dtime (void) |
| return time in seconds since last call | |
| double | edt_elapsed (u_char reset) |
| Like edt_dtime, but doesn't reset start time unless requested. | |
| u_int | edt_errno (void) |
| Returns an operating system-dependent error number. | |
| 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. | |
| int | edt_fix_millennium (char *str, int rollover) |
| given a date string in the format yy/mm/dd or yyy/mm/dd or yyyy/mm/dd, correct for the millenium. | |
| char * | edt_fmt_pn (char *pn, char *pn_str) |
| Takes a part number portion of the embedded infrormation string, as retrieved from the PCI xilinx information header via edt_get_sns; reformats and returns it in a "human readable" form (dashes added). | |
| void | edt_free (uchar_t *ptr) |
| Convenience routine to free the memory allocated with edt_alloc. | |
| void | edt_fwd_to_back (char *str) |
| fwd_to_back: for use by edt_correct_slashes | |
| 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. | |
| 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 (EdtDev *edt_p, char *esn, char *osn) |
| Retrieve the board's manufacturer and OEM embedded information strings strings from the PCI xilinx information header. | |
| void | edt_get_sns_sector (EdtDev *edt_p, char *esn, char *osn, int sector) |
| char * | edt_idstr (int id) |
| Converts the board ID returned by edt_device_id to a human readable form. | |
| void | edt_msleep (int msecs) |
| Causes the process to sleep for the specified number of milliseconds. | |
| DIRHANDLE | edt_opendir (char *dirname) |
| Cross platform function to open a directory for reading. | |
| uint_t | edt_overflow (EdtDev *edt_p) |
| int | edt_parse_esn (char *str, Edt_embinfo *ei) |
| Parse the board's embedded information string. | |
| 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_readdir (DIRHANDLE h, char *name) |
| Cross platform function to read the next directory entry. | |
| 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. | |
| 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. | |
| double | edt_timestamp (void) |
| Gets the seconds + fractional seconds since the Epoch, OS independent. | |
| char * | edt_timestring (u_int *timep) |
| void | edt_usec_busywait (u_int usec) |
| void | edt_usleep (int usecs) |
| causes process to sleep for specified number of microseconds | |
| 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");
| uchar_t* edt_alloc | ( | int | size | ) |
Convenience routine to allocate memory in a system-independent way.
The buffer returned is page aligned. Uses VirtualAlloc on Windows NT systems, valloc on UNIX-based systems.
| size,: | number of bytes of memory to allocate. |
| 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 |
| double edt_elapsed | ( | u_char | reset | ) |
| 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 * | 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. |
| int edt_fix_millennium | ( | char * | str, | |
| int | rollover | |||
| ) |
given a date string in the format yy/mm/dd or yyy/mm/dd or yyyy/mm/dd, correct for the millenium.
Will only work for the next 100 years or less, depending on rollover.
Definition at line 2581 of file edt_xilinx.c.
| char* edt_fmt_pn | ( | char * | pn, | |
| char * | str | |||
| ) |
Takes a part number portion of the embedded infrormation string, as retrieved from the PCI xilinx information header via edt_get_sns; reformats and returns it in a "human readable" form (dashes added).
A simple subroutine mainly for use by pciload and other EDT utility programs, but available for use by user apps if desired.
The string returned is valid until the next invocation of this function.
| pn | the part number without dashes. | |
| str | the output string, which should be at least 13 characters long |
Definition at line 192 of file edt_xilinx.c.
| void edt_free | ( | uchar_t * | ptr | ) |
| 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:
(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 2400 of file edt_xilinx.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 2422 of file edt_xilinx.c.
| void edt_get_sns | ( | EdtDev * | edt_p, | |
| char * | esn, | |||
| char * | osn | |||
| ) |
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 2539 of file edt_xilinx.c.
| void edt_msleep | ( | int | msecs | ) |
Causes the process to sleep for the specified number of milliseconds.
| msecs | The number of milliseconds for the process to sleep. |
| DIRHANDLE edt_opendir | ( | char * | dirname | ) |
| 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 2461 of file edt_xilinx.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_readdir | ( | DIRHANDLE | dirphandle, | |
| char * | name | |||
| ) |
Cross platform function to read the next directory entry.
| dirphandle | a handle for the directory, returned by edt_opendir | |
| name | a pointer to a string into which the name of the next file in the directory will be written. The string must be allocated by the caller to at least 256 bytes. |
| 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.
| double edt_timestamp | ( | void | ) |
| void edt_usleep | ( | int | usecs | ) |
1.5.1