GNU Linux-libre 4.19.286-gnu1
[releases.git] / drivers / staging / comedi / drivers / 8255.h
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * module/8255.h
4  * Header file for 8255
5  *
6  * COMEDI - Linux Control and Measurement Device Interface
7  * Copyright (C) 1998 David A. Schleef <ds@schleef.org>
8  */
9
10 #ifndef _8255_H
11 #define _8255_H
12
13 #define I8255_SIZE              0x04
14
15 #define I8255_DATA_A_REG        0x00
16 #define I8255_DATA_B_REG        0x01
17 #define I8255_DATA_C_REG        0x02
18 #define I8255_CTRL_REG          0x03
19 #define I8255_CTRL_C_LO_IO      BIT(0)
20 #define I8255_CTRL_B_IO         BIT(1)
21 #define I8255_CTRL_B_MODE       BIT(2)
22 #define I8255_CTRL_C_HI_IO      BIT(3)
23 #define I8255_CTRL_A_IO         BIT(4)
24 #define I8255_CTRL_A_MODE(x)    ((x) << 5)
25 #define I8255_CTRL_CW           BIT(7)
26
27 struct comedi_device;
28 struct comedi_subdevice;
29
30 int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
31                      int (*io)(struct comedi_device *dev, int dir, int port,
32                                int data, unsigned long regbase),
33                      unsigned long regbase);
34
35 int subdev_8255_mm_init(struct comedi_device *dev, struct comedi_subdevice *s,
36                         int (*io)(struct comedi_device *dev, int dir, int port,
37                                   int data, unsigned long regbase),
38                         unsigned long regbase);
39
40 unsigned long subdev_8255_regbase(struct comedi_subdevice *s);
41
42 #endif