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

xtos_bci_set_channel

Requests enabling or disabling one channel and supplies a gain field through ioctl.

On this page

Declaration

c
#include <xtos/bci.h>

int xtos_bci_set_channel(xtos_bci_session_t *session,
                        uint32_t channel,
                        bool enabled,
                        uint32_t gain);

Parameters

ParameterTypeDescription
sessionxtos_bci_session_t *Non-NULL session handle.
channeluint32_tChannel index; valid range is driver-defined.
enabledboolWhether to enable the channel.
gainuint32_tGain field constructed by user space and passed to ioctl.

Return value

Returns the underlying ioctl’s 0 or -1; the SDK does not update the device-info cache.

Errors

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

Notes

  • The pinned core/Cyton path wires gain through: allowed values are 1, 2, 4, 6, 8, 12, 24; 0 preserves readback gain. Cyton channel indices are 0..7 and active receiving returns EBUSY. It sends a nine-byte x...X command, checks the exact ACK, then compares register readback with the desired values before committing a new configuration generation.
  • 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 stack-local argument is used only during the call. Unknown gains return EINVAL; unsupported shared BIAS/SRB1 state returns EOPNOTSUPP. Transport/readback failure invalidates configuration without guaranteed rollback; verify get_config before resuming acquisition. Legacy drivers with only an enable callback return EOPNOTSUPP for nonzero gain rather than silently ignoring it.

Example

Source

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