Ameba-D User Manual
User Manual All information provided in this document is subject to legal disclaimers. © REALTEK 2019. All rights reserved.
60
Under software control, the direction of the external I/O pad is controlled by a write to the Port
x
data direction register (gpio_swport
x
_ddr).
The data written to this memory-mapped register gets mapped onto an output signal, gpio_port
x
_ddr, of the gpio peripheral. This output
signal controls the direction of an external I/O pad.
The data written to the Port
x
data register (gpio_swport
x
_dr) drives the output buffer of the I/O pad. External data are input on the external
data signal, gpio_ext_port
x
. Depending on whether gpio_ext_port
x
is configured as an input or output, the following occurs:
Input – Reads the values on the signal
Output – Reads the data register for Port
x
The gpio_ext_port
x
register is read-only, meaning that it cannot be written from the APB software interface.
8.2.1.2
Hardware Control Mode
If a signal is configured for hardware control, it has external, auxiliary hardware signals controlling the data and the direction of Ports A through
D. In this mode, the auxiliary data input signal (aux_portx_out) and direction control signal (aux_portx_en) are selected, where
x
is a.
The data direction of the external I/O pad, gpio_portx_ddr, is controlled through the auxiliary signal direction control signal, aux_portx_en.
For lines that are set to Output, the gpio_portx_dr and gpio_portx_ddr output signals drive the data and direction control onto the
bidirectional pad that exists within the I/O ring of the SoC device. Fig 8-2 shows how the gpio peripheral controls the data and direction signals
of an I/O PAD and data generation for the auxiliary source.
The gpio_swportx_ctl signal masks the value on the gpio_ext_portx external signal in order to generate aux_portx_in. The net result is that
when hardware mode is selected, the value on aux_port_in output signal is equal to the value on the gpio_ext_portx input signal. When
software mode is selected, the aux_portx_in output signal is always driven low. Setting bit 0 of gpio_swportx_ctl to 1 selects hardware mode
for the entire signal if the parameter GPIO_PORTX_SINGLE_CTL is 1. If GPIO_PORTX_SINGLE_CTL is 0, setting bit n of gpio_swportx_ctl to 1
selects hardware mode for bit n of Portx. Setting bit 0 of gpio_swportx_ctl to 0 selects software mode for the entire signal if
GPIO_PORTX_SINGLE_CTL is 1, while setting bit n of gpio_swportx_ctl to 0 selects software mode for bit n of Portx if GPIO_PORTX_SINGLE_CTL
is 0. gpio_swportx_ctl to 0 selects software mode for bit n of Portx if GPIO_PORTX_SINGLE_CTL is 0.
8.2.1.3
Reading External Signals
The data on the external GPIO signal is read by an APB read of the memory-mapped register, gpio_ext_port
x
. An APB read to the pio_ext_port
x
register provides either the data on the gpio_ext_port
x
control lines or the contents of the gpio_swport
x
_dr, depending on the value of
gpio_swportx_ddr.
Fig 8-2 shows how the hardware/software option is multiplexed, where the control lines for the multiplexing come from a memory-mapped
register. It also shows the synchronization registers and the individual bit control of each data and data direction bit.
Note
: The synchronization registers are optimized at the synthesis stage if the GPIO_PA_SYNC_EXT_DATA configuration parameter is equal to
0.
Fig 8-3 shows a timing diagram of a read to the gpio_ext_port
x
memory map registers when the direction is set to
Input
and the metastability
registers are included.
Note
: The maximum data rate that can be read back on consecutive reads from gpio_ext_port
x
must be less than pclk/2. Two pclk cycles per
read access is required due to the non-pipelined nature of the APB. The assumption is that the APB bridge does not lose ownership of the AHB
during consecutive accesses when PCLK=HCLK.
Realtek confidential files
The document authorized to
SZ99iot
2019-05-15 10:08:03