外文翻译—电子信息的嵌入式程序下载和调试-电子信息(编辑修改稿)内容摘要:
xecution with the main function. In an embeddedapplication, main is usually coded as an endless loop and can be thought of as asingle task that is executed continuously. For example: RoundRobin Task Switching RTX51 Tiny allows a quasiparallel, simultaneous execution of several task is executed for a predefined timeout period. A timeout suspends theexecution of a task and causes another task to be started. The following exampleuses this roundrobin task switching technique. Simple C Program using RTX51 RTX51 starts the program with task 0 (assigned to job0). The functionos_create_task marks task 1 (assigned to job1) as ready for execution. Thesetwo functions are simple count loops. After the timeout period has beenpleted, RTX51 interrupts job0 and begins execution of job1. This functioneven reaches the timeout and the system continues with job0. The os_wait Function The os_wait function provides a more efficient way to allocate the availableprocessor time to several tasks. os_wait interrupts the execution of the currenttask and waits for the specified event. During the time in which a task waits foran event, other tasks can be executed. Wait for Timeout RTX51 uses an 8051 timer in order to generate cyclic interrupts (timer ticks).The simplest event argument for os_wait is a timeout, where the currentlyexecuting task is interrupted for the specified number of timer ticks. Thefollowing uses timeouts for the time delay. Program with os_wait Function This program is similar to the previous example with the exception that job0 isinterrupted with os_wait after counter0 has been incremented. RTX51 waitsthree timer ticks until job0 is ready for execution again. During this time, job1 isexecuted. This function also calls os_wait with a timeout of 5 ticks. The result:counter0 is incremented every three ticks and counter1 is incremented every fivetimer ticks. Wait for Signal Another event for os_wait is a signal. Signals are used for task coordination: ifa task waits with os_wait until another task issues a signal. If a signal waspreviously sent, the task is immediately continued. Program with Wait for Signal. In this example, task 1 waits for a signal from task 0 and therefore processes theoverflow from counter0. Preemptive Task Switching The full version of RTX51 provides preemptive task switching. This feature isnot included in RTX51 Tiny. It is explained here to provide a pleteoverview of multitasking concepts. In the previous example, task 1 is not immediately started after a signal hasarrived, but only after a timeout occurs for task 0. If task 1 is defined with ahigher priority than task 0, by means of preemptive task switching, task 1 isstarted immediately after the signal has arrived. The priority is specified in thetask definition (priority 0 is the default value). RTX51 Technical Data Description RTX51 Full RTX51 Tiny Number of tasks 256。 max. 19 tasks active 16 RAM requirements 40 .. 46 bytes DATA 20 .. 200 bytes IDATA 7 bytes DATA 3 * task count IDATA (user stack) min. 650 bytes XDATA Code requirements 6KB .. 8KB 900 bytes Hardware requirements timer 0 or timer 1 timer 0 System clock 1000 .. 40000 cycles 1000 .. 65535 cycles Interrupt latency 50 cycles 20 cycles Context switch time 70 .. 100 cycles (fast task) 180 .. 700 cycles (standard task) depends on stack load 100 .. 700 cycles depends on stack load Mailbox system 8 mailboxes with 8 integer entries each not available Memory pool system up to 16 memory pools not available Semaphores 8 * 1 bit not available Overview of RTX51 Routines The following table lists some of the RTX51 functions along with a briefdescription and execution timing (for RTX51 Full). function Description CPU Cycles sr_recv_message Receive a message (call from interrupt). 71 (with message) isr_send_message Send a message (call from interrupt). 53 isr_send_signal Send a signal to a task (call from interrupt). 46 os_attach_interrupt Assign task to interrupt source. 119 os_clear_signal Delete a previously sent 57 signal. os_create_task Move a task to execution queue. 302 os_create_pool Define a memory pool. 644 (size 20 * 10 bytes) os_delete_task Remove a task from execution queue. 172 os_detach_interrupt Remove interrupt assignment. 96 os_disable_isr Disable 8051 hardware interrupts. 81 os_enable_isr Enable 8051 hardware interrupts. 80 os_free_block Return a block to a memory pool. 160 os_get_block Get a block from a memory pool. 148 os_send_message Send a message (call from task). 443 with task sw。外文翻译—电子信息的嵌入式程序下载和调试-电子信息(编辑修改稿)
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。
用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。