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

xtos_bci_get_config

Queries and strictly validates v1 configuration and firmware/register readback; pinned v1.0.2 supports the eight-channel 250 Hz Cyton profile.

On this page

Declaration

c
#include <xtos/bci.h>

int xtos_bci_get_config(xtos_bci_session_t *session,
                        struct xtos_bci_config_v1 *out);

Parameters

ParameterTypeDescription
sessionxtos_bci_session_t *Non-NULL, caller-managed lifetime; externally serialize access.
outstruct xtos_bci_config_v1 *Non-NULL caller-owned output structure; every byte remains unchanged on failure.

Output fields

FieldTypeMeaning
versionuint32_tABI version, dimensionless; must be 1.
flagsuint32_tFlags, dimensionless; zero in v1.
channelsuint32_tChannel count; the validated profile requires 8.
sample_rate_hzuint32_tSampling rate in Hz; the validated profile requires 250.
enabled_maskuint32_tDimensionless enabled-channel mask; bits 0..7 represent channels 0..7 and agree with CHnSET power-down bits.
capabilitiesuint32_tDimensionless capability bits: CONFIG_READBACK=1, FIRMWARE_READBACK=2, GAIN_CONTROL=4, IMPEDANCE=8, SELF_TEST=16; the first two are required, unknown bits rejected. The pinned Cyton path does not advertise impedance/self-test.
reserved0uint32_t[2]Reserved, dimensionless; both elements are zero.
generationuint64_tDimensionless nonzero configuration generation; increases on successful verified commits during the device lifetime, even for unchanged readbacks. It is not a unique board ID.
gainuint32_t[8]Per-channel dimensionless gain; each is 1, 2, 4, 6, 8, 12, or 24 and agrees with register readback.
registersuint8_t[24]24 actual ADS register bytes, dimensionless; CONFIG1 low three bits equal 6 and CHnSET validates gains and enable state.
firmwarechar[256]Firmware banner, no unit; nonempty and NUL-terminated, with printable ASCII or CR/LF before NUL. It is not unique device identity.
reserveduint32_t[8]Reserved, dimensionless; all eight elements are zero.

Return value

Returns 0 and copies validated configuration on success; -1/errno on failure with out unchanged.

Errors

errnoCondition
EINVALsession/out is NULL.
EPROTOInvalid version, reserved fields, capabilities, gain/enable readback, firmware string, or fixed profile.
ENODATA/ENODEV/ENOTTY/EOPNOTSUPP/system errnoConfiguration is unverified, device disconnected, interface unsupported, or underlying ioctl failed.

Notes

  • 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.
  • Internally sets only request version=1. Cyton returns the driver-retained last verified configuration; this call does not issue a serial register query, commit a new generation, or reset the board. It is not the old GET_INFO cache; configuration updates occur during initialization, START, or successful configuration transactions.
  • The native-endian configuration is 384 bytes; API presence does not establish calibration or impedance capability.

Example

c
#include <xtos/bci.h>
int query_config(xtos_bci_session_t *s) {
    struct xtos_bci_config_v1 config;
    return xtos_bci_get_config(s, &config);
}

Source

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