[444] | 1 | /* op50n-io.S -- low-level I/O routines for the Oki OP50N eval board. |
---|
| 2 | * |
---|
| 3 | * Copyright (c) 1995 Cygnus Support |
---|
| 4 | * |
---|
| 5 | * The authors hereby grant permission to use, copy, modify, distribute, |
---|
| 6 | * and license this software and its documentation for any purpose, provided |
---|
| 7 | * that existing copyright notices are retained in all copies and that this |
---|
| 8 | * notice is included verbatim in any distributions. No written agreement, |
---|
| 9 | * license, or royalty fee is required for any of the authorized uses. |
---|
| 10 | * Modifications to this software may be copyrighted by their authors |
---|
| 11 | * and need not follow the licensing terms described here, provided that |
---|
| 12 | * the new terms are clearly indicated on the first page of each file where |
---|
| 13 | * they apply. |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | mon_start .EQU 0xd0000000 |
---|
| 17 | where_dp .EQU mon_start+4*4 |
---|
| 18 | where_ci .EQU mon_start+14*4 |
---|
| 19 | where_co .EQU mon_start+15*4 |
---|
| 20 | where_read .EQU mon_start+22*4 |
---|
| 21 | where_write .EQU mon_start+23*4 |
---|
| 22 | |
---|
| 23 | /* |
---|
| 24 | *int c = inbyte(wait); |
---|
| 25 | */ |
---|
| 26 | .space $TEXT$ |
---|
| 27 | .align 4 |
---|
| 28 | .EXPORT inbyte,CODE,ARGW0=GR,RTNVAL=GR |
---|
| 29 | inbyte |
---|
| 30 | .PROC |
---|
| 31 | .CALLINFO CALLER,FRAME=64,SAVE_RP |
---|
| 32 | .ENTRY |
---|
| 33 | stw %r2,-20(0,%r30) |
---|
| 34 | ldo 64(%r30),%r30 |
---|
| 35 | stw %r27,-56(0,%r30) ; save my dp |
---|
| 36 | ldil l%where_dp,%r27 ; load monitors dp |
---|
| 37 | ldw r%where_dp(0,%r27),%r27 |
---|
| 38 | ldil l%where_ci,%r1 |
---|
| 39 | ldw r%where_ci(0,%r1),%r1 |
---|
| 40 | ble 0(0,%r1) |
---|
| 41 | copy %r31,%r2 |
---|
| 42 | ldw -56(0,%r30),%r27 ; load my dp |
---|
| 43 | ldw -84(0,%r30),%r2 |
---|
| 44 | ldo -64(%r30),%r30 |
---|
| 45 | bv %r0(%r2) |
---|
| 46 | nop |
---|
| 47 | .EXIT |
---|
| 48 | .PROCEND |
---|
| 49 | |
---|
| 50 | /* int c = outbyte(c); |
---|
| 51 | */ |
---|
| 52 | .EXPORT outbyte,CODE,ARGW0=GR,RTNVAL=GR |
---|
| 53 | outbyte |
---|
| 54 | .PROC |
---|
| 55 | .CALLINFO CALLER,FRAME=64,SAVE_RP |
---|
| 56 | .ENTRY |
---|
| 57 | stw %r2,-20(0,%r30) |
---|
| 58 | ldo 64(%r30),%r30 |
---|
| 59 | stw %r27,-56(0,%r30) ; save my dp |
---|
| 60 | ldil l%where_dp,%r27 ; load monitors dp |
---|
| 61 | ldw r%where_dp(0,%r27),%r27 |
---|
| 62 | ldil l%where_co,%r1 |
---|
| 63 | ldw r%where_co(0,%r1),%r1 |
---|
| 64 | ble 0(0,%r1) |
---|
| 65 | copy %r31,%r2 |
---|
| 66 | ldw -56(0,%r30),%r27 ; load my dp |
---|
| 67 | ldw -84(0,%r30),%r2 |
---|
| 68 | ldo -64(%r30),%r30 |
---|
| 69 | bv %r0(%r2) |
---|
| 70 | nop |
---|
| 71 | .EXIT |
---|
| 72 | .PROCEND |
---|
| 73 | |
---|
| 74 | #if 0 |
---|
| 75 | /* cnt = read(fd, bufp, cnt); |
---|
| 76 | */ |
---|
| 77 | .EXPORT read,CODE,ARGW0=NO,ARGW1=NO,ARGW2=NO,ARGW3=NO,RTNVAL=NO |
---|
| 78 | read |
---|
| 79 | .PROC |
---|
| 80 | .CALLINFO FRAME=64,CALLS,SAVE_RP |
---|
| 81 | .ENTRY |
---|
| 82 | stw %r2,-20(0,%r30) |
---|
| 83 | ldo 64(%r30),%r30 |
---|
| 84 | stw %dp,-56(0,%r30) ; save my dp |
---|
| 85 | ldil l%where_dp,%dp ; load monitors dp |
---|
| 86 | ldw r%where_dp(0,%dp), %dp |
---|
| 87 | ldil l%where_read,%r1 |
---|
| 88 | ldw r%where_read(0,%r1), %r1 |
---|
| 89 | ble 0(0,%r1) |
---|
| 90 | copy %r31,%r2 |
---|
| 91 | ldw -56(0,%r30),%dp ; load my dp |
---|
| 92 | ldw -84(0,%r30),%r2 |
---|
| 93 | bv %r0(%r2) |
---|
| 94 | ldo -64(%r30),%r30 |
---|
| 95 | .EXIT |
---|
| 96 | .PROCEND |
---|
| 97 | |
---|
| 98 | /* cnt = write(fd, bufp, cnt); |
---|
| 99 | */ |
---|
| 100 | .EXPORT write,CODE,ARGW0=NO,ARGW1=NO,ARGW2=NO,ARGW3=NO,RTNVAL=NO |
---|
| 101 | write |
---|
| 102 | .PROC |
---|
| 103 | .CALLINFO FRAME=64,CALLS,SAVE_RP |
---|
| 104 | .ENTRY |
---|
| 105 | stw %r2,-20(0,%r30) |
---|
| 106 | ldo 64(%r30),%r30 |
---|
| 107 | stw %dp,-56(0,%r30) ; save my dp |
---|
| 108 | ldil l%where_dp,%dp ; load monitors dp |
---|
| 109 | ldw r%where_dp(0,%dp), %dp |
---|
| 110 | ldil l%where_write,%r1 |
---|
| 111 | ldw r%where_write(0,%r1), %r1 |
---|
| 112 | ble 0(0,%r1) |
---|
| 113 | copy %r31,%r2 |
---|
| 114 | ldw -56(0,%r30),%dp ; load my dp |
---|
| 115 | ldw -84(0,%r30),%r2 |
---|
| 116 | bv %r0(%r2) |
---|
| 117 | ldo -64(%r30),%r30 |
---|
| 118 | .EXIT |
---|
| 119 | .PROCEND |
---|
| 120 | #endif |
---|