windows驱动开发-resources获取与使用

作者

QQ群:852283276
微信:arm80x86
微信公众号:青儿创客基地
B站:主页 https://space.bilibili.com/208826118

参考

_CM_PARTIAL_RESOURCE_DESCRIPTOR structure

PCM_PARTIAL_RESOURCE_DESCRIPTOR

今日开发altera dma驱动,获取资源的时候得到下面的打印,显示获取的资源类型为CmResourceTypeMemoryLarge,这个资源与普通的CmResourceTypeMemory不一样,查看官网,

CmResourceTypeMemoryLarge	One of u.Memory40, u.Memory48, or u.Memory64.
The CM_RESOURCE_MEMORY_LARGE_XXX flags set in the Flags member determines which structure is used.

实际偏移和长度存储的变量由Flags位确定,

CM_RESOURCE_MEMORY_LARGE_40	The memory descriptor uses the u.Memory40 member.
CM_RESOURCE_MEMORY_LARGE_48	The memory descriptor uses the u.Memory48 member.
CM_RESOURCE_MEMORY_LARGE_64	The memory descriptor uses the u.Memory64 member.

同时,此时的长度需要左移一个偏移才是实际长度,

u.Memory40.Start

For raw resources: Specifies the bus-relative physical address of the lowest of a range of contiguous memory addresses that are allocated to the device.

For translated resources: Specifies the system physical address of the lowest of a range of contiguous memory addresses that are allocated to the device.

For more information about raw and translated resources, see Remarks.

u.Memory40.Length40

Contains the high 32 bits of the 40-bit length, in bytes, of the range of allocated memory addresses. The lowest 8 bits are treated as zero.

u.Memory48.Start

For raw resources: Specifies the bus-relative physical address of the lowest of a range of contiguous memory addresses that are allocated to the device.

For translated resources: Specifies the system physical address of the lowest of a range of contiguous memory addresses that are allocated to the device.

For more information about raw and translated resources, see Remarks.

u.Memory48.Length48

Contains the high 32 bits of the 48-bit length, in bytes, of the range of allocated memory addresses. The lowest 16 bits are treated as zero.

u.Memory64.Start

For raw resources: Specifies the bus-relative physical address of the lowest of a range of contiguous memory addresses that are allocated to the device.

For translated resources: Specifies the system physical address of the lowest of a range of contiguous memory addresses that are allocated to the device.

For more information about raw and translated resources, see Remarks.

u.Memory64.Length64

Contains the high 32 bits of the 64-bit length, in bytes, of the range of allocated memory addresses. The lowest 32 bits are treated as zero.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值