📄 stm32f10x_gpio.lst
字号:
392
393 tmp |= GPIO_Pin;
394 /* Set LCKK bit */
395 GPIOx->LCKR = tmp;
396 /* Reset LCKK bit */
397 GPIOx->LCKR = GPIO_Pin;
398 /* Set LCKK bit */
399 GPIOx->LCKR = tmp;
400 /* Read LCKK bit*/
401 tmp = GPIOx->LCKR;
402 /* Read LCKK bit*/
403 tmp = GPIOx->LCKR;
404 }
405
406 /*******************************************************************************
407 * Function Name : GPIO_EventOutputConfig
408 * Description : Selects the GPIO pin used as Event output.
409 * Input : - GPIO_PortSource: selects the GPIO port to be used as source
410 * for Event output.
411 * This parameter can be GPIO_PortSourceGPIOx where x can be
412 * (A..E).
413 * - GPIO_PinSource: specifies the pin for the Event output.
414 * This parameter can be GPIO_PinSourcex where x can be (0..15).
415 * Output : None
416 * Return : None
417 *******************************************************************************/
418 void GPIO_EventOutputConfig(u8 GPIO_PortSource, u8 GPIO_PinSource)
419 {
420 u32 tmpreg = 0x00;
421
422 /* Check the parameters */
423 assert_param(IS_GPIO_PORT_SOURCE(GPIO_PortSource));
424 assert_param(IS_GPIO_PIN_SOURCE(GPIO_PinSource));
425
426 tmpreg = AFIO->EVCR;
427 /* Clear the PORT[6:4] and PIN[3:0] bits */
428 tmpreg &= EVCR_PORTPINCONFIG_MASK;// ((u16)0xFF80)
429 tmpreg |= (u32)GPIO_PortSource << 0x04;
430 tmpreg |= GPIO_PinSource;
431
432 AFIO->EVCR = tmpreg;
433 }
434
435 /*******************************************************************************
436 * Function Name : GPIO_EventOutputCmd
437 * Description : Enables or disables the Event Output.
438 * Input : - NewState: new state of the Event output.
439 * This parameter can be: ENABLE or DISABLE.
440 * Output : None
441 * Return : None
442 *******************************************************************************/
443 void GPIO_EventOutputCmd(FunctionalState NewState)
444 {
445 /* Check the parameters */
446 assert_param(IS_FUNCTIONAL_STATE(NewState));
447
448 *(vu32 *) EVCR_EVOE_BB = (u32)NewState;
449 }
450
451 /*******************************************************************************
452 * Function Name : GPIO_PinRemapConfig
453 * Description : Changes the mapping of the specified pin.
454 * Input : - GPIO_Remap: selects the pin to remap.
455 * This parameter can be one of the following values:
456 * - GPIO_Remap_SPI1
457 * - GPIO_Remap_I2C1
458 * - GPIO_Remap_USART1
459 * - GPIO_Remap_USART2
460 * - GPIO_PartialRemap_USART3
461 * - GPIO_FullRemap_USART3
462 * - GPIO_PartialRemap_TIM1
463 * - GPIO_FullRemap_TIM1
464 * - GPIO_PartialRemap1_TIM2
465 * - GPIO_PartialRemap2_TIM2
466 * - GPIO_FullRemap_TIM2
467 * - GPIO_PartialRemap_TIM3
468 * - GPIO_FullRemap_TIM3
469 * - GPIO_Remap_TIM4
470 * - GPIO_Remap1_CAN
471 * - GPIO_Remap2_CAN
472 * - GPIO_Remap_PD01
473 * - GPIO_Remap_SWJ_NoJTRST
474 * - GPIO_Remap_SWJ_JTAGDisable
475 * - GPIO_Remap_SWJ_Disable
476 * - NewState: new state of the port pin remapping.
477 * This parameter can be: ENABLE or DISABLE.
478 * Output : None
479 * Return : None
480 *******************************************************************************/
481 void GPIO_PinRemapConfig(u32 GPIO_Remap, FunctionalState NewState)
482 {
483 u32 tmp = 0x00, tmp1 = 0x00, tmpreg = 0x00, tmpmask = 0x00;
484
485 /* Check the parameters */
486 assert_param(IS_GPIO_REMAP(GPIO_Remap));
487 assert_param(IS_FUNCTIONAL_STATE(NewState));
488
489 tmpreg = AFIO->MAPR;
490
491 tmpmask = (GPIO_Remap & DBGAFR_POSITION_MASK) >> 0x10;
492 tmp = GPIO_Remap & LSB_MASK;
493
494 if ((GPIO_Remap & DBGAFR_LOCATION_MASK) == DBGAFR_LOCATION_MASK)
495 {
496 tmpreg &= DBGAFR_SWJCFG_MASK;
497 }
498 else if ((GPIO_Remap & DBGAFR_NUMBITS_MASK) == DBGAFR_NUMBITS_MASK)
499 {
500 tmp1 = ((u32)0x03) << tmpmask;
501 tmpreg &= ~tmp1;
502 }
503 else
504 {
505 tmpreg &= ~tmp;
506 }
507
508 if (NewState != DISABLE)
509 {
510 if ((GPIO_Remap & DBGAFR_LOCATION_MASK) == DBGAFR_LOCATION_MASK)
511 {
512 tmpreg |= (tmp << 0x10);
513 }
514 else
515 {
516 tmpreg |= tmp;
517 }
518 }
519 AFIO->MAPR = tmpreg;
520 }
521
522 /*******************************************************************************
523 * Function Name : GPIO_EXTILineConfig
524 * Description : Selects the GPIO pin used as EXTI Line.
525 * Input : - GPIO_PortSource: selects the GPIO port to be used as
526 * source for EXTI lines.
527 * - GPIO_PinSource: specifies the EXTI line to be configured.
528 * This parameter can be GPIO_PinSourcex where x can be (0..15).
529 * Output : None
530 * Return : None
531 *******************************************************************************/
532 void GPIO_EXTILineConfig(u8 GPIO_PortSource, u8 GPIO_PinSource)
533 {
534 u32 tmp = 0x00;
535
536 /* Check the parameters */
537 assert_param(IS_GPIO_PORT_SOURCE(GPIO_PortSource));
538 assert_param(IS_GPIO_PIN_SOURCE(GPIO_PinSource));
539
540 tmp = ((u32)0x0F) << (0x04 * (GPIO_PinSource & (u8)0x03));
541
542 AFIO->EXTICR[GPIO_PinSource >> 0x02] &= ~tmp;
543 AFIO->EXTICR[GPIO_PinSource >> 0x02] |= (((u32)GPIO_PortSource) << (0x04 * (GPIO_PinSource & (u8)0x03)));
544 }
545
546 /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
Maximum stack usage in bytes:
Function .cstack
-------- -------
GPIO_AFIODeInit 8
GPIO_DeInit 8
GPIO_EXTILineConfig 8
GPIO_EventOutputCmd 0
GPIO_EventOutputConfig 0
GPIO_Init 24
GPIO_PinLockConfig 0
GPIO_PinRemapConfig 16
GPIO_ReadInputData 0
GPIO_ReadInputDataBit 8
GPIO_ReadOutputData 0
GPIO_ReadOutputDataBit 8
GPIO_ResetBits 0
GPIO_SetBits 0
GPIO_StructInit 0
GPIO_Write 0
GPIO_WriteBit 0
Section sizes:
Function/Label Bytes
-------------- -----
GPIO_DeInit 140
GPIO_AFIODeInit 22
GPIO_Init 244
GPIO_StructInit 20
GPIO_ReadInputDataBit 34
GPIO_ReadInputData 6
GPIO_ReadOutputDataBit 34
GPIO_ReadOutputData 6
GPIO_SetBits 6
GPIO_ResetBits 6
GPIO_WriteBit 18
GPIO_Write 6
GPIO_PinLockConfig 28
GPIO_EventOutputConfig 40
GPIO_EventOutputCmd 12
GPIO_PinRemapConfig 96
GPIO_EXTILineConfig 96
814 bytes in section .text
814 bytes of CODE memory
Errors: none
Warnings: none
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -