Home | History | Annotate | Line # | Download | only in ic
      1 /* $NetBSD: igpiovar.h,v 1.2 2023/01/07 03:27:01 msaitoh Exp $ */
      2 
      3 /*
      4  * Copyright (c) 2021 Emmanuel Dreyfus
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  *
     16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     18  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     19  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
     20  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     21  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     22  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     23  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     25  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     26  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27  */
     28 
     29 #ifndef _IGPIOVAR_H
     30 #define _IGPIOVAR_H
     31 
     32 struct igpio_softc {
     33 	device_t		sc_dev;
     34 	const char		*sc_acpi_hid;
     35 	bus_space_tag_t		sc_bst;
     36 	int			sc_nbar;
     37 	bus_addr_t		*sc_base;
     38 	bus_size_t		*sc_length;
     39 	bus_space_handle_t	*sc_bsh;
     40 
     41 	gpio_pin_t		*sc_pins;
     42 	int			sc_npins;
     43 	struct gpio_chipset_tag	sc_gc;
     44 
     45 	uint32_t		sc_reserved_mask;
     46 
     47 	struct igpio_bank	*sc_banks;
     48 };
     49 
     50 void igpio_attach(struct igpio_softc *);
     51 void igpio_detach(struct igpio_softc *);
     52 
     53 int	igpio_pin_read(void *, int);
     54 void	igpio_pin_write(void *, int, int);
     55 void	igpio_pin_ctl(void *, int, int);
     56 void	*igpio_intr_establish(void *, int, int, int, int (*)(void *), void *);
     57 void	igpio_intr_disestablish(void *, void *);
     58 bool	igpio_intr_str(void *, int, int, char *, size_t);
     59 int	igpio_intr(void *);
     60 
     61 
     62 
     63 #endif /* !_IGPIOVAR_H */
     64