Forum Discussion
Altera_Forum
Honored Contributor
8 years agoHi Kyle,
Thanks for your support...also would like to know if there are any configurations in the Assignments->Device->Deviceandpinoptions->Unused pins (An input Tristated) to access the pin and see the output. I am using a C file which has hps.h through which I assign GPIO1_SWPORTA_DR_ADDR and configuring these registers to get the output. eg: # include <stdio.h> # include <unistd.h> # include <fcntl.h> # include <sys/mman.h> # include "hwlib.h" # include "soc_cv_av/socal/socal.h" # include "soc_cv_av/socal/hps.h" # include "soc_cv_av/socal/alt_gpio.h" # define HW_REGS_BASE ( ALT_STM_OFST ) # define HW_REGS_SPAN ( 0x04000000 ) # define HW_REGS_MASK ( HW_REGS_SPAN - 1 ) # define USER_IO_DIR (0x01000008) # define BIT_LED (0x01000008) # define BUTTON_MASK (0x02000000) int main(int argc, char **argv) { void *virtual_base; int fd; uint32_t scan_input; int i; // map the address space for the LED registers into user space so we can interact with them. // we'll actually map in the entire CSR span of the HPS since we want to access various registers within that span if( ( fd = open( "/dev/mem", ( O_RDWR | O_SYNC ) ) ) == -1 ) { printf( "ERROR: could not open \"/dev/mem\"...\n" ); return( 1 ); } virtual_base = mmap( NULL, HW_REGS_SPAN, ( PROT_READ | PROT_WRITE ), MAP_SHARED, fd, HW_REGS_BASE ); if( virtual_base == MAP_FAILED ) { printf( "ERROR: mmap() failed...\n" ); close( fd ); return( 1 ); } // initialize the pio controller // led: set the direction of the HPS GPIO1 bits attached to LEDs to output alt_clrbits_word( ( virtual_base + ( ( uint32_t )( ALT_GPIO1_SWPORTA_DR_ADDR) & ( uint32_t )( HW_REGS_MASK ) ) ), BIT_LED ); alt_setbits_word( ( virtual_base + ( ( uint32_t )( ALT_GPIO1_SWPORTA_DR_ADDR) & ( uint32_t )( HW_REGS_MASK ) ) ), USER_IO_DIR ); so this should work..Let me know get some idea --Ravi