|
Xenomai 3.3.2
|
Data Structures | |
| struct | a4l_cmd_desc |
| Structure describing the asynchronous instruction. More... | |
Functions | |
| int | a4l_snd_command (a4l_desc_t *dsc, a4l_cmd_t *cmd) |
| Send a command to an Analoy device. | |
| int | a4l_snd_cancel (a4l_desc_t *dsc, unsigned int idx_subd) |
| Cancel an asynchronous acquisition. | |
| int | a4l_set_bufsize (a4l_desc_t *dsc, unsigned int idx_subd, unsigned long size) |
| Change the size of the asynchronous buffer. | |
| int | a4l_get_bufsize (a4l_desc_t *dsc, unsigned int idx_subd, unsigned long *size) |
| Get the size of the asynchronous buffer. | |
| int | a4l_mark_bufrw (a4l_desc_t *dsc, unsigned int idx_subd, unsigned long cur, unsigned long *new) |
| Update the asynchronous buffer state. | |
| int | a4l_poll (a4l_desc_t *dsc, unsigned int idx_subd, unsigned long ms_timeout) |
| Get the available data count. | |
| int | a4l_mmap (a4l_desc_t *dsc, unsigned int idx_subd, unsigned long size, void **ptr) |
| Map the asynchronous ring-buffer into a user-space. | |
Channel macros | |
Specific precompilation macros and constants useful for the channels descriptors tab located in the command structure | |
| #define | CHAN(a) ((a) & 0xffff) |
| Channel indication macro. | |
| #define | RNG(a) (((a) & 0xff) << 16) |
| Range definition macro. | |
| #define | AREF(a) (((a) & 0x03) << 24) |
| Reference definition macro. | |
| #define | FLAGS(a) ((a) & CR_FLAGS_MASK) |
| Flags definition macro. | |
| #define | PACK(a, b, c) (a | RNG(b) | AREF(c)) |
| Channel + range + reference definition macro. | |
| #define | PACK_FLAGS(a, b, c, d) (PACK(a, b, c) | FLAGS(d)) |
| Channel + range + reference + flags definition macro. | |
| #define | AREF_GROUND 0x00 |
| Analog reference is analog ground. | |
| #define | AREF_COMMON 0x01 |
| Analog reference is analog common. | |
| #define | AREF_DIFF 0x02 |
| Analog reference is differential. | |
| #define | AREF_OTHER 0x03 |
| Analog reference is undefined. | |
| int a4l_get_bufsize | ( | a4l_desc_t * | dsc, |
| unsigned int | idx_subd, | ||
| unsigned long * | size | ||
| ) |
Get the size of the asynchronous buffer.
During asynchronous acquisition, a ring-buffer enables the transfers from / to user-space. Functions like a4l_read() or a4l_write() recovers / sends data through this intermediate buffer. Please note, there is one ring-buffer per subdevice capable of asynchronous acquisition. By default, each buffer size is set to 64 KB.
| [in] | dsc | Device descriptor filled by a4l_open() (and optionally a4l_fill_desc()) |
| [in] | idx_subd | Index of the concerned subdevice |
| [out] | size | Buffer size |
References a4l_descriptor::fd.
| int a4l_mark_bufrw | ( | a4l_desc_t * | dsc, |
| unsigned int | idx_subd, | ||
| unsigned long | cur, | ||
| unsigned long * | new | ||
| ) |
Update the asynchronous buffer state.
When the mapping of the asynchronous ring-buffer (thanks to a4l_mmap() is disabled, common read / write syscalls have to be used. In input case, a4l_read() must be used for:
In mmap configuration, these features are provided by unique function named a4l_mark_bufrw(). In input case, a4l_mark_bufrw() can :
| [in] | dsc | Device descriptor filled by a4l_open() (and optionally a4l_fill_desc()) |
| [in] | idx_subd | Index of the concerned subdevice |
| [in] | cur | Amount of consumed data |
| [out] | new | Amount of available data |
References a4l_descriptor::fd.
| int a4l_mmap | ( | a4l_desc_t * | dsc, |
| unsigned int | idx_subd, | ||
| unsigned long | size, | ||
| void ** | ptr | ||
| ) |
Map the asynchronous ring-buffer into a user-space.
| [in] | dsc | Device descriptor filled by a4l_open() (and optionally a4l_fill_desc()) |
| [in] | idx_subd | Index of the concerned subdevice |
| [in] | size | Size of the buffer to map |
| [out] | ptr | Address of the pointer containing the assigned address on return |
References a4l_descriptor::fd.
| int a4l_poll | ( | a4l_desc_t * | dsc, |
| unsigned int | idx_subd, | ||
| unsigned long | ms_timeout | ||
| ) |
Get the available data count.
| [in] | dsc | Device descriptor filled by a4l_open() (and optionally a4l_fill_desc()) |
| [in] | idx_subd | Index of the concerned subdevice |
| [in] | ms_timeout | The number of miliseconds to wait for some data to be available. Passing A4L_INFINITE causes the caller to block indefinitely until some data is available. Passing A4L_NONBLOCK causes the function to return immediately without waiting for any available data |
References a4l_poll(), and a4l_descriptor::fd.
Referenced by a4l_async_read(), a4l_async_write(), and a4l_poll().
| int a4l_set_bufsize | ( | a4l_desc_t * | dsc, |
| unsigned int | idx_subd, | ||
| unsigned long | size | ||
| ) |
Change the size of the asynchronous buffer.
During asynchronous acquisition, a ring-buffer enables the transfers from / to user-space. Functions like a4l_read() or a4l_write() recovers / sends data through this intermediate buffer. The function a4l_set_bufsize() can change the size of the ring-buffer. Please note, there is one ring-buffer per subdevice capable of asynchronous acquisition. By default, each buffer size is set to 64 KB.
| [in] | dsc | Device descriptor filled by a4l_open() (and optionally a4l_fill_desc()) |
| [in] | idx_subd | Index of the concerned subdevice |
| [in] | size | New buffer size, the maximal tolerated value is 16MB (A4L_BUF_MAXSIZE) |
References a4l_sys_bufcfg(), and a4l_descriptor::fd.
| int a4l_snd_cancel | ( | a4l_desc_t * | dsc, |
| unsigned int | idx_subd | ||
| ) |
Cancel an asynchronous acquisition.
The function a4l_snd_cancel() is devoted to stop an asynchronous acquisition configured thanks to an Analogy command.
| [in] | dsc | Device descriptor filled by a4l_open() (and optionally a4l_fill_desc()) |
| [in] | idx_subd | Subdevice index |
References a4l_descriptor::fd.
| int a4l_snd_command | ( | a4l_desc_t * | dsc, |
| a4l_cmd_t * | cmd | ||
| ) |
Send a command to an Analoy device.
The function a4l_snd_command() triggers asynchronous acquisition.
| [in] | dsc | Device descriptor filled by a4l_open() (and optionally a4l_fill_desc()) |
| [in] | cmd | Command structure |
References a4l_descriptor::fd.