"Lars T. Kyllingstad" <pub...@kyllingen.nospamnet> writes: > 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 Olson > > Would std.mmfile be what you need? > > http://www.digitalmars.com/d/2.0/phobos/std_mmfile.html > > -Lars
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 Olson