当前位置:首页 > K60 - GPIO头文件分析
[cpp] view plaincopyprint?
1. /* ---------------------------------------------------------------------------- 2. -- GPIO
3. ---------------------------------------------------------------------------- */ 4. 5. /**
6. * @addtogroup GPIO_Peripheral GPIO 7. * @{ 8. */ 9.
10. /** GPIO - Peripheral register structure */ 11. typedef struct GPIO_MemMap {
12. uint32_t PDOR; /**< Port Data Output Reg
ister, offset: 0x0 */
13. uint32_t PSOR; /**< Port Set Output Regi
ster, offset: 0x4 */
14. uint32_t PCOR; /**< Port Clear Output Re
gister, offset: 0x8 */
15. uint32_t PTOR; /**< Port Toggle Output R
egister, offset: 0xC */
16. uint32_t PDIR; /**< Port Data Input Regi
ster, offset: 0x10 */
17. uint32_t PDDR; /**< Port Data Direction
Register, offset: 0x14 */ 18. } volatile *GPIO_MemMapPtr;
19. /* ----------------------------------------------------------------------------
20. -- GPIO - Register accessor macros
21. ---------------------------------------------------------------------------- */ 22. 23. /**
24. * @addtogroup GPIO_Register_Accessor_Macros GPIO - Register accessor macros
25. * @{ 26. */ 27. 28.
29. /* GPIO - Register accessors */
30. #define GPIO_PDOR_REG(base) ((base)->PDOR) 31. #define GPIO_PSOR_REG(base) ((base)->PSOR) 32. #define GPIO_PCOR_REG(base) ((base)->PCOR)
33. #define GPIO_PTOR_REG(base) ((base)->PTOR) 34. #define GPIO_PDIR_REG(base) ((base)->PDIR) 35. #define GPIO_PDDR_REG(base) ((base)->PDDR) 36. 37. /** 38. * @}
39. */ /* end of group GPIO_Register_Accessor_Macros */ 40. 41.
42. /* ----------------------------------------------------------------------------
43. -- GPIO Register Masks
44. ---------------------------------------------------------------------------- */ 45. 46. /**
47. * @addtogroup GPIO_Register_Masks GPIO Register Masks 48. * @{ 49. */ 50.
51. /* PDOR Bit Fields */
52. #define GPIO_PDOR_PDO_MASK 0xFFFFFFFFu 53. #define GPIO_PDOR_PDO_SHIFT 0
54. #define GPIO_PDOR_PDO(x) (((uint32_t)(((uint32_t)(x)
)< 56. #define GPIO_PSOR_PTSO_MASK 0xFFFFFFFFu 57. #define GPIO_PSOR_PTSO_SHIFT 0 58. #define GPIO_PSOR_PTSO(x) (((uint32_t)(((uint32_t)(x) )< 60. #define GPIO_PCOR_PTCO_MASK 0xFFFFFFFFu 61. #define GPIO_PCOR_PTCO_SHIFT 0 62. #define GPIO_PCOR_PTCO(x) (((uint32_t)(((uint32_t)(x) )< 64. #define GPIO_PTOR_PTTO_MASK 0xFFFFFFFFu 65. #define GPIO_PTOR_PTTO_SHIFT 0 66. #define GPIO_PTOR_PTTO(x) (((uint32_t)(((uint32_t)(x) )< 68. #define GPIO_PDIR_PDI_MASK 0xFFFFFFFFu 69. #define GPIO_PDIR_PDI_SHIFT 0 70. #define GPIO_PDIR_PDI(x) (((uint32_t)(((uint32_t)(x) )< 72. #define GPIO_PDDR_PDD_MASK 0xFFFFFFFFu 73. #define GPIO_PDDR_PDD_SHIFT 0 74. #define GPIO_PDDR_PDD(x) (((uint32_t)(((uint32_t)(x) )< 78. */ /* end of group GPIO_Register_Masks */ 79. 80. 81. /* GPIO - Peripheral instance base addresses */ 82. /** Peripheral PTA base pointer */ 83. #define PTA_BASE_PTR ((GPIO_MemMapPtr)0x400FF000 u) 84. /** Peripheral PTB base pointer */ 85. #define PTB_BASE_PTR ((GPIO_MemMapPtr)0x400FF040 u) 86. /** Peripheral PTC base pointer */ 87. #define PTC_BASE_PTR ((GPIO_MemMapPtr)0x400FF080 u) 88. /** Peripheral PTD base pointer */ 89. #define PTD_BASE_PTR ((GPIO_MemMapPtr)0x400FF0C0 u) 90. /** Peripheral PTE base pointer */ 91. #define PTE_BASE_PTR ((GPIO_MemMapPtr)0x400FF100 u) 92. 93. /* ---------------------------------------------------------------------------- 94. -- GPIO - Register accessor macros 95. ---------------------------------------------------------------------------- */ 96. 97. /** 98. * @addtogroup GPIO_Register_Accessor_Macros GPIO - Register accessor macros 99. * @{ 100. */ 101. 102. 103. /* GPIO - Register instance definitions */ 104. /* PTA */ 105. #define GPIOA_PDOR GPIO_PDOR_REG(PTA_BASE_PTR ) 106. #define GPIOA_PSOR GPIO_PSOR_REG(PTA_BASE_PTR ) 107. #define GPIOA_PCOR GPIO_PCOR_REG(PTA_BASE_PTR ) 108. #define GPIOA_PTOR GPIO_PTOR_REG(PTA_BASE_PTR ) 109. #define GPIOA_PDIR GPIO_PDIR_REG(PTA_BASE_PTR ) 110. #define GPIOA_PDDR GPIO_PDDR_REG(PTA_BASE_PTR ) 111. /* PTB */ 112. #define GPIOB_PDOR GPIO_PDOR_REG(PTB_BASE_PTR ) 113. #define GPIOB_PSOR GPIO_PSOR_REG(PTB_BASE_PTR ) 114. #define GPIOB_PCOR GPIO_PCOR_REG(PTB_BASE_PTR ) 115. #define GPIOB_PTOR GPIO_PTOR_REG(PTB_BASE_PTR ) 116. #define GPIOB_PDIR GPIO_PDIR_REG(PTB_BASE_PTR ) 117. #define GPIOB_PDDR GPIO_PDDR_REG(PTB_BASE_PTR ) 118. /* PTC */ 119. #define GPIOC_PDOR GPIO_PDOR_REG(PTC_BASE_PTR ) 120. #define GPIOC_PSOR GPIO_PSOR_REG(PTC_BASE_PTR ) 121. #define GPIOC_PCOR GPIO_PCOR_REG(PTC_BASE_PTR ) 122. #define GPIOC_PTOR GPIO_PTOR_REG(PTC_BASE_PTR ) 123. #define GPIOC_PDIR GPIO_PDIR_REG(PTC_BASE_PTR ) 124. #define GPIOC_PDDR GPIO_PDDR_REG(PTC_BASE_PTR ) 125. /* PTD */ 126. #define GPIOD_PDOR GPIO_PDOR_REG(PTD_BASE_PTR ) 127. #define GPIOD_PSOR GPIO_PSOR_REG(PTD_BASE_PTR )
共分享92篇相关文档