126
7
7
.
.
7
7
W
W
h
h
y
y
t
t
h
h
e
e
L
L
E
E
D
D
B
B
l
l
i
i
n
n
k
k
s
s
The Nios II system description header file,
system.h
, contains the software definitions, name,
locations, base addresses, and settings for all of the components in the Nios II hardware system. The
system.h
file is located in the in the
hello_world_0_syslib\Debug\system_description
directory,
and is shown in
Figure 7-59
.
Figure 7-59 The system.h file
If you look in the
system.h
file for the Nios II project example used in this tutorial, you will notice
the
pio_led
function. This function controls the LEDs. The Nios II processor controls the PIO ports
(and thereby the LEDs) by reading and writing to the register map. For the PIO, there are four
registers:
data, direction, interruptmask, and edgecapture
. To turn the LED on and off, the
application writes to the PIO’s data register.
The PIO core has an associated software file
altera_avalon_pio_regs.h
. This file defines the core’s
register map, providing symbolic constants to access the low-level hardware. The
altera_avalon_pio_regs.h
file is located in the directory,
altera\10.1\ip\sopc_builder_ip\altera_avalon_pio
.
When you include the
altera_avalon_pio_regs.h
file, several useful functions that manipulate the
PIO core registers are available to your program. In particular, the macro
IOWR_ALTERA_AVALON_PIO_DATA(base, data)
Summary of Contents for De0-Nano
Page 1: ...1 ...
Page 4: ...4 9 3 Revision History 155 9 4 Copyright Statement 155 ...
Page 44: ...44 Figure 6 5 Browse to find the location Figure 6 6 There is no need to test the driver ...
Page 90: ...90 Figure 7 14 Add NIOS II Processor ...
Page 93: ...93 Figure 7 17 Rename the CPU 1 Figure 7 18 Rename the CPU 2 ...
Page 98: ...98 Figure 7 23 Add On Chip Memory ...
Page 100: ...100 Figure 7 25 Update Total memory size ...
Page 102: ...102 Figure 7 28 Update CPU settings ...
Page 104: ...104 Figure 7 30 Add PIO ...
Page 106: ...106 Figure 7 32 PIO 21 Rename pio_0 to pio_led as shown in Figure 7 33 Figure 7 33 Rename PIO ...
Page 113: ...113 Figure 7 43 Input verilog Text Figure 7 44 Open DE0_NANO_SOPC v ...
Page 146: ...146 Figure 8 16 Display Progress and Result Information for the SDRAM Demonstration ...
Page 150: ...150 Figure 9 3 Select Devices Page ...
Page 151: ...151 Figure 9 4 Convert Programming Files Page ...