📄 stm32f10x_gpio.s79
字号:
B.N ??GPIO_DeInit_8
Nop
DATA
??GPIO_DeInit_0:
DC32 0x40010800
DC32 0x40010c00
DC32 0x40011000
DC32 0x40011400
DC32 0x40011800
DC32 0x40011c00
DC32 0x40012000
CFI EndBlock cfiBlock0
// 91 break;
// 92
// 93 default:
// 94 break;
// 95 }
// 96 }
// 97
// 98 /*******************************************************************************
// 99 * Function Name : GPIO_AFIODeInit
// 100 * Description : Deinitializes the Alternate Functions (remap, event control
// 101 * and EXTI configuration) registers to their default reset
// 102 * values.
// 103 * Input : None
// 104 * Output : None
// 105 * Return : None
// 106 *******************************************************************************/
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock1 Using cfiCommon0
CFI Function GPIO_AFIODeInit
THUMB
// 107 void GPIO_AFIODeInit(void)
// 108 {
GPIO_AFIODeInit:
PUSH {LR}
CFI ?RET Frame(CFA, -4)
CFI CFA R13+4
// 109 RCC_APB2PeriphResetCmd(RCC_APB2Periph_AFIO, ENABLE);
MOVS R1,#+1
MOVS R0,#+1
_BLF RCC_APB2PeriphResetCmd,??RCC_APB2PeriphResetCmd??rT
// 110 RCC_APB2PeriphResetCmd(RCC_APB2Periph_AFIO, DISABLE);
MOVS R1,#+0
MOVS R0,#+1
POP {LR} ;; Pop
CFI ?RET R14
CFI CFA R13+0
_BF.W RCC_APB2PeriphResetCmd,??RCC_APB2PeriphResetCmd??rT
CFI EndBlock cfiBlock1
// 111 }
// 112
// 113 /*******************************************************************************
// 114 * Function Name : GPIO_Init
// 115 * Description : Initializes the GPIOx peripheral according to the specified
// 116 * parameters in the GPIO_InitStruct.
// 117 * Input : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
// 118 * - GPIO_InitStruct: pointer to a GPIO_InitTypeDef structure that
// 119 * contains the configuration information for the specified GPIO
// 120 * peripheral.
// 121 * Output : None
// 122 * Return : None
// 123 *******************************************************************************/
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock2 Using cfiCommon0
CFI Function GPIO_Init
THUMB
// 124 void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)
// 125 {
GPIO_Init:
PUSH {R4-R8,LR}
CFI ?RET Frame(CFA, -4)
CFI R8 Frame(CFA, -8)
CFI R7 Frame(CFA, -12)
CFI R6 Frame(CFA, -16)
CFI R5 Frame(CFA, -20)
CFI R4 Frame(CFA, -24)
CFI CFA R13+24
// 126 u32 currentmode = 0x00, currentpin = 0x00, pinpos = 0x00, pos = 0x00;
// 127 u32 tmpreg = 0x00, pinmask = 0x00;
// 128
// 129 /* Check the parameters */
// 130 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
// 131 assert_param(IS_GPIO_MODE(GPIO_InitStruct->GPIO_Mode));
// 132 assert_param(IS_GPIO_PIN(GPIO_InitStruct->GPIO_Pin));
// 133
// 134 /*---------------------------- GPIO Mode Configuration -----------------------*/
// 135 currentmode = ((u32)GPIO_InitStruct->GPIO_Mode) & ((u32)0x0F);
LDRB R3,[R1, #+3]
LSLS R2,R3,#+28
LSRS R2,R2,#+28
// 136
// 137 if ((((u32)GPIO_InitStruct->GPIO_Mode) & ((u32)0x10)) != 0x00)
LSLS R3,R3,#+27
ITTT MI
// 138 {
// 139 /* Check the parameters */
// 140 assert_param(IS_GPIO_SPEED(GPIO_InitStruct->GPIO_Speed));
// 141 /* Output mode */
// 142 currentmode |= (u32)GPIO_InitStruct->GPIO_Speed;
MOVMI R3,R2
LDRBMI R2,[R1, #+2]
ORRMI R2,R2,R3
// 143 }
// 144
// 145 /*---------------------------- GPIO CRL Configuration ------------------------*/
// 146 /* Configure the eight low port pins */
// 147 if (((u32)GPIO_InitStruct->GPIO_Pin & ((u32)0x00FF)) != 0x00)
LDRH R3,[R1, #+0]
MOV R8,R3
LSLS R3,R3,#+24
BEQ.N ??GPIO_Init_0
// 148 {
// 149 tmpreg = GPIOx->CRL;
LDR R5,[R0, #+0]
// 150
// 151 for (pinpos = 0x00; pinpos < 0x08; pinpos++)
MOVS R3,#+0
// 152 {
// 153 pos = ((u32)0x01) << pinpos;
??GPIO_Init_1:
MOVS R6,#+1
LSLS R6,R6,R3
// 154 /* Get the port pins position */
// 155 currentpin = (GPIO_InitStruct->GPIO_Pin) & pos;
// 156
// 157 if (currentpin == pos)
MOV R7,R8
ANDS R7,R7,R6
CMP R7,R6
BNE.N ??GPIO_Init_2
// 158 {
// 159 pos = pinpos << 2;
LSLS R4,R3,#+2
// 160 /* Clear the corresponding low control register bits */
// 161 pinmask = ((u32)0x0F) << pos;
// 162 tmpreg &= ~pinmask;
// 163
// 164 /* Write the mode configuration in the corresponding bits */
// 165 tmpreg |= (currentmode << pos);
MOVS R7,#+15
LSLS R7,R7,R4
BICS R5,R5,R7
MOVS R7,R5
LSLS R5,R2,R4
// 166
// 167 /* Reset the corresponding ODR bit */
// 168 if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPD)
LDRB R4,[R1, #+3]
ORRS R5,R5,R7
CMP R4,#+40
IT EQ
// 169 {
// 170 GPIOx->BRR = (((u32)0x01) << pinpos);
STREQ R6,[R0, #+20]
// 171 }
// 172 /* Set the corresponding ODR bit */
// 173 if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPU)
LDRB R4,[R1, #+3]
CMP R4,#+72
IT EQ
// 174 {
// 175 GPIOx->BSRR = (((u32)0x01) << pinpos);
STREQ R6,[R0, #+16]
// 176 }
// 177 }
// 178 }
??GPIO_Init_2:
ADDS R3,R3,#+1
CMP R3,#+8
BCC.N ??GPIO_Init_1
// 179 GPIOx->CRL = tmpreg;
STR R5,[R0, #+0]
// 180 }
// 181
// 182 /*---------------------------- GPIO CRH Configuration ------------------------*/
// 183 /* Configure the eight high port pins */
// 184 if (GPIO_InitStruct->GPIO_Pin > 0x00FF)
??GPIO_Init_0:
MOVS R4,#+256
CMP R8,R4
BCC.N ??GPIO_Init_3
// 185 {
// 186 tmpreg = GPIOx->CRH;
LDR R5,[R0, #+4]
// 187 for (pinpos = 0x00; pinpos < 0x08; pinpos++)
MOVS R3,#+0
// 188 {
// 189 pos = (((u32)0x01) << (pinpos + 0x08));
??GPIO_Init_4:
MOVS R6,#+1
MOVS R4,R3
ADDS R4,R4,#+8
LSLS R6,R6,R4
// 190 /* Get the port pins position */
// 191 currentpin = ((GPIO_InitStruct->GPIO_Pin) & pos);
// 192 if (currentpin == pos)
MOV R7,R8
ANDS R7,R7,R6
CMP R7,R6
BNE.N ??GPIO_Init_5
// 193 {
// 194 pos = pinpos << 2;
LSLS R4,R3,#+2
// 195 /* Clear the corresponding high control register bits */
// 196 pinmask = ((u32)0x0F) << pos;
// 197 tmpreg &= ~pinmask;
// 198
// 199 /* Write the mode configuration in the corresponding bits */
// 200 tmpreg |= (currentmode << pos);
MOVS R7,#+15
LSLS R7,R7,R4
BICS R5,R5,R7
MOVS R7,R5
LSLS R5,R2,R4
// 201
// 202 /* Reset the corresponding ODR bit */
// 203 if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPD)
LDRB R4,[R1, #+3]
ORRS R5,R5,R7
CMP R4,#+40
IT EQ
// 204 {
// 205 GPIOx->BRR = (((u32)0x01) << (pinpos + 0x08));
STREQ R6,[R0, #+20]
// 206 }
// 207 /* Set the corresponding ODR bit */
// 208 if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPU)
LDRB R4,[R1, #+3]
CMP R4,#+72
IT EQ
// 209 {
// 210 GPIOx->BSRR = (((u32)0x01) << (pinpos + 0x08));
STREQ R6,[R0, #+16]
// 211 }
// 212 }
// 213 }
??GPIO_Init_5:
ADDS R3,R3,#+1
CMP R3,#+8
BCC.N ??GPIO_Init_4
// 214 GPIOx->CRH = tmpreg;
STR R5,[R0, #+4]
// 215 }
// 216 }
??GPIO_Init_3:
POP {R4-R8,PC}
CFI EndBlock cfiBlock2
// 217
// 218 /*******************************************************************************
// 219 * Function Name : GPIO_StructInit
// 220 * Description : Fills each GPIO_InitStruct member with its default value.
// 221 * Input : - GPIO_InitStruct : pointer to a GPIO_InitTypeDef structure
// 222 * which will be initialized.
// 223 * Output : None
// 224 * Return : None
// 225 *******************************************************************************/
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock3 Using cfiCommon0
CFI Function GPIO_StructInit
THUMB
// 226 void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct)
// 227 {
// 228 /* Reset GPIO init structure parameters values */
// 229 GPIO_InitStruct->GPIO_Pin = GPIO_Pin_All;
GPIO_StructInit:
LDR.N R1,??GPIO_StructInit_0 ;; 0xffff
STRH R1,[R0, #+0]
// 230 GPIO_InitStruct->GPIO_Speed = GPIO_Speed_2MHz;
MOVS R1,#+2
STRB R1,[R0, #+2]
// 231 GPIO_InitStruct->GPIO_Mode = GPIO_Mode_IN_FLOATING;
MOVS R1,#+4
STRB R1,[R0, #+3]
// 232 }
BX LR ;; return
Nop
DATA
??GPIO_StructInit_0:
DC32 0xffff
CFI EndBlock cfiBlock3
// 233
// 234 /*******************************************************************************
// 235 * Function Name : GPIO_ReadInputDataBit
// 236 * Description : Reads the specified input port pin.
// 237 * Input : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
// 238 * : - GPIO_Pin: specifies the port bit to read.
// 239 * This parameter can be GPIO_Pin_x where x can be (0..15).
// 240 * Output : None
// 241 * Return : The input port pin value.
// 242 *******************************************************************************/
RSEG CODE:CODE:NOROOT(2)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -