Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 /*
0003  * comedi_8255.h
0004  * Generic 8255 digital I/O subdevice support
0005  *
0006  * COMEDI - Linux Control and Measurement Device Interface
0007  * Copyright (C) 1998 David A. Schleef <ds@schleef.org>
0008  */
0009 
0010 #ifndef _COMEDI_8255_H
0011 #define _COMEDI_8255_H
0012 
0013 #define I8255_SIZE      0x04
0014 
0015 #define I8255_DATA_A_REG    0x00
0016 #define I8255_DATA_B_REG    0x01
0017 #define I8255_DATA_C_REG    0x02
0018 #define I8255_CTRL_REG      0x03
0019 #define I8255_CTRL_C_LO_IO  BIT(0)
0020 #define I8255_CTRL_B_IO     BIT(1)
0021 #define I8255_CTRL_B_MODE   BIT(2)
0022 #define I8255_CTRL_C_HI_IO  BIT(3)
0023 #define I8255_CTRL_A_IO     BIT(4)
0024 #define I8255_CTRL_A_MODE(x)    ((x) << 5)
0025 #define I8255_CTRL_CW       BIT(7)
0026 
0027 struct comedi_device;
0028 struct comedi_subdevice;
0029 
0030 int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
0031              int (*io)(struct comedi_device *dev, int dir, int port,
0032                    int data, unsigned long regbase),
0033              unsigned long regbase);
0034 
0035 int subdev_8255_mm_init(struct comedi_device *dev, struct comedi_subdevice *s,
0036             int (*io)(struct comedi_device *dev, int dir, int port,
0037                   int data, unsigned long regbase),
0038             unsigned long regbase);
0039 
0040 unsigned long subdev_8255_regbase(struct comedi_subdevice *s);
0041 
0042 #endif