




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
嵌入式软件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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- HIB疫苗竞争策略分析报告
- 2025至2030中国生态木行业营销模式与竞争格局研究报告版
- 养老院门诊病历管理制度与措施研究
- 节假日施工期间客户服务措施
- 2025至2030中国淡竹叶行业消费态势及竞争趋势研究报告
- 制造业设备安全整改方案
- 托班社交技能培养方案
- 桥墩抗撞性能分析与U-C组合防撞结构性能研究
- 基于背景噪声研究青藏高原东北缘地壳方位各向异性
- 本土汉语教师课堂教学言语行为研究
- 初一下学期期中家长会课件
- 附着式升降脚手架安装验收表
- 高中生物《基因工程的基本操作程序》教案基于学科核心素养的教学设计及教学反思
- 120急救网络医院建设标准
- MAM860螺杆式空压机控制器
- 研究思路图模板
- BowTie模型简介与应用
- 中国风武术太极拳主题PPT模板
- 大商业结构拆改加固专项施工方案(44页)
- 苏州园林的艺术特色之拙政园讲解
- Y-Y2系列电机绕组标准数据汇总
评论
0/150
提交评论