1 /* $NetBSD: sa11x0_io_asm.S,v 1.3 2005/12/11 12:16:51 christos Exp $ */
4 * Copyright (c) 1997 Mark Brinicombe.
5 * Copyright (c) 1997 Causality Limited.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by Mark Brinicombe.
19 * 4. The name of the company nor the name of the author may be used to
20 * endorse or promote products derived from this software without specific
21 * prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
24 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 #include <machine/asm.h>
39 * bus_space I/O functions for sa11x0
87 subs r2, r2, #0x00000001
88 strb r1, [r3], #0x0001
89 bgt sa11x0_bs_rm_1_loop
100 tsteq r3, #0x00000003
101 beq sa11x0_bs_rm_2_fast
105 subs r2, r2, #0x00000001
106 strh r1, [r3], #0x0002
107 bgt sa11x0_bs_rm_2_loop
112 stmfd sp!, {r4, r5, lr}
114 sa11x0_bs_rm_2_fastloop:
117 orr r1, r1, lr, lsl #16
121 orr r4, r4, lr, lsl #16
125 orr r5, r5, lr, lsl #16
129 orr ip, ip, lr, lsl #16
131 stmia r3!, {r1, r4, r5, ip}
133 bgt sa11x0_bs_rm_2_fastloop
135 ldmfd sp!, {r4, r5, pc}
138 ENTRY(sa11x0_bs_rm_4)
146 subs r2, r2, #0x00000001
147 str r1, [r3], #0x0004
148 bgt sa11x0_bs_rm_4_loop
156 ENTRY(sa11x0_bs_wm_1)
163 ldrb r1, [r3], #0x0001
164 subs r2, r2, #0x00000001
170 ENTRY(sa11x0_bs_wm_2)
177 ldrh r1, [r3], #0x0002
178 subs r2, r2, #0x00000001
180 bgt sa11x0_bs_wm_2_loop
184 ENTRY(sa11x0_bs_wm_4)
191 ldr r1, [r3], #0x0004
192 subs r2, r2, #0x00000001
194 bgt sa11x0_bs_wm_4_loop
202 ENTRY(sa11x0_bs_rr_2)
209 ldrh r1, [r0], #0x0002
210 strh r1, [r3], #0x0002
211 subs r2, r2, #0x00000001
212 bgt sa11x0_bs_rr_2_loop
220 ENTRY(sa11x0_bs_wr_2)
227 ldrh r1, [r3], #0x0002
228 strh r1, [r0], #0x0002
229 subs r2, r2, #0x00000001
230 bgt sa11x0_bs_wr_2_loop
238 ENTRY(sa11x0_bs_sr_2)
245 strh r3, [r0], #0x0002
246 subs r2, r2, #0x00000001
247 bgt sa11x0_bs_sr_2_loop
264 blt sa11x0_bs_c_2_backwards
267 ldrh r3, [r0], #0x0002
268 strh r3, [r1], #0x0002
269 subs r2, r2, #0x00000001
270 bgt sa11x0_bs_cf_2_loop
274 sa11x0_bs_c_2_backwards:
275 add r0, r0, r2, lsl #1
276 add r1, r1, r2, lsl #1
284 bne sa11x0_bs_cb_2_loop