1 1.3 dyoung /* $NetBSD: lubbock_var.h,v 1.3 2011/07/01 20:42:37 dyoung Exp $ */ 2 1.1 bsh 3 1.1 bsh /* 4 1.1 bsh * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. 5 1.1 bsh * Written by Hiroyuki Bessho for Genetec Corporation. 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 Corporation may not be used to endorse or 16 1.1 bsh * 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 CORPORATION ``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 CORPORATION 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_LUBBOCK_VAR_H 33 1.1 bsh #define _EVBARM_LUBBOCK_VAR_H 34 1.1 bsh 35 1.1 bsh #include <sys/conf.h> 36 1.1 bsh #include <sys/device.h> 37 1.1 bsh 38 1.3 dyoung #include <sys/bus.h> 39 1.1 bsh #include <evbarm/lubbock/lubbock_reg.h> 40 1.1 bsh 41 1.1 bsh 42 1.1 bsh /* 43 1.1 bsh * Lubbock on-board IO bus 44 1.1 bsh */ 45 1.1 bsh #define N_OBIO_IRQ 8 46 1.1 bsh 47 1.1 bsh struct obio_softc { 48 1.2 rjs device_t sc_dev; 49 1.1 bsh bus_space_tag_t sc_iot; 50 1.1 bsh bus_space_handle_t sc_obioreg_ioh; 51 1.1 bsh void *sc_ih; /* interrupt handler for obio on pxaip */ 52 1.1 bsh void *sc_si; /* software interrupt handler */ 53 1.1 bsh int sc_intr; 54 1.1 bsh int sc_obio_intr_mask; 55 1.1 bsh int sc_obio_intr_pending; 56 1.1 bsh int sc_ipl; /* Max ipl among sub interrupts */ 57 1.1 bsh struct obio_handler { 58 1.1 bsh int (* func)(void *); 59 1.1 bsh void *arg; 60 1.1 bsh int level; 61 1.1 bsh } sc_handler[N_OBIO_IRQ]; 62 1.1 bsh }; 63 1.1 bsh 64 1.1 bsh typedef void *obio_chipset_tag_t; 65 1.1 bsh 66 1.1 bsh struct obio_attach_args { 67 1.1 bsh obio_chipset_tag_t oba_sc; 68 1.1 bsh bus_space_tag_t oba_iot; /* Bus tag */ 69 1.1 bsh bus_addr_t oba_addr; /* i/o address */ 70 1.1 bsh int oba_intr; 71 1.1 bsh }; 72 1.1 bsh 73 1.1 bsh /* on-board hex LED */ 74 1.1 bsh void hex_led_blank( uint32_t value, int blank ); 75 1.1 bsh #define hex_led(value) ioreg_write( LUBBOCK_OBIO_VBASE+LUBBOCK_HEXLED, (value) ) 76 1.1 bsh #define hex_led_p(value) ioreg_write( LUBBOCK_OBIO_PBASE+LUBBOCK_HEXLED, (value) ) 77 1.1 bsh 78 1.1 bsh #define d_led(value) ioreg16_write( LUBBOCK_OBIO_VBASE+LUBBOCK_LEDCTL, (value) ) 79 1.1 bsh 80 1.1 bsh /* 81 1.1 bsh * IRQ handler 82 1.1 bsh */ 83 1.1 bsh void *obio_intr_establish(struct obio_softc *, int, int, int (*)(void *), void *); 84 1.1 bsh void obio_intr_disestablish(void *); 85 1.1 bsh 86 1.1 bsh #define obio_read(offset) ioreg_read(LUBBOCK_OBIO_VBASE+(offset)) 87 1.1 bsh #define obio_write(offset,value) \ 88 1.1 bsh ioreg_write(LUBBOCK_OBIO_VBASE+(offset), (value)) 89 1.1 bsh 90 1.1 bsh 91 1.1 bsh #define obio16_read(offset) ioreg16_read(LUBBOCK_OBIO_VBASE+(offset)) 92 1.1 bsh #define obio16_write(offset,value) \ 93 1.1 bsh ioreg16_write(LUBBOCK_OBIO_VBASE+(offset), (value)) 94 1.1 bsh 95 1.1 bsh #define obio8_read(offset) ioreg8_read(LUBBOCK_OBIO_VBASE+(offset)) 96 1.1 bsh #define obio8_write(offset,value) \ 97 1.1 bsh ioreg8_write(LUBBOCK_OBIO_VBASE+(offset), (value)) 98 1.1 bsh 99 1.1 bsh 100 1.1 bsh #endif /* _EVBARM_LUBBOCK_VAR_H */ 101