xref: /netbsd-src/sys/arch/arm/ep93xx/epgpiovar.h (revision 7959c31a5fa0aa1b952f2e8df752784f943a42a1)
1 /*	$NetBSD: epgpiovar.h,v 1.1 2005/11/12 05:33:23 hamajima Exp $	*/
2 
3 /*
4  * Copyright (c) 2005 HAMAJIMA Katsuomi. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  */
27 
28 #ifndef	_EPGPIOVAR_H_
29 #define	_EPGPIOVAR_H_
30 
31 typedef enum {
32 	PORT_A = 0,
33 	PORT_B = 1,
34 	PORT_C = 2,
35 	PORT_D = 3,
36 	PORT_E = 4,
37 	PORT_F = 5,
38 	PORT_G = 6,
39 	PORT_H = 7
40 } epgpio_port;
41 
42 struct epgpio_softc;
43 
44 int epgpio_read(struct epgpio_softc *,epgpio_port, int bit);
45 void epgpio_set(struct epgpio_softc *,epgpio_port, int bit);
46 void epgpio_clear(struct epgpio_softc *,epgpio_port, int bit);
47 void epgpio_in(struct epgpio_softc *,epgpio_port, int bit);
48 void epgpio_out(struct epgpio_softc *,epgpio_port, int bit);
49 
50 void *epgpio_intr_establish(struct epgpio_softc *,epgpio_port, int bit,
51 			    int flag, int ipl, int (*)(void *), void *);
52 void epgpio_intr_disestablish(struct epgpio_softc *,epgpio_port, int bit);
53 
54 /* interrupt flags */
55 #define	EDGE_TRIGGER	0x01
56 #define	LEVEL_SENSE	0x00
57 #define	RISING_EDGE	0x02
58 #define	HIGH_LEVEL	0x02
59 #define	FALLING_EDGE	0x00
60 #define	LOW_LEVEL	0x00
61 #define	DEBOUNCE	0x04
62 
63 struct epgpio_attach_args {
64 	struct epgpio_softc	*ga_gc;
65 	bus_space_tag_t		ga_iot;		/* Bus tag */
66 	bus_addr_t		ga_addr;	/* i/o address */
67 	int			ga_port;
68 	int			ga_bit1;
69 	int			ga_bit2;
70 };
71 
72 #endif	/* _EPGPIOVAR_H_ */
73