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