📄 gpio_regs.h
字号:
#define __REG(x) (x)#define __REG2(x, y) ((x) + (y))/* GPIO alternate function mode & direction */#define GPIO_IN 0x000#define GPIO_OUT 0x080#define GPIO_ALT_FN_1_IN 0x100#define GPIO_ALT_FN_1_OUT 0x180#define GPIO_ALT_FN_2_IN 0x200#define GPIO_ALT_FN_2_OUT 0x280#define GPIO_ALT_FN_3_IN 0x300#define GPIO_ALT_FN_3_OUT 0x380#define GPIO_MD_MASK_NR 0x07f#define GPIO_MD_MASK_DIR 0x080#define GPIO_MD_MASK_FN 0x300#define GPIO_DFLT_LOW 0x400#define GPIO_DFLT_HIGH 0x800#define GPLR0 __REG(0x40E00000) /* GPIO Pin-Level Register GPIO<31:0> */#define GPLR1 __REG(0x40E00004) /* GPIO Pin-Level Register GPIO<63:32> */#define GPLR2 __REG(0x40E00008) /* GPIO Pin-Level Register GPIO<80:64> */#define GPDR0 __REG(0x40E0000C) /* GPIO Pin Direction Register GPIO<31:0> */#define GPDR1 __REG(0x40E00010) /* GPIO Pin Direction Register GPIO<63:32> */#define GPDR2 __REG(0x40E00014) /* GPIO Pin Direction Register GPIO<80:64> */#define GPSR0 __REG(0x40E00018) /* GPIO Pin Output Set Register GPIO<31:0> */#define GPSR1 __REG(0x40E0001C) /* GPIO Pin Output Set Register GPIO<63:32> */#define GPSR2 __REG(0x40E00020) /* GPIO Pin Output Set Register GPIO<80:64> */#define GPCR0 __REG(0x40E00024) /* GPIO Pin Output Clear Register GPIO<31:0> */#define GPCR1 __REG(0x40E00028) /* GPIO Pin Output Clear Register GPIO <63:32> */#define GPCR2 __REG(0x40E0002C) /* GPIO Pin Output Clear Register GPIO <80:64> */#define GRER0 __REG(0x40E00030) /* GPIO Rising-Edge Detect Register GPIO<31:0> */#define GRER1 __REG(0x40E00034) /* GPIO Rising-Edge Detect Register GPIO<63:32> */#define GRER2 __REG(0x40E00038) /* GPIO Rising-Edge Detect Register GPIO<80:64> */#define GFER0 __REG(0x40E0003C) /* GPIO Falling-Edge Detect Register GPIO<31:0> */#define GFER1 __REG(0x40E00040) /* GPIO Falling-Edge Detect Register GPIO<63:32> */#define GFER2 __REG(0x40E00044) /* GPIO Falling-Edge Detect Register GPIO<80:64> */#define GEDR0 __REG(0x40E00048) /* GPIO Edge Detect Status Register GPIO<31:0> */#define GEDR1 __REG(0x40E0004C) /* GPIO Edge Detect Status Register GPIO<63:32> */#define GEDR2 __REG(0x40E00050) /* GPIO Edge Detect Status Register GPIO<80:64> */#define GAFR0_L __REG(0x40E00054) /* GPIO Alternate Function Select Register GPIO<15:0> */#define GAFR0_U __REG(0x40E00058) /* GPIO Alternate Function Select Register GPIO<31:16> */#define GAFR1_L __REG(0x40E0005C) /* GPIO Alternate Function Select Register GPIO<47:32> */#define GAFR1_U __REG(0x40E00060) /* GPIO Alternate Function Select Register GPIO<63:48> */#define GAFR2_L __REG(0x40E00064) /* GPIO Alternate Function Select Register GPIO<79:64> */#define GAFR2_U __REG(0x40E00068) /* GPIO Alternate Function Select Register GPIO<95-80> */#define GAFR3_L __REG(0x40E0006C) /* GPIO Alternate Function Select Register GPIO<111:96> */#define GAFR3_U __REG(0x40E00070) /* GPIO Alternate Function Select Register GPIO<127:112> */#define GPLR3 __REG(0x40E00100) /* GPIO Pin-Level Register GPIO<127:96> */#define GPDR3 __REG(0x40E0010C) /* GPIO Pin Direction Register GPIO<127:96> */#define GPSR3 __REG(0x40E00118) /* GPIO Pin Output Set Register GPIO<127:96> */#define GPCR3 __REG(0x40E00124) /* GPIO Pin Output Clear Register GPIO<127:96> */#define GRER3 __REG(0x40E00130) /* GPIO Rising-Edge Detect Register GPIO<127:96> */#define GFER3 __REG(0x40E0013C) /* GPIO Falling-Edge Detect Register GPIO<127:96> */#define GEDR3 __REG(0x40E00148) /* GPIO Edge Detect Status Register GPIO<127:96> *//* More handy macros. The argument is a literal GPIO number. */#define GPIO_bit(x) (1 << ((x) & 0x1f))#define _GPLR(x) __REG2(0x40E00000, ((x) & 0x60) >> 3)#define _GPDR(x) __REG2(0x40E0000C, ((x) & 0x60) >> 3)#define _GPSR(x) __REG2(0x40E00018, ((x) & 0x60) >> 3)#define _GPCR(x) __REG2(0x40E00024, ((x) & 0x60) >> 3)#define _GRER(x) __REG2(0x40E00030, ((x) & 0x60) >> 3)#define _GFER(x) __REG2(0x40E0003C, ((x) & 0x60) >> 3)#define _GEDR(x) __REG2(0x40E00048, ((x) & 0x60) >> 3)#define _GAFR(x) __REG2(0x40E00054, ((x) & 0x70) >> 2)#define GPLR(x) (((((x) & 0x7f) < 96) ? _GPLR(x) : GPLR3))#define GPDR(x) (((((x) & 0x7f) < 96) ? _GPDR(x) : GPDR3))#define GPSR(x) (((((x) & 0x7f) < 96) ? _GPSR(x) : GPSR3))#define GPCR(x) (((((x) & 0x7f) < 96) ? _GPCR(x) : GPCR3))#define GRER(x) (((((x) & 0x7f) < 96) ? _GRER(x) : GRER3))#define GFER(x) (((((x) & 0x7f) < 96) ? _GFER(x) : GFER3))#define GEDR(x) (((((x) & 0x7f) < 96) ? _GEDR(x) : GEDR3))#define GAFR(x) (((((x) & 0x7f) < 96) ? _GAFR(x) : \ ((((x) & 0x7f) < 112) ? GAFR3_L : GAFR3_U)))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -