HAN Pilot Platform
Demonstration Manual
46
www.terasic.com
September 6, 2019
GPIO Register Address Mapping
The registers of HPS peripherals are mapped to HPS base address space 0xFC000000 with 64MB
size. The registers of the GPIO1 controller are mapped to the base address 0xFFC02A00 with 256B
size, and the registers of the GPIO2 controller are mapped to the base address 0xFFC02B00 with
256B size, as shown in
Figure 3-3 GPIO address map
Software API
Developers can use the following software API to access the register of GPIO controller.
open:
open memory mapped device driver
mmap
: map physical memory to user space
alt_read_word
: read a value from a specified register
alt_write_word
: write a value into a specified register
munmap
: clean up memory mapping
close
: close device driver
Developers can also use the following MACRO to access the register.
alt_setbits_word:
set specified bit value to one for a specified register
alt_clrbits_word
: set specified bit value to zero for a specified register
The program must include the following header files to use the above API to access the registers of
GPIO controller.
include <stdio.h>
include <unistd.h>
include <fcntl.h>
include <sys/mman.h>
include "hwlib.h"
include "socal/socal.h"
include "socal/hps.h"
include "socal/alt_gpio.h"
LED and KEY Control
shows the HPS users LED and KEY pin assignment for the HAN Pilot Platform. The
LED is connected to GPIO1_IO1 and the KEY is connected to GPIO1_IO4.
Содержание HAN Pilot Platform
Страница 1: ......
Страница 92: ...HAN Pilot Platform Demonstration Manual 91 www terasic com September 6 2019...