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