📄 stm32f10x_gpio.txt
字号:
;;;378 assert_param(IS_GET_GPIO_PIN(GPIO_Pin));
;;;379 assert_param(IS_GPIO_BIT_ACTION(BitVal));
;;;380
;;;381 if (BitVal != Bit_RESET)
;;;382 {
;;;383 GPIOx->BSRR = GPIO_Pin;
000230 6101 STR r1,[r0,#0x10]
000232 e000 B |L1.566|
|L1.564|
;;;384 }
;;;385 else
;;;386 {
;;;387 GPIOx->BRR = GPIO_Pin;
000234 6141 STR r1,[r0,#0x14]
|L1.566|
;;;388 }
;;;389 }
000236 4770 BX lr
;;;390
ENDP
GPIO_Write PROC
;;;399 *******************************************************************************/
;;;400 void GPIO_Write(GPIO_TypeDef* GPIOx, u16 PortVal)
000238 60c1 STR r1,[r0,#0xc]
;;;401 {
;;;402 /* Check the parameters */
;;;403 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
;;;404
;;;405 GPIOx->ODR = PortVal;
;;;406 }
00023a 4770 BX lr
;;;407
ENDP
GPIO_PinLockConfig PROC
;;;417 *******************************************************************************/
;;;418 void GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)
00023c f44f3280 MOV r2,#0x10000
;;;419 {
;;;420 u32 tmp = 0x00010000;
;;;421
;;;422 /* Check the parameters */
;;;423 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
;;;424 assert_param(IS_GPIO_PIN(GPIO_Pin));
;;;425
;;;426 tmp |= GPIO_Pin;
000240 430a ORRS r2,r2,r1
;;;427 /* Set LCKK bit */
;;;428 GPIOx->LCKR = tmp;
000242 6182 STR r2,[r0,#0x18]
;;;429 /* Reset LCKK bit */
;;;430 GPIOx->LCKR = GPIO_Pin;
000244 6181 STR r1,[r0,#0x18]
;;;431 /* Set LCKK bit */
;;;432 GPIOx->LCKR = tmp;
000246 6182 STR r2,[r0,#0x18]
;;;433 /* Read LCKK bit*/
;;;434 tmp = GPIOx->LCKR;
000248 6982 LDR r2,[r0,#0x18]
;;;435 /* Read LCKK bit*/
;;;436 tmp = GPIOx->LCKR;
00024a 6982 LDR r2,[r0,#0x18]
;;;437 }
00024c 4770 BX lr
;;;438
ENDP
GPIO_EventOutputConfig PROC
;;;450 *******************************************************************************/
;;;451 void GPIO_EventOutputConfig(u8 GPIO_PortSource, u8 GPIO_PinSource)
00024e 4602 MOV r2,r0
;;;452 {
;;;453 u32 tmpreg = 0x00;
000250 2000 MOVS r0,#0
;;;454
;;;455 /* Check the parameters */
;;;456 assert_param(IS_GPIO_EVENTOUT_PORT_SOURCE(GPIO_PortSource));
;;;457 assert_param(IS_GPIO_PIN_SOURCE(GPIO_PinSource));
;;;458
;;;459 tmpreg = AFIO->EVCR;
000252 4b34 LDR r3,|L1.804|
000254 6818 LDR r0,[r3,#0]
;;;460 /* Clear the PORT[6:4] and PIN[3:0] bits */
;;;461 tmpreg &= EVCR_PORTPINCONFIG_MASK;
000256 f64f7380 MOV r3,#0xff80
00025a 4018 ANDS r0,r0,r3
;;;462 tmpreg |= (u32)GPIO_PortSource << 0x04;
00025c ea401002 ORR r0,r0,r2,LSL #4
;;;463 tmpreg |= GPIO_PinSource;
000260 4308 ORRS r0,r0,r1
;;;464
;;;465 AFIO->EVCR = tmpreg;
000262 4b30 LDR r3,|L1.804|
000264 6018 STR r0,[r3,#0]
;;;466 }
000266 4770 BX lr
;;;467
ENDP
GPIO_EventOutputCmd PROC
;;;475 *******************************************************************************/
;;;476 void GPIO_EventOutputCmd(FunctionalState NewState)
000268 492f LDR r1,|L1.808|
;;;477 {
;;;478 /* Check the parameters */
;;;479 assert_param(IS_FUNCTIONAL_STATE(NewState));
;;;480
;;;481 *(vu32 *) EVCR_EVOE_BB = (u32)NewState;
00026a 61c8 STR r0,[r1,#0x1c]
;;;482 }
00026c 4770 BX lr
;;;483
ENDP
GPIO_PinRemapConfig PROC
;;;518 *******************************************************************************/
;;;519 void GPIO_PinRemapConfig(u32 GPIO_Remap, FunctionalState NewState)
00026e b5f0 PUSH {r4-r7,lr}
;;;520 {
000270 460a MOV r2,r1
;;;521 u32 tmp = 0x00, tmp1 = 0x00, tmpreg = 0x00, tmpmask = 0x00;
000272 2300 MOVS r3,#0
000274 2400 MOVS r4,#0
000276 2100 MOVS r1,#0
000278 2500 MOVS r5,#0
;;;522
;;;523 /* Check the parameters */
;;;524 assert_param(IS_GPIO_REMAP(GPIO_Remap));
;;;525 assert_param(IS_FUNCTIONAL_STATE(NewState));
;;;526
;;;527 tmpreg = AFIO->MAPR;
00027a 4e2a LDR r6,|L1.804|
00027c 6871 LDR r1,[r6,#4]
;;;528
;;;529 tmpmask = (GPIO_Remap & DBGAFR_POSITION_MASK) >> 0x10;
00027e f3c04503 UBFX r5,r0,#16,#4
;;;530 tmp = GPIO_Remap & LSB_MASK;
000282 b283 UXTH r3,r0
;;;531
;;;532 if ((GPIO_Remap & (DBGAFR_LOCATION_MASK | DBGAFR_NUMBITS_MASK)) == (DBGAFR_LOCATION_MASK | DBGAFR_NUMBITS_MASK))
000284 f4001640 AND r6,r0,#0x300000
000288 f5b61f40 CMP r6,#0x300000
00028c d108 BNE |L1.672|
;;;533 {
;;;534 tmpreg &= DBGAFR_SWJCFG_MASK;
00028e f0216170 BIC r1,r1,#0xf000000
;;;535 AFIO->MAPR &= DBGAFR_SWJCFG_MASK;
000292 4e24 LDR r6,|L1.804|
000294 6876 LDR r6,[r6,#4]
000296 f0266670 BIC r6,r6,#0xf000000
00029a 4f22 LDR r7,|L1.804|
00029c 607e STR r6,[r7,#4]
00029e e012 B |L1.710|
|L1.672|
;;;536 }
;;;537 else if ((GPIO_Remap & DBGAFR_NUMBITS_MASK) == DBGAFR_NUMBITS_MASK)
0002a0 f4001680 AND r6,r0,#0x100000
0002a4 f5b61f80 CMP r6,#0x100000
0002a8 d106 BNE |L1.696|
;;;538 {
;;;539 tmp1 = ((u32)0x03) << tmpmask;
0002aa 2603 MOVS r6,#3
0002ac fa06f405 LSL r4,r6,r5
;;;540 tmpreg &= ~tmp1;
0002b0 43a1 BICS r1,r1,r4
;;;541 tmpreg |= ~DBGAFR_SWJCFG_MASK;
0002b2 f0416170 ORR r1,r1,#0xf000000
0002b6 e006 B |L1.710|
|L1.696|
;;;542 }
;;;543 else
;;;544 {
;;;545 tmpreg &= ~(tmp << ((GPIO_Remap >> 0x15)*0x10));
0002b8 0d46 LSRS r6,r0,#21
0002ba 0136 LSLS r6,r6,#4
0002bc fa03f606 LSL r6,r3,r6
0002c0 43b1 BICS r1,r1,r6
;;;546 tmpreg |= ~DBGAFR_SWJCFG_MASK;
0002c2 f0416170 ORR r1,r1,#0xf000000
|L1.710|
;;;547 }
;;;548
;;;549 if (NewState != DISABLE)
0002c6 b122 CBZ r2,|L1.722|
;;;550 {
;;;551 tmpreg |= (tmp << ((GPIO_Remap >> 0x15)*0x10));
0002c8 0d46 LSRS r6,r0,#21
0002ca 0136 LSLS r6,r6,#4
0002cc fa03f606 LSL r6,r3,r6
0002d0 4331 ORRS r1,r1,r6
|L1.722|
;;;552 }
;;;553
;;;554 AFIO->MAPR = tmpreg;
0002d2 4e14 LDR r6,|L1.804|
0002d4 6071 STR r1,[r6,#4]
;;;555 }
0002d6 bdf0 POP {r4-r7,pc}
;;;556
ENDP
GPIO_EXTILineConfig PROC
;;;568 *******************************************************************************/
;;;569 void GPIO_EXTILineConfig(u8 GPIO_PortSource, u8 GPIO_PinSource)
0002d8 b530 PUSH {r4,r5,lr}
;;;570 {
;;;571 u32 tmp = 0x00;
0002da 2200 MOVS r2,#0
;;;572
;;;573 /* Check the parameters */
;;;574 assert_param(IS_GPIO_EXTI_PORT_SOURCE(GPIO_PortSource));
;;;575 assert_param(IS_GPIO_PIN_SOURCE(GPIO_PinSource));
;;;576
;;;577 tmp = ((u32)0x0F) << (0x04 * (GPIO_PinSource & (u8)0x03));
0002dc 078b LSLS r3,r1,#30
0002de 0f1c LSRS r4,r3,#28
0002e0 230f MOVS r3,#0xf
0002e2 fa03f204 LSL r2,r3,r4
;;;578
;;;579 AFIO->EXTICR[GPIO_PinSource >> 0x02] &= ~tmp;
0002e6 4b0f LDR r3,|L1.804|
0002e8 3308 ADDS r3,r3,#8
0002ea 108c ASRS r4,r1,#2
0002ec f8533024 LDR r3,[r3,r4,LSL #2]
0002f0 4393 BICS r3,r3,r2
0002f2 4c0c LDR r4,|L1.804|
0002f4 3408 ADDS r4,r4,#8
0002f6 108d ASRS r5,r1,#2
0002f8 f8443025 STR r3,[r4,r5,LSL #2]
;;;580 AFIO->EXTICR[GPIO_PinSource >> 0x02] |= (((u32)GPIO_PortSource) << (0x04 * (GPIO_PinSource & (u8)0x03)));
0002fc 4623 MOV r3,r4
0002fe 108c ASRS r4,r1,#2
000300 f8533024 LDR r3,[r3,r4,LSL #2]
000304 078c LSLS r4,r1,#30
000306 0f24 LSRS r4,r4,#28
000308 fa00f404 LSL r4,r0,r4
00030c 4323 ORRS r3,r3,r4
00030e 4c05 LDR r4,|L1.804|
000310 3408 ADDS r4,r4,#8
000312 108d ASRS r5,r1,#2
000314 f8443025 STR r3,[r4,r5,LSL #2]
;;;581 }
000318 bd30 POP {r4,r5,pc}
;;;582
ENDP
00031a 0000 DCW 0x0000
|L1.796|
DCD 0x40011400
|L1.800|
DCD 0xbffef800
|L1.804|
DCD 0x40010000
|L1.808|
DCD 0x42200000
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -