HAN Pilot Platform
Demonstration Manual
65
www.terasic.com
September 6, 2019
Figure 4-4 PIO led address in Qsys’s Address Map
Map LED_PIO Address
This section will describe how to map the led_pio physical address into a virtual address which is
accessible by an application software.
shows the C program to derive the virtual address
of led_pio base address. First, open system-call is used to open memory device driver “/dev/mem”,
and then the mmap system-call is used to map HPS physical address into a virtual address
represented by the void pointer variable virtual_base. The demo code maps the physical base
address (HW_REGS_BASE = 0xfc000000) of the peripheral region into a based virtual address
virtual_base. For any controller in the peripheral region, users can calculate their virtual address by
adding their offset relative to the peripheral region to the based virtual address virtual_base. Based
on the rule, the virtual address of led_pio can be calculated by adding the below two offset
addresses to virtual_base.
Offset address of Lightweight HPS-to-FPGA AXI bus relative to HPS base address
Offset address of Pio_led relative to Lightweight HPS-to-FPGA AXI bus
The
first
offset
address
is
0xff200000
which
is
defined
as
a
constant
ALT_FPGA_BRIDGE_LWH2F_OFST in the header hps.h. The hps.h is a header of SoC EDS. It is
located in the Quartus installation folder: D:\ IntelFPGA\ 18.0\ embedded\ ip\ altera\ hps\
altera_hps\ hwlib\ include\ soc_a10\socal.
The second offset address is 0x120 which is led_pio’s address defined as LED_PIO_BASE in the C
code file.
The virtual address of led_pio is represented by a void pointer variable
h2p_lw_led_addr
.
Application program can directly use the pointer variable to access the registers in the controller of
LED_PIO
.
Содержание HAN Pilot Platform
Страница 1: ......
Страница 92: ...HAN Pilot Platform Demonstration Manual 91 www terasic com September 6 2019...