[技术问题解答] 关于GPIO的库文件的C程序问题

[复制链接]
1210|0
 楼主| 追梦听雨 发表于 2016-4-28 10:07 | 显示全部楼层 |阅读模式
  1. typedef struct {
  2.   __IO uint32_t PDOR;                              /**< Port Data Output Register, offset: 0x0 */
  3.   __O  uint32_t PSOR;                              /**< Port Set Output Register, offset: 0x4 */
  4.   __O  uint32_t PCOR;                              /**< Port Clear Output Register, offset: 0x8 */
  5.   __O  uint32_t PTOR;                              /**< Port Toggle Output Register, offset: 0xC */
  6.   __I  uint32_t PDIR;                              /**< Port Data Input Register, offset: 0x10 */
  7.   __IO uint32_t PDDR;                              /**< Port Data Direction Register, offset: 0x14 */
  8. } GPIO_Type, *GPIO_MemMapPtr;


  9. /* GPIO - Peripheral instance base addresses */
  10. /** Peripheral PTA base address */
  11. #define PTA_BASE                                 (0x400FF000u)
  12. /** Peripheral PTA base pointer */
  13. #define PTA                                      ((GPIO_Type *)PTA_BASE)
  14. #define PTA_BASE_PTR                             (PTA)
  15. /** Peripheral PTB base address */
  16. #define PTB_BASE                                 (0x400FF040u)
  17. /** Peripheral PTB base pointer */
  18. #define PTB                                      ((GPIO_Type *)PTB_BASE)
  19. #define PTB_BASE_PTR                             (PTB)
  20. /** Peripheral PTC base address */
  21. #define PTC_BASE                                 (0x400FF080u)
  22. /** Peripheral PTC base pointer */
  23. #define PTC                                      ((GPIO_Type *)PTC_BASE)
  24. #define PTC_BASE_PTR                             (PTC)
  25. /** Peripheral PTD base address */
  26. #define PTD_BASE                                 (0x400FF0C0u)
  27. /** Peripheral PTD base pointer */
  28. #define PTD                                      ((GPIO_Type *)PTD_BASE)
  29. #define PTD_BASE_PTR                             (PTD)
  30. /** Peripheral PTE base address */
  31. #define PTE_BASE                                 (0x400FF100u)
  32. /** Peripheral PTE base pointer */
  33. #define PTE                                      ((GPIO_Type *)PTE_BASE)
  34. #define PTE_BASE_PTR                             (PTE)
  35. /** Array initializer of GPIO peripheral base pointers */
  36. #define GPIO_BASES                               { PTA, PTB, PTC, PTD, PTE }


  37. #define GPIO_BASES {PTA, PTB, PTC, PTD, PTE, PTF}


  38. static GPIO_Type * const GPIO_InstanceTable[] = GPIO_BASES;

这里边的typedef struct {……} GPIO_Type, *GPIO_MemMapPtr;怎么理解
还有就是static GPIO_Type * const GPIO_InstanceTable[] = GPIO_BASES;等号左右表示什么意思
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

1

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部