LMS API Documentation: Sample Streaming functions

LMS API Documentation v23.11.0

Loading...
Searching...
No Matches
Sample Streaming functions

## Topics
| Additional streaming options
| These can be combined with lms_stream_t::channel to enable additional streaming options.

## Data Structures
struct | lms_stream_meta_t
struct | lms_stream_t
struct | lms_stream_status_t

## Functions
API_EXPORT int CALL_CONV | LMS_SetupStream (lms_device_t *device, lms_stream_t *stream)
API_EXPORT int CALL_CONV | LMS_DestroyStream (lms_device_t *dev, lms_stream_t *stream)
API_EXPORT int CALL_CONV | LMS_StartStream (lms_stream_t *stream)
API_EXPORT int CALL_CONV | LMS_StopStream (lms_stream_t *stream)
API_EXPORT int CALL_CONV | LMS_RecvStream (lms_stream_t *stream, void *samples, size_t sample_count, lms_stream_meta_t *meta, unsigned timeout_ms)
API_EXPORT int CALL_CONV | LMS_GetStreamStatus (lms_stream_t *stream, lms_stream_status_t *status)
API_EXPORT int CALL_CONV | LMS_SendStream (lms_stream_t *stream, const void *samples, size_t sample_count, const lms_stream_meta_t *meta, unsigned timeout_ms)
API_EXPORT int CALL_CONV | LMS_UploadWFM (lms_device_t *device, const void **samples, uint8_t chCount, size_t sample_count, int format)
API_EXPORT int CALL_CONV | LMS_EnableTxWFM (lms_device_t *device, unsigned chan, bool active)

## Detailed Description

The functions in this section provides support for sending and receiving IQ data samples.

## Function Documentation

## ◆ LMS_DestroyStream()

API_EXPORT int CALL_CONV LMS_DestroyStream | ( | lms_device_t * | dev,
|  | lms_stream_t * | stream )

Deallocate memory used by stream.

Parameters

  dev | Device handle previously obtained by LMS_Open().
  stream | Stream structure previously initialized with LMS_SetupStream().

Returns
  0 on success, (-1) on failure

## ◆ LMS_EnableTxWFM()

API_EXPORT int CALL_CONV LMS_EnableTxWFM | ( | lms_device_t * | device,
|  | unsigned | chan,
|  | bool | active )

Enables/Disables transmitting of uploaded waveform

Parameters

  device | Device handle previously obtained by LMS_Open().
  chan | Channel index
  active | Enable/Disable waveform playback

Returns
  0 on success, (-1) on failure

## ◆ LMS_GetStreamStatus()

API_EXPORT int CALL_CONV LMS_GetStreamStatus | ( | lms_stream_t * | stream,
|  | lms_stream_status_t * | status )

Get stream operation status

Parameters

  stream | structure previously initialized with LMS_SetupStream().
  status | Stream status. See the lms_stream_status_t for description

Returns
  0 on success, (-1) on failure

## ◆ LMS_RecvStream()

API_EXPORT int CALL_CONV LMS_RecvStream | ( | lms_stream_t * | stream,
|  | void * | samples,
|  | size_t | sample_count,
|  | lms_stream_meta_t * | meta,
|  | unsigned | timeout_ms )

Read samples from the FIFO of the specified stream. Sample buffer must be big enough to hold requested number of samples.

Parameters

  stream | structure previously initialized with LMS_SetupStream().
  samples | sample buffer.
  sample_count | Number of samples to read
  meta | Metadata. See the lms_stream_meta_t description.
  timeout_ms | how long to wait for data before timing out.

Returns
  number of samples received on success, (-1) on failure

## ◆ LMS_SendStream()

API_EXPORT int CALL_CONV LMS_SendStream | ( | lms_stream_t * | stream,
|  | const void * | samples,
|  | size_t | sample_count,
|  | const lms_stream_meta_t * | meta,
|  | unsigned | timeout_ms )

Write samples to the FIFO of the specified stream.

Parameters

  stream | structure previously initialized with LMS_SetupStream().
  samples | sample buffer.
  sample_count | Number of samples to write
  meta | Metadata. See the lms_stream_meta_t description.
  timeout_ms | how long to wait for data before timing out.

Returns
  number of samples send on success, (-1) on failure

## ◆ LMS_SetupStream()

API_EXPORT int CALL_CONV LMS_SetupStream | ( | lms_device_t * | device,
|  | lms_stream_t * | stream )

Create new stream based on parameters passed in configuration structure. The structure is initialized with stream handle.

Parameters

  device | Device handle previously obtained by LMS_Open().
  stream | Stream configuration .See the lms_stream_t description.

Returns
  0 on success, (-1) on failure

## ◆ LMS_StartStream()

API_EXPORT int CALL_CONV LMS_StartStream | ( | lms_stream_t * | stream | ) |

Start stream

Parameters

  stream | Stream structure previously initialized with LMS_SetupStream().

Returns
  0 on success, (-1) on failure

## ◆ LMS_StopStream()

API_EXPORT int CALL_CONV LMS_StopStream | ( | lms_stream_t * | stream | ) |

Stop stream

Parameters

  stream | Stream structure previously initialized with LMS_SetupStream().

Returns
  0 on success, (-1) on failure

## ◆ LMS_UploadWFM()

API_EXPORT int CALL_CONV LMS_UploadWFM | ( | lms_device_t * | device,
|  | const void ** | samples,
|  | uint8_t | chCount,
|  | size_t | sample_count,
|  | int | format )

Uploads waveform to on board memory for later use

Parameters

  device | Device handle previously obtained by LMS_Open().
  samples | multiple channel samples data
  chCount | number of waveform channels (1 or 2).
  sample_count | number of samples in each channel. Must be multiple of 4
  format | waveform data format: 0 - int16 [-2048, 2047], 1 - int16 [-32768, 32767] 2 - float [-1.0, 1.0]

Returns
  0 on success, (-1) on failure