
DE10-Standard
User Manual
93
www.terasic.com
January 19, 2017
Figure 6-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"