; generated by ARM/Thumb C/C++ Compiler with , RVCT3.1 [Build 942] for uVision
; commandline ArmCC [--split_sections --debug -c --asm --interleave -o.\Int_Flash\usb_pwr.o --depend=.\Int_Flash\usb_pwr.d --device=DARMSTM --apcs=interwork -O3 -I..\include -I..\..\..\..\..\INC\ST\STM32F10x\USB -Id:\Keil\ARM\INC\ST\STM32F10x -D__MICROLIB --omf_browse=.\Int_Flash\usb_pwr.crf ..\source\usb_pwr.c]
THUMB
AREA ||i.PowerOn||, CODE, READONLY, ALIGN=2
PowerOn PROC
;;;49 RESULT PowerOn(void)
;;;50 {
000000 b510 PUSH {r4,lr}
;;;51 u16 wRegVal;
;;;52
;;;53 /*** cable plugged-in ? ***/
;;;54 /*while(!CablePluggedIn());*/
;;;55 USB_Cable_Config(ENABLE);
000002 2001 MOVS r0,#1
000004 f7fffffe BL USB_Cable_Config
;;;56
;;;57 /*** CNTR_PWDN = 0 ***/
;;;58 wRegVal = CNTR_FRES;
000008 4806 LDR r0,|L1.36|
00000a 2101 MOVS r1,#1
;;;59 _SetCNTR(wRegVal);
00000c 6001 STR r1,[r0,#0]
;;;60
;;;61 /*** CNTR_FRES = 0 ***/
;;;62 wInterrupt_Mask = 0;
00000e 2100 MOVS r1,#0
000010 4a05 LDR r2,|L1.40|
;;;63 _SetCNTR(wInterrupt_Mask);
000012 6001 STR r1,[r0,#0]
;;;64 /*** Clear pending interrupts ***/
;;;65 _SetISTR(0);
000014 6041 STR r1,[r0,#4]
;;;66 /*** Set interrupt mask ***/
;;;67 wInterrupt_Mask = CNTR_RESETM | CNTR_SUSPM | CNTR_WKUPM;
000016 f44f51e0 MOV r1,#0x1c00
00001a 8011 STRH r1,[r2,#0] ; wInterrupt_Mask
;;;68 _SetCNTR(wInterrupt_Mask);
00001c 6001 STR r1,[r0,#0]
;;;69
;;;70 return USB_SUCCESS;
00001e 2000 MOVS r0,#0
;;;71 }
000020 bd10 POP {r4,pc}
;;;72
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
;;;80 RESULT PowerOff()
;;;81 {
000000 b510 PUSH {r4,lr}
;;;82 /* disable all ints and force USB reset */
;;;83 _SetCNTR(CNTR_FRES);
000002 4c05 LDR r4,|L2.24|
000004 2001 MOVS r0,#1
000006 6020 STR r0,[r4,#0]
;;;84 /* clear interrupt status register */
;;;85 _SetISTR(0);
000008 2000 MOVS r0,#0
00000a 6060 STR r0,[r4,#4]
;;;86 /* Disable the Pull-Up*/
;;;87 USB_Cable_Config(DISABLE);
00000c f7fffffe BL USB_Cable_Config
;;;88 /* switch-off device */
;;;89 _SetCNTR(CNTR_FRES + CNTR_PDWN);
000010 2003 MOVS r0,#3
000012 6020 STR r0,[r4,#0]
;;;90 /* sw variables reset */
;;;91 /* ... */
;;;92
;;;93 return USB_SUCCESS;
000014 2000 MOVS r0,#0
;;;94 }
000016 bd10 POP {r4,pc}
;;;95
ENDP
|L2.24|
000018 40005c40 DCD 0x40005c40
AREA ||i.Suspend||, CODE, READONLY, ALIGN=2
Suspend PROC
;;;103 void Suspend(void)
;;;104 {
000000 4806 LDR r0,|L3.28|
;;;105 u16 wCNTR;
;;;106 /* suspend preparation */
;;;107 /* ... */
;;;108
;;;109 /* macrocell enters suspend mode */
;;;110 wCNTR = _GetCNTR();
000002 6801 LDR r1,[r0,#0]
000004 b289 UXTH r1,r1
;;;111 wCNTR |= CNTR_FSUSP;
000006 f0410108 ORR r1,r1,#8
;;;112 _SetCNTR(wCNTR);
00000a 6001 STR r1,[r0,#0]
;;;113
;;;114 /* ------------------ ONLY WITH BUS-POWERED DEVICES ---------------------- */
;;;115 /* power reduction */
;;;116 /* ... on connected devices */
;;;117
;;;118
;;;119 /* force low-power mode in the macrocell */
;;;120 wCNTR = _GetCNTR();
00000c 6801 LDR r1,[r0,#0]
00000e b289 UXTH r1,r1
;;;121 wCNTR |= CNTR_LPMODE;
000010 f0410104 ORR r1,r1,#4
;;;122 _SetCNTR(wCNTR);
000014 6001 STR r1,[r0,#0]
;;;123
;;;124 /* switch-off the clocks */
;;;125 /* ... */
;;;126 Enter_LowPowerMode();
000016 f7ffbffe B.W Enter_LowPowerMode
;;;127
;;;128 }
;;;129
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
;;;173 void Resume(RESUME_STATE eResumeSetVal)
;;;174 {
000000 b570 PUSH {r4-r6,lr}
000002 4c1e LDR r4,|L5.124|
;;;175 u16 wCNTR;
;;;176
;;;177 if (eResumeSetVal != RESUME_ESOF)
000004 2807 CMP r0,#7
000006 d000 BEQ |L5.10|
;;;178 ResumeS.eState = eResumeSetVal;
000008 7020 STRB r0,[r4,#0] ; ResumeS
|L5.10|
;;;179
;;;180 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
;;;181 {
;;;182 case RESUME_EXTERNAL:
;;;183 Resume_Init();
000020 f7fffffe BL Resume_Init
;;;184 ResumeS.eState = RESUME_OFF;
;;;185 break;
000024 e028 B |L5.120|
;;;186 case RESUME_INTERNAL:
;;;187 Resume_Init();
000026 f7fffffe BL Resume_Init
;;;188 ResumeS.eState = RESUME_START;
;;;189 break;
00002a e00a B |L5.66|
;;;190 case RESUME_LATER:
;;;191 ResumeS.bESOFcnt = 2;
00002c 2002 MOVS r0,#2
00002e 7060 STRB r0,[r4,#1] ; ResumeS
;;;192 ResumeS.eState = RESUME_WAIT;
000030 2003 MOVS r0,#3
000032 7020 STRB r0,[r4,#0] ; ResumeS
|L5.52|
;;;193 break;
;;;194 case RESUME_WAIT:
;;;195 ResumeS.bESOFcnt--;
;;;196 if (ResumeS.bESOFcnt == 0)
;;;197 ResumeS.eState = RESUME_START;
;;;198 break;
;;;199 case RESUME_START:
;;;200 wCNTR = _GetCNTR();
;;;201 wCNTR |= CNTR_RESUME;
;;;202 _SetCNTR(wCNTR);
;;;203 ResumeS.eState = RESUME_ON;
;;;204 ResumeS.bESOFcnt = 10;
;;;205 break;
;;;206 case RESUME_ON:
;;;207 ResumeS.bESOFcnt--;
;;;208 if (ResumeS.bESOFcnt == 0)
;;;209 {
;;;210 wCNTR = _GetCNTR();
;;;211 wCNTR &= (~CNTR_RESUME);
;;;212 _SetCNTR(wCNTR);
;;;213 ResumeS.eState = RESUME_OFF;
;;;214 }
;;;215 break;
;;;216 case RESUME_OFF:
;;;217 case RESUME_ESOF:
;;;218 default:
;;;219 ResumeS.eState = RESUME_OFF;
;;;220 break;
;;;221 }
;;;222 }
000034 bd70 POP {r4-r6,pc}
000036 7860 LDRB r0,[r4,#1] ;195 ; ResumeS
000038 1e40 SUBS r0,r0,#1 ;195
00003a 7060 STRB r0,[r4,#1] ;195 ; ResumeS
00003c 7860 LDRB r0,[r4,#1] ;196 ; ResumeS
00003e 2800 CMP r0,#0 ;196
000040 d1f8 BNE |L5.52|
|L5.66|
000042 7026 STRB r6,[r4,#0] ;197 ; ResumeS
000044 bd70 POP {r4-r6,pc}
000046 f8d10c40 LDR r0,[r1,#0xc40] ;200
00004a b280 UXTH r0,r0 ;200
00004c f0400010 ORR r0,r0,#0x10 ;201
000050 f8c10c40 STR r0,[r1,#0xc40] ;202
000054 2005 MOVS r0,#5 ;203
000056 7020 STRB r0,[r4,#0] ;203 ; ResumeS
000058 200a MOVS r0,#0xa ;204
00005a 7060 STRB r0,[r4,#1] ;204 ; ResumeS
|L5.92|
00005c bd70 POP {r4-r6,pc}
00005e 7860 LDRB r0,[r4,#1] ;207 ; ResumeS
000060 1e40 SUBS r0,r0,#1 ;207
000062 7060 STRB r0,[r4,#1] ;207 ; ResumeS
000064 7860 LDRB r0,[r4,#1] ;208 ; ResumeS
000066 2800 CMP r0,#0 ;208
000068 d1f8 BNE |L5.92|
00006a f8d10c40 LDR r0,[r1,#0xc40] ;210
00006e b280 UXTH r0,r0 ;210
000070 f0200010 BIC r0,r0,#0x10 ;211
000074 f8c10c40 STR r0,[r1,#0xc40] ;212
|L5.120|
000078 7025 STRB r5,[r4,#0] ;219 ; ResumeS
00007a bd70 POP {r4-r6,pc}
;;;223
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=2
EXPORTAS |area_number.7|, ||.data||
bDeviceState
000000 00000000 DCD 0x00000000
AREA |area_number.8|, DATA, ALIGN=0
EXPORTAS |area_number.8|, ||.data||
fSuspendEnabled
000000 01 DCB 0x01