XTOS / OPEN SOURCE REAL-TIME SYSTEMOPEN SOURCE · VERSION 0.9.0 · BUILD FROM SOURCE
libxtos-bcixtos_bci_read_samples

xtos_bci_read_samples

Performs one device read directly into a float buffer and returns the byte count divided by sizeof(float).

On this page

Declaration

c
#include <xtos/bci.h>

ssize_t xtos_bci_read_samples(xtos_bci_session_t *session,
                             float *buffer,
                             size_t num_samples);

Parameters

ParameterTypeDescription
sessionxtos_bci_session_t *Non-NULL session handle.
bufferfloat *Non-NULL caller-owned buffer holding at least num_samples floats.
num_samplessize_tRequested scalar float count, greater than zero; it is not automatically a frame count.

Return value

Returns a nonnegative count and permits short reads; returns -1 on failure.

Errors

errnoCondition
EINVALsession or buffer is NULL, or num_samples is zero.
EAGAIN/EINTRA nonblocking setup or signal interruption can make the underlying read return these errno values.
system errnoOther read failures preserve the underlying errno.

Notes

  • The public implementation does not check multiplication overflow, frame alignment, or timestamps; read may block by default and callers must handle short reads.
  • The public driver writes int32 nanovolt bytes while this implementation reads them directly into float* without int32→float or nV→µV conversion; do not interpret it as floating-point EEG.
  • The caller allocates and frees buffer; the function returns no device timestamp, sequence, quality flag, or reliable frame boundary.

Example

Source

This reference describes headers and implementation at OpenXTOS commit dd313955ad57542bcd2af8827157d1bbd0cf5e83.