📄 xllp_ac97.cod
字号:
00038 e58380a8 str r8, [r3, #0xA8]
; 324 :
; 325 : #endif
; 326 : goto done;
0003c ea000026 b |$done$1286|
00040 |$L1283|
; 327 : }
; 328 : else
; 329 : {
; 330 : // Select the Primary or Secondary Audio IO address space
; 331 : if (XLLP_AC97_CODEC_PRIMARY == codecSel)
00040 e3530000 cmp r3, #0
; 332 : pCodecReg = &(pAc97Reg->CodecRegsPrimaryAud[0]);
00044 02842c02 addeq r2, r4, #2, 24
; 333 : else
; 334 : pCodecReg = &(pAc97Reg->CodecRegsSecondaryAud[0]);
00048 12842c03 addne r2, r4, #3, 24
; 335 :
; 336 : pCodecReg += offset / XLLP_AC97_CODEC_REGS_PER_WORD;
0004c e1a030a0 mov r3, r0, lsr #1
00050 e0829103 add r9, r2, r3, lsl #2
; 337 : }
; 338 :
; 339 :
; 340 : //Lock the ACLINK
; 341 : timeRemaining = XLLP_AC97_LOCK_TIMEOUT_DEF;
00054 e3a07f4b mov r7, #0x4B, 30
00058 |$L1290|
; 342 : do
; 343 : {
; 344 : gotLink = XllpAc97LinkLock(pAc97Reg);
00058 e5943020 ldr r3, [r4, #0x20]
0005c e3a06001 mov r6, #1
00060 e58d3000 str r3, [sp]
00064 e59d3000 ldr r3, [sp]
00068 e3130001 tst r3, #1
; 345 : if (XLLP_FALSE == gotLink) // 1 usec is a long time. Skip delay if possible.
; 346 : {
; 347 : XllpOstDelayMicroSeconds(pOstRegs, 1);
0006c 13a01001 movne r1, #1
00070 11a0000a movne r0, r10
00074 13a06000 movne r6, #0
00078 1b000000 blne XllpOstDelayMicroSeconds
; 348 : }
; 349 : } // Wait while time remaining and ACLINK not available
; 350 : while (timeRemaining-- && (XLLP_FALSE == gotLink));
0007c e3570000 cmp r7, #0
00080 e2477001 sub r7, r7, #1
00084 0a000001 beq |$L1294|
00088 e3560000 cmp r6, #0
0008c 0afffff1 beq |$L1290|
00090 |$L1294|
; 351 :
; 352 : if (XLLP_FALSE == gotLink) // Didn't get the ACLINK
00090 e3560000 cmp r6, #0
; 353 : {
; 354 : status = XLLP_AC97_LINK_LOCK_FAIL;
00094 03a05005 moveq r5, #5
00098 0a00000f beq |$done$1286|
; 355 : }
; 356 : else // We got the link. Perform the write operation and don't wait.
; 357 : {
; 358 :
; 359 : // First, clear old write status indication CDONE by writing a ONE to that bit.
; 360 : pAc97Reg->GSR = XLLP_AC97_GSR_CDONE_MSK;
0009c e3a03702 mov r3, #2, 14
; 361 :
; 362 : *pCodecReg = data; // Now the write!
; 363 :
; 364 : // Wait until write cycle is complete. There should be a way
; 365 : // to do this speculatively at the beginning of the procedure.
; 366 : // Need to discover it. Too inefficient to always wait.
; 367 :
; 368 : timeRemaining = maxRWTimeOutUs;
000a0 e59d6024 ldr r6, [sp, #0x24]
000a4 e584301c str r3, [r4, #0x1C]
000a8 e5898000 str r8, [r9]
000ac |$L1297|
; 369 : do
; 370 : {
; 371 : XllpOstDelayMicroSeconds(pOstRegs, 1);
000ac e3a01001 mov r1, #1
000b0 e1a0000a mov r0, r10
000b4 eb000000 bl XllpOstDelayMicroSeconds
; 372 : } // Wait while time remaining and command I/O still incomplete.
; 373 : while ( (timeRemaining--) && !(pAc97Reg->GSR & XLLP_AC97_GSR_CDONE_MSK));
000b8 e3560000 cmp r6, #0
000bc e2466001 sub r6, r6, #1
000c0 0a000002 beq |$L1300|
000c4 e594301c ldr r3, [r4, #0x1C]
000c8 e3130702 tst r3, #2, 14
000cc 0afffff6 beq |$L1297|
000d0 |$L1300|
; 374 : if (!(pAc97Reg->GSR & XLLP_AC97_GSR_CDONE_MSK))
000d0 e594301c ldr r3, [r4, #0x1C]
000d4 e3130702 tst r3, #2, 14
; 375 : status = XLLP_AC97_CODEC_ACCESS_TIMEOUT;
000d8 03a05001 moveq r5, #1
000dc |$done$1286|
; 376 : } // Got AC link
; 377 :
; 378 : done:
; 379 : return(status);
000dc e1a00005 mov r0, r5
; 380 : } // Ac97CtrlCodecWrite()
000e0 e28dd004 add sp, sp, #4
000e4 e8bd47f0 ldmia sp!, {r4 - r10, lr}
000e8 e12fff1e bx lr
000ec |$M1517|
ENDP ; |XllpAc97Write|
EXPORT |XllpAc97Read|
00000 AREA |.text| { |XllpAc97Read| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$XllpAc97Read|, PDATA, SELECTION=5, ASSOC=|.text| { |XllpAc97Read| } ; comdat associative
|$T1549| DCD |$L1548|
DCD 0x40004702
; Function compile flags: /Ogsy
00000 AREA |.text| { |XllpAc97Read| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |XllpAc97Read| PROC
; 424 : {
00000 |$L1548|
00000 e92d4ff0 stmdb sp!, {r4 - r11, lr}
00004 e24dd004 sub sp, sp, #4
00008 |$M1546|
00008 e1a08003 mov r8, r3
0000c e1a04002 mov r4, r2
00010 e1a0a001 mov r10, r1
; 425 : XLLP_AC97_ERROR_T status = XLLP_AC97_NO_ERROR;
; 426 : XLLP_BOOL_T gotLink;
; 427 : XLLP_UINT32_T timeRemaining;
; 428 : P_XLLP_VUINT32_T pCodecReg;
; 429 :
; 430 : // Point to specified register within area mapped to target codec regs
; 431 : // Check for special case register 54h the GPIO status register
; 432 : #ifdef WM9712
; 433 : if(offset == XLLP_AC97_CR_E_MDM_GPIO_PIN_STAT)
; 434 : {
; 435 : // Select the Primary or Secondary modem IO address space
; 436 : if (XLLP_AC97_CODEC_PRIMARY == codecSel)
; 437 : pCodecReg = &(pAc97Reg->CodecRegsPrimaryMdm[0]);
; 438 : else
; 439 : pCodecReg = &(pAc97Reg->CodecRegsSecondaryMdm[0]);
; 440 :
; 441 : pCodecReg += offset / XLLP_AC97_CODEC_REGS_PER_WORD;
; 442 :
; 443 : // The data is received on Slot 12 and stored by the
; 444 : // ACUNIT so we can read back straight away.
; 445 : *pdata = (XLLP_UINT16_T)(*pCodecReg);
; 446 :
; 447 : goto done;
; 448 : }
; 449 : else
; 450 : {
; 451 : // Select the Primary or Secondary Audio IO address space
; 452 : if (XLLP_AC97_CODEC_PRIMARY == codecSel)
; 453 : pCodecReg = &(pAc97Reg->CodecRegsPrimaryAud[0]);
; 454 : else
; 455 : pCodecReg = &(pAc97Reg->CodecRegsSecondaryAud[0]);
; 456 :
; 457 : pCodecReg += offset / XLLP_AC97_CODEC_REGS_PER_WORD;
; 458 : }
; 459 : #else
; 460 : // Select the Primary or Secondary Audio IO address space
; 461 : if (XLLP_AC97_CODEC_PRIMARY == codecSel)
00014 e59de02c ldr lr, [sp, #0x2C]
; 462 : pCodecReg = &(pAc97Reg->CodecRegsPrimaryAud[0]);
; 463 : else
; 464 : pCodecReg = &(pAc97Reg->CodecRegsSecondaryAud[0]);
; 465 : pCodecReg += offset / XLLP_AC97_CODEC_REGS_PER_WORD;
00018 e1a030a0 mov r3, r0, lsr #1
0001c e3a05000 mov r5, #0
00020 e35e0000 cmp lr, #0
00024 02842c02 addeq r2, r4, #2, 24
00028 12842c03 addne r2, r4, #3, 24
0002c e0829103 add r9, r2, r3, lsl #2
; 466 : #endif
; 467 : //Lock the ACLINK
; 468 : timeRemaining = XLLP_AC97_LOCK_TIMEOUT_DEF;
00030 e3a07f4b mov r7, #0x4B, 30
00034 |$L1321|
; 469 : do
; 470 : {
; 471 : gotLink = XllpAc97LinkLock(pAc97Reg);
00034 e5943020 ldr r3, [r4, #0x20]
00038 e3a06001 mov r6, #1
0003c e58d3000 str r3, [sp]
00040 e59d3000 ldr r3, [sp]
00044 e3130001 tst r3, #1
; 472 : if (XLLP_FALSE == gotLink) // 1 usec is a long time. Skip delay if possible.
; 473 : {
; 474 : XllpOstDelayMicroSeconds(pOstRegs, 1);
00048 13a01001 movne r1, #1
0004c 11a00008 movne r0, r8
00050 13a06000 movne r6, #0
00054 1b000000 blne XllpOstDelayMicroSeconds
; 475 : }
; 476 : } // Wait while time remaining and ACLINK not available
; 477 : while (timeRemaining-- && (XLLP_FALSE == gotLink));
00058 e3570000 cmp r7, #0
0005c e2477001 sub r7, r7, #1
00060 0a000001 beq |$L1325|
00064 e3560000 cmp r6, #0
00068 0afffff1 beq |$L1321|
0006c |$L1325|
; 478 :
; 479 : if (XLLP_FALSE == gotLink) // Didn't get the ACLINK
0006c e3560000 cmp r6, #0
; 480 : {
; 481 : status = XLLP_AC97_LINK_LOCK_FAIL;
00070 03a05005 moveq r5, #5
00074 0a000024 beq |$L1339|
; 482 : }
; 483 : else // We got the link. Perform the write operation and don't wait.
; 484 : {
; 485 : // First, clear old read status indications.
; 486 : pAc97Reg->GSR = XLLP_AC97_GSR_SDONE_MSK | XLLP_AC97_GSR_RCS_ERR_MSK;
00078 e3a0b912 mov r11, #0x12, 18
; 487 :
; 488 : *pdata = (XLLP_UINT16_T)(*pCodecReg); // This is THE DUMMY READ.
; 489 :
; 490 : // Wait for read I/O with codec to complete before doing real read.
; 491 : timeRemaining = maxRWTimeOutUs;
0007c e59d6028 ldr r6, [sp, #0x28]
00080 e584b01c str r11, [r4, #0x1C]
00084 e5993000 ldr r3, [r9]
00088 e1a07006 mov r7, r6
0008c e1ca30b0 strh r3, [r10]
00090 |$L1329|
; 492 : do
; 493 : {
; 494 : XllpOstDelayMicroSeconds(pOstRegs, 1);
00090 e3a01001 mov r1, #1
00094 e1a00008 mov r0, r8
00098 eb000000 bl XllpOstDelayMicroSeconds
; 495 : } // Wait while time remaining and read I/O still incomplete
; 496 : while( (timeRemaining--) && (!(pAc97Reg->GSR & XLLP_AC97_GSR_SDONE_MSK)) );
0009c e3570000 cmp r7, #0
000a0 e2477001 sub r7, r7, #1
000a4 0a000002 beq |$L1332|
000a8 e594301c ldr r3, [r4, #0x1C]
000ac e3130701 tst r3, #1, 14
000b0 0afffff6 beq |$L1329|
000b4 |$L1332|
; 497 :
; 498 : if ((pAc97Reg->GSR & XLLP_AC97_GSR_SDONE_MSK) && (!(pAc97Reg->GSR & XLLP_AC97_GSR_RCS_ERR_MSK)) )
000b4 e594301c ldr r3, [r4, #0x1C]
000b8 e3130701 tst r3, #1, 14
000bc 0a00000f beq |$L1333|
000c0 e594301c ldr r3, [r4, #0x1C]
000c4 e3130902 tst r3, #2, 18
000c8 1a00000c bne |$L1333|
; 499 : {
; 500 : // succeed in reading. clear status bits first.
; 501 : pAc97Reg->GSR = XLLP_AC97_GSR_SDONE_MSK | XLLP_AC97_GSR_RCS_ERR_MSK;
000cc e584b01c str r11, [r4, #0x1C]
; 502 : *pdata = (XLLP_UINT16_T)(*pCodecReg); // THE REAL READ.
000d0 e5993000 ldr r3, [r9]
; 503 : timeRemaining = maxRWTimeOutUs;
000d4 e1ca30b0 strh r3, [r10]
000d8 |$L1335|
; 504 : do
; 505 : {
; 506 : XllpOstDelayMicroSeconds(pOstRegs, 1);
000d8 e3a01001 mov r1, #1
000dc e1a00008 mov r0, r8
000e0 eb000000 bl XllpOstDelayMicroSeconds
; 507 : } // Wait while time remaining and read I/O still incomplete
; 508 : while( (timeRemaining--) && (!(pAc97Reg->GSR & XLLP_AC97_GSR_SDONE_MSK)) );
000e4 e3560000 cmp r6, #0
000e8 e2466001 sub r6, r6, #1
000ec 0a000006 beq |$L1339|
000f0 e594301c ldr r3, [r4, #0x1C]
000f4 e3130701 tst r3, #1, 14
000f8 0afffff6 beq |$L1335|
; 509 :
; 510 : }
; 511 : else // failed
000fc ea000002 b |$L1339|
00100 |$L1333|
; 512 : {
; 513 : status = XLLP_AC97_CODEC_ACCESS_TIMEOUT;
; 514 : pAc97Reg->CAR = XLLP_AC97_CAR_CAIP_CLEAR;
00100 e3a03000 mov r3, #0
00104 e5843020 str r3, [r4, #0x20]
00108 e3a05001 mov r5, #1
0010c |$L1339|
; 515 :
; 516 : } // else (OK to do real read)
; 517 :
; 518 : } // else (We got the link. Perform the read operations.)
; 519 :
; 520 : return (status);
0010c e1a00005 mov r0, r5
; 521 : } // XllpAc97Read ()
00110 e28dd004 add sp, sp, #4
00114 e8bd4ff0 ldmia sp!, {r4 - r11, lr}
00118 e12fff1e bx lr
0011c |$M1547|
ENDP ; |XllpAc97Read|
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -