




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
嵌入式软件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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 江苏省苏州市初中毕业暨升学考试模拟试卷2025年初三最后一模(5月月考)语文试题含解析
- 内蒙古自治区呼和浩特市2025届初三下学期考试生物试题含解析
- 山西林业职业技术学院《非物质文化遗产设计与推广》2023-2024学年第二学期期末试卷
- 山东劳动职业技术学院《教材分析与研究》2023-2024学年第二学期期末试卷
- 水塘栽莲藕承包协议书
- 简易房屋装修合同书
- 商品房销售代理合同范例
- 股权质押债权转让协议书
- 2025国际销售代理合同范本下载
- 2025某企业春风农场承包合同
- 湖北省2025届高三(4月)调研模拟考试英语试题及答案
- 血液制品规范输注
- 2025-2030中国生物医药行业市场深度调研及发展趋势与投资前景预测研究报告
- 贸易公司员工管理制度
- 专利代理师高频题库新版2025
- 肝硬化护理新进展
- 2025年征信业务合规培训
- 2025年全国国家版图知识竞赛题库及答案(中小学组)
- 2025项目部与供应商安全生产物资供应合同
- 统借统还合同协议
- 2025年上半年中国十五冶金建设集团限公司公开招聘中高端人才易考易错模拟试题(共500题)试卷后附参考答案
评论
0/150
提交评论