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.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
webpack加载style-resources-loader使用方法如下: 1. 首先,确保已经在项目安装了webpack和style-resources-loader。 ```shell npm install webpack style-resources-loader --save-dev ``` 2. 在webpack配置文件,添加style-resources-loader的配置。 ```javascript const path = require('path'); module.exports = { // 其他配置... module: { rules: [ // 其他规则... { test: /\.scss$/, use: [ // 其他loader... 'style-loader', 'css-loader', 'sass-loader', { loader: 'style-resources-loader', options: { patterns: [ path.resolve(__dirname, '路径/到/样式资源文件1.scss'), path.resolve(__dirname, '路径/到/样式资源文件2.scss'), ], }, }, ], }, ], }, }; ``` 3. 在配置使用style-resources-loader的loader,将样式资源文件引入到每个需要的样式文件。 在上面的配置,可以看到`patterns`选项里指定了两个样式资源文件的路径,你可以根据自己的需求进行扩展或更改。注意,路径需要使用`path.resolve`方法来获取绝对路径。 例如,如果你的项目有`styles`文件夹,并且在该文件夹下有`variables.scss`和`mixins.scss`两个样式资源文件,你可以将路径配置为: ```javascript patterns: [ path.resolve(__dirname, 'styles/variables.scss'), path.resolve(__dirname, 'styles/mixins.scss'), ], ``` 这样,在每个`.scss`文件,你就可以直接使用这些样式资源,而无需每次都手动引入。 总结一下,通过在webpack配置文件的module.rules添加style-resources-loader的配置项,来一次性加载全局样式资源文件,从而简化样式文件的引入。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值