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