Home | History | Annotate | Line # | Download | only in include
intr.h revision 1.22.28.1
      1  1.22.28.1      ad /*	$NetBSD: intr.h,v 1.22.28.1 2007/12/03 18:38:54 ad Exp $	*/
      2        1.1  itojun 
      3       1.16     uch /*-
      4       1.16     uch  * Copyright (c) 2002 The NetBSD Foundation, Inc.
      5       1.16     uch  * All rights reserved.
      6        1.1  itojun  *
      7        1.1  itojun  * Redistribution and use in source and binary forms, with or without
      8        1.1  itojun  * modification, are permitted provided that the following conditions
      9        1.1  itojun  * are met:
     10        1.1  itojun  * 1. Redistributions of source code must retain the above copyright
     11        1.1  itojun  *    notice, this list of conditions and the following disclaimer.
     12        1.1  itojun  * 2. Redistributions in binary form must reproduce the above copyright
     13        1.1  itojun  *    notice, this list of conditions and the following disclaimer in the
     14        1.1  itojun  *    documentation and/or other materials provided with the distribution.
     15        1.1  itojun  * 3. All advertising materials mentioning features or use of this software
     16        1.1  itojun  *    must display the following acknowledgement:
     17       1.16     uch  *        This product includes software developed by the NetBSD
     18       1.16     uch  *        Foundation, Inc. and its contributors.
     19       1.16     uch  * 4. Neither the name of The NetBSD Foundation nor the names of its
     20       1.16     uch  *    contributors may be used to endorse or promote products derived
     21       1.16     uch  *    from this software without specific prior written permission.
     22        1.1  itojun  *
     23       1.16     uch  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     24       1.16     uch  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     25       1.16     uch  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     26       1.16     uch  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     27       1.16     uch  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     28       1.16     uch  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     29       1.16     uch  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     30       1.16     uch  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     31       1.16     uch  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     32       1.16     uch  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     33       1.16     uch  * POSSIBILITY OF SUCH DAMAGE.
     34        1.1  itojun  */
     35        1.1  itojun 
     36        1.1  itojun #ifndef _SH3_INTR_H_
     37       1.16     uch #define	_SH3_INTR_H_
     38        1.1  itojun 
     39       1.16     uch #include <sys/device.h>
     40       1.16     uch #include <sys/lock.h>
     41       1.16     uch #include <sys/queue.h>
     42       1.15     uch #include <sh3/psl.h>
     43       1.14     uch 
     44        1.1  itojun /* Interrupt sharing types. */
     45       1.16     uch #define	IST_NONE		0	/* none */
     46       1.16     uch #define	IST_PULSE		1	/* pulsed */
     47       1.16     uch #define	IST_EDGE		2	/* edge-triggered */
     48       1.16     uch #define	IST_LEVEL		3	/* level-triggered */
     49       1.16     uch 
     50       1.16     uch /* Interrupt priority levels */
     51  1.22.28.1      ad #define	_IPL_N		8
     52       1.16     uch #define	_IPL_NSOFT	4
     53       1.16     uch 
     54       1.16     uch #define	IPL_NONE	0	/* nothing */
     55  1.22.28.1      ad #define	IPL_SOFTCLOCK	1
     56  1.22.28.1      ad #define	IPL_SOFTBIO	2	/* timeouts */
     57       1.16     uch #define	IPL_SOFTNET	3	/* protocol stacks */
     58       1.16     uch #define	IPL_SOFTSERIAL	4	/* serial */
     59       1.16     uch 
     60       1.16     uch struct intc_intrhand {
     61       1.16     uch 	int	(*ih_func)(void *);
     62       1.16     uch 	void	*ih_arg;
     63       1.16     uch 	int	ih_level;	/* SR.I[0:3] value */
     64       1.16     uch 	int	ih_evtcode;	/* INTEVT or INTEVT2(SH7709/SH7709A) */
     65       1.16     uch 	int	ih_idx;		/* evtcode -> intrhand mapping */
     66       1.16     uch };
     67       1.16     uch 
     68       1.22     uwe /* from 0x200 by 0x20 -> from 0 by 1 */
     69       1.22     uwe #define	EVTCODE_TO_MAP_INDEX(x)		(((x) >> 5) - 0x10)
     70       1.17     uch #define	EVTCODE_TO_IH_INDEX(x)						\
     71       1.16     uch 	__intc_evtcode_to_ih[EVTCODE_TO_MAP_INDEX(x)]
     72       1.17     uch #define	EVTCODE_IH(x)	(&__intc_intrhand[EVTCODE_TO_IH_INDEX(x)])
     73       1.16     uch extern int8_t __intc_evtcode_to_ih[];
     74       1.16     uch extern struct intc_intrhand __intc_intrhand[];
     75       1.16     uch 
     76       1.16     uch void intc_init(void);
     77       1.16     uch void *intc_intr_establish(int, int, int, int (*)(void *), void *);
     78       1.16     uch void intc_intr_disestablish(void *);
     79       1.19     uwe void intc_intr_enable(int);
     80       1.19     uwe void intc_intr_disable(int);
     81       1.16     uch void intc_intr(int, int, int);
     82       1.16     uch 
     83       1.20  nonaka void intpri_intr_priority(int evtcode, int level);
     84       1.20  nonaka 
     85        1.1  itojun #endif /* !_SH3_INTR_H_ */
     86