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