xllp_ac97acodec.cod

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

COD
1,214
字号
; Listing generated by Microsoft (R) Optimizing Compiler Version 13.10.4345 

	TTL	F:\wm520\PLATFORM\intel_dbpxa27x\Public\CSP\ARM\INTEL\PXA27X\XLLP\SOURCE\.\xllp_ac97acodec.c
	CODE32

  00000			 AREA	 |.drectve|, DRECTVE
	DCB	"-defaultlib:coredll.lib "
	DCB	"-defaultlib:corelibc.lib "

	IMPORT	|XllpOstDelayMicroSeconds|
	IMPORT	|XllpGpioSetOutputState1|
; File f:\wm520\platform\intel_dbpxa27x\public\csp\arm\intel\pxa27x\xllp\source\xllp_ac97acodec.c

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

  00000			 AREA	 |.pdata$$XllpAc97ACODECColdReset|, PDATA, SELECTION=5, ASSOC=|.text| { |XllpAc97ACODECColdReset| } ; comdat associative
|$T1348| DCD	|$L1347|
	DCD	0x40003702
; Function compile flags: /Ogsy

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

  00000		 |XllpAc97ACODECColdReset| PROC

; 436  : { 

  00000		 |$L1347|
  00000	e92d43f0	 stmdb       sp!, {r4 - r9, lr}
  00004	e24dd018	 sub         sp, sp, #0x18
  00008		 |$M1345|
  00008	e1a05000	 mov         r5, r0

; 437  :     XLLP_ACODEC_ERROR_T	status = XLLP_ACODEC_SUCCESS;
; 438  :     P_XLLP_AC97ACODEC_T pAC97 = (P_XLLP_AC97ACODEC_T)(pAc97ctxt->pPCMReg);
; 439  :     P_XLLP_OST_T 		pOstRegs = pAc97ctxt->pOSTRegs;

  0000c	e5959024	 ldr         r9, [r5, #0x24]
  00010	e5958008	 ldr         r8, [r5, #8]

; 440  :     XLLP_BOOL_T			priCodecReady, secCodecReady; 
; 441  :     XLLP_UINT32_T		timeRemaining; 
; 442  :     volatile XLLP_GPIO_T	*pGPIO = (volatile XLLP_GPIO_T *) pAc97ctxt->pGpioReg;
; 443  : 
; 444  :     pAC97->GCR = 0;    

  00014	e5954004	 ldr         r4, [r5, #4]
  00018	e3a03000	 mov         r3, #0

; 445  : 
; 446  :     // Hold reset active for a minimum time
; 447  : 	XllpOstDelayMicroSeconds(pOstRegs, XLLP_AC97_COLD_HOLDTIME);

  0001c	e1a00009	 mov         r0, r9
  00020	e3a01064	 mov         r1, #0x64
  00024	e588300c	 str         r3, [r8, #0xC]
  00028	e3a07000	 mov         r7, #0
  0002c	eb000000	 bl          XllpOstDelayMicroSeconds

; 448  : 
; 449  :     // Deactivate cold reset condition
; 450  : 	pAC97->GCR |= XLLP_AC97_GCR_COLD_RESET_MSK; 

  00030	e598300c	 ldr         r3, [r8, #0xC]

; 451  :     
; 452  :     // Set nReset high. This is a workaround for some strange behavior of nReset pin.
; 453  :     {
; 454  : 	    XLLP_UINT32_T pins[6];
; 455  :     	pins[0] = 1;

  00034	e3a02001	 mov         r2, #1

; 456  :     	pins[1] = 113;

  00038	e3a0e071	 mov         lr, #0x71
  0003c	e3833002	 orr         r3, r3, #2

; 457  :     	XllpGpioSetOutputState1((XLLP_GPIO_T *)pGPIO, pins);

  00040	e28d1000	 add         r1, sp, #0
  00044	e1a00004	 mov         r0, r4
  00048	e588300c	 str         r3, [r8, #0xC]
  0004c	e58d2000	 str         r2, [sp]
  00050	e58de004	 str         lr, [sp, #4]
  00054	eb000000	 bl          XllpGpioSetOutputState1

; 458  :     }
; 459  :     	
; 460  :     // And wait with timeout for all codecs to respond.
; 461  : 
; 462  :     priCodecReady = XLLP_FALSE;
; 463  : 	if (XLLP_FALSE == pAc97ctxt->bUseSecondaryCodec)

  00058	e5953020	 ldr         r3, [r5, #0x20]

; 464  : 	{
; 465  : 	    secCodecReady = XLLP_TRUE;
; 466  : 	}
; 467  : 	else
; 468  : 	{
; 469  : 	    secCodecReady = XLLP_FALSE;
; 470  : 	}
; 471  :     timeRemaining = (pAc97ctxt->uMaxSetupTimeOutMs) * 1000;

  0005c	e3a02ffa	 mov         r2, #0xFA, 30
  00060	e3a06000	 mov         r6, #0
  00064	e3530000	 cmp         r3, #0
  00068	e595301c	 ldr         r3, [r5, #0x1C]
  0006c	03a04001	 moveq       r4, #1
  00070	13a04000	 movne       r4, #0
  00074	e0050293	 mul         r5, r3, r2
  00078		 |$L1282|

; 472  :     do
; 473  :     {
; 474  : 		XllpOstDelayMicroSeconds(pOstRegs, 1);

  00078	e3a01001	 mov         r1, #1
  0007c	e1a00009	 mov         r0, r9
  00080	eb000000	 bl          XllpOstDelayMicroSeconds

; 475  :         if (pAC97->GSR & XLLP_AC97_GSR_PCRDY_MSK)

  00084	e598301c	 ldr         r3, [r8, #0x1C]
  00088	e3130c01	 tst         r3, #1, 24

; 476  :             priCodecReady = XLLP_TRUE;
; 477  :         if (pAC97->GSR & XLLP_AC97_GSR_SCRDY_MSK)

  0008c	e598301c	 ldr         r3, [r8, #0x1C]
  00090	13a06001	 movne       r6, #1
  00094	e3130c02	 tst         r3, #2, 24

; 478  :             secCodecReady = XLLP_TRUE;

  00098	13a04001	 movne       r4, #1

; 479  :     }
; 480  :     while (timeRemaining-- && ((priCodecReady == XLLP_FALSE) || (secCodecReady == XLLP_FALSE)));

  0009c	e3550000	 cmp         r5, #0
  000a0	e2455001	 sub         r5, r5, #1
  000a4	0a000003	 beq         |$L1287|
  000a8	e3560000	 cmp         r6, #0
  000ac	0afffff1	 beq         |$L1282|
  000b0	e3540000	 cmp         r4, #0
  000b4	0affffef	 beq         |$L1282|
  000b8		 |$L1287|

; 481  : 
; 482  :     // Timeout status if some of the devices weren't ready.
; 483  :     if ((priCodecReady == XLLP_FALSE) || (secCodecReady == XLLP_FALSE))

  000b8	e3560000	 cmp         r6, #0
  000bc	0a000001	 beq         |$L1289|
  000c0	e3540000	 cmp         r4, #0
  000c4	1a000000	 bne         |$L1288|
  000c8		 |$L1289|

; 484  :     {
; 485  :         status = XLLP_ACODEC_CONTROLLER_INTERFACE_TIMEOUT;

  000c8	e3a07003	 mov         r7, #3
  000cc		 |$L1288|

; 486  :     }
; 487  : 
; 488  :     return (status);

  000cc	e1a00007	 mov         r0, r7

; 489  : } 

  000d0	e28dd018	 add         sp, sp, #0x18
  000d4	e8bd43f0	 ldmia       sp!, {r4 - r9, lr}
  000d8	e12fff1e	 bx          lr
  000dc		 |$M1346|

			 ENDP  ; |XllpAc97ACODECColdReset|


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

  00000			 AREA	 |.pdata$$XllpAc97ACODECShutdownAclink|, PDATA, SELECTION=5, ASSOC=|.text| { |XllpAc97ACODECShutdownAclink| } ; comdat associative
|$T1366| DCD	|$L1365|
	DCD	0x40001601
; Function compile flags: /Ogsy

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

  00000		 |XllpAc97ACODECShutdownAclink| PROC

; 493  : {

  00000		 |$L1365|
  00000	e92d40f0	 stmdb       sp!, {r4 - r7, lr}
  00004		 |$M1363|
  00004	e1a07001	 mov         r7, r1
  00008	e1a06000	 mov         r6, r0

; 494  :     XLLP_ACODEC_ERROR_T	status = XLLP_ACODEC_SUCCESS;
; 495  :     XLLP_UINT32_T timeRemaining = XLLP_AC97_LINKOFF_TIMEOUT_DEF; 
; 496  : 
; 497  :     pAc97Reg->GCR |= XLLP_AC97_GCR_LINK_OFF_MSK;

  0000c	e596300c	 ldr         r3, [r6, #0xC]

; 498  : 	
; 499  : 	while (!(pAc97Reg->GSR & XLLP_AC97_GSR_ACOFFD_MSK))

  00010	e3a04000	 mov         r4, #0
  00014	e3a05f7d	 mov         r5, #0x7D, 30
  00018	e3833008	 orr         r3, r3, #8
  0001c	e586300c	 str         r3, [r6, #0xC]
  00020	ea000004	 b           |$L1362|
  00024		 |$L1298|

; 500  : 	{
; 501  : 		timeRemaining --;

  00024	e2555001	 subs        r5, r5, #1

; 502  : 		if (0 == timeRemaining)

  00028	0a000006	 beq         |$L1353|

; 505  :     		break;
; 506  : 		}
; 507  : 		XllpOstDelayMicroSeconds(pOstRegs, 1);

  0002c	e3a01001	 mov         r1, #1
  00030	e1a00007	 mov         r0, r7
  00034	eb000000	 bl          XllpOstDelayMicroSeconds
  00038		 |$L1362|
  00038	e596301c	 ldr         r3, [r6, #0x1C]
  0003c	e3130008	 tst         r3, #8
  00040	0afffff7	 beq         |$L1298|

; 502  : 		if (0 == timeRemaining)

  00044	ea000000	 b           |$L1299|
  00048		 |$L1353|

; 503  : 		{
; 504  :     		status = XLLP_ACODEC_CONTROLLER_INTERFACE_TIMEOUT;

  00048	e3a04003	 mov         r4, #3
  0004c		 |$L1299|

; 508  :     }
; 509  : 	
; 510  :     return(status);

  0004c	e1a00004	 mov         r0, r4

; 511  : }

  00050	e8bd40f0	 ldmia       sp!, {r4 - r7, lr}
  00054	e12fff1e	 bx          lr
  00058		 |$M1364|

			 ENDP  ; |XllpAc97ACODECShutdownAclink|


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

  00000			 AREA	 |.pdata$$XllpAc97ACODECLinkLock|, PDATA, SELECTION=5, ASSOC=|.text| { |XllpAc97ACODECLinkLock| } ; comdat associative
|$T1377| DCD	|$L1376|
	DCD	0x40000901
; Function compile flags: /Ogsy

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

  00000		 |XllpAc97ACODECLinkLock| PROC

; 514  : {

  00000		 |$L1376|
  00000	e24dd004	 sub         sp, sp, #4
  00004		 |$M1374|

; 515  :     XLLP_BOOL_T		status = XLLP_TRUE;
; 516  :     XLLP_VUINT32_T	carTmp;
; 517  : 
; 518  :     carTmp = pAc97Reg->CAR;

  00004	e5903020	 ldr         r3, [r0, #0x20]
  00008	e3a00001	 mov         r0, #1
  0000c	e58d3000	 str         r3, [sp]

; 519  :     if (carTmp & XLLP_AC97_CAR_CAIP_MSK)	// "1" in CAIP bit means lock failed.

  00010	e59d3000	 ldr         r3, [sp]
  00014	e3130001	 tst         r3, #1

; 520  :     {
; 521  :         status = XLLP_FALSE;

  00018	13a00000	 movne       r0, #0

; 522  :     }
; 523  :     return (status);
; 524  : } // XllpAc97LinkLock()

  0001c	e28dd004	 add         sp, sp, #4
  00020	e12fff1e	 bx          lr
  00024		 |$M1375|

			 ENDP  ; |XllpAc97ACODECLinkLock|

	EXPORT	|XllpAc97ACodecInit|
	IMPORT	|XllpGpioSetDirectionIn|
	IMPORT	|XllpGpioSetDirectionOut|
	IMPORT	|XllpGpioSetOutput0|
	IMPORT	|XllpGpioSetAlternateFn|

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

  00000			 AREA	 |.pdata$$XllpAc97ACodecInit|, PDATA, SELECTION=5, ASSOC=|.text| { |XllpAc97ACodecInit| } ; comdat associative
|$T1419| DCD	|$L1418|
	DCD	0x40008302
; Function compile flags: /Ogsy

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

  00000		 |XllpAc97ACodecInit| PROC

; 80   : {

  00000		 |$L1418|
  00000	e92d43f0	 stmdb       sp!, {r4 - r9, lr}
  00004	e24dd054	 sub         sp, sp, #0x54
  00008		 |$M1416|
  00008	e1a05000	 mov         r5, r0

; 81   :     XLLP_ACODEC_ERROR_T	status ;
; 82   :     volatile XLLP_GPIO_T	*pGPIO = (volatile XLLP_GPIO_T *) pAc97ctxt->pGpioReg;
; 83   : 	volatile XLLP_CLKMGR_T *pCLKMGR = (volatile XLLP_CLKMGR_T *) pAc97ctxt->pClockReg;
; 84   :     XLLP_UINT32_T pins[9], fn[6];
; 85   : 	
; 86   : /*
; 87   : #ifdef FORCE_ZOAR_SSPTXD_HIGH
; 88   : //force gpio 87 low
; 89   :     pins[0] = 1;  //SPECIFY 3 PIN ITEMS
; 90   :     pins[1] =  87; //ssptxd2
; 91   :     fn[0] = 1;
; 92   :     fn[1] = XLLP_GPIO_ALT_FN_0;  ////no alt function, use as gpio
; 93   :     XllpGpioSetOutput0((XLLP_GPIO_T *)pGPIO, pins);
; 94   :     XllpGpioSetDirectionOut((XLLP_GPIO_T *)pGPIO, pins);
; 95   :     XllpGpioSetAlternateFn((XLLP_GPIO_T *)pGPIO, pins, fn);
; 96   : #endif
; 97   : */
; 98   : 
; 99   :     // Set bitclk, sdata_in_0
; 100  : 	pins[0] = 2;
; 101  :     pins[1] = XLLP_GPIO_AC97BITCLK;
; 102  :     pins[2] = XLLP_GPIO_AC97_SDATA_IN_0;
; 103  :     fn[0] = 2;
; 104  :     fn[1] = XLLP_GPIO_ALT_FN_1;
; 105  :     fn[2] = XLLP_GPIO_ALT_FN_1;
; 106  :     if (XLLP_TRUE == pAc97ctxt->bUseSecondaryCodec)

  0000c	e5953020	 ldr         r3, [r5, #0x20]
  00010	e3a0101c	 mov         r1, #0x1C
  00014	e3a0001d	 mov         r0, #0x1D
  00018	e5954004	 ldr         r4, [r5, #4]
  0001c	e3530001	 cmp         r3, #1
  00020	e3a02002	 mov         r2, #2
  00024	e3a0e002	 mov         lr, #2
  00028	e58d1034	 str         r1, [sp, #0x34]
  0002c	e58d0038	 str         r0, [sp, #0x38]

; 107  :     {
; 108  : 		pins[0] = 3;
; 109  : 		pins[3] = XLLP_GPIO_KP_MKIN5;      // use this pin as AC97_SDATA_IN_1 
; 110  : 		fn[0] = 3;

  00030	03a01003	 moveq       r1, #3

; 111  : 		fn[3] = XLLP_GPIO_ALT_FN_2;

  00034	03a00002	 moveq       r0, #2
  00038	e58d2030	 str         r2, [sp, #0x30]
  0003c	e58de000	 str         lr, [sp]
  00040	058d1000	 streq       r1, [sp]
  00044	058d000c	 streq       r0, [sp, #0xC]
  00048	e3a07001	 mov         r7, #1
  0004c	e3a08001	 mov         r8, #1
  00050	e5956010	 ldr         r6, [r5, #0x10]
  00054	03a03003	 moveq       r3, #3
  00058	03a02063	 moveq       r2, #0x63

; 112  : 	}
; 113  : 	XllpGpioSetDirectionIn((XLLP_GPIO_T *)pGPIO, pins);

  0005c	e28d1030	 add         r1, sp, #0x30
  00060	e1a00004	 mov         r0, r4
  00064	e58d7004	 str         r7, [sp, #4]
  00068	e58d8008	 str         r8, [sp, #8]
  0006c	058d3030	 streq       r3, [sp, #0x30]
  00070	058d203c	 streq       r2, [sp, #0x3C]
  00074	eb000000	 bl          XllpGpioSetDirectionIn

; 114  :     XllpGpioSetAlternateFn((XLLP_GPIO_T *)pGPIO, pins, fn);

⌨️ 快捷键说明

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