当前位置:网站首页>HDF驱动框架的API(3)
HDF驱动框架的API(3)
2022-08-02 17:35:00 【随遇而安的dandelion】
引言
为了方便查阅,本文汇集了我在学习鸿蒙驱动子系统过程中,曾经遇到过的HDF驱动框架提供的API。 同时,还加入了一些对这些API的个人理解和解读。
另外,大家也可以去阅读这些API的源码或官方文档:
https://device.harmonyos.com/cn/docs/documentation/apiref/core-0000001054718073
前一篇:《HDF驱动框架的API》(2)
三、枚举类型
3.1 DeviceClass
1、官方文档
https://device.harmonyos.com/cn/docs/documentation/apiref/core-0000001054718073#ZH-CN_TOPIC_0000001054718073__gab54f9e79649505f668d6d276fb447a2b
2、定义
drivers/framework/include/core/hdf_io_service_if.h
3.2 DeviceResourceType
1、官方文档
https://device.harmonyos.com/cn/docs/develop/apiref/driverconfig-0000001055678040#ZH-CN_TOPIC_0000001055678040__ga09c9585a5d95c79fd5ee4bd8863ba66a
2、定义
drivers/framework/include/config/device_resource_if.h
3.3 DevicePreload
驱动的加载方式。
1、官方文档
https://device.harmonyos.com/cn/docs/develop/apiref/core-0000001054718073#ZH-CN_TOPIC_0000001054718073__section550733843112509
2、定义
drivers/framework/include/core/hdf_device_desc.h
3.4 ServicePolicy
驱动对外发布服务的策略。
1、官方文档
https://device.harmonyos.com/cn/docs/develop/apiref/core-0000001054718073#ZH-CN_TOPIC_0000001054718073__section550733843112509
2、定义
drivers/framework/include/core/hdf_device_desc.h
四、宏定义
4.1 HDF_INIT
功能:向HDF注册驱动。
1、官方文档
https://device.harmonyos.com/cn/docs/develop/apiref/core-0000001054718073#ZH-CN_TOPIC_0000001054718073__ga99831072fdca13e3c423a14fa6a83c34
2、定义
drivers/framework/include/core/hdf_device_desc.h
drivers/framework/core/common/include/host/hdf_device_section.h
4.2 HDF_LOGE
功能:以error级别输出日志信息。
1、官方文档
https://device.harmonyos.com/cn/docs/develop/apiref/driverutils-0000001055518036#ZH-CN_TOPIC_0000001055518036__ga78a7d97e44c6dac52a5d9d849c1a65d4
2、定义
drivers/framework/include/utils/hdf_log.h
五、GPIO驱动的接口
GPIO驱动属于基于HDF驱动框架开发的一种平台设备驱动,它提供一套标准的接口供应用程序或其它设备驱动使用。平台设备一般指SOC的片上外设,比如:GPIO、IIC、UART、RTC等。
5.1 接口函数
5.1.1 GpioSetDir
设置GPIO的方向。第1个参数gpio
:GPIO端口的编号;第2个参数val
:GPIO的方向(见5.2.2节)。
int32_t GpioWrite(uint16_t gpio, uint16_t val)
1、头文件
drivers/framework/include/platform/gpio_if.h
2、官方文档
https://device.harmonyos.com/cn/docs/develop/apiref/gpio-0000001054918103#ZH-CN_TOPIC_0000001054918103__ga5c628216d209fa76c69eca69856bc0ae
5.1.2 GpioWrite
写GPIO。第1个参数gpio
:GPIO端口的编号;第2个参数val
:GPIO要输出的值(见5.2.1节)。
int32_t GpioWrite(uint16_t gpio, uint16_t val)
1、头文件
drivers/framework/include/platform/gpio_if.h
2、官方文档
https://device.harmonyos.com/cn/docs/documentation/apiref/gpio-0000001054918103#ZH-CN_TOPIC_0000001054918103__ga7dee8242ba9335b3217635ba64764bc4
5.2 枚举类型
5.2.1 GpioValue
drivers/framework/include/platform/gpio_if.h
5.2.2 GpioDirType
drivers/framework/include/platform/gpio_if.h
边栏推荐
- golang源码分析(7):chan
- 玩转云端 | 天翼云对象存储ZOS高可用的关键技术揭秘
- Go 语言快速入门指南:第二篇 变量与常量
- npm install报gyp info it worked if it ends with ok
- 新特性解读 | MySQL 8.0 GIPK 不可见主键
- MySQL基本操作和基于MySQL基本操作的综合实例项目
- Mini Program Graduation Works WeChat Gymnasium Reservation Mini Program Graduation Design Finished Product (8) Graduation Design Thesis Template
- 阿波罗 planning代码-modules\planning\lattice\trajectory_generation\PiecewiseBrakingTrajectoryGenerator类详解
- 边界访问的空间权限
- 文件上传很难搞?10分钟带你学会阿里云OSS对象存储
猜你喜欢
随机推荐
NeRF: The Secret of 3D Reconstruction Technology in the Popular Scientific Research Circle
Kubernetes:(七)优化大法(江湖失传已久的武林秘籍)
vulnhub W34kn3ss: 1
Arduino hardware programming introduction to language learning
golang源码分析(3):thrift
租房小程序自动定位城市
MySQL基本语法
Security First: Tools You Need to Know to Implement DevSecOps Best Practices
暴跌99.7%后,谁还在买卖「二舅币」?
golang源码分析(13)gorpc源码分析
docker安装Oracle之后常用的一些命令
STL案例-招聘新员工
npm install 编译时报“Cannot read properties of null (reading ‘pickAlgorithm‘)“
启航
宝塔搭建实测-基于ThinkPHP5.1的wms进销存源码
牛津硕士进碳圈,高瓴红杉经纬一起投了
本地MSE播放fragment mp4服务
Redis的使用--集群模式
golang源码分析(8):m、p、g、shedt、sudog
Wechat Gymnasium Appointment Mini Program Graduation Design Finished Work (5) Task Book