Home | History | Annotate | Line # | Download | only in lubbock
sm_obio_space_asm.S revision 1.1
      1 /*	$NetBSD: sm_obio_space_asm.S,v 1.1 2003/06/18 10:51:15 bsh Exp $ */
      2 
      3 /*
      4  * Copyright (c) 2002, 2003  Genetec Corporation.  All rights reserved.
      5  * Written by Hiroyuki Bessho for Genetec Corporation.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  * 3. The name of Genetec Corporation may not be used to endorse or
     16  *    promote products derived from this software without specific prior
     17  *    written permission.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
     20  * 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 GENETEC CORPORATION
     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.
     30  */
     31 
     32 /*
     33  * These are special bus space functions for Lubbock's on-board I/O.
     34  * Especially for SMC91c96 chip in 8-bit mode.
     35  */
     36 
     37 #include <machine/asm.h>
     38 
     39 /*
     40  * bus_space I/O functions with offset*4, 8-bit access.
     41  */
     42 
     43 /*
     44  * read single
     45  */
     46 
     47 ENTRY(smobio8_bs_r_2)
     48 	add	r1, r1, r2, LSL #2
     49 	ldrb	r0, [r1], #4
     50 	ldrb	r2, [r1]
     51 	orr	r0, r0, r2, LSL #8
     52 	mov	pc, lr
     53 
     54 /*
     55  * write single
     56  */
     57 
     58 ENTRY(smobio8_bs_w_2)
     59 	add	r1, r1, r2, LSL #2
     60 	strb	r3, [r1], #4
     61 	mov	r3, r3, LSR #8
     62 	strb	r3, [r1]
     63 	mov	pc, lr
     64 
     65 /*
     66  * read multiple
     67  */
     68 ENTRY(smobio8_bs_rm_2)
     69 	add	r0, r1, r2, LSL #2
     70 	ldr	r2, [sp, #0]
     71 	cmp     r2, #0x00000000
     72 	movle   pc, lr
     73 
     74 	stmfd	sp!, {lr}
     75 Lbs_rm_2_loop:
     76 	ldrb	r1, [r0]
     77 	ldrb	lr, [r0, #4]
     78 	subs	r2, r2, #0x00000001
     79 	orr	r1, r1, lr, LSL #8
     80 	strh	r1, [r3], #0x0002
     81 	bgt	Lbs_rm_2_loop
     82 
     83 	ldmfd	sp!, {pc}
     84 
     85 
     86 
     87 /*
     88  * write multiple
     89  */
     90 ENTRY(smobio8_bs_wm_2)
     91 	add	r0, r1, r2, LSL #2
     92 	ldr	r2, [sp, #0]
     93 	cmp     r2, #0x00000000
     94 	movle   pc, lr
     95 
     96 Lbs_wm_2_loop:
     97 	ldrh	r1, [r3], #0x0002
     98 	subs	r2, r2, #0x00000001
     99 	strb	r1, [r0]
    100 	mov	r1, r1, LSR #8
    101 	strb	r1, [r0,#4]
    102 	bgt	Lbs_wm_2_loop
    103 
    104 	mov	pc, lr
    105 
    106 
    107 /*
    108  * For 16-bit mode
    109  */
    110 
    111 /*
    112  * read single
    113  */
    114 
    115 ENTRY(smobio16_bs_r_1)
    116 	tst	r2, #1    /* Even/Odd ? */
    117 	ldreqb	r0, [r1, r2, LSL #2]
    118 	moveq	pc,lr
    119 
    120 	/* Odd byte.  read 16bits and get high byte */
    121 	bic	r2, r2, #1
    122 	add	r1, r1, r2, LSL #2
    123 	ldrh	r0, [r1]
    124 	mov	r0, r0, LSR #8
    125 	mov	pc, lr
    126 
    127 
    128 /*
    129  * write single
    130  */
    131 
    132 ENTRY(smobio16_bs_w_1)
    133 	tst	r2, #1    /* Even/Odd ? */
    134 	streqb	r3, [r1, r2, LSL #2]
    135 	moveq	pc,lr
    136 
    137 	/* Odd byte.  write 16bit with low byte is 0. */
    138 	bic	r2, r2, #1
    139 	mov	r3, r3, LSL #8
    140 	add	r1, r1, r2, LSL #2
    141 	strh	r3, [r1]
    142 	mov	pc, lr
    143 
    144