1; 2; BeOS 53c8xx SCRIPTS 3; 4ARCH 810 5 6; Interrupt codes used to signal driver from SCRIPTS 7; 8ABSOLUTE status_ready = 0x10 ; idle loop interrupted by driver 9ABSOLUTE status_reselected = 0x11 ; select or idle interrupted by reselection 10ABSOLUTE status_timeout = 0x12 ; select timed out 11ABSOLUTE status_selected = 0x13 ; select succeeded 12ABSOLUTE status_complete = 0x14 ; transaction completed 13ABSOLUTE status_disconnect = 0x15 ; device disconnected in the middle 14ABSOLUTE status_badstatus = 0x16 ; snafu in the status phase 15ABSOLUTE status_overrun = 0x17 ; data overrun occurred 16ABSOLUTE status_underrun = 0x18 ; data underrun occurred 17ABSOLUTE status_badphase = 0x19 ; weird phase transition occurred 18ABSOLUTE status_badmsg = 0x1a ; bad msg received 19ABSOLUTE status_badextmsg = 0x1b ; bad extended msg received 20ABSOLUTE status_selftest = 0x1c ; used by selftest stub 21ABSOLUTE status_iocomplete = 0x1d ; used by driver 22ABSOLUTE status_syncin = 0x1e ; inbound sync msg 23ABSOLUTE status_widein = 0x1f ; inbound wdtr msg 24ABSOLUTE status_ignore_residue = 0x20 ; ignore wide residue bytes 25 26; DSA-offset data table 27; 28ABSOLUTE ctxt_device = 0x00 ; targ id, sync params, etc 29ABSOLUTE ctxt_sendmsg = 0x08 ; outgoing (ID) msg(1) pointer 30ABSOLUTE ctxt_recvmsg = 0x10 ; incoming msg(1) pointer 31ABSOLUTE ctxt_extdmsg = 0x18 ; extdmsg(1) pointer 32ABSOLUTE ctxt_syncmsg = 0x20 ; sync(2) pointer 33ABSOLUTE ctxt_status = 0x28 ; status(1) pointer 34ABSOLUTE ctxt_command = 0x30 ; command(6,10,12) pointer 35ABSOLUTE ctxt_widemsg = 0x38 ; wide(2) pointer 36 37ENTRY start 38ENTRY idle 39ENTRY switch 40ENTRY switch_resel 41ENTRY phase_dataerr 42ENTRY test 43 44ENTRY do_datain 45ENTRY do_dataout 46 47; ------------------------------------------------------------------------------------ 48; Idle loop -- when no new requests are pending wait for a reselect 49; or interrupt from the driver 50; 51idle: 52 WAIT RESELECT interrupted 53 INT status_reselected 54 55interrupted: 56 MOVE CTEST2 TO SFBR ; read sigp to clear it 57 INT status_ready 58 59 60; ------------------------------------------------------------------------------------ 61; Driver must load DSA and jump here to attempt to select a target, beginning a new 62; transaction. Interrupt will indicate success, timeout, or reselection 63; 64start: 65 SELECT ATN FROM ctxt_device, resel ; try to select the dev for the req 66 JUMP selected, WHEN MSG_OUT ; force wait for timeout 67 INT status_timeout 68 69selected: 70 INT status_selected 71 72resel: 73 INT status_reselected 74 75 76; ------------------------------------------------------------------------------------ 77; If we're entering the main dispatcher after a reselection, we must insure that 78; the registers for SYNC/WIDE transfers are properly loaded. This is the solution 79; suggested in 9-18 of the Symbios programming guide. 80; 81switch_resel: 82 SELECT FROM ctxt_device, switch ; force the load of SXFER/SCNTL3, etc 83 84; ------------------------------------------------------------------------------------ 85; Main activity entry -- driver must set DSA and patch do_datain and do_dataout 86; before starting this dispatch function. 87; 88switch: 89 JUMP phase_msgin, WHEN MSG_IN 90 JUMP phase_msgout, IF MSG_OUT 91 JUMP phase_command, IF CMD 92do_datain: ; Patched by driver 93 JUMP phase_dataerr, IF DATA_IN 94do_dataout: ; Patched by driver 95 JUMP phase_dataerr, IF DATA_OUT 96 JUMP phase_status, IF STATUS 97 INT status_badphase 98 99phase_msgin: 100 MOVE FROM ctxt_recvmsg, WHEN MSG_IN 101 JUMP phase_msgin_ext, IF 0x01 102 JUMP disc, IF 0x04 103 JUMP ignore, IF 0x23 ; /* wide ignore residue */ 104 CLEAR ACK 105 JUMP switch, IF 0x02 ; ignore save data pointers 106 JUMP switch, IF 0x07 ; ignore message reject :) 107 JUMP switch, IF 0x03 ; ignore restore data pointers 108 JUMP switch, IF 0x80 ; ignore ident after reselect 109 JUMP switch, IF 0x81 ; ignore ident after reselect 110 JUMP switch, IF 0x82 ; ignore ident after reselect 111 JUMP switch, IF 0x83 ; ignore ident after reselect 112 JUMP switch, IF 0x84 ; ignore ident after reselect 113 JUMP switch, IF 0x85 ; ignore ident after reselect 114 JUMP switch, IF 0x86 ; ignore ident after reselect 115 JUMP switch, IF 0x87 ; ignore ident after reselect 116 JUMP switch, IF 0xC0 ; ignore ident after reselect 117 JUMP switch, IF 0xC1 ; ignore ident after reselect 118 JUMP switch, IF 0xC2 ; ignore ident after reselect 119 JUMP switch, IF 0xC3 ; ignore ident after reselect 120 JUMP switch, IF 0xC4 ; ignore ident after reselect 121 JUMP switch, IF 0xC5 ; ignore ident after reselect 122 JUMP switch, IF 0xC6 ; ignore ident after reselect 123 JUMP switch, IF 0xC7 ; ignore ident after reselect 124 INT status_badmsg 125 126ignore: 127 CLEAR ACK 128 MOVE FROM ctxt_extdmsg, WHEN MSG_IN ; read status byte 129 CLEAR ACK 130 JUMP switch 131; INT status_ignore_residue 132 133phase_msgin_ext: 134 CLEAR ACK 135 MOVE FROM ctxt_extdmsg, WHEN MSG_IN ; read extended message length 136 JUMP phase_msgin_sync, IF 0x03 137 JUMP phase_msgin_wide, IF 0x02 138 INT status_badextmsg 139 140phase_msgin_wide: 141 CLEAR ACK 142 MOVE FROM ctxt_widemsg, WHEN MSG_IN 143 CLEAR ACK 144 INT status_widein 145 146phase_msgin_sync: 147 CLEAR ACK 148 MOVE FROM ctxt_syncmsg, WHEN MSG_IN 149 CLEAR ACK 150 INT status_syncin 151 152phase_msgout: 153 MOVE FROM ctxt_sendmsg, WHEN MSG_OUT 154 JUMP switch 155 156phase_command: 157 MOVE FROM ctxt_command, WHEN CMD 158 JUMP switch 159 160phase_dataerr: 161 INT status_overrun 162 163phase_status: 164 MOVE FROM ctxt_status, WHEN STATUS 165 INT status_badstatus, WHEN NOT MSG_IN 166 MOVE FROM ctxt_recvmsg, WHEN MSG_IN 167 INT status_badmsg, IF NOT 0x00 ; not disconnect?! 168 MOVE SCNTL2 & 0x7f TO SCNTL2 169 CLEAR ACK 170 WAIT DISCONNECT 171 INT status_complete 172 173disc: 174 MOVE SCNTL2 & 0x7f to SCNTL2 ; expect disconnect 175 CLEAR ACK 176 WAIT DISCONNECT 177 INT status_disconnect 178 179; ------------------------------------------------------------------------------------ 180; Self-test snippet 181; 182test: 183 INT status_selftest 184 185 186