egd_acq_setup(3) specify which and how channel data should be obtained

SYNOPSIS

#include <eegdev.h>

int egd_acq_setup(struct eegdev* dev,
unsigned int narr, const size_t *strides,
unsigned int ngrp, const struct grpconf *grp);

DESCRIPTION

egd_acq_setup() configures the way data is provided by the device referenced by dev for the next calls to egd_get_data(3).

The narr argument specifies the number of buffers that will be supplied in the argument list of egd_get_data(3). strides should points to an array of narr values specifying respectively for each buffers its stride, i.e. the size in bytes between the data of two successive samples in this buffer.

The channels data that must be returns in those buffers are defined by ngrp groups of consecutive channels. The groups definition are passed by grp which points to an array of ngrp structures, defined as follows:

struct grpconf {
    unsigned int sensortype;    /* type of channel */
    unsigned int index;         /* index of the first channel */
    unsigned int nch;           /* number of channels */
    unsigned int iarray;        /* index of the array */
    unsigned int arr_offset;    /* offset in the array */
    unsigned int datatype;      /* type in the array */
};

The different fields in the structure defines the properties of the group:

*
sensortype specifies the type of channel. it must one of the following values returned by egd_sensor_type(3).

*
index indicates the index of the first channel in the group. Note that channel index i refers the i-th channel of the type specified previously, i.e. the channel index i refers to two differents channels if sensortype differs.

*
nch specifies the number of consecutive channels that should be in the group.

*
iarray indicates which buffer the data of the channel group must be written to.

*
arr_offset defines the offset of the memory location of the data in the buffers relatively to the beginning of each sample.

*
datatype specifies the type of data that must be written to the buffer. It must be one of the following value: EGD_INT32, EGD_FLOAT or EGD_DOUBLE

RETURN VALUE

The function returns 0 in case of succes. Otherwise, -1 is returned and errno is set accordingly.

ERRORS

egd_acq_setup() will fail if:

EINVAL
dev is NULL.
EPERM
The acquisition is running

THREAD SAFETY

egd_acq_setup() is thread-safe.

EXAMPLE

See egd_get_data(3) for a example