Xenomai  3.1
8255.h
1 /*
2  * Hardware driver for 8255 chip
3  * @note Copyright (C) 1999 David A. Schleef <ds@schleef.org>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14 
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18  */
19 #ifndef __ANALOGY_8255_H__
20 #define __ANALOGY_8255_H__
21 
22 #include <rtdm/analogy/device.h>
23 
24 typedef int (*a4l_8255_cb_t)(int, int, int, unsigned long);
25 
26 typedef struct subd_8255_struct {
27  unsigned long cb_arg;
28  a4l_8255_cb_t cb_func;
29  unsigned int status;
30  int have_irq;
31  int io_bits;
32 } subd_8255_t;
33 
34 #if (defined(CONFIG_XENO_DRIVERS_ANALOGY_8255) || \
35  defined(CONFIG_XENO_DRIVERS_ANALOGY_8255_MODULE))
36 
37 #define _8255_SIZE 4
38 
39 #define _8255_DATA 0
40 #define _8255_CR 3
41 
42 #define CR_C_LO_IO 0x01
43 #define CR_B_IO 0x02
44 #define CR_B_MODE 0x04
45 #define CR_C_HI_IO 0x08
46 #define CR_A_IO 0x10
47 #define CR_A_MODE(a) ((a)<<5)
48 #define CR_CW 0x80
49 
50 void a4l_subdev_8255_init(struct a4l_subdevice *subd);
51 void a4l_subdev_8255_interrupt(struct a4l_subdevice *subd);
52 
53 #else /* !CONFIG_XENO_DRIVERS_ANALOGY_8255 */
54 
55 #define a4l_subdev_8255_init(x) do { } while(0)
56 #define a4l_subdev_8255_interrupt(x) do { } while(0)
57 
58 #endif /* CONFIG_XENO_DRIVERS_ANALOGY_8255 */
59 
60 #endif /* !__ANALOGY_8255_H__ */
Structure describing the subdevice.
Definition: subdevice.h:40