xtos_ bci_ set_ channel
Requests enabling or disabling one channel and supplies a gain field through ioctl.
On this page
Declaration
#include <xtos/bci.h>
int xtos_bci_set_channel(xtos_bci_session_t *session,
uint32_t channel,
bool enabled,
uint32_t gain);Parameters
| Parameter | Type | Description |
|---|---|---|
| session | xtos_bci_session_t * | Non-NULL session handle. |
| channel | uint32_t | Channel index; valid range is driver-defined. |
| enabled | bool | Whether to enable the channel. |
| gain | uint32_t | Gain 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
| errno | Condition |
|---|---|
| EINVAL | session is NULL or the driver considers the channel configuration invalid. |
| ENOTTY/EOPNOTSUPP | The device does not support channel configuration. |
| system errno | Preserves 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).