Xenomai  3.1
Synchronous acquisition API
Collaboration diagram for Synchronous acquisition API:

Functions

int a4l_sync_write (a4l_desc_t *dsc, unsigned int idx_subd, unsigned int chan_desc, unsigned int ns_delay, void *buf, size_t nbyte)
 Perform a synchronous acquisition write operation. More...
 
int a4l_sync_read (a4l_desc_t *dsc, unsigned int idx_subd, unsigned int chan_desc, unsigned int ns_delay, void *buf, size_t nbyte)
 Perform a synchronous acquisition read operation. More...
 
int a4l_sync_dio (a4l_desc_t *dsc, unsigned int idx_subd, void *mask, void *buf)
 Perform a synchronous acquisition digital acquisition. More...
 
int a4l_config_subd (a4l_desc_t *dsc, unsigned int idx_subd, unsigned int type,...)
 Configure a subdevice. More...
 

Detailed Description

Function Documentation

◆ a4l_config_subd()

int a4l_config_subd ( a4l_desc_t dsc,
unsigned int  idx_subd,
unsigned int  type,
  ... 
)

Configure a subdevice.

a4l_config_subd() takes a variable count of arguments. According to the configuration type, some additional argument is necessary:

  • A4L_INSN_CONFIG_DIO_INPUT: the channel index (unsigned int)
  • A4L_INSN_CONFIG_DIO_OUTPUT: the channel index (unsigned int)
  • A4L_INSN_CONFIG_DIO_QUERY: the returned DIO polarity (unsigned int *)
Parameters
[in]dscDevice descriptor filled by a4l_open() (and optionally a4l_fill_desc())
[in]idx_subdIndex of the concerned subdevice
[in]typeConfiguration parameter
Returns
0 on success. Otherwise:
  • -EINVAL is returned if some argument is missing or wrong (Please, type "dmesg" for more info)
  • -ENOSYS is returned if the configuration parameter is not supported

References A4L_INSN_CONFIG, and a4l_instruction::type.

◆ a4l_sync_dio()

int a4l_sync_dio ( a4l_desc_t dsc,
unsigned int  idx_subd,
void *  mask,
void *  buf 
)

Perform a synchronous acquisition digital acquisition.

Parameters
[in]dscDevice descriptor filled by a4l_open() (and optionally a4l_fill_desc())
[in]idx_subdIndex of the concerned subdevice
[in]maskWrite mask which indicates which bit(s) must be modified
[in,out]bufInput / output buffer
Returns
Number of bytes read, otherwise negative error code:
  • -EINVAL is returned if some argument is missing or wrong (Please, type "dmesg" for more info)
  • -EFAULT is returned if a user <-> kernel transfer went wrong
  • -ENOMEM is returned if the system is out of memory
  • -ENOSYS is returned if the driver does not provide any handler "instruction bits"

References a4l_get_subdinfo(), A4L_INSN_BITS, a4l_sizeof_subd(), a4l_snd_insn(), a4l_instruction::data_size, and a4l_instruction::type.

◆ a4l_sync_read()

int a4l_sync_read ( a4l_desc_t dsc,
unsigned int  idx_subd,
unsigned int  chan_desc,
unsigned int  ns_delay,
void *  buf,
size_t  nbyte 
)

Perform a synchronous acquisition read operation.

Parameters
[in]dscDevice descriptor filled by a4l_open() (and optionally a4l_fill_desc())
[in]idx_subdIndex of the concerned subdevice
[in]chan_descChannel descriptor (channel, range and reference)
[in]ns_delayOptional delay (in nanoseconds) to wait between the setting of the input channel and sample(s) acquisition(s).
[in]bufInput buffer
[in]nbyteNumber of bytes to read
Returns
Number of bytes read, otherwise negative error code:
  • -EINVAL is returned if some argument is missing or wrong (Please, type "dmesg" for more info)
  • -EFAULT is returned if a user <-> kernel transfer went wrong
  • -ENOMEM is returned if the system is out of memory

References A4L_INSN_READ, A4L_INSN_WAIT, and a4l_instruction::type.

◆ a4l_sync_write()

int a4l_sync_write ( a4l_desc_t dsc,
unsigned int  idx_subd,
unsigned int  chan_desc,
unsigned int  ns_delay,
void *  buf,
size_t  nbyte 
)

Perform a synchronous acquisition write operation.

Parameters
[in]dscDevice descriptor filled by a4l_open() (and optionally a4l_fill_desc())
[in]idx_subdIndex of the concerned subdevice
[in]chan_descChannel descriptor (channel, range and reference)
[in]ns_delayOptional delay (in nanoseconds) to wait between the setting of the input channel and sample(s) acquisition(s).
[in]bufOutput buffer
[in]nbyteNumber of bytes to write
Returns
Number of bytes written, otherwise negative error code:
  • -EINVAL is returned if some argument is missing or wrong (Please, type "dmesg" for more info)
  • -EFAULT is returned if a user <-> kernel transfer went wrong
  • -ENOMEM is returned if the system is out of memory

References A4L_INSN_WAIT, A4L_INSN_WRITE, and a4l_instruction::type.