CAEN FERS Library v1.1.4
SDK for FERS systems
Read/Write registers
Collaboration diagram for Read/Write registers:

Functions

int FERS_ReadRegister (int handle, uint32_t address, uint32_t *data)
 Read a register of a FERS board. More...
 
int FERS_WriteRegister (int handle, uint32_t address, uint32_t data)
 Write a register of a FERS board. More...
 
int FERS_WriteRegisterSlice (int handle, uint32_t address, uint32_t start_bit, uint32_t stop_bit, uint32_t data)
 Write a slice of a register of a FERS board. More...
 
int FERS_SendCommand (int handle, uint32_t cmd)
 
Send a command to the board More...
 
int FERS_SendCommandBroadcast (int *handle, uint32_t cmd, uint32_t delay)
 Send a broadcast command to multiple boards connected to a concentrator. More...
 
int FERS_I2C_ReadRegister (int handle, uint32_t i2c_dev_addr, uint32_t reg_addr, uint32_t *reg_data)
 Read a register of an I2C register (picoTDC, PLL, ...) More...
 
int FERS_I2C_WriteRegister (int handle, uint32_t i2c_dev_addr, uint32_t reg_addr, uint32_t reg_data)
 Write a register of an I2C register (picoTDC, PLL, ...) More...
 
int FERS_I2C_WriteRegisterSlice (int handle, uint32_t i2c_dev_addr, uint32_t address, uint32_t start_bit, uint32_t stop_bit, uint32_t data)
 Write a slice of a register of an I2C device. More...
 
int FERS_ReadFlashPage (int handle, int pagenum, int size, uint8_t *data)
 Read a page from the flash memory. More...
 
int FERS_WriteFlashPage (int handle, int pagenum, int size, uint8_t *data)
 Write a page of the flash memory. More...
 
int FERS_XROC_WriteRegister (int handle, int page_addr, int sub_addr, uint8_t data)
 Write a register of the XROC ASIC chip via I2C. More...
 
int FERS_XROC_ReadRegister (int handle, int page_addr, int sub_addr, uint8_t *data)
 Read a register of the XROC ASIC chip via I2C. More...
 
int FERS_XROC_WriteRegisterSilce (int handle, int page_addr, int sub_addr, uint32_t start_bit, uint32_t stop_bit, uint8_t data)
 Write a register slice of the XROC ASIC chip via I2C. More...
 
int FERS_ReadConcentratorInfo (int handle, FERS_CncInfo_t *cinfo)
 Read concentrator info from the device. More...
 
int FERS_WriteBoardInfo (int handle, FERS_BoardInfo_t binfo)
 Write Board info into the relevant flash memory page. More...
 

Detailed Description

Function Documentation

◆ FERS_ReadRegister()

int FERS_ReadRegister ( int  handle,
uint32_t  address,
uint32_t *  data 
)

Read a register of a FERS board.

Parameters
[out]dataregister data
[in]handledevice handle
[in]addressregister address
Returns
0 in case of success, or a negative error code specified in FERSLIB_ErrorCodes

◆ FERS_WriteRegister()

int FERS_WriteRegister ( int  handle,
uint32_t  address,
uint32_t  data 
)

Write a register of a FERS board.

Parameters
[in]handledevice handle
[in]addressregister address
[in]dataregister data
Returns
0 in case of success, or a negative error code specified in FERSLIB_ErrorCodes

◆ FERS_WriteRegisterSlice()

int FERS_WriteRegisterSlice ( int  handle,
uint32_t  address,
uint32_t  start_bit,
uint32_t  stop_bit,
uint32_t  data 
)

Write a slice of a register of a FERS board.

Parameters
[in]handledevice handle
[in]addressregister address
[in]start_bitfirst bit of the slice (included)
[in]stop_bitlast bit of the slice (included)
[in]dataslice data
Returns
0 in case of success, or a negative error code specified in FERSLIB_ErrorCodes

◆ FERS_SendCommand()

int FERS_SendCommand ( int  handle,
uint32_t  cmd 
)


Send a command to the board

Parameters
[in]handledevice handle
[in]cmdcommand opcode
Returns
0 in case of success, or a negative error code specified in FERSLIB_ErrorCodes

◆ FERS_SendCommandBroadcast()

int FERS_SendCommandBroadcast ( int *  handle,
uint32_t  cmd,
uint32_t  delay 
)

Send a broadcast command to multiple boards connected to a concentrator.

Parameters
[in]handledevice handles of all the board that should receive the command
[in]cmdcommand opcode
[in]delayexecution delay (0 for automatic)
Returns
0 in case of success, or a negative error code specified in FERSLIB_ErrorCodes

◆ FERS_I2C_ReadRegister()

int FERS_I2C_ReadRegister ( int  handle,
uint32_t  i2c_dev_addr,
uint32_t  reg_addr,
uint32_t *  reg_data 
)

Read a register of an I2C register (picoTDC, PLL, ...)

Parameters
[out]reg_dataregister data
[in]handledevice handle
[in]i2c_dev_addrI2C device address (7 bit)
[in]reg_addrregister address (in the device)
Returns
0 in case of success, or a negative error code specified in FERSLIB_ErrorCodes

◆ FERS_I2C_WriteRegister()

int FERS_I2C_WriteRegister ( int  handle,
uint32_t  i2c_dev_addr,
uint32_t  reg_addr,
uint32_t  reg_data 
)

Write a register of an I2C register (picoTDC, PLL, ...)

Parameters
[in]handledevice handle
[in]i2c_dev_addrI2C device address (7 bit)
[in]reg_addrregister address (in the device)
[in]reg_dataregister data
Returns
0 in case of success, or a negative error code specified in FERSLIB_ErrorCodes

◆ FERS_I2C_WriteRegisterSlice()

int FERS_I2C_WriteRegisterSlice ( int  handle,
uint32_t  i2c_dev_addr,
uint32_t  address,
uint32_t  start_bit,
uint32_t  stop_bit,
uint32_t  data 
)

Write a slice of a register of an I2C device.

Parameters
[in]handledevice handle
[in]i2c_dev_addrI2C device address (7 bit)
[in]addressregister address (in the device)
[in]start_bitfirst bit of the slice (included)
[in]stop_bitlast bit of the slice (included)
[in]dataslice data
Returns
0 in case of success, or a negative error code specified in FERSLIB_ErrorCodes

◆ FERS_ReadFlashPage()

int FERS_ReadFlashPage ( int  handle,
int  pagenum,
int  size,
uint8_t *  data 
)

Read a page from the flash memory.

Parameters
[out]dataBuffer to store the read data
[in]handleHandle to the FERS device
[in]pagenumPage number to read
[in]sizeNumber of bytes to read
Returns
0 on success, or a negative error code as defined in FERSLIB_ErrorCodes

◆ FERS_WriteFlashPage()

int FERS_WriteFlashPage ( int  handle,
int  pagenum,
int  size,
uint8_t *  data 
)

Write a page of the flash memory.

Warning
The flash memory contains vital parameters for the board. Overwriting certain pages can damage the hardware!!! Do no use this function withou contacting CAEN first
Parameters
[in]handleHandle to the FERS device
[in]pagenumPage number to write
[in]sizeNumber of bytes to write
[in]dataBuffer containing the data to write
Returns
0 on success, or a negative error code as defined in FERSLIB_ErrorCodes

◆ FERS_XROC_WriteRegister()

int FERS_XROC_WriteRegister ( int  handle,
int  page_addr,
int  sub_addr,
uint8_t  data 
)

Write a register of the XROC ASIC chip via I2C.

Parameters
[in]handleHandle to the FERS device
[in]page_addrPage address of the register, indentifies the register group
[in]sub_addrSub-address of the register, identifies the register in the page
[in]dataData to write
Returns
0 on success, or a negative error code as defined in FERSLIB_ErrorCodes

◆ FERS_XROC_ReadRegister()

int FERS_XROC_ReadRegister ( int  handle,
int  page_addr,
int  sub_addr,
uint8_t *  data 
)

Read a register of the XROC ASIC chip via I2C.

Parameters
[out]dataPointer to store the read value
[in]handleHandle to the FERS device
[in]page_addrPage address of the register, identifies the register group
[in]sub_addrSub-address of the register, identifies the register in the page
Returns
0 on success, or a negative error code as defined in FERSLIB_ErrorCodes

◆ FERS_XROC_WriteRegisterSilce()

int FERS_XROC_WriteRegisterSilce ( int  handle,
int  page_addr,
int  sub_addr,
uint32_t  start_bit,
uint32_t  stop_bit,
uint8_t  data 
)

Write a register slice of the XROC ASIC chip via I2C.

Parameters
[in]handleHandle to the FERS device
[in]page_addrPage address, identifies the register group
[in]sub_addrSub-address, identifies the register in the page
[in]start_bitFirst bit of the slice (included)
[in]stop_bitLast bit of the slice (included)
[in]dataData to write
Returns
0 on success, or a negative error code as defined in FERSLIB_ErrorCodes

◆ FERS_ReadConcentratorInfo()

int FERS_ReadConcentratorInfo ( int  handle,
FERS_CncInfo_t cinfo 
)

Read concentrator info from the device.

Parameters
[out]cinfoconcentrator info structure
[in]handleconcentrator handle
Returns
0 in case of success, or a negative error code specified in FERSLIB_ErrorCodes

◆ FERS_WriteBoardInfo()

int FERS_WriteBoardInfo ( int  handle,
FERS_BoardInfo_t  binfo 
)

Write Board info into the relevant flash memory page.

Warning
The flash memory contains vital parameters for the board. Overwriting certain pages can damage the hardware!!! Do not use this function without contacting CAEN first
Parameters
[in]handledevice handle
[in]binfoboard info structure
Returns
0 in case of success, or a negative error code specified in FERSLIB_ErrorCodes