- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I'm trying to write/read to and from some PIO. I have read as much as I can find about this topic on the forums and nios wiki but im not having much luck. Ive made a little test program: <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>#include <stdio.h># include <asm/io.h> int main(void) { printf("writing to port:\n"); writew(0xFFFF,0x10402020); //data return 0; }</div> where 0x10402020 is the address of my PIO. The code doesn't do anything really... ive tried a few other methods, none seemed to work. Can anyone help!?!?!?Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You will need to bypass cache by turning on address bit 31.
writew(0xFFFF,0x10402020 | 0x80000000); //data - Hippo- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
<div class='quotetop'>QUOTE (hippo @ Aug 7 2009, 10:54 AM) <{post_snapback}> (index.php?act=findpost&pid=23449)</div>
--- Quote Start --- You will need to bypass cache by turning on address bit 31. writew(0xFFFF,0x10402020 | 0x80000000); //data - Hippo[/b] --- Quote End --- Hi, what does that acually mean? Unfortunately that didn't work. My output port are all set to high no matter what. Also, I have two ports, one output and one bidirectional. Is there a way to change the direction of a port? Or does writew /readw take care of that?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
<div class='quotetop'>QUOTE (Gaz @ Aug 7 2009, 10:16 AM) <{post_snapback}> (index.php?act=findpost&pid=23448)</div>
--- Quote Start --- Hi all, I'm trying to write/read to and from some PIO. I have read as much as I can find about this topic on the forums and nios wiki but im not having much luck. Ive made a little test program: <div class='codetop'>CODE --- Quote End --- <div class='codemain' style='height:200px;white-space:pre;overflow:auto'>#include <stdio.h># include <asm/io.h> int main(void) { printf("writing to port:\n"); writew(0xFFFF,0x10402020); //data return 0; }</div> where 0x10402020 is the address of my PIO. The code doesn't do anything really... ive tried a few other methods, none seemed to work. Can anyone help!?!?!?[/b] --- Quote End --- got it! had to find the correct register to change the direction (can find them in the nios2eds io.h). so doing utw(0xFFFF,(0x10402020+4)) wrote 0xFFFF to the direction register and changed the port to an output. Maybe this will help someone else one day....
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