tornadovxworks培训(编辑修改稿)内容摘要:
em debugging by Unsetting the VX_DEALLOC_STACK option or, Using a delete hook. taskDelete(tid) 嵌入式培训专题 微迪软件培训中心 Resource Reclamation Contrary to the philosophy of sharing system resources among all tasks. Can be an expensive process, which must be the application‟s responsibility. TCB and stack are the only resources automatically reclaimed. Tasks are responsible for cleaning up after themselves. Deallocating memory. Releasing locks to system resources. Closing files which are open. Deleting child / client tasks when parent / server exits. 嵌入式培训专题 微迪软件培训中心 RealTime Multitasking Introduction Task Basics Task Control Error Status System Tasks 嵌入式培训专题 微迪软件培训中心 Task Restart taskRestart (tid) Task is terminated and respawned with original arguments and tid. Usually used for error recovery. 嵌入式培训专题 微迪软件培训中心 Task Suspend / Resume taskSuspend (tid) Makes task ineligible to execute. Can be added to pended or delayed state. taskResume (tid) Removes suspension. Usually used for debugging and development purposes. 嵌入式培训专题 微迪软件培训中心 Task Delay To delay a task for a specified number of system clock ticks. To poll every 1/7 second: FOREVER { taskDelay (sysClkRateGet() / 7)。 ... } STATUS taskDelay (ticks) Use sysClkRateSet() to change the clock rate. Accurate only if clock rate is a multiple of seven ticks / seconds. Can suffer from “drift.” 嵌入式培训专题 微迪软件培训中心 Reentrancy and Task Variables If tasks access the same global or static variables, the resource can bee corrupted (called a race condition). Possible Solutions: Task Variables cause a 32bit value to be saved and restored on context switchs, like a register. Use only stack variables in applications. Protect the resource with a semaphore. Use task variables to make the variable private to a task Caveat: task variables increase context switch times. See the taskVarLib manual pages for details. 嵌入式培训专题 微迪软件培训中心 Task Hooks Userdefined code can be executed on every context switch, at task creation, or at task deletion: taskSwitchHookAdd () taskCreateHookAdd () taskDeleteHookAdd () VxWorks uses a switch hook to implement task variables. See manual pages on taskHookLib for details. 嵌入式培训专题 微迪软件培训中心 Task Information Like i(), but also displays: Can also use show (): show (tNetTask, 1) Stack information Task options CPU registers FPU registers (if the VX_FP_TASK option bit is set) ti (taskNameOrId) 嵌入式培训专题 微迪软件培训中心 Task Browser To obtain information about a specific task, click on the task‟s summary line in the main target browser. 嵌入式培训专题 微迪软件培训中心 What is POSIX ? Originally, an IEEE mittee convened to create a standard interface to UNIX for: VxWors supports almost all of the POSIX Realtime Extensions. Increased portability. Convenience. Context switch times are very fast. Text, data, and bss are stored in a mon, global address space. The POSIX realtime extensions are based on implicit assumptions about the UNIX process model which do not always hold in VxWorks. In VxWorks, 嵌入式培训专题 微迪软件培训中心 What does VxWorks support ? Library Description aioPxLib Asynchornous I/O semPxLib POSIX Semaphores mqPxLib POSIX Message Queues mmanPxLib POSIX Memory Management schedPxLib POSIX Scheduler Interface sigLib POSIX Signals timerLib, clockLib POSIX Timer/Clock Interface dirLib File/Directory Information 嵌入式培训专题 微迪软件培训中心 RealTime Multitasking Introduction Task Basics Task Control Error Status System Tasks 嵌入式培训专题 微迪软件培训中心 Error Status • VxWorks里使用一个全局整型变量 errno来描述错误信息 – 程序执行过程中我们可以设置并调用一些函数例程来检测错误信息,并针对错误信息设置相应的错误号 – 然后调用一些函数例程检测错误号,当程序执行异常时可以根据错误号发现相应的错误 嵌入式培训专题 微迪软件培训中心 Errno and Context Switches At each context switch, the kernel saves and restores the value of errno. TCB errorStatus errno 嵌入式培训专题 微迪软件培训中心 Setting Errno Lowest level routine to detect an error sets errno and returns ERROR: STATUS myRoutine () { ... if (myNumFlurbishes = MAX_FLURBISH) { errno = s_myLib_TOO_MANY_FLURBISHES。 return (ERROR)。 } … pMem=malloc(sizeof(myStruct))。 if ( pMem== NULL) { /* malloc() sets errno don’t redefine it */ return (ERROR)。 } ... } 嵌入式培训专题 微迪软件培训中心 Examining Errno Examine errno to find out why a routine failed. if (reactorOk() == ERROR) { switch (errno) { case S_rctorLib_TEMP_DANGER_ZONE: startShutDown ()。 break。 case S_rctorLib_TEMP_CRITICAL_ZONE: logMsg (“Run!”)。 break。 case S_rctorLib_LEAK_POSSIBLE: checkVessel ()。 break。 default: startEmergProc ()。 } } errno is only valid after an error occurs. 嵌入式培训专题 微迪软件培训中心 Interpreting Errno VxWorks uses the 32bit value errno as follows: Module numbers are defined in . Each module defines its own error numbers in its header file. Module number 0x11 (define in to be memLib) and Error number 0x01 (defined in to be “not enough memory”). For example, an errno of 0x110001 would be: module error number 31 15 0 嵌入式培训专题 微迪软件培训中心 Error Messages VxWorks uses an error symbol table (statSymTbl) to convert error numbers to error messages. To print the error message for the current task‟s error status to STD_ERR: perror (“darn”) darn: S_Drv_NO_SUCH_FILE_OR_DIR To print the error message associated with an error number to the WindSh console : printErrno (0x110001) S_memLib_NOT_ENOUGH_MEMORY 嵌入式培训专题 微迪软件培训中心 UserDefined Error Codes To get perror() to print your error messages: 1. Modify to reserve a module number: define M_myLib (501 16) 2. Define error macros in your header file (which must be in the wind/target/h directory): define S_myLib_。tornadovxworks培训(编辑修改稿)
相关推荐
onents a rough draft of the human genome sequence its use for any purpose was subject to licence agreements their paper estimated 25,000 human genes individuals G Study the highlighted words and
没在意青少年对待网络文学情况有助于学习影响学习无影响打发时间学生卷调查分析 从学生卷中发现在 21世纪的青少年中,网络文学的影响颇为严重,大多数青少年与其读一些网络小说也不愿读一些世界名著或一些必读书目。 过半的学生喜欢或沉迷于网络文学,我个人认为这种现象不是什么好现象,网络文学虽然也是文学,但现在的网络文学尚不成熟,许多网络文学中都含有血腥,色情或是种马。
utes’ walk. Dialogue 2: 65 footbridge straight ahead traffic light five Dialogue 3: No, it doesn’t. 2. Why will the girl walk the man to Zhangjiang Hightech park? 1. Does the bus go to Zhangjiang
将新邮件发送到服务器存储器上 硬件故障时邮件不受损失 别人能够看到你的日历 建立离线存储器 在 PC机上建立服务器存储器的副本,可以象在线一样进行访问 配置 AutoArchive 将较早的信息存储于个人存储器中,使服务器上的信息不超过服务器存储器的限制 最佳操作 来自微软员工的建议 将来自管理人员和主要客户的信息用不同色彩作标记
ing to digital and print resources 图书馆研究统一检索时应同时兼顾数字 /数字及印刷资源 Interface expectations 界面要求 Millennial gen library users are well acclimated to the Web and like 代的读者喜欢及习惯使用互联网 Used to relevancy
Tru64 UNIX BeOS 处理机 Advantages the kernel can simultaneously schedule many threads of the same process on many processors 内核可在多处理机上同时对一个进程的多个线程进行调度 blocking is done on a thread level 阻塞仅限线程级别