* FPGA registers userspace interface?
@ 2011-01-03 12:47 Kfir Lavi
2011-01-03 12:57 ` Daniel Baluta
2011-01-03 13:00 ` Philip Downer
0 siblings, 2 replies; 7+ messages in thread
From: Kfir Lavi @ 2011-01-03 12:47 UTC (permalink / raw)
To: kernelnewbies
Hi,
I have a FPGA that is constantly changing (its on development phase).
I want to let userspace app to update those registers, but don't want to
create an API yet.
What is the best way to open a range of registers to userspace, so no driver
update is required?
Thanks,
Kfir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110103/24b752ce/attachment.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* FPGA registers userspace interface?
2011-01-03 12:47 FPGA registers userspace interface? Kfir Lavi
@ 2011-01-03 12:57 ` Daniel Baluta
2011-01-03 13:00 ` Philip Downer
1 sibling, 0 replies; 7+ messages in thread
From: Daniel Baluta @ 2011-01-03 12:57 UTC (permalink / raw)
To: kernelnewbies
On Mon, Jan 3, 2011 at 2:47 PM, Kfir Lavi <lavi.kfir@gmail.com> wrote:
> Hi,
> I have a FPGA that is constantly changing (its on development phase).
> I want to let userspace app to update those registers, but don't want to
> create an API yet.
> What is the best way to open a range of registers to userspace, so no driver
> update is required?
You can think of exporting them via sysfs, together with some additional
information like register base address.
thanks,
Daniel.
^ permalink raw reply [flat|nested] 7+ messages in thread
* FPGA registers userspace interface?
2011-01-03 12:47 FPGA registers userspace interface? Kfir Lavi
2011-01-03 12:57 ` Daniel Baluta
@ 2011-01-03 13:00 ` Philip Downer
2011-01-03 15:09 ` Kfir Lavi
1 sibling, 1 reply; 7+ messages in thread
From: Philip Downer @ 2011-01-03 13:00 UTC (permalink / raw)
To: kernelnewbies
On 03/01/11 12:47, Kfir Lavi wrote:
> I have a FPGA that is constantly changing (its on development phase).
> I want to let userspace app to update those registers, but don't want to
> create an API yet.
> What is the best way to open a range of registers to userspace, so no
> driver update is required?
When I had to do this recently I used sysfs, I have no idea if it's the
best way but it certainly was very effective. Remember in sysfs that
each file should only have one value.
Once it's setup though you can just write to the sysfs files, I started
by writing simple perl scripts to test things before starting to write
more complex apps.
HTH
Phil
^ permalink raw reply [flat|nested] 7+ messages in thread
* FPGA registers userspace interface?
2011-01-03 13:00 ` Philip Downer
@ 2011-01-03 15:09 ` Kfir Lavi
2011-01-03 15:21 ` Kfir Lavi
0 siblings, 1 reply; 7+ messages in thread
From: Kfir Lavi @ 2011-01-03 15:09 UTC (permalink / raw)
To: kernelnewbies
On Mon, Jan 3, 2011 at 3:00 PM, Philip Downer <phil@pjd.me.uk> wrote:
> On 03/01/11 12:47, Kfir Lavi wrote:
>
> I have a FPGA that is constantly changing (its on development phase).
>> I want to let userspace app to update those registers, but don't want to
>> create an API yet.
>> What is the best way to open a range of registers to userspace, so no
>> driver update is required?
>>
>
> When I had to do this recently I used sysfs, I have no idea if it's the
> best way but it certainly was very effective. Remember in sysfs that each
> file should only have one value.
>
> Once it's setup though you can just write to the sysfs files, I started by
> writing simple perl scripts to test things before starting to write more
> complex apps.
>
> HTH
>
> Phil
>
So what do expose in sysfs? for each register - a file of it's own? or you
get a bulk of data to one file?
Thanks,
Kfir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110103/5e5d4c27/attachment.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* FPGA registers userspace interface?
2011-01-03 15:09 ` Kfir Lavi
@ 2011-01-03 15:21 ` Kfir Lavi
2011-01-03 20:52 ` Daniel Baluta
0 siblings, 1 reply; 7+ messages in thread
From: Kfir Lavi @ 2011-01-03 15:21 UTC (permalink / raw)
To: kernelnewbies
On Mon, Jan 3, 2011 at 5:09 PM, Kfir Lavi <lavi.kfir@gmail.com> wrote:
>
>
> On Mon, Jan 3, 2011 at 3:00 PM, Philip Downer <phil@pjd.me.uk> wrote:
>
>> On 03/01/11 12:47, Kfir Lavi wrote:
>>
>> I have a FPGA that is constantly changing (its on development phase).
>>> I want to let userspace app to update those registers, but don't want to
>>> create an API yet.
>>> What is the best way to open a range of registers to userspace, so no
>>> driver update is required?
>>>
>>
>> When I had to do this recently I used sysfs, I have no idea if it's the
>> best way but it certainly was very effective. Remember in sysfs that each
>> file should only have one value.
>>
>> Once it's setup though you can just write to the sysfs files, I started by
>> writing simple perl scripts to test things before starting to write more
>> complex apps.
>>
>> HTH
>>
>> Phil
>>
> So what do expose in sysfs? for each register - a file of it's own? or you
> get a bulk of data to one file?
>
> Thanks,
> Kfir
>
I thought about using 3 files in sysfs.
1. address of the register
2. data to write to the register
3. trigger that do the write
Please share your comments.
Regards,
Kfir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110103/d9f16f74/attachment.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* FPGA registers userspace interface?
2011-01-03 15:21 ` Kfir Lavi
@ 2011-01-03 20:52 ` Daniel Baluta
2011-01-03 21:29 ` Greg KH
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Baluta @ 2011-01-03 20:52 UTC (permalink / raw)
To: kernelnewbies
> I thought about using 3 files in sysfs.
> 1. address of the register
> 2. data to write to the register
> 3. trigger that do the write
The most effective solution would be to
have one file per register.
Writing register:
# echo value > /sys/path/to/file
Reading register:
# cat /sys/path/to/file
Also, since your FPGA is in development phase I assume that
the registers base address is changing (or am I wrong?). You can
solve this with an additional writable sysfs entry which will
hold the current base address.
thanks,
Daniel.
^ permalink raw reply [flat|nested] 7+ messages in thread
* FPGA registers userspace interface?
2011-01-03 20:52 ` Daniel Baluta
@ 2011-01-03 21:29 ` Greg KH
0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2011-01-03 21:29 UTC (permalink / raw)
To: kernelnewbies
On Mon, Jan 03, 2011 at 10:52:34PM +0200, Daniel Baluta wrote:
> > I thought about using 3 files in sysfs.
> > 1. address of the register
> > 2. data to write to the register
> > 3. trigger that do the write
>
> The most effective solution would be to
> have one file per register.
>
> Writing register:
> # echo value > /sys/path/to/file
>
> Reading register:
> # cat /sys/path/to/file
>
> Also, since your FPGA is in development phase I assume that
> the registers base address is changing (or am I wrong?). You can
> solve this with an additional writable sysfs entry which will
> hold the current base address.
Also remember that debugfs would also be good for something like this,
being much easier to use than sysfs.
Note the rule when using debugfs:
There is are no rules when using debugfs.
Which works much better when doing development :)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-01-03 21:29 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-03 12:47 FPGA registers userspace interface? Kfir Lavi
2011-01-03 12:57 ` Daniel Baluta
2011-01-03 13:00 ` Philip Downer
2011-01-03 15:09 ` Kfir Lavi
2011-01-03 15:21 ` Kfir Lavi
2011-01-03 20:52 ` Daniel Baluta
2011-01-03 21:29 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).