1 1.4 andvar /* $NetBSD: gb225var.h,v 1.4 2022/02/16 20:31:43 andvar Exp $ */ 2 1.1 bsh 3 1.1 bsh /* 4 1.1 bsh * Copyright (c) 2002, 2003 Genetec corp. All rights reserved. 5 1.1 bsh * Written by Hiroyuki Bessho for Genetec corp. 6 1.1 bsh * 7 1.1 bsh * Redistribution and use in source and binary forms, with or without 8 1.1 bsh * modification, are permitted provided that the following conditions 9 1.1 bsh * are met: 10 1.1 bsh * 1. Redistributions of source code must retain the above copyright 11 1.1 bsh * notice, this list of conditions and the following disclaimer. 12 1.1 bsh * 2. Redistributions in binary form must reproduce the above copyright 13 1.1 bsh * notice, this list of conditions and the following disclaimer in the 14 1.1 bsh * documentation and/or other materials provided with the distribution. 15 1.1 bsh * 3. The name of Genetec corp. may not be used to endorse 16 1.1 bsh * or promote products derived from this software without specific prior 17 1.1 bsh * written permission. 18 1.1 bsh * 19 1.1 bsh * THIS SOFTWARE IS PROVIDED BY GENETEC CORP. ``AS IS'' AND 20 1.1 bsh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 1.1 bsh * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 1.1 bsh * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENETEC CORP. 23 1.1 bsh * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 1.1 bsh * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 1.1 bsh * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 1.1 bsh * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 1.1 bsh * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 1.1 bsh * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 1.1 bsh * POSSIBILITY OF SUCH DAMAGE. 30 1.1 bsh */ 31 1.1 bsh 32 1.1 bsh #ifndef _EVBARM_GB225VAR_H 33 1.1 bsh #define _EVBARM_GB225VAR_H 34 1.1 bsh 35 1.1 bsh #include <sys/queue.h> 36 1.1 bsh #include <sys/callout.h> 37 1.1 bsh 38 1.1 bsh /* 39 1.4 andvar * Interrupt sources for option board CPLD. 40 1.1 bsh */ 41 1.1 bsh #define OPIO_INTR_CF_INSERT 0 42 1.1 bsh #define OPIO_INTR_PCMCIA_INSERT 1 43 1.1 bsh #define OPIO_INTR_USB_POWER 2 /* USB power fault */ 44 1.1 bsh #define OPIO_INTR_CARD_POWER 3 /* PCMCIA/CF power fault */ 45 1.1 bsh #define N_OPIO_INTR 4 46 1.1 bsh 47 1.1 bsh 48 1.1 bsh struct opio_intr_handler; 49 1.1 bsh 50 1.1 bsh struct opio_softc { 51 1.3 bsh device_t sc_dev; 52 1.1 bsh 53 1.1 bsh bus_space_tag_t sc_iot; 54 1.1 bsh bus_space_handle_t sc_ioh; 55 1.1 bsh 56 1.1 bsh bus_space_handle_t sc_memctl_ioh; /* PXA2x0's memory controller */ 57 1.1 bsh 58 1.1 bsh void *sc_ih; /* interrupt handler */ 59 1.1 bsh /* callout for debounce */ 60 1.1 bsh struct callout sc_callout; 61 1.1 bsh 62 1.1 bsh enum {ST_STABLE, ST_BOUNCING } sc_debounce; 63 1.1 bsh 64 1.1 bsh struct opio_intr_handler { 65 1.1 bsh int (* func)(void *, int); 66 1.1 bsh void *arg; 67 1.1 bsh int level; 68 1.1 bsh 69 1.1 bsh uint8_t reported_state; 70 1.1 bsh uint8_t last_state; 71 1.1 bsh short debounce_count; 72 1.1 bsh } sc_intr[N_OPIO_INTR]; 73 1.1 bsh }; 74 1.1 bsh 75 1.1 bsh 76 1.1 bsh void *opio_intr_establish(struct opio_softc *, int, int, 77 1.1 bsh int (*)(void *, int), void *); 78 1.1 bsh 79 1.1 bsh #endif /* _EVBARM_GB225VAR_H */ 80