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