Re: D and memory mapped devices

2017-06-14 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-06-14 11:04, Rene Zwanenburg wrote: I've casted void buffers to structs containing bitfields to read pre-existing binary files, and that worked just fine. I don't see why it would be different for memory mapped devices. What do yo mean by 'do more'? This bitfield discussion came up in

Re: D and memory mapped devices

2017-06-14 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 14 June 2017 at 08:10:57 UTC, Russel Winder wrote: This would appear a priori to not allow for actual memory mapped devices using it, or am I missing something? I believe the only case where it might matter is if the device was sensitive to the read/write size (1/2/4 bytes).

Re: D and memory mapped devices

2017-06-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/14/17 4:10 AM, Russel Winder via Digitalmars-d-learn wrote: In C and C++ you often use bitfields to control devices with memory mapped hardware control and data words. So for example: typedef struct some_device { unsigned int flob: 3; unsigned int adob: 2; unsigned int: 3;

Re: D and memory mapped devices

2017-06-14 Thread Rene Zwanenburg via Digitalmars-d-learn
On Wednesday, 14 June 2017 at 08:10:57 UTC, Russel Winder wrote: but the bitfields mixin template appears to do more than add all the bit twiddling functions to emulate the bitfields. This would appear a priori to not allow for actual memory mapped devices using it, or am I missing something?

D and memory mapped devices

2017-06-14 Thread Russel Winder via Digitalmars-d-learn
In C and C++ you often use bitfields to control devices with memory mapped hardware control and data words. So for example: typedef struct some_device { unsigned int flob: 3; unsigned int adob: 2; unsigned int: 3; unsigned int data: 8; } some_device; Clearly D has no bitfields. I