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

📄 stm32f10x_gpio.lst

📁 编译环境是 iar EWARM ,STM32 下的UCOSII
💻 LST
📖 第 1 页 / 共 4 页
字号:
   \   0000000A   0021               MOVS     R1,#+0
   \   0000000C   0120               MOVS     R0,#+1
   \   0000000E   ........           _BLF     RCC_APB2PeriphResetCmd,??RCC_APB2PeriphResetCmd??rT
    113          }
   \   00000012   00BD               POP      {PC}             ;; return
    114          
    115          /*******************************************************************************
    116          * Function Name  : GPIO_Init
    117          * Description    : Initializes the GPIOx peripheral according to the specified
    118          *                  parameters in the GPIO_InitStruct.
    119          * Input          : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
    120          *                  - GPIO_InitStruct: pointer to a GPIO_InitTypeDef structure that
    121          *                    contains the configuration information for the specified GPIO
    122          *                    peripheral.
    123          * Output         : None
    124          * Return         : None
    125          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    126          void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)
    127          {
   \                     GPIO_Init:
   \   00000000   2DE9F041           PUSH     {R4-R8,LR}
    128            u32 currentmode = 0x00, currentpin = 0x00, pinpos = 0x00, pos = 0x00;
    129            u32 tmpreg = 0x00, pinmask = 0x00;
    130          
    131            /* Check the parameters */
    132            assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
    133            assert_param(IS_GPIO_MODE(GPIO_InitStruct->GPIO_Mode));
    134            assert_param(IS_GPIO_PIN(GPIO_InitStruct->GPIO_Pin));  
    135            
    136          /*---------------------------- GPIO Mode Configuration -----------------------*/
    137            currentmode = ((u32)GPIO_InitStruct->GPIO_Mode) & ((u32)0x0F);
   \   00000004   CA78               LDRB     R2,[R1, #+3]
   \   00000006   1207               LSLS     R2,R2,#+28
   \   00000008   120F               LSRS     R2,R2,#+28
    138          
    139            if ((((u32)GPIO_InitStruct->GPIO_Mode) & ((u32)0x10)) != 0x00)
   \   0000000A   CB78               LDRB     R3,[R1, #+3]
   \   0000000C   DB06               LSLS     R3,R3,#+27
   \   0000000E   02D5               BPL.N    ??GPIO_Init_0
    140            { 
    141              /* Check the parameters */
    142              assert_param(IS_GPIO_SPEED(GPIO_InitStruct->GPIO_Speed));
    143              /* Output mode */
    144              currentmode |= (u32)GPIO_InitStruct->GPIO_Speed;
   \   00000010   1300               MOVS     R3,R2
   \   00000012   8A78               LDRB     R2,[R1, #+2]
   \   00000014   1A43               ORRS     R2,R2,R3
    145            }
    146          
    147          /*---------------------------- GPIO CRL Configuration ------------------------*/
    148            /* Configure the eight low port pins */
    149            if (((u32)GPIO_InitStruct->GPIO_Pin & ((u32)0x00FF)) != 0x00)
   \                     ??GPIO_Init_0:
   \   00000016   0023               MOVS     R3,#+0
   \   00000018   9846               MOV      R8,R3
   \   0000001A   0B88               LDRH     R3,[R1, #+0]
   \   0000001C   DBB2               UXTB     R3,R3
   \   0000001E   002B               CMP      R3,#+0
   \   00000020   1DD0               BEQ.N    ??GPIO_Init_1
    150            {
    151              tmpreg = GPIOx->CRL;
   \   00000022   0568               LDR      R5,[R0, #+0]
    152          
    153              for (pinpos = 0x00; pinpos < 0x08; pinpos++)
   \   00000024   4346               MOV      R3,R8
   \   00000026   17E0               B.N      ??GPIO_Init_2
    154              {
    155                pos = ((u32)0x01) << pinpos;
   \                     ??GPIO_Init_3:
   \   00000028   0126               MOVS     R6,#+1
   \   0000002A   9E40               LSLS     R6,R6,R3
   \   0000002C   3400               MOVS     R4,R6
    156                /* Get the port pins position */
    157                currentpin = (GPIO_InitStruct->GPIO_Pin) & pos;
    158          
    159                if (currentpin == pos)
   \   0000002E   0F88               LDRH     R7,[R1, #+0]
   \   00000030   2740               ANDS     R7,R7,R4
   \   00000032   A742               CMP      R7,R4
   \   00000034   0FD1               BNE.N    ??GPIO_Init_4
    160                {
    161                  pos = pinpos << 2;
   \   00000036   9C00               LSLS     R4,R3,#+2
    162                  /* Clear the corresponding low control register bits */
    163                  pinmask = ((u32)0x0F) << pos;
    164                  tmpreg &= ~pinmask;
    165          
    166                  /* Write the mode configuration in the corresponding bits */
    167                  tmpreg |= (currentmode << pos);
   \   00000038   0F27               MOVS     R7,#+15
   \   0000003A   A740               LSLS     R7,R7,R4
   \   0000003C   BD43               BICS     R5,R5,R7
   \   0000003E   2F00               MOVS     R7,R5
   \   00000040   12FA04F5           LSLS     R5,R2,R4
   \   00000044   3D43               ORRS     R5,R5,R7
    168          
    169                  /* Reset the corresponding ODR bit */
    170                  if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPD)
   \   00000046   CC78               LDRB     R4,[R1, #+3]
   \   00000048   282C               CMP      R4,#+40
   \   0000004A   00D1               BNE.N    ??GPIO_Init_5
    171                  {
    172                    GPIOx->BRR = (((u32)0x01) << pinpos);
   \   0000004C   4661               STR      R6,[R0, #+20]
    173                  }
    174                  /* Set the corresponding ODR bit */
    175                  if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPU)
   \                     ??GPIO_Init_5:
   \   0000004E   CC78               LDRB     R4,[R1, #+3]
   \   00000050   482C               CMP      R4,#+72
   \   00000052   00D1               BNE.N    ??GPIO_Init_4
    176                  {
    177                    GPIOx->BSRR = (((u32)0x01) << pinpos);
   \   00000054   0661               STR      R6,[R0, #+16]
    178                  }
    179                }
    180              }
   \                     ??GPIO_Init_4:
   \   00000056   5B1C               ADDS     R3,R3,#+1
   \                     ??GPIO_Init_2:
   \   00000058   082B               CMP      R3,#+8
   \   0000005A   E5D3               BCC.N    ??GPIO_Init_3
    181              GPIOx->CRL = tmpreg;
   \   0000005C   0560               STR      R5,[R0, #+0]
    182            }
    183          
    184          /*---------------------------- GPIO CRH Configuration ------------------------*/
    185            /* Configure the eight high port pins */
    186            if (GPIO_InitStruct->GPIO_Pin > 0x00FF)
   \                     ??GPIO_Init_1:
   \   0000005E   0B88               LDRH     R3,[R1, #+0]
   \   00000060   5FF48074           MOVS     R4,#+256
   \   00000064   A342               CMP      R3,R4
   \   00000066   1FD3               BCC.N    ??GPIO_Init_6
    187            {
    188              tmpreg = GPIOx->CRH;
   \   00000068   4568               LDR      R5,[R0, #+4]
    189              for (pinpos = 0x00; pinpos < 0x08; pinpos++)
   \   0000006A   4346               MOV      R3,R8
   \   0000006C   19E0               B.N      ??GPIO_Init_7
    190              {
    191                pos = (((u32)0x01) << (pinpos + 0x08));
   \                     ??GPIO_Init_8:
   \   0000006E   0126               MOVS     R6,#+1
   \   00000070   1C00               MOVS     R4,R3
   \   00000072   0834               ADDS     R4,R4,#+8
   \   00000074   A640               LSLS     R6,R6,R4
   \   00000076   3400               MOVS     R4,R6
    192                /* Get the port pins position */
    193                currentpin = ((GPIO_InitStruct->GPIO_Pin) & pos);
    194                if (currentpin == pos)
   \   00000078   0F88               LDRH     R7,[R1, #+0]
   \   0000007A   2740               ANDS     R7,R7,R4
   \   0000007C   A742               CMP      R7,R4
   \   0000007E   0FD1               BNE.N    ??GPIO_Init_9
    195                {
    196                  pos = pinpos << 2;
   \   00000080   9C00               LSLS     R4,R3,#+2
    197                  /* Clear the corresponding high control register bits */
    198                  pinmask = ((u32)0x0F) << pos;
    199                  tmpreg &= ~pinmask;
    200          
    201                  /* Write the mode configuration in the corresponding bits */
    202                  tmpreg |= (currentmode << pos);
   \   00000082   0F27               MOVS     R7,#+15
   \   00000084   A740               LSLS     R7,R7,R4
   \   00000086   BD43               BICS     R5,R5,R7
   \   00000088   2F00               MOVS     R7,R5
   \   0000008A   12FA04F5           LSLS     R5,R2,R4
   \   0000008E   3D43               ORRS     R5,R5,R7
    203          
    204                  /* Reset the corresponding ODR bit */
    205                  if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPD)
   \   00000090   CC78               LDRB     R4,[R1, #+3]
   \   00000092   282C               CMP      R4,#+40
   \   00000094   00D1               BNE.N    ??GPIO_Init_10
    206                  {
    207                    GPIOx->BRR = (((u32)0x01) << (pinpos + 0x08));
   \   00000096   4661               STR      R6,[R0, #+20]
    208                  }
    209                  /* Set the corresponding ODR bit */
    210                  if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPU)
   \                     ??GPIO_Init_10:
   \   00000098   CC78               LDRB     R4,[R1, #+3]
   \   0000009A   482C               CMP      R4,#+72
   \   0000009C   00D1               BNE.N    ??GPIO_Init_9
    211                  {
    212                    GPIOx->BSRR = (((u32)0x01) << (pinpos + 0x08));
   \   0000009E   0661               STR      R6,[R0, #+16]
    213                  }
    214                }
    215              }
   \                     ??GPIO_Init_9:
   \   000000A0   5B1C               ADDS     R3,R3,#+1
   \                     ??GPIO_Init_7:
   \   000000A2   082B               CMP      R3,#+8
   \   000000A4   E3D3               BCC.N    ??GPIO_Init_8
    216              GPIOx->CRH = tmpreg;
   \   000000A6   4560               STR      R5,[R0, #+4]
    217            }
    218          }
   \                     ??GPIO_Init_6:
   \   000000A8   BDE8F081           POP      {R4-R8,PC}       ;; return
    219          
    220          /*******************************************************************************
    221          * Function Name  : GPIO_StructInit
    222          * Description    : Fills each GPIO_InitStruct member with its default value.
    223          * Input          : - GPIO_InitStruct : pointer to a GPIO_InitTypeDef structure
    224          *                    which will be initialized.
    225          * Output         : None
    226          * Return         : None
    227          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    228          void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct)
    229          {
    230            /* Reset GPIO init structure parameters values */
    231            GPIO_InitStruct->GPIO_Pin  = GPIO_Pin_All;
   \                     GPIO_StructInit:
   \   00000000   0349               LDR.N    R1,??GPIO_StructInit_0  ;; 0xffff
   \   00000002   0180               STRH     R1,[R0, #+0]
    232            GPIO_InitStruct->GPIO_Speed = GPIO_Speed_2MHz;
   \   00000004   0221               MOVS     R1,#+2
   \   00000006   8170               STRB     R1,[R0, #+2]
    233            GPIO_InitStruct->GPIO_Mode = GPIO_Mode_IN_FLOATING;
   \   00000008   0421               MOVS     R1,#+4
   \   0000000A   C170               STRB     R1,[R0, #+3]
    234          }
   \   0000000C   7047               BX       LR               ;; return
   \   0000000E   00BF               Nop      
   \                     ??GPIO_StructInit_0:
   \   00000010   FFFF0000           DC32     0xffff
    235          
    236          /*******************************************************************************
    237          * Function Name  : GPIO_ReadInputDataBit
    238          * Description    : Reads the specified input port pin.
    239          * Input          : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
    240          *                : - GPIO_Pin:  specifies the port bit to read.
    241          *                    This parameter can be GPIO_Pin_x where x can be (0..15).
    242          * Output         : None
    243          * Return         : The input port pin value.
    244          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    245          u8 GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)
    246          {
   \                     GPIO_ReadInputDataBit:
   \   00000000   00B5               PUSH     {LR}
    247            u8 bitstatus = 0x00;
    248            
    249            /* Check the parameters */
    250            assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
    251            assert_param(IS_GET_GPIO_PIN(GPIO_Pin)); 
    252            
    253            if ((GPIOx->IDR & GPIO_Pin) != (u32)Bit_RESET)
   \   00000002   8068               LDR      R0,[R0, #+8]
   \   00000004   0842               TST      R0,R1
   \   00000006   01D0               BEQ.N    ??GPIO_ReadInputDataBit_0
    254            {
    255              bitstatus = (u8)Bit_SET;
   \   00000008   0120               MOVS     R0,#+1
   \   0000000A   00BD               POP      {PC}
    256            }
    257            else
    258            {
    259              bitstatus = (u8)Bit_RESET;
   \                     ??GPIO_ReadInputDataBit_0:

⌨️ 快捷键说明

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