EDT PDV SDK Documentation 6.2.0
Register Access

Functions

uint32_t edt_reg_read (EdtDev edt_p, uint32_t desc)
 Read a device register. More...
 
void edt_reg_write (EdtDev edt_p, uint32_t desc, uint32_t val)
 Write a device register. More...
 
uint32_t edt_reg_or (EdtDev edt_p, uint32_t desc, uint32_t mask)
 Perform a register read-modify-write operation in the driver, OR-ing the mask with the register value. More...
 
uint32_t edt_reg_and (EdtDev edt_p, uint32_t desc, uint32_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, uint32_t desc, uint32_t mask)
 Toggle the register bits specified in mask, off (0) then on (1). More...
 
void edt_reg_setclear (EdtDev edt_p, uint32_t desc, uint32_t mask)
 Toggle the register bits specified in mask, on (1) then off (0). More...
 
void edt_intfc_write8 (EdtDev edt_p, uint32_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, uint32_t offset)
 Read 8-bit value from a user interface ("UI") FPGA register. More...
 
void edt_intfc_write16 (EdtDev edt_p, uint32_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, uint32_t offset)
 Read 16-bit value from a user interface ("UI") FPGA register. More...
 
void edt_intfc_write32 (EdtDev edt_p, uint32_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, uint32_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...
 

Detailed Description

Register access functions.

Function Documentation

◆ edt_reg_read()

uint32_t edt_reg_read ( EdtDev  edt_p,
uint32_t  desc 
)

Read a device register.

Parameters
edt_pThe open EDT device handle.
descThe name of the register to read. Use the names provided in the register descriptions in documentation for the card you are using. Or, register descriptor values can be constructed with macros such as EDT_BAR1_REG4 or EDT_IND_REG_1.
Returns
The (4-byte) value of register.

◆ edt_reg_write()

void edt_reg_write ( EdtDev  edt_p,
uint32_t  desc,
uint32_t  val 
)

Write a device register.

Warning
Use this routine with care; it writes directly to the hardware. An incorrect value can crash your system, possibly causing loss of data.
Parameters
edt_pThe open EDT device handle.
descThe name of the register to write. Use the names provided in the register descriptions in documentation for the card you are using. Or, register descriptor values can be constructed with macros such as EDT_BAR1_REG4 or EDT_IND_REG_1.
valueThe value to write to the register.

◆ edt_reg_or()

uint32_t edt_reg_or ( EdtDev  edt_p,
uint32_t  desc,
uint32_t  mask 
)

Perform a register read-modify-write operation in the driver, OR-ing the mask with the register value.

Parameters
edt_pThe open EDT device handle.
descThe name of the register to modify.
maskThe value to OR with the register.
Returns
The value written back to the register.

◆ edt_reg_and()

uint32_t edt_reg_and ( EdtDev  edt_p,
uint32_t  desc,
uint32_t  mask 
)

Perform a register read-modify-write operation in the driver, AND-ing the mask with the register value.

Parameters
edt_pThe open EDT device handle.
descThe name of the register to modify.
maskThe value to AND with the register.
Returns
The value written back to the register.

◆ edt_reg_clearset()

void edt_reg_clearset ( EdtDev  edt_p,
uint32_t  desc,
uint32_t  mask 
)

Toggle the register bits specified in mask, off (0) then on (1).

Parameters
edt_pThe open EDT device handle.
descThe name of the register to modify.
maskBits set in this mask indicate which bits in the register to toggle.

◆ edt_reg_setclear()

void edt_reg_setclear ( EdtDev  edt_p,
uint32_t  desc,
uint32_t  mask 
)

Toggle the register bits specified in mask, on (1) then off (0).

Parameters
edt_pThe open EDT device handle.
descThe name of the register to modify.
maskBits set in this mask indicate which bits in the register to toggle.

◆ edt_intfc_write8()

void edt_intfc_write8 ( EdtDev  edt_p,
uint32_t  offset,
uint8_t  data 
)

Write 8-bit value to a user interface ("UI") FPGA register.

Parameters
edt_pThe open EDT device handle.
offsetInteger offset into user interface FPGA space, or edt_reg_write() style register descriptor.
data8-bit value to write to the register.

A convenience routine, partly for backward compatability. The register descriptors used by edt_reg_write() can also be used, since this function masks off the offset.

Example:

uint8_t fnct1 = 1;
edt_intfc_write8(edt_p, PCD_FUNCT, fnct1);
See also
edt_intfc_read8(), edt_reg_write(), edt_intfc_write16()

◆ edt_intfc_read8()

uint8_t edt_intfc_read8 ( EdtDev  edt_p,
uint32_t  offset 
)

Read 8-bit value from a user interface ("UI") FPGA register.

Parameters
edt_pThe open EDT device handle.
offsetInteger offset into user interface FPGA space, or edt_reg_read() style register descriptor.
Returns
8-bit value read from the register.

A convenience routine, partly for backward compatability. The register descriptors used by edt_reg_read() can also be used, since this function masks off the offset.

Example:

uint8_t func_reg = edt_intfc_read8(edt_p, PCD_FUNC);
See also
edt_intfc_write8(), edt_reg_read(), edt_intfc_read16()

◆ edt_intfc_write16()

void edt_intfc_write16 ( EdtDev  edt_p,
uint32_t  offset,
uint16_t  data 
)

Write 16-bit value to a user interface ("UI") FPGA register.

Parameters
edt_pThe open EDT device handle.
offsetInteger offset into user interface FPGA space, or edt_reg_write() style register descriptor.
data16-bit value to write to the register.

A convenience routine, partly for backward compatability. The register descriptors used by edt_reg_write() can also be used, since this function masks off the offset.

Example:

puts("Enabling all 16 DMA channels on PCDa with 'ssdio.bit'
loaded in user interface xilinx");
edt_intfc_write16(edt_p, SSD16_CHEN, 0xffff);
See also
edt_intfc_write8(), edt_reg_write()

◆ edt_intfc_read16()

uint16_t edt_intfc_read16 ( EdtDev  edt_p,
uint32_t  offset 
)

Read 16-bit value from a user interface ("UI") FPGA register.

Parameters
edt_pThe open EDT device handle.
offsetInteger offset into user interface FPGA space, or edt_reg_read() style register descriptor.
Returns
16-bit value read from the register.

A convenience routine, partly for backward compatability. The register descriptors used by edt_reg_read() can also be used, since this function masks off the offset.

Example:

puts("Directions for each channel of 16-channel card using
user interface firmware 'ssdio.bit':");
uint16_t channel_direction_reg = edt_intfc_read16(edt_p, SSD16_CHDIR);
for (int i = 0; i < 16; i++) {
int dir = channel_dir_reg & (1 << i);
printf("Channel %d configured for: ", i);
if (dir == 0) {
printf("input\n");
} else {
printf("output");
}
}
See also
edt_intfc_read8, edt_reg_read

◆ edt_intfc_write32()

void edt_intfc_write32 ( EdtDev  edt_p,
uint32_t  offset,
uint32_t  data 
)

Write 32-bit value to a user interface ("UI") FPGA register.

Parameters
edt_pThe open EDT device handle.
offsetInteger offset into user interface FPGA space, or edt_reg_read() style register descriptor.
data32-bit value to write to the register.

A convenience routine, partly for backward compatability. The register descriptors used by edt_reg_write() can also be used, since this function masks off the offset.

See also
edt_intfc_read32, edt_reg_write

◆ edt_intfc_read32()

uint32_t edt_intfc_read32 ( EdtDev  edt_p,
uint32_t  offset 
)

Read 32-bit value from a user interface ("UI") FPGA register.

Parameters
edt_pThe open EDT device handle.
offsetInteger offset into user interface FPGA space, or edt_reg_read() style register descriptor.
Returns
32-bit value read from the register.

A convenience routine, partly for backward compatability. The register descriptors used by edt_reg_read() can also be used, since this function masks off the offset.

◆ edt_bar1_write()

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).

Parameters
edt_pThe open EDT device handle.
offsetByte offset into PCI BAR1 register memory, addressing a 32-bit value. The least-significant two bits are ignored (masked off).
data32-bit value to write to the register.

Example:

uint32_t reg24 = 0xb01d_bee;
edt_bar1_write(edt_p, 0x24, reg24);
See also
edt_bar1_read(), edt_reg_write(), EDT_BAR1_REG4

◆ edt_bar1_read()

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))).

Parameters
edt_pThe open EDT device handle.
offsetByte offset into PCI BAR1 register memory, addressing a 32-bit value. The least-significant two bits are ignored (masked off).
Returns
32-bit value read from the register.

Example:

uint32_t reg24 = edt_bar1_read(edt_p, 0x24);
See also
edt_bar1_write(), edt_reg_read(), EDT_BAR1_REG4