Further question with memory mapped interface

前端 未结 2 678
小鲜肉
小鲜肉 2021-01-26 18:55

I still have some issues with my c code that deals with an memory mapped device. At the moment I declare the address space for the registers I write as volatile pointer and I wr

2条回答
  •  悲&欢浪女
    2021-01-26 19:38

    That would be just fine IMHO. I sometimes use macros like:

    #define WR_REG     *(volatile unsigned int*)0x40000000
    

    This allows the registers to be used sort of like variables:

    WR_REG = 0x12345678;
    

提交回复
热议问题