logo资料库

ThreadX用户手册.pdf

第1页 / 共356页
第2页 / 共356页
第3页 / 共356页
第4页 / 共356页
第5页 / 共356页
第6页 / 共356页
第7页 / 共356页
第8页 / 共356页
资料共356页,剩余部分请下载后查看
ThreadX User Guide Ver.5
Contents
Figures
About This Guide
Organization
Guide Conventions
ThreadX Data Types
Customer Support Center
Latest Product Information
What We Need From You
Where to Send Comments About This Guide
1 Introduction to ThreadX
ThreadX Unique Features
picokernel™ Architecture
ANSI C Source Code
Advanced Technology
Not A Black Box
The RTOS Standard
Safety Certifications
TÜV Certification
MISRA C Compliant
UL Certification
Certification Pack
Embedded Applications
Real-time Software
Multitasking
Tasks vs. Threads
ThreadX Benefits
Improved Responsiveness
Software Maintenance
Increased Throughput
Processor Isolation
Dividing the Application
Ease of Use
Improve Time-to-market
Protecting the Software Investment
2 Installation and Use of ThreadX
Host Considerations
Target Considerations
Product Distribution
ThreadX Installation
Using ThreadX
Small Example System
Troubleshooting
Configuration Options
Smallest Configuration
Fastest Configuration
Global Time Source
Detailed Configuration Options
ThreadX Version ID
3 Functional Components of ThreadX
Execution Overview
Initialization
Thread Execution
Interrupt Service Routines (ISR)
Application Timers
Memory Usage
Static Memory Usage
Dynamic Memory Usage
Initialization
System Reset Vector
Development Tool Initialization
main Function
tx_kernel_enter
Application Definition Function
Interrupts
Thread Execution
Thread Execution States
Thread Entry/Exit Notification
Thread Priorities
Thread Scheduling
Round-robin Scheduling
Time-Slicing
Preemption
Preemption- Threshold™
Priority Inheritance
Thread Creation
Thread Control Block TX_THREAD
Currently Executing Thread
Thread Stack Area
Memory Pitfalls
Optional Run-time Stack Checking
Reentrancy
Thread Priority Pitfalls
Priority Overhead
Run-time Thread Performance Information
Debugging Pitfalls
Message Queues
Creating Message Queues
Message Size
Message Queue Capacity
Queue Memory Area
Thread Suspension
Queue Send Notification
Queue Event- chaining™
Run-time Queue Performance Information
Queue Control Block TX_QUEUE
Message Destination Pitfall
Counting Semaphores
Mutual Exclusion
Event Notification
Creating Counting Semaphores
Thread Suspension
Semaphore Put Notification
Semaphore Event- chaining™
Run-time Semaphore Performance Information
Semaphore Control Block TX_SEMAPHORE
Deadly Embrace
Priority Inversion
Mutexes
Mutex Mutual Exclusion
Creating Mutexes
Thread Suspension
Run-time Mutex Performance Information
Mutex Control Block TX_MUTEX
Deadly Embrace
Priority Inversion
Event Flags
Creating Event Flags Groups
Thread Suspension
Event Flags Set Notification
Event Flags Event- chaining™
Run-time Event Flags Performance Information
Event Flags Group Control Block TX_EVENT_FLAGS_GROUP
Memory Block Pools
Creating Memory Block Pools
Memory Block Size
Pool Capacity
Pool’s Memory Area
Thread Suspension
Run-time Block Pool Performance Information
Memory Block Pool Control Block TX_BLOCK_POOL
Overwriting Memory Blocks
Memory Byte Pools
Creating Memory Byte Pools
Pool Capacity
Pool’s Memory Area
Thread Suspension
Run-time Byte Pool Performance Information
Memory Byte Pool Control Block TX_BYTE_POOL
Nondeterministic Behavior
Overwriting Memory Blocks
Application Timers
Timer Intervals
Timer Accuracy
Timer Execution
Creating Application Timers
Run-time Application Timer Performance Information
Application Timer Control Block TX_TIMER
Excessive Timers
Relative Time
Interrupts
Interrupt Control
ThreadX Managed Interrupts
ISR Template
High-frequency Interrupts
Interrupt Latency
4 Description of ThreadX Services
tx_block_allocate
tx_block_pool_create
tx_block_pool_delete
tx_block_pool_info_get
tx_block_pool_performance_info_get
tx_block_pool_performance_system_info_get
tx_block_pool_prioritize
tx_block_release
tx_byte_allocate
tx_byte_pool_create
tx_byte_pool_delete
tx_byte_pool_info_get
tx_byte_pool_performance_info_get
tx_byte_pool_performance_system_info_get
tx_byte_pool_prioritize
tx_byte_release
tx_event_flags_create
tx_event_flags_delete
tx_event_flags_get
tx_event_flags_info_get
tx_event_flags_performance info_get
tx_event_flags_performance_system_info_get
tx_event_flags_set
tx_event_flags_set_notify
tx_interrupt_control
tx_mutex_create
tx_mutex_delete
tx_mutex_get
tx_mutex_info_get
tx_mutex_performance_info_get
tx_mutex_performance_system_info_get
tx_mutex_prioritize
tx_mutex_put
tx_queue_create
tx_queue_delete
tx_queue_flush
tx_queue_front_send
tx_queue_info_get
tx_queue_performance_info_get
tx_queue_performance_system_info_get
tx_queue_prioritize
tx_queue_receive
tx_queue_send
tx_queue_send_notify
tx_semaphore_ceiling_put
tx_semaphore_create
tx_semaphore_delete
tx_semaphore_get
tx_semaphore_info_get
tx_semaphore_performance_info_get
tx_semaphore_performance_system_info_get
tx_semaphore_prioritize
tx_semaphore_put
tx_semaphore_put_notify
tx_thread_create
tx_thread_delete
tx_thread_entry_exit_notify
tx_thread_identify
tx_thread_info_get
tx_thread_performance_info_get
tx_thread_performance_system_info_get
tx_thread_preemption_change
tx_thread_priority_change
tx_thread_relinquish
tx_thread_reset
tx_thread_resume
tx_thread_sleep
tx_thread_stack_error_notify
tx_thread_suspend
tx_thread_terminate
tx_thread_time_slice_change
tx_thread_wait_abort
tx_time_get
tx_time_set
tx_timer_activate
tx_timer_change
tx_timer_create
tx_timer_deactivate
tx_timer_delete
tx_timer_info_get
tx_timer_performance_info_get
tx_timer_performance_system_info_get
5 Device Drivers for ThreadX
Device Driver Introduction
Driver Functions
Driver Initialization
Driver Control
Driver Access
Driver Input
Driver Output
Driver Interrupts
Driver Status
Driver Termination
Simple Driver Example
Simple Driver Initialization
Simple Driver Input
Simple Driver Output
Simple Driver Shortcomings
Advanced Driver Issues
I/O Buffering
Circular Byte Buffers
Circular Buffer Input
Circular Output Buffer
Buffer I/O Management
TX_IO_BUFFER
Buffered I/O Advantage
Buffered Driver Responsibilities
Interrupt Management
Thread Suspension
6 Demonstration System for ThreadX
Overview
Application Define
Initial Execution
Thread 0
Thread 1
Thread 2
Threads 3 and 4
Thread 5
Threads 6 and 7
Observing the Demonstration
Distribution file: demo_threadx.c
A ThreadX API Services
Entry Function
Block Memory Services
Byte Memory Services
Event Flags Services
Interrupt Control
Mutex Services
Queue Services
Semaphore Services
Thread Control Services
Time Services
Timer Services
B ThreadX Constants
Alphabetic Listings
Listing by Value
C ThreadX Data Types
TX_BLOCK_POOL
TX_BYTE_POOL
TX_EVENT_FLAGS_GROUP
TX_MUTEX
TX_QUEUE
TX_SEMAPHORE
TX_THREAD
TX_TIMER
TX_TIMER_INTERNAL
D ASCII Character Codes
Index
the high-performance embedded kernel User Guide Version 5 Express Logic 858.613.6640 Toll Free 888.THREADX FAX 858.521.4259 http://www.expresslogic.com
©1997-2017 by Express Logic All rights reserved. This document and the associated ThreadX software are the sole property of Express Logic. Each contains proprietary information of Express Logic. Reproduction or duplication by any means of any portion of this document without the prior written consent of Express Logic is expressly forbidden. Express Logic reserves the right to make changes to the specifications described herein at any time and without notice in order to improve design or reliability of ThreadX. The information in this document has been carefully checked for accuracy; however, Express Logic makes no warranty pertaining to the correctness of this document. Trademarks ThreadX is a registered trademark of Express Logic, and picokernel, preemption-threshold, and event- chaining are trademarks of Express Logic. All other product and company names are trademarks or registered trademarks of their respective holders. Warranty Limitations Express Logic makes no warranty of any kind that the ThreadX products will meet the USER’s requirements, or will operate in the manner specified by the USER, or that the operation of the ThreadX products will operate uninterrupted or error free, or that any defects that may exist in the ThreadX products will be corrected after the warranty period. Express Logic makes no warranties of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose, with respect to the ThreadX products. No oral or written information or advice given by Express Logic, its dealers, distributors, agents, or employees shall create any other warranty or in any way increase the scope of this warranty, and licensee may not rely on any such information or advice. Safety Certifications IEC 61508 up to SIL 4 IEC 62304 up to SW safety Class C ISO 26262 ASIL D EN 50128 SW-SIL 4 UL/IEC 60730, UL/IEC 60335, UL 1998 MISRA-C:2004 Compliant MISRA C:2012 Compliant Part Number: 000-1001 Revision 5.8 Express Logic
Contents About This Guide 9 1 Organization 9 1 Guide Conventions 10 1 ThreadX Data Types 11 1 Customer Support Center 12 1 Introduction to ThreadX 15 1 ThreadX Unique Features 16 1 Safety Certifications 18 1 Embedded Applications 20 1 ThreadX Benefits 22 2 Installation and Use of ThreadX 27 1 Host Considerations 28 1 Target Considerations 28 1 Product Distribution 29 1 ThreadX Installation 30 1 Using ThreadX 31 1 Small Example System 31 1 Troubleshooting 33 1 Configuration Options 33 1 ThreadX Version ID 40 User Guide
4 ThreadX 3 Functional Components of ThreadX 41 1 Execution Overview 44 1 Memory Usage 46 1 Initialization 48 1 Thread Execution 50 1 Message Queues 67 1 Counting Semaphores 72 1 Mutexes 78 1 Event Flags 82 1 Memory Block Pools 85 1 Memory Byte Pools 89 1 Application Timers 93 1 Relative Time 96 1 Interrupts 96 4 Description of ThreadX Services 101 5 Device Drivers for ThreadX 289 1 Device Driver Introduction 290 1 Driver Functions 290 1 Simple Driver Example 292 1 Advanced Driver Issues 297 6 Demonstration System for ThreadX 305 1 Overview 306 1 Application Define 306 1 Thread 0 308 1 Thread 1 308 1 Thread 2 308 User Guide
Contents 5 1 Threads 3 and 4 309 1 Thread 5 309 1 Threads 6 and 7 310 1 Observing the Demonstration 310 1 Distribution file: demo_threadx.c 311 Appendices A ThreadX API Services 317 B ThreadX Constants 323 C ThreadX Data Types 329 D ASCII Character Codes 337 Index 339 Express Logic, Inc.
6 ThreadX User Guide
Figures Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 Figure 7 Figure 8 Figure 9 Figure 10 Figure 11 Figure 12 Figure 13 Figure 14 Figure 15 Template for Application Development 32 Types of Program Execution 45 Memory Area Example 47 Initialization Process 51 Thread State Transition 52 Typical Thread Stack 60 Stack Preset to 0xEFEF 61 Example of Suspended Threads 77 Simple Driver Initialization 294 Simple Driver Input 295 Simple Driver Output 296 Logic for Circular Input Buffer 299 Logic for Circular Output Buffer 300 I/O Buffer 300 Input-Output Lists 302 User Guide
8 ThreadX User Guide
分享到:
收藏