1/1

|
Openrisc linux port io
by wachag on Sep 29, 2012 |
wachag
Posts: 6 Joined: Feb 3, 2010 Last seen: Oct 12, 2013 |
||
|
Dear community,
I am developing an embedded software for my student work using the openrisc processor in an FPGA. I have created a custom wishbone IP which I want to use from userspace. I have tried to use ioperm() and outb() from my software, but these are not implemented in uClibc. What is the way to do basic IO port operations? I can write a kernel driver (character device or a GPIO device), but it seems a bit overkill to me. Regards, Gabor |
|||
|
RE: Openrisc linux port io
by firefalcon on Sep 29, 2012 |
firefalcon
Posts: 99 Joined: Jan 10, 2011 Last seen: Mar 26, 2024 |
||
|
Dear community,
I am developing an embedded software for my student work using the openrisc processor in an FPGA. I have created a custom wishbone IP which I want to use from userspace. I have tried to use ioperm() and outb() from my software, but these are not implemented in uClibc. What is the way to do basic IO port operations? I can write a kernel driver (character device or a GPIO device), but it seems a bit overkill to me. Regards, Gabor Here is a secret...the OR1200 doesn't really check the supervisor bit (SR[0]). You should be able to communicate using memory-mapped IO from a userspace application. |
|||
|
RE: Openrisc linux port io
by wachag on Sep 30, 2012 |
wachag
Posts: 6 Joined: Feb 3, 2010 Last seen: Oct 12, 2013 |
||
|
Unfortunately, it does not work, it segfaults when I try to access the memory.
(I tried with a simple pointer and also with mmaping /dev/mem). Gabor |
|||
|
RE: Openrisc linux port io
by firefalcon on Sep 30, 2012 |
firefalcon
Posts: 99 Joined: Jan 10, 2011 Last seen: Mar 26, 2024 |
||
|
Unfortunately, it does not work, it segfaults when I try to access the memory.
(I tried with a simple pointer and also with mmaping /dev/mem). Gabor Sorry, I forgot that since the process is running in a virtual address space and the device address is physical and not mapped into the process's virtual address space you are going to get a segfault. You could try to use mmap() to map-in the device or you could just stick with the device driver approach (which is probably the correct way to do it anyway). |
|||
|
RE: Openrisc linux port io
by firefalcon on Oct 14, 2012 |
firefalcon
Posts: 99 Joined: Jan 10, 2011 Last seen: Mar 26, 2024 |
||
|
After playing around on a project involving an ARM board, I realized that you can open /dev/mem and call mmap() to map the appropriate address range into your process. If you set the permissions correctly, you will be able to have full access to the mapped-in memory. I don't know if the OpenRISC version of uclibc supports this approach though, since I haven't tried it on the OR1200.
|
|||
|
RE: Openrisc linux port io
by wachag on Oct 24, 2012 |
wachag
Posts: 6 Joined: Feb 3, 2010 Last seen: Oct 12, 2013 |
||
|
This was my first approach for the solution, and unfortunately it did not work. Since that, I've written a kernel module, so the problem is solved, albeit not the easy way I would have liked.
|
|||
1/1

