zoukankan      html  css  js  c++  java
  • 【嵌入式】——对#define GPBCON (*(volatile unsigned long*)0x56000010)的理解

    #define GPBCON (*(volatile unsigned long*)0x56000010)

    1:volatile

      当计算机需要一个数值的时候,会先把内存中的值读取到寄存器,然后下次在使用该值的时候就直接读取寄存器中的值了。加上volatile之后,程序就会在每次需要该值的时候都读取一次内存。这是为了防止某些原因硬件会改变其值。

    2:

      (volatile unsigned long *)即为强制类型转换;(volatile unsigned long *)0x56000010 的意思就是把0x56000010强制转换为unsigned long类型的指针。这时(volatile unsigned long *)0x56000010就可以看做是一个指针p了。*(volatile unsigned long*)0x56000010等价于*p,也就是取指针p的地址(取0x56000010的地址)。

      此时整句话的句意也就不难理解了。

  • 相关阅读:
    Codeforces 376A. Night at the Museum
    Assigning Workstations
    树的直径证明
    Frogger
    Circle
    HDU 1022 Train Problem I
    Argus
    树状数组总结
    C++ 容器(一):顺序容器简介
    C++ 输出缓冲区的管理
  • 原文地址:https://www.cnblogs.com/ngnetboy/p/3305004.html
Copyright © 2011-2022 走看看