⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usb_pwr.txt

📁 STM32F103ZET6+UCOSII+UCGUI源码
💻 TXT
字号:
; generated by ARM C/C++ Compiler with , RVCT4.0 [Build 524] 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..\..\include -I..\..\..\FWLib\library\inc -I..\..\..\USBLib\library\inc -I..\..\Config -I..\..\GUI\Core -I..\..\GUI\Font -I..\..\GUI\ConvertColor -I..\..\GUI\AntiAlias -I..\..\GUI\ConvertMono -I..\..\GUI\JPEG -I..\..\GUI\MemDev -I..\..\GUI\MultiLayer -I..\..\GUI\Widget -I..\..\GUI\WM -IC:\Keil\ARM\INC\ST\STM32F10x ..\..\source\usb_pwr.c]
                          THUMB

                          AREA ||i.PowerOff||, CODE, READONLY, ALIGN=2

                  PowerOff PROC
;;;79     *******************************************************************************/
;;;80     RESULT PowerOff()
000000  b510              PUSH     {r4,lr}
;;;81     {
;;;82       /* disable all ints and force USB reset */
;;;83       _SetCNTR(CNTR_FRES);
000002  4c05              LDR      r4,|L1.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

                  |L1.24|
                          DCD      0x40005c40

                          AREA ||i.PowerOn||, CODE, READONLY, ALIGN=2

                  PowerOn PROC
;;;48     *******************************************************************************/
;;;49     RESULT PowerOn(void)
000000  b510              PUSH     {r4,lr}
;;;50     {
;;;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,|L2.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,|L2.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]
;;;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
                  |L2.36|
                          DCD      0x40005c40
                  |L2.40|
                          DCD      wInterrupt_Mask

                          AREA ||i.Resume||, CODE, READONLY, ALIGN=2

                  Resume PROC
;;;172    *******************************************************************************/
;;;173    void Resume(RESUME_STATE eResumeSetVal)
000000  b570              PUSH     {r4-r6,lr}
;;;174    {
;;;175      u16 wCNTR;
;;;176    
;;;177      if (eResumeSetVal != RESUME_ESOF)
;;;178        ResumeS.eState = eResumeSetVal;
000002  4c1e              LDR      r4,|L3.124|
000004  2807              CMP      r0,#7                 ;177
000006  d000              BEQ      |L3.10|
000008  7020              STRB     r0,[r4,#0]
                  |L3.10|
;;;179    
;;;180      switch (ResumeS.eState)
00000a  7820              LDRB     r0,[r4,#0]  ; ResumeS
;;;181      {
;;;182        case RESUME_EXTERNAL:
;;;183          Resume_Init();
;;;184          ResumeS.eState = RESUME_OFF;
00000c  2506              MOVS     r5,#6
;;;185          break;
;;;186        case RESUME_INTERNAL:
;;;187          Resume_Init();
;;;188          ResumeS.eState = RESUME_START;
00000e  2604              MOVS     r6,#4
;;;189          break;
;;;190        case RESUME_LATER:
;;;191          ResumeS.bESOFcnt = 2;
;;;192          ResumeS.eState = RESUME_WAIT;
;;;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();
000010  491b              LDR      r1,|L3.128|
000012  2806              CMP      r0,#6                 ;180
000014  d230              BCS      |L3.120|
000016  e8dff000          TBB      [pc,r0]               ;180
00001a  0306              DCB      0x03,0x06
00001c  090e1622          DCB      0x09,0x0e,0x16,0x22
000020  f7fffffe          BL       Resume_Init
000024  e028              B        |L3.120|
000026  f7fffffe          BL       Resume_Init
00002a  e00a              B        |L3.66|
00002c  2002              MOVS     r0,#2                 ;191
00002e  7060              STRB     r0,[r4,#1]            ;191
000030  2003              MOVS     r0,#3                 ;192
000032  7020              STRB     r0,[r4,#0]            ;192
                  |L3.52|
;;;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
00003c  7860              LDRB     r0,[r4,#1]            ;196  ; ResumeS
00003e  2800              CMP      r0,#0                 ;196
000040  d1f8              BNE      |L3.52|
                  |L3.66|
000042  7026              STRB     r6,[r4,#0]            ;197
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
000058  200a              MOVS     r0,#0xa               ;204
00005a  7060              STRB     r0,[r4,#1]            ;204
                  |L3.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
000064  7860              LDRB     r0,[r4,#1]            ;208  ; ResumeS
000066  2800              CMP      r0,#0                 ;208
000068  d1f8              BNE      |L3.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
                  |L3.120|
000078  7025              STRB     r5,[r4,#0]            ;219
00007a  bd70              POP      {r4-r6,pc}
;;;223    
                          ENDP

                  |L3.124|
                          DCD      ||area_number.10||
                  |L3.128|
                          DCD      0x40005000

                          AREA ||i.Resume_Init||, CODE, READONLY, ALIGN=2

                  Resume_Init PROC
;;;136    *******************************************************************************/
;;;137    void Resume_Init(void)
000000  b510              PUSH     {r4,lr}
;;;138    {
000002  4c06              LDR      r4,|L4.28|
;;;139      u16 wCNTR;
;;;140      /* ------------------ ONLY WITH BUS-POWERED DEVICES ---------------------- */
;;;141      /* restart the clocks */
;;;142      /* ...  */
;;;143    
;;;144      /* CNTR_LPMODE = 0 */
;;;145      wCNTR = _GetCNTR();
000004  6820              LDR      r0,[r4,#0]
000006  b280              UXTH     r0,r0
;;;146      wCNTR &= (~CNTR_LPMODE);
000008  f0200004          BIC      r0,r0,#4
;;;147      _SetCNTR(wCNTR);
00000c  6020              STR      r0,[r4,#0]
;;;148    
;;;149      /* restore full power */
;;;150      /* ... on connected devices */
;;;151      Leave_LowPowerMode();
00000e  f7fffffe          BL       Leave_LowPowerMode
;;;152    
;;;153      /* reset FSUSP bit */
;;;154      _SetCNTR(IMR_MSK);
000012  f44f4004          MOV      r0,#0x8400
000016  6020              STR      r0,[r4,#0]
;;;155    
;;;156      /* reverse suspend preparation */
;;;157      /* ... */
;;;158    
;;;159    }
000018  bd10              POP      {r4,pc}
;;;160    
                          ENDP

00001a  0000              DCW      0x0000
                  |L4.28|
                          DCD      0x40005c40

                          AREA ||i.Suspend||, CODE, READONLY, ALIGN=2

                  Suspend PROC
;;;102    *******************************************************************************/
;;;103    void Suspend(void)
000000  4806              LDR      r0,|L5.28|
;;;104    {
;;;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
                  |L5.28|
                          DCD      0x40005c40

                          AREA ||.data||, DATA, ALIGN=2

                  bDeviceState
                          DCD      0x00000000

                          AREA ||area_number.9||, DATA, ALIGN=0

                          EXPORTAS ||area_number.9||, ||.data||
                  fSuspendEnabled
000000  01                DCB      0x01

                          AREA ||area_number.10||, DATA, ALIGN=0

                          EXPORTAS ||area_number.10||, ||.data||
                  ResumeS
000000  0000              DCB      0x00,0x00

⌨️ 快捷键说明

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