
DE10-Standard
User Manual
112
www.terasic.com
January 19, 2017
D:\altera\embedded\ip\altera\hps\altera_hps\hwlib\include\soc_cv_av\socal
The second offset address is 0x10040 which is defined as LED_PIO_BASE in the hps_0.h
header file which is generated in above section.
The virtual address of pio_led 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
.
Figure 7-6 LED_PIO memory map code
LED Control
C programmers need to understand the Register Map of the PIO core for
LED_PIO
before they can
control it.
Figure 7-7
shows the Register Map for the PIO Core. Each register is 32-bit width. For
detail information, please refer to the datasheet of PIO Core. For led control, we just need to write
output value to the offset 0 register relative to based address 0x10040. Because the led on
DE10-Standard is high active, writing a value 0x00000000 to the offset 0 register will turn off all of
the nine red LEDs. There are 10 red LEDs on DE10-Standard and 9 of them are connected to this
controller. The last LED (LED0) is used to implement FPGA heartbeat. Writing a value 0x000001ff
to the offset 0 register will turn on all of nine red LEDs. In C program, writing a value 0x0000001ff
to the offset 0 register of pio_led can be implemented as:
*(uint32_t *) h2p_lw_led_addr= 0x000001ff;
The state will assign the void pointer to a uint32_t pointer, so C compiler knows write a 32-bit value
0x000001ff to the virtual address h2p_lw_led_addr.