forveri.blogg.se

Pointer focus registration code
Pointer focus registration code













Sometimes there are special instructions or address spaces needed to get to a register, which usually can't be generated by the C compiler. Finally, by using asms, I know exactly how I'm accessing the register.This is hidden easily in macros of this style, and the bulk of my code still refers to the registers I'm interested in, not the complicated way the hardware makes me touch them. Some registers require a multi-step process to read from the hardware.I think they read better in the code, identifying what I'm doing, reading a register, instead of focusing on how I'm doing it.I like these better than direct use of pointers because: Īnd then fill these in with the appropriate gcc asms. However, I usually prefer to write macros like this #define READ_LCDCW1(). This is always a good idea when reading or writing hardware registers, because it ensures that each access you perform in your C code actually shows up in the generated code. Note that I've added the volatile qualifier.

pointer focus registration code

You can, as others have suggested, declare an appropriate pointer, ie, volatile uint32_t *reg = (volatile uint32_t *)0xc000















Pointer focus registration code