- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
I have uclinux on nios, the memory is sdram, but now i do not know how to read or write the pio(built in sopc) in uclinux. can anybody help me?:) thanks a lot! my regards, wangyipinLink Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not sure how it works in the latest versions of uClinux, but in the (old) version I use the build system generates a nios2_system.h header file from my .ptf that defines all my PIO addresses as a "np_pio" struct. It automatically names them na_<pio name>. You can then write/read to them directly from your application (assuming you aren't using an MMU). So, e.g., if you have a PIO named my_pio in SOPC builder then you can read/write it as follows:
#include "nios2_system.h"
...
// Reads the PIO value.
int currvalue = na_my_pio->np_piodata;
// Writes a new value.
na_my_pio->np_piodata = newvalue;
...
See the definition of the np_pio struct for info on more advanced features (e.g., bidirectional data, edge detection).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks Tristan,
i will try, and i know the header file is the point- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- but now i do not know how to read or write the pio(built in sopc) in uclinux. --- Quote End --- In a device driver or in a user land program ? Using NIOS with our without MMU ? -Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In a user program without MMU.
What's the easiest way? --- Quote Start --- In a device driver or in a user land program ? Using NIOS with our without MMU ? -Michael --- Quote End ---
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page