at91piovar.h revision 1.1.22.1 1 1.1.22.1 simonb /* $NetBSD: at91piovar.h,v 1.1.22.1 2008/07/03 18:37:51 simonb Exp $ */
2 1.1.22.1 simonb
3 1.1.22.1 simonb /*
4 1.1.22.1 simonb * Copyright (c) 2007 Embedtronics Oy. All rights reserved.
5 1.1.22.1 simonb *
6 1.1.22.1 simonb * Based on arch/arm/ep93xx/epgiovar.h
7 1.1.22.1 simonb * Copyright (c) 2005 HAMAJIMA Katsuomi. All rights reserved.
8 1.1.22.1 simonb *
9 1.1.22.1 simonb * Redistribution and use in source and binary forms, with or without
10 1.1.22.1 simonb * modification, are permitted provided that the following conditions
11 1.1.22.1 simonb * are met:
12 1.1.22.1 simonb * 1. Redistributions of source code must retain the above copyright
13 1.1.22.1 simonb * notice, this list of conditions and the following disclaimer.
14 1.1.22.1 simonb * 2. Redistributions in binary form must reproduce the above copyright
15 1.1.22.1 simonb * notice, this list of conditions and the following disclaimer in the
16 1.1.22.1 simonb * documentation and/or other materials provided with the distribution.
17 1.1.22.1 simonb *
18 1.1.22.1 simonb * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 1.1.22.1 simonb * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 1.1.22.1 simonb * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 1.1.22.1 simonb * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 1.1.22.1 simonb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 1.1.22.1 simonb * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 1.1.22.1 simonb * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 1.1.22.1 simonb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 1.1.22.1 simonb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 1.1.22.1 simonb * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 1.1.22.1 simonb * SUCH DAMAGE.
29 1.1.22.1 simonb */
30 1.1.22.1 simonb
31 1.1.22.1 simonb #ifndef _AT91PIOVAR_H_
32 1.1.22.1 simonb #define _AT91PIOVAR_H_
33 1.1.22.1 simonb
34 1.1.22.1 simonb typedef enum {
35 1.1.22.1 simonb AT91_PIOA,
36 1.1.22.1 simonb AT91_PIOB,
37 1.1.22.1 simonb AT91_PIOC,
38 1.1.22.1 simonb AT91_PIOD,
39 1.1.22.1 simonb AT91_PIOE,
40 1.1.22.1 simonb AT91_PIOF,
41 1.1.22.1 simonb AT91_PIOG,
42 1.1.22.1 simonb AT91_PIOH,
43 1.1.22.1 simonb AT91_PIO_COUNT,
44 1.1.22.1 simonb AT91_PIO_INVALID = AT91_PIO_COUNT
45 1.1.22.1 simonb } at91pio_port;
46 1.1.22.1 simonb
47 1.1.22.1 simonb struct at91pio_softc;
48 1.1.22.1 simonb
49 1.1.22.1 simonb struct at91pio_softc *at91pio_sc(at91pio_port);
50 1.1.22.1 simonb
51 1.1.22.1 simonb int at91pio_read(struct at91pio_softc *, int bit);
52 1.1.22.1 simonb void at91pio_set(struct at91pio_softc *, int bit);
53 1.1.22.1 simonb void at91pio_clear(struct at91pio_softc *, int bit);
54 1.1.22.1 simonb void at91pio_in(struct at91pio_softc *, int bit);
55 1.1.22.1 simonb void at91pio_out(struct at91pio_softc *, int bit);
56 1.1.22.1 simonb void at91pio_per(struct at91pio_softc *, int bit, int perab);
57 1.1.22.1 simonb
58 1.1.22.1 simonb void *at91pio_intr_establish(struct at91pio_softc *,int bit,
59 1.1.22.1 simonb int ipl, int (*)(void *), void *);
60 1.1.22.1 simonb void at91pio_intr_disestablish(struct at91pio_softc *,int bit,
61 1.1.22.1 simonb void *cookie);
62 1.1.22.1 simonb
63 1.1.22.1 simonb struct at91pio_attach_args {
64 1.1.22.1 simonb struct at91pio_softc *paa_sc;
65 1.1.22.1 simonb bus_space_tag_t paa_iot; /* Bus tag */
66 1.1.22.1 simonb bus_addr_t paa_addr; /* i/o address */
67 1.1.22.1 simonb int paa_pid; /* peripheral id */
68 1.1.22.1 simonb int paa_bit; /* pin number */
69 1.1.22.1 simonb };
70 1.1.22.1 simonb
71 1.1.22.1 simonb #endif /* _AT91PIOVAR_H_ */
72