xllp_ac97acodec.cod

来自「pxa270为硬件平台的wince操作系统XLLP驱动源码」· COD 代码 · 共 1,214 行 · 第 1/3 页

COD
1,214
字号
  00040	058462a8	 streq       r6, [r4, #0x2A8]
  00044	058434a8	 streq       r3, [r4, #0x4A8]
  00048	0a000026	 beq         |$done$1204|

; 276  :        
; 277  :         goto done;
; 278  :     }
; 279  :     
; 280  : 	if(offset == XLLP_AC97_CR_E_MDM_GPIO_PIN_STAT)

  0004c	e3510054	 cmp         r1, #0x54

; 281  : 	{//it is a special register and sent out on slot 12
; 282  :     	if (XLLP_AC97_ACODEC_PRIMARY == codecSel)
; 283  : 	    	pCodecReg = &(pAc97Reg->CodecRegsPrimaryMdm[0]);
; 284  :     	else
; 285  : 	    	pCodecReg = &(pAc97Reg->CodecRegsSecondaryMdm[0]);
; 286  :     	pCodecReg += offset / XLLP_AC97_CODEC_REGS_PER_WORD;
; 287  :         // The data will be sent out on slot 12.
; 288  :         *pCodecReg = (XLLP_UINT32_T)data;

  00050	058464a8	 streq       r6, [r4, #0x4A8]
  00054	0a000023	 beq         |$done$1204|
  00058		 |$L1463|

; 289  :         goto done;
; 290  : 	}
; 291  :         
; 292  :     // Point to specified register within area mapped to target codec regs
; 293  : 	if (XLLP_AC97_ACODEC_PRIMARY == codecSel)
; 294  : 		pCodecReg = &(pAc97Reg->CodecRegsPrimaryAud[0]);

  00058	e2842c02	 add         r2, r4, #2, 24

; 295  : 	else
; 296  : 		pCodecReg = &(pAc97Reg->CodecRegsSecondaryAud[0]);
; 297  : 	pCodecReg += offset / XLLP_AC97_CODEC_REGS_PER_WORD;

  0005c	e1a030a1	 mov         r3, r1, lsr #1
  00060	e082a103	 add         r10, r2, r3, lsl #2

; 298  : 
; 299  : 	
; 300  : 	//Lock the ACLINK
; 301  :     timeRemaining = XLLP_AC97_LOCK_TIMEOUT_DEF;

  00064	e3a08f4b	 mov         r8, #0x4B, 30
  00068		 |$L1211|

; 302  :     do
; 303  :     {
; 304  :         gotLink = XllpAc97ACODECLinkLock(pAc97Reg);

  00068	e5943020	 ldr         r3, [r4, #0x20]
  0006c	e3a07001	 mov         r7, #1
  00070	e58d3000	 str         r3, [sp]
  00074	e59d3000	 ldr         r3, [sp]
  00078	e3130001	 tst         r3, #1

; 305  :         if (XLLP_FALSE == gotLink)	// 1 usec is a long time.  Skip delay if possible.
; 306  :         {
; 307  : 			XllpOstDelayMicroSeconds(pOstRegs, 1);

  0007c	13a01001	 movne       r1, #1
  00080	11a0000b	 movne       r0, r11
  00084	13a07000	 movne       r7, #0
  00088	1b000000	 blne        XllpOstDelayMicroSeconds

; 308  :         }
; 309  :     }        // Wait while time remaining and ACLINK not available
; 310  :     while (timeRemaining-- && (XLLP_FALSE == gotLink));

  0008c	e3580000	 cmp         r8, #0
  00090	e2488001	 sub         r8, r8, #1
  00094	0a000001	 beq         |$L1215|
  00098	e3570000	 cmp         r7, #0
  0009c	0afffff1	 beq         |$L1211|
  000a0		 |$L1215|

; 311  : 
; 312  :     if (XLLP_FALSE == gotLink)	// Didn't get the ACLINK

  000a0	e3570000	 cmp         r7, #0

; 313  :     {
; 314  :         status = XLLP_ACODEC_CONTROLLER_INTERFACE_TIMEOUT;
; 315  :     }
; 316  :     else	// We got the link. Perform the write operation and don't wait.

  000a4	0a00000e	 beq         |$L1480|

; 317  :     {
; 318  :         // First, clear old write status indication CDONE by writing a ONE to that bit.
; 319  :         pAc97Reg->GSR = XLLP_AC97_GSR_CDONE_MSK;

  000a8	e3a03702	 mov         r3, #2, 14
  000ac	e584301c	 str         r3, [r4, #0x1C]

; 320  : 
; 321  :         *pCodecReg = (XLLP_UINT32_T)data;       // Now the write!

  000b0	e58a6000	 str         r6, [r10]

; 322  : 
; 323  :         // Wait until write cycle is complete. There should be a way
; 324  :         //  to do this speculatively at the beginning of the procedure.
; 325  :         //  Need to discover it. Too inefficient to always wait.
; 326  : 
; 327  :         timeRemaining = maxRWTimeOutUs;

  000b4		 |$L1219|

; 328  :         do
; 329  :         {
; 330  : 			XllpOstDelayMicroSeconds(pOstRegs, 1);

  000b4	e3a01001	 mov         r1, #1
  000b8	e1a0000b	 mov         r0, r11
  000bc	eb000000	 bl          XllpOstDelayMicroSeconds

; 331  :         }     // Wait while time remaining and command I/O still incomplete.
; 332  :         while ( (timeRemaining--) && !(pAc97Reg->GSR & XLLP_AC97_GSR_CDONE_MSK));

  000c0	e3590000	 cmp         r9, #0
  000c4	e2499001	 sub         r9, r9, #1
  000c8	0a000002	 beq         |$L1222|
  000cc	e594301c	 ldr         r3, [r4, #0x1C]
  000d0	e3130702	 tst         r3, #2, 14
  000d4	0afffff6	 beq         |$L1219|
  000d8		 |$L1222|

; 333  : 		if (!(pAc97Reg->GSR & XLLP_AC97_GSR_CDONE_MSK))

  000d8	e594301c	 ldr         r3, [r4, #0x1C]
  000dc	e3130702	 tst         r3, #2, 14
  000e0	1a000000	 bne         |$done$1204|
  000e4		 |$L1480|

; 334  : 			status = XLLP_ACODEC_CONTROLLER_INTERFACE_TIMEOUT;

  000e4	e3a05003	 mov         r5, #3
  000e8		 |$done$1204|

; 335  :     }  // Got AC link
; 336  : 
; 337  : done:
; 338  :     return(status);

  000e8	e1a00005	 mov         r0, r5

; 339  : } // Ac97CtrlCodecWrite()

  000ec	e28dd004	 add         sp, sp, #4
  000f0	e8bd4ff0	 ldmia       sp!, {r4 - r11, lr}
  000f4	e12fff1e	 bx          lr
  000f8		 |$M1482|

			 ENDP  ; |XllpAc97ACodecWrite|

	EXPORT	|XllpAc97ACodecRead|

  00000			 AREA	 |.text| { |XllpAc97ACodecRead| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000			 AREA	 |.pdata$$XllpAc97ACodecRead|, PDATA, SELECTION=5, ASSOC=|.text| { |XllpAc97ACodecRead| } ; comdat associative
|$T1519| DCD	|$L1518|
	DCD	0x40004902
; Function compile flags: /Ogsy

  00000			 AREA	 |.text| { |XllpAc97ACodecRead| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000		 |XllpAc97ACodecRead| PROC

; 343  : {

  00000		 |$L1518|
  00000	e92d4ff0	 stmdb       sp!, {r4 - r11, lr}
  00004	e24dd004	 sub         sp, sp, #4
  00008		 |$M1516|
  00008	e1a09002	 mov         r9, r2

; 344  :     XLLP_ACODEC_ERROR_T	status = XLLP_ACODEC_SUCCESS;
; 345  :     XLLP_BOOL_T			gotLink;
; 346  : 	XLLP_UINT32_T		timeRemaining;
; 347  :     P_XLLP_VUINT32_T	pCodecReg;
; 348  :     P_XLLP_AC97ACODEC_T pAc97Reg = (P_XLLP_AC97ACODEC_T)(pDevContext->pPCMReg); 
; 349  : 	P_XLLP_OST_T pOstRegs = pDevContext->pOSTRegs;
; 350  : 	XLLP_UINT32_T maxRWTimeOutUs = (pDevContext->uMaxReadWriteTimeOutMs) * 1000; 

  0000c	e5903018	 ldr         r3, [r0, #0x18]
  00010	e5904008	 ldr         r4, [r0, #8]
  00014	e3a02ffa	 mov         r2, #0xFA, 30

; 351  : 	XLLP_AC97_ACODEC_SEL_T codecSel = XLLP_AC97_ACODEC_PRIMARY;
; 352  : 
; 353  :     if(offset == XLLP_AC97_CR_E_MDM_GPIO_PIN_STAT)

  00018	e3510054	 cmp         r1, #0x54
  0001c	e0080293	 mul         r8, r3, r2

; 354  :     {//it is a special register. it does not need dummy read and must be read in modem IO space
; 355  :         // Select the Primary or Secondary modem IO address space
; 356  : 	    if (XLLP_AC97_ACODEC_PRIMARY == codecSel)
; 357  :             pCodecReg = &(pAc97Reg->CodecRegsPrimaryMdm[0]);
; 358  :         else
; 359  :             pCodecReg = &(pAc97Reg->CodecRegsSecondaryMdm[0]);
; 360  : 
; 361  :         pCodecReg += offset / XLLP_AC97_CODEC_REGS_PER_WORD;
; 362  : 
; 363  :         // The data is received on Slot 12 and stored by the
; 364  :         // ACUNIT so we can read back straight away.
; 365  :         *pdata = (XLLP_UINT16_T)(*pCodecReg);

  00020	059434a8	 ldreq       r3, [r4, #0x4A8]
  00024	e590b024	 ldr         r11, [r0, #0x24]
  00028	e3a05000	 mov         r5, #0
  0002c	01c930b0	 streqh      r3, [r9]
  00030	0a000037	 beq         |$done$1244|

; 366  :             
; 367  :         goto done;
; 368  :     }
; 369  :     
; 370  :     // Point to specified register within area mapped to target codec regs
; 371  : 	if (XLLP_AC97_ACODEC_PRIMARY == codecSel)
; 372  : 		pCodecReg = &(pAc97Reg->CodecRegsPrimaryAud[0]);

  00034	e2842c02	 add         r2, r4, #2, 24

; 373  : 	else
; 374  : 		pCodecReg = &(pAc97Reg->CodecRegsSecondaryAud[0]);
; 375  : 	pCodecReg += offset / XLLP_AC97_CODEC_REGS_PER_WORD;

  00038	e1a030a1	 mov         r3, r1, lsr #1
  0003c	e082a103	 add         r10, r2, r3, lsl #2

; 376  : 
; 377  : 	//Lock the ACLINK
; 378  :     timeRemaining = XLLP_AC97_LOCK_TIMEOUT_DEF;

  00040	e3a07f4b	 mov         r7, #0x4B, 30
  00044		 |$L1247|

; 379  :     do
; 380  :     {
; 381  :         gotLink = XllpAc97ACODECLinkLock(pAc97Reg);

  00044	e5943020	 ldr         r3, [r4, #0x20]
  00048	e3a06001	 mov         r6, #1
  0004c	e58d3000	 str         r3, [sp]
  00050	e59d3000	 ldr         r3, [sp]
  00054	e3130001	 tst         r3, #1

; 382  :         if (XLLP_FALSE == gotLink)	// 1 usec is a long time.  Skip delay if possible.
; 383  :         {
; 384  : 			XllpOstDelayMicroSeconds(pOstRegs, 1);

  00058	13a01001	 movne       r1, #1
  0005c	11a0000b	 movne       r0, r11
  00060	13a06000	 movne       r6, #0
  00064	1b000000	 blne        XllpOstDelayMicroSeconds

; 385  :         }
; 386  :     }        // Wait while time remaining and ACLINK not available
; 387  :     while (timeRemaining-- && (XLLP_FALSE == gotLink));

  00068	e3570000	 cmp         r7, #0
  0006c	e2477001	 sub         r7, r7, #1
  00070	0a000001	 beq         |$L1251|
  00074	e3560000	 cmp         r6, #0
  00078	0afffff1	 beq         |$L1247|
  0007c		 |$L1251|

; 388  : 
; 389  :     if (XLLP_FALSE == gotLink)	// Didn't get the ACLINK

  0007c	e3560000	 cmp         r6, #0

; 390  :     {
; 391  :         status = XLLP_ACODEC_CONTROLLER_INTERFACE_TIMEOUT;
; 392  :     }
; 393  :     else	// We got the link. Perform the write operation and don't wait.

  00080	0a000022	 beq         |$L1515|

; 394  :     {
; 395  :          // First, clear old read status indications.
; 396  :         pAc97Reg->GSR = XLLP_AC97_GSR_SDONE_MSK | XLLP_AC97_GSR_RCS_ERR_MSK;

  00084	e3a07912	 mov         r7, #0x12, 18
  00088	e584701c	 str         r7, [r4, #0x1C]

; 397  : 
; 398  :         *pdata = (XLLP_UINT16_T)(*pCodecReg); // This is THE DUMMY READ.

  0008c	e59a3000	 ldr         r3, [r10]

; 399  : 
; 400  :          // Wait for read I/O with codec to complete before doing real read.
; 401  :         timeRemaining = maxRWTimeOutUs;

  00090	e1a06008	 mov         r6, r8
  00094	e1c930b0	 strh        r3, [r9]
  00098		 |$L1255|

; 402  :         do
; 403  :         {
; 404  : 			XllpOstDelayMicroSeconds(pOstRegs, 1);

  00098	e3a01001	 mov         r1, #1
  0009c	e1a0000b	 mov         r0, r11
  000a0	eb000000	 bl          XllpOstDelayMicroSeconds

; 405  :         }   // Wait while time remaining and read I/O still incomplete
; 406  :         while( (timeRemaining--) && (!(pAc97Reg->GSR & XLLP_AC97_GSR_SDONE_MSK)) );

  000a4	e3560000	 cmp         r6, #0
  000a8	e2466001	 sub         r6, r6, #1
  000ac	0a000002	 beq         |$L1258|
  000b0	e594301c	 ldr         r3, [r4, #0x1C]
  000b4	e3130701	 tst         r3, #1, 14
  000b8	0afffff6	 beq         |$L1255|
  000bc		 |$L1258|

; 407  : 
; 408  :         if ((pAc97Reg->GSR & XLLP_AC97_GSR_SDONE_MSK) && (!(pAc97Reg->GSR & XLLP_AC97_GSR_RCS_ERR_MSK)) )

  000bc	e594301c	 ldr         r3, [r4, #0x1C]
  000c0	e3130701	 tst         r3, #1, 14
  000c4	0a00000f	 beq         |$L1259|
  000c8	e594301c	 ldr         r3, [r4, #0x1C]
  000cc	e3130902	 tst         r3, #2, 18
  000d0	1a00000c	 bne         |$L1259|

; 409  :         {
; 410  :              // succeed in reading. clear status bits first.
; 411  :              pAc97Reg->GSR = XLLP_AC97_GSR_SDONE_MSK | XLLP_AC97_GSR_RCS_ERR_MSK;

  000d4	e584701c	 str         r7, [r4, #0x1C]

; 412  :             *pdata = (XLLP_UINT16_T)(*pCodecReg);	// THE REAL READ.

  000d8	e59a3000	 ldr         r3, [r10]

; 413  :      		timeRemaining = maxRWTimeOutUs;

  000dc	e1c930b0	 strh        r3, [r9]
  000e0		 |$L1261|

; 414  :     	    do
; 415  : 	        {
; 416  : 				XllpOstDelayMicroSeconds(pOstRegs, 1);

  000e0	e3a01001	 mov         r1, #1
  000e4	e1a0000b	 mov         r0, r11
  000e8	eb000000	 bl          XllpOstDelayMicroSeconds

; 417  :   		    }   // Wait while time remaining and read I/O still incomplete
; 418  :     	    while( (timeRemaining--) && (!(pAc97Reg->GSR & XLLP_AC97_GSR_SDONE_MSK)) );

  000ec	e3580000	 cmp         r8, #0
  000f0	e2488001	 sub         r8, r8, #1
  000f4	0a000006	 beq         |$done$1244|
  000f8	e594301c	 ldr         r3, [r4, #0x1C]
  000fc	e3130701	 tst         r3, #1, 14
  00100	0afffff6	 beq         |$L1261|

; 419  : 
; 420  :         }
; 421  :         else	// failed

  00104	ea000002	 b           |$done$1244|
  00108		 |$L1259|

; 422  :         {
; 423  :             status = XLLP_ACODEC_CONTROLLER_INTERFACE_TIMEOUT;
; 424  :             pAc97Reg->CAR = XLLP_AC97_CAR_CAIP_CLEAR;

  00108	e3a03000	 mov         r3, #0
  0010c	e5843020	 str         r3, [r4, #0x20]
  00110		 |$L1515|
  00110	e3a05003	 mov         r5, #3
  00114		 |$done$1244|

; 425  : 
; 426  :         } // else  (OK to do real read)
; 427  : 
; 428  :     } // else  (We got the link.  Perform the read operations.)
; 429  : 
; 430  : done:    
; 431  :     return (status);

  00114	e1a00005	 mov         r0, r5

; 432  : } 

  00118	e28dd004	 add         sp, sp, #4
  0011c	e8bd4ff0	 ldmia       sp!, {r4 - r11, lr}
  00120	e12fff1e	 bx          lr
  00124		 |$M1517|

			 ENDP  ; |XllpAc97ACodecRead|

	END

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?