欢迎来到天天文库
浏览记录
ID:37344181
大小:83.50 KB
页数:19页
时间:2019-05-22
《μCOS-II中OS_SEM.C源码中文注释版》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、xilentz的网络文摘博客园 首页 新随笔 联系 订阅 管理随笔-204 文章-0 评论-10 trackbacks-0OS_SEM.C/*********************************************************************************************************** uC/OS-II*
2、 TheReal-TimeKernel* SEMAPHOREMANAGEMENT** (c)Copyright1992-2002,JeanJ.Labrosse,Weston,FL* AllRightsReserved**File:OS_SE
3、M.C*By :JeanJ.Labrosse**********************************************************************************************************/#ifndef OS_MASTER_FILE#include"includes.h"#endif#ifOS_SEM_EN>0/*************************************************************
4、********************************************** ACCEPTSEMAPHORE接受信号量**Description:Thisfunctionchecksthesemaphoretoseeifaresourceisavailableor,ifanevent* occurred. UnlikeOSSemPend(),OSSemAccept()doesnots
5、uspendthecallingtaskifthe* resourceisnotavailableortheeventdidnotoccur.**Arguments :pevent isapointertotheeventcontrolblock**Returns :> 0 iftheresourceisavailableortheeventdidnotoccurthesemaphoreis* decremente
6、dtoobtaintheresource.* ==0 iftheresourceisnotavailableortheeventdidnotoccuror,* if'pevent'isaNULLpointeror,* ifyoudidn'tpassapointertoasemaphore***********************************************
7、***********************************************************/#ifOS_SEM_ACCEPT_EN>0INT16U OSSemAccept(OS_EVENT*pevent){#ifOS_CRITICAL_METHOD==3 /*AllocatestorageforCPUstatusregister */ OS_CPU_SR cpu_sr;#endif INT16U c
8、nt;#ifOS_ARG_CHK_EN>0 if(pevent==(OS_EVENT*)0){ /*Validate'pevent' */ return(0); } if(pevent->OSEventType!=OS_EVENT_TYPE_SEM){ /*Validateeventblocktype
此文档下载收益归作者所有