UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
446 Views
Registered: ‎07-11-2018

AXI registers read /write access from userspace

Hi

I want to do read and write access to AXI registers from userspace, is there any xilinx APIs defined instead of using /dev/mem and creating custom APIs.

Please suggest

Tags (2)
0 Kudos
3 Replies
Moderator
Moderator
444 Views
Registered: ‎12-04-2016

Re: AXI registers read /write access from userspace

Hi @umamahesh

 

You can try enabling UIO userspace, as explained in this forum link to acheive read/write without devmem/mmap

https://forums.xilinx.com/t5/Embedded-Linux/How-to-access-AXI-registers-under-Petalinux/td-p/829599

 

 

 

0 Kudos
Moderator
Moderator
431 Views
Registered: ‎09-12-2007

Re: AXI registers read /write access from userspace

I have added some simple code here that you can use to read/write a register:

read_write.PNG

You can build this in SDK, or create a makefile:

APP = reg_read
 
# Add any other object files to this list below
APP_OBJS = read_write.o
 
 
all: $(APP)
 
 
$(APP): $(APP_OBJS)
    $(CC) $(LDFLAGS) -o $@ $(APP_OBJS) $(LDLIBS)
 
clean:
    -rm -f $(APP) *.elf *.gdb *.o $(APP_OBJS)
 
%.o: %.c
    $(CC) -c -Wall -O0 -g3 -c -fmessage-length=0 -MT"$@" -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"

 

298 Views
Registered: ‎06-04-2018

Re: AXI registers read /write access from userspace

Clean. Thanks for that code, it helps alot.
0 Kudos