Guest User

gpio_remap.h

a guest
May 27th, 2011
442
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // gpio_remap.h, by x893
  2. // see http://forums.leaflabs.com/topic.php?id=802
  3.  
  4. #ifndef _GPIO_REMAP_H
  5. #define _GPIO_REMAP_H
  6.  
  7. #ifdef __cplusplus
  8.  extern "C" {
  9. #endif
  10.  
  11. #define AFIO_MAPR2      ((volatile uint32*)0x4001001C)
  12. #define DBGMCU_IDCODE       ((volatile uint32*)0xE0042000)
  13. #define DBGMCU_CR       ((volatile uint32*)0xE0042004)
  14. /*
  15.     0x80000000  Use MAPR2 register
  16.     0x000F0000  DBGAFR_POSITION_MASK
  17. */
  18. #define GPIO_Remap_SPI1             ((uint32)0x00000001)    /* SPI1 Alternate Function mapping */
  19. #define GPIO_Remap_I2C1             ((uint32)0x00000002)    /* I2C1 Alternate Function mapping */
  20. #define GPIO_Remap_USART1           ((uint32)0x00000004)    /* USART1 Alternate Function mapping */
  21. #define GPIO_Remap_USART2           ((uint32)0x00000008)    /* USART2 Alternate Function mapping */
  22. #define GPIO_PartialRemap_USART3    ((uint32)0x00140010)    /* USART3 Partial Alternate Function mapping */
  23. #define GPIO_FullRemap_USART3       ((uint32)0x00140030)    /* USART3 Full Alternate Function mapping */
  24. #define GPIO_PartialRemap_TIM1      ((uint32)0x00160040)    /* TIM1 Partial Alternate Function mapping */
  25. #define GPIO_FullRemap_TIM1         ((uint32)0x001600C0)    /* TIM1 Full Alternate Function mapping */
  26. #define GPIO_PartialRemap1_TIM2     ((uint32)0x00180100)    /* TIM2 Partial1 Alternate Function mapping */
  27. #define GPIO_PartialRemap2_TIM2     ((uint32)0x00180200)    /* TIM2 Partial2 Alternate Function mapping */
  28. #define GPIO_FullRemap_TIM2         ((uint32)0x00180300)    /* TIM2 Full Alternate Function mapping */
  29. #define GPIO_PartialRemap_TIM3      ((uint32)0x001A0800)    /* TIM3 Partial Alternate Function mapping */
  30. #define GPIO_FullRemap_TIM3         ((uint32)0x001A0C00)    /* TIM3 Full Alternate Function mapping */
  31. #define GPIO_Remap_TIM4             ((uint32)0x00001000)    /* TIM4 Alternate Function mapping */
  32.                                                     /* CAN1 Alternate Function mapping */
  33.                                                     /* 00: CAN_RX mapped to PA11, CAN_TX mapped to PA12 */
  34. #define GPIO_Remap1_CAN1            ((uint32)0x001D4000)    /* 10: CAN_RX mapped to PB8, CAN_TX mapped to PB9 (not available on 36-pin package) */
  35. #define GPIO_Remap2_CAN1            ((uint32)0x001D6000)    /* 11: CAN_RX mapped to PD0, CAN_TX mapped to PD1 */
  36.  
  37. #define GPIO_Remap_PD01             ((uint32)0x00008000)    /* PD01 Alternate Function mapping */
  38. #define GPIO_Remap_TIM5CH4_LSI      ((uint32)0x00200001)    /* LSI connected to TIM5 Channel4 input capture for calibration */
  39. #define GPIO_Remap_ADC1_ETRGINJ     ((uint32)0x00200002)    /* ADC1 External Trigger Injected Conversion remapping */
  40. #define GPIO_Remap_ADC1_ETRGREG     ((uint32)0x00200004)    /* ADC1 External Trigger Regular Conversion remapping */
  41. #define GPIO_Remap_ADC2_ETRGINJ     ((uint32)0x00200008)    /* ADC2 External Trigger Injected Conversion remapping */
  42. #define GPIO_Remap_ADC2_ETRGREG     ((uint32)0x00200010)    /* ADC2 External Trigger Regular Conversion remapping */
  43. #define GPIO_Remap_ETH              ((uint32)0x00200020)    /* Ethernet remapping (only for Connectivity line devices) */
  44. #define GPIO_Remap_CAN2             ((uint32)0x00200040)    /* CAN2 remapping (only for Connectivity line devices) */
  45. #define GPIO_Remap_SWJ_NoJTRST      ((uint32)0x00300100)    /* Full SWJ Enabled (JTAG-DP + SW-DP) but without JTRST */
  46. #define GPIO_Remap_SWJ_JTAGDisable  ((uint32)0x00300200)    /* JTAG-DP Disabled and SW-DP Enabled */
  47. #define GPIO_Remap_SWJ_Disable      ((uint32)0x00300400)    /* Full SWJ Disabled (JTAG-DP + SW-DP) */
  48. #define GPIO_Remap_SPI3             ((uint32)0x00201000)    /* SPI3/I2S3 Alternate Function mapping (only for Connectivity line devices) */
  49. #define GPIO_Remap_TIM2ITR1_PTP_SOF ((uint32)0x00202000)    /* Ethernet PTP output or USB OTG SOF (Start of Frame) connected
  50.                                                                  to TIM2 Internal Trigger 1 for calibration
  51.                                                                  (only for Connectivity line devices) */
  52. #define GPIO_Remap_PTP_PPS          ((uint32)0x00204000)    /* Ethernet MAC PPS_PTS output on PB05 (only for Connectivity line devices) */
  53.  
  54. #define GPIO_Remap_TIM15            ((uint32)0x80000001)    /* TIM15 Alternate Function mapping (only for Value line devices) */
  55. #define GPIO_Remap_TIM16            ((uint32)0x80000002)    /* TIM16 Alternate Function mapping (only for Value line devices) */
  56. #define GPIO_Remap_TIM17            ((uint32)0x80000004)    /* TIM17 Alternate Function mapping (only for Value line devices) */
  57. #define GPIO_Remap_CEC              ((uint32)0x80000008)    /* CEC Alternate Function mapping (only for Value line devices) */
  58. #define GPIO_Remap_TIM1_DMA         ((uint32)0x80000010)    /* TIM1 DMA requests mapping (only for Value line devices) */
  59.  
  60. #define GPIO_Remap_TIM9             ((uint32)0x80000020)    /* TIM9 Alternate Function mapping (only for XL-density devices) */
  61. #define GPIO_Remap_TIM10            ((uint32)0x80000040)    /* TIM10 Alternate Function mapping (only for XL-density devices) */
  62. #define GPIO_Remap_TIM11            ((uint32)0x80000080)    /* TIM11 Alternate Function mapping (only for XL-density devices) */
  63. #define GPIO_Remap_TIM13            ((uint32)0x80000100)    /* TIM13 Alternate Function mapping (only for XL-density devices) */
  64. #define GPIO_Remap_TIM14            ((uint32)0x80000200)    /* TIM14 Alternate Function mapping (only for XL-density devices) */
  65. #define GPIO_Remap_FSMC_NADV        ((uint32)0x80000400)    /* FSMC_NADV Alternate Function mapping (only for XL-density devices) */
  66.  
  67. void gpio_remap(uint32 GPIO_Remap, uint8 NewState);
  68. uint32 DBGMCU_GetREVID(void);
  69. uint32 DBGMCU_GetDEVID(void);
  70.  
  71. #ifdef __cplusplus
  72. } // extern "C"
  73. #endif
  74.  
  75. #endif
RAW Paste Data