XTOS / OPEN SOURCE REAL-TIME SYSTEMOPEN SOURCE · 1.0.2 · PRERELEASE · IMAGES & SOURCE
libxtos-bcixtos_bci_set_sampling_rate

xtos_bci_set_sampling_rate

Requests an integer sampling rate through ioctl and updates the session cache after success.

On this page

Declaration

c
#include <xtos/bci.h>

int xtos_bci_set_sampling_rate(xtos_bci_session_t *session, uint32_t rate);

Parameters

ParameterTypeDescription
sessionxtos_bci_session_t *Non-NULL session handle.
rateuint32_tSampling rate in Hz; the library does not check the device support list.

Return value

Returns 0 and updates info.sampling_rate after ioctl success; returns -1 without updating the cache on failure.

Errors

errnoCondition
EINVALsession is NULL or the driver considers rate invalid.
ENOTTY/EOPNOTSUPPThe device does not support setting the sampling rate.
system errnoPreserves driver or system errno from ioctl failure.

Notes

  • The pinned Cyton path supports only 250 Hz: when stopped it reads registers and validates/commits configuration, without sending ~6, which resets all ADS state. 500, 1000 and 2000 Hz return EOPNOTSUPP; other values return EINVAL; active receiving returns EBUSY.
  • Externally serialize every API on one session; the SDK has no internal lock. Calls may block or allocate and establish no real-time deadline guarantee.
  • The SDK updates info.sampling_rate only after ioctl success. Cyton driver success means verified readback and a configuration commit; failure may invalidate configuration. Use get_config for the verified generation. Source behavior is not a physical rate measurement.

Example

Source

This reference describes headers and implementation in OpenXTOS v1.0.2 (c24e923717670c4724cdaf24c7c105caee8dc2fb).