LMS API Documentation: Low-Level control functions

LMS API Documentation v23.11.0

Loading...
Searching...
No Matches
Topics | Functions
Low-Level control functions

## Topics
| Board parameter
| Clock definitions

## Functions
API_EXPORT int CALL_CONV | LMS_Reset (lms_device_t *device)
API_EXPORT int CALL_CONV | LMS_ReadLMSReg (lms_device_t *device, uint32_t address, uint16_t *val)
API_EXPORT int CALL_CONV | LMS_WriteLMSReg (lms_device_t *device, uint32_t address, uint16_t val)
API_EXPORT int CALL_CONV | LMS_ReadParam (lms_device_t *device, struct LMS7Parameter param, uint16_t *val)
API_EXPORT int CALL_CONV | LMS_WriteParam (lms_device_t *device, struct LMS7Parameter param, uint16_t val)
API_EXPORT int CALL_CONV | LMS_ReadFPGAReg (lms_device_t *device, uint32_t address, uint16_t *val)
API_EXPORT int CALL_CONV | LMS_WriteFPGAReg (lms_device_t *device, uint32_t address, uint16_t val)
API_EXPORT int CALL_CONV | LMS_ReadCustomBoardParam (lms_device_t *device, uint8_t id, float_type *val, lms_name_t units)
API_EXPORT int CALL_CONV | LMS_WriteCustomBoardParam (lms_device_t *device, uint8_t id, float_type val, const lms_name_t units)
API_EXPORT int CALL_CONV | LMS_GetClockFreq (lms_device_t *dev, size_t clk_id, float_type *freq)
API_EXPORT int CALL_CONV | LMS_SetClockFreq (lms_device_t *dev, size_t clk_id, float_type freq)
API_EXPORT int CALL_CONV | LMS_VCTCXOWrite (lms_device_t *dev, uint16_t val)
API_EXPORT int CALL_CONV | LMS_VCTCXORead (lms_device_t *dev, uint16_t *val)
API_EXPORT int CALL_CONV | LMS_Synchronize (lms_device_t *dev, bool toChip)
API_EXPORT int CALL_CONV | LMS_GPIORead (lms_device_t *dev, uint8_t *buffer, size_t len)
API_EXPORT int CALL_CONV | LMS_GPIOWrite (lms_device_t *dev, const uint8_t *buffer, size_t len)
API_EXPORT int CALL_CONV | LMS_GPIODirRead (lms_device_t *dev, uint8_t *buffer, size_t len)
API_EXPORT int CALL_CONV | LMS_GPIODirWrite (lms_device_t *dev, const uint8_t *buffer, size_t len)

## Detailed Description

The functions in this section provide a low access to device such as modifying device internal register or clock frequency. Low-Level functions can be used to configure device entirely, however a more practical use is to fine-tune device settings after configuring it with /ref FN_HIGH_LVL.

## Function Documentation

## ◆ LMS_GetClockFreq()

API_EXPORT int CALL_CONV LMS_GetClockFreq | ( | lms_device_t * | dev,
|  | size_t | clk_id,
|  | float_type * | freq )

Get frequency of the specified clock.

Parameters

  dev | Device handle previously obtained by LMS_Open().
  clk_id | Clock identifier (Clock definitions)
  freq | Clock frequency in Hz

Returns
  0 on success, (-1) on failure

## ◆ LMS_GPIODirRead()

API_EXPORT int CALL_CONV LMS_GPIODirRead | ( | lms_device_t * | dev,
|  | uint8_t * | buffer,
|  | size_t | len )

Parameters

  | dev | Device handle previously obtained by LMS_Open().
  [out] | buffer | GPIO direction configuration(8 GPIO per byte, LSB first; 0 input, 1 output)
  | len | number of bytes to read

Returns
  0 on success, (-1) on failure

## ◆ LMS_GPIODirWrite()

API_EXPORT int CALL_CONV LMS_GPIODirWrite | ( | lms_device_t * | dev,
|  | const uint8_t * | buffer,
|  | size_t | len )

Parameters

  | dev | Device handle previously obtained by LMS_Open().
  [in] | buffer | GPIO direction configuration(8 GPIO per byte, LSB first; 0 input, 1 output)
  | len | number of bytes to write

Returns
  0 on success, (-1) on failure

## ◆ LMS_GPIORead()

API_EXPORT int CALL_CONV LMS_GPIORead | ( | lms_device_t * | dev,
|  | uint8_t * | buffer,
|  | size_t | len )

Parameters

  | dev | Device handle previously obtained by LMS_Open().
  [in] | buffer | read values (8 GPIO values per byte, LSB first)
  | len | number of bytes to read

Returns
  0 on success, (-1) on failure

## ◆ LMS_GPIOWrite()

API_EXPORT int CALL_CONV LMS_GPIOWrite | ( | lms_device_t * | dev,
|  | const uint8_t * | buffer,
|  | size_t | len )

Parameters

  | dev | Device handle previously obtained by LMS_Open().
  [out] | buffer | values to write (8 GPIO values per byte, LSB first)
  | len | number of bytes to write

Returns
  0 on success, (-1) on failure

## ◆ LMS_ReadCustomBoardParam()

API_EXPORT int CALL_CONV LMS_ReadCustomBoardParam | ( | lms_device_t * | device,
|  | uint8_t | id,
|  | float_type * | val,
|  | lms_name_t | units )

Read custom parameter from board

Parameters

  device | Device handle previously obtained by LMS_Open().
  id | Parameter identifier (Board parameter)
  val | Current register value
  units | [optional] measurement units of parameter if available

Returns
  0 on success, (-1) on failure

## ◆ LMS_ReadFPGAReg()

API_EXPORT int CALL_CONV LMS_ReadFPGAReg | ( | lms_device_t * | device,
|  | uint32_t | address,
|  | uint16_t * | val )

Read device FPGA register

Parameters

  device | Device handle previously obtained by LMS_Open().
  address | Register address
  val | Current register value

Returns
  0 on success, (-1) on failure

## ◆ LMS_ReadLMSReg()

API_EXPORT int CALL_CONV LMS_ReadLMSReg | ( | lms_device_t * | device,
|  | uint32_t | address,
|  | uint16_t * | val )

Read device LMS chip register

Parameters

  device | Device handle previously obtained by LMS_Open().
  address | Register address
  val | Current register value

Returns
  0 on success, (-1) on failure

## ◆ LMS_ReadParam()

API_EXPORT int CALL_CONV LMS_ReadParam | ( | lms_device_t * | device,
|  | struct LMS7Parameter | param,
|  | uint16_t * | val )

Read device parameter. Parameter defines specific bits in device register.

Parameters

  device | Device handle previously obtained by LMS_Open().
  param | Parameter.
  val | Current parameter value.

Returns
  0 on success, (-1) on failure

## ◆ LMS_Reset()

API_EXPORT int CALL_CONV LMS_Reset | ( | lms_device_t * | device | ) |

Send Reset signal to LMS chip. This initializes LMS chip with default configuration as described in LMS chip datasheet.

Parameters

  device | Device handle previously obtained by LMS_Open().

Returns
  0 on success, (-1) on failure

## ◆ LMS_SetClockFreq()

API_EXPORT int CALL_CONV LMS_SetClockFreq | ( | lms_device_t * | dev,
|  | size_t | clk_id,
|  | float_type | freq )

Set frequency of the specified clock

Parameters

  dev | Device handle previously obtained by LMS_Open().
  clk_id | Clock identifier (Clock definitions)
  freq | Clock frequency in Hz. Pass zero or negative value to only perform tune (if supported) without recalculating values

Returns
  0 on success, (-1) on failure

## ◆ LMS_Synchronize()

API_EXPORT int CALL_CONV LMS_Synchronize | ( | lms_device_t * | dev,
|  | bool | toChip )

Synchronizes register values between API cache and chip

Parameters

  dev | Device handle previously obtained by LMS_Open().
  toChip | if true copies values from API cache to chip.

Returns
  0 on success, (-1) on failure

## ◆ LMS_VCTCXORead()

API_EXPORT int CALL_CONV LMS_VCTCXORead | ( | lms_device_t * | dev,
|  | uint16_t * | val )

Read VCTCXO trim DAC value from non-volatile storage. Returned value is value that is loaded on power-on and may different from current runtime value.

Parameters

  [in] | dev | Device handle previously obtained by LMS_Open().
  [out] | val | VCTCXO trim DAC value

Returns
  0 on success, (-1) on failure

## ◆ LMS_VCTCXOWrite()

API_EXPORT int CALL_CONV LMS_VCTCXOWrite | ( | lms_device_t * | dev,
|  | uint16_t | val )

Write value to VCTCXO trim DAC. Used to adjust/calibrate reference clock generated by voltage controlled oscillator. Value is written to non-volatile storage.

Note
  calling this functions switches clock source to VCTCXO

Parameters

  dev | Device handle previously obtained by LMS_Open().
  val | Value to write to VCTCXO trim DAC

Returns
  0 on success, (-1) on failure

## ◆ LMS_WriteCustomBoardParam()

API_EXPORT int CALL_CONV LMS_WriteCustomBoardParam | ( | lms_device_t * | device,
|  | uint8_t | id,
|  | float_type | val,
|  | const lms_name_t | units )

Write custom parameter from board

Parameters

  | device | Device handle previously obtained by LMS_Open().
  | id | Parameter identifier (Board parameter)
  [out] | val | Value to write
  [out] | units | [optional] measurement units of parameter if available

Returns
  0 on success, (-1) on failure

## ◆ LMS_WriteFPGAReg()

API_EXPORT int CALL_CONV LMS_WriteFPGAReg | ( | lms_device_t * | device,
|  | uint32_t | address,
|  | uint16_t | val )

Write device FPGA register

Parameters

  device | Device handle previously obtained by LMS_Open().
  address | Register address
  val | Value to write

Returns
  0 on success, (-1) on failure

## ◆ LMS_WriteLMSReg()

API_EXPORT int CALL_CONV LMS_WriteLMSReg | ( | lms_device_t * | device,
|  | uint32_t | address,
|  | uint16_t | val )

Write device LMS chip register

Parameters

  device | Device handle previously obtained by LMS_Open().
  address | Register address
  val | Value to write

Returns
  0 on success, (-1) on failure

## ◆ LMS_WriteParam()

API_EXPORT int CALL_CONV LMS_WriteParam | ( | lms_device_t * | device,
|  | struct LMS7Parameter | param,
|  | uint16_t | val )

Write device parameter. Parameter defines specific bits in device register.

Parameters

  device | Device handle previously obtained by LMS_Open().
  param | Parameter.
  val | Parameter value to write

Returns
  0 on success, (-1) on failure