Hello!
Currently it seems to be the tradition (at least in the TI example code that I have seen thus far) to access registers like this:
HW_WR_REG32(domainBaseAddr + clkRegOffset, PRCM_MODULEMODE_ENABLE);
Or perhaps utilize a driver function like this:
PRCMModuleEnable(CHIPDB_MOD_ID_DMTIMER, pDmtimerObj->instNum, FALSE);
that makes the assignment for me.
Has it ever been considered (as a design choice and a programmer interface choice) to establish these register addresses (with unique names for each register) in a supplemental linker script (one for each microcontroller and SoC) to established named register addresses, so instead of the above, I could say this:
DMT3CLKMUX = 2; DMT3CLKCTRL = 2; while ((DMT3CLKCTRL & DMT3CLKCTRL_IDLEST_MASK) == DMT3CLKCTRL_IDLEST_DISABLE) { continue; } // ...and register "struct" typedefs for SoC-specific include files to enable saying things like this: DMT3OCPCFG.SOFTRESET = 1; // Wait for reset to complete: while (DMT3OCPCFG.SOFTRESET) { continue; }
I'm fairly certain that the GNU compiler (at least) supports it -- a two-pronged approach including register address definitions in the linker script, and struct typedefs in a .H file.
Has this ever been considered? If it was and was declined as a design choice for programmer interface, does anyone know the rationale behind it?
Kind regards,
Vic