DE10-Standard
User Manual
111
www.terasic.com
January 19, 2017
EDS command shell, go to the Quartus project folder, and execute
generate_hps_qsys_header.sh
by typing ‘./generate_hps_qys_header.sh”. Then, press ENTER key, a header file
hps_0.h
will be
generated. In the header file, the
led_pio
base address is represented by a constant
LED_PIO_BASE as show in
Figure 7-5
. The
led_pio
width is represented by a constant
LED_PIO_DATA_WIDTH. These two constants will be used in the C program demonstration code.
Figure 7-5 pio_led information defined in hps_0.h
Map LED_PIO Address
This section will describe how to map the pio_led physical address into a virtual address
which is accessible by an application software.
Figure 7-6
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
. Then, 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_LWFPGASLVS_OFST in the header hps.h. The hps.h is a header of SoC EDS. It is
located in the Quartus installation folder: