GPIO 在不同平台的地址

一、以酷睿平台为例
访问GPIO 按如下公式
每个GPIO都有单独的地址 和32bit配置空间
在这里插入图片描述
SBREG_BAR 在代码中宏定义可以找到
port id 需要查询EDS Vol1

在这里插入图片描述
二、以至强平台为例
所有的GPIO配置信息压缩在几个寄存器中
7.10 General Purpose I/O Registers
The control for the general purpose I/O signals is handled through a 128-byte I/O
space. The base offset for this space is selected by the GPIOBASE register.
GPIO base address 通过PCIE B D F即可获得

配置空间解读:
例如
GPIO_USE_SEL
Each bit in this register enables the corresponding GPIO (if it exists) to be used as a GPIO, rather than for the native function. 0 = Signal used as native function. 1 = Signal used as a GPIO.(native应该表示改gpio可以复用 eds GPIO signals或者 general purpose I/O signals可以查到对应的复用功能)

GPIO0 被用作GPIO, 那么GPIO_USE_SEL的bit0 为1
同理 GPIO1被设置为native 那么GPIO_USE_SEL的bit1 为0.
GPIO_USE_SEL只有32 bit 可以被用作32个GPIO 的use select配置。
那么超过32之外的GPIO怎么配置呢,我们看到GPIO_USE_SEL2和GPIO_USE_SEL3
32到63的GPIO用sel2寄存器 64以上的用 sel3寄存器

在这里插入图片描述

其他GPIO 配置属性:
1)GP_IO_SEL 0 = Output. The corresponding GPIO signal is an output. 1 = Input. The corresponding GPIO signal is an input. 值得注意的是When configured in native mode (GPIO_USE_SEL[n] is 0), writes to these bits have no effect.
2)GP_LVL If GPIO[n] is programmed to be an output (using the corresponding bit in the GP_IO_SEL register), then the corresponding GP_LVL[n] write register value will drive a high or low value on the output pin. 1 = high, 0 = low. 只有设定为output的时候 此bit生效
3)GPI_INV This bit only has effect if the corresponding GPIO is used as an input and used by the GPE logic, where the polarity matters. When set to ‘1’, then the GPI is inverted as it is sent to the GPE logic that is using it. This bit has no effect on the value that is reported in the GP_LVL register.

初入UEFI 若有错误 请各位评论留言斧正 感谢!

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值