Home | History | Annotate | Line # | Download | only in include
intr.h revision 1.25.14.1
      1  1.25.14.1     jym /*	$NetBSD: intr.h,v 1.25.14.1 2009/05/13 17:18:22 jym 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  *
     16       1.16     uch  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     17       1.16     uch  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     18       1.16     uch  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     19       1.16     uch  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     20       1.16     uch  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     21       1.16     uch  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     22       1.16     uch  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     23       1.16     uch  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     24       1.16     uch  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     25       1.16     uch  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26       1.16     uch  * POSSIBILITY OF SUCH DAMAGE.
     27        1.1  itojun  */
     28        1.1  itojun 
     29        1.1  itojun #ifndef _SH3_INTR_H_
     30       1.16     uch #define	_SH3_INTR_H_
     31        1.1  itojun 
     32       1.15     uch #include <sh3/psl.h>
     33       1.14     uch 
     34        1.1  itojun /* Interrupt sharing types. */
     35       1.16     uch #define	IST_NONE		0	/* none */
     36       1.16     uch #define	IST_PULSE		1	/* pulsed */
     37       1.16     uch #define	IST_EDGE		2	/* edge-triggered */
     38       1.16     uch #define	IST_LEVEL		3	/* level-triggered */
     39       1.16     uch 
     40       1.16     uch /* Interrupt priority levels */
     41  1.25.14.1     jym #define	_IPL_N		16
     42       1.16     uch #define	_IPL_NSOFT	4
     43       1.16     uch 
     44       1.16     uch #define	IPL_NONE	0	/* nothing */
     45       1.23      ad #define	IPL_SOFTCLOCK	1
     46       1.23      ad #define	IPL_SOFTBIO	2	/* timeouts */
     47       1.16     uch #define	IPL_SOFTNET	3	/* protocol stacks */
     48       1.16     uch #define	IPL_SOFTSERIAL	4	/* serial */
     49       1.16     uch 
     50       1.16     uch struct intc_intrhand {
     51       1.16     uch 	int	(*ih_func)(void *);
     52       1.16     uch 	void	*ih_arg;
     53       1.16     uch 	int	ih_level;	/* SR.I[0:3] value */
     54       1.16     uch 	int	ih_evtcode;	/* INTEVT or INTEVT2(SH7709/SH7709A) */
     55       1.16     uch 	int	ih_idx;		/* evtcode -> intrhand mapping */
     56       1.16     uch };
     57       1.16     uch 
     58       1.22     uwe /* from 0x200 by 0x20 -> from 0 by 1 */
     59       1.22     uwe #define	EVTCODE_TO_MAP_INDEX(x)		(((x) >> 5) - 0x10)
     60       1.17     uch #define	EVTCODE_TO_IH_INDEX(x)						\
     61       1.16     uch 	__intc_evtcode_to_ih[EVTCODE_TO_MAP_INDEX(x)]
     62       1.17     uch #define	EVTCODE_IH(x)	(&__intc_intrhand[EVTCODE_TO_IH_INDEX(x)])
     63       1.16     uch extern int8_t __intc_evtcode_to_ih[];
     64       1.16     uch extern struct intc_intrhand __intc_intrhand[];
     65       1.16     uch 
     66       1.16     uch void intc_init(void);
     67       1.16     uch void *intc_intr_establish(int, int, int, int (*)(void *), void *);
     68       1.16     uch void intc_intr_disestablish(void *);
     69       1.19     uwe void intc_intr_enable(int);
     70       1.19     uwe void intc_intr_disable(int);
     71       1.16     uch void intc_intr(int, int, int);
     72       1.16     uch 
     73       1.20  nonaka void intpri_intr_priority(int evtcode, int level);
     74       1.20  nonaka 
     75        1.1  itojun #endif /* !_SH3_INTR_H_ */
     76