Xenomai  3.1
transfer.h
1 /*
2  * Analogy for Linux, transfer related features
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_TRANSFER_H
22 #define _COBALT_RTDM_ANALOGY_TRANSFER_H
23 
24 #include <rtdm/analogy/buffer.h>
25 
26 /* IRQ types */
27 #define A4L_IRQ_DISABLED 0
28 
29 /* Fields init values */
30 #define A4L_IRQ_UNUSED (unsigned int)((unsigned short)(~0))
31 #define A4L_IDX_UNUSED (unsigned int)(~0)
32 
33 /* TODO: IRQ handling must leave transfer for os_facilities */
34 
35 struct a4l_device;
36 /* Analogy transfer descriptor */
37 struct a4l_transfer {
38 
39  /* Subdevices desc */
40  unsigned int nb_subd;
41  struct a4l_subdevice **subds;
42 
43  /* Buffer stuff: the default size */
44  unsigned int default_bufsize;
45 
46  /* IRQ in use */
47  /* TODO: irq_desc should vanish */
48  struct a4l_irq_descriptor irq_desc;
49 };
50 
51 /* --- Proc function --- */
52 
53 int a4l_rdproc_transfer(struct seq_file *p, void *data);
54 
55 /* --- Upper layer functions --- */
56 
57 void a4l_presetup_transfer(struct a4l_device_context * cxt);
58 int a4l_setup_transfer(struct a4l_device_context * cxt);
59 int a4l_precleanup_transfer(struct a4l_device_context * cxt);
60 int a4l_cleanup_transfer(struct a4l_device_context * cxt);
61 int a4l_reserve_transfer(struct a4l_device_context * cxt, int idx_subd);
62 int a4l_init_transfer(struct a4l_device_context * cxt, struct a4l_cmd_desc * cmd);
63 int a4l_cancel_transfer(struct a4l_device_context * cxt, int idx_subd);
64 int a4l_cancel_transfers(struct a4l_device_context * cxt);
65 
66 ssize_t a4l_put(struct a4l_device_context * cxt, void *buf, size_t nbytes);
67 ssize_t a4l_get(struct a4l_device_context * cxt, void *buf, size_t nbytes);
68 
69 int a4l_request_irq(struct a4l_device *dev,
70  unsigned int irq,
71  a4l_irq_hdlr_t handler,
72  unsigned long flags, void *cookie);
73 int a4l_free_irq(struct a4l_device *dev, unsigned int irq);
74 unsigned int a4l_get_irq(struct a4l_device *dev);
75 
76 int a4l_ioctl_cancel(struct a4l_device_context * cxt, void *arg);
77 
78 #endif /* !_COBALT_RTDM_ANALOGY_TRANSFER_H */
int a4l_request_irq(struct a4l_device *dev, unsigned int irq, a4l_irq_hdlr_t handler, unsigned long flags, void *cookie)
Register an interrupt handler for a specific device.
Definition: transfer.c:151
Structure describing the asynchronous instruction.
Definition: analogy.h:289
unsigned int a4l_get_irq(struct a4l_device *dev)
Get the interrupt number in use for a specific device.
Definition: transfer.c:189
Structure describing the subdevice.
Definition: subdevice.h:40
int a4l_free_irq(struct a4l_device *dev, unsigned int irq)
Release an interrupt handler for a specific device.
Definition: transfer.c:171