📄 usb_pwr.txt
字号:
; generated by ARM/Thumb C/C++ Compiler with , RVCT3.1 [Build 938] for uVision
; commandline ArmCC [--split_sections --debug -c --asm --interleave -o.\Obj\usb_pwr.o --depend=.\Obj\usb_pwr.d --device=DARMSTM --apcs=interwork -O3 -I.\Code\FATSystem\INC -I.\Code\Library\INC -I.\Code\SDCard\INC -I.\Code\Speaker\INC -I.\Code\System\INC -I.\Code\USBMassStorage\INC -I.\Code\User\INC -I.\Code\VS1003\INC -ID:\Keil\ARM\INC\ST\STM32F10x --omf_browse=.\Obj\usb_pwr.crf Code\USBMassStorage\SRC\usb_pwr.c]
THUMB
AREA ||i.PowerOn||, CODE, READONLY, ALIGN=2
PowerOn PROC
;;;53 RESULT PowerOn(void)
;;;54 {
000000 b510 PUSH {r4,lr}
;;;55 u16 wRegVal;
;;;56
;;;57 /*** cable plugged-in ? ***/
;;;58 /*while(!CablePluggedIn());*/
;;;59 USB_Cable_Config(ENABLE);
000002 2001 MOVS r0,#1
000004 f7fffffe BL USB_Cable_Config
;;;60
;;;61 /*** CNTR_PWDN = 0 ***/
;;;62 wRegVal = CNTR_FRES;
000008 4806 LDR r0,|L1.36|
00000a 2101 MOVS r1,#1
;;;63 _SetCNTR(wRegVal);
00000c 6001 STR r1,[r0,#0]
;;;64
;;;65 /*** CNTR_FRES = 0 ***/
;;;66 wInterrupt_Mask = 0;
00000e 2100 MOVS r1,#0
000010 4a05 LDR r2,|L1.40|
;;;67 _SetCNTR(wInterrupt_Mask);
000012 6001 STR r1,[r0,#0]
;;;68 /*** Clear pending interrupts ***/
;;;69 _SetISTR(0);
000014 6041 STR r1,[r0,#4]
;;;70 /*** Set interrupt mask ***/
;;;71 wInterrupt_Mask = CNTR_RESETM | CNTR_SUSPM | CNTR_WKUPM;
000016 f44f51e0 MOV r1,#0x1c00
00001a 8011 STRH r1,[r2,#0] ; wInterrupt_Mask
;;;72 _SetCNTR(wInterrupt_Mask);
00001c 6001 STR r1,[r0,#0]
;;;73
;;;74 return USB_SUCCESS;
00001e 2000 MOVS r0,#0
;;;75 }
000020 bd10 POP {r4,pc}
;;;76
ENDP
000022 0000 DCW 0x0000
|L1.36|
000024 40005c40 DCD 0x40005c40
|L1.40|
000028 00000000 DCD wInterrupt_Mask
AREA ||i.PowerOff||, CODE, READONLY, ALIGN=2
PowerOff PROC
;;;84 RESULT PowerOff()
;;;85 {
000000 b510 PUSH {r4,lr}
;;;86 /* disable all ints and force USB reset */
;;;87 _SetCNTR(CNTR_FRES);
000002 4c05 LDR r4,|L2.24|
000004 2001 MOVS r0,#1
000006 6020 STR r0,[r4,#0]
;;;88 /* clear interrupt status register */
;;;89 _SetISTR(0);
000008 2000 MOVS r0,#0
00000a 6060 STR r0,[r4,#4]
;;;90 /* Disable the Pull-Up*/
;;;91 USB_Cable_Config(DISABLE);
00000c f7fffffe BL USB_Cable_Config
;;;92 /* switch-off device */
;;;93 _SetCNTR(CNTR_FRES + CNTR_PDWN);
000010 2003 MOVS r0,#3
000012 6020 STR r0,[r4,#0]
;;;94 /* sw variables reset */
;;;95 /* ... */
;;;96
;;;97 return USB_SUCCESS;
000014 2000 MOVS r0,#0
;;;98 }
000016 bd10 POP {r4,pc}
;;;99
ENDP
|L2.24|
000018 40005c40 DCD 0x40005c40
AREA ||i.Suspend||, CODE, READONLY, ALIGN=2
Suspend PROC
;;;107 void Suspend(void)
;;;108 {
000000 4806 LDR r0,|L3.28|
;;;109 u16 wCNTR;
;;;110 /* suspend preparation */
;;;111 /* ... */
;;;112
;;;113 /* macrocell enters suspend mode */
;;;114 wCNTR = _GetCNTR();
000002 6801 LDR r1,[r0,#0]
000004 b289 UXTH r1,r1
;;;115 wCNTR |= CNTR_FSUSP;
000006 f0410108 ORR r1,r1,#8
;;;116 _SetCNTR(wCNTR);
00000a 6001 STR r1,[r0,#0]
;;;117
;;;118 /* ------------------ ONLY WITH BUS-POWERED DEVICES ---------------------- */
;;;119 /* power reduction */
;;;120 /* ... on connected devices */
;;;121
;;;122
;;;123 /* force low-power mode in the macrocell */
;;;124 wCNTR = _GetCNTR();
00000c 6801 LDR r1,[r0,#0]
00000e b289 UXTH r1,r1
;;;125 wCNTR |= CNTR_LPMODE;
000010 f0410104 ORR r1,r1,#4
;;;126 _SetCNTR(wCNTR);
000014 6001 STR r1,[r0,#0]
;;;127
;;;128 /* switch-off the clocks */
;;;129 /* ... */
;;;130 Enter_LowPowerMode();
000016 f7ffbffe B.W Enter_LowPowerMode
;;;131
;;;132 }
;;;133
ENDP
00001a 0000 DCW 0x0000
|L3.28|
00001c 40005c40 DCD 0x40005c40
AREA ||i.Resume_Init||, CODE, READONLY, ALIGN=2
Resume_Init PROC
000000 b510 PUSH {r4,lr}
000002 4c06 LDR r4,|L4.28|
000004 6820 LDR r0,[r4,#0]
000006 b280 UXTH r0,r0
000008 f0200004 BIC r0,r0,#4
00000c 6020 STR r0,[r4,#0]
00000e f7fffffe BL Leave_LowPowerMode
000012 f44f4004 MOV r0,#0x8400
000016 6020 STR r0,[r4,#0]
000018 bd10 POP {r4,pc}
ENDP
00001a 0000 DCW 0x0000
|L4.28|
00001c 40005c40 DCD 0x40005c40
AREA ||i.Resume||, CODE, READONLY, ALIGN=2
Resume PROC
;;;177 void Resume(RESUME_STATE eResumeSetVal)
;;;178 {
000000 b570 PUSH {r4-r6,lr}
000002 4c1e LDR r4,|L5.124|
;;;179 u16 wCNTR;
;;;180
;;;181 if (eResumeSetVal != RESUME_ESOF)
000004 2807 CMP r0,#7
000006 d000 BEQ |L5.10|
;;;182 ResumeS.eState = eResumeSetVal;
000008 7020 STRB r0,[r4,#0] ; ResumeS
|L5.10|
;;;183
;;;184 switch (ResumeS.eState)
00000a 7820 LDRB r0,[r4,#0] ; ResumeS
00000c 2506 MOVS r5,#6
00000e 2604 MOVS r6,#4
000010 491b LDR r1,|L5.128|
000012 2806 CMP r0,#6
000014 d230 BCS |L5.120|
000016 e8dff000 TBB [pc,r0]
00001a 0306090e DCB 0x03,0x06,0x09,0x0e
00001e 1622 DCB 0x16,0x22
;;;185 {
;;;186 case RESUME_EXTERNAL:
;;;187 Resume_Init();
000020 f7fffffe BL Resume_Init
;;;188 ResumeS.eState = RESUME_OFF;
;;;189 break;
000024 e028 B |L5.120|
;;;190 case RESUME_INTERNAL:
;;;191 Resume_Init();
000026 f7fffffe BL Resume_Init
;;;192 ResumeS.eState = RESUME_START;
;;;193 break;
00002a e00a B |L5.66|
;;;194 case RESUME_LATER:
;;;195 ResumeS.bESOFcnt = 2;
00002c 2002 MOVS r0,#2
00002e 7060 STRB r0,[r4,#1] ; ResumeS
;;;196 ResumeS.eState = RESUME_WAIT;
000030 2003 MOVS r0,#3
000032 7020 STRB r0,[r4,#0] ; ResumeS
|L5.52|
;;;197 break;
;;;198 case RESUME_WAIT:
;;;199 ResumeS.bESOFcnt--;
;;;200 if (ResumeS.bESOFcnt == 0)
;;;201 ResumeS.eState = RESUME_START;
;;;202 break;
;;;203 case RESUME_START:
;;;204 wCNTR = _GetCNTR();
;;;205 wCNTR |= CNTR_RESUME;
;;;206 _SetCNTR(wCNTR);
;;;207 ResumeS.eState = RESUME_ON;
;;;208 ResumeS.bESOFcnt = 10;
;;;209 break;
;;;210 case RESUME_ON:
;;;211 ResumeS.bESOFcnt--;
;;;212 if (ResumeS.bESOFcnt == 0)
;;;213 {
;;;214 wCNTR = _GetCNTR();
;;;215 wCNTR &= (~CNTR_RESUME);
;;;216 _SetCNTR(wCNTR);
;;;217 ResumeS.eState = RESUME_OFF;
;;;218 }
;;;219 break;
;;;220 case RESUME_OFF:
;;;221 case RESUME_ESOF:
;;;222 default:
;;;223 ResumeS.eState = RESUME_OFF;
;;;224 break;
;;;225 }
;;;226 }
000034 bd70 POP {r4-r6,pc}
000036 7860 LDRB r0,[r4,#1] ;199 ; ResumeS
000038 1e40 SUBS r0,r0,#1 ;199
00003a 7060 STRB r0,[r4,#1] ;199 ; ResumeS
00003c 7860 LDRB r0,[r4,#1] ;200 ; ResumeS
00003e 2800 CMP r0,#0 ;200
000040 d1f8 BNE |L5.52|
|L5.66|
000042 7026 STRB r6,[r4,#0] ;201 ; ResumeS
000044 bd70 POP {r4-r6,pc}
000046 f8d10c40 LDR r0,[r1,#0xc40] ;204
00004a b280 UXTH r0,r0 ;204
00004c f0400010 ORR r0,r0,#0x10 ;205
000050 f8c10c40 STR r0,[r1,#0xc40] ;206
000054 2005 MOVS r0,#5 ;207
000056 7020 STRB r0,[r4,#0] ;207 ; ResumeS
000058 200a MOVS r0,#0xa ;208
00005a 7060 STRB r0,[r4,#1] ;208 ; ResumeS
|L5.92|
00005c bd70 POP {r4-r6,pc}
00005e 7860 LDRB r0,[r4,#1] ;211 ; ResumeS
000060 1e40 SUBS r0,r0,#1 ;211
000062 7060 STRB r0,[r4,#1] ;211 ; ResumeS
000064 7860 LDRB r0,[r4,#1] ;212 ; ResumeS
000066 2800 CMP r0,#0 ;212
000068 d1f8 BNE |L5.92|
00006a f8d10c40 LDR r0,[r1,#0xc40] ;214
00006e b280 UXTH r0,r0 ;214
000070 f0200010 BIC r0,r0,#0x10 ;215
000074 f8c10c40 STR r0,[r1,#0xc40] ;216
|L5.120|
000078 7025 STRB r5,[r4,#0] ;223 ; ResumeS
00007a bd70 POP {r4-r6,pc}
;;;227
ENDP
|L5.124|
00007c 00000000 DCD ||.data||
|L5.128|
000080 40005000 DCD 0x40005000
AREA ||.data||, DATA, ALIGN=0
ResumeS
000000 0000 DCB 0x00,0x00
AREA |area_number.7|, DATA, ALIGN=0
EXPORTAS |area_number.7|, ||.data||
bDeviceState
000000 00 DCB 0x00
AREA |area_number.8|, DATA, ALIGN=0
EXPORTAS |area_number.8|, ||.data||
fSuspendEnabled
000000 01 DCB 0x01
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -