|
#define GPIO_BASE 0x40028000 /* GPIO registers base*/
GPIO寄存器定义
typedef struct
{
volatile UNS_32 pio_inp_state; /* Input pin state register */
volatile UNS_32 pio_outp_set; /* Output pin set register */
volatile UNS_32 pio_outp_clr; /* Output pin clear register */
volatile UNS_32 pio_outp_state; /* Output pin state register */
volatile UNS_32 pio_dir_set; /* GPIO direction set register */
volatile UNS_32 pio_dir_clr; /* GPIO direction clear register */
volatile UNS_32 pio_dir_state; /* GPIO direction state register */
volatile UNS_32 pio_sdinp_state; /* SDRAM-Input pin state register*/
volatile UNS_32 pio_sdoutp_set; /* SDRAM-Output pin set register */
volatile UNS_32 pio_sdoutp_clr; /* SDRAM-Output pin clear register*/
volatile UNS_32 pio_mux_set; /* PIO mux control set register*/
volatile UNS_32 pio_mux_clr; /* PIO mux control clear register*/
volatile UNS_32 pio_mux_state; /* PIO mux state register */
volatile UNS_32 reserved1 [3];
volatile UNS_32 p0_pin_read; /* P0 GPIOs pin read register */
volatile UNS_32 p0_outp_set; /* P0 GPIOs output set register */
volatile UNS_32 p0_outp_clr; /* P0 GPIOs output clear register */
volatile UNS_32 p0_outp_state; /* P0 GPIOs output state register */
volatile UNS_32 p0_dir_set; /* P0 GPIOs direction set reg */
volatile UNS_32 p0_dir_clr; /* P0 GPIOs direction clear reg */
volatile UNS_32 p0_dir_state; /* P0 GPIOs direction state reg */
。。。。。。。。。。。。。。。。
} GPIO_REGS_T;
#define GPIO ((GPIO_REGS_T *)(GPIO_BASE))
****************************************************************************************
但手册里实际的寄存器
Port 3
0x4002 8000 P3_INP_STATE
0x4002 8004 P3_OUTP_SET
0x4002 8008 P3_OUTP_CLR
0x4002 800C P3_OUTP_STATE
Port 2
0x4002 801C P2_INP_STATE
0x4002 8020 P2_OUTP_SET
0x4002 8024 P2_OUTP_CLR
0x4002 8010 P2_DIR_SET
0x4002 8014 P2_DIR_CLR
0x4002 8018 P2_DIR_STATE
Port 0
0x4002 8040 P0_INP_STATE
0x4002 8044 P0_OUTP_SET
0x4002 8048 P0_OUTP_CLR
0x4002 804C P0_OUTP_STATE
0x4002 8050 P0_DIR_SET
0x4002 8054 P0_DIR_CLR
0x4002 8058 P0_DIR_STATE
Port 1
0x4002 8060 P1_INP_STATE
0x4002 8064 P1_OUTP_SET
0x4002 8068 P1_OUTP_CLR
0x4002 806C P1_OUTP_STATE
0x4002 8070 P1_DIR_SET
0x4002 8074 P1_DIR_CLR
0x4002 8078 P1_DIR_STATE
。。。。。。。。。
对比发现寄存器排列顺序不一致啊,那他们怎么能相互对应起来呢
|
|