Forum Discussion
Altera_Forum
Honored Contributor
12 years agoThank you both for your replies. I'll admit that using the HAL API was somewhat lazy on my part and mostly out of habit, too many frameworks lately, so thank you for suggesting an alternative.
I have no input on the hardware design. My programming is in the application layer and I have no input on anything below. This matter is complicated more, for me, given the fact that I don't typically think in the context of bit level development. My attempt at building structures to work with the peripherals looked like this,
typedef struct
{
alt_u32 a:2;
alt_u32 b:4;
alt_u32 c:26;
} PeripheralOne;
with separate functions to read from, alt_u32 PeripheralOn_to_alt_u32() and write to, alt_u32_to_PeripheralOn() each peripheral using bit shifting. I have a large number of these interface, which all have different formats, so I feel that this approach is inefficient, however, I'm having trouble thinking of a better, portable, approach.