6、信号量相关接口

在头文件drivers\framework\include\osal\osal_sem.h中定义了信号量相关接口。对于LiteOS-M内核,接口实现程序定义在文件drivers\adapter\khdf\liteos_m\osal\src\osal_sem.c中。

class="table-box">
接口接口描述
int32_t OsalSemInit(struct OsalSem *sem, uint32_t value)初始化信号量
int32_t OsalSemWait(struct OsalSem *sem, uint32_t ms)等待信号量
int32_t OsalSemPost(struct OsalSem *sem)释放信号量
int32_t OsalSemDestroy(struct OsalSem *sem)销毁信号量

7、线程相关接口

在头文件drivers\framework\include\osal\osal_thread.h中定义了信号量相关接口。对于LiteOS-M内核,接口实现程序定义在文件drivers\adapter\khdf\liteos_m\osal\src\osal_thread.c中。

class="table-box">
接口接口描述
int32_t OsalThreadCreate(struct OsalThread *thread, OsalThreadEntry threadEntry, void *entryPara)创建线程
int32_t OsalThreadBind(struct OsalThread *thread, unsigned int cpuID)绑定线程到指定的CPU上运行
int32_t OsalThreadStart(struct OsalThread *thread, const struct OsalThreadParam *param)启动线程
int32_t OsalThreadDestroy(struct OsalThread *thread)销毁线程

8、其他接口

类似还有时间、定时器接口,可以自行查看文件drivers\adapter\khdf\liteos_m\osal\src\osal_time.c、drivers\adapter\khdf\liteos_m\osal\src\osal_timer.c,不再一一列举。

小结

本文介绍了HDF驱动框架子系统中的OSAL接口,后续会介绍更多的HDF驱动框架知识。

如果大家想更加深入的学习 OpenHarmony 开发的内容,不妨可以参考以下相关学习文档进行学习,助你快速提升自己:

OpenHarmony 开发环境搭建:https://qr18.cn/CgxrRy

《OpenHarmony源码解析》:https://qr18.cn/CgxrRy

系统架构分析:https://qr18.cn/CgxrRy

OpenHarmony 设备开发学习手册:https://qr18.cn/CgxrRy

在这里插入图片描述

OpenHarmony面试题(内含参考答案):https://qr18.cn/CgxrRy

写在最后

data-report-view="{"mod":"1585297308_001","spm":"1001.2101.3001.6548","dest":"https://blog.csdn.net/maniuT/article/details/139809476","extend1":"pc","ab":"new"}">> id="blogExtensionBox" style="width:400px;margin:auto;margin-top:12px" class="blog-extension-box"> class="blog_extension blog_extension_type2" id="blog_extension"> class="extension_official" data-report-click="{"spm":"1001.2101.3001.6471"}" data-report-view="{"spm":"1001.2101.3001.6471"}"> class="blog_extension_card_left"> class="blog_extension_card_cont"> 鸿蒙开发学习资料领取!!! class="blog_extension_card_cont_r"> 微信名片
注:本文转载自blog.csdn.net的沧海一笑-dj的文章"https://blog.csdn.net/dengjin20104042056/article/details/97136130"。版权归原作者所有,此博客不拥有其著作权,亦不承担相应法律责任。如有侵权,请联系我们删除。
复制链接

评论记录:

未查询到任何数据!