the following.
1. LPC_GPIO_TypeDef is a typedef struct. In other words it is just a struct, not different that a typedef int is just an int.
2. What make things complicated is that there is a little struct inside the big struct, and there is something called a union. I forgot what is a union. So I need to google further. The struct has members DATA and DIR. Now I guess the weird string "->" should be like the dot which roughly member.
typedef struct
{
union
{
...
struct
{
}
}
...
}
LPC_GPIO_TypeDef;
.END
Now let me look more closely the 3 define statements.
1. #define LPC_AHB_BASE (0x50000000UL)
2. #define LPC_GPIO_BASE (LPC_AHB_BASE + 0x00000)
3. #define LPC_GPIO1 ((LPC_GPIO_TypeDef *) LPC_GPIO1_BASE )
typedef struct
{
union {
__IO uint32_t MASKED_ACCESS[4096]; /*!< Offset: 0x0000 (R/W) Port data Register for pins PIOn_0 to PIOn_11 */
struct {
uint32_t RESERVED0[4095];
__IO uint32_t DATA; /*!< Offset: 0x3FFC (R/W) Port data Register */
};
};
uint32_t RESERVED1[4096];
__IO uint32_t DIR; /*!< Offset: 0x8000 (R/W) Data direction Register */
__IO uint32_t IS; /*!< Offset: 0x8004 (R/W) Interrupt sense Register */
__IO uint32_t IBE; /*!< Offset: 0x8008 (R/W) Interrupt both edges Register */
__IO uint32_t IEV; /*!< Offset: 0x800C (R/W) Interrupt event Register */
__IO uint32_t IE; /*!< Offset: 0x8010 (R/W) Interrupt mask Register */
__I uint32_t RIS; /*!< Offset: 0x8014 (R/ ) Raw interrupt status Register */
__I uint32_t MIS; /*!< Offset: 0x8018 (R/ ) Masked interrupt status Register */
__O uint32_t IC; /*!< Offset: 0x801C ( /W) Interrupt clear Register */
} LPC_GPIO_TypeDef;
.END
No comments:
Post a Comment