EDT PCD SDK Documentation 6.1.0
libedt.h File Reference

(git ff2fe684, 2023-12-04)

EDT PCI device library. More...

#include "edt_portability.h"
#include "edt_os_utils.h"
#include "driver/edt_pci_devices.h"
#include "driver/edt_shared_types.h"
#include <stdint.h>
#include <stdbool.h>
Include dependency graph for libedt.h:
This graph shows which files directly or indirectly include this file:

Data Structures

struct  edt_pll
 Structure to set up phase locked loop parameters. More...
 
struct  edt_event_handler
 
struct  EdtBoardInfo
 

Macros

#define EDT_READ   0
 
#define EDT_WRITE   1
 

Typedefs

typedef void(* EdtEventFunc) (void *)
 
typedef struct edt_event_handler EdtEventHandler
 
typedef enum edt_io_port EdtIOPort
 Values that represent a port on a card. This is to enforce typed access in C++.
 
typedef struct edt_device * EdtDev
 EDT device handle (an opaque pointer). More...
 

Enumerations

enum  edt_io_port
 Values that represent a port on a card. This is to enforce typed access in C++.
 

Functions

int edt_close (EdtDev edt_p)
 Shut down all pending I/O operations, closes the device or channel and frees all resources associated with the device handle. More...
 
EDT_CHECK_RETURN EdtDev edt_open (const char *device_name, int unit)
 Open the specified EDT board and sets up the device handle. Equivalent to edt_open_device(device_name, unit, channel: 0, verbose: 1). More...
 
EDT_CHECK_RETURN EdtDev edt_open_quiet (const char *device_name, int unit)
 Same as edt_open(), but with fewer log messages. Equivalent to edt_open_device(device_name, unit, channel: 0, verbose: 0). More...
 
EDT_CHECK_RETURN EdtDev edt_open_channel (const char *device_name, int unit, int channel)
 Open a specific DMA channel on the specified EDT board. Equivalent to edt_open_device(device_name, unit, channel, verbose: 1). More...
 
EDT_CHECK_RETURN EdtDev edt_open_device (const char *device_name, int unit, int channel, int verbose)
 Open a specific EDT board and DMA channel. More...
 
void edt_set_port (EdtDev edt_p, EdtIOPort port)
 Set the port number, as distinct from the DMA channel. More...
 
EdtIOPort edt_get_port (EdtDev edt_p)
 Get the port number set by edt_set_port(). More...
 
int edt_read (EdtDev edt_p, void *buf, uint_t size)
 Perform a DMA read from the EDT device. More...
 
int edt_write (EdtDev edt_p, void *buf, uint_t size)
 Perform a DMA write to the EDT device. More...
 
int edt_configure_ring_buffers (EdtDev edt_p, unsigned int bufsize, unsigned int numbufs, unsigned int write_flag)
 Prepare and configure ring buffers for DMA to/from the EDT device. More...
 
int edt_configure_block_buffers (EdtDev edt_p, int bufsize, int numbufs, int write_flag, int header_size, int header_before)
 Prepare and configure ring buffers for DMA, allocating buffers as a single large block, setting the buffer addresses from within that block. More...
 
void edt_set_dmy_wait_for_buffers_callback (EdtDev edt_p, void(*callback)(EdtDev edt_p, void *buf))
 Register a callback to populate the ring buffer with data when edt_wait_for_buffers() is called. More...
 
void edt_set_dmy_reg_read_callback (EdtDev edt_p, uint32_t(*callback)(EdtDev edt_p, uint32_t reg_desc))
 Register a callback to read a simulated register when edt_reg_read() is called. More...
 
void edt_set_dmy_reg_write_callback (EdtDev edt_p, void(*callBack)(EdtDev edt_p, uint32_t reg_desc, uint32_t reg_value))
 Register a callback to write a simulated register when edt_reg_write() is called. More...
 
EDT_CHECK_RETURN void * edt_map_dmamem (EdtDev edt_p)
 Memory-map the entire DMA channel's ring of buffers. More...
 
int edt_disable_ring_buffers (EdtDev edt_p)
 Disable EDT device ring buffers. Pending DMA is cancelled and all data buffers are released. More...
 
int edt_get_numbufs (EdtDev edt_p)
 Get the number of buffers allocated even if by other process (for monitoring from a separate call to edt_open()). More...
 
int edt_reset_ring_buffers (EdtDev edt_p, uint_t bufnum)
 Stop any active DMA then set the ring buffer to restart on buffer bufnum. More...
 
int edt_abort_dma (EdtDev edt_p)
 Stop any active DMA then set the ring buffer to restart on the current buffer. More...
 
int edt_abort_current_dma (EdtDev edt_p)
 Stop any active DMA then set the ring buffer to restart on the next buffer. More...
 
int edt_stop_buffers (EdtDev edt_p)
 Stop DMA transfer after the current buffer has completed. Ring buffer mode remains active, and transfers may be resumed by calling edt_start_buffers(). More...
 
int edt_start_buffers (EdtDev edt_p, uint_t count)
 Start DMA transfers for count number of buffers. More...
 
int edt_set_buffer_size (EdtDev edt_p, uint_t index, uint_t size, uint_t write_flag)
 Change the size or direction of one buffer in a ring. More...
 
unsigned int edt_allocated_size (EdtDev edt_p, int buffer_idx)
 Get the allocated size of the specified buffer. More...
 
int edt_get_total_bufsize (EdtDev edt_p, int bufsize, int header_size)
 Get the total buffer size for block of buffers, in which the memory allocation size is rounded up so all buffers start on a page boundary. This is used to allocate a single contiguous block of DMA buffers. More...
 
void * edt_wait_for_buffers (EdtDev edt_p, int count)
 Blocks until the specified number of buffers have completed. More...
 
int edt_ref_tmstamp (EdtDev edt_p, u_int val)
 Causes application-defined events to show up in the same timeline as driver events when the event history is listed by running setdebug -g. More...
 
int edt_get_timestamp (EdtDev edt_p, edt_timespec_t *ts, u_int bufnum)
 Get the seconds and nanoseconds timestamp of when DMA was completed on the buffer specified by bufnum. More...
 
void * edt_wait_for_next_buffer (EdtDev edt_p)
 Wait for the next buffer that finishes DMA. Depending on how often this routine is called, buffers that have already completed DMA might be skipped. More...
 
void * edt_last_buffer_timed (EdtDev edt_p, edt_timespec_t *ts)
 Like edt_last_buffer() but also returns the time at which the DMA was complete on this buffer. More...
 
void * edt_last_buffer (EdtDev edt_p)
 Wait for the last buffer that has been transferred. Useful if an application cannot keep up with buffer transfer. If this routine is called a second time before another buffer has been transferred, it will block waiting for the next transfer to complete. More...
 
void * edt_wait_buffers_timed (EdtDev edt_p, int count, edt_timespec_t *ts)
 Block until the specified number of buffers have completed. More...
 
int edt_set_buffer (EdtDev edt_p, uint_t bufnum)
 Set which buffer should be started next. Usually done to recover after a timeout, interrupt, or error. More...
 
void * edt_next_writebuf (EdtDev edt_p)
 Get a pointer to the next buffer scheduled for output DMA, in order to fill the buffer with data. More...
 
uint32_t edt_dma_buffers_done_waiting (EdtDev edt_p)
 Get the number of DMA buffers that have been waited for. More...
 
void ** edt_buffer_addresses (EdtDev edt_p)
 Get an array of ring buffer pointers. More...
 
uint32_t edt_done_count (EdtDev edt_p)
 Returns the cumulative count of completed buffer transfers in ring buffer mode. More...
 
void * edt_check_for_buffers (EdtDev edt_p, uint_t count)
 Checks, without blocking, if the specified number of buffers have completed. More...
 
uint16_t edt_get_direction (EdtDev edt_p)
 Get the value of the PCD_DIRA and PCD_DIRB registers. The value from PCD_DIRB is shifted up 8 bits. More...
 
void edt_startdma_reg (EdtDev edt_p, uint_t desc, uint_t val)
 Set the register and value to use at the start of DMA, as set by edt_startdma_action(). More...
 
void edt_enddma_reg (EdtDev edt_p, uint_t desc, uint_t val)
 Sets the register and value to use at the end of dma, as set by edt_enddma_action(). More...
 
void edt_startdma_action (EdtDev edt_p, uint_t val)
 Specifies when to perform the action at the start of a DMA transfer as specified by edt_startdma_reg(). More...
 
void edt_enddma_action (EdtDev edt_p, uint_t val)
 Specifies when to perform the action at the end of a DMA transfer as specified by edt_enddma_reg(). More...
 
int edt_do_timeout (EdtDev edt_p)
 Cause the driver to perform the same actions as it would on a timeout. Partially filled FIFOs will be flushed and DMA will be aborted. More...
 
int edt_timeouts (EdtDev edt_p)
 Get the number of read and write timeouts that have occurred since the last call of edt_open(). More...
 
uint_t edt_get_timeout_count (EdtDev edt_p)
 Get the number of bytes transferred at last timeout. More...
 
int edt_set_timeout_action (EdtDev edt_p, EdtDmaTimeoutAction action)
 Set the driver behavior on a timeout. More...
 
int edt_get_timeout_goodbits (EdtDev edt_p)
 Get the number of good bits in the last long word of a read buffer after the last timeout. This routine is called after a timeout if the timeout action is set to EDT_TIMEOUT_BIT_STROBE. More...
 
int edt_get_goodbits (EdtDev edt_p)
 Get the current number of good bits in the last long word of a read buffer (0 through 31). More...
 
int edt_set_event_func (EdtDev edt_p, enum edt_kernel_event event_type, EdtEventFunc func, void *data, int continuous)
 Define a function to call when an event occurs. More...
 
int edt_remove_event_func (EdtDev edt_p, enum edt_kernel_event event_type)
 Remove an event function previously set with edt_set_event_func(). More...
 
uint_t edt_get_todo (EdtDev edt_p)
 Get the number of buffers that the driver has been told to acquire. More...
 
int edt_ring_buffer_overrun (EdtDev edt_p)
 Determine if DMA has written to more buffers in the ring than user space code has "waited" (edt_wait_for_buffers()) for. Indicates user space code cannot keep up with the DMA transfer rate. More...
 
int edt_set_burst_enable (EdtDev edt_p, int enable)
 Set the burst enable flag, determining whether the DMA master transfers as many words as possible at once, or transfers them one at a time as soon as the data is acquired. More...
 
int edt_get_burst_enable (EdtDev edt_p)
 Get the value of the burst enable flag. More...
 
int edt_set_rtimeout (EdtDev edt_p, int timeout_ms)
 Set the timeout for data receive calls. More...
 
int edt_set_wtimeout (EdtDev edt_p, int timeout_ms)
 Set the timeout for data transmit calls. More...
 
int edt_get_rtimeout (EdtDev edt_p)
 Gets the current read timeout value: the number of milliseconds to wait for DMA reads to complete before returning. More...
 
int edt_get_wtimeout (EdtDev edt_p)
 Gets the current write timeout value: the number of milliseconds to wait for DMA reads to complete before returning. More...
 
uint_t edt_overflow (EdtDev edt_p)
 Get DMA overflow counter from the driver. Reset by edt_reset_counts(). More...
 
uint_t edt_reg_read (EdtDev edt_p, uint_t desc)
 Read a device register. More...
 
void edt_reg_write (EdtDev edt_p, uint_t desc, uint_t val)
 Write a device register. More...
 
uint_t edt_reg_or (EdtDev edt_p, uint_t desc, uint_t mask)
 Perform a register read-modify-write operation in the driver, OR-ing the mask with the register value. More...
 
uint_t edt_reg_and (EdtDev edt_p, uint_t desc, uint_t mask)
 Perform a register read-modify-write operation in the driver, AND-ing the mask with the register value. More...
 
void edt_reg_clearset (EdtDev edt_p, uint_t desc, uint_t mask)
 Toggle the register bits specified in mask, off (0) then on (1). More...
 
void edt_reg_setclear (EdtDev edt_p, uint_t desc, uint_t mask)
 Toggle the register bits specified in mask, on (1) then off (0). More...
 
void edt_intfc_write8 (EdtDev edt_p, uint_t offset, uint8_t data)
 Write 8-bit value to a user interface ("UI") FPGA register. More...
 
uint8_t edt_intfc_read8 (EdtDev edt_p, uint_t offset)
 Read 8-bit value from a user interface ("UI") FPGA register. More...
 
void edt_intfc_write16 (EdtDev edt_p, uint_t offset, uint16_t data)
 Write 16-bit value to a user interface ("UI") FPGA register. More...
 
uint16_t edt_intfc_read16 (EdtDev edt_p, uint_t offset)
 Read 16-bit value from a user interface ("UI") FPGA register. More...
 
void edt_intfc_write32 (EdtDev edt_p, uint_t offset, uint32_t data)
 Write 32-bit value to a user interface ("UI") FPGA register. More...
 
uint32_t edt_intfc_read32 (EdtDev edt_p, uint_t offset)
 Read 32-bit value from a user interface ("UI") FPGA register. More...
 
void edt_bar1_write (EdtDev edt_p, uint32_t offset, uint32_t data)
 A convenience routine to write registers in the PCI BAR1 region. Equivalent to edt_reg_write(edt_p, EDT_BAR1_REG4(offset)), data). More...
 
uint32_t edt_bar1_read (EdtDev edt_p, uint32_t offset)
 A convenience routine to read registers in the PCI BAR1 region. Equivalent to edt_reg_read(edt_p, EDT_BAR1_REG4(offset))). More...
 
void edt_flush_fifo (EdtDev edt_p)
 Flush the board's input and output FIFOs to allow new data transfers to start from a known state. More...
 
int edt_set_firstflush (EdtDev edt_p, int flag)
 Specify whether and when to flush the FIFOs before DMA transfer. By default, the FIFOs are not flushed. However, certain applications may require flushing before a given DMA transfer, or before each transfer. More...
 
int edt_enable_channels (EdtDev edt_p, u_int mask)
 Set DMA channel enable bits in SSD16_CHEN or SSD16_CHEN32 register. More...
 
int edt_enable_channel (EdtDev edt_p, u_int channel)
 Set DMA channel enable bit in SSD16_CHEN or SSD16_CHEN32 register. More...
 
int edt_disable_channels (EdtDev edt_p, u_int mask)
 Clear DMA channel enable bits in SSD16_CHEN or SSD16_CHEN32 register. More...
 
int edt_disable_channel (EdtDev edt_p, u_int channel)
 Clear DMA channel enable bit in SSD16_CHEN or SSD16_CHEN32 register. 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_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...
 
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...
 
uint32_t edt_pci_config_read (EdtDev edt_p, uint8_t offset)
 Read a 32-bit word directly from the board's PCI configuration space. More...
 
int edt_pci_reboot (EdtDev edt_p)
 Attempt to reboot the PCI FPGA. More...
 
u_int edt_get_bufbytecount (EdtDev edt_p, uint32_t *cur_buffer)
 Get the number of bytes read so far into the current buffer. More...
 
int edt_little_endian (void)
 Check if currently running on a little-endian machine. More...
 
int edt_unmapmem (EdtDev edt_p, void *addr, uint32_t size)
 Unmap a PCI BAR region, previously mapped with edt_mapmem(). More...
 
void * edt_mapmem (EdtDev edt_p, uint32_t addr, uint32_t size)
 Map regions of PCI BAR space into the virtual address space of the calling process. More...
 
u_int edt_get_mappable_size (EdtDev edt_p, int bar)
 Get the size of a given PCI base address register (BAR) region. More...
 
int edt_set_max_buffers (EdtDev edt_p, int newmax)
 Change the maximum number of ring buffers that can be allocated. More...
 
int edt_get_max_buffers (EdtDev edt_p)
 Get the maximum number of ring buffers that can be allocated. More...
 
int edt_set_kernel_buffers (EdtDev edt_p, uint_t onoff)
 Set flags in kernel driver to change the way kernel buffers are created and used. More...
 
int edt_get_kernel_buffers (EdtDev edt_p)
 Get the current kbufs state. More...
 
void edt_free_detected_boards_list (void)
 Free memory containing board list created & returned by any of the edt_detect_boards functions. More...
 
const EdtBoardInfoedt_detect_boards (int unit, int *nunits, int verbose)
 Detect all EDT boards in the system. Designed for use by pciload & pciload-like applications. More...
 
const EdtBoardInfoedt_detect_boards_ids (int unit, const enum EDT_PCI_PID *idlist, int *nunits, int verbose)
 Detect any EDT boards in the system that match the given ids. Designed for use by pciload & pciload-like applications. More...
 
void edt_set_trace_regs (EdtDev edt_p, u_int reg_def, u_int state)
 Enable or disable tracing a single reg access in the driver. More...
 
void edt_trace_regs_enable (EdtDev edt_p, u_int state)
 Enable global tracing of register accesses. Individual registers or register types must still be enabled using edt_set_trace_regs(). More...
 
int edtdev_channels_from_type (EdtDev edt_p)
 Get the number of (DMA) channels avaliable for this board type. More...
 

Detailed Description

EDT PCI device library.

Provides a 'C' language interface to the EDT PCI DMA cards to simplify the ring buffer method of reading data. All routines access a specific device, whose handle is created and returned by the edt_open() routine.

Macro Definition Documentation

◆ EDT_READ

#define EDT_READ   0

Flag for edt_configure_ring_buffers() indicates data will be transferred from the EDT card to the Host.

◆ EDT_WRITE

#define EDT_WRITE   1

Flag for edt_configure_ring_buffers() indicates data will be transferred from the Host to the EDT card.

Typedef Documentation

◆ EdtEventFunc

typedef void(* EdtEventFunc) (void *)

Event callback function type.

◆ EdtEventHandler

Event handler configuration.

◆ EdtDev

typedef struct edt_device* EdtDev

EDT device handle (an opaque pointer).

See also
edt_open(), edt_open_device(), edt_close(), Open / Close

Function Documentation

◆ edt_pci_config_read()

uint32_t edt_pci_config_read ( EdtDev  edt_p,
uint8_t  offset 
)

Read a 32-bit word directly from the board's PCI configuration space.

Note that this does not allow for reading past the first 64 bytes.

Parameters
edt_pThe open EDT device handle.
offsetOffset in the PCI configuration space to read from. Must be 32-bit aligned (lower 2 bits clear). Max value is 0x3C (60).
Returns
Value read from config space, or UINT32_MAX if offset is invalid.

◆ edt_pci_reboot()

int edt_pci_reboot ( EdtDev  edt_p)

Attempt to reboot the PCI FPGA.

Parameters
edt_pThe open EDT device handle.
Returns
0 on success, -1 on failure
Here is the call graph for this function:

◆ edt_get_bufbytecount()

u_int edt_get_bufbytecount ( EdtDev  edt_p,
uint32_t *  cur_buffer 
)

Get the number of bytes read so far into the current buffer.

Can be used to monitor how much data has been read into the buffer during acquisition.

Parameters
edt_pThe open EDT device handle.
[out]cur_bufferCurrent buffer's index is returned here. Pass NULL if buffer number is not needed.
Returns
The number of bytes transferred.

◆ edt_little_endian()

int edt_little_endian ( void  )

Check if currently running on a little-endian machine.

Returns
True (1) if machine is little-endian.
Here is the call graph for this function:

◆ edt_unmapmem()

int edt_unmapmem ( EdtDev  edt_p,
void *  addr,
uint32_t  size 
)

Unmap a PCI BAR region, previously mapped with edt_mapmem().

On Linux, all pages containing a part of the indicated range are unmapped, and subsequent references to these pages will generate segmentation fault errors.

On Windows, if the indicated range does not match the range originally requested (e.g. size does not match) then nothing is un-mapped and an error is returned.

Parameters
addrVirtual address to unmap. Must be a multiple of the page size (but size need not be).
sizeSize of the region to unmap.
Returns
0 on success.

◆ edt_mapmem()

void * edt_mapmem ( EdtDev  edt_p,
uint32_t  addr,
uint32_t  size 
)

Map regions of PCI BAR space into the virtual address space of the calling process.

Calls mmap() on UNIX, or a driver ioctl on Windows.

Parameters
edt_pThe open EDT device handle.
addrSelects the region and offset of a BAR to mmap.
  • (0 >= addr <0x10000) PCI BAR0 region.
  • (0x10000 >= addr < PDMA_OFFSET) PCI BAR1 region.
  • (addr >= PDMA_OFFSET) Undefined, do not use.
sizeSize (in bytes) of the region to memory map. Use @reg edt_get_mappable_size() to get the size of a given PCI BAR.
Returns
Pointer to the mapped area on success. NULL on error.
See also
edt_map_dmamem(), edt_get_mappable_size()

◆ edt_get_mappable_size()

u_int edt_get_mappable_size ( EdtDev  edt_p,
int  bar 
)

Get the size of a given PCI base address register (BAR) region.

Similar to Linux kernel's pci_resource_len() function.

Parameters
edt_pThe open EDT device handle.
barIndex of the BAR to query. Must be either 0 or 1.
Returns
The byte length of the PCI bar region.

◆ edt_set_max_buffers()

int edt_set_max_buffers ( EdtDev  edt_p,
int  newmax 
)

Change the maximum number of ring buffers that can be allocated.

The absolute maximum is 1024.

Parameters
edt_pThe open EDT device handle.
newmaxNew maximum, up to 1024.
Returns
0 on success.
See also
edt_configure_ring_buffers(), edt_get_max_buffers()

The default number of buffers differs depending on the EDT device being accessed, and is set to a conservative limit meant to ensure that too many system resources are not consumed. However, application and system architecture may indicate more buffers so this call is provided to up the number.

Here is the call graph for this function:

◆ edt_get_max_buffers()

int edt_get_max_buffers ( EdtDev  edt_p)

Get the maximum number of ring buffers that can be allocated.

Parameters
edt_pThe open EDT device handle.
Returns
The maximum number of buffers that can be allocated, or -1 on failure.
See also
edt_configure_ring_buffers(), edt_set_max_buffers()

◆ edt_set_kernel_buffers()

int edt_set_kernel_buffers ( EdtDev  edt_p,
uint_t  onoff 
)

Set flags in kernel driver to change the way kernel buffers are created and used.

Parameters
edt_pThe open EDT device handle.
onoffBitfield of EDT_USER_BUFS, EDT_COPY_KBUFS, EDT_MMAP_KBUFS.
Returns
0 on success, -1 on failure

◆ edt_get_kernel_buffers()

int edt_get_kernel_buffers ( EdtDev  edt_p)

Get the current kbufs state.

Parameters
edt_pThe open EDT device handle.
Returns
Current kbuf state.

◆ edt_free_detected_boards_list()

void edt_free_detected_boards_list ( void  )

Free memory containing board list created & returned by any of the edt_detect_boards functions.

See also
edt_detect_boards(), edt_detect_boards_id(), edt_detect_boards_ids()
Here is the caller graph for this function:

◆ edt_detect_boards()

const EdtBoardInfo * edt_detect_boards ( int  unit,
int *  nunits,
int  verbose 
)

Detect all EDT boards in the system. Designed for use by pciload & pciload-like applications.

Note
This is a wrapper of edt_detect_boards_ids().
Parameters
unitA specific unit to find, or -1 for any unit that matches.
[out]nunitsReturns the number of units found.
verboseEnable (1) verbose output.
Returns
Array of zero or more EdtBoardInfo structs, each with a detected board that meets the given parameters. NULL on error. Free with edt_free_detected_boards_list().
Here is the call graph for this function:

◆ edt_detect_boards_ids()

const EdtBoardInfo * edt_detect_boards_ids ( int  unit,
const enum EDT_PCI_PID idlist,
int *  nunits,
int  verbose 
)

Detect any EDT boards in the system that match the given ids. Designed for use by pciload & pciload-like applications.

Parameters
unitA specific unit to find, or -1 for any unit that matches.
[in]idlistList of device ids to search for. The last ID in the list must be EDT_PCI_UNKNOWN_ID to mark the end of the list. Pass NULL to search for all/any EDT devices.
[out]nunitsReturns the number of units found.
verboseEnable (1) verbose output.
Returns
Array of zero or more EdtBoardInfo structs, each with a detected board that meets the given parameters. NULL on error. Free with edt_free_detected_boards_list().
Here is the call graph for this function:
Here is the caller graph for this function:

◆ edt_set_trace_regs()

void edt_set_trace_regs ( EdtDev  edt_p,
u_int  reg_def,
u_int  state 
)

Enable or disable tracing a single reg access in the driver.

Parameters
edt_pThe open EDT device handle.
reg_defIf reg_def ends in 0xffff, trace all register accesses of that type.
state1 enable tracing, 0 disable tracing.

◆ edt_trace_regs_enable()

void edt_trace_regs_enable ( EdtDev  edt_p,
u_int  state 
)

Enable global tracing of register accesses. Individual registers or register types must still be enabled using edt_set_trace_regs().

Parameters
edt_pThe open EDT device handle.
stateEnable (1) or disable (0) global register trace flag in the driver.

◆ edtdev_channels_from_type()

int edtdev_channels_from_type ( EdtDev  edt_p)

Get the number of (DMA) channels avaliable for this board type.

Parameters
edt_pThe open EDT device handle.
Returns
The number of channels for this board's device ID.
See also
edt_device_id()