digitalmars.D.learn - Memory mapped IO
- Dan Olson (6/6) Jan 09 2011 I'm exploring D for embedded work as a nice alternative to C/C++ for the
- Lars T. Kyllingstad (4/11) Jan 10 2011 Would std.mmfile be what you need?
- Dan Olson (12/23) Jan 10 2011 Ok, thanks. So I see that is a wrapper for mmap. So that would be good
- Lars T. Kyllingstad (5/34) Jan 10 2011 Ah, I should have read your post more closely. I just saw "memory mappe...
I'm exploring D for embedded work as a nice alternative to C/C++ for the 32-bitters and am finding it has a nice set of features. But, what is the best way handle memory mapped IO? I don't see volatile like in C. Is writing asm {} the best way to ensure memory access? Thanks, Dan Olson
Jan 09 2011
On Sun, 09 Jan 2011 22:44:44 -0800, Dan Olson wrote:I'm exploring D for embedded work as a nice alternative to C/C++ for the 32-bitters and am finding it has a nice set of features. But, what is the best way handle memory mapped IO? I don't see volatile like in C. Is writing asm {} the best way to ensure memory access? Thanks, Dan OlsonWould std.mmfile be what you need? http://www.digitalmars.com/d/2.0/phobos/std_mmfile.html -Lars
Jan 10 2011
"Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> writes:On Sun, 09 Jan 2011 22:44:44 -0800, Dan Olson wrote:Ok, thanks. So I see that is a wrapper for mmap. So that would be good for user space code running on top of posix or win32. But... I'm more interested in the general embedded case with a small OS or no OS (just ISRs and main loop). I'm betting without volatile, asm {} is the next best thing for tickling a controllers peripheral registers? Yes/No? I searched the news groups and saw there used to be a volatile. But it looks like it was done away with because of how it was misused (like C volatile) for thread sharing. But this is different. This is just telling the compiler not to optimize away an access. -- Dan OlsonI'm exploring D for embedded work as a nice alternative to C/C++ for the 32-bitters and am finding it has a nice set of features. But, what is the best way handle memory mapped IO? I don't see volatile like in C. Is writing asm {} the best way to ensure memory access? Thanks, Dan OlsonWould std.mmfile be what you need? http://www.digitalmars.com/d/2.0/phobos/std_mmfile.html -Lars
Jan 10 2011
On Mon, 10 Jan 2011 08:38:15 -0800, Dan Olson wrote:"Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> writes:Ah, I should have read your post more closely. I just saw "memory mapped IO" and latched onto that. :)On Sun, 09 Jan 2011 22:44:44 -0800, Dan Olson wrote:Ok, thanks. So I see that is a wrapper for mmap. So that would be good for user space code running on top of posix or win32. But...I'm exploring D for embedded work as a nice alternative to C/C++ for the 32-bitters and am finding it has a nice set of features. But, what is the best way handle memory mapped IO? I don't see volatile like in C. Is writing asm {} the best way to ensure memory access? Thanks, Dan OlsonWould std.mmfile be what you need? http://www.digitalmars.com/d/2.0/phobos/std_mmfile.html -LarsI'm more interested in the general embedded case with a small OS or no OS (just ISRs and main loop). I'm betting without volatile, asm {} is the next best thing for tickling a controllers peripheral registers? Yes/No? I searched the news groups and saw there used to be a volatile. But it looks like it was done away with because of how it was misused (like C volatile) for thread sharing. But this is different. This is just telling the compiler not to optimize away an access.AFAIK, that's right. The compiler does not optimise across asm {} blocks. -Lars
Jan 10 2011