Xenomai API  2.6.5
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

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, a4l_snd_insn(), CHAN, a4l_instruction::chan_desc, a4l_instruction::data_size, and a4l_instruction::type.

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.

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, a4l_snd_insn(), a4l_snd_insnlist(), a4l_instruction_list::count, a4l_instruction::data, a4l_instruction::data_size, and a4l_instruction::type.

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, a4l_snd_insn(), a4l_snd_insnlist(), a4l_instruction_list::count, a4l_instruction::data, a4l_instruction::data_size, and a4l_instruction::type.