Real-Time Embedded Multithreading Using ThreadX and MIPS- P2

Real-Time Embedded Multithreading Using ThreadX and MIPS- P2:Although the history of embedded systems is relatively short, 1 the advances and successes of this fi eld have been profound. Embedded systems are found in a vast array of applications such as consumer electronics, “ smart ” devices, communication equipment, automobiles, desktop computers, and medical equipment. | 16 Chapter 2 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063 064 065 066 067 068 069 070 071 072 073 074 075 076 077 078 079 080 081 Enter the ThreadX kernel. tx_kernel_enter Application Definitions Define what the initial system looks like. void tx_application_define void first_unused_memory CHAR pool_pointer Create a byte memory pool from which to allocate the thread stacks. tx_byte_pool_create my_byte_pool my_byte_pool first_unused_memory DEMO_BYTE_POOL_SIZE Put system definition stuff in here . thread creates and other assorted create information. Allocate the stack for the Speedy_Thread. tx_byte_allocate my_byte_pool VOID pool_pointer DEMO_STACK_SIZE TX_NO_WAIT Create the Speedy_Thread. tx_thread_create Speedy_Thread Speedy_Thread Speedy_Thread_entry 0 pool_pointer DEMO_STACK_SIZE 5 5 TX_NO_TIME_SLICE TX_AUTO_START Allocate the stack for the Slow Thread. PUh .ye on to remove this watermark. Ple First Look at a System Using an RTOS 17 082 tx_byte_allocate my_byte_pool VOID pool_pointer 083 DEMO_STACK_SIZE TX_NO_WAIT 084 085 Create the Slow_Thread. 086 tx_thread_create Slow_Thread Slow_Thread 087 Slow_Thread_entry 1 pool_pointer 088 DEMO_STACK_SIZE 15 15 089 TX_NO_TIME_SLICE TX_AUTO_START 090 091 Create the mutex used by both threads 092 tx_mutex_create my_mutex my_mutex TX_NO_INHERIT 093 094 095 096 097 098 099 Function Definitions 100 101 102 103 Entry function definition of the Speedy_Thread 104 it has a higher priority than the Slow_Thread 105 106 void Speedy_Thread_entry ULONG thread_input 107 108 109 ULONG current_time 110 111 while 1 112 113 Activity 1 2 timer-ticks 114 tx_thread_sleep 2 115 116 Get the mutex with suspension 117 tx_mutex_get my_mutex TX_WAIT_FOREVER 118 119 Activity 2 5 timer-ticks critical section 120 tx_thread_sleep 5 121 Please purchase PDF Split-Merge on . I co imo ne wrueHt ai saw rai k. 18 Chapter 2 122 123 124 125 126 127 .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.