90
Figure 6-3 GPIO Address Map
Software API
Developers can use the following software API to access the register of GPIO controller.
open: use to 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 zero for a specified register
alt_clrbits_word: set specified bit value to one for a specified register
To use the above API to access register of GPIO controller, the program must include the following
header files.
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include "hwlib.h"
#include "socal/socal.h"
#include "socal/hps.h"