- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
Maybe a silly question... What is the purpose of the io.h headerfile? A memory addressable device can be referenced as follows: data = *(INT32U*) 0x200000; or using io.h data = IORD_32DIRECT(0x200000, 0); I find that it some cases the first option does not work correctly - the device chip selects do not get set while doing the read. I have now switched to using io.h for such reads but would like to know if anyone can explain this? Thanks RLink Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm guessing that you have a data cache in your system, which is why you're seeing strange results with your first example. The second example maps onto the ldxio assembly functions which bypass the cache. For more information you should read Writing Device Drivers (page 7-4) in the Nios II Software Developer's Handbook (n2sw_nii5v2.pdf)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Rikusg.
If you were working with Nios I then what you showed in your first example was correct. However from a software point of view, you can't pre-determine if you will get a cache hit or miss (cache hit in your case will cause the program to fail since your device will not be accessed).
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