Xenomai  3.1
context.h
1 /*
2  * Analogy for Linux, context structure / macros declarations
3  *
4  * Copyright (C) 1997-2000 David A. Schleef <ds@schleef.org>
5  * Copyright (C) 2008 Alexis Berlemont <alexis.berlemont@free.fr>
6  *
7  * Xenomai is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * Xenomai is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with Xenomai; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  */
21 #ifndef _COBALT_RTDM_ANALOGY_CONTEXT_H
22 #define _COBALT_RTDM_ANALOGY_CONTEXT_H
23 
24 #include <rtdm/driver.h>
25 
26 struct a4l_device;
27 struct a4l_buffer;
28 
29 struct a4l_device_context {
30  /* The adequate device pointer
31  (retrieved thanks to minor at open time) */
32  struct a4l_device *dev;
33 
34  /* The buffer structure contains everything to transfer data
35  from asynchronous acquisition operations on a specific
36  subdevice */
37  struct a4l_buffer *buffer;
38 };
39 
40 static inline int a4l_get_minor(struct a4l_device_context *cxt)
41 {
42  /* Get a pointer on the container structure */
43  struct rtdm_fd *fd = rtdm_private_to_fd(cxt);
44  /* Get the minor index */
45  return rtdm_fd_minor(fd);
46 }
47 
48 #endif /* !_COBALT_RTDM_ANALOGY_CONTEXT_H */
Real-Time Driver Model for Xenomai, driver API header.
static struct rtdm_fd * rtdm_private_to_fd(void *dev_private)
Locate a device file descriptor structure from its driver private area.
Definition: driver.h:174