版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
嵌入式软件VxWorks编程介绍
邹昕光哈尔滨工业大学自动化测控所联系电话:86413531-609
E-mail:xgzou@vxworks嵌入式操作系统共93页,您现在浏览的是第1页!AgendaTaskIntertaskmunicationISRvxworks嵌入式操作系统共93页,您现在浏览的是第2页!TaskEachtaskhasitsowncontext,whichistheCPUenvironmentandsystemresourcesthatthetaskseeseachtimeitisscheduledtorunbythekernel.Atask’scontextissavedinthetaskcontrolblock(TCB).vxworks嵌入式操作系统共93页,您现在浏览的是第3页!TaskAtask’scontextincludes:-athreadofexecution;thatis,thetask’sprogramcounter-theCPUregistersand(optionally)floating-pointregisters-I/Oassignmentsforstandardinput,output,anderror-adelaytimer-atime-slicetimer-kernelcontrolstructures-signalhandlers-debuggingandperformancemonitoringvaluesvxworks嵌入式操作系统共93页,您现在浏览的是第4页!TaskSchedulerControlRoutinesvxworks嵌入式操作系统共93页,您现在浏览的是第5页!TaskControlRoutinevxworks嵌入式操作系统共93页,您现在浏览的是第6页!TaskSpawnvxworks嵌入式操作系统共93页,您现在浏览的是第7页!TaskInformationRoutinesvxworks嵌入式操作系统共93页,您现在浏览的是第8页!TaskDeletingRoutinesvxworks嵌入式操作系统共93页,您现在浏览的是第9页!TaskControlRoutinesvxworks嵌入式操作系统共93页,您现在浏览的是第10页!SharedCodeandReentrancyAsinglecopyofcodeexecutedbymultipletasksiscalledsharedcode.Asubroutineisreentrantifasinglecopyoftheroutinecanbecalledfromseveraltaskcontextssimultaneouslywithoutconflict.Modifyglobalorstaticvariables.vxworks嵌入式操作系统共93页,您现在浏览的是第11页!DynamicStackVariablesvxworks嵌入式操作系统共93页,您现在浏览的是第12页!TaskVariablesvxworks嵌入式操作系统共93页,您现在浏览的是第13页!SharedDataStructuresGlobalvariablesLinearbuffersRingbuffersLinkedlistsPointersvxworks嵌入式操作系统共93页,您现在浏览的是第14页!MutualExclusionDisableinterruptsDisablepreemptionResourcelockingwithsemaphoresvxworks嵌入式操作系统共93页,您现在浏览的是第15页!PreemptivelocksLessrestrictiveformofmutualexclusion.Noothertaskisallowedtopreemptivethecurrentexecutingtask,ISRareabletoexecute.Tasksofhigherpriorityareunabletoexecuteuntilthelockingtaskleavesthecriticalregion.vxworks嵌入式操作系统共93页,您现在浏览的是第16页!SemaphoreControlRoutinesvxworks嵌入式操作系统共93页,您现在浏览的是第17页!BinarySemaphorevxworks嵌入式操作系统共93页,您现在浏览的是第18页!BinarySemaphore-MutualExclusionvxworks嵌入式操作系统共93页,您现在浏览的是第19页!BinarySemaphore-Synchronizationvxworks嵌入式操作系统共93页,您现在浏览的是第20页!MutualSemaphore-RecursiveResourceAccessvxworks嵌入式操作系统共93页,您现在浏览的是第21页!CountingSemaphoresvxworks嵌入式操作系统共93页,您现在浏览的是第22页!MessageQueuesvxworks嵌入式操作系统共93页,您现在浏览的是第23页!MessageQueueExamplevxworks嵌入式操作系统共93页,您现在浏览的是第24页!MessageQueueExamplevxworks嵌入式操作系统共93页,您现在浏览的是第25页!PipesPipesprovideanalternativeinterfacetothemessagequeuefacilitythatgoesthroughtheVxWorksI/Osystem.vxworks嵌入式操作系统共93页,您现在浏览的是第26页!RPCRemoteProcedureCalls(RPC)isafacilitythatallowsaprocessonamachinetocallaprocedurethatisexecutedbyanotherprocessoneitherthesamemachineoraremotemachine.vxworks嵌入式操作系统共93页,您现在浏览的是第27页!SignalSignalsasynchronouslyalterthecontrolflowofatask.AnytaskorISRcanraiseasignalforaparticulartask.Thetaskbeingsignaledimmediatelysuspendsitscurrentthreadofexecutionandexecutesthetask-specifiedsignalhandlerroutine.vxworks嵌入式操作系统共93页,您现在浏览的是第28页!EventSendingandReceivingEvents Eventscanbesentfromaresourcetoatask,fromanISRtoatask,ordirectlybetweentwotasks.WaitingforEvents Ataskcanwaitformultipleeventsfromoneormoreresources.Eachsourcecansendmultipleevents,andataskcanalsowaittoreceiveonlyoneevent,orallevents.vxworks嵌入式操作系统共93页,您现在浏览的是第29页!EventFreeResourceDefinitionMutexSemaphore -Amutexsemaphoreisconsideredfreewhenitnolongerhasanownerandnooneispendingonit.BinarySemaphore -Abinarysemaphoreisconsideredfreewhennotaskownsitandnooneiswaitingforit.vxworks嵌入式操作系统共93页,您现在浏览的是第30页!EventSendingandReceivingEvents Eventscanbesentfromaresourcetoatask,fromanISRtoatask,ordirectlybetweentwotasks.WaitingforEvents Ataskcanwaitformultipleeventsfromoneormoreresources.Eachsourcecansendmultipleevents,andataskcanalsowaittoreceiveonlyoneevent,orallevents.vxworks嵌入式操作系统共93页,您现在浏览的是第31页!WatchdogTimersCallsvxworks嵌入式操作系统共93页,您现在浏览的是第32页!EventRegisterRoutinevxworks嵌入式操作系统共93页,您现在浏览的是第33页!intConnectRoutinevxworks嵌入式操作系统共93页,您现在浏览的是第34页!Runashellvxworks嵌入式操作系统共93页,您现在浏览的是第35页!Cmandsinshellvxworks嵌入式操作系统共93页,您现在浏览的是第36页!ShellCommands:tdvxworks嵌入式操作系统共93页,您现在浏览的是第37页!ShellCommands:tivxworks嵌入式操作系统共93页,您现在浏览的是第38页!ShellCommands:twvxworks嵌入式操作系统共93页,您现在浏览的是第39页!ShellCommands:dvxworks嵌入式操作系统共93页,您现在浏览的是第40页!ShellCommands:dvxworks嵌入式操作系统共93页,您现在浏览的是第41页!ShellCommands:pwd&cdvxworks嵌入式操作系统共93页,您现在浏览的是第42页!ShellCommands:rebootvxworks嵌入式操作系统共93页,您现在浏览的是第43页!ShellCommands:semaphorevxworks嵌入式操作系统共93页,您现在浏览的是第44页!ShellCommands:semaphorevxworks嵌入式操作系统共93页,您现在浏览的是第45页!ShellCommands:MessageQueuevxworks嵌入式操作系统共93页,您现在浏览的是第46页!ShellCommands:MessageQueuevxworks嵌入式操作系统共93页,您现在浏览的是第47页!ShellCommands:MessageQueuevxworks嵌入式操作系统共93页,您现在浏览的是第48页!TaskThedefaulttaskschedulingalgorithminwindispriority-basedpreemptivescheduling.RoundRobinisanoptionalalgorithm.Thewindkernelhas256prioritylevels,numbered0through255.Priority0isthehighestandpriority255isthelowest.vxworks嵌入式操作系统共93页,您现在浏览的是第49页!TaskTaskLock WhenataskdisablestheschedulerbycallingtaskLock(),nopriority-basedpreemptioncantakeplacewhilethattaskisrunning. Ifthetaskexplicitlyblocksorsuspends,theschedulerselectsthenexthighest-priorityeligibletasktoexecute. Whenthepreemption-lockedtaskunblocksandbeginsrunningagain,preemptionisagaindisabled. ThetaskLock()preventtaskcontextswitching,butdonotlockoutinterrupthandling.vxworks嵌入式操作系统共93页,您现在浏览的是第50页!TasktaskSpawnTaskNameandIDRoutinesTaskInformationRoutinesTaskDeletingRoutinesTaskControlRoutinesTaskHookRoutinesvxworks嵌入式操作系统共93页,您现在浏览的是第51页!TaskNameandIDRoutinesvxworks嵌入式操作系统共93页,您现在浏览的是第52页!TaskInformationRoutinesvxworks嵌入式操作系统共93页,您现在浏览的是第53页!TaskDeletingRoutinesvxworks嵌入式操作系统共93页,您现在浏览的是第54页!TaskHookRoutinesvxworks嵌入式操作系统共93页,您现在浏览的是第55页!CodeReentrancySolutionsDynamicStackVariablesGuardedGlobalandStaticVariablesTaskVariablesvxworks嵌入式操作系统共93页,您现在浏览的是第56页!GuardedGlobalandStaticVariablesProvidingamutual-exclusionmechanismtoprohibittasksfromsimultaneouslyexecutingcriticalsectionsofcode.vxworks嵌入式操作系统共93页,您现在浏览的是第57页!IntertaskCommunicationSharedDataStructureMutualExclusionSemaphoresMessageQueuesPipesNetworkIntertaskCommunicationSignalsvxworks嵌入式操作系统共93页,您现在浏览的是第58页!SharedDataStructuresvxworks嵌入式操作系统共93页,您现在浏览的是第59页!DisableInterruptsThemostpowerfulmethodItpreventsthesystemfromrespondingtoexternaleventsforthedurationoftheselocks.Keepthedurationofinterruptlockoutsshort.vxworks嵌入式操作系统共93页,您现在浏览的是第60页!SemaphoresHighlyoptimizedandprovidethefastestintertaskmunicationmechanisminVxWorks.ThreetypesofWindsemaphores: -Binary -Mutualexclusion -Countingvxworks嵌入式操作系统共93页,您现在浏览的是第61页!BinarySemaphorevxworks嵌入式操作系统共93页,您现在浏览的是第62页!BinarySemaphore-MutualExclusionvxworks嵌入式操作系统共93页,您现在浏览的是第63页!BinarySemaphore-Synchronizationvxworks嵌入式操作系统共93页,您现在浏览的是第64页!BinarySemaphore-Synchronizationvxworks嵌入式操作系统共93页,您现在浏览的是第65页!MutualSemaphore-RecursiveResourceAccessvxworks嵌入式操作系统共93页,您现在浏览的是第66页!MessageQueueMessagequeuesallowavariablenumberofmessages,eachofvariablelength,tobequeued.TasksandISRscansendmessagestoamessagequeue,andtaskscanreceivemessageformamessagequeue.Multipletaskscansendtoandreceivefromthesamemessagequeue.Full-duplexmunicationbetweentwotasksgenerallyrequirestwomessagequeues,oneforeachdirection.vxworks嵌入式操作系统共93页,您现在浏览的是第67页!WindMessageQueueControlvxworks嵌入式操作系统共93页,您现在浏览的是第68页!MessageQueueExamplevxworks嵌入式操作系统共93页,您现在浏览的是第69页!MessageQueuesvxworks嵌入式操作系统共93页,您现在浏览的是第70页!SocketsInVxWorks,thebasisofintertaskmunicationacrossthenetworkissockets.VxWorkssupportstheInternetprotocolsTCPandUDP.TCPprovidesreliable,guaranteed,two-waytransmissionofdatawithstreamsockets.UDPprovidesasimplebutlessrobustformofmunication.vxworks嵌入式操作系统共93页,您现在浏览的是第71页!SignalSignalsasynchronouslyalterthecontrolflowofatask.AnytaskorISRcanraiseasignalforaparticulartask.Thetaskbeingsignaledimmediatelysuspendsitscurrentthreadofexecutionandexecutesthetask-specifiedsignalhandlerroutine.vxworks嵌入式操作系统共93页,您现在浏览的是第72页!EventVxWorkseventsaremeansofmunicationbetweentasksandinterruptroutine,betweentasksandothertasks,orbetweentasksandVxWorksobjects.VxWorksobjectsarereferredtoasresourcessuchassemaphoresandmessagequeue.vxworks嵌入式操作系统共93页,您现在浏览的是第73页!EventRegisteringforEvents Onlyonetaskcanregisteritselftoreceiveeventsfromaresource.Ifanothertasksubsequentlyregisterswiththesameresource,thepreviouslyregisteredtaskisautomaticallyunregistered.FreeingResource Whenaresourcesendstoatasktoindicatethatitisfree,itdoesnotmeanthatresourceisreserved.vxworks嵌入式操作系统共93页,您现在浏览的是第74页!EventFreeResourceDefinitionCountingSemaphore -Acountingsemaphoreisconsideredfreewhenitscountsisnonzeroandnooneispendingonit.MessageQueue -Amessagequeueisconsideredfreewhenamessagequeueispresentinthequeueandnooneispendingforthearrivalofamessageinthatqueue.vxworks嵌入式操作系统共93页,您现在浏览的是第75页!WatchdogTimersVxWorksincludesawatchdog-timermechanismthatallowsanyCfunctiontobeconnecttoaspecifiedtimedelay.Functioninvokedbywatchdogtimersexecuteasinterruptservicecodea
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026福建医科大学附属第一医院招聘劳务派遣人员4人(三)模拟试卷附答案详解(培优B卷)
- 2026四川启赛微电子有限公司招聘研发工程师等岗位2人备考题库附答案详解AB卷
- 2026云南红会眼视光中心有限公司招聘2人备考题库附答案详解【基础题】
- 新型力学测试题及答案
- 新疆八年级秋季学期体育专项训练通关及答案
- 2026四川宜宾市高县上源水务投资有限责任公司招聘6人参考题库附完整答案详解(夺冠系列)
- 2026安徽芜湖市经开区龙山街道专职人民调解员招聘2人笔试题库附答案详解(综合卷)
- 2026辽宁省疾病预防控制中心招聘高层次和急需紧缺人才6人笔试题库附答案详解(培优B卷)
- 2026年合肥滨湖寿春中学初中部教师招聘模拟试卷附参考答案详解【达标题】
- 2026广东高鲲能源数据投资有限公司第六期招聘4人模拟试卷及答案详解(真题汇编)
- IATF16949项目移交管理程序
- 新概念Lesson1-72Revision知识点讲义
- 2023届江西省九江市瑞昌市三年级数学第二学期期末联考试题含解析
- 云计算虚拟化技术基础与实践PPT完整全套教学课件
- 西子奥的斯服务器LCB2RCB2服务器使用PPT幻灯片课件
- PLC十人投票机设计论文
- 海南油库防腐工程临时用电施工方案
- GA/T 959-2011机动车区间测速技术规范
- 资料交接移交确认单
- DB4406-T 5-2021 地理标志产品 香云纱-(高清现行)
- Fanuc机器人喷涂培训教程-
评论
0/150
提交评论