92
In this demo code, the following mask is defined to control LED and KEY direction and LED’s
output value.
#define USER_IO_DIR (0x01000000)
#define BIT_LED (0x01000000)
#define BUTTON_MASK (0x02000000)
The following statement can be used to configure the LED associated pins as output pins.
alt_setbits_word( ( virtua
( ( uint32_t )( ALT_GPIO1_SWPORTA_DDR_ADDR ) &
( uint32_t )( HW_REGS_MASK ) ) ),
USER_IO_DIR
);
The following statement can be used to turn on the LED.
alt_setbits_word( ( virtua
( ( uint32_t )( ALT_GPIO1_SWPORTA_DR_ADDR ) &
( uint32_t )( HW_REGS_MASK ) ) ),
BIT_LED
);
The following statement can be used to read the content of
gpio_ext_porta
register. The bit mask is
used to check the status of the key.
alt_read_word( ( virtua
( ( uint32_t )( ALT_GPIO1_EXT_PORTA_ADDR ) &
( uint32_t )( HW_REGS_MASK ) ) ) );
.
Demonstration Source Code
Build tool: Altera SoC EDS V13.0
Project directory: \Demonstration\SoC\hps_gpio
Binary file: hps_gpio
Build command: make ('make clean' to remove all temporal files)
Execute command: ./hps_gpio
Summary of Contents for DE1-SOC
Page 1: ...1...
Page 108: ...107 Figure 8 4 Select Devices Page...