File: gpio-i8255.h

package info (click to toggle)
linux 6.1.137-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,408 kB
  • sloc: ansic: 23,468,339; asm: 266,595; sh: 110,522; makefile: 49,887; python: 36,990; perl: 36,834; cpp: 6,056; yacc: 4,908; lex: 2,725; awk: 1,440; ruby: 25; sed: 5
file content (46 lines) | stat: -rw-r--r-- 1,513 bytes parent folder | download | duplicates (6)
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
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright 2022 William Breathitt Gray */
#ifndef _I8255_H_
#define _I8255_H_

#include <linux/spinlock.h>
#include <linux/types.h>

/**
 * struct i8255 - Intel 8255 register structure
 * @port:	Port A, B, and C
 * @control:	Control register
 */
struct i8255 {
	u8 port[3];
	u8 control;
};

/**
 * struct i8255_state - Intel 8255 state structure
 * @lock:		synchronization lock for accessing device state
 * @control_state:	Control register state
 */
struct i8255_state {
	spinlock_t lock;
	u8 control_state;
};

void i8255_direction_input(struct i8255 __iomem *ppi, struct i8255_state *state,
			   unsigned long offset);
void i8255_direction_output(struct i8255 __iomem *ppi,
			    struct i8255_state *state, unsigned long offset,
			    unsigned long value);
int i8255_get(struct i8255 __iomem *ppi, unsigned long offset);
int i8255_get_direction(const struct i8255_state *state, unsigned long offset);
void i8255_get_multiple(struct i8255 __iomem *ppi, const unsigned long *mask,
			unsigned long *bits, unsigned long ngpio);
void i8255_mode0_output(struct i8255 __iomem *const ppi);
void i8255_set(struct i8255 __iomem *ppi, struct i8255_state *state,
	       unsigned long offset, unsigned long value);
void i8255_set_multiple(struct i8255 __iomem *ppi, struct i8255_state *state,
			const unsigned long *mask, const unsigned long *bits,
			unsigned long ngpio);
void i8255_state_init(struct i8255_state *const state, unsigned long nbanks);

#endif /* _I8255_H_ */