• 0
accel

Accessing specific registers of a custom IP

Question

After doing the hands on linux tutorial for the Zybo I have some grasp on how to access custom IP in linx. However, I'm confused on how to access the three other registers that the IP core has in the demo. I know its using a file transaction to get the user data and write the data to the IP core register in the kernel space.

Would I have to modify the kernel module source to parse the message and then do an IO write to a indicated register or do I have to write enough data to get to the desired register? Also how would I go about reading specific registers using the procfs method? (i.e. I want to write and read register 2 only).

Edited by JColvin
tags

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 1

Hello Accel,

The easiest method for this would be to modify the kernel module with additional function calls that use ioread32() and iowrite32() with base_addr+4 to index to the second register.  "+4" because the memory is stored in 32-bit words or 4-byte words.

A better implementation could use ioread32() and iowrite32() to read and write to an offset of the base_addr

prototype EX:

unsigned int my_read(unsigned long base_addr);

int my_write(uint32 value, unsigned long base_addr);

Hope this helps.

Best of Luck!

Marshall

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now