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