comedi_8255.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * comedi_8255.h
  4. * Generic 8255 digital I/O subdevice support
  5. *
  6. * COMEDI - Linux Control and Measurement Device Interface
  7. * Copyright (C) 1998 David A. Schleef <[email protected]>
  8. */
  9. #ifndef _COMEDI_8255_H
  10. #define _COMEDI_8255_H
  11. #define I8255_SIZE 0x04
  12. #define I8255_DATA_A_REG 0x00
  13. #define I8255_DATA_B_REG 0x01
  14. #define I8255_DATA_C_REG 0x02
  15. #define I8255_CTRL_REG 0x03
  16. #define I8255_CTRL_C_LO_IO BIT(0)
  17. #define I8255_CTRL_B_IO BIT(1)
  18. #define I8255_CTRL_B_MODE BIT(2)
  19. #define I8255_CTRL_C_HI_IO BIT(3)
  20. #define I8255_CTRL_A_IO BIT(4)
  21. #define I8255_CTRL_A_MODE(x) ((x) << 5)
  22. #define I8255_CTRL_CW BIT(7)
  23. struct comedi_device;
  24. struct comedi_subdevice;
  25. int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
  26. int (*io)(struct comedi_device *dev, int dir, int port,
  27. int data, unsigned long regbase),
  28. unsigned long regbase);
  29. int subdev_8255_mm_init(struct comedi_device *dev, struct comedi_subdevice *s,
  30. int (*io)(struct comedi_device *dev, int dir, int port,
  31. int data, unsigned long regbase),
  32. unsigned long regbase);
  33. unsigned long subdev_8255_regbase(struct comedi_subdevice *s);
  34. #endif