; generated by ARM C/C++ Compiler with , RVCT4.0 [Build 524] for uVision
; commandline ArmCC [--split_sections --debug -c --asm --interleave -o.\Obj\usb_int.o --depend=.\Obj\usb_int.d --device=DARMSTM --apcs=interwork -O3 -I.\usb_library\inc -Id:\Keil\ARM\INC\ST\STM32F10x -D__MICROLIB -DVECT_TAB_FLASH --omf_browse=.\Obj\usb_int.crf usb_library\src\usb_int.c]
                          THUMB

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

                  CTR_HP PROC
;;;155    *******************************************************************************/
;;;156    void CTR_HP(void)
000000  e92d41f0          PUSH     {r4-r8,lr}
;;;157    {
;;;158      u32 wEPVal;
;;;159    
;;;160      while (((wIstr = _GetISTR()) & ISTR_CTR) != 0)
;;;161      {
;;;162        _SetISTR((u16)CLR_CTR); /* clear CTR flag */
;;;163        /* extract highest priority endpoint number */
;;;164        EPindex = (u8)(wIstr & ISTR_EP_ID);
000004  4d1e              LDR      r5,|L1.128|
000006  4e1f              LDR      r6,|L1.132|
000008  4f1f              LDR      r7,|L1.136|
00000a  e032              B        |L1.114|
                  |L1.12|
00000c  f64770ff          MOV      r0,#0x7fff            ;162
000010  f8c60c44          STR      r0,[r6,#0xc44]        ;162
000014  8838              LDRH     r0,[r7,#0]  ; wIstr
000016  f000000f          AND      r0,r0,#0xf
00001a  7028              STRB     r0,[r5,#0]
;;;165        /* process related endpoint register */
;;;166        wEPVal = _GetENDPOINT(EPindex);
00001c  b2c0              UXTB     r0,r0
00001e  eb060080          ADD      r0,r6,r0,LSL #2
000022  f8d01c00          LDR      r1,[r0,#0xc00]
000026  b28c              UXTH     r4,r1
;;;167        if ((wEPVal & EP_CTR_RX) != 0)
000028  0421              LSLS     r1,r4,#16
00002a  d50e              BPL      |L1.74|
;;;168        {
;;;169          /* clear int flag */
;;;170          _ClearEP_CTR_RX(EPindex);
00002c  f8d01c00          LDR      r1,[r0,#0xc00]
000030  f640728f          MOV      r2,#0xf8f
000034  b289              UXTH     r1,r1
000036  4011              ANDS     r1,r1,r2
000038  f8c01c00          STR      r1,[r0,#0xc00]
;;;171    
;;;172          /* call OUT service function */
;;;173          (*pEpInt_OUT[EPindex-1])();
00003c  4813              LDR      r0,|L1.140|
00003e  7829              LDRB     r1,[r5,#0]  ; EPindex
000040  eb000081          ADD      r0,r0,r1,LSL #2
000044  f8500c04          LDR      r0,[r0,#-4]
000048  4780              BLX      r0
                  |L1.74|
;;;174    
;;;175        } /* if((wEPVal & EP_CTR_RX) */
;;;176        if ((wEPVal & EP_CTR_TX) != 0)
00004a  0620              LSLS     r0,r4,#24
00004c  d511              BPL      |L1.114|
;;;177        {
;;;178          /* clear int flag */
;;;179          _ClearEP_CTR_TX(EPindex);
00004e  7828              LDRB     r0,[r5,#0]  ; EPindex
000050  eb060080          ADD      r0,r6,r0,LSL #2
000054  f8d01c00          LDR      r1,[r0,#0xc00]
000058  f648720f          MOV      r2,#0x8f0f
00005c  b289              UXTH     r1,r1
00005e  4011              ANDS     r1,r1,r2
000060  f8c01c00          STR      r1,[r0,#0xc00]
;;;180    
;;;181          /* call IN service function */
;;;182          (*pEpInt_IN[EPindex-1])();
000064  480a              LDR      r0,|L1.144|
000066  7829              LDRB     r1,[r5,#0]  ; EPindex
000068  eb000081          ADD      r0,r0,r1,LSL #2
00006c  f8500c04          LDR      r0,[r0,#-4]
000070  4780              BLX      r0
                  |L1.114|
000072  f8d60c44          LDR      r0,[r6,#0xc44]        ;160
000076  8038              STRH     r0,[r7,#0]            ;160
000078  0400              LSLS     r0,r0,#16             ;160
00007a  d4c7              BMI      |L1.12|
;;;183    
;;;184    
;;;185        } /* if((wEPVal & EP_CTR_TX) != 0) */
;;;186    
;;;187      }/* while(...) */
;;;188    }
00007c  e8bd81f0          POP      {r4-r8,pc}
;;;189    
                          ENDP

                  |L1.128|
                          DCD      EPindex
                  |L1.132|
                          DCD      0x40005000
                  |L1.136|
                          DCD      wIstr
                  |L1.140|
                          DCD      pEpInt_OUT
                  |L1.144|
                          DCD      pEpInt_IN

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

                  CTR_LP PROC
;;;40     *******************************************************************************/
;;;41     void CTR_LP(void)
000000  e92d5ff0          PUSH     {r4-r12,lr}
;;;42     {
;;;43       u32 wEPVal;
;;;44       /* stay in loop while pending ints */
;;;45       while (((wIstr = _GetISTR()) & ISTR_CTR) != 0)
;;;46       {
;;;47         _SetISTR((u16)CLR_CTR); /* clear CTR flag */
;;;48         /* extract highest priority endpoint number */
;;;49         EPindex = (u8)(wIstr & ISTR_EP_ID);
;;;50         if (EPindex == 0)
;;;51         {
;;;52           /* Decode and service control endpoint interrupt */
;;;53           /* calling related service routine */
;;;54           /* (Setup0_Process, In0_Process, Out0_Process) */
;;;55     
;;;56           /* save RX & TX status */
;;;57           /* and set both to NAK */
;;;58           SaveRState = _GetEPRxStatus(ENDP0);
;;;59           SaveTState = _GetEPTxStatus(ENDP0);
;;;60           _SetEPRxStatus(ENDP0, EP_RX_NAK);
000004  f64b788f          MOV      r8,#0xbf8f
000008  f8df9178          LDR      r9,|L2.388|
;;;61           _SetEPTxStatus(ENDP0, EP_TX_NAK);
;;;62     
;;;63     
;;;64           /* DIR bit = origin of the interrupt */
;;;65     
;;;66           if ((wIstr & ISTR_DIR) == 0)
;;;67           {
;;;68             /* DIR = 0 */
;;;69     
;;;70             /* DIR = 0      => IN  int */
;;;71             /* DIR = 0 implies that (EP_CTR_TX = 1) always  */
;;;72     
;;;73     
;;;74             _ClearEP_CTR_TX(ENDP0);
;;;75             In0_Process();
;;;76     
;;;77             /* check if SETUP arrived during IN processing */
;;;78             wEPVal = _GetENDPOINT(ENDP0);
;;;79             if ((wEPVal & (EP_CTR_RX | EP_SETUP)) != 0)
;;;80             {
;;;81               _ClearEP_CTR_RX(ENDP0); /* SETUP bit kept frozen while CTR_RX = 1 */
00000c  f640768f          MOV      r6,#0xf8f
000010  f6487a0f          MOV      r10,#0x8f0f           ;74
000014  4d5c              LDR      r5,|L2.392|
000016  f8dfb174          LDR      r11,|L2.396|
;;;82               Setup0_Process();
;;;83             }
;;;84     
;;;85           }
;;;86     
;;;87           else
;;;88           {
;;;89             /* DIR = 1 */
;;;90     
;;;91             /* DIR = 1 & CTR_RX       => SETUP or OUT int */
;;;92             /* DIR = 1 & (CTR_TX | CTR_RX) => 2 int pending */
;;;93     
;;;94             wEPVal = _GetENDPOINT(ENDP0);
;;;95             if ((wEPVal & EP_CTR_TX) != 0)
;;;96             {
;;;97               _ClearEP_CTR_TX(ENDP0);
;;;98               In0_Process();
;;;99             }
;;;100            if ((wEPVal &EP_SETUP) != 0)
;;;101            {
;;;102              _ClearEP_CTR_RX(ENDP0); /* SETUP bit kept frozen while CTR_RX = 1 */
;;;103              Setup0_Process();
;;;104            }
;;;105    
;;;106            else if ((wEPVal & EP_CTR_RX) != 0)
;;;107            {
;;;108              _ClearEP_CTR_RX(ENDP0);
;;;109              Out0_Process();
;;;110            }
;;;111    
;;;112          }
;;;113    
;;;114          /* before terminate set Tx & Rx status */
;;;115          _SetEPRxStatus(ENDP0, SaveRState);
;;;116          _SetEPTxStatus(ENDP0, SaveTState);
;;;117        }/* if(EPindex == 0) */
;;;118        else
;;;119        {
;;;120          /* Decode and service non control endpoints interrupt  */
;;;121    
;;;122          /* process related endpoint register */
;;;123          wEPVal = _GetENDPOINT(EPindex);
;;;124          if ((wEPVal & EP_CTR_RX) != 0)
;;;125          {
;;;126            /* clear int flag */
;;;127            _ClearEP_CTR_RX(EPindex);
;;;128    
;;;129            /* call OUT service function */
;;;130            (*pEpInt_OUT[EPindex-1])();
;;;131    
;;;132          } /* if((wEPVal & EP_CTR_RX) */
;;;133    
;;;134          if ((wEPVal & EP_CTR_TX) != 0)
;;;135          {
;;;136            /* clear int flag */
;;;137            _ClearEP_CTR_TX(EPindex);
;;;138    
;;;139            /* call IN service function */
;;;140            (*pEpInt_IN[EPindex-1])();
00001a  e0a8              B        |L2.366|
                  |L2.28|
00001c  f64771ff          MOV      r1,#0x7fff            ;47
000020  f8c51c44          STR      r1,[r5,#0xc44]        ;47
000024  8801              LDRH     r1,[r0,#0]            ;49  ; wIstr
000026  4f5a              LDR      r7,|L2.400|
000028  f001010f          AND      r1,r1,#0xf            ;49
00002c  7039              STRB     r1,[r7,#0]            ;49
00002e  b2c9              UXTB     r1,r1                 ;50
000030  2900              CMP      r1,#0                 ;50
000032  d175              BNE      |L2.288|
000034  f5056540          ADD      r5,r5,#0xc00          ;50
000038  682a              LDR      r2,[r5,#0]            ;58
00003a  f3c23201          UBFX     r2,r2,#12,#2          ;58
00003e  0312              LSLS     r2,r2,#12             ;58
000040  f8a92000          STRH     r2,[r9,#0]            ;58
000044  682a              LDR      r2,[r5,#0]            ;59
000046  f3c21201          UBFX     r2,r2,#4,#2           ;59
00004a  ea4f1202          LSL      r2,r2,#4              ;59
00004e  f8a92002          STRH     r2,[r9,#2]            ;59
000052  6829              LDR      r1,[r5,#0]            ;60
000054  b289              UXTH     r1,r1                 ;60
000056  ea010108          AND      r1,r1,r8              ;60
00005a  f4815100          EOR      r1,r1,#0x2000         ;60
00005e  6029              STR      r1,[r5,#0]            ;60
000060  6829              LDR      r1,[r5,#0]            ;61
000062  f64877bf          MOV      r7,#0x8fbf            ;61
000066  b289              UXTH     r1,r1                 ;61
000068  4039              ANDS     r1,r1,r7              ;61
00006a  f0810120          EOR      r1,r1,#0x20           ;61
00006e  6029              STR      r1,[r5,#0]            ;61
000070  8800              LDRH     r0,[r0,#0]            ;66  ; wIstr
000072  f5a56540          SUB      r5,r5,#0xc00          ;61
000076  06c0              LSLS     r0,r0,#27             ;66
000078  f8d50c00          LDR      r0,[r5,#0xc00]        ;74
00007c  d40c              BMI      |L2.152|
00007e  b280              UXTH     r0,r0                 ;74
000080  ea00000a          AND      r0,r0,r10             ;74
000084  f8c50c00          STR      r0,[r5,#0xc00]        ;74
000088  f7fffffe          BL       In0_Process
00008c  f8d50c00          LDR      r0,[r5,#0xc00]        ;78
000090  f4104f08          TST      r0,#0x8800            ;79
000094  d021              BEQ      |L2.218|
000096  e00d              B        |L2.180|
                  |L2.152|
000098  b284              UXTH     r4,r0                 ;94
00009a  0620              LSLS     r0,r4,#24             ;95
00009c  d508              BPL      |L2.176|
00009e  f8d50c00          LDR      r0,[r5,#0xc00]        ;97
0000a2  b280              UXTH     r0,r0                 ;97
0000a4  ea00000a          AND      r0,r0,r10             ;97
0000a8  f8c50c00          STR      r0,[r5,#0xc00]        ;97
0000ac  f7fffffe          BL       In0_Process
                  |L2.176|
0000b0  0520              LSLS     r0,r4,#20             ;100
0000b2  d508              BPL      |L2.198|
                  |L2.180|
0000b4  f8d50c00          LDR      r0,[r5,#0xc00]        ;102
0000b8  b280              UXTH     r0,r0                 ;102
0000ba  4030              ANDS     r0,r0,r6              ;102
0000bc  f8c50c00          STR      r0,[r5,#0xc00]        ;102
0000c0  f7fffffe          BL       Setup0_Process
0000c4  e009              B        |L2.218|
                  |L2.198|
0000c6  0420              LSLS     r0,r4,#16             ;106
0000c8  d507              BPL      |L2.218|
0000ca  f8d50c00          LDR      r0,[r5,#0xc00]        ;108
0000ce  b280              UXTH     r0,r0                 ;108
0000d0  4030              ANDS     r0,r0,r6              ;108
0000d2  f8c50c00          STR      r0,[r5,#0xc00]        ;108
0000d6  f7fffffe          BL       Out0_Process
                  |L2.218|
0000da  f8d50c00          LDR      r0,[r5,#0xc00]        ;115
0000de  f8b91000          LDRH     r1,[r9,#0]            ;115  ; SaveRState
0000e2  b280              UXTH     r0,r0                 ;115
0000e4  464a              MOV      r2,r9                 ;115
0000e6  ea000008          AND      r0,r0,r8              ;115
0000ea  04cb              LSLS     r3,r1,#19             ;115
0000ec  d501              BPL      |L2.242|
0000ee  f4805080          EOR      r0,r0,#0x1000         ;115
                  |L2.242|
0000f2  0489              LSLS     r1,r1,#18             ;115
0000f4  d501              BPL      |L2.250|
0000f6  f4805000          EOR      r0,r0,#0x2000         ;115
                  |L2.250|
0000fa  f8c50c00          STR      r0,[r5,#0xc00]        ;115
0000fe  f8d50c00          LDR      r0,[r5,#0xc00]        ;116
000102  8851              LDRH     r1,[r2,#2]            ;116  ; SaveTState
000104  b280              UXTH     r0,r0                 ;116
000106  4038              ANDS     r0,r0,r7              ;116
000108  06ca              LSLS     r2,r1,#27             ;116
00010a  d501              BPL      |L2.272|
00010c  f0800010          EOR      r0,r0,#0x10           ;116
                  |L2.272|
000110  0689              LSLS     r1,r1,#26             ;116
000112  d501              BPL      |L2.280|
000114  f0800020          EOR      r0,r0,#0x20           ;116
                  |L2.280|
000118  f8c50c00          STR      r0,[r5,#0xc00]        ;116
00011c  e027              B        |L2.366|
00011e  e7ff              B        |L2.288|
                  |L2.288|
000120  eb050081          ADD      r0,r5,r1,LSL #2       ;123
000124  f8d01c00          LDR      r1,[r0,#0xc00]        ;123
000128  b28c              UXTH     r4,r1                 ;123
00012a  0421              LSLS     r1,r4,#16             ;124
00012c  d50c              BPL      |L2.328|
00012e  f8d01c00          LDR      r1,[r0,#0xc00]        ;127
000132  b289              UXTH     r1,r1                 ;127
000134  4031              ANDS     r1,r1,r6              ;127
000136  f8c01c00          STR      r1,[r0,#0xc00]        ;127
00013a  4816              LDR      r0,|L2.404|
00013c  7839              LDRB     r1,[r7,#0]            ;130  ; EPindex
00013e  eb000081          ADD      r0,r0,r1,LSL #2       ;130
000142  f8500c04          LDR      r0,[r0,#-4]           ;130
000146  4780              BLX      r0                    ;130
                  |L2.328|
000148  0620              LSLS     r0,r4,#24             ;134
00014a  d510              BPL      |L2.366|
00014c  7838              LDRB     r0,[r7,#0]            ;137  ; EPindex
00014e  eb050080          ADD      r0,r5,r0,LSL #2       ;137
000152  f8d01c00          LDR      r1,[r0,#0xc00]        ;137
000156  b289              UXTH     r1,r1                 ;137
000158  ea01010a          AND      r1,r1,r10             ;137
00015c  f8c01c00          STR      r1,[r0,#0xc00]        ;137
000160  480d              LDR      r0,|L2.408|
000162  7839              LDRB     r1,[r7,#0]  ; EPindex
000164  eb000081          ADD      r0,r0,r1,LSL #2
000168  f8500c04          LDR      r0,[r0,#-4]
00016c  4780              BLX      r0
                  |L2.366|
00016e  f8d51c44          LDR      r1,[r5,#0xc44]        ;45
000172  4658              MOV      r0,r11                ;45
000174  f8ab1000          STRH     r1,[r11,#0]           ;45
000178  0409              LSLS     r1,r1,#16             ;45
00017a  f53faf4f          BMI      |L2.28|
;;;141          } /* if((wEPVal & EP_CTR_TX) != 0) */
;;;142    
;;;143        }/* if(EPindex == 0) else */
;;;144    
;;;145      }/* while(...) */
;;;146    }
00017e  e8bd9ff0          POP      {r4-r12,pc}
;;;147    
                          ENDP

000182  0000              DCW      0x0000
                  |L2.388|
                          DCD      ||.data||
                  |L2.392|
                          DCD      0x40005000
                  |L2.396|
                          DCD      wIstr
                  |L2.400|
                          DCD      EPindex
                  |L2.404|
                          DCD      pEpInt_OUT
                  |L2.408|
                          DCD      pEpInt_IN

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

                  SaveRState
000000  0000              DCB      0x00,0x00
                  SaveTState
000002  0000              DCB      0x00,0x00
