日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

关于寄存器的定义__REG

發布時間:2024/9/5 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 关于寄存器的定义__REG 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在linux/include/asm-arm/arch-s3c2410/hardware.h中
下面那個
#ifndef __ASSEMBLY__
#else
#endif
中的__REG定義想了半天沒想明白,大家幫我解釋下好嗎? 謝謝
還有就是#ifndef __ASSEMBLY__中__ASSEMBLY__什么時候才會定義了的?


/*
* S3C2410 internal I/O mappings
*
* We have the following mapping:
*? ? ? ? ? ? ? ? phys? ? ? ? ? ? ? ? virt
*? ? ? ? ? ? ? ? 48000000? ? ? ? e8000000
*/

#define VIO_BASE? ? ? ? ? ? ? ? 0xe8000000? ? ? ? /* virtual start of IO space */
#define PIO_START? ? ? ? ? ? ? ? 0x48000000? ? ? ? /* physical start of IO space */

#define io_p2v(x) ((x) | 0xa0000000)
#define io_v2p(x) ((x) & ~0xa0000000)

#ifndef __ASSEMBLY__
#include <asm/types.h>

/*
* This __REG() version gives the same results as the one above, except
* that we are fooling gcc some how so it generates far better and smaller
* assembly code for access to contigous registers. It's a shame that gcc
* doesn't guess this by itself
*/
typedef struct { volatile u32 offset[4096]; } __regbase;
#define __REGP(x)? ? ? ? ((__regbase *)((x)&~4095))->offset[((x)&4095)>>2]
#define __REG(x)? ? ? ? __REGP(io_p2v(x))

/* Let's kick gcc's ass again... */
# define __REG2(x,y)? ? ? ? \
? ? ? ? ( __builtin_constant_p(y) ? (__REG((x) + (y))) \
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? ?: (*(volatile u32 *)((u32)&__REG(x) + (y))) )

#define __PREG(x)? ? ? ? (io_v2p((u32)&(x)))

#else? ? ? ? /* __ASSEMBLY__ */

# define __REG(x)? ? ? ? io_p2v(x)
# define __PREG(x)? ? ? ? io_v2p(x)

#endif? ? ? ? /* __ASSEMBLY__ */

總結

以上是生活随笔為你收集整理的关于寄存器的定义__REG的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。