Annotation of sys/arch/jornada/include/jornada_intr.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: armish_intr.h,v 1.4 2007/05/19 15:47:18 miod Exp $ */
! 2: /* $NetBSD: sa11x0_intr.h,v 1.4 2003/07/05 06:53:08 dogcow Exp $ */
! 3:
! 4: /*
! 5: * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
! 6: * All rights reserved.
! 7: *
! 8: * Written by Jason R. Thorpe for Wasabi Systems, Inc.
! 9: *
! 10: * Redistribution and use in source and binary forms, with or without
! 11: * modification, are permitted provided that the following conditions
! 12: * are met:
! 13: * 1. Redistributions of source code must retain the above copyright
! 14: * notice, this list of conditions and the following disclaimer.
! 15: * 2. Redistributions in binary form must reproduce the above copyright
! 16: * notice, this list of conditions and the following disclaimer in the
! 17: * documentation and/or other materials provided with the distribution.
! 18: * 3. All advertising materials mentioning features or use of this software
! 19: * must display the following acknowledgement:
! 20: * This product includes software developed for the NetBSD Project by
! 21: * Wasabi Systems, Inc.
! 22: * 4. The name of Wasabi Systems, Inc. may not be used to endorse
! 23: * or promote products derived from this software without specific prior
! 24: * written permission.
! 25: *
! 26: * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
! 27: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! 28: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! 29: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
! 30: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! 31: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! 32: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! 33: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! 34: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! 35: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! 36: * POSSIBILITY OF SUCH DAMAGE.
! 37: */
! 38:
! 39: #ifndef _SA11X0_INTR_H_
! 40: #define _SA11X0_INTR_H_
! 41:
! 42: #define ARM_IRQ_HANDLER _C_LABEL(sa11x0_irq_handler)
! 43:
! 44: #ifndef _LOCORE
! 45:
! 46: #include <arm/armreg.h>
! 47: #include <arm/cpufunc.h>
! 48: #include <arm/softintr.h>
! 49:
! 50: extern __volatile int current_ipl_level;
! 51: extern __volatile int softint_pending;
! 52: extern int sa11x0_imask[];
! 53: void sa11x0_do_pending(void);
! 54:
! 55: void sa11x0_setipl(int new);
! 56: void sa11x0_splx(int new);
! 57: int sa11x0_splraise(int ipl);
! 58: int sa11x0_spllower(int ipl);
! 59: void sa11x0_setsoftintr(int si);
! 60:
! 61: /*
! 62: * An useful function for interrupt handlers.
! 63: * XXX: This shouldn't be here.
! 64: */
! 65: static __inline int
! 66: find_first_bit( uint32_t bits )
! 67: {
! 68: int count;
! 69: uint32_t mask;
! 70:
! 71: /*
! 72: * If we weren't ARMv4 then we would use CLZ insn here (ARMv5 and above).
! 73: * Since our CPU is SA1 which is ARMv4 we implement this in software.
! 74: * TODO optimize code.
! 75: */
! 76: count = 0;
! 77: mask = 1 << 31; /* we start from MSB */
! 78: for (; mask > 0; mask >>= 1)
! 79: if (bits & mask)
! 80: break;
! 81: else
! 82: count++;
! 83:
! 84: return 31 - count;
! 85: }
! 86:
! 87:
! 88: int _splraise(int);
! 89: int _spllower(int);
! 90: void splx(int);
! 91: void _setsoftintr(int);
! 92:
! 93: /*
! 94: * This function *MUST* be called very early on in a port's
! 95: * initarm() function, before ANY spl*() functions are called.
! 96: *
! 97: * The parameter is the virtual address of the I80321's Interrupt
! 98: * Controller registers.
! 99: */
! 100: void sa11x0_intr_bootstrap(vaddr_t);
! 101:
! 102: void sa11x0_irq_handler(void *);
! 103: #if 0
! 104: void *sa11x0_intr_establish(int irqno, int level, int (*func)(void *),
! 105: void *cookie, char *name);
! 106: void sa11x0_intr_disestablish(void *cookie);
! 107: #endif
! 108: const char *sa11x0_intr_string(void *cookie);
! 109:
! 110: #ifdef DIAGNOSTIC
! 111: /*
! 112: * Although this function is implemented in MI code, it must be in this MD
! 113: * header because we don't want this header to include MI includes.
! 114: */
! 115: void splassert_fail(int, int, const char *);
! 116: extern int splassert_ctl;
! 117: void sa11x0_splassert_check(int, const char *);
! 118: #define splassert(__wantipl) do { \
! 119: if (splassert_ctl > 0) { \
! 120: sa11x0_splassert_check(__wantipl, __func__); \
! 121: } \
! 122: } while (0)
! 123: #else
! 124: #define splassert(wantipl) do { /* nothing */ } while (0)
! 125: #endif
! 126:
! 127: #endif /* ! _LOCORE */
! 128:
! 129: #endif /* _SA11X0_INTR_H_ */
! 130:
CVSweb