3 ms·
weird.... most embedded platforms do something like ( following from an actual lib header, which is full of the same ). The entire interface to the hardware
by keithnz 9y ago
weird.... most embedded platforms do something like ( following from an actual lib header, which is full of the same ). The entire interface to the hardware is basically bitfields.
typedef union {
struct {
unsigned REC :8;
};
struct {
unsigned REC0 :1;
unsigned REC1 :1;
unsigned REC2 :1;
unsigned REC3 :1;
unsigned REC4 :1;
unsigned REC5 :1;
unsigned REC6 :1;
unsigned REC7 :1;
};
} RXERRCNTbits_t;
- eecsninja 9y agoDid you forget to include field width specifiers?
- jschwartzi 9y agoI've seen this a lot in Texas Instruments' bare-metal BSPs for their processors that are generated using HalCoGen. Their own proprietary compiler handles them as you'd expect. Other BSPs typically follow the coding style for their operating system. I've never seen QNX BSP drivers use bitfields. I've also never seen them in Linux drivers. QNX and Linux typically use variants of GCC to compile their drivers unless you pay for another toolchain.