PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 1 PC Machine Code I Line File: A 1 COMMENT /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A 2 (C) Copyright Intel Corp., 1996 A 3 A 4 File: LOOPBACK&ISO&SUSRSM.asm A 5 A 6 Universal Serial Bus 930 Test firmware A 7 A 8 Revision History A 9 --------------------------------------------- A 10 0.3 09-12-96 Myngoc Le A 11 0.2 05-27-96 Abdul Rahman Ismail A 12 0.1 02-13-96 Joe DrAgony A 13 A 14 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ A 15 B 0 INCLUDE "swap.INC" B 1 COMMENT /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ B 2 (C) Copyright Intel Corp., 1996 B 3 B 4 File: swap.inc B 5 B 6 Universal Serial Bus 930 Test firmware B 7 B 8 Revision History B 9 --------------------------------------------- B 10 0.1 05-27-96 Abdul Rahman Ismail B 11 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ B 12 B 13 SWAP_BYTES: MACRO Reg1, Reg2, Reg3 B 14 mov Reg3, Reg1 B 15 mov Reg1, Reg2 B 16 mov Reg2, Reg3 B 17 ENDMAC SWAP_BYTES B 18 B 19 DEBUG_PORT: MACRO Reg1, Immeadiate B 20 mov Reg1, gbDebugMess B 21 orl Reg1, #Immeadiate B 22 mov gbDebugMess, Reg1 B 23 mov P1, Reg1 B 24 ENDMAC DEBUG_PORT B 25 B 26 A 17 B 0 INCLUDE "82930aa.INC" B 1 ;####################################################################### B 2 ;# $Source: q:/include/82930hx.inc $ # B 3 ;# $Revision: 1.0 $ # B 4 ;# # B 5 ;# $Date: 1996/04/18 20:02:32 $ # B 6 ;# # B 7 ;# Author: Joe Murray # B 8 ;# $Locker: $ # PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 2 PC Machine Code I Line File: 82930aa.INC B 9 ;# # B 10 ;# Platform: 82930AA DUT on ISA SV Board # B 11 ;# # B 12 ;# Description: # B 13 ;# This file contains EQUates for HUB SFRs. # B 14 ;# B 15 ;# * * * Do NOT Include this file directly! * * * # B 16 ;# You should define PROC equ "something" and include 82930.inc # B 17 ;# # B 18 ;# ------------------------------------------------------------------- # B 19 ;# REVISION HISTORY: # B 20 ;# ------------------------------------------------------------------- # B 21 ;# $Log: hello.asm,v $ B 22 ;# Revision 1.0 1996/06/20 20:02:32 Joe Murray B 23 ;# Initial revision B 24 ;# B 25 ;####################################################################### B 26 B 27 ;############################################################################## B 28 ;# Filename: hub_def.asm B 29 ;# B 30 ;# Author: Joe Murray. B 31 ;# B 32 ;# Date: 22/Feb/96 B 33 ;# B 34 ;# Description: EQUates for the 82930AA SFRs B 35 ;# B 36 ;############################################################################## B 37 00000085 B 38 DPXL: EQU 85h B 39 000000FF B 40 SBTM: EQU 0FFH 000000F1 B 41 EPINDEX: EQU 0F1H B 42 000000F2 B 43 TXSTAT: EQU 0F2H 000000F2 B 44 TXSTAT0: EQU 0F2H 000000F2 B 45 TXSTAT1: EQU 0F2H 000000F2 B 46 TXSTAT2: EQU 0F2H 000000F2 B 47 TXSTAT3: EQU 0F2H 000000F2 B 48 HTXSTAT0: EQU 0F2H B 49 000000F3 B 50 TXDAT: EQU 0F3H 000000F3 B 51 TXDAT0: EQU 0F3H 000000F3 B 52 TXDAT1: EQU 0F3H 000000F3 B 53 TXDAT2: EQU 0F3H 000000F3 B 54 TXDAT3: EQU 0F3H 000000F3 B 55 FTXDAT0: EQU 0F3H 000000F3 B 56 FTXDAT1: EQU 0F3H 000000F3 B 57 FTXDAT2: EQU 0F3H 000000F3 B 58 FTXDAT3: EQU 0F3H 000000F3 B 59 HTXDAT0: EQU 0F3H 000000F3 B 60 HTXDAT1: EQU 0F3H PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 3 PC Machine Code I Line File: 82930aa.INC B 61 000000F4 B 62 TXCON: EQU 0F4H 000000F4 B 63 TXCON0: EQU 0F4H 000000F4 B 64 TXCON1: EQU 0F4H 000000F4 B 65 TXCON2: EQU 0F4H 000000F4 B 66 TXCON3: EQU 0F4H B 67 000000F4 B 68 FTXCON0: EQU 0F4H 000000F4 B 69 FTXCON1: EQU 0F4H 000000F4 B 70 FTXCON2: EQU 0F4H 000000F4 B 71 FTXCON3: EQU 0F4H 000000F4 B 72 HTXCON0: EQU 0F4H B 73 000000F5 B 74 TXFLG: EQU 0F5H 000000F5 B 75 TXFLG0: EQU 0F5H 000000F5 B 76 TXFLG1: EQU 0F5H 000000F5 B 77 TXFLG2: EQU 0F5H 000000F5 B 78 TXFLG3: EQU 0F5H 000000F5 B 79 FTXFLG0: EQU 0F5H 000000F5 B 80 FTXFLG1: EQU 0F5H 000000F5 B 81 FTXFLG2: EQU 0F5H 000000F5 B 82 FTXFLG3: EQU 0F5H 000000F5 B 83 HTXFLG0: EQU 0F5H B 84 B 85 B 86 000000F6 B 87 TXCNT0: EQU 0F6h 000000F6 B 88 TXCNT1: EQU 0F6h 000000F6 B 89 TXCNT2: EQU 0F6h 000000F6 B 90 TXCNT3: EQU 0F6h B 91 000000F6 B 92 TXCNT: EQU 0F6H 000000F6 B 93 FTXCNTO: EQU 0F6H 000000F6 B 94 FTXCNT1: EQU 0F6H 000000F6 B 95 FTXCNT2: EQU 0F6H 000000F6 B 96 FTXCNT3: EQU 0F6H 000000F6 B 97 HTXCNTO: EQU 0F6H 000000F6 B 98 TXCNTL: EQU 0F6H 000000F7 B 99 TXCNTH: EQU 0F7H B 100 000000E8 B 101 HIS: EQU 0E8H B 102 000000EF B 103 UICECON: EQU 0EFH B 104 000000E1 B 105 EPCON: EQU 0E1H 000000E1 B 106 EPCON0: EQU 0E1H 000000E1 B 107 EPCON1: EQU 0E1H 000000E1 B 108 EPCON2: EQU 0E1H 000000E1 B 109 EPCON3: EQU 0E1H 000000E1 B 110 HEPCON0: EQU 0E1H B 111 000000E2 B 112 RXSTAT: EQU 0E2H PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 4 PC Machine Code I Line File: 82930aa.INC 000000E2 B 113 RXSTAT0: EQU 0E2H 000000E2 B 114 RXSTAT1: EQU 0E2H 000000E2 B 115 RXSTAT2: EQU 0E2H 000000E2 B 116 RXSTAT3: EQU 0E2H 000000E2 B 117 HRXSTAT0: EQU 0E2H B 118 000000E3 B 119 RXDAT: EQU 0E3H 000000E3 B 120 RXDAT0: EQU 0E3H 000000E3 B 121 RXDAT1: EQU 0E3H 000000E3 B 122 RXDAT2: EQU 0E3H 000000E3 B 123 RXDAT3: EQU 0E3H B 124 000000E3 B 125 FRXDAT0: EQU 0E3H 000000E3 B 126 FRXDAT1: EQU 0E3H 000000E3 B 127 FRXDAT2: EQU 0E3H 000000E3 B 128 FRXDAT3: EQU 0E3H 000000E3 B 129 HRXDAT0: EQU 0E3H B 130 000000E4 B 131 RXCON: EQU 0E4H 000000E4 B 132 RXCON0: EQU 0E4H 000000E4 B 133 RXCON1: EQU 0E4H 000000E4 B 134 RXCON2: EQU 0E4H 000000E4 B 135 RXCON3: EQU 0E4H B 136 000000E4 B 137 FRXCON0: EQU 0E4H 000000E4 B 138 FRXCON1: EQU 0E4H 000000E4 B 139 FRXCON2: EQU 0E4H 000000E4 B 140 FRXCON3: EQU 0E4H 000000E4 B 141 HRXCON0: EQU 0E4H B 142 000000E5 B 143 RXFLG: EQU 0E5H 000000E5 B 144 RXFLG0: EQU 0E5H 000000E5 B 145 RXFLG1: EQU 0E5H 000000E5 B 146 RXFLG2: EQU 0E5H 000000E5 B 147 RXFLG3: EQU 0E5H B 148 B 149 000000E5 B 150 FRXFLG: EQU 0E5H 000000E5 B 151 FRXFLG0: EQU 0E5H 000000E5 B 152 FRXFLG1: EQU 0E5H 000000E5 B 153 FRXFLG2: EQU 0E5H 000000E5 B 154 FRXFLG3: EQU 0E5H 000000E5 B 155 HRXFLG0: EQU 0E5H B 156 B 157 000000E6 B 158 RXCNT0: EQU 0E6h 000000E6 B 159 RXCNT1: EQU 0E6h 000000E6 B 160 RXCNT2: EQU 0E6h 000000E6 B 161 RXCNT3: EQU 0E6h B 162 000000E6 B 163 RXCNT: EQU 0E6H 000000E6 B 164 FRXCNT0: EQU 0E6H PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 5 PC Machine Code I Line File: 82930aa.INC 000000E6 B 165 FRXCNT1: EQU 0E6H 000000E6 B 166 FR2XCNT2: EQU 0E6H 000000E6 B 167 FRXCNT3: EQU 0E6H 000000E6 B 168 HRXCNT0: EQU 0E6H 000000E6 B 169 RXCNTL: EQU 0E6H 000000E7 B 170 RXCNTH: EQU 0E7H B 171 000000DF B 172 UPWCON: EQU 0DFH 000000D2 B 173 SOFL: EQU 0D2H 000000D3 B 174 SOFH: EQU 0D3H 000000D4 B 175 UPINDEX: EQU 0D4H B 176 000000D5 B 177 UPSTCH: EQU 0D5H 000000D5 B 178 UPSTCH1: EQU 0D5H 000000D5 B 179 UPSTCH2: EQU 0D5H 000000D5 B 180 UPSTCH3: EQU 0D5H 000000D5 B 181 UPSTCH4: EQU 0D5H B 182 000000D7 B 183 UPSTAT: EQU 0D7H 000000D7 B 184 UPSTAT1: EQU 0D7H 000000D7 B 185 UPSTAT2: EQU 0D7H 000000D7 B 186 UPSTAT3: EQU 0D7H 000000D7 B 187 UPSTAT4: EQU 0D7H B 188 000000CF B 189 UPCON: EQU 0CFH 000000CF B 190 UPCON1: EQU 0CFH 000000CF B 191 UPCON2: EQU 0CFH 000000CF B 192 UPCON3: EQU 0CFH 000000CF B 193 UPCON4: EQU 0CFH B 194 B 195 B 196 000000B5 B 197 HFRTMRL: EQU 0B5H 000000B6 B 198 HFRTMRH: EQU 0B6H 000000AE B 199 HSTAT: EQU 0AEH 000000A1 B 200 HIE: EQU 0A1H 000000A2 B 201 FIE: EQU 0A2H B 202 ;FIS: EQU 0C0h 000000C0 B 203 SBI: EQU 0C0H ; Backward COmpatible 0000009A B 204 UPPWR: EQU 09AH 00000097 B 205 HADDR: EQU 097H 0000008F B 206 FADDR: EQU 08FH B 207 B 208 ;---------------------------------- B 209 ;- INTERRUPT REGISTERS B 210 ;---------------------------------- 000000B1 B 211 IEA: EQU 0B1H B 212 000000A8 B 213 IEN0 EQU 0A8H 000000B2 B 214 IPA: EQU 0B2H 000000B3 B 215 IPA1: EQU 0B3H B 216 PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 6 PC Machine Code I Line File: 82930aa.INC 000000B1 B 217 AA_IE1: EQU 0B1H B 218 B 219 ;IE0: EQU 0A8H B 220 ;IPH0: EQU 0B7H B 221 ;IPL0: EQU 0B8H 000000B3 B 222 IPH1: EQU 0B3H 000000B2 B 223 IPL1: EQU 0B2H B 224 ;SBIE: EQU 0A2H B 225 B 226 B 227 ;---------------------------------- B 228 ;- USB INTERRUPT ENABLES B 229 ;---------------------------------- 000000B1 B 230 IEN1: EQU 0B1H B 231 B 232 ESOF: EQU IEN1.0 B 233 ;EF: EQU IEN1.1 B 234 ESR: EQU IEN1.2 B 235 B 236 ;---------------------------------- B 237 ;- PCON B 238 ;---------------------------------- B 239 ;PCON EQU 087h B 240 LC EQU PCON.5 B 241 POF EQU PCON.4 B 242 PD EQU PCON.1 B 243 IDL EQU PCON.0 B 244 B 245 B 246 B 247 ;---------------------------------- B 248 ;- PCON1 B 249 ;---------------------------------- B 250 000000DF B 251 PCON1 EQU 0DFh B 252 RWU EQU PCON1.2 B 253 ;G_RSM EQU PCON1.1 B 254 ;G_SUS EQU PCON1.0 B 255 GRSM EQU PCON1.1 B 256 GSUS EQU PCON1.0 B 257 B 258 ;---------------------------------- B 259 ;- SOFH B 260 ;---------------------------------- B 261 SFACK EQU SOFH.7 B 262 ASOF EQU SOFH.6 B 263 SOFIE EQU SOFH.5 B 264 FLOCK EQU SOFH.4 B 265 SOFDIS EQU SOFH.3 B 266 B 267 ;---------------------------------- B 268 ;- EPCON PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 7 PC Machine Code I Line File: 82930aa.INC B 269 ;---------------------------------- B 270 RXSTL EQU EPCON.7 B 271 TXSTL EQU EPCON.6 B 272 CTLEP EQU EPCON.5 B 273 RXSPM EQU EPCON.4 B 274 RXIE EQU EPCON.3 B 275 RXEPEN EQU EPCON.2 B 276 TXOE EQU EPCON.1 B 277 TXEPEN EQU EPCON.7 B 278 B 279 ;---------------------------------- B 280 ;- RXSTAT B 281 ;---------------------------------- B 282 RXSEQ EQU RXSTAT.7 B 283 RXSETUP EQU RXSTAT.6 B 284 STOVW EQU RXSTAT.5 B 285 EDOVW EQU RXSTAT.4 B 286 RXDTO EQU RXSTAT.3 B 287 RXVOID EQU RXSTAT.2 B 288 RXERR EQU RXSTAT.1 B 289 RXACK EQU RXSTAT.0 B 290 B 291 ;---------------------------------- B 292 ;- TXSTAT B 293 ;---------------------------------- B 294 TXSEQ EQU TXSTAT.7 B 295 ;-- B 296 ;-- B 297 TXFLUSH EQU TXSTAT.4 B 298 TXDTO EQU TXSTAT.3 B 299 TXVOID EQU TXSTAT.2 B 300 TXERR EQU TXSTAT.1 B 301 TXACK EQU TXSTAT.0 B 302 B 303 B 304 B 305 ;---------------------------------- B 306 ;- RXCON B 307 ;---------------------------------- B 308 RXCLR EQU RXCON.7 B 309 ;- B 310 RXWS EQU RXCON.5 B 311 RXFFRC EQU RXCON.4 B 312 RXISO EQU RXCON.3 B 313 ARM EQU RXCON.2 B 314 ADVWM EQU RXCON.1 B 315 REVWP EQU RXCON.0 B 316 B 317 ;---------------------------------- B 318 ;- TXCON B 319 ;---------------------------------- B 320 TXCLR EQU TXCON.7 PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 8 PC Machine Code I Line File: 82930aa.INC B 321 ;- B 322 TXWS EQU TXCON.5 B 323 TXFFRC EQU TXCON.4 B 324 TXISO EQU TXCON.3 B 325 ATM EQU TXCON.2 B 326 ADVRM EQU TXCON.1 B 327 REVRP EQU TXCON.0 B 328 B 329 B 330 ;---------------------------------- B 331 ;- FIE B 332 ;---------------------------------- B 333 FTXIE0 EQU FIE.0 B 334 FRXIE0 EQU FIE.1 B 335 FTXIE1 EQU FIE.2 B 336 FRXIE1 EQU FIE.3 B 337 FTXIE2 EQU FIE.4 B 338 FRXIE2 EQU FIE.5 B 339 FTXIE3 EQU FIE.6 B 340 FRXIE3 EQU FIE.7 B 341 B 342 ;---------------------------------- B 343 ;- FIFLG B 344 ;---------------------------------- 000000C0 B 345 FIFLG EQU 0C0H B 346 FTXD0 EQU FIFLG.0 B 347 FRXD0 EQU FIFLG.1 B 348 FTXD1 EQU FIFLG.2 B 349 FRXD1 EQU FIFLG.3 B 350 FTXD2 EQU FIFLG.4 B 351 FRXD2 EQU FIFLG.5 B 352 FTXD3 EQU FIFLG.6 B 353 FRXD3 EQU FIFLG.7 B 354 B 355 ;---------------------------------- B 356 ;- RXFLG B 357 ;---------------------------------- B 358 RXFIF1 EQU RXFLG.7 B 359 RXFIF0 EQU RXFLG.6 B 360 ;--- B 361 ;--- B 362 RXEMP EQU RXFLG.3 B 363 RXFULL EQU RXFLG.2 B 364 RXURF EQU RXFLG.1 B 365 RXOVF EQU RXFLG.0 B 366 B 367 B 368 ;---------------------------------- B 369 ;- TXFLG B 370 ;---------------------------------- B 371 TXFIF1 EQU TXFLG.7 B 372 TXFIF0 EQU TXFLG.6 PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 9 PC Machine Code I Line File: 82930aa.INC B 373 ;--- B 374 ;--- B 375 TXEMP EQU TXFLG.3 B 376 TXFULL EQU TXFLG.2 B 377 TXURF EQU TXFLG.1 B 378 TXOVF EQU TXFLG.0 B 379 B 380 B 381 B 382 A 19 B 0 INCLUDE "ONE_OH.INC" B 1 COMMENT /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ B 2 (C) Copyright Intel Corp., 1996 B 3 B 4 File: one_oh.inc B 5 B 6 Universal Serial Bus 930 Test firmware B 7 B 8 Revision History B 9 --------------------------------------------- B 10 0.3 B 11 0.2 05-27-96 Abdul Rahman Ismail B 12 0.1 02-13-96 Joe DrAgony B 13 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ B 14 ; B 15 ; ONE_OH.INC: This file contains equates related to the operations under USB Spec. rev 1.0 B 16 ; It also includes equates for 82930 register manipulation B 17 ; B 18 B 19 ;<<<<<<<<<<<<<< B 20 ;bRequest Types B 21 ;>>>>>>>>>>>>>> B 22 00000000 B 23 GET_STATUS equ 00h 00000001 B 24 CLEAR_FEATURE equ 01h 00000002 B 25 RESERVED1 equ 02h 00000003 B 26 SET_FEATURE equ 03h 00000004 B 27 RESERVED2 equ 04h 00000005 B 28 SET_ADDRESS equ 05h 00000006 B 29 GET_DESCRIPTOR equ 06h 00000007 B 30 SET_DESCRIPTOR equ 07h 00000008 B 31 GET_CONFIGURATION equ 08h 00000009 B 32 SET_CONFIGURATION equ 09h 0000000A B 33 GET_INTERFACE equ 0Ah 0000000B B 34 SET_INTERFACE equ 0Bh 0000000C B 35 SYCH_FRAME equ 0Ch B 36 B 37 ; B 38 ;Descriptor Types B 39 ; 00000001 B 40 DEVICE_DESCR equ 01h PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 10 PC Machine Code I Line File: ONE_OH.INC 00000002 B 41 CONFIG_DESCR equ 02h 00000003 B 42 STRING_DESCR equ 03h 00000004 B 43 INTERFACE_DESCR equ 04h 00000005 B 44 ENDPOINT_DESCR equ 05h 00000006 B 45 SUSPEND_DESCR equ 06h B 46 B 47 ; B 48 ;HID specific descriptor types 00000021 B 49 HID_DESCR equ 021h 00000022 B 50 ENTITY_DESCR equ 022h B 51 B 52 ; B 53 ;Feature Selectors B 54 ; B 55 B 56 00000001 B 57 DEVICE_REMOTE_WAKEUP equ 01h 00000000 B 58 ENDPOINT_STALL equ 00h B 59 B 60 B 61 B 62 B 63 ; B 64 ;Equates for clearing bits in SBI register B 65 ; B 66 B 67 000000FE B 68 EP0_TX_CLR equ 0FEh 000000FD B 69 EP0_RX_CLR equ 0FDh B 70 000000FB B 71 EP1_TX_CLR equ 0FBh 000000F7 B 72 EP1_RX_CLR equ 0F7h B 73 000000EF B 74 EP2_TX_CLR equ 0EFh 000000DF B 75 EP2_RX_CLR equ 0DFh B 76 000000BF B 77 EP3_TX_CLR equ 0BFh 0000007F B 78 EP3_RX_CLR equ 07Fh B 79 B 80 B 81 ; B 82 ;Equates to access EP management variables B 83 ; B 84 00000800 B 85 EPRXPTROFFSET equ 0800h 00000802 B 86 EPTXPTROFFSET equ 0802h 00000804 B 87 EPDATACNTOFFSET equ 0804h B 88 B 89 ; B 90 ; Ring buffer size (actually one less...) B 91 ; 000007FF B 92 RINGBUFFSIZE equ 07FFh PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 11 PC Machine Code I Line File: ONE_OH.INC B 93 B 94 ; B 95 ;Equates for masking registers, addresses, and counters B 96 ; 0000F7FF B 97 RINGBUFFMASK equ 0F7FFh 000007FF B 98 RINGWORDMASK equ 07FFh 000000C0 B 99 FIFBITMASK equ 0C0h B 100 00000008 B 101 EP0MAXPACKET equ 08h 00000400 B 102 EP1MAXPACKET equ 0400h 00000008 B 103 EP2MAXPACKET equ 08h 00000008 B 104 EP3MAXPACKET equ 08h B 105 00000001 B 106 R_ACK equ 01h 00000002 B 107 R_ERR equ 02h 00000004 B 108 R_VOID equ 04h 00000040 B 109 R_SETUP equ 40h 00000080 B 110 R_SEQ equ 80h B 111 00000012 B 112 DEVICE_DESCRIPTOR_LENGTH equ 012h 00000019 B 113 CONFIG_DESCRIPTOR_LENGTH equ 019h B 114 00000004 B 115 GET_REQUEST_TYPE_OFFSET equ 004h B 116 00000008 B 117 SETUP_PACKET_LENGTH equ 008h A 21 A 22 ;------------- External functions - process.c A 23 ;EXTERN _SetFeature:CODE A 24 ;EXTERN _ClearFeature:CODE A 25 ;EXTERN _GetStatus:CODE A 26 ;EXTERN _SetLEDs:CODE A 27 EXTERN _SetInterface:CODE A 28 A 29 PUBLIC _TestThing A 30 PUBLIC _SOF_Init_FIFOs A 31 A 32 ;------------- Global variables. A 33 XDEF _EP1RxPtr, _EP1TxPtr, _EP1DataCount A 34 A 35 XDEF _EP2RxPtr, _EP2TxPtr, _EP2DataCount A 36 A 37 XDEF _EP3RxPtr, _EP3TxPtr, _EP3DataCount A 38 A 39 XDEF _gbMPSEndPoint1 A 40 XDEF _gbMPSEndPoint2 A 41 A 42 DEFINE CCB_SEGMENT, SPACE=CODE, ORG=0ff7ff8H A 43 SEGMENT CCB_SEGMENT A 44 ; CCB0 A 45 ; - WSA1# WSA0# XALE# RD1 RD0 PAGE# SRC A 46 ; CCB1 A 47 ; - - - INTR - WSB1# WSB0# EMAP# PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 12 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm A 48 00FF7FF8 92 A 49 db 092h ; D2 Original Binary Mode-Paged Mode 00FF7FF9 F1 A 50 db 0F1h ; F7 Normal A 51 A 52 ;TO DO A 53 ; Change Packet Transfer to use Words not bytes. 00000008 A 54 FIFO_SIZE equ 8 A 55 A 56 CSEG AT FF:0000H 00FF0000 02 0100 A 57 LJMP main A 58 A 59 CSEG AT FF:0003H ; INT0# A 60 ; LJMP INT0_ISR 00FF0003 02 0215 A 61 LJMP RWK_ISR A 62 A 63 CSEG AT FF:0013H ; INT1# A 64 ; LJMP INT1_ISR 00FF0013 02 0215 A 65 LJMP RWK_ISR A 66 A 67 CSEG AT FF:0043H ; Any SOF (ISO Endpoint) 00FF0043 02 0156 A 68 LJMP SOF_ISR A 69 A 70 CSEG AT FF:004BH ; USB Function (FTXDx,FRXDx)x=0,1,2,3 00FF004B 02 0148 A 71 LJMP EPx_ISR A 72 A 73 CSEG AT FF:0053H ;USB Global Suspend/Resume 00FF0053 02 0226 A 74 LJMP Sus_ISR A 75 A 76 A 77 CSEG AT FF:0100H 00FF0100 A 78 main: 00FF0100 758100 A 79 mov SP, #00h 00FF0103 75BE05 A 80 mov SPH, #05h ; Set the stack to start @ 00:0500h 00FF0106 7585FF A 81 mov DPXL, #0ffh ; Set DPXL to point at the FLASH device to access constan 00FF0109 75A800 A 82 mov IEN0, #00h ; Disable all interrupts 00FF010C 75903C A 83 mov P1, #3Ch 00FF010F 12 0B22 A 84 lCall INIT_VARIABLES ; Initialize the RAM space as required 00FF0112 759066 A 85 mov P1, #66h 00FF0115 12 0996 A 86 lCall INIT_USB ; Initialize the USB subsystem A 87 00FF0118 7590CC A 88 mov P1, #0CCh A 89 00FF011B A57E80 08 A 90 mov R8, #EP1_INIT_MaxPacket 00FF011F A57A83 D806 A 91 mov 00:_gbMPSEndPoint1, R8 A 92 00FF0124 A57E8008 A 93 mov R8, #8 ; same as 00:gEPB_wMaxPacketSize 00FF0128 A57A83 D807 A 94 mov 00:_gbMPSEndPoint2, R8 A 95 00FF012D 12 01C1 A 96 call _SOF_Init_FIFOs A 97 00FF0130 759099 A 98 mov P1, #099h A 99 PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 13 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF0133 75B301 A 100 mov IPH1, #1 ; Set USB SOF interrupt to higher priority 00FF0136 75B200 A 101 mov IPL1, #0 ; Set USB SOF interrupt to higher priority 00FF0139 75A884 A 102 MOV IEN0, #84h ; Enable Global Interrupts 00FF013C 75B107 A 103 MOV IEN1, #07h ; Enable USB Interrupts 00FF013F C28A A 104 CLR IT1 ; set INT1# to level sensitive 00FF0141 A5A9D5D3 A 105 setb SOFIE ; Enable SOF interrupts A 106 00FF0145 02 0248 A 107 ljmp ActiveLoop ;Jump over the ISR stubs to the main loop. A 108 A 109 ;Interrupts 00FF0148 A 110 EPx_ISR: 00FF0148 32 A 111 RetI A 112 00FF0149 A 113 _TestThing: 00FF0149 A57E81D3 A 114 mov R8, SOFH 00FF014D A55E8007 A 115 anl R8, #07h 00FF0151 A57A8190 A 116 mov P1, R8 00FF0155 22 A 117 ret A 118 A 119 00FF0156 A 120 SOF_ISR: 00FF0156 A5CA78 A 121 push R7 00FF0159 A5CA88 A 122 push R8 00FF015C C0F1 A 123 push EPINDEX A 124 A 125 ;; Put the counter on to see something working 00FF015E A57E81D3 A 126 mov R8, SOFH 00FF0162 A55E8007 A 127 anl R8, #07h 00FF0166 A57A8190 A 128 mov P1, R8 A 129 A 130 ;; FOr testing only A 131 ; push R8 A 132 ; lcall _SetLEDs A 133 ; pop R8 A 134 ;; End for testing only A 135 00FF016A A5A9C6D3 A 136 clr ASOF A 137 A 138 ; jmp SOF_ISR_exit ; ### for test only A 139 A 140 ;; First check to see if there were any overflows. If so, then A 141 ;; Just re-init the fifos and start over. This should never happen A 142 ;; for transmits A 143 ; mov EPINDEX, #1 A 144 ; jnb TXOVF, ?SOF_Check_EP2 A 145 ; clr TXOVF A 146 ; call _SOF_Init_FIFOs A 147 ; jmp SOF_ISR_exit A 148 00FF016E A 149 ?SOF_Check_EP2: A 150 ; mov EPINDEX, #2 A 151 ; jnb TXOVF, ?SOF_Check_FIFOs PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 14 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm A 152 ; clr TXOVF A 153 ; call _SOF_Init_FIFOs A 154 ; jmp SOF_ISR_exit A 155 A 156 00FF016E A 157 ?SOF_Check_FIFOs: 00FF016E A57E81D2 A 158 mov R8, SOFL ; preload R8 with the right value 00FF0172 A57E73 D809 A 159 mov R7,Inject_error ; Check to see if there should be an error in the stream. 00FF0177 A5BE7000 A 160 cmp R7,#0 00FF017B A568 03 A 161 je ?SOF_No_inject 00FF017E A50B80 A 162 inc R8,#1 A 163 00FF0181 A 164 ?SOF_No_inject: 00FF0181 75F101 A 165 mov EPINDEX, #1 00FF0184 AFF5 A 166 mov R7, TXFLG 00FF0186 A55E70C0 A 167 anl R7, #0C0h ; Check if both bits are set 00FF018A A5BE70C0 A 168 cmp R7, #0C0h 00FF018E A568 08 A 169 je ?SOF_Check_FIFO2 ; and if so, skip to next A 170 00FF0191 A57E73 D806 A 171 mov R7,_gbMPSEndPoint1 00FF0196 12 0206 A 172 call SOF_Load_FIFO A 173 00FF0199 A 174 ?SOF_Check_FIFO2: 00FF0199 75F102 A 175 mov EPINDEX, #2 00FF019C AFF5 A 176 mov R7, TXFLG 00FF019E A55E70C0 A 177 anl R7, #0C0h ; Check if both bits are set 00FF01A2 A5BE70C0 A 178 cmp R7, #0C0h 00FF01A6 A568 08 A 179 je SOF_ISR_exit ; and if so, no room so return A 180 00FF01A9 A57E73 D807 A 181 mov R7,_gbMPSEndPoint2 00FF01AE 12 0206 A 182 call SOF_Load_FIFO A 183 00FF01B1 A 184 SOF_ISR_exit: 00FF01B1 7F00 A 185 mov R7, #0 00FF01B3 A57A73 D809 A 186 mov Inject_error, R7 00FF01B8 D0F1 A 187 pop EPINDEX 00FF01BA A5DA88 A 188 pop R8 00FF01BD A5DA78 A 189 pop R7 A 190 00FF01C0 32 A 191 RetI A 192 A 193 ;; This routine will init the FIFOs for both pipes. 00FF01C1 A 194 _SOF_Init_FIFOs: 00FF01C1 A5CA88 A 195 push R8 00FF01C4 A5CA78 A 196 push R7 00FF01C7 C0F1 A 197 push EPINDEX A 198 00FF01C9 75F101 A 199 mov EPINDEX, #1 00FF01CC A5A9D7F4 A 200 setb TXCLR 00FF01D0 A57E8000 A 201 mov R8, #0 00FF01D4 A57E73 D806 A 202 mov R7, 00: _gbMPSEndPoint1 00FF01D9 12 0206 A 203 call SOF_Load_FIFO PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 15 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF01DC A57E8001 A 204 mov R8, #1 00FF01E0 12 0206 A 205 call SOF_Load_FIFO A 206 00FF01E3 75F102 A 207 mov EPINDEX, #2 00FF01E6 A5A9D7F4 A 208 setb TXCLR 00FF01EA A57E8000 A 209 mov R8, #0 00FF01EE A57E73 D807 A 210 mov R7, 00: _gbMPSEndPoint2 00FF01F3 12 0206 A 211 call SOF_Load_FIFO 00FF01F6 A57E8001 A 212 mov R8, #1 00FF01FA 12 0206 A 213 call SOF_Load_FIFO A 214 00FF01FD D0F1 A 215 pop EPINDEX 00FF01FF A5DA78 A 216 pop R7 00FF0202 A5DA88 A 217 pop R8 00FF0205 22 A 218 ret A 219 A 220 A 221 ;; This routine assumes that R7 holds the number of bytes to write A 222 ;; into the FIFO, and that R8 holds the value, and that EPINDEX is A 223 ;; setup properly. Registers are preserved. 00FF0206 A 224 SOF_Load_FIFO: 00FF0206 A5CA78 A 225 push R7 A 226 00FF0209 A 227 ?Fill_SOF_FIFO: 00FF0209 A57A81F3 A 228 mov TXDAT, R8 00FF020D DF FA A 229 djnz R7, ?Fill_SOF_FIFO A 230 00FF020F A5DA78 A 231 pop R7 00FF0212 8FF6 A 232 mov TXCNTL, R7 00FF0214 22 A 233 Ret A 234 A 235 ;------------------------------------------------------------------ A 236 ;------------------------------------------------------------------ 00FF0215 A 237 RWK_ISR: 00FF0215 759020 A 238 MOV P1, #20h ; clear Suspend LED 00FF0218 A5CA78 A 239 push R7 00FF021B 7F01 A 240 mov R7,#1 00FF021D A57A73 D809 A 241 mov Inject_error, R7 00FF0222 A5DA78 A 242 pop R7 00FF0225 32 A 243 reti A 244 00FF0226 A 245 Sus_ISR: 00FF0226 A5A921DF 15 A 246 jb GRSM, Resume_l ; 00FF022B 759008 A 247 MOV P1, #08h ; set LED for Suspend 00FF022E A5A9D187 A 248 setb PD ; set Powerdown Mode bit to meet 500uA. A 249 00FF0232 A5A921DF 09 A 250 jb GRSM,Resume_l ; jump if GRSM flag. 00FF0237 A5A9D2DF A 251 setb RWU ; Set remote_wakeup bit. 00FF023B A5A9C0DF A 252 clr GSUS ; Clear the suspend bit. 00FF023F 32 A 253 reti A 254 00FF0240 A 255 Resume_l: PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 16 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm A 256 ; jb GSUS, Sus_ISR ; 00FF0240 A5A9C1DF A 257 clr GRSM ; Clear Resume bit 00FF0244 759020 A 258 MOV P1, #20h ; reset Suspend LED, turn on resume LED 00FF0247 32 A 259 reti A 260 A 261 A 262 COMMENT *------------------------------------------------------------ A 263 Function name : ActiveLoop A 264 Brief Description : Monitors RX and TX on all EPs A 265 Regs preserved : No reg. is saved A 266 --------------------------------------------------------------------* A 267 SCOPE 00FF0248 A 268 ActiveLoop: A 269 ; jb GRSM, resume_l ; jump if Global Resume flag. A 270 ; jb GSUS, pw_down ; jump if Global Suspend flag. A 271 A 272 ; mov R8, SOFH A 273 ; mov P1, R8 A 274 ; clr SOFH.6 A 275 00FF0248 A 276 EP0_RX: 00FF0248 30C1 06 A 277 jnb FRXD0, EP0_TX 00FF024B 75F100 A 278 mov EPINDEX, #0 00FF024E 12 025D A 279 lCall OUT_TOKEN1 ; 82930 has received a packet from HC A 280 00FF0251 A 281 EP0_TX: 00FF0251 30C0 06 A 282 jnb FTXD0, EP1_RX 00FF0254 75F100 A 283 mov EPINDEX, #0 00FF0257 12 02B7 A 284 lCall IN_TOKEN ; 82930 has sent a packet to HC 00FF025A A 285 EP1_RX: A 286 ; jnb FRXD1, EP1_TX A 287 ; mov EPINDEX, #1 A 288 ; lCall ServiceEP1RX A 289 ; lCall PrimeEP1Fifo A 290 00FF025A A 291 EP1_TX: A 292 ; jnb FTXD1, EP2_RX A 293 ; mov EPINDEX, #1 A 294 ; lCall ServiceEP1TX A 295 00FF025A A 296 EP2_RX: A 297 ; jnb FRXD2, EP2_TX A 298 ; mov EPINDEX, #2 A 299 ; lCall ServiceEP2RX A 300 ; lCall PrimeEP2Fifo A 301 00FF025A A 302 EP2_TX: A 303 ; jnb FTXD2, EP3_RX A 304 ; mov EPINDEX, #2 A 305 ; lCall ServiceEP2TX A 306 00FF025A A 307 EP3_RX: PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 17 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm A 308 ; jnb FRXD3, EP3_TX A 309 ; mov EPINDEX, #3 A 310 ; lCall ServiceEP3RX A 311 ; lCall PrimeEP3Fifo A 312 00FF025A A 313 EP3_TX: A 314 ; jnb FTXD3, EP_Done A 315 ; mov EPINDEX, #3 A 316 ; lCall ServiceEP3TX A 317 00FF025A A 318 EP_Done: 00FF025A 02 0248 A 319 ljmp ActiveLoop A 320 A 321 SCOPE A 322 ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< A 323 ; This is the block that services EP0 events. A 324 ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< A 325 ;####################### FAKE INTERUPT ROUTINE ####################### A 326 ; A 327 ; SetupSeq Meaning A 328 ; 0 No Setup command pending. Any out received is treated as a A 329 ; DeviceRequest. Later steppings will actually detect a SETUP A 330 ; packet and set a status flag telling us SETUP was received. A 331 ; A 332 ; 1 DeviceRequest Received, Processing Get Request. An IN Will A 333 ; transfer data. An Out will end the transfer and set A 334 ; SetupSeq to 0 A 335 ; A 336 ; 2 DeviceRequest Received, Processing Set Request. An OUT Will A 337 ; transfer data to the buffer. An IN will end the transfer and A 338 ; set SetupSeq to 0 A 339 ; A 340 ; 3 Done bit SetRequest. Ignore all data sent until an IN A 341 ; Used for Set Address A 342 A 343 ; This block of code deals with Endpoint 0 getting a transmit event interrupt. A 344 00FF025D A 345 OUT_TOKEN1: A 346 00FF025D 53C0FD A 347 anl FIFLG, #EP0_RX_CLR ; Clear the interrupt bit. A 348 A 349 ;Check sequence bit for the state that we are in. 00FF0260 A57EE4 0000 A 350 mov WR28, #00 ; point to page 00 00FF0265 A57EF4 9000 A 351 mov WR30, #LOW16(SetupSeq) 00FF026A A57E7BB0 A 352 mov R11, @DR28 00FF026E A5BEB000 A 353 cmp R11, #0 ; Is this a setup packet?? 00FF0272 A578 06 A 354 jne ?l1 ; If not, then deal with the data phase. 00FF0275 12 02F7 A 355 lcall SETUP_TOKEN ; If yes, then parse the setup command. 00FF0278 02 02B6 A 356 ljmp ?lx ; Return to caller. A 357 A 358 ; If this is not a setup command then it must be one of two things A 359 ; 0 or more data packets for a set command (Seq=2) or an PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 18 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm A 360 ; status result if Seq=1 A 361 00FF027B A5BEB001 A 362 ?l1: cmp R11, #1 ; Is this the status phase of a "GET" command? 00FF027F A578 1B A 363 jne ?l2 ; No, so check next 00FF0282 A5A9D4E4 A 364 SETB RXCON0.4 ;Update receive FIFO state 00FF0286 A5A9D7F4 A 365 SETB TXCON0.7 ;Flush the Transmit FIFOS 00FF028A A5A9C1E1 A 366 CLR EPCON0.1 ;disable Tx Output on EP0. Respond to "IN" A 367 ;with "NAK" 00FF028E A57EF4 9000 A 368 mov WR30,#LOW16(SetupSeq) ;Update the state machine-Expect a setup token 00FF0293 A57EB000 A 369 mov r11,#0 00FF0297 A57A7BB0 A 370 mov @DR28, R11 00FF029B 80 19 A 371 sjmp ?lx A 372 A 373 ;jb RXSTAT0.6, ?l1 ; If not SETUP then must be a standard out A 374 00FF029D A5BEB002 A 375 ?l2: cmp R11, #2 ; Are we processing a Control Write, i.e. Set Descr... 00FF02A1 A578 05 A 376 jne ?l3 00FF02A4 12 05D2 A 377 lcall OUT_TOKEN ; If we are continue to read in the data. 00FF02A7 80 0D A 378 SJMP ?lx A 379 00FF02A9 A5BEB003 A 380 ?l3: cmp R11, #3 ;If 3, then we are done setting the address and A 381 ;all outs are to be ignored until an IN terminates A 382 ;the control transfer 00FF02AD A578 06 A 383 jne ?l4 00FF02B0 A5A9D4E4 A 384 SETB RXCON0.4 ;Clear the receive FIFO 00FF02B4 80 00 A 385 sjmp ?lx A 386 00FF02B6 A 387 ?l4: A 388 00FF02B6 22 A 389 ?lx: ret A 390 A 391 A 392 A 393 SCOPE A 394 ;##################################################################### A 395 ;#################### IN TOKEN ###################################### A 396 ;##################################################################### A 397 ; SetupSeq Meaning A 398 ; 0 No Setup command pending. Any out received is a DeviceRequest A 399 ; A 400 ; 1 DeviceRequest Received, Processing Get Request. An IN Will A 401 ; transfer data. An Out will end the transfer and set A 402 ; SetupSeq to 0 A 403 ; A 404 ; 2 DeviceRequest Received, Processing Set Request. An OUT Will A 405 ; transfer data to the buffer. An IN will end the transfer and A 406 ; set SetupSeq to 0 A 407 ; A 408 ; 3 Done SetADDRESS Request. Ignore all data sent until an IN A 409 ; Used for Set Address A 410 ; A 411 ; PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 19 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm A 412 ; For in tokens we can do 2 things. A 413 ; A 414 ; If SetupSeq = 2,3 then a IN will terminate the control transfer. A 415 A 416 A 417 SCOPE 00FF02B7 A 418 IN_TOKEN: 00FF02B7 53C0FE A 419 anl FIFLG, #EP0_TX_CLR ; clear the interrupt bit 00FF02BA A57EB3 9000 A 420 mov R11, 00:SetupSeq ; read state variable 00FF02BF A5BEB002 A 421 cmp R11, #02h ; Should this be the end to a setup sequence? 00FF02C3 A578 0B A 422 jne InTokenCheckSA ; If no,check for end of set address A 423 00FF02C6 A 424 ?StatusPhaseDone: 00FF02C6 A57EB000 A 425 mov R11, #00h 00FF02CA A57AB3 9000 A 426 mov 00:SetupSeq, R11 ; Set state var. to expect setup. 00FF02CF 80 25 A 427 jmp ?Return A 428 00FF02D1 A 429 InTokenCheckSA: 00FF02D1 A5BEB003 A 430 cmp R11, #03h ; Prev. Setup was SetAddress??? 00FF02D5 A578 14 A 431 jne ?SendDataBack 00FF02D8 A57EA3 9006 A 432 mov R10, 00:new_addr 00FF02DD A57AA18F A 433 mov FADDR, R10 00FF02E1 A57EB000 A 434 mov R11, #00h 00FF02E5 A57AB3 9000 A 435 mov 00:SetupSeq, R11 00FF02EA 80 0A A 436 jmp ?Return A 437 00FF02EC A 438 ?SendDataBack: 00FF02EC A5BEB001 A 439 cmp R11, #01h 00FF02F0 A578 03 A 440 jne ?Return A 441 00FF02F3 12 0927 A 442 lCall DoControlOutput A 443 00FF02F6 A 444 ?Return: 00FF02F6 22 A 445 Ret A 446 A 447 SCOPE A 448 A 449 ;***************** SETUP_TOKEN ************************* A 450 ;***** Gets and saves SETUP DATA ************************ A 451 ;****************************************************** A 452 A 453 ;Procedure that takes SETUP data from the FIFO, Puts it in memory A 454 ;and then updates writes it to the fifo. 00FF02F7 A 455 SETUP_TOKEN: 00FF02F7 A57EE4 0000 A 456 MOV WR28, #0 ; USE DR28 for our data pointer 00FF02FC A57EF4 9100 A 457 mov WR30, #LOW16(COMMAND_BUFFER) 00FF0301 A57E81E6 A 458 mov R8, RXCNT0 ; Use R8 for our count register 00FF0305 A57A7B80 A 459 mov @DR28, R8 ; Store the count in the buffer 00FF0309 A52EF4 0001 A 460 add WR30, #1 ; Increment mem pointer 00FF030E A54C88 A 461 orl R8, R8 ; Set flags 00FF0311 A568 22 A 462 je ?k2 ; Zero length SETUP, error out.... A 463 ;(KLS) PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 20 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF0314 A5A9C4E2 A 464 clr EDOVW ; Release the SETUP Fifo to be read. A 465 ; Read FIFO loop 00FF0318 A57EB1E3 A 466 ?k1: mov R11, RXDAT0 ; Read byte from FIFO into R11 00FF031C A57A7BB0 A 467 mov @DR28, R11 ; Store it in the buffer 00FF0320 A52EF4 0001 A 468 ADD WR30, #1 ; Increment the pointer 00FF0325 A59E8001 A 469 sub R8, #1 ; Decrement the counter 00FF0329 A578 EC A 470 jne ?k1 ; Read until FIFO empty A 471 00FF032C A5A9D4E4 A 472 setb RXCON0.4 ; Set FFRC bit to update RX FIFO state A 473 ;(KLS) 00FF0330 A5A9C6E2 A 474 clr RXSETUP ; Release the FIFO to no longer NAK data. 00FF0334 80 07 A 475 sjmp PROCESS_SETUP A 476 00FF0336 A 477 ?k2: ;Should never get a zero length setup. 00FF0336 A5A9D4E4 A 478 setb RXCON0.4 ;Clear the fifo 00FF033A 02 05D1 A 479 LJMP EXIT_SETUP ;leave. A 480 SCOPE A 481 A 482 ;***************** PROCESS_SETUP ********************** A 483 ;***** PROCESS THE SETUP ****************************** A 484 ;****************************************************** A 485 SCOPE 00FF033D A 486 PROCESS_SETUP: A 487 A 488 ;Compare bmRequest Type A 489 ;If it's it 1xxxxxxb - Get Descriptor/Get Configuration A 490 ;If it's it 0xxxxxxb - Set Address/Configuration/Set Feature/Clear Feature. A 491 00FF033D A57EE4 0000 A 492 mov WR28, #0 00FF0342 A57EF4 9101 A 493 mov WR30, #LOW16(bmRequestType) 00FF0347 A57E7BB0 A 494 mov R11, @DR28 A 495 00FF034B A55EB080 A 496 anl R11, #80h; Get/Set ?? 00FF034F A578 03 A 497 jne DO_GET_COMMAND A 498 00FF0352 02 03C7 A 499 LJMP DO_SET_COMMAND A 500 A 501 ;=================================================== A 502 ; Routines to process a get descriptor/configuration A 503 ;=================================================== A 504 00FF0355 A 505 DO_GET_COMMAND: ;Is this a get_config or a Get_Descrip. 00FF0355 A57EF4 9102 A 506 mov WR30, #LOW16(bRequest) 00FF035A A57E7BB0 A 507 mov R11, @DR28 00FF035E A5BEB006 A 508 cmp R11, #GET_DESCRIPTOR 00FF0362 A578 03 A 509 jne CheckGetConfig 00FF0365 02 056B A 510 ljmp GET_DESCR_Request ;Go get Descriptor (Device & Config) A 511 00FF0368 A 512 CheckGetConfig: 00FF0368 A5BEB008 A 513 cmp R11, #GET_CONFIGURATION 00FF036C A578 03 A 514 jne CheckGetStatus 00FF036F 02 05D1 A 515 ljmp GET_CONFIG_Request ;Go get config request PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 21 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm A 516 A 517 ; code for other types of bRequests 00FF0372 A 518 CheckGetStatus: 00FF0372 A5BEB000 A 519 cmp R11, #GET_STATUS 00FF0376 A578 37 A 520 jne CheckGetInterface 00FF0379 A57E67 9105 A 521 mov WR12, wIndex A 522 SWAP_BYTES R12,R13,R14 00FF037E A57CEC A+ 522 mov R14, R12 00FF0381 A57CCD A+ 522 mov R12, R13 00FF0384 A57CDE A+ 522 mov R13, R14 A+ 522 ENDMAC SWAP_BYTES 00FF0387 A5CA69 A 523 push WR12 ;wIndex 00FF038A A57EC3 9101 A 524 mov R12, bmRequestType 00FF038F A5CAC8 A 525 push R12 ;bmRequestType A 526 A 527 ; lCall _GetStatus ;Go get status 00FF0392 A59EF8 0003 A 528 sub SPX, #03h A 529 ; WR0 contains the result returned from GetStatus A 530 ; need to swap the bytes to make it little endian for the bus A 531 SWAP_BYTES R0, R1, R2 00FF0397 A57C20 A+ 531 mov R2, R0 00FF039A A57C01 A+ 531 mov R0, R1 00FF039D A57C12 A+ 531 mov R1, R2 A+ 531 ENDMAC SWAP_BYTES A 532 00FF03A0 7A01 A 533 mov R2, #01h 00FF03A2 A57A23 9000 A 534 mov SetupSeq , R2 ;Advance State Machine to next state A 535 00FF03A7 12 090F A 536 lCall SetStatusData 00FF03AA 12 0927 A 537 lCall DoControlOutput ;primes fifo A 538 00FF03AD 02 05D1 A 539 ljmp EXIT_SETUP A 540 00FF03B0 A 541 CheckGetInterface: 00FF03B0 A5BEB00A A 542 cmp R11, #GET_INTERFACE 00FF03B4 A578 03 A 543 jne CheckSynchFrame 00FF03B7 02 05D1 A 544 ljmp GET_CONFIG_Request ;Go get config request A 545 00FF03BA A 546 CheckSynchFrame: 00FF03BA A5BEB00C A 547 cmp R11, #SYCH_FRAME 00FF03BE A578 03 A 548 jne GetCommandExit 00FF03C1 02 05D1 A 549 ljmp GET_CONFIG_Request ;Go get config request A 550 00FF03C4 A 551 GetCommandExit: 00FF03C4 02 05D1 A 552 ljmp EXIT_SETUP A 553 A 554 A 555 A 556 ;=================================================== A 557 ; Routines to process a set descriptor/configuration A 558 ;=================================================== A 559 PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 22 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF03C7 A 560 DO_SET_COMMAND: 00FF03C7 A57EF4 9102 A 561 mov WR30, #LOW16(bRequest) 00FF03CC A57E7BB0 A 562 mov R11, @DR28 A 563 00FF03D0 A5BEB007 A 564 cmp R11, #SET_DESCRIPTOR ; Was this a Set_Descriptor? 00FF03D4 A578 02 A 565 jne ?CheckSetConfig 00FF03D7 80 32 A 566 jmp DO_SET_DESCRIPTOR A 567 00FF03D9 A 568 ?CheckSetConfig: 00FF03D9 A5BEB009 A 569 cmp R11, #SET_CONFIGURATION ; Was this a Set_Configuration? 00FF03DD A578 02 A 570 jne ?CheckSetInterface 00FF03E0 80 2B A 571 jmp DO_SET_CONFIGURATION A 572 00FF03E2 A 573 ?CheckSetInterface: 00FF03E2 A5BEB00B A 574 cmp R11, #SET_INTERFACE ; Was this a Set_Interface? 00FF03E6 A578 02 A 575 jne ?CheckClearFeature 00FF03E9 80 24 A 576 jmp DO_SET_INTERFACE A 577 00FF03EB A 578 ?CheckClearFeature: 00FF03EB A5BEB001 A 579 cmp R11, #CLEAR_FEATURE 00FF03EF A578 03 A 580 jne ?CheckSetAddress 00FF03F2 02 04CF A 581 jmp DO_CLEAR_FEATURE A 582 00FF03F5 A 583 ?CheckSetAddress: 00FF03F5 A5BEB005 A 584 cmp R11, #SET_ADDRESS ; Was this a Set_Address? 00FF03F9 A578 03 A 585 jne ?CheckSetFeature 00FF03FC 02 053E A 586 jmp DO_SET_ADDRESS A 587 00FF03FF A 588 ?CheckSetFeature: 00FF03FF A5BEB003 A 589 cmp R11, #SET_FEATURE ; Was this a Set_Feature? 00FF0403 A578 03 A 590 jne ?CheckExit 00FF0406 02 0500 A 591 jmp DO_SET_FEATURE A 592 00FF0409 A 593 ?CheckExit: 00FF0409 A1 5F A 594 ajmp DO_SET_COMMAND_EXIT A 595 00FF040B A 596 DO_SET_DESCRIPTOR: A 597 ; 00FF040B A1 5F A 598 ajmp DO_SET_COMMAND_EXIT A 599 00FF040D A 600 DO_SET_CONFIGURATION: A 601 ; 00FF040D A1 5F A 602 ajmp DO_SET_COMMAND_EXIT A 603 00FF040F A 604 DO_SET_INTERFACE: A 605 ; A 606 ;###################################################################### A 607 ;; This stuff was originally here to call into C. It doesn't A 608 ;; work easily so it is booted A 609 ;###################################################################### A 610 ; push DR28 ; These push'es are here to protect what A 611 ; push WR26 ; gets used by the C-code that is called PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 23 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm A 612 ; push WR14 ; below A 613 ; A 614 ; mov WR12, wIndex A 615 ; SWAP_BYTES R12, R13, R14 A 616 ; push WR12 A 617 ; A 618 ; mov WR12, wValue A 619 ; SWAP_BYTES R12, R13, R14 A 620 ; push WR12 A 621 ; A 622 ; lCall _SetInterface A 623 ; sub SPX, #04h A 624 ; A 625 ; pop WR14 A 626 ; pop WR26 A 627 ; pop DR28 A 628 ;###################################################################### A 629 ;###################################################################### A 630 00FF040F A57E67 9103 A 631 mov WR12, wValue ; Loads the 'word' value R12 actually holds A 632 ; what we want A 633 00FF0414 A5BEC000 A 634 cmp R12,#0 00FF0418 A578 15 A 635 jne ?SI1 A 636 00FF041B A57E80 08 A 637 mov R8, #EP1_INIT_MaxPacket ; Alt setting 0 - MPS1=32 MPS2=8 00FF041F A57A83 D806 A 638 mov _gbMPSEndPoint1,R8 00FF0424 A57E8008 A 639 mov R8, #8 00FF0428 A57A83 D807 A 640 mov _gbMPSEndPoint2,R8 00FF042D 02 04B5 A 641 jmp SI_leave A 642 00FF0430 A5BEC001 A 643 ?SI1: cmp R12,#1 00FF0434 A578 14 A 644 jne ?SI2 A 645 00FF0437 A57E8020 A 646 mov R8, #32 ; Alt setting 1 - MPS1=32 MPS2=4 00FF043B A57A83 D806 A 647 mov _gbMPSEndPoint1,R8 00FF0440 A57E8004 A 648 mov R8, #4 00FF0444 A57A83 D807 A 649 mov _gbMPSEndPoint2,R8 00FF0449 80 6A A 650 jmp SI_leave A 651 00FF044B A5BEC002 A 652 ?SI2: cmp R12,#2 00FF044F A578 14 A 653 jne ?SI3 A 654 00FF0452 A57E8040 A 655 mov R8, #64 ; Alt setting 2 - MPS1=64 MPS2=2 00FF0456 A57A83 D806 A 656 mov _gbMPSEndPoint1,R8 00FF045B A57E8002 A 657 mov R8, #2 00FF045F A57A83 D807 A 658 mov _gbMPSEndPoint2,R8 00FF0464 80 4F A 659 jmp SI_leave A 660 00FF0466 A5BEC003 A 661 ?SI3: cmp R12,#3 00FF046A A578 14 A 662 jne ?SI4 A 663 PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 24 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF046D A57E8080 A 664 mov R8, #128 ; Alt setting 3 - MPS1=128 MPS2=1 00FF0471 A57A83 D806 A 665 mov _gbMPSEndPoint1,R8 00FF0476 A57E8001 A 666 mov R8, #1 00FF047A A57A83 D807 A 667 mov _gbMPSEndPoint2,R8 00FF047F 80 34 A 668 jmp SI_leave A 669 00FF0481 A5BEC004 A 670 ?SI4: cmp R12,#4 00FF0485 A578 14 A 671 jne ?SI5 A 672 00FF0488 A57E8035 A 673 mov R8, #53 ; Alt setting 4 - MPS1=53 MPS2=3 00FF048C A57A83 D806 A 674 mov _gbMPSEndPoint1,R8 00FF0491 A57E8003 A 675 mov R8, #3 00FF0495 A57A83 D807 A 676 mov _gbMPSEndPoint2,R8 00FF049A 80 19 A 677 jmp SI_leave A 678 00FF049C A5BEC005 A 679 ?SI5: cmp R12,#5 00FF04A0 A578 12 A 680 jne SI_leave A 681 00FF04A3 A57E8067 A 682 mov R8, #103 ; Alt setting 5 - MPS1=103 MPS2=7 00FF04A7 A57A83 D806 A 683 mov _gbMPSEndPoint1,R8 00FF04AC A57E8007 A 684 mov R8, #7 00FF04B0 A57A83 D807 A 685 mov _gbMPSEndPoint2,R8 A 686 00FF04B5 A 687 SI_leave: 00FF04B5 A5A9C5D3 A 688 clr SOFIE ; Disable SOF interrupts A 689 00FF04B9 12 01C1 A 690 call _SOF_Init_FIFOs ; Set the FIFOs back to startup A 691 00FF04BC A5A9D5D3 A 692 setb SOFIE ; Enable SOF interrupts A 693 00FF04C0 A57EF4 9000 A 694 mov WR30, #LOW16(SetupSeq) 00FF04C5 A57EA002 A 695 mov R10, #2 ; This was a Set with do data phase. 00FF04C9 A57A7BA0 A 696 mov @DR28, R10 ;Set state to look for status phase. A 697 00FF04CD A1 5F A 698 ajmp DO_SET_COMMAND_EXIT A 699 00FF04CF A 700 DO_CLEAR_FEATURE: 00FF04CF A57E67 9105 A 701 mov WR12, wIndex A 702 SWAP_BYTES R12, R13, R14 00FF04D4 A57CEC A+ 702 mov R14, R12 00FF04D7 A57CCD A+ 702 mov R12, R13 00FF04DA A57CDE A+ 702 mov R13, R14 A+ 702 ENDMAC SWAP_BYTES 00FF04DD A5CA69 A 703 push WR12 A 704 00FF04E0 A57E67 9103 A 705 mov WR12, wValue A 706 SWAP_BYTES R12, R13, R14 00FF04E5 A57CEC A+ 706 mov R14, R12 00FF04E8 A57CCD A+ 706 mov R12, R13 00FF04EB A57CDE A+ 706 mov R13, R14 A+ 706 ENDMAC SWAP_BYTES 00FF04EE A5CA69 A 707 push WR12 PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 25 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm A 708 00FF04F1 A57EC3 9101 A 709 mov R12, bmRequestType 00FF04F6 A5CAC8 A 710 push R12 A 711 ; LCall _ClearFeature 00FF04F9 A59EF8 0005 A 712 sub SPX, #05h A 713 00FF04FE 80 5F A 714 jmp DO_SET_COMMAND_EXIT A 715 00FF0500 A 716 DO_SET_FEATURE: 00FF0500 A57E67 9105 A 717 mov WR12, wIndex A 718 SWAP_BYTES R12, R13, R14 00FF0505 A57CEC A+ 718 mov R14, R12 00FF0508 A57CCD A+ 718 mov R12, R13 00FF050B A57CDE A+ 718 mov R13, R14 A+ 718 ENDMAC SWAP_BYTES 00FF050E A5CA69 A 719 push WR12 A 720 00FF0511 A57E67 9103 A 721 mov WR12, wValue A 722 SWAP_BYTES R12, R13, R14 00FF0516 A57CEC A+ 722 mov R14, R12 00FF0519 A57CCD A+ 722 mov R12, R13 00FF051C A57CDE A+ 722 mov R13, R14 A+ 722 ENDMAC SWAP_BYTES 00FF051F A5CA69 A 723 push WR12 A 724 00FF0522 A57EC3 9101 A 725 mov R12, bmRequestType 00FF0527 A5CAC8 A 726 push R12 A 727 ; LCall _SetFeature 00FF052A A59EF8 0005 A 728 sub SPX, #05h A 729 00FF052F A57EF4 9000 A 730 mov WR30, #LOW16(SetupSeq) 00FF0534 A57EA002 A 731 mov R10, #2 ; This was a Set Address command. 00FF0538 A57A7BA0 A 732 mov @DR28, R10 ;Set state to look for status phase. A 733 00FF053C 80 21 A 734 jmp DO_SET_COMMAND_EXIT A 735 00FF053E A 736 DO_SET_ADDRESS: 00FF053E A57EF4 9103 A 737 mov WR30, #LOW16(wValue) ; Get the address from wValue and store it. 00FF0543 A50B7A40 A 738 mov WR8, @DR28 ; It doesn't actually get changed until the 00FF0547 A57EF4 9006 A 739 mov WR30, #LOW16(new_addr) ;status phase completes successfully. 00FF054C A57A7B80 A 740 mov @DR28, R8 00FF0550 A57EF4 9000 A 741 mov WR30, #LOW16(SetupSeq) 00FF0555 A57EA003 A 742 mov R10, #3 ; This was a Set Address command. 00FF0559 A57A7BA0 A 743 mov @DR28, R10 ;Set state to look for status phase. 00FF055D A1 5F A 744 ajmp DO_SET_COMMAND_EXIT A 745 00FF055F A 746 DO_SET_COMMAND_EXIT: A 747 00FF055F 75F100 A 748 mov EPINDEX, #0 00FF0562 75F600 A 749 mov TXCNT0, #0 ; Prime FIFO for response to status phase 00FF0565 A5A9D1E1 A 750 setb EPCON0.1 ; Set the Tx output enable bit. 00FF0569 A1 D1 A 751 ajmp EXIT_SETUP PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 26 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm A 752 A 753 A 754 ; ********************** GET DESCRIPTOR ******************* 00FF056B A 755 GET_DESCR_Request: A 756 00FF056B A57EF4 9103 A 757 mov WR30, #LOW16(wValue) 00FF0570 A50B7A50 A 758 mov WR10, @DR28 00FF0574 A5BEB001 A 759 cmp R11, #DEVICE_DESCR ;Low Byte in Rll 00FF0578 A578 20 A 760 jne ?c1 A 761 A 762 A 763 ; ********************** GET DESCRIPTOR, DEVICE ******************* A 764 00FF057B A57EF4 9000 A 765 mov WR30, #LOW16(SetupSeq) ;Advance State Machine to next state 00FF0580 A57EA001 A 766 mov R10, #1 ;Set state to doing a "GET" command 00FF0584 A57A7BA0 A 767 mov @DR28, R10 ; A 768 00FF0588 A57EE4 00FF A 769 mov WR28, #0ffh; ; Located in ROM->Page=0ff 00FF058D A57EF4 09E7 A 770 mov WR30, #LOW16(DEVICE_DESCRIPTOR); 00FF0592 12 08C5 A 771 LCALL BufferControlData 00FF0595 12 0927 A 772 LCALL DoControlOutput 00FF0598 02 05D1 A 773 ljmp EXIT_SETUP A 774 A 775 00FF059B A5BEB002 A 776 ?c1: cmp R11, #CONFIG_DESCR 00FF059F A578 2C A 777 jne ?c2 A 778 ; ********************** GET DESCRIPTOR, CONFIGURATION ************ A 779 00FF05A2 A57EF4 9000 A 780 mov WR30, #LOW16(SetupSeq) ;Update state machine 00FF05A7 A57E9001 A 781 mov R9, #1 00FF05AB A57A7B90 A 782 mov @DR28, R9 A 783 00FF05AF A57EE4 00FF A 784 mov WR28, #0ffh; ;Located in ROM 00FF05B4 A57EF4 09FA A 785 mov WR30, #LOW16(CONFIGURATION_DESCRIPTOR); 00FF05B9 A5BEA001 A 786 cmp R10, #1 00FF05BD A578 05 A 787 jne ?c45 00FF05C0 A57EF4 0A8E A 788 mov WR30, #LOW16(CONFIGURATION_DESCRIPTOR2); A 789 00FF05C5 A 790 ?c45: 00FF05C5 12 08C5 A 791 LCALL BufferControlData 00FF05C8 12 0927 A 792 LCALL DoControlOutput A 793 00FF05CB 02 05D1 A 794 ljmp EXIT_SETUP A 795 00FF05CE A 796 ?c2: 00FF05CE 02 05D1 A 797 ljmp EXIT_SETUP A 798 00FF05D1 A 799 GET_CONFIG_Request: A 800 A 801 A 802 00FF05D1 A 803 EXIT_SETUP: PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 27 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF05D1 22 A 804 ret A 805 A 806 SCOPE A 807 A 808 A 809 ;***************** OUT_TOKEN ************************* A 810 ;***** Gets and saves OUT DATA ************************ A 811 ;****************************************************** A 812 A 813 ;Program that takes data from the FIFO, Puts it in memory A 814 ;and then updates writes it to the fifo. A 815 A 816 A 817 00FF05D2 A 818 OUT_TOKEN: ; Get the data and place it in the in_buffers 00FF05D2 53C0FD A 819 anl FIFLG, #EP0_RX_CLR ; Clear the bit 00FF05D5 A57EC4 0000 A 820 MOV WR24, #0 ; USE DR24 00FF05DA A57ED4 C000 A 821 mov WR26, #LOW16(OUT_BUFFERS) 00FF05DF A57E81E6 A 822 mov R8, RXCNT0 ; Read count of bytes rec'd into R8 00FF05E3 A57A6B80 A 823 mov @DR24, R8 ; Store the count in the OUT_BUFFERS space. 00FF05E7 A52ED4 0001 A 824 add WR26, #1 ; Increment mem pointer 00FF05EC A54C88 A 825 orl R8, R8 ; Set flags 00FF05EF A568 12 A 826 je ?k2 A 827 00FF05F2 AFE3 A 828 ?k1: mov R7, RXDAT0 ; Read loop 00FF05F4 A57A6B70 A 829 mov @DR24, R7 00FF05F8 A52ED4 0001 A 830 ADD WR26, #1 00FF05FD A59E8001 A 831 sub R8, #1 00FF0601 A578 EE A 832 jne ?k1 A 833 00FF0604 A5A9D4E4 A 834 ?k2: setb RXCON0.4 ; Clear the fifo A 835 ; We now have the data in the buffer. A 836 ; Transmit it to the xmit fifo 00FF0608 22 A 837 ret A 838 A 839 COMMENT *------------------------------------------------------------ A 840 Function name : ServiceEP1RX A 841 Brief Description : Copies data recd. on EP 1 and stores the same in A 842 : a buffer. A 843 Regs preserved : No reg. is saved A 844 --------------------------------------------------------------------* A 845 SCOPE 00FF0609 A 846 ServiceEP1RX: 00FF0609 53C0F7 A 847 anl FIFLG, #EP1_RX_CLR ; Clear the interrupt bit 00FF060C A5A920E2 02 A 848 jb RXACK, ?GoodReceive ; If R_ACK set then a good reception A 849 00FF0611 80 58 A 850 jmp ?Return ; else leave A 851 00FF0613 A 852 ?GoodReceive: 00FF0613 7E00 A 853 mov R6, #00h 00FF0615 AFE6 A 854 mov R7, RXCNT1 ; Get the no. of bytes recd. 00FF0617 A5BE7000 A 855 cmp R7, #00h ; Check whether a null data packet was recd. PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 28 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF061B A568 49 A 856 je ?NullPacketRecd ; 00FF061E A57E57 D800 A 857 mov WR10, _EP1RxPtr ; Get offset of next free location in the buffer 00FF0623 A57EF4 D000 A 858 mov WR30, #EP_1_Buffer ; get address of start of buffer. 00FF0628 A52DF5 A 859 add WR30, WR10 ; get to next free locaion. A 860 00FF062B A52D53 A 861 add WR10, WR6 00FF062E A55E54 F7FF A 862 anl WR10, #RINGBUFFMASK ; do modulo 800h rollover 00FF0633 A57A57 D800 A 863 mov _EP1RxPtr, WR10 ; update the RXPtr offset in buffer. A 864 00FF0638 A57E57 D804 A 865 mov WR10, _EP1DataCount ; get current data count 00FF063D A52D53 A 866 add WR10, WR6 ; add no. of bytes recd. 00FF0640 A57A57 D804 A 867 mov _EP1DataCount, WR10 ; update the data count A 868 00FF0645 A 869 ?CopyDataToBuffer: 00FF0645 A57EC1E3 A 870 mov R12, RXDAT1 ; Read data from FIFO 00FF0649 A57AF9C0 A 871 mov @WR30, R12 ; store in data buffer 00FF064D A50BF4 A 872 inc WR30, #01h ; incr. ptr into buffer 00FF0650 A55EF4 F7FF A 873 anl WR30, #RINGBUFFMASK ; do modulo 800h rollover 00FF0655 DF EE A 874 djnz R7, ?CopyDataToBuffer A 875 00FF0657 A 876 ?ReadyForAnotherRX: 00FF0657 A52E54 0400 A 877 add WR10, #EP1MAXPACKET ; The next packet can ba a max of MPS 00FF065C A5BE54 07FF A 878 cmp WR10, #RINGBUFFSIZE ; If this is < than the total buffer sapce, return 00FF0661 40 04 A 879 jl ?NullPacketRecd A 880 00FF0663 A5A9C3E1 A 881 clr RXIE ; Set not ready to RX till a enuf space is availab A 882 00FF0667 A 883 ?NullPacketRecd: 00FF0667 A5A9D4E4 A 884 setb RXFFRC ; signal FIFO read complete to trigger ARM A 885 ; logic for FIFO management 00FF066B A 886 ?Return: 00FF066B 22 A 887 Ret A 888 A 889 COMMENT *------------------------------------------------------------ A 890 Function name : ServiceEP1TX A 891 Brief Description : Deals with a transmit event on endpoint 1 It A 892 : checks to be sure a FIFO is available. It then A 893 : checks for data availability. If the no. of bytes A 894 : of data is greater than the MaxPacket size, then A 895 : MaxPacket bytes are sent. Otherwise all the A 896 : available data is sent. In either case the data A 897 : count and TxPtr are adjusted after the move. A 898 : It can be called as the result of a Tx or an Rx A 899 : interrupt. If its a Tx interrupt it enters at A 900 : ServiceEP1TX. If its from an Rx interrupt it A 901 : enters at PrimeEP1Fifo. A 902 Regs preserved : No reg. is saved A 903 --------------------------------------------------------------------* A 904 SCOPE 00FF066C A 905 ServiceEP1TX: 00FF066C 53C0FB A 906 anl FIFLG, #EP1_TX_CLR ; Clear the interrupt bit. A 907 PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 29 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF066F A 908 PrimeEP1Fifo: 00FF066F A5A937F5 07 A 909 jnb TXFIF1, ?FifoAvailable ; Make sure a fifo is available 00FF0674 A5A936F5 02 A 910 jnb TXFIF0, ?FifoAvailable ; Make sure a fifo is available A 911 00FF0679 80 72 A 912 jmp ?Return A 913 00FF067B A 914 ?FifoAvailable: 00FF067B A57E37 D804 A 915 mov WR6, _EP1DataCount ; Get data count in WR6 00FF0680 A5BE34 0000 A 916 cmp WR6, #00h ; is data count == 0? 00FF0685 A578 02 A 917 jne ?Continue A 918 00FF0688 80 63 A 919 jmp ?Return A 920 00FF068A A 921 ?Continue: 00FF068A A5BE34 0400 A 922 cmp WR6, #EP1MAXPACKET ; cmp with MPS 00FF068F 40 05 A 923 jl ?LessThanMPS A 924 00FF0691 A 925 ?MoreThanMPS: 00FF0691 A57E34 0400 A 926 mov WR6, #EP1MAXPACKET ; Set NoOfBytes to transfer to MPS A 927 00FF0696 A 928 ?LessThanMPS: 00FF0696 A57E57 D802 A 929 mov WR10, _EP1TxPtr ; Get offset of first full location A 930 ; in the endpoint buffer 00FF069B A57EF4 D000 A 931 mov WR30, #EP_1_Buffer ; set WR30 back to buffer start 00FF06A0 A52DF5 A 932 add WR30, WR10 ; get to first full location A 933 00FF06A3 A52D53 A 934 add WR10, WR6 00FF06A6 A55E54 07FF A 935 anl WR10, #RINGWORDMASK ; do modulo 800h rollover 00FF06AB A57A57 D802 A 936 mov _EP1TxPtr, WR10 A 937 00FF06B0 A57E57 D804 A 938 mov WR10, _EP1DataCount 00FF06B5 A59D53 A 939 sub WR10, WR6 00FF06B8 A57A57 D804 A 940 mov _EP1DataCount, WR10 A 941 00FF06BD A5CA78 A 942 push R7 00FF06C0 A 943 ?ArmTXFifo: 00FF06C0 A57EF9C0 A 944 mov R12, @WR30 ; Read data from buffer 00FF06C4 A57AC1F3 A 945 mov TXDAT1, R12 ; store in Tx FIFO 00FF06C8 A50BF4 A 946 inc WR30, #01h ; inc. the pointer 00FF06CB A55EF4 F7FF A 947 anl WR30, #RINGBUFFMASK ; do modulo 800h rollover 00FF06D0 DF EE A 948 djnz R7, ?ArmTXFifo 00FF06D2 A5DA78 A 949 pop R7 A 950 00FF06D5 8FF6 A 951 mov TXCNT1, R7 ; Write the transmit count A 952 00FF06D7 A 953 ?ReadyForRX: 00FF06D7 A5A923E1 11 A 954 jb RXIE , ?Return A 955 00FF06DC A 956 ?RXWasDisabled: 00FF06DC A52E54 0400 A 957 add WR10, #EP1MAXPACKET ; The next packet can be a max of MPS 00FF06E1 A5BE54 07FF A 958 cmp WR10, #RINGBUFFSIZE ; If this is > than the total buffer sapce 00FF06E6 A538 04 A 959 jg ?Return ; return PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 30 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm A 960 00FF06E9 A5A9D3E1 A 961 setb RXIE ; Set ready to RX as enuf buffer space is A 962 ; now available. 00FF06ED A 963 ?Return: 00FF06ED 22 A 964 Ret A 965 A 966 COMMENT *------------------------------------------------------------ A 967 Function name : ServiceEP2RX A 968 Brief Description : Copies data recd. on EP 2 and stores the same in A 969 : a buffer. A 970 Regs preserved : No reg. is saved A 971 --------------------------------------------------------------------* A 972 SCOPE 00FF06EE A 973 ServiceEP2RX: 00FF06EE 53C0DF A 974 anl FIFLG, #EP2_RX_CLR ; Clear the interrupt bit 00FF06F1 A5A920E2 02 A 975 jb RXACK, ?GoodReceive ; If R_ACK set then a good reception A 976 00FF06F6 80 58 A 977 jmp ?Return ; else leave A 978 00FF06F8 A 979 ?GoodReceive: 00FF06F8 7E00 A 980 mov R6, #00h 00FF06FA AFE6 A 981 mov R7, RXCNT2 ; Get the no. of bytes recd. 00FF06FC A5BE7000 A 982 cmp R7, #00h ; Check whether a null data packet was recd. 00FF0700 A568 49 A 983 je ?NullPacketRecd ; 00FF0703 A57E57 E800 A 984 mov WR10, _EP2RxPtr ; Get offset of next free location in the buffer 00FF0708 A57EF4 E000 A 985 mov WR30, #EP_2_Buffer ; get address of start of buffer. 00FF070D A52DF5 A 986 add WR30, WR10 ; get to next free locaion. A 987 00FF0710 A52D53 A 988 add WR10, WR6 00FF0713 A55E54 F7FF A 989 anl WR10, #RINGBUFFMASK ; do modulo 800h rollover 00FF0718 A57A57 E800 A 990 mov _EP2RxPtr, WR10 ; update the RXPtr offset in buffer. A 991 00FF071D A57E57 E804 A 992 mov WR10, _EP2DataCount ; get current data count 00FF0722 A52D53 A 993 add WR10, WR6 ; add no. of bytes recd. 00FF0725 A57A57 E804 A 994 mov _EP2DataCount, WR10 ; update the data count A 995 00FF072A A 996 ?CopyDataToBuffer: 00FF072A A57EC1E3 A 997 mov R12, RXDAT2 ; Read data from FIFO 00FF072E A57AF9C0 A 998 mov @WR30, R12 ; store in data buffer 00FF0732 A50BF4 A 999 inc WR30, #01h ; incr. ptr into buffer 00FF0735 A55EF4 F7FF A 1000 anl WR30, #RINGBUFFMASK ; do modulo 800h rollover 00FF073A DF EE A 1001 djnz R7, ?CopyDataToBuffer A 1002 00FF073C A 1003 ?ReadyForAnotherRX: 00FF073C A52E54 0008 A 1004 add WR10, #EP2MAXPACKET ; The next packet can ba a max of MPS 00FF0741 A5BE54 07FF A 1005 cmp WR10, #RINGBUFFSIZE ; If this is < than the total buffer sapce, return 00FF0746 40 04 A 1006 jl ?NullPacketRecd A 1007 00FF0748 A5A9C3E1 A 1008 clr RXIE ; Set not ready to RX till a enuf space is availab A 1009 00FF074C A 1010 ?NullPacketRecd: 00FF074C A5A9D4E4 A 1011 setb RXFFRC ; signal FIFO read complete to trigger ARM PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 31 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm A 1012 ; logic for FIFO management 00FF0750 A 1013 ?Return: 00FF0750 22 A 1014 Ret A 1015 A 1016 COMMENT *------------------------------------------------------------ A 1017 Function name : ServiceEP2TX A 1018 Brief Description : Deals with a transmit event on endpoint 1 It A 1019 : checks to be sure a FIFO is available. It then A 1020 : checks for data availability. If the no. of bytes A 1021 : of data is greater than the MaxPacket size, then A 1022 : MaxPacket bytes are sent. Otherwise all the A 1023 : available data is sent. In either case the data A 1024 : count and TxPtr are adjusted after the move. A 1025 : It can be called as the result of a Tx or an Rx A 1026 : interrupt. If its a Tx interrupt it enters at A 1027 : ServiceEP2TX. If its from an Rx interrupt it A 1028 : enters at PrimeEP2Fifo. A 1029 Regs preserved : No reg. is saved A 1030 --------------------------------------------------------------------* A 1031 SCOPE 00FF0751 A 1032 ServiceEP2TX: 00FF0751 53C0EF A 1033 anl FIFLG, #EP2_TX_CLR ; Clear the interrupt bit. A 1034 00FF0754 A 1035 PrimeEP2Fifo: 00FF0754 A5A937F5 07 A 1036 jnb TXFIF1 , ?FifoAvailable ; Make sure a fifo is available 00FF0759 A5A936F5 02 A 1037 jnb TXFIF0 , ?FifoAvailable ; Make sure a fifo is available A 1038 00FF075E 80 7F A 1039 jmp ?Return A 1040 00FF0760 A 1041 ?FifoAvailable: 00FF0760 A57E37 E804 A 1042 mov WR6, _EP2DataCount ; Get data count in WR6 00FF0765 A5BE34 0000 A 1043 cmp WR6, #00h ; is data count == 0? 00FF076A A578 02 A 1044 jne ?Continue A 1045 00FF076D 80 70 A 1046 jmp ?Return A 1047 00FF076F A 1048 ?Continue: 00FF076F A5BE34 0008 A 1049 cmp WR6, #EP2MAXPACKET ; cmp with MPS 00FF0774 40 05 A 1050 jl ?LessThanMPS A 1051 00FF0776 A 1052 ?MoreThanMPS: 00FF0776 A57E34 0008 A 1053 mov WR6, #EP2MAXPACKET ; Set NoOfBytes to transfer to MPS A 1054 00FF077B A 1055 ?LessThanMPS: 00FF077B A57E57 E802 A 1056 mov WR10, _EP2TxPtr ; Get offset of first full location A 1057 ; in the endpoint buffer 00FF0780 A57EF4 E000 A 1058 mov WR30, #EP_2_Buffer ; set WR30 back to buffer start 00FF0785 A52DF5 A 1059 add WR30, WR10 ; get to first full location A 1060 00FF0788 A52D53 A 1061 add WR10, WR6 00FF078B A55E54 07FF A 1062 anl WR10, #RINGWORDMASK ; do modulo 800h rollover 00FF0790 A57A57 E802 A 1063 mov _EP2TxPtr, WR10 PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 32 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm A 1064 00FF0795 A57E57 E804 A 1065 mov WR10, _EP2DataCount 00FF079A A59D53 A 1066 sub WR10, WR6 00FF079D A57A57 E804 A 1067 mov _EP2DataCount, WR10 A 1068 00FF07A2 A5CA78 A 1069 push R7 00FF07A5 A 1070 ?ArmTXFifo: 00FF07A5 A57EF9C0 A 1071 mov R12, @WR30 ; Read data from buffer 00FF07A9 A57AC1F3 A 1072 mov TXDAT2, R12 ; store in Tx FIFO 00FF07AD A50BF4 A 1073 inc WR30, #01h ; inc. the pointer 00FF07B0 A55EF4 F7FF A 1074 anl WR30, #RINGBUFFMASK ; do modulo 800h rollover 00FF07B5 DF EE A 1075 djnz R7, ?ArmTXFifo 00FF07B7 A5DA78 A 1076 pop R7 A 1077 00FF07BA 8FF6 A 1078 mov TXCNT2, R7 ; Write the transmit count A 1079 00FF07BC A 1080 ?ReadyForRX: 00FF07BC A5A923E1 11 A 1081 jb RXIE, ?Return_3 A 1082 00FF07C1 A 1083 ?RXWasDisabled: 00FF07C1 A52E54 0008 A 1084 add WR10, #EP2MAXPACKET ; The next packet can be a max of MPS 00FF07C6 A5BE54 07FF A 1085 cmp WR10, #RINGBUFFSIZE ; If this is > than the total buffer sapce 00FF07CB A538 04 A 1086 jg ?Return_3 ; return A 1087 00FF07CE A5A9D3E1 A 1088 setb RXIE ; Set ready to RX as enuf buffer sp A 1089 ; now available. 00FF07D2 A 1090 ?Return_3: 00FF07D2 A57EB1F5 A 1091 mov R11, TXFLG 00FF07D6 A55EB0C0 A 1092 anl R11, #0C0h 00FF07DA 60 03 A 1093 jZ ?Return 00FF07DC 02 0751 A 1094 jmp ServiceEP2TX 00FF07DF A 1095 ?Return: 00FF07DF 22 A 1096 Ret A 1097 A 1098 COMMENT *------------------------------------------------------------ A 1099 Function name : ServiceEP3RX A 1100 Brief Description : Copies data recd. on EP 3 and stores the same in A 1101 : a buffer. A 1102 Regs preserved : No reg. is saved A 1103 --------------------------------------------------------------------* A 1104 SCOPE 00FF07E0 A 1105 ServiceEP3RX: 00FF07E0 53C07F A 1106 anl FIFLG, #EP3_RX_CLR ; Clear the interrupt bit 00FF07E3 A5A920E2 02 A 1107 jb RXACK, ?GoodReceive ; If R_ACK set then a good reception A 1108 00FF07E8 80 58 A 1109 jmp ?Return ; else leave A 1110 00FF07EA A 1111 ?GoodReceive: 00FF07EA 7E00 A 1112 mov R6, #00h 00FF07EC AFE6 A 1113 mov R7, RXCNT3 ; Get the no. of bytes recd. 00FF07EE A5BE7000 A 1114 cmp R7, #00h ; Check whether a null data packet was recd. 00FF07F2 A568 49 A 1115 je ?NullPacketRecd ; PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 33 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF07F5 A57E57 F800 A 1116 mov WR10, _EP3RxPtr ; Get offset of next free location in the buffer 00FF07FA A57EF4 F000 A 1117 mov WR30, #EP_3_Buffer ; get address of start of buffer. 00FF07FF A52DF5 A 1118 add WR30, WR10 ; get to next free locaion. A 1119 00FF0802 A52D53 A 1120 add WR10, WR6 00FF0805 A55E54 F7FF A 1121 anl WR10, #RINGBUFFMASK ; do modulo 800h rollover 00FF080A A57A57 F800 A 1122 mov _EP3RxPtr, WR10 ; update the RXPtr offset in buffer. A 1123 00FF080F A57E57 F804 A 1124 mov WR10, _EP3DataCount ; get current data count 00FF0814 A52D53 A 1125 add WR10, WR6 ; add no. of bytes recd. 00FF0817 A57A57 F804 A 1126 mov _EP3DataCount, WR10 ; update the data count A 1127 00FF081C A 1128 ?CopyDataToBuffer: 00FF081C A57EC1E3 A 1129 mov R12, RXDAT3 ; Read data from FIFO 00FF0820 A57AF9C0 A 1130 mov @WR30, R12 ; store in data buffer 00FF0824 A50BF4 A 1131 inc WR30, #01h ; incr. ptr into buffer 00FF0827 A55EF4 F7FF A 1132 anl WR30, #RINGBUFFMASK ; do modulo 800h rollover 00FF082C DF EE A 1133 djnz R7, ?CopyDataToBuffer A 1134 00FF082E A 1135 ?ReadyForAnotherRX: 00FF082E A52E54 0008 A 1136 add WR10, #EP3MAXPACKET ; The next packet can ba a max of MPS 00FF0833 A5BE54 07FF A 1137 cmp WR10, #RINGBUFFSIZE ; If this is < than the total buffer sapce, return 00FF0838 40 04 A 1138 jl ?NullPacketRecd A 1139 00FF083A A5A9C3E1 A 1140 clr RXIE ; Set not ready to RX till a enuf space is availab A 1141 00FF083E A 1142 ?NullPacketRecd: 00FF083E A5A9D4E4 A 1143 setb RXFFRC ; signal FIFO read complete to trigger ARM A 1144 ; logic for FIFO management 00FF0842 A 1145 ?Return: 00FF0842 22 A 1146 Ret A 1147 A 1148 COMMENT *------------------------------------------------------------ A 1149 Function name : ServiceEP3TX A 1150 Brief Description : Deals with a transmit event on endpoint 1 It A 1151 : checks to be sure a FIFO is available. It then A 1152 : checks for data availability. If the no. of bytes A 1153 : of data is greater than the MaxPacket size, then A 1154 : MaxPacket bytes are sent. Otherwise all the A 1155 : available data is sent. In either case the data A 1156 : count and TxPtr are adjusted after the move. A 1157 : It can be called as the result of a Tx or an Rx A 1158 : interrupt. If its a Tx interrupt it enters at A 1159 : ServiceEP3TX. If its from an Rx interrupt it A 1160 : enters at PrimeEP3Fifo. A 1161 Regs preserved : No reg. is saved A 1162 --------------------------------------------------------------------* A 1163 SCOPE 00FF0843 A 1164 ServiceEP3TX: 00FF0843 53C0BF A 1165 anl FIFLG, #EP3_TX_CLR ; Clear the interrupt bit. A 1166 00FF0846 A 1167 PrimeEP3Fifo: PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 34 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF0846 A5A937F5 07 A 1168 jnb TXFIF1, ?FifoAvailable ; Make sure a fifo is available 00FF084B A5A936F5 02 A 1169 jnb TXFIF0, ?FifoAvailable ; Make sure a fifo is available A 1170 00FF0850 80 72 A 1171 jmp ?Return A 1172 00FF0852 A 1173 ?FifoAvailable: 00FF0852 A57E37 F804 A 1174 mov WR6, _EP3DataCount ; Get data count in WR6 00FF0857 A5BE34 0000 A 1175 cmp WR6, #00h ; is data count == 0? 00FF085C A578 02 A 1176 jne ?Continue A 1177 00FF085F 80 63 A 1178 jmp ?Return A 1179 00FF0861 A 1180 ?Continue: 00FF0861 A5BE34 0008 A 1181 cmp WR6, #EP3MAXPACKET ; cmp with MPS 00FF0866 40 05 A 1182 jl ?LessThanMPS A 1183 00FF0868 A 1184 ?MoreThanMPS: 00FF0868 A57E34 0008 A 1185 mov WR6, #EP3MAXPACKET ; Set NoOfBytes to transfer to MPS A 1186 00FF086D A 1187 ?LessThanMPS: 00FF086D A57E57 F802 A 1188 mov WR10, _EP3TxPtr ; Get offset of first full location A 1189 ; in the endpoint buffer 00FF0872 A57EF4 F000 A 1190 mov WR30, #EP_3_Buffer ; set WR30 back to buffer start 00FF0877 A52DF5 A 1191 add WR30, WR10 ; get to first full location A 1192 00FF087A A52D53 A 1193 add WR10, WR6 00FF087D A55E54 07FF A 1194 anl WR10, #RINGWORDMASK ; do modulo 800h rollover 00FF0882 A57A57 F802 A 1195 mov _EP3TxPtr, WR10 A 1196 00FF0887 A57E57 F804 A 1197 mov WR10, _EP3DataCount 00FF088C A59D53 A 1198 sub WR10, WR6 00FF088F A57A57 F804 A 1199 mov _EP3DataCount, WR10 A 1200 00FF0894 A5CA78 A 1201 push R7 00FF0897 A 1202 ?ArmTXFifo: 00FF0897 A57EF9C0 A 1203 mov R12, @WR30 ; Read data from buffer 00FF089B A57AC1F3 A 1204 mov TXDAT3, R12 ; store in Tx FIFO 00FF089F A50BF4 A 1205 inc WR30, #01h ; inc. the pointer 00FF08A2 A55EF4 F7FF A 1206 anl WR30, #RINGBUFFMASK ; do modulo 800h rollover 00FF08A7 DF EE A 1207 djnz R7, ?ArmTXFifo 00FF08A9 A5DA78 A 1208 pop R7 A 1209 00FF08AC 8FF6 A 1210 mov TXCNT3, R7 ; Write the transmit count A 1211 00FF08AE A 1212 ?ReadyForRX: 00FF08AE A5A923E1 11 A 1213 jb RXIE , ?Return A 1214 00FF08B3 A 1215 ?RXWasDisabled: 00FF08B3 A52E54 0008 A 1216 add WR10, #EP3MAXPACKET ; The next packet can be a max of MPS 00FF08B8 A5BE54 07FF A 1217 cmp WR10, #RINGBUFFSIZE ; If this is > than the total buffer sapce 00FF08BD A538 04 A 1218 jg ?Return ; return A 1219 PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 35 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF08C0 A5A9D3E1 A 1220 setb RXIE ; Set ready to RX as enuf buffer space is A 1221 ; now available. 00FF08C4 A 1222 ?Return: 00FF08C4 22 A 1223 Ret A 1224 A 1225 SCOPE A 1226 ;################################################################### A 1227 ;################### BufferControlData ############################ A 1228 ;## Transfers the data pointed to by DR28 into the IN Buffer ####### A 1229 ;## Also assumes that the first byte pointed to by DR28 is the ##### A 1230 ;## number of bytes to be moved, immediately followed by the data ## A 1231 ;################################################################### A 1232 A 1233 SCOPE 00FF08C5 A 1234 BufferControlData: A 1235 ;DR28 has address of data 00FF08C5 7E00 A 1236 mov R6, #00h 00FF08C7 A57E7B70 A 1237 mov R7, @DR28 ; Move Count 00FF08CB A52EF4 0001 A 1238 add WR30, #01h ; increment pointer to first byte of data 00FF08D0 A57E9000 A 1239 mov R9, #00h A 1240 00FF08D4 A57A93 A004 A 1241 mov in_rd_pntr, R9 ;Set buffer pointer to zero A 1242 ;for new transfer A 1243 00FF08D9 A57E57 9107 A 1244 mov WR10, wLength ; cmp no of bytes asked for with the A 1245 SWAP_BYTES R10,R11,R12 ; no. of bytes that the descriptor 00FF08DE A57CCA A+ 1245 mov R12, R10 00FF08E1 A57CAB A+ 1245 mov R10, R11 00FF08E4 A57CBC A+ 1245 mov R11, R12 A+ 1245 ENDMAC SWAP_BYTES 00FF08E7 A5BD35 A 1246 cmp WR6, WR10 ; contains. 00FF08EA A528 03 A 1247 jle ?Continue A 1248 00FF08ED A57D35 A 1249 mov WR6, WR10 ; If the no. of bytes in the descriptor A 1250 ; is greater than the no. of bytes asked for A 1251 ; send back only the no. of bytes as per A 1252 ; the Setup packet. A 1253 00FF08F0 A 1254 ?Continue: 00FF08F0 A57A73 A005 A 1255 mov in_bytes_left, R7 ;Store Count A 1256 00FF08F5 A57ED4 B000 A 1257 mov WR26, #LOW16(IN_BUFFERS) A 1258 00FF08FA A 1259 ?MoveMemory: 00FF08FA A57E7B90 A 1260 mov R9, @DR28 ; Get data 00FF08FE A57AD990 A 1261 mov @WR26, R9 ; Store data 00FF0902 A52ED4 0001 A 1262 add WR26, #01h 00FF0907 A52EF4 0001 A 1263 add WR30, #01h 00FF090C DF EC A 1264 djnz R7, ?MoveMemory A 1265 00FF090E 22 A 1266 Ret A 1267 PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 36 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm A 1268 ; --------------------------------------------------------- A 1269 ; A 1270 ; A 1271 ; --------------------------------------------------------- 00FF090F A 1272 SetStatusData: 00FF090F 7A00 A 1273 mov R2, #00h 00FF0911 A57A23 A004 A 1274 mov in_rd_pntr, R2 ;Set buffer pointer to zero A 1275 00FF0916 7A02 A 1276 mov R2, #02h 00FF0918 A57A23 A005 A 1277 mov in_bytes_left, R2 ;point to count variable A 1278 00FF091D A57ED4 B000 A 1279 mov WR26, #LOW16(IN_BUFFERS) 00FF0922 A51BD800 A 1280 mov @WR26, WR0 A 1281 00FF0926 22 A 1282 Ret A 1283 A 1284 ;################################################################### A 1285 ;################# DoControlOutput ################################## A 1286 ;################################################################### A 1287 A 1288 SCOPE 00FF0927 A 1289 DoControlOutput: 00FF0927 A5A9C1E1 A 1290 clr EPCON0.1 ; Set it up so that data is not Xmitted A 1291 ; while were are filling up the fifo. 00FF092B A57EA3 A005 A 1292 mov R10, in_bytes_left 00FF0930 A5BEA000 A 1293 cmp R10, #00h ;check for none 00FF0934 A578 07 A 1294 jne CntlDataAvail ;if ther is data do normal flow 00FF0937 A57E8000 A 1295 mov R8, #00h ;if none, do null packet 00FF093B 02 098D A 1296 ljmp ControlArmTx A 1297 00FF093E A 1298 CntlDataAvail: 00FF093E A57ED4 B000 A 1299 mov WR26, #LOW16(IN_BUFFERS) ;Get the address of the first char 00FF0943 A57EC000 A 1300 mov R12, #00h ;set up a word value for add since 00FF0947 A57ED3 A004 A 1301 mov R13, in_rd_pntr ;this is just a byte value. A 1302 00FF094C A52DD6 A 1303 add WR26, WR12 ;Add the read_pointer to the buffer location 00FF094F A57E8000 A 1304 mov R8, #00h ;initialize FIFO full counter 00FF0953 A5CAA8 A 1305 push R10 ;save starting bytes avail count A 1306 00FF0956 A 1307 ?WriteToFifo: 00FF0956 A57ED9B0 A 1308 mov R11, @WR26 ;Get the data 00FF095A A57AB1F3 A 1309 mov TXDAT0, R11 ;write it into the FIFO 00FF095E A52ED4 0001 A 1310 add WR26, #01h ;Increment buffer pointer 00FF0963 A52E8001 A 1311 add R8,#01h ;Increment FIFO count 00FF0967 A59EA001 A 1312 sub R10, #01h ;Are we done with the buffer 00FF096B A568 07 A 1313 je ControlTxUpd A 1314 00FF096E A5BE8008 A 1315 cmp R8, #FIFO_SIZE ;FIFO FULL? 00FF0972 A578 E1 A 1316 jne ?WriteToFifo A 1317 00FF0975 A 1318 ControlTxUpd: 00FF0975 A5DAA8 A 1319 pop R10 ;restore starting count PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 37 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF0978 A57EC3 A004 A 1320 mov R12, in_rd_pntr ;Get the offset into IN_BUFFER 00FF097D A52CC8 A 1321 add R12, R8 ;add amount we consumed 00FF0980 A57AC3 A004 A 1322 mov in_rd_pntr, R12 ;store the new offset 00FF0985 A59CA8 A 1323 sub R10, R8 ;subtract amount we just consumed 00FF0988 A57AA3 A005 A 1324 mov in_bytes_left, R10 ;store new count A 1325 00FF098D A 1326 ControlArmTx: 00FF098D A57A81F6 A 1327 mov TXCNT0, R8 ;Write count into TXCNT register 00FF0991 A5A9D1E1 A 1328 setb EPCON0.1 ;Enable data transmit A 1329 00FF0995 A 1330 ?Return: 00FF0995 22 A 1331 Ret A 1332 A 1333 SCOPE A 1334 ;***************************************************** A 1335 ;***************** INIT_USB ************************* A 1336 ;***************************************************** A 1337 00FF0996 A 1338 INIT_USB: A 1339 ;(KLS) 00FF0996 75F100 A 1340 mov EPINDEX, #00h 00FF0999 75F484 A 1341 mov TXCON0,#84h ;/* Flush FIFO, sets Empty bit in TXFLG0, enable ATM. */ 00FF099C 75E484 A 1342 mov RXCON0,#84h ;/* Flush FIFO, sets Empty bit in RXFLG0, enable ARM. */ A 1343 ; Enable endpoint 0 as a control endpoint. We need to set the A 1344 ; Transmit Endpoint enable, Receive Endpoint enable, and the A 1345 ; Receive Input enable. We do not set the Transmit Output enable A 1346 ; until we have determined what type of response we need to send A 1347 ; back, i.e., NULL packet for status phase or data for a "GET" A 1348 ; command. 00FF099F 75E12D A 1349 mov EPCON0,#2Dh; A 1350 A 1351 ; The non-zero endpoints are being enabled here just so they will A 1352 ; NAK any tokens sent to them. This is really not correct, since A 1353 ; by the spec they should not respond at all until the host has A 1354 ; set a configuration for this endpoint. We will set the Receive A 1355 ; Endpoint enable and Transmit Endpoint enable bits for these guys A 1356 ; but not the input and output enables. A 1357 00FF09A2 75F101 A 1358 mov EPINDEX, #01h 00FF09A5 75F484 A 1359 mov TXCON1,#84h ;/* Flush FIFO, sets Empty bit in TXFLG1, enable ATM. */ 00FF09A8 A5A9D3F4 A 1360 setb TXISO ; Make it an ISO endpoint 00FF09AC 75E484 A 1361 mov RXCON1,#84h ;/* Flush FIFO, sets Empty bit in RXFLG1, enable ARM. */ 00FF09AF 75E103 A 1362 mov EPCON1,#03h; ;/* Transmit only */ A 1363 00FF09B2 75F102 A 1364 mov EPINDEX, #02h 00FF09B5 75F484 A 1365 mov TXCON2,#84h ;/* Flush FIFO, sets Empty bit in TXFLG2, enable ATM. */ 00FF09B8 A5A9D3F4 A 1366 setb TXISO ; Make it an ISO endpoint 00FF09BC 75E484 A 1367 mov RXCON2,#84h ;/* Flush FIFO, sets Empty bit in RXFLG2, enable ARM. */ 00FF09BF 75E103 A 1368 mov EPCON2,#03h; ;/* Transmit only */ A 1369 00FF09C2 75F103 A 1370 mov EPINDEX, #03h 00FF09C5 75F484 A 1371 mov TXCON3,#84h ;/* Flush FIFO, sets Empty bit in TXFLG3, enable ATM. */ PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 38 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF09C8 75E484 A 1372 mov RXCON3,#84h ;/* Flush FIFO, sets Empty bit in RXFLG3, enable ARM. */ 00FF09CB 75E100 A 1373 mov EPCON3,#00h; ;/* Off */ 00FF09CE 22 A 1374 RET A 1375 A 1376 SCOPE A 1377 ;***************************************************** A 1378 ;***************** INIT_UART ************************* A 1379 ;***************************************************** A 1380 00FF09CF A 1381 INIT_UART: 00FF09CF 759850 A 1382 mov SCON, #050h A 1383 ;Timer 2 is being used to generate baud rates. 00FF09D2 75CAD9 A 1384 mov RCAP2L, #0D9h ; USB EVAL 9600 ?==? 9600/19200 16-bit reload value for baud 00FF09D5 75CBFF A 1385 mov RCAP2H, #0FFh ; 00FF09D8 75C834 A 1386 mov T2CON, #034h ; Set TIMER 2 into baud rate generator WORKS(A) 00FF09DB C299 A 1387 clr TI ; Clear Transmit interrupt A 1388 ;; mov IEN0, #0 ; KILL ALL INTERUPTS 00FF09DD 12 0C12 A 1389 LCALL Lng_Delay 00FF09E0 759900 A 1390 mov SBUF, #00 00FF09E3 12 0C12 A 1391 LCALL Lng_Delay 00FF09E6 22 A 1392 ret A 1393 A 1394 A 1395 A 1396 ;************************************************************************ A 1397 ;************* DEVICE DESCRIPTOR **************************************** A 1398 ;************************************************************************ A 1399 A 1400 ; A 1401 ; NOTE!!!!! '251 is a Big Endian machine. Words and DWords are stored with the A 1402 ; LSB in the numerically higher address. A 1403 ; A 1404 00000008 A 1405 EP1_INIT_MaxPacket equ 8 A 1406 00FF09E7 A 1407 DEVICE_DESCRIPTOR: 00FF09E7 12 A 1408 gDLength: db 012h ;Used by packet transfer routines. 00FF09E8 12 A 1409 gDevice_bLength: db 012h 00FF09E9 01 A 1410 gDevice_bDescriptorType: db DEVICE_DESCR 00FF09EA 0001 A 1411 gDevice_bcdUSB: dw 0001h ; Version 1.00 compliant 00FF09EC DC A 1412 gDevice_bDeviceClass: db 0DCh 00FF09ED 00 A 1413 gDevice_bDeviceSubClass: db 00h 00FF09EE 00 A 1414 gDevice_bDeviceProtocol: db 00h 00FF09EF 08 A 1415 gDevice_wMaxPacketSize0: db 08h ;8 byte max for EP0 00FF09F0 8680 A 1416 gDevice_widVendor: dw 8680h ;Intel Vendor ID (8086) 00FF09F2 9198 A 1417 gDevice_widProduct: dw 9198h ; 00FF09F4 3001 A 1418 gDevice_bcdDevice: dw 3001h ;device version 1.30 00FF09F6 00 A 1419 gDevice_iManufacturer: db 0h ;These three fields are supposed 00FF09F7 00 A 1420 gDevice_iProduct: db 0h ;to contain the index of strings 00FF09F8 00 A 1421 gDevice_iSerialNumber: db 0h ;describing device. 00FF09F9 01 A 1422 gDevice_bNumConfigurations: db 01h A 1423 PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 39 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm A 1424 A 1425 ;/*--------------- Initialize global Config descriptor ----------------*/ 00FF09FA A 1426 CONFIGURATION_DESCRIPTOR: 00FF09FA 93 A 1427 gCLength: db gEndDescriptor1Label-gConfig_bLength A 1428 ; ^^^^ Used by packet transfer routines. A 1429 00FF09FB 09 A 1430 gConfig_bLength: db 09h 00FF09FC 02 A 1431 gConfig_bDescriptorType: db CONFIG_DESCR 00FF09FD 93 A 1432 gConfig_bTotalLength: db gEndDescriptor1Label-gConfig_bLength ; 00FF09FE 00 A 1433 gConfig_bCorrection: db 0 00FF09FF 01 A 1434 gConfig_bNumInterfaces: db 1 ; NUM_OF_INTERFACES; 00FF0A00 01 A 1435 gConfig_bConfigurationValue: db 1 00FF0A01 00 A 1436 gConfig_iConfiguration: db 0 00FF0A02 40 A 1437 gConfig_bmAttributes: db 040h 00FF0A03 25 A 1438 gConfig_MaxPower: db 025h ;50ma A 1439 A 1440 ; /*------------- Initialize global Interface descriptor ---------------*/ 00FF0A04 A 1441 gInterfaceDescriptor: 00FF0A04 09 A 1442 gInterface_bLength: db 09h 00FF0A05 04 A 1443 gInterface_bDescriptorType: db INTERFACE_DESCR 00FF0A06 00 A 1444 gInterface_bInterfaceNumber: db 00h 00FF0A07 00 A 1445 gInterface_bAlternateSetting: db 00h 00FF0A08 02 A 1446 gInterface_bNumEndpoints: db 02h 00FF0A09 DC A 1447 gInterface_bInterfaceClass: db 0DCh 00FF0A0A 50 A 1448 gInterface_bInterfaceSubClass: db 50h 00FF0A0B 10 A 1449 gInterface_bInterfaceProtocol: db 10h 00FF0A0C 00 A 1450 gInterface_iInterface: db 0 A 1451 A 1452 ; /*------------- Initialize Endpoint 1 descriptor ---------------*/ 00FF0A0D A 1453 gEndPoint: 00FF0A0D 07 A 1454 gEP_bLength: db 07h 00FF0A0E 05 A 1455 gEP_bDescriptorType: db ENDPOINT_DESCR 00FF0A0F 81 A 1456 gEP_bEndpointAddress: db 81h ;EP address 1, in 00FF0A10 01 A 1457 gEP_bmAtrributes: db 01h ;ISOC A 1458 ;Max Packet 32 bytes 00FF0A11 0800 A 1459 gEP_wMaxPacketSize: db LOW(EP1_INIT_MaxPacket),HIGH(EP1_INIT_MaxPacket) 00FF0A13 00 A 1460 gEP_bInterval: db 0h A 1461 A 1462 ; /*------------- Initialize Endpoint 1B descriptor ---------------*/ 00FF0A14 A 1463 gEndPointB: 00FF0A14 07 A 1464 gEPB_bLength: db 07h 00FF0A15 05 A 1465 gEPB_bDescriptorType: db ENDPOINT_DESCR 00FF0A16 82 A 1466 gEPB_bEndPointAddress: db 82h ;EP address 2, in 00FF0A17 01 A 1467 gEPB_bmAtrributes: db 01h ;ISOC 00FF0A18 0800 A 1468 gEPB_wMaxPacketSize: dw 0800h ;Max Packet 8 bytes 00FF0A1A 00 A 1469 gEPB_bInterval: db 0h A 1470 A 1471 ; /*------------- Initialize Alternate Interface descriptor 1---------------*/ 00FF0A1B A 1472 gAltXface1Descriptor: 00FF0A1B 09 A 1473 gAltXface1_bLength: db 09h 00FF0A1C 04 A 1474 gAltXface1_bDescriptorType: db INTERFACE_DESCR 00FF0A1D 00 A 1475 gAltXface1_bInterfaceNumber: db 0h PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 40 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF0A1E 01 A 1476 gAltXface1_bAlternateSetting: db 01h 00FF0A1F 02 A 1477 gAltXface1_bNumEndpoints: db 2h 00FF0A20 DC A 1478 gAltXface1_bInterfaceClass: db 0DCh 00FF0A21 50 A 1479 gAltXface1_bInterfaceSubClass: db 50h 00FF0A22 10 A 1480 gAltXface1_bInterfaceProtocol: db 10h 00FF0A23 00 A 1481 gAltXface1_iInterface: db 0 A 1482 A 1483 ; /*------------- Initialize Endpoints in Alternate interface 1 ---------------*/ 00FF0A24 A 1484 gEndPointAX1: 00FF0A24 07 A 1485 gEPAX1_bLength: db 07h 00FF0A25 05 A 1486 gEPAX1_bDescriptorType: db ENDPOINT_DESCR 00FF0A26 81 A 1487 gEPAX1_bEndpointAddress: db 81h ;EP address 1, in 00FF0A27 01 A 1488 gEPAX1_bmAtrributes: db 01h ;ISOC 00FF0A28 2000 A 1489 gEPAX1_wMaxPacketSize: dw 2000h ;Max Packet 32 bytes 00FF0A2A 00 A 1490 gEPAX1_bInterval: db 0h A 1491 00FF0A2B A 1492 gEndPointAX1B: 00FF0A2B 07 A 1493 gEPAX1B_bLength: db 07h 00FF0A2C 05 A 1494 gEPAX1B_bDescriptorType: db ENDPOINT_DESCR 00FF0A2D 81 A 1495 gEPAX1B_bEndPointAddress: db 81h ;EP address 2,in 00FF0A2E 01 A 1496 gEPAX1B_bmAtrributes: db 01h ;ISOC 00FF0A2F 0400 A 1497 gEPAX1B_wMaxPacketSize: dw 0400h ;Max Packet 4 bytes 00FF0A31 00 A 1498 gEPAX1B_bInterval: db 0h A 1499 A 1500 ; /*------------- Initialize Alternate Interface descriptor 2---------------*/ 00FF0A32 A 1501 gAltXface2Descriptor: 00FF0A32 09 A 1502 gAltXface2_bLength: db 09h 00FF0A33 04 A 1503 gAltXface2_bDescriptorType: db INTERFACE_DESCR 00FF0A34 00 A 1504 gAltXface2_bInterfaceNumber: db 00h 00FF0A35 02 A 1505 gAltXface2_bAlternateSetting: db 02h 00FF0A36 02 A 1506 gAltXface2_bNumEndpoints: db 2h 00FF0A37 DC A 1507 gAltXface2_bInterfaceClass: db 0DCh 00FF0A38 50 A 1508 gAltXface2_bInterfaceSubClass: db 50h 00FF0A39 10 A 1509 gAltXface2_bInterfaceProtocol: db 10h 00FF0A3A 00 A 1510 gAltXface2_iInterface: db 0 A 1511 A 1512 ; /*------------- Initialize Endpoints in Alternate interface 2 ---------------*/ 00FF0A3B A 1513 gEndPointAX2: 00FF0A3B 07 A 1514 gEPAX2_bLength: db 07h 00FF0A3C 05 A 1515 gEPAX2_bDescriptorType: db ENDPOINT_DESCR 00FF0A3D 81 A 1516 gEPAX2_bEndpointAddress: db 81h ;EP address 1, in 00FF0A3E 01 A 1517 gEPAX2_bmAtrributes: db 01h ;ISOC 00FF0A3F 4000 A 1518 gEPAX2_wMaxPacketSize: dw 4000h ;Max Packet 64 bytes 00FF0A41 00 A 1519 gEPAX2_bInterval: db 0h A 1520 00FF0A42 A 1521 gEndPointAX2B: 00FF0A42 07 A 1522 gEPAX2B_bLength: db 07h 00FF0A43 05 A 1523 gEPAX2B_bDescriptorType: db ENDPOINT_DESCR 00FF0A44 81 A 1524 gEPAX2B_bEndPointAddress: db 81h ;EP address 2,in 00FF0A45 01 A 1525 gEPAX2B_bmAtrributes: db 01h ;ISOC 00FF0A46 0200 A 1526 gEPAX2B_wMaxPacketSize: dw 0200h ;Max Packet 2 bytes 00FF0A48 00 A 1527 gEPAX2B_bInterval: db 0h PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 41 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm A 1528 A 1529 ; /*------------- Initialize Alternate Interface descriptor 3---------------*/ 00FF0A49 A 1530 gAltXface3Descriptor: 00FF0A49 09 A 1531 gAltXface3_bLength: db 09h 00FF0A4A 04 A 1532 gAltXface3_bDescriptorType: db INTERFACE_DESCR 00FF0A4B 00 A 1533 gAltXface3_bInterfaceNumber: db 00h 00FF0A4C 03 A 1534 gAltXface3_bAlternateSetting: db 03h 00FF0A4D 02 A 1535 gAltXface3_bNumEndpoints: db 2h 00FF0A4E DC A 1536 gAltXface3_bInterfaceClass: db 0DCh 00FF0A4F 50 A 1537 gAltXface3_bInterfaceSubClass: db 50h 00FF0A50 10 A 1538 gAltXface3_bInterfaceProtocol: db 10h 00FF0A51 00 A 1539 gAltXface3_iInterface: db 0 A 1540 A 1541 ; /*------------- Initialize Endpoints in Alternate interface 3 ---------------*/ 00FF0A52 A 1542 gEndPointAX3: 00FF0A52 07 A 1543 gEPAX3_bLength: db 07h 00FF0A53 05 A 1544 gEPAX3_bDescriptorType: db ENDPOINT_DESCR 00FF0A54 81 A 1545 gEPAX3_bEndpointAddress: db 81h ;EP address 1, in 00FF0A55 01 A 1546 gEPAX3_bmAtrributes: db 01h ;ISOC 00FF0A56 8000 A 1547 gEPAX3_wMaxPacketSize: dw 8000h ;Max Packet 128 bytes 00FF0A58 00 A 1548 gEPAX3_bInterval: db 0h A 1549 00FF0A59 A 1550 gEndPointAX3B: 00FF0A59 07 A 1551 gEPAX3B_bLength: db 07h 00FF0A5A 05 A 1552 gEPAX3B_bDescriptorType: db ENDPOINT_DESCR 00FF0A5B 81 A 1553 gEPAX3B_bEndPointAddress: db 81h ;EP address 2,in 00FF0A5C 01 A 1554 gEPAX3B_bmAtrributes: db 01h ;ISOC 00FF0A5D 0100 A 1555 gEPAX3B_wMaxPacketSize: dw 0100h ;Max Packet 1 bytes 00FF0A5F 00 A 1556 gEPAX3B_bInterval: db 0h A 1557 A 1558 ; /*------------- Initialize Alternate Interface descriptor 4---------------*/ 00FF0A60 A 1559 gAltXface4Descriptor: 00FF0A60 09 A 1560 gAltXface4_bLength: db 09h 00FF0A61 04 A 1561 gAltXface4_bDescriptorType: db INTERFACE_DESCR 00FF0A62 00 A 1562 gAltXface4_bInterfaceNumber: db 00h 00FF0A63 04 A 1563 gAltXface4_bAlternateSetting: db 04h 00FF0A64 02 A 1564 gAltXface4_bNumEndpoints: db 2h 00FF0A65 DC A 1565 gAltXface4_bInterfaceClass: db 0DCh 00FF0A66 50 A 1566 gAltXface4_bInterfaceSubClass: db 50h 00FF0A67 10 A 1567 gAltXface4_bInterfaceProtocol: db 10h 00FF0A68 00 A 1568 gAltXface4_iInterface: db 0 A 1569 A 1570 ; /*------------- Initialize Endpoints in Alternate interface 4 ---------------*/ 00FF0A69 A 1571 gEndPointAX4: 00FF0A69 07 A 1572 gEPAX4_bLength: db 07h 00FF0A6A 05 A 1573 gEPAX4_bDescriptorType: db ENDPOINT_DESCR 00FF0A6B 81 A 1574 gEPAX4_bEndpointAddress: db 81h ;EP address 1, in 00FF0A6C 01 A 1575 gEPAX4_bmAtrributes: db 01h ;ISOC 00FF0A6D 3500 A 1576 gEPAX4_wMaxPacketSize: dw 3500h ;Max Packet 53 bytes 00FF0A6F 00 A 1577 gEPAX4_bInterval: db 0h A 1578 00FF0A70 A 1579 gEndPointAX4B: PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 42 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF0A70 07 A 1580 gEPAX4B_bLength: db 07h 00FF0A71 05 A 1581 gEPAX4B_bDescriptorType: db ENDPOINT_DESCR 00FF0A72 81 A 1582 gEPAX4B_bEndPointAddress: db 81h ;EP address 2,in 00FF0A73 01 A 1583 gEPAX4B_bmAtrributes: db 01h ;ISOC 00FF0A74 0300 A 1584 gEPAX4B_wMaxPacketSize: dw 0300h ;Max Packet 3 bytes 00FF0A76 00 A 1585 gEPAX4B_bInterval: db 0h A 1586 A 1587 ; /*------------- Initialize Alternate Interface descriptor 3---------------*/ 00FF0A77 A 1588 gAltXface5Descriptor: 00FF0A77 09 A 1589 gAltXface5_bLength: db 09h 00FF0A78 04 A 1590 gAltXface5_bDescriptorType: db INTERFACE_DESCR 00FF0A79 00 A 1591 gAltXface5_bInterfaceNumber: db 00h 00FF0A7A 05 A 1592 gAltXface5_bAlternateSetting: db 05h 00FF0A7B 02 A 1593 gAltXface5_bNumEndpoints: db 2h 00FF0A7C DC A 1594 gAltXface5_bInterfaceClass: db 0DCh 00FF0A7D 50 A 1595 gAltXface5_bInterfaceSubClass: db 50h 00FF0A7E 10 A 1596 gAltXface5_bInterfaceProtocol: db 10h 00FF0A7F 00 A 1597 gAltXface5_iInterface: db 0 A 1598 A 1599 ; /*------------- Initialize Endpoints in Alternate interface 3 ---------------*/ 00FF0A80 A 1600 gEndPointAX5: 00FF0A80 07 A 1601 gEPAX5_bLength: db 07h 00FF0A81 05 A 1602 gEPAX5_bDescriptorType: db ENDPOINT_DESCR 00FF0A82 81 A 1603 gEPAX5_bEndpointAddress: db 81h ;EP address 1, in 00FF0A83 01 A 1604 gEPAX5_bmAtrributes: db 01h ;ISOC 00FF0A84 6700 A 1605 gEPAX5_wMaxPacketSize: dw 6700h ;Max Packet 103 bytes 00FF0A86 00 A 1606 gEPAX5_bInterval: db 0h A 1607 00FF0A87 A 1608 gEndPointAX5B: 00FF0A87 07 A 1609 gEPAX5B_bLength: db 07h 00FF0A88 05 A 1610 gEPAX5B_bDescriptorType: db ENDPOINT_DESCR 00FF0A89 81 A 1611 gEPAX5B_bEndPointAddress: db 81h ;EP address 2,in 00FF0A8A 01 A 1612 gEPAX5B_bmAtrributes: db 01h ;ISOC 00FF0A8B 0700 A 1613 gEPAX5B_wMaxPacketSize: dw 0700h ;Max Packet 7 bytes 00FF0A8D 00 A 1614 gEPAX5B_bInterval: db 0h 00FF0A8E A 1615 gEndDescriptor1Label: A 1616 A 1617 A 1618 A 1619 A 1620 ;/*--------------- Initialize global Config descriptor ----------------*/ 00FF0A8E A 1621 CONFIGURATION_DESCRIPTOR2: 00FF0A8E 93 A 1622 g2CLength: db g2EndDescriptor2Label-g2Config_bLength A 1623 ; ^^^^ Used by packet transfer routines. A 1624 00FF0A8F 09 A 1625 g2Config_bLength: db 09h 00FF0A90 02 A 1626 g2Config_bDescriptorType: db CONFIG_DESCR 00FF0A91 93 A 1627 g2Config_bTotalLength: db g2EndDescriptor2Label-g2Config_bLength ; 00FF0A92 00 A 1628 g2Config_bCorrection: db 0 00FF0A93 01 A 1629 g2Config_bNumInterfaces: db 1 ; NUM_OF_INTERFACES; 00FF0A94 01 A 1630 g2Config_bConfigurationValue: db 1 00FF0A95 00 A 1631 g2Config_iConfiguration: db 0 PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 43 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF0A96 40 A 1632 g2Config_bmAttributes: db 040h 00FF0A97 25 A 1633 g2Config_MaxPower: db 025h ;50ma A 1634 A 1635 ; /*------------- Initialize global Interface descriptor ---------------*/ 00FF0A98 A 1636 g2InterfaceDescriptor: 00FF0A98 09 A 1637 g2Interface_bLength: db 09h 00FF0A99 04 A 1638 g2Interface_bDescriptorType: db INTERFACE_DESCR 00FF0A9A 00 A 1639 g2Interface_bInterfaceNumber: db 00h 00FF0A9B 00 A 1640 g2Interface_bAlternateSetting: db 00h 00FF0A9C 02 A 1641 g2Interface_bNumEndpoints: db 02h 00FF0A9D DC A 1642 g2Interface_bInterfaceClass: db 0DCh 00FF0A9E 50 A 1643 g2Interface_bInterfaceSubClass: db 50h 00FF0A9F 10 A 1644 g2Interface_bInterfaceProtocol: db 10h 00FF0AA0 00 A 1645 g2Interface_iInterface: db 0 A 1646 A 1647 ; /*------------- Initialize Endpoint 1 descriptor ---------------*/ 00FF0AA1 A 1648 g2EndPoint: 00FF0AA1 07 A 1649 g2EP_bLength: db 07h 00FF0AA2 05 A 1650 g2EP_bDescriptorType: db ENDPOINT_DESCR 00FF0AA3 81 A 1651 g2EP_bEndpointAddress: db 81h ;EP address 1, in 00FF0AA4 01 A 1652 g2EP_bmAtrributes: db 01h ;ISOC 00FF0AA5 0800 A 1653 g2EP_wMaxPacketSize: dw 0800h ;Max Packet 8 bytes 00FF0AA7 00 A 1654 g2EP_bInterval: db 0h A 1655 A 1656 ; /*------------- Initialize Endpoint 1B descriptor ---------------*/ 00FF0AA8 A 1657 g2EndPointB: 00FF0AA8 07 A 1658 g2EPB_bLength: db 07h 00FF0AA9 05 A 1659 g2EPB_bDescriptorType: db ENDPOINT_DESCR 00FF0AAA 82 A 1660 g2EPB_bEndPointAddress: db 82h ;EP address 2, in 00FF0AAB 01 A 1661 g2EPB_bmAtrributes: db 01h ;ISOC 00FF0AAC 0800 A 1662 g2EPB_wMaxPacketSize: dw 0800h ;Max Packet 8 bytes 00FF0AAE 00 A 1663 g2EPB_bInterval: db 0h A 1664 A 1665 ; /*------------- Initialize Interface descriptor 1---------------*/ 00FF0AAF A 1666 g2AltXface1Descriptor: 00FF0AAF 09 A 1667 g2AltXface1_bLength: db 09h 00FF0AB0 04 A 1668 g2AltXface1_bDescriptorType: db INTERFACE_DESCR 00FF0AB1 01 A 1669 g2AltXface1_bInterfaceNumber: db 1h 00FF0AB2 00 A 1670 g2AltXface1_bAlternateSetting: db 00h 00FF0AB3 02 A 1671 g2AltXface1_bNumEndpoints: db 2h 00FF0AB4 DC A 1672 g2AltXface1_bInterfaceClass: db 0DCh 00FF0AB5 50 A 1673 g2AltXface1_bInterfaceSubClass: db 50h 00FF0AB6 10 A 1674 g2AltXface1_bInterfaceProtocol: db 10h 00FF0AB7 00 A 1675 g2AltXface1_iInterface: db 0 A 1676 A 1677 ; /*------------- Initialize Endpoints in interface 1 ---------------*/ 00FF0AB8 A 1678 g2EndPointAX1: 00FF0AB8 07 A 1679 g2EPAX1_bLength: db 07h 00FF0AB9 05 A 1680 g2EPAX1_bDescriptorType: db ENDPOINT_DESCR 00FF0ABA 81 A 1681 g2EPAX1_bEndpointAddress: db 81h ;EP address 1, in 00FF0ABB 01 A 1682 g2EPAX1_bmAtrributes: db 01h ;ISOC 00FF0ABC 2000 A 1683 g2EPAX1_wMaxPacketSize: dw 2000h ;Max Packet 32 bytes PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 44 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF0ABE 00 A 1684 g2EPAX1_bInterval: db 0h A 1685 00FF0ABF A 1686 g2EndPointAX1B: 00FF0ABF 07 A 1687 g2EPAX1B_bLength: db 07h 00FF0AC0 05 A 1688 g2EPAX1B_bDescriptorType: db ENDPOINT_DESCR 00FF0AC1 81 A 1689 g2EPAX1B_bEndPointAddress: db 81h ;EP address 2,in 00FF0AC2 01 A 1690 g2EPAX1B_bmAtrributes: db 01h ;ISOC 00FF0AC3 0400 A 1691 g2EPAX1B_wMaxPacketSize: dw 0400h ;Max Packet 4 bytes 00FF0AC5 00 A 1692 g2EPAX1B_bInterval: db 0h A 1693 A 1694 ; /*------------- Initialize Interface descriptor 2---------------*/ 00FF0AC6 A 1695 g2AltXface2Descriptor: 00FF0AC6 09 A 1696 g2AltXface2_bLength: db 09h 00FF0AC7 04 A 1697 g2AltXface2_bDescriptorType: db INTERFACE_DESCR 00FF0AC8 02 A 1698 g2AltXface2_bInterfaceNumber: db 02h 00FF0AC9 00 A 1699 g2AltXface2_bAlternateSetting: db 00h 00FF0ACA 02 A 1700 g2AltXface2_bNumEndpoints: db 2h 00FF0ACB DC A 1701 g2AltXface2_bInterfaceClass: db 0DCh 00FF0ACC 50 A 1702 g2AltXface2_bInterfaceSubClass: db 50h 00FF0ACD 10 A 1703 g2AltXface2_bInterfaceProtocol: db 10h 00FF0ACE 00 A 1704 g2AltXface2_iInterface: db 0 A 1705 A 1706 ; /*------------- Initialize Endpoints in interface 2 ---------------*/ 00FF0ACF A 1707 g2EndPointAX2: 00FF0ACF 07 A 1708 g2EPAX2_bLength: db 07h 00FF0AD0 05 A 1709 g2EPAX2_bDescriptorType: db ENDPOINT_DESCR 00FF0AD1 81 A 1710 g2EPAX2_bEndpointAddress: db 81h ;EP address 1, in 00FF0AD2 01 A 1711 g2EPAX2_bmAtrributes: db 01h ;ISOC 00FF0AD3 4000 A 1712 g2EPAX2_wMaxPacketSize: dw 4000h ;Max Packet 64 bytes 00FF0AD5 00 A 1713 g2EPAX2_bInterval: db 0h A 1714 00FF0AD6 A 1715 g2EndPointAX2B: 00FF0AD6 07 A 1716 g2EPAX2B_bLength: db 07h 00FF0AD7 05 A 1717 g2EPAX2B_bDescriptorType: db ENDPOINT_DESCR 00FF0AD8 81 A 1718 g2EPAX2B_bEndPointAddress: db 81h ;EP address 2,in 00FF0AD9 01 A 1719 g2EPAX2B_bmAtrributes: db 01h ;ISOC 00FF0ADA 0200 A 1720 g2EPAX2B_wMaxPacketSize: dw 0200h ;Max Packet 2 bytes 00FF0ADC 00 A 1721 g2EPAX2B_bInterval: db 0h A 1722 A 1723 ; /*------------- Initialize Interface descriptor 3---------------*/ 00FF0ADD A 1724 g2AltXface3Descriptor: 00FF0ADD 09 A 1725 g2AltXface3_bLength: db 09h 00FF0ADE 04 A 1726 g2AltXface3_bDescriptorType: db INTERFACE_DESCR 00FF0ADF 03 A 1727 g2AltXface3_bInterfaceNumber: db 03h 00FF0AE0 00 A 1728 g2AltXface3_bAlternateSetting: db 00h 00FF0AE1 02 A 1729 g2AltXface3_bNumEndpoints: db 2h 00FF0AE2 DC A 1730 g2AltXface3_bInterfaceClass: db 0DCh 00FF0AE3 50 A 1731 g2AltXface3_bInterfaceSubClass: db 50h 00FF0AE4 10 A 1732 g2AltXface3_bInterfaceProtocol: db 10h 00FF0AE5 00 A 1733 g2AltXface3_iInterface: db 0 A 1734 A 1735 ; /*------------- Initialize Endpoints in interface 3 ---------------*/ PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 45 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF0AE6 A 1736 g2EndPointAX3: 00FF0AE6 07 A 1737 g2EPAX3_bLength: db 07h 00FF0AE7 05 A 1738 g2EPAX3_bDescriptorType: db ENDPOINT_DESCR 00FF0AE8 81 A 1739 g2EPAX3_bEndpointAddress: db 81h ;EP address 1, in 00FF0AE9 01 A 1740 g2EPAX3_bmAtrributes: db 01h ;ISOC 00FF0AEA 8000 A 1741 g2EPAX3_wMaxPacketSize: dw 8000h ;Max Packet 128 bytes 00FF0AEC 00 A 1742 g2EPAX3_bInterval: db 0h A 1743 00FF0AED A 1744 g2EndPointAX3B: 00FF0AED 07 A 1745 g2EPAX3B_bLength: db 07h 00FF0AEE 05 A 1746 g2EPAX3B_bDescriptorType: db ENDPOINT_DESCR 00FF0AEF 81 A 1747 g2EPAX3B_bEndPointAddress: db 81h ;EP address 2,in 00FF0AF0 01 A 1748 g2EPAX3B_bmAtrributes: db 01h ;ISOC 00FF0AF1 0100 A 1749 g2EPAX3B_wMaxPacketSize: dw 0100h ;Max Packet 1 bytes 00FF0AF3 00 A 1750 g2EPAX3B_bInterval: db 0h A 1751 A 1752 ; /*------------- Initialize Interface descriptor 4---------------*/ 00FF0AF4 A 1753 g2AltXface4Descriptor: 00FF0AF4 09 A 1754 g2AltXface4_bLength: db 09h 00FF0AF5 04 A 1755 g2AltXface4_bDescriptorType: db INTERFACE_DESCR 00FF0AF6 04 A 1756 g2AltXface4_bInterfaceNumber: db 04h 00FF0AF7 00 A 1757 g2AltXface4_bAlternateSetting: db 00h 00FF0AF8 02 A 1758 g2AltXface4_bNumEndpoints: db 2h 00FF0AF9 DC A 1759 g2AltXface4_bInterfaceClass: db 0DCh 00FF0AFA 50 A 1760 g2AltXface4_bInterfaceSubClass: db 50h 00FF0AFB 10 A 1761 g2AltXface4_bInterfaceProtocol: db 10h 00FF0AFC 00 A 1762 g2AltXface4_iInterface: db 0 A 1763 A 1764 ; /*------------- Initialize Endpoints in interface 4 ---------------*/ 00FF0AFD A 1765 g2EndPointAX4: 00FF0AFD 07 A 1766 g2EPAX4_bLength: db 07h 00FF0AFE 05 A 1767 g2EPAX4_bDescriptorType: db ENDPOINT_DESCR 00FF0AFF 81 A 1768 g2EPAX4_bEndpointAddress: db 81h ;EP address 1, in 00FF0B00 01 A 1769 g2EPAX4_bmAtrributes: db 01h ;ISOC 00FF0B01 3500 A 1770 g2EPAX4_wMaxPacketSize: dw 3500h ;Max Packet 53 bytes 00FF0B03 00 A 1771 g2EPAX4_bInterval: db 0h A 1772 00FF0B04 A 1773 g2EndPointAX4B: 00FF0B04 07 A 1774 g2EPAX4B_bLength: db 07h 00FF0B05 05 A 1775 g2EPAX4B_bDescriptorType: db ENDPOINT_DESCR 00FF0B06 81 A 1776 g2EPAX4B_bEndPointAddress: db 81h ;EP address 2,in 00FF0B07 01 A 1777 g2EPAX4B_bmAtrributes: db 01h ;ISOC 00FF0B08 0300 A 1778 g2EPAX4B_wMaxPacketSize: dw 0300h ;Max Packet 3 bytes 00FF0B0A 00 A 1779 g2EPAX4B_bInterval: db 0h A 1780 A 1781 ; /*------------- Initialize Interface descriptor 5---------------*/ 00FF0B0B A 1782 g2AltXface5Descriptor: 00FF0B0B 09 A 1783 g2AltXface5_bLength: db 09h 00FF0B0C 04 A 1784 g2AltXface5_bDescriptorType: db INTERFACE_DESCR 00FF0B0D 05 A 1785 g2AltXface5_bInterfaceNumber: db 05h 00FF0B0E 00 A 1786 g2AltXface5_bAlternateSetting: db 00h 00FF0B0F 02 A 1787 g2AltXface5_bNumEndpoints: db 2h PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 46 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF0B10 DC A 1788 g2AltXface5_bInterfaceClass: db 0DCh 00FF0B11 50 A 1789 g2AltXface5_bInterfaceSubClass: db 50h 00FF0B12 10 A 1790 g2AltXface5_bInterfaceProtocol: db 10h 00FF0B13 00 A 1791 g2AltXface5_iInterface: db 0 A 1792 A 1793 ; /*------------- Initialize Endpoints in interface 5 ---------------*/ 00FF0B14 A 1794 g2EndPointAX5: 00FF0B14 07 A 1795 g2EPAX5_bLength: db 07h 00FF0B15 05 A 1796 g2EPAX5_bDescriptorType: db ENDPOINT_DESCR 00FF0B16 81 A 1797 g2EPAX5_bEndpointAddress: db 81h ;EP address 1, in 00FF0B17 01 A 1798 g2EPAX5_bmAtrributes: db 01h ;ISOC 00FF0B18 6700 A 1799 g2EPAX5_wMaxPacketSize: dw 6700h ;Max Packet 103 bytes 00FF0B1A 00 A 1800 g2EPAX5_bInterval: db 0h A 1801 00FF0B1B A 1802 g2EndPointAX5B: 00FF0B1B 07 A 1803 g2EPAX5B_bLength: db 07h 00FF0B1C 05 A 1804 g2EPAX5B_bDescriptorType: db ENDPOINT_DESCR 00FF0B1D 81 A 1805 g2EPAX5B_bEndPointAddress: db 81h ;EP address 2,in 00FF0B1E 01 A 1806 g2EPAX5B_bmAtrributes: db 01h ;ISOC 00FF0B1F 0700 A 1807 g2EPAX5B_wMaxPacketSize: dw 0700h ;Max Packet 7 bytes 00FF0B21 00 A 1808 g2EPAX5B_bInterval: db 0h 00FF0B22 A 1809 g2EndDescriptor2Label: A 1810 A 1811 SCOPE 00FF0B22 A 1812 INIT_VARIABLES: A 1813 ;Init SETUP VARIABLES A 1814 ;;; 00FF0B22 759080 A 1815 mov P1,#080h A 1816 ;;; 00FF0B25 A57EB000 A 1817 mov R11,#0 ; Zero out R11 to represent initial state 00FF0B29 A57EE4 0000 A 1818 mov WR28,#0 ; Access in page 00h 00FF0B2E A57EF4 9000 A 1819 mov WR30,#LOW16(SetupSeq) ; Offset of SetupSeq var 00FF0B33 A57A7BB0 A 1820 mov @DR28,R11 ; Initial state is wait for SETUP A 1821 A 1822 ;;; 00FF0B37 759090 A 1823 mov P1,#090h A 1824 ;;; A 1825 ; 00FF0B3A A57E54 0000 A 1826 mov WR10, #00h ; 00FF0B3F A57EF4 D800 A 1827 mov WR30, #LOW16(_EP1RxPtr); 00FF0B44 A51B7A50 A 1828 mov @DR28, WR10 ; 00FF0B48 A52EF4 0002 A 1829 add WR30, #02h ; 00FF0B4D A51B7A50 A 1830 mov @DR28, WR10 ; 00FF0B51 A52EF4 0002 A 1831 add WR30, #02h ; 00FF0B56 A51B7A50 A 1832 mov @DR28, WR10 ; A 1833 ;;; 00FF0B5A 7590A0 A 1834 mov P1,#0A0h A 1835 ;;; A 1836 ;initialize the buffer variables for 00FF0B5D A57EF4 E800 A 1837 mov WR30, #LOW16(_EP2RxPtr);the three endpoints 00FF0B62 A51B7A50 A 1838 mov @DR28, WR10 ; 00FF0B66 A52EF4 0002 A 1839 add WR30, #02h ; PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 47 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF0B6B A51B7A50 A 1840 mov @DR28, WR10 ; 00FF0B6F A52EF4 0002 A 1841 add WR30, #02h ; 00FF0B74 A51B7A50 A 1842 mov @DR28, WR10 ; A 1843 ; 00FF0B78 A57EF4 F800 A 1844 mov WR30, #LOW16(_EP3RxPtr); 00FF0B7D A51B7A50 A 1845 mov @DR28, WR10 ; 00FF0B81 A52EF4 0002 A 1846 add WR30, #02h ; 00FF0B86 A51B7A50 A 1847 mov @DR28, WR10 ; 00FF0B8A A52EF4 0002 A 1848 add WR30, #02h ; 00FF0B8F A51B7A50 A 1849 mov @DR28, WR10 ; A 1850 A 1851 ;;; 00FF0B93 7590B0 A 1852 mov P1,#0B0h A 1853 ;;; A 1854 A 1855 00FF0B96 A57EA4 0000 A 1856 mov WR20,#0 00FF0B9B A57EB4 A000 A 1857 mov WR22, #low16(out_var_table) 00FF0BA0 A57E54 0000 A 1858 mov WR10, #0 00FF0BA5 A57E44 0000 A 1859 mov WR8,#0 00FF0BAA A57A5BB0 A 1860 ?l1: mov @DR20,R11 ;This loop zeroes out the 64 byte area 00FF0BAE A52EB4 0001 A 1861 add WR22,#1 ;at out_var_table. I'm not sure why. 00FF0BB3 A52E8001 A 1862 add R8,#1 00FF0BB7 A5BE8040 A 1863 cmp R8,#64 00FF0BBB A578 EC A 1864 jne ?l1 A 1865 A 1866 ;Zero out the output buffer area. A 1867 ;;; 00FF0BBE 7590C0 A 1868 mov P1,#0C0h A 1869 ;;; A 1870 00FF0BC1 A57EA4 0000 A 1871 mov WR20, #0 00FF0BC6 A57EB4 C000 A 1872 mov WR22, #low16(OUT_BUFFERS) 00FF0BCB A57E54 0000 A 1873 mov WR10, #0 00FF0BD0 A57E44 0000 A 1874 mov WR8,#0 00FF0BD5 A57A5BB0 A 1875 ?l2: mov @DR20,R11 00FF0BD9 A52EB4 0001 A 1876 add WR22,#1 00FF0BDE A52E44 0001 A 1877 add WR8,#1 A 1878 ; cmp WR8,#1000 00FF0BE3 A5BE44 0010 A 1879 cmp WR8,#10h 00FF0BE8 A578 EA A 1880 jne ?l2 A 1881 ;;; 00FF0BEB 7590D0 A 1882 mov P1,#0D0h A 1883 ;;; 00FF0BEE A57E54 0000 A 1884 mov WR10, #00h 00FF0BF3 A57EB4 A008 A 1885 mov WR22, #LOW16(DATA_PENDING) 00FF0BF8 A57A5BA0 A 1886 mov @DR20, R10 00FF0BFC A57EB4 A00B A 1887 mov WR22, #LOW16(DIRECTION_ERROR_COUNT) 00FF0C01 A57A5BA0 A 1888 mov @DR20, R10 00FF0C05 A57EB4 A009 A 1889 mov WR22, #LOW16(PENDING_START_TIME) 00FF0C0A A51B5A50 A 1890 mov @DR20, WR10 A 1891 ;;; PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 48 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00FF0C0E 7590E0 A 1892 mov P1,#0E0h A 1893 ;;; 00FF0C11 22 A 1894 RET A 1895 SCOPE A 1896 A 1897 00FF0C12 A 1898 Lng_Delay: 00FF0C12 A5CAC9 A 1899 push WR24 00FF0C15 A5CAD9 A 1900 push WR26 00FF0C18 A57EC4 0082 A 1901 MOV WR24, #082H 00FF0C1D 80 10 A 1902 JMP DE2 A 1903 A 1904 00FF0C1F A 1905 Delay_X: ;MOV P1,DPXL 00FF0C1F A5CAC9 A 1906 push WR24 ;5 states 00FF0C22 A5CAD9 A 1907 push WR26 ;5 states 00FF0C25 A57EC4 0001 A 1908 MOV WR24, #001H ;3 states 00FF0C2A A 1909 DE1: 00FF0C2A A57ED4 04FF A 1910 MOV WR26, #004FFH ;3 states cfffh original ;0fff works 00FF0C2F A 1911 DE2: 00FF0C2F A51BD4 A 1912 DEC WR26, #1 ;2 states 00FF0C32 A5BED4 0000 A 1913 CMP WR26, #00H ;4 states 00FF0C37 A578 F5 A 1914 JNE DE2 ;5 states T ; 2 states NT 00FF0C3A A51BC4 A 1915 DEC WR24, #1 ;2 states 00FF0C3D A5BEC4 0000 A 1916 CMP WR24, #00H ;4 states 00FF0C42 A578 E5 A 1917 JNE DE1 ;5 states T ; 2 states NT 00FF0C45 A5DAD9 A 1918 POP WR26 ;5 states 00FF0C48 A5DAC9 A 1919 POP WR24 ;5 states 00FF0C4B 22 A 1920 QUICK1: RET ; A 1921 A 1922 A 1923 A 1924 A 1925 ;############################################################# A 1926 ;####### RAM MEMORY MAP ###################################### A 1927 ;############################################################# A 1928 A 1929 ; org 00:0000h ;0-4ff Reserved A 1930 A 1931 ; org 00:0500h ; Variables A 1932 A 1933 ; org 00:0600h ; Variables for the IN token buffers A 1934 A 1935 ;; A 1936 ;; Data block for EP1. Contains buffer space and some management variables. A 1937 ;; A 1938 A 1939 define OUR_DATA_SEG, SPACE=pdata A 1940 segment OUR_DATA_SEG A 1941 0000D000 A 1942 org 00:D000h 0000D000 A 1943 EP_1_Buffer: ds 10h PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 49 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm A 1944 0000D800 A 1945 org 00:D800h 0000D800 A 1946 _EP1RxPtr: ds 2 0000D802 A 1947 _EP1TxPtr: ds 2 0000D804 A 1948 _EP1DataCount: ds 2 0000D806 A 1949 _gbMPSEndPoint1: ds 1 0000D807 A 1950 _gbMPSEndPoint2: ds 1 0000D808 A 1951 Critical: ds 1 0000D809 A 1952 Inject_error: ds 1 A 1953 ;; A 1954 ;; Data block for EP2. Contains buffer space and some management variables. A 1955 ;; A 1956 0000E000 A 1957 org 00:E000h 0000E000 A 1958 EP_2_Buffer: ds 10h A 1959 0000E800 A 1960 org 00:E800h 0000E800 A 1961 _EP2RxPtr: ds 2 0000E802 A 1962 _EP2TxPtr: ds 2 0000E804 A 1963 _EP2DataCount: ds 2 A 1964 A 1965 ;; A 1966 ;; Data block for EP3. Contains buffer space and some management variables. A 1967 ;; A 1968 0000F000 A 1969 org 00:F000h 0000F000 A 1970 EP_3_Buffer: ds 10h A 1971 0000F800 A 1972 org 00:F800h 0000F800 A 1973 _EP3RxPtr: ds 2 0000F802 A 1974 _EP3TxPtr: ds 2 0000F804 A 1975 _EP3DataCount: ds 2 A 1976 A 1977 00009000 A 1978 org 00:9000h A 1979 00009000 A 1980 SETUP_VARS: 00009000 A 1981 SetupSeq: ds 1 00009001 A 1982 heart_pat: ds 1 00009002 A 1983 heart_bt0: ds 2 00009004 A 1984 heart_bt1: ds 2 00009006 A 1985 new_addr: ds 1 A 1986 00009100 A 1987 org 00:9100h A 1988 00009100 A 1989 COMMAND_BUFFER: 00009100 A 1990 ds 1 ; Byte Count 00009101 A 1991 StandardDeviceRequest: 00009101 A 1992 bmRequestType: ds 1 00009102 A 1993 bRequest: ds 1 00009103 A 1994 wValue: ds 2 00009105 A 1995 wIndex: ds 2 PLC 80251 Macro Assembler, Version 2.10 06-Jan-97 16:17:18 page: 50 PC Machine Code I Line File: c:\usb\930code\altxfa~1\altxface.asm 00009107 A 1996 wLength: ds 2 A 1997 A 1998 A 1999 ; define OUR_DATA_SEG, SPACE=data, ORG=00:A000h A 2000 ; segment OUR_DATA_SEG A 2001 0000A000 A 2002 org 00:A000h A 2003 A 2004 0000A000 A 2005 out_var_table: 0000A000 A 2006 out_cur_buf: ds 2 0000A002 A 2007 out_cnt: ds 2 A 2008 0000A004 A 2009 in_var_table: A 2010 0000A004 A 2011 in_rd_pntr: ds 1 0000A005 A 2012 in_bytes_left: ds 1 0000A006 A 2013 in_FIFO_size: ds 1 0000A007 A 2014 in_FIFO_empty: ds 1 A 2015 0000A008 A 2016 DATA_PENDING: ds 1 0000A009 A 2017 PENDING_START_TIME: ds 2 0000A00B A 2018 DIRECTION_ERROR_COUNT: ds 1 A 2019 A 2020 0000B000 A 2021 org 00:B000h ; A 2022 0000B000 A 2023 IN_BUFFERS: A 2024 0000C000 A 2025 org 00:C000h ; A 2026 0000C000 A 2027 OUT_BUFFERS: A 2028 A 2029 A 2030 END Errors: 0 Warnings: 0 Lines Assembled: 2584