Danh mục

Real-Time Embedded Multithreading Using ThreadX and MIPS- P3

Số trang: 20      Loại file: pdf      Dung lượng: 179.14 KB      Lượt xem: 12      Lượt tải: 0    
Thu Hiền

Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Real-Time Embedded Multithreading Using ThreadX and MIPS- P3:Although the history of embedded systems is relatively short, 1 the advances andsuccesses of this fi eld have been profound. Embedded systems are found in a vast array ofapplications such as consumer electronics, “ smart ” devices, communication equipment,automobiles, desktop computers, and medical equipment.
Nội dung trích xuất từ tài liệu:
Real-Time Embedded Multithreading Using ThreadX and MIPS- P3 36 Chapter 4 Memory block pool control block Memory block pool name Number of bytes in each memory block Location of memory block pool Total number of bytes available Figure 4.8: Attributes of a memory block pool The total number of memory blocks in a memory block pool can be calculated as follows: Total Number of Bytes Available Total Number of Blocks ( Number of Bytes in Each Memory Block ) (sizeof (void *)) Each memory block contains one pointer of overhead that is invisible to the user and is represented by the sizeof (void*) expression in the preceding formula. Avoid wasting memory space by correctly computing the total number of bytes to allocate, based on the number of desired memory blocks. 4.6 Application Timer Fast response to asynchronous external events is the most important function of real-time, embedded applications. However, many of these applications must also perform certain activities at predetermined intervals of time. Application timers enable applications to execute application C functions at specific intervals of time. It is also possible for an application timer to expire only once. This type of timer is called a one-shot timer, while repeating interval timers are called periodic timers. Each application timer is a public resource. Figure 4.9 contains the attributes of an application timer. Every application timer must have a Control Block that contains essential system information. Every application timer is assigned a name, which is used primarily for identification purposes. Other attributes include the name of the expiration function that is executed when the timer expires. Another attribute is a value that is passed to the expiration function. (This value is for w ww. n e w n e s p r e s s .c o mPlease purchase PDF Split-Merge on www.verypdf.com to remove this watermark. RTOS Building Blocks for System Development 37 Application timer control block Application timer name Expiration function to call Expiration input value to pass to function Initial number of timer-ticks Reschedule number of timer-ticks Automatic activate option Figure 4.9: Attributes of an application timer the use of the developer.) An attribute containing the initial number of timer-ticks1 for the timer expiration is required, as is an attribute specifying the number of timer-ticks for all timer expirations after the first. The last attribute is used to specify whether the application timer is automatically activated at creation, or whether it is created in a nonactive state that would require a thread to start it. Application timers are very similar to ISRs, except the actual hardware implementation (usually a single periodic hardware interrupt is used) is hidden from the application. Such timers are used by applications to perform time-outs, periodic operations, and/ or watchdog services. Just like ISRs, application timers most often interrupt thread execution. Unlike ISRs, however, application timers cannot interrupt each other. 4.7 Mutex The sole purpose of a mutex is to provide mutual exclusion; the name of this concept provides the derivation of the name mutex (i.e., MUTual EXclusion).2 A mutex is used 1 The actual time between timer-ticks is specified by the application, but 10 ms is the value used here. 2 In the 1960s, Edsger Dijkstra proposed the concept of a mutual exclusion semaphore with two operations: the P operation (Prolaag, meaning to lower) and the V operation (Verhogen, meaning to raise). The P operation decrements the semaphore if its value is greater than zero, and the V operation increments the semaphore value. P and V are atomic operations. w w w.ne w nespress.comPlease purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 38 Chapter 4 Mutex control block Mutex name Priority inheritance option ...

Tài liệu được xem nhiều: