General Purpose Input Output (通用输入/输出)简称为GPIO,或总线扩展器,使用工业规范I2C、SMBus或SPI接口简化了I/O口的扩展。当微操控器或芯片组没有满足的I/O端口,或当体系需求选用远端串行通讯或操控时,GPIO产品能够供给额定的操控和监督功用。
S3C2440A has 130 multi-functional input/output port pins and there are eight ports as shown below:
— Port A(GPA): 25-output port
— Port B(GPB): 11-input/out port
— Port C(GPC): 16-input/output port
— Port D(GPD): 16-input/output port
— Port E(GPE): 16-input/output port
— Port F(GPF): 8-input/output port
— Port G(GPG): 16-input/output port
— Port H(GPH): 9-input/output port
— Port J(GPJ): 13-input/output port
Each port can be easily configured by software to meet various system configurations and design requirements. You have to define which function of each pin is used before starting the main program. If a pin is not used for multiplexed functions, the pin can be configured as I/O ports
从上面的信息能够看出,S3C2440芯片共有130个GPIO引脚,分为9组
关于GPIO的寄存器
PORT CONFIGURATION REGISTER (GPACON-GPJCON)
In S3C2440A, most of the pins are multiplexed pins. So, It is determined which function is selected for each pins.
The PnCON(port control register) determines which function is used for each pin.
If PE0 – PE7 is used for the wakeup signal in power down mode, these ports must be configured in interrupt mode.
PORT DATA REGISTER (GPADAT-GPJDAT)
If Ports are configured as output ports, data can be written to the corresponding bit of PnDAT. If Ports are configured
as input ports, the data can be read from the corresponding bit of PnDAT.
PORT PULL-UP REGISTER (GPBUP-GPJUP)
The port pull-up register controls the pull-up resister enable/disable of each port group. When the corresponding bit is
0, the pull-up resister of the pin is enabled. When 1, the pull-up resister is disabled.
If the port pull-up register is enabled then the pull-up resisters work without pin’s functional setting(input, output,
DATAn, EINTn and etc
关于怎么设定寄存器,请参阅芯片手册