1 ;-------------------------------------------------------- 2 ; File Created by SDCC : free open source ANSI-C Compiler 3 ; Version 4.2.0 #13081 (Linux) 4 ;-------------------------------------------------------- 5 .module i2c 6 .optsdcc -mmcs51 --model-small 7 8 ;-------------------------------------------------------- 9 ; Public variables in this module 10 ;-------------------------------------------------------- 11 .globl _i2c_write_PARM_3 12 .globl _i2c_write_PARM_2 13 .globl _i2c_read_PARM_3 14 .globl _i2c_read_PARM_2 15 .globl _EIPX6 16 .globl _EIPX5 17 .globl _EIPX4 18 .globl _PI2C 19 .globl _PUSB 20 .globl _EIEX6 21 .globl _EIEX5 22 .globl _EIEX4 23 .globl _EI2C 24 .globl _EIUSB 25 .globl _SMOD1 26 .globl _ERESI 27 .globl _RESI 28 .globl _INT6 29 .globl _CY 30 .globl _AC 31 .globl _F0 32 .globl _RS1 33 .globl _RS0 34 .globl _OV 35 .globl _FL 36 .globl _P 37 .globl _TF2 38 .globl _EXF2 39 .globl _RCLK 40 .globl _TCLK 41 .globl _EXEN2 42 .globl _TR2 43 .globl _C_T2 44 .globl _CP_RL2 45 .globl _SM01 46 .globl _SM11 47 .globl _SM21 48 .globl _REN1 49 .globl _TB81 50 .globl _RB81 51 .globl _TI1 52 .globl _RI1 53 .globl _PS1 54 .globl _PT2 55 .globl _PS0 56 .globl _PT1 57 .globl _PX1 58 .globl _PT0 59 .globl _PX0 60 .globl _EA 61 .globl _ES1 62 .globl _ET2 63 .globl _ES0 64 .globl _ET1 65 .globl _EX1 66 .globl _ET0 67 .globl _EX0 68 .globl _SM0 69 .globl _SM1 70 .globl _SM2 71 .globl _REN 72 .globl _TB8 73 .globl _RB8 74 .globl _TI 75 .globl _RI 76 .globl _TF1 77 .globl _TR1 78 .globl _TF0 79 .globl _TR0 80 .globl _IE1 81 .globl _IT1 82 .globl _IE0 83 .globl _IT0 84 .globl _SEL 85 .globl _EIP 86 .globl _B 87 .globl _EIE 88 .globl _ACC 89 .globl _EICON 90 .globl _PSW 91 .globl _TH2 92 .globl _TL2 93 .globl _RCAP2H 94 .globl _RCAP2L 95 .globl _T2CON 96 .globl _SBUF1 97 .globl _SCON1 98 .globl _GPIFSGLDATLNOX 99 .globl _GPIFSGLDATLX 100 .globl _GPIFSGLDATH 101 .globl _GPIFTRIG 102 .globl _EP01STAT 103 .globl _IP 104 .globl _OEE 105 .globl _OED 106 .globl _OEC 107 .globl _OEB 108 .globl _OEA 109 .globl _IOE 110 .globl _IOD 111 .globl _AUTOPTRSETUP 112 .globl _EP68FIFOFLGS 113 .globl _EP24FIFOFLGS 114 .globl _EP2468STAT 115 .globl _IE 116 .globl _INT4CLR 117 .globl _INT2CLR 118 .globl _IOC 119 .globl _AUTODAT2 120 .globl _AUTOPTRL2 121 .globl _AUTOPTRH2 122 .globl _AUTODAT1 123 .globl _APTR1L 124 .globl _APTR1H 125 .globl _SBUF0 126 .globl _SCON0 127 .globl _MPAGE 128 .globl _EXIF 129 .globl _IOB 130 .globl _CKCON 131 .globl _TH1 132 .globl _TH0 133 .globl _TL1 134 .globl _TL0 135 .globl _TMOD 136 .globl _TCON 137 .globl _PCON 138 .globl _DPS 139 .globl _DPH1 140 .globl _DPL1 141 .globl _DPH 142 .globl _DPL 143 .globl _SP 144 .globl _IOA 145 .globl _EP8FIFOBUF 146 .globl _EP6FIFOBUF 147 .globl _EP4FIFOBUF 148 .globl _EP2FIFOBUF 149 .globl _EP1INBUF 150 .globl _EP1OUTBUF 151 .globl _EP0BUF 152 .globl _CT4 153 .globl _CT3 154 .globl _CT2 155 .globl _CT1 156 .globl _USBTEST 157 .globl _TESTCFG 158 .globl _DBUG 159 .globl _UDMACRCQUAL 160 .globl _UDMACRCL 161 .globl _UDMACRCH 162 .globl _GPIFHOLDAMOUNT 163 .globl _FLOWSTBHPERIOD 164 .globl _FLOWSTBEDGE 165 .globl _FLOWSTB 166 .globl _FLOWHOLDOFF 167 .globl _FLOWEQ1CTL 168 .globl _FLOWEQ0CTL 169 .globl _FLOWLOGIC 170 .globl _FLOWSTATE 171 .globl _GPIFABORT 172 .globl _GPIFREADYSTAT 173 .globl _GPIFREADYCFG 174 .globl _XGPIFSGLDATLNOX 175 .globl _XGPIFSGLDATLX 176 .globl _XGPIFSGLDATH 177 .globl _EP8GPIFTRIG 178 .globl _EP8GPIFPFSTOP 179 .globl _EP8GPIFFLGSEL 180 .globl _EP6GPIFTRIG 181 .globl _EP6GPIFPFSTOP 182 .globl _EP6GPIFFLGSEL 183 .globl _EP4GPIFTRIG 184 .globl _EP4GPIFPFSTOP 185 .globl _EP4GPIFFLGSEL 186 .globl _EP2GPIFTRIG 187 .globl _EP2GPIFPFSTOP 188 .globl _EP2GPIFFLGSEL 189 .globl _GPIFTCB0 190 .globl _GPIFTCB1 191 .globl _GPIFTCB2 192 .globl _GPIFTCB3 193 .globl _GPIFADRL 194 .globl _GPIFADRH 195 .globl _GPIFCTLCFG 196 .globl _GPIFIDLECTL 197 .globl _GPIFIDLECS 198 .globl _GPIFWFSELECT 199 .globl _SETUPDAT 200 .globl _SUDPTRCTL 201 .globl _SUDPTRL 202 .globl _SUDPTRH 203 .globl _EP8FIFOBCL 204 .globl _EP8FIFOBCH 205 .globl _EP6FIFOBCL 206 .globl _EP6FIFOBCH 207 .globl _EP4FIFOBCL 208 .globl _EP4FIFOBCH 209 .globl _EP2FIFOBCL 210 .globl _EP2FIFOBCH 211 .globl _EP8FIFOFLGS 212 .globl _EP6FIFOFLGS 213 .globl _EP4FIFOFLGS 214 .globl _EP2FIFOFLGS 215 .globl _EP8CS 216 .globl _EP6CS 217 .globl _EP4CS 218 .globl _EP2CS 219 .globl _EP1INCS 220 .globl _EP1OUTCS 221 .globl _EP0CS 222 .globl _EP8BCL 223 .globl _EP8BCH 224 .globl _EP6BCL 225 .globl _EP6BCH 226 .globl _EP4BCL 227 .globl _EP4BCH 228 .globl _EP2BCL 229 .globl _EP2BCH 230 .globl _EP1INBC 231 .globl _EP1OUTBC 232 .globl _EP0BCL 233 .globl _EP0BCH 234 .globl _FNADDR 235 .globl _MICROFRAME 236 .globl _USBFRAMEL 237 .globl _USBFRAMEH 238 .globl _TOGCTL 239 .globl _WAKEUPCS 240 .globl _SUSPEND 241 .globl _USBCS 242 .globl _XAUTODAT2 243 .globl _XAUTODAT1 244 .globl _I2CTL 245 .globl _I2DAT 246 .globl _I2CS 247 .globl _PORTECFG 248 .globl _PORTCCFG 249 .globl _PORTACFG 250 .globl _INTSETUP 251 .globl _INT4IVEC 252 .globl _INT2IVEC 253 .globl _CLRERRCNT 254 .globl _ERRCNTLIM 255 .globl _USBERRIRQ 256 .globl _USBERRIE 257 .globl _GPIFIRQ 258 .globl _GPIFIE 259 .globl _EPIRQ 260 .globl _EPIE 261 .globl _USBIRQ 262 .globl _USBIE 263 .globl _NAKIRQ 264 .globl _NAKIE 265 .globl _IBNIRQ 266 .globl _IBNIE 267 .globl _EP8FIFOIRQ 268 .globl _EP8FIFOIE 269 .globl _EP6FIFOIRQ 270 .globl _EP6FIFOIE 271 .globl _EP4FIFOIRQ 272 .globl _EP4FIFOIE 273 .globl _EP2FIFOIRQ 274 .globl _EP2FIFOIE 275 .globl _OUTPKTEND 276 .globl _INPKTEND 277 .globl _EP8ISOINPKTS 278 .globl _EP6ISOINPKTS 279 .globl _EP4ISOINPKTS 280 .globl _EP2ISOINPKTS 281 .globl _EP8FIFOPFL 282 .globl _EP8FIFOPFH 283 .globl _EP6FIFOPFL 284 .globl _EP6FIFOPFH 285 .globl _EP4FIFOPFL 286 .globl _EP4FIFOPFH 287 .globl _EP2FIFOPFL 288 .globl _EP2FIFOPFH 289 .globl _EP8AUTOINLENL 290 .globl _EP8AUTOINLENH 291 .globl _EP6AUTOINLENL 292 .globl _EP6AUTOINLENH 293 .globl _EP4AUTOINLENL 294 .globl _EP4AUTOINLENH 295 .globl _EP2AUTOINLENL 296 .globl _EP2AUTOINLENH 297 .globl _EP8FIFOCFG 298 .globl _EP6FIFOCFG 299 .globl _EP4FIFOCFG 300 .globl _EP2FIFOCFG 301 .globl _EP8CFG 302 .globl _EP6CFG 303 .globl _EP4CFG 304 .globl _EP2CFG 305 .globl _EP1INCFG 306 .globl _EP1OUTCFG 307 .globl _REVCTL 308 .globl _REVID 309 .globl _FIFOPINPOLAR 310 .globl _UART230 311 .globl _BPADDRL 312 .globl _BPADDRH 313 .globl _BREAKPT 314 .globl _FIFORESET 315 .globl _PINFLAGSCD 316 .globl _PINFLAGSAB 317 .globl _IFCONFIG 318 .globl _CPUCS 319 .globl _RES_WAVEDATA_END 320 .globl _GPIF_WAVE_DATA 321 .globl _i2c_read 322 .globl _i2c_write 323 ;-------------------------------------------------------- 324 ; special function registers 325 ;-------------------------------------------------------- 326 .area RSEG (ABS,DATA) 000000 327 .org 0x0000 000080 328 _IOA = 0x0080 000081 329 _SP = 0x0081 000082 330 _DPL = 0x0082 000083 331 _DPH = 0x0083 000084 332 _DPL1 = 0x0084 000085 333 _DPH1 = 0x0085 000086 334 _DPS = 0x0086 000087 335 _PCON = 0x0087 000088 336 _TCON = 0x0088 000089 337 _TMOD = 0x0089 00008A 338 _TL0 = 0x008a 00008B 339 _TL1 = 0x008b 00008C 340 _TH0 = 0x008c 00008D 341 _TH1 = 0x008d 00008E 342 _CKCON = 0x008e 000090 343 _IOB = 0x0090 000091 344 _EXIF = 0x0091 000092 345 _MPAGE = 0x0092 000098 346 _SCON0 = 0x0098 000099 347 _SBUF0 = 0x0099 00009A 348 _APTR1H = 0x009a 00009B 349 _APTR1L = 0x009b 00009C 350 _AUTODAT1 = 0x009c 00009D 351 _AUTOPTRH2 = 0x009d 00009E 352 _AUTOPTRL2 = 0x009e 00009F 353 _AUTODAT2 = 0x009f 0000A0 354 _IOC = 0x00a0 0000A1 355 _INT2CLR = 0x00a1 0000A2 356 _INT4CLR = 0x00a2 0000A8 357 _IE = 0x00a8 0000AA 358 _EP2468STAT = 0x00aa 0000AB 359 _EP24FIFOFLGS = 0x00ab 0000AC 360 _EP68FIFOFLGS = 0x00ac 0000AF 361 _AUTOPTRSETUP = 0x00af 0000B0 362 _IOD = 0x00b0 0000B1 363 _IOE = 0x00b1 0000B2 364 _OEA = 0x00b2 0000B3 365 _OEB = 0x00b3 0000B4 366 _OEC = 0x00b4 0000B5 367 _OED = 0x00b5 0000B6 368 _OEE = 0x00b6 0000B8 369 _IP = 0x00b8 0000BA 370 _EP01STAT = 0x00ba 0000BB 371 _GPIFTRIG = 0x00bb 0000BD 372 _GPIFSGLDATH = 0x00bd 0000BE 373 _GPIFSGLDATLX = 0x00be 0000BF 374 _GPIFSGLDATLNOX = 0x00bf 0000C0 375 _SCON1 = 0x00c0 0000C1 376 _SBUF1 = 0x00c1 0000C8 377 _T2CON = 0x00c8 0000CA 378 _RCAP2L = 0x00ca 0000CB 379 _RCAP2H = 0x00cb 0000CC 380 _TL2 = 0x00cc 0000CD 381 _TH2 = 0x00cd 0000D0 382 _PSW = 0x00d0 0000D8 383 _EICON = 0x00d8 0000E0 384 _ACC = 0x00e0 0000E8 385 _EIE = 0x00e8 0000F0 386 _B = 0x00f0 0000F8 387 _EIP = 0x00f8 388 ;-------------------------------------------------------- 389 ; special function bits 390 ;-------------------------------------------------------- 391 .area RSEG (ABS,DATA) 000000 392 .org 0x0000 000086 393 _SEL = 0x0086 000088 394 _IT0 = 0x0088 000089 395 _IE0 = 0x0089 00008A 396 _IT1 = 0x008a 00008B 397 _IE1 = 0x008b 00008C 398 _TR0 = 0x008c 00008D 399 _TF0 = 0x008d 00008E 400 _TR1 = 0x008e 00008F 401 _TF1 = 0x008f 000098 402 _RI = 0x0098 000099 403 _TI = 0x0099 00009A 404 _RB8 = 0x009a 00009B 405 _TB8 = 0x009b 00009C 406 _REN = 0x009c 00009D 407 _SM2 = 0x009d 00009E 408 _SM1 = 0x009e 00009F 409 _SM0 = 0x009f 0000A8 410 _EX0 = 0x00a8 0000A9 411 _ET0 = 0x00a9 0000AA 412 _EX1 = 0x00aa 0000AB 413 _ET1 = 0x00ab 0000AC 414 _ES0 = 0x00ac 0000AD 415 _ET2 = 0x00ad 0000AE 416 _ES1 = 0x00ae 0000AF 417 _EA = 0x00af 0000B8 418 _PX0 = 0x00b8 0000B9 419 _PT0 = 0x00b9 0000BA 420 _PX1 = 0x00ba 0000BB 421 _PT1 = 0x00bb 0000BC 422 _PS0 = 0x00bc 0000BD 423 _PT2 = 0x00bd 0000BE 424 _PS1 = 0x00be 0000C0 425 _RI1 = 0x00c0 0000C1 426 _TI1 = 0x00c1 0000C2 427 _RB81 = 0x00c2 0000C3 428 _TB81 = 0x00c3 0000C4 429 _REN1 = 0x00c4 0000C5 430 _SM21 = 0x00c5 0000C6 431 _SM11 = 0x00c6 0000C7 432 _SM01 = 0x00c7 0000C8 433 _CP_RL2 = 0x00c8 0000C9 434 _C_T2 = 0x00c9 0000CA 435 _TR2 = 0x00ca 0000CB 436 _EXEN2 = 0x00cb 0000CC 437 _TCLK = 0x00cc 0000CD 438 _RCLK = 0x00cd 0000CE 439 _EXF2 = 0x00ce 0000CF 440 _TF2 = 0x00cf 0000D0 441 _P = 0x00d0 0000D1 442 _FL = 0x00d1 0000D2 443 _OV = 0x00d2 0000D3 444 _RS0 = 0x00d3 0000D4 445 _RS1 = 0x00d4 0000D5 446 _F0 = 0x00d5 0000D6 447 _AC = 0x00d6 0000D7 448 _CY = 0x00d7 0000DB 449 _INT6 = 0x00db 0000DC 450 _RESI = 0x00dc 0000DD 451 _ERESI = 0x00dd 0000DF 452 _SMOD1 = 0x00df 0000E8 453 _EIUSB = 0x00e8 0000E9 454 _EI2C = 0x00e9 0000EA 455 _EIEX4 = 0x00ea 0000EB 456 _EIEX5 = 0x00eb 0000EC 457 _EIEX6 = 0x00ec 0000F8 458 _PUSB = 0x00f8 0000F9 459 _PI2C = 0x00f9 0000FA 460 _EIPX4 = 0x00fa 0000FB 461 _EIPX5 = 0x00fb 0000FC 462 _EIPX6 = 0x00fc 463 ;-------------------------------------------------------- 464 ; overlayable register banks 465 ;-------------------------------------------------------- 466 .area REG_BANK_0 (REL,OVR,DATA) 000000 467 .ds 8 468 ;-------------------------------------------------------- 469 ; internal ram data 470 ;-------------------------------------------------------- 471 .area DSEG (DATA) 472 ;-------------------------------------------------------- 473 ; overlayable items in internal ram 474 ;-------------------------------------------------------- 475 .area OSEG (OVR,DATA) 000000 476 _i2c_read_PARM_2: 000000 477 .ds 2 000002 478 _i2c_read_PARM_3: 000002 479 .ds 1 000003 480 _i2c_read_junk_65536_29: 000003 481 .ds 1 482 .area OSEG (OVR,DATA) 000000 483 _i2c_write_PARM_2: 000000 484 .ds 2 000002 485 _i2c_write_PARM_3: 000002 486 .ds 1 487 ;-------------------------------------------------------- 488 ; indirectly addressable internal ram data 489 ;-------------------------------------------------------- 490 .area ISEG (DATA) 491 ;-------------------------------------------------------- 492 ; absolute internal ram data 493 ;-------------------------------------------------------- 494 .area IABS (ABS,DATA) 495 .area IABS (ABS,DATA) 496 ;-------------------------------------------------------- 497 ; bit data 498 ;-------------------------------------------------------- 499 .area BSEG (BIT) 500 ;-------------------------------------------------------- 501 ; paged external ram data 502 ;-------------------------------------------------------- 503 .area PSEG (PAG,XDATA) 504 ;-------------------------------------------------------- 505 ; external ram data 506 ;-------------------------------------------------------- 507 .area XSEG (XDATA) 00E400 508 _GPIF_WAVE_DATA = 0xe400 00E480 509 _RES_WAVEDATA_END = 0xe480 00E600 510 _CPUCS = 0xe600 00E601 511 _IFCONFIG = 0xe601 00E602 512 _PINFLAGSAB = 0xe602 00E603 513 _PINFLAGSCD = 0xe603 00E604 514 _FIFORESET = 0xe604 00E605 515 _BREAKPT = 0xe605 00E606 516 _BPADDRH = 0xe606 00E607 517 _BPADDRL = 0xe607 00E608 518 _UART230 = 0xe608 00E609 519 _FIFOPINPOLAR = 0xe609 00E60A 520 _REVID = 0xe60a 00E60B 521 _REVCTL = 0xe60b 00E610 522 _EP1OUTCFG = 0xe610 00E611 523 _EP1INCFG = 0xe611 00E612 524 _EP2CFG = 0xe612 00E613 525 _EP4CFG = 0xe613 00E614 526 _EP6CFG = 0xe614 00E615 527 _EP8CFG = 0xe615 00E618 528 _EP2FIFOCFG = 0xe618 00E619 529 _EP4FIFOCFG = 0xe619 00E61A 530 _EP6FIFOCFG = 0xe61a 00E61B 531 _EP8FIFOCFG = 0xe61b 00E620 532 _EP2AUTOINLENH = 0xe620 00E621 533 _EP2AUTOINLENL = 0xe621 00E622 534 _EP4AUTOINLENH = 0xe622 00E623 535 _EP4AUTOINLENL = 0xe623 00E624 536 _EP6AUTOINLENH = 0xe624 00E625 537 _EP6AUTOINLENL = 0xe625 00E626 538 _EP8AUTOINLENH = 0xe626 00E627 539 _EP8AUTOINLENL = 0xe627 00E630 540 _EP2FIFOPFH = 0xe630 00E631 541 _EP2FIFOPFL = 0xe631 00E632 542 _EP4FIFOPFH = 0xe632 00E633 543 _EP4FIFOPFL = 0xe633 00E634 544 _EP6FIFOPFH = 0xe634 00E635 545 _EP6FIFOPFL = 0xe635 00E636 546 _EP8FIFOPFH = 0xe636 00E637 547 _EP8FIFOPFL = 0xe637 00E640 548 _EP2ISOINPKTS = 0xe640 00E641 549 _EP4ISOINPKTS = 0xe641 00E642 550 _EP6ISOINPKTS = 0xe642 00E643 551 _EP8ISOINPKTS = 0xe643 00E648 552 _INPKTEND = 0xe648 00E649 553 _OUTPKTEND = 0xe649 00E650 554 _EP2FIFOIE = 0xe650 00E651 555 _EP2FIFOIRQ = 0xe651 00E652 556 _EP4FIFOIE = 0xe652 00E653 557 _EP4FIFOIRQ = 0xe653 00E654 558 _EP6FIFOIE = 0xe654 00E655 559 _EP6FIFOIRQ = 0xe655 00E656 560 _EP8FIFOIE = 0xe656 00E657 561 _EP8FIFOIRQ = 0xe657 00E658 562 _IBNIE = 0xe658 00E659 563 _IBNIRQ = 0xe659 00E65A 564 _NAKIE = 0xe65a 00E65B 565 _NAKIRQ = 0xe65b 00E65C 566 _USBIE = 0xe65c 00E65D 567 _USBIRQ = 0xe65d 00E65E 568 _EPIE = 0xe65e 00E65F 569 _EPIRQ = 0xe65f 00E660 570 _GPIFIE = 0xe660 00E661 571 _GPIFIRQ = 0xe661 00E662 572 _USBERRIE = 0xe662 00E663 573 _USBERRIRQ = 0xe663 00E664 574 _ERRCNTLIM = 0xe664 00E665 575 _CLRERRCNT = 0xe665 00E666 576 _INT2IVEC = 0xe666 00E667 577 _INT4IVEC = 0xe667 00E668 578 _INTSETUP = 0xe668 00E670 579 _PORTACFG = 0xe670 00E671 580 _PORTCCFG = 0xe671 00E672 581 _PORTECFG = 0xe672 00E678 582 _I2CS = 0xe678 00E679 583 _I2DAT = 0xe679 00E67A 584 _I2CTL = 0xe67a 00E67B 585 _XAUTODAT1 = 0xe67b 00E67C 586 _XAUTODAT2 = 0xe67c 00E680 587 _USBCS = 0xe680 00E681 588 _SUSPEND = 0xe681 00E682 589 _WAKEUPCS = 0xe682 00E683 590 _TOGCTL = 0xe683 00E684 591 _USBFRAMEH = 0xe684 00E685 592 _USBFRAMEL = 0xe685 00E686 593 _MICROFRAME = 0xe686 00E687 594 _FNADDR = 0xe687 00E68A 595 _EP0BCH = 0xe68a 00E68B 596 _EP0BCL = 0xe68b 00E68D 597 _EP1OUTBC = 0xe68d 00E68F 598 _EP1INBC = 0xe68f 00E690 599 _EP2BCH = 0xe690 00E691 600 _EP2BCL = 0xe691 00E694 601 _EP4BCH = 0xe694 00E695 602 _EP4BCL = 0xe695 00E698 603 _EP6BCH = 0xe698 00E699 604 _EP6BCL = 0xe699 00E69C 605 _EP8BCH = 0xe69c 00E69D 606 _EP8BCL = 0xe69d 00E6A0 607 _EP0CS = 0xe6a0 00E6A1 608 _EP1OUTCS = 0xe6a1 00E6A2 609 _EP1INCS = 0xe6a2 00E6A3 610 _EP2CS = 0xe6a3 00E6A4 611 _EP4CS = 0xe6a4 00E6A5 612 _EP6CS = 0xe6a5 00E6A6 613 _EP8CS = 0xe6a6 00E6A7 614 _EP2FIFOFLGS = 0xe6a7 00E6A8 615 _EP4FIFOFLGS = 0xe6a8 00E6A9 616 _EP6FIFOFLGS = 0xe6a9 00E6AA 617 _EP8FIFOFLGS = 0xe6aa 00E6AB 618 _EP2FIFOBCH = 0xe6ab 00E6AC 619 _EP2FIFOBCL = 0xe6ac 00E6AD 620 _EP4FIFOBCH = 0xe6ad 00E6AE 621 _EP4FIFOBCL = 0xe6ae 00E6AF 622 _EP6FIFOBCH = 0xe6af 00E6B0 623 _EP6FIFOBCL = 0xe6b0 00E6B1 624 _EP8FIFOBCH = 0xe6b1 00E6B2 625 _EP8FIFOBCL = 0xe6b2 00E6B3 626 _SUDPTRH = 0xe6b3 00E6B4 627 _SUDPTRL = 0xe6b4 00E6B5 628 _SUDPTRCTL = 0xe6b5 00E6B8 629 _SETUPDAT = 0xe6b8 00E6C0 630 _GPIFWFSELECT = 0xe6c0 00E6C1 631 _GPIFIDLECS = 0xe6c1 00E6C2 632 _GPIFIDLECTL = 0xe6c2 00E6C3 633 _GPIFCTLCFG = 0xe6c3 00E6C4 634 _GPIFADRH = 0xe6c4 00E6C5 635 _GPIFADRL = 0xe6c5 00E6CE 636 _GPIFTCB3 = 0xe6ce 00E6CF 637 _GPIFTCB2 = 0xe6cf 00E6D0 638 _GPIFTCB1 = 0xe6d0 00E6D1 639 _GPIFTCB0 = 0xe6d1 00E6D2 640 _EP2GPIFFLGSEL = 0xe6d2 00E6D3 641 _EP2GPIFPFSTOP = 0xe6d3 00E6D4 642 _EP2GPIFTRIG = 0xe6d4 00E6DA 643 _EP4GPIFFLGSEL = 0xe6da 00E6DB 644 _EP4GPIFPFSTOP = 0xe6db 00E6DC 645 _EP4GPIFTRIG = 0xe6dc 00E6E2 646 _EP6GPIFFLGSEL = 0xe6e2 00E6E3 647 _EP6GPIFPFSTOP = 0xe6e3 00E6E4 648 _EP6GPIFTRIG = 0xe6e4 00E6EA 649 _EP8GPIFFLGSEL = 0xe6ea 00E6EB 650 _EP8GPIFPFSTOP = 0xe6eb 00E6EC 651 _EP8GPIFTRIG = 0xe6ec 00E6F0 652 _XGPIFSGLDATH = 0xe6f0 00E6F1 653 _XGPIFSGLDATLX = 0xe6f1 00E6F2 654 _XGPIFSGLDATLNOX = 0xe6f2 00E6F3 655 _GPIFREADYCFG = 0xe6f3 00E6F4 656 _GPIFREADYSTAT = 0xe6f4 00E6F5 657 _GPIFABORT = 0xe6f5 00E6C6 658 _FLOWSTATE = 0xe6c6 00E6C7 659 _FLOWLOGIC = 0xe6c7 00E6C8 660 _FLOWEQ0CTL = 0xe6c8 00E6C9 661 _FLOWEQ1CTL = 0xe6c9 00E6CA 662 _FLOWHOLDOFF = 0xe6ca 00E6CB 663 _FLOWSTB = 0xe6cb 00E6CC 664 _FLOWSTBEDGE = 0xe6cc 00E6CD 665 _FLOWSTBHPERIOD = 0xe6cd 00E60C 666 _GPIFHOLDAMOUNT = 0xe60c 00E67D 667 _UDMACRCH = 0xe67d 00E67E 668 _UDMACRCL = 0xe67e 00E67F 669 _UDMACRCQUAL = 0xe67f 00E6F8 670 _DBUG = 0xe6f8 00E6F9 671 _TESTCFG = 0xe6f9 00E6FA 672 _USBTEST = 0xe6fa 00E6FB 673 _CT1 = 0xe6fb 00E6FC 674 _CT2 = 0xe6fc 00E6FD 675 _CT3 = 0xe6fd 00E6FE 676 _CT4 = 0xe6fe 00E740 677 _EP0BUF = 0xe740 00E780 678 _EP1OUTBUF = 0xe780 00E7C0 679 _EP1INBUF = 0xe7c0 00F000 680 _EP2FIFOBUF = 0xf000 00F400 681 _EP4FIFOBUF = 0xf400 00F800 682 _EP6FIFOBUF = 0xf800 00FC00 683 _EP8FIFOBUF = 0xfc00 684 ;-------------------------------------------------------- 685 ; absolute external ram data 686 ;-------------------------------------------------------- 687 .area XABS (ABS,XDATA) 688 ;-------------------------------------------------------- 689 ; external initialized ram data 690 ;-------------------------------------------------------- 691 .area HOME (CODE) 692 .area GSINIT0 (CODE) 693 .area GSINIT1 (CODE) 694 .area GSINIT2 (CODE) 695 .area GSINIT3 (CODE) 696 .area GSINIT4 (CODE) 697 .area GSINIT5 (CODE) 698 .area GSINIT (CODE) 699 .area GSFINAL (CODE) 700 .area CSEG (CODE) 701 ;-------------------------------------------------------- 702 ; global & static initialisations 703 ;-------------------------------------------------------- 704 .area HOME (CODE) 705 .area GSINIT (CODE) 706 .area GSFINAL (CODE) 707 .area GSINIT (CODE) 708 ;-------------------------------------------------------- 709 ; Home 710 ;-------------------------------------------------------- 711 .area HOME (CODE) 712 .area HOME (CODE) 713 ;-------------------------------------------------------- 714 ; code 715 ;-------------------------------------------------------- 716 .area CSEG (CODE) 717 ;------------------------------------------------------------ 718 ;Allocation info for local variables in function 'i2c_read' 719 ;------------------------------------------------------------ 720 ;buf Allocated with name '_i2c_read_PARM_2' 721 ;len Allocated with name '_i2c_read_PARM_3' 722 ;addr Allocated to registers r7 723 ;junk Allocated with name '_i2c_read_junk_65536_29' 724 ;------------------------------------------------------------ 725 ; i2c.c:33: i2c_read (unsigned char addr, __xdata unsigned char *buf, unsigned char len) 726 ; ----------------------------------------- 727 ; function i2c_read 728 ; ----------------------------------------- 000000 729 _i2c_read: 000007 730 ar7 = 0x07 000006 731 ar6 = 0x06 000005 732 ar5 = 0x05 000004 733 ar4 = 0x04 000003 734 ar3 = 0x03 000002 735 ar2 = 0x02 000001 736 ar1 = 0x01 000000 737 ar0 = 0x00 000000 AF 82 [24] 738 mov r7,dpl 739 ; i2c.c:37: if (len == 0) // reading zero bytes always works 000002 E5*02 [12] 740 mov a,_i2c_read_PARM_3 000004 70 04 [24] 741 jnz 00103$ 742 ; i2c.c:38: return 1; 000006 75 82 01 [24] 743 mov dpl,#0x01 000009 22 [24] 744 ret 745 ; i2c.c:40: while (I2CS & bmSTOP) // wait for stop to clear 00000A 746 00103$: 00000A 90 E6 78 [24] 747 mov dptr,#_I2CS 00000D E0 [24] 748 movx a,@dptr 00000E 20 E6 F9 [24] 749 jb acc.6,00103$ 750 ; i2c.c:43: I2CS = bmSTART; 000011 90 E6 78 [24] 751 mov dptr,#_I2CS 000014 74 80 [12] 752 mov a,#0x80 000016 F0 [24] 753 movx @dptr,a 754 ; i2c.c:44: I2DAT = (addr << 1) | 1; // write address and direction (1's the read bit) 000017 EF [12] 755 mov a,r7 000018 2F [12] 756 add a,r7 000019 FF [12] 757 mov r7,a 00001A 90 E6 79 [24] 758 mov dptr,#_I2DAT 00001D 74 01 [12] 759 mov a,#0x01 00001F 4F [12] 760 orl a,r7 000020 F0 [24] 761 movx @dptr,a 762 ; i2c.c:46: while ((I2CS & bmDONE) == 0) 000021 763 00106$: 000021 90 E6 78 [24] 764 mov dptr,#_I2CS 000024 E0 [24] 765 movx a,@dptr 000025 30 E0 F9 [24] 766 jnb acc.0,00106$ 767 ; i2c.c:49: if ((I2CS & bmBERR) || (I2CS & bmACK) == 0) // no device answered... 000028 90 E6 78 [24] 768 mov dptr,#_I2CS 00002B E0 [24] 769 movx a,@dptr 00002C 30 E2 03 [24] 770 jnb acc.2,00199$ 00002F 02r00rAE [24] 771 ljmp 00129$ 000032 772 00199$: 000032 90 E6 78 [24] 773 mov dptr,#_I2CS 000035 E0 [24] 774 movx a,@dptr 000036 20 E1 03 [24] 775 jb acc.1,00200$ 000039 02r00rAE [24] 776 ljmp 00129$ 00003C 777 00200$: 778 ; i2c.c:52: if (len == 1) 00003C 74 01 [12] 779 mov a,#0x01 00003E B5*02 08 [24] 780 cjne a,_i2c_read_PARM_3,00113$ 781 ; i2c.c:53: I2CS |= bmLASTRD; 000041 90 E6 78 [24] 782 mov dptr,#_I2CS 000044 E0 [24] 783 movx a,@dptr 000045 43 E0 20 [24] 784 orl acc,#0x20 000048 F0 [24] 785 movx @dptr,a 000049 786 00113$: 787 ; i2c.c:55: junk = I2DAT; // trigger the first read cycle 000049 90 E6 79 [24] 788 mov dptr,#_I2DAT 00004C E0 [24] 789 movx a,@dptr 00004D F5*03 [12] 790 mov _i2c_read_junk_65536_29,a 791 ; i2c.c:57: while (--len != 0){ 00004F AE*00 [24] 792 mov r6,_i2c_read_PARM_2 000051 AF*01 [24] 793 mov r7,(_i2c_read_PARM_2 + 1) 000053 AD*02 [24] 794 mov r5,_i2c_read_PARM_3 000055 795 00121$: 000055 1D [12] 796 dec r5 000056 ED [12] 797 mov a,r5 000057 60 2E [24] 798 jz 00124$ 799 ; i2c.c:58: while ((I2CS & bmDONE) == 0) 000059 800 00114$: 000059 90 E6 78 [24] 801 mov dptr,#_I2CS 00005C E0 [24] 802 movx a,@dptr 00005D 30 E0 F9 [24] 803 jnb acc.0,00114$ 804 ; i2c.c:61: if (I2CS & bmBERR) 000060 90 E6 78 [24] 805 mov dptr,#_I2CS 000063 E0 [24] 806 movx a,@dptr 000064 20 E2 47 [24] 807 jb acc.2,00129$ 808 ; i2c.c:64: if (len == 1) 000067 BD 01 08 [24] 809 cjne r5,#0x01,00120$ 810 ; i2c.c:65: I2CS |= bmLASTRD; 00006A 90 E6 78 [24] 811 mov dptr,#_I2CS 00006D E0 [24] 812 movx a,@dptr 00006E 43 E0 20 [24] 813 orl acc,#0x20 000071 F0 [24] 814 movx @dptr,a 000072 815 00120$: 816 ; i2c.c:67: *buf++ = I2DAT; // get data, trigger another read 000072 90 E6 79 [24] 817 mov dptr,#_I2DAT 000075 E0 [24] 818 movx a,@dptr 000076 FC [12] 819 mov r4,a 000077 8E 82 [24] 820 mov dpl,r6 000079 8F 83 [24] 821 mov dph,r7 00007B F0 [24] 822 movx @dptr,a 00007C A3 [24] 823 inc dptr 00007D AE 82 [24] 824 mov r6,dpl 00007F AF 83 [24] 825 mov r7,dph 000081 8E*00 [24] 826 mov _i2c_read_PARM_2,r6 000083 8F*01 [24] 827 mov (_i2c_read_PARM_2 + 1),r7 828 ; i2c.c:72: while ((I2CS & bmDONE) == 0) 000085 80 CE [24] 829 sjmp 00121$ 000087 830 00124$: 000087 90 E6 78 [24] 831 mov dptr,#_I2CS 00008A E0 [24] 832 movx a,@dptr 00008B 30 E0 F9 [24] 833 jnb acc.0,00124$ 834 ; i2c.c:75: if (I2CS & bmBERR) 00008E 90 E6 78 [24] 835 mov dptr,#_I2CS 000091 E0 [24] 836 movx a,@dptr 000092 20 E2 19 [24] 837 jb acc.2,00129$ 838 ; i2c.c:78: I2CS |= bmSTOP; 000095 90 E6 78 [24] 839 mov dptr,#_I2CS 000098 E0 [24] 840 movx a,@dptr 000099 43 E0 40 [24] 841 orl acc,#0x40 00009C F0 [24] 842 movx @dptr,a 843 ; i2c.c:79: *buf = I2DAT; 00009D AE*00 [24] 844 mov r6,_i2c_read_PARM_2 00009F AF*01 [24] 845 mov r7,(_i2c_read_PARM_2 + 1) 0000A1 90 E6 79 [24] 846 mov dptr,#_I2DAT 0000A4 E0 [24] 847 movx a,@dptr 0000A5 8E 82 [24] 848 mov dpl,r6 0000A7 8F 83 [24] 849 mov dph,r7 0000A9 F0 [24] 850 movx @dptr,a 851 ; i2c.c:81: return 1; 0000AA 75 82 01 [24] 852 mov dpl,#0x01 853 ; i2c.c:83: fail: 0000AD 22 [24] 854 ret 0000AE 855 00129$: 856 ; i2c.c:84: I2CS |= bmSTOP; 0000AE 90 E6 78 [24] 857 mov dptr,#_I2CS 0000B1 E0 [24] 858 movx a,@dptr 0000B2 43 E0 40 [24] 859 orl acc,#0x40 0000B5 F0 [24] 860 movx @dptr,a 861 ; i2c.c:85: return 0; 0000B6 75 82 00 [24] 862 mov dpl,#0x00 863 ; i2c.c:86: } 0000B9 22 [24] 864 ret 865 ;------------------------------------------------------------ 866 ;Allocation info for local variables in function 'i2c_write' 867 ;------------------------------------------------------------ 868 ;buf Allocated with name '_i2c_write_PARM_2' 869 ;len Allocated with name '_i2c_write_PARM_3' 870 ;addr Allocated to registers r7 871 ;------------------------------------------------------------ 872 ; i2c.c:92: i2c_write (unsigned char addr, __xdata const unsigned char *buf, unsigned char len) 873 ; ----------------------------------------- 874 ; function i2c_write 875 ; ----------------------------------------- 0000BA 876 _i2c_write: 0000BA AF 82 [24] 877 mov r7,dpl 878 ; i2c.c:94: while (I2CS & bmSTOP) // wait for stop to clear 0000BC 879 00101$: 0000BC 90 E6 78 [24] 880 mov dptr,#_I2CS 0000BF E0 [24] 881 movx a,@dptr 0000C0 20 E6 F9 [24] 882 jb acc.6,00101$ 883 ; i2c.c:97: I2CS = bmSTART; 0000C3 90 E6 78 [24] 884 mov dptr,#_I2CS 0000C6 74 80 [12] 885 mov a,#0x80 0000C8 F0 [24] 886 movx @dptr,a 887 ; i2c.c:98: I2DAT = (addr << 1) | 0; // write address and direction (0's the write bit) 0000C9 EF [12] 888 mov a,r7 0000CA 2F [12] 889 add a,r7 0000CB FF [12] 890 mov r7,a 0000CC 90 E6 79 [24] 891 mov dptr,#_I2DAT 0000CF F0 [24] 892 movx @dptr,a 893 ; i2c.c:100: while ((I2CS & bmDONE) == 0) 0000D0 894 00104$: 0000D0 90 E6 78 [24] 895 mov dptr,#_I2CS 0000D3 E0 [24] 896 movx a,@dptr 0000D4 30 E0 F9 [24] 897 jnb acc.0,00104$ 898 ; i2c.c:103: if ((I2CS & bmBERR) || (I2CS & bmACK) == 0) // no device answered... 0000D7 90 E6 78 [24] 899 mov dptr,#_I2CS 0000DA E0 [24] 900 movx a,@dptr 0000DB 20 E2 44 [24] 901 jb acc.2,00119$ 0000DE 90 E6 78 [24] 902 mov dptr,#_I2CS 0000E1 E0 [24] 903 movx a,@dptr 0000E2 30 E1 3D [24] 904 jnb acc.1,00119$ 905 ; i2c.c:106: while (len > 0){ 0000E5 AE*00 [24] 906 mov r6,_i2c_write_PARM_2 0000E7 AF*01 [24] 907 mov r7,(_i2c_write_PARM_2 + 1) 0000E9 AD*02 [24] 908 mov r5,_i2c_write_PARM_3 0000EB 909 00116$: 0000EB ED [12] 910 mov a,r5 0000EC 60 28 [24] 911 jz 00118$ 912 ; i2c.c:107: I2DAT = *buf++; 0000EE 8E 82 [24] 913 mov dpl,r6 0000F0 8F 83 [24] 914 mov dph,r7 0000F2 E0 [24] 915 movx a,@dptr 0000F3 FC [12] 916 mov r4,a 0000F4 A3 [24] 917 inc dptr 0000F5 AE 82 [24] 918 mov r6,dpl 0000F7 AF 83 [24] 919 mov r7,dph 0000F9 90 E6 79 [24] 920 mov dptr,#_I2DAT 0000FC EC [12] 921 mov a,r4 0000FD F0 [24] 922 movx @dptr,a 923 ; i2c.c:108: len--; 0000FE 1D [12] 924 dec r5 925 ; i2c.c:110: while ((I2CS & bmDONE) == 0) 0000FF 926 00110$: 0000FF 90 E6 78 [24] 927 mov dptr,#_I2CS 000102 E0 [24] 928 movx a,@dptr 000103 30 E0 F9 [24] 929 jnb acc.0,00110$ 930 ; i2c.c:113: if ((I2CS & bmBERR) || (I2CS & bmACK) == 0) // no device answered... 000106 90 E6 78 [24] 931 mov dptr,#_I2CS 000109 E0 [24] 932 movx a,@dptr 00010A 20 E2 15 [24] 933 jb acc.2,00119$ 00010D 90 E6 78 [24] 934 mov dptr,#_I2CS 000110 E0 [24] 935 movx a,@dptr 000111 20 E1 D7 [24] 936 jb acc.1,00116$ 937 ; i2c.c:114: goto fail; 000114 80 0C [24] 938 sjmp 00119$ 000116 939 00118$: 940 ; i2c.c:117: I2CS |= bmSTOP; 000116 90 E6 78 [24] 941 mov dptr,#_I2CS 000119 E0 [24] 942 movx a,@dptr 00011A 43 E0 40 [24] 943 orl acc,#0x40 00011D F0 [24] 944 movx @dptr,a 945 ; i2c.c:118: return 1; 00011E 75 82 01 [24] 946 mov dpl,#0x01 947 ; i2c.c:120: fail: 000121 22 [24] 948 ret 000122 949 00119$: 950 ; i2c.c:121: I2CS |= bmSTOP; 000122 90 E6 78 [24] 951 mov dptr,#_I2CS 000125 E0 [24] 952 movx a,@dptr 000126 43 E0 40 [24] 953 orl acc,#0x40 000129 F0 [24] 954 movx @dptr,a 955 ; i2c.c:122: return 0; 00012A 75 82 00 [24] 956 mov dpl,#0x00 957 ; i2c.c:123: } 00012D 22 [24] 958 ret 959 .area CSEG (CODE) 960 .area CONST (CODE) 961 .area CABS (ABS,CODE)