1 /* $NetBSD: hd6446x_subr.S,v 1.6 2006/07/22 01:16:16 uwe Exp $ */
4 * Copyright (c) 2002 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
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.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
33 #include <hpcsh/dev/hd6446x/hd6446xintcreg.h>
36 * LINTSTUB: Func: int hd6446x_intr_raise(int s)
37 * raise SR.IMASK and HD6446x ICU interrupt mask to 's'.
38 * if current SR.IMASK is greater equal 's',nothing to do.
39 * Returns previous SR.IMASK.
41 NENTRY(hd6446x_intr_raise)
45 shll r1 /* r1 = 0xf0 */
46 and r1, r0 /* r0 = SR & 0xf0 */
47 cmp/ge r4, r0 /* r0 >= r4 ? T = 1 */
49 not r1, r1 /* r1 = 0xffffff0f */
50 and r1, r2 /* r2 = SR & ~0xf0 */
51 or r4, r2 /* r2 = (SR & ~0xf0) | s */
52 ldc r2, sr /* SR = r2 */
57 mov.w @r1, r2 /* r2 = hd6446x_imask[s >> 4] */
59 mov.w r2, @r1 /* Set new interrupt mask to HD6446x */
61 nop /* return (SR & 0xf0) */
64 2: .long _C_LABEL(hd6446x_imask)
67 SET_ENTRY_SIZE(hd6446x_intr_raise)
71 * LINTSTUB: Func: int hd6446x_intr_resume(int s)
72 * Set SR.IMASK and HD6446x interrupt mask register to
73 * 's' interrupt level. Returns previous SR.IMASK.
75 NENTRY(hd6446x_intr_resume)
81 mov.w @r1, r2 /* r2 = hd6446x_imask[s >> 4] */
83 mov.w r2, @r1 /* Set new interrupt mask to HD6446x */
84 stc sr, r0 /* r0 = SR */
86 shll r2 /* r2 = 0x000000f0 */
87 not r2, r1 /* r1 = 0xffffff0f */
88 and r0, r1 /* r1 = (SR & ~0xf0) */
89 or r1, r4 /* r4 = (SR & ~0xf0) | level */
90 ldc r4, sr /* Set new IMASK to SR */
92 and r2, r0 /* return (SR & 0xf0) */
95 2: .long _C_LABEL(hd6446x_imask)
98 SET_ENTRY_SIZE(hd6446x_intr_resume)