|
Xenomai 3.3.2
|
Subdevice declaration in a driver. More...
Functions | |
| struct a4l_subdevice * | a4l_alloc_subd (int sizeof_priv, void(*setup)(struct a4l_subdevice *)) |
| Allocate a subdevice descriptor. | |
| int | a4l_add_subd (struct a4l_device *dev, struct a4l_subdevice *subd) |
| Add a subdevice to the driver descriptor. | |
| struct a4l_subdevice * | a4l_get_subd (struct a4l_device *dev, int idx) |
| Get a pointer to the subdevice descriptor referenced by its registration index. | |
Subdevice status | |
Flags to define the subdevice's status | |
| #define | A4L_SUBD_BUSY_NR 0 |
| The subdevice is busy, a synchronous or an asynchronous acquisition is occuring. | |
| #define | A4L_SUBD_BUSY (1 << A4L_SUBD_BUSY_NR) |
| The subdevice is busy, a synchronous or an asynchronous acquisition is occuring. | |
| #define | A4L_SUBD_CLEAN_NR 1 |
| The subdevice is about to be cleaned in the middle of the detach procedure. | |
| #define | A4L_SUBD_CLEAN (1 << A4L_SUBD_CLEAN_NR) |
| The subdevice is busy, a synchronous or an asynchronous acquisition is occuring. | |
Subdevice declaration in a driver.
The subdevice structure is the most complex one in the Analogy driver layer. It contains some description fields to fill and some callbacks to declare.
The description fields are:
The functions callbakcs are:
Once the subdevice is filled, it must be inserted into the driver structure thanks to a4l_add_subd().
| int a4l_add_subd | ( | struct a4l_device * | dev, |
| struct a4l_subdevice * | subd | ||
| ) |
Add a subdevice to the driver descriptor.
Once the driver descriptor structure is initialized, the function a4l_add_subd() must be used so to add some subdevices to the driver.
| [in] | dev | Device descriptor structure |
| [in] | subd | Subdevice descriptor structure |
References a4l_subdevice::dev, a4l_subdevice::idx, and a4l_subdevice::list.
| struct a4l_subdevice * a4l_alloc_subd | ( | int | sizeof_priv, |
| void(*)(struct a4l_subdevice *) | setup | ||
| ) |
Allocate a subdevice descriptor.
This is a helper function so as to get a suitable subdevice descriptor
| [in] | sizeof_priv | Size of the subdevice's private data |
| [in] | setup | Setup function to be called after the allocation |
References rtdm_malloc().
| struct a4l_subdevice * a4l_get_subd | ( | struct a4l_device * | dev, |
| int | idx | ||
| ) |
Get a pointer to the subdevice descriptor referenced by its registration index.
This function is scarcely useful as all the drivers callbacks get the related subdevice descriptor as first argument. This function is not optimized, it goes through a linked list to get the proper pointer. So it must not be used in real-time context but at initialization / cleanup time (attach / detach).
| [in] | dev | Device descriptor structure |
| [in] | idx | Subdevice index |