Contents
Figures
About This Guide
Organization
Guide Conventions
ThreadX Data Types
Customer Support Center
Where to Send Comments
Introduction to ThreadX
ThreadX Unique Features
picokernel™ Architecture
ANSI C Source Code
Not A Black Box
A Potential Standard
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
Installation and Use of ThreadX
Host Considerations
Target Considerations
Product Distribution
ThreadX Installation
Using ThreadX
Small Example System
Troubleshooting
Configuration Options
ThreadX Version ID
Functional Components of ThreadX
Execution Overview
Initialization
Initialization
Thread Execution
Interrupt Service Routines (ISR)
Application Timers
Memory Usage
Static Memory Usage
Dynamic Memory Usage
Initialization
System Reset
Development Tool Initialization
main
tx_kernel_enter
Application Definition Function
Interrupts
Thread Execution
Thread Execution States
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
Reentrancy
Thread Priority Pitfalls
Priority Overhead
Debugging Pitfalls
Message Queues
Creating Message Queues
Message Size
Message Queue Capacity
Queue Memory Area
Thread Suspension
Queue Control Block TX_QUEUE
Message Destination Pitfall
Counting Semaphores
Mutual Exclusion
Event Notification
Creating Counting Semaphores
Thread Suspension
Semaphore Control Block TX_SEMAPHORE
Deadly Embrace
Priority Inversion
Mutexes
Mutex Mutual Exclusion
Creating Mutexes
Thread Suspension
Mutex Control Block TX_MUTEX
Deadly Embrace
Priority Inversion
Event Flags
Creating Event Flag Groups
Thread Suspension
Event Flag 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
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
Memory Byte Pool Control Block TX_BYTE_POOL
Un-deterministic Behavior
Overwriting Memory Blocks
Application Timers
Timer Intervals
Timer Accuracy
Timer Execution
Creating Application Timers
Application Timer Control Block TX_TIMER
Excessive Timers
Relative Time
Interrupts
Interrupt Control
ThreadX Managed Interrupts
ISR Template
High-Frequency Interrupts
Interrupt Latency
Description of ThreadX Services
tx_block_allocate
tx_block_pool_create
tx_block_pool_delete
tx_block_pool_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_prioritize
tx_byte_release
tx_event_flags_create
tx_event_flags_delete
tx_event_flags_get
tx_event_flags_info_get
tx_event_flags_set
tx_interrupt_control
tx_mutex_create
tx_mutex_delete
tx_mutex_get
tx_mutex_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_prioritize
tx_queue_receive
tx_queue_send
tx_semaphore_create
tx_semaphore_delete
tx_semaphore_get
tx_semaphore_info_get
tx_semaphore_prioritize
tx_semaphore_put
tx_thread_create
tx_thread_delete
tx_thread_identify
tx_thread_info_get
tx_thread_preemption_change
tx_thread_priority_change
tx_thread_relinquish
tx_thread_resume
tx_thread_sleep
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
I/O Drivers for ThreadX
I/O 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
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.c
Internal Composition of ThreadX
ThreadX Design Goals
Simplicity
Scalability
High Performance
ThreadX ANSI C Library
System Include Files
System Entry
Application Definition
Software Components
ThreadX Components
Component Specification File
Component Initialization
Component Body Functions
Coding Conventions
ThreadX File Names
ThreadX Name Space
ThreadX Constants
ThreadX Struct and Typedef Names
ThreadX Member Names
ThreadX Global Data
ThreadX Local Data
ThreadX Function Names
Source Code Indentation
Comments
Initialization Component
TX_INI.H
TX_IHL.C
TX_IKE.C
TX_ILL.[S, ASM]
Thread Component
TX_THR.H
TX_TC.C
TX_TCR.[S,ASM]
TX_TCS.[S,ASM]
TX_TDEL.C
TX_TI.C
TX_TIC.[S,ASM]
TX_TIDE.C
TX_TIG.C
TX_TPC.[S,ASM]
TX_TPCH.C
TX_TPRCH.C
TX_TR.C
TX_TRA.C
TX_TREL.C
TX_TS.[S,ASM]
TX_TSA.C
TX_TSB.[S,ASM]
TX_TSE.C
TX_TSLE.C
TX_TSR.[S,ASM]
TX_TSUS.C
TX_TT.C
TX_TTO.C
TX_TTS.C
TX_TTSC.C
TX_TWA.C
TXE_TC.C
TXE_TDEL.C
TXE_TIG.C
TXE_TPCH.C
TXE_TRA.C
TXE_TREL.C
TXE_TRPC.C
TXE_TSA.C
TXE_TT.C
TXE_TTSC.C
TXE_TWA.C
Timer Component
TX_TIM.H
TX_TA.C
TX_TAA.C
TX_TD.C
TX_TDA.C
TX_TIMCH.C
TX_TIMCR.C
TX_TIMD.C
TX_TIMEG.C
TX_TIMES.C
TX_TIMI.C
TX_TIMIG.C
TX_TIMIN.[S,ASM]
TX_TTE.C
TXE_TAA.C
TXE_TDA.C
TXE_TIMD.C
TXE_TIMI.C
TXE_TMCH.C
TXE_TMCR.C
Queue Component
TX_QUE.H
TX_QC.C
TX_QCLE.C
TX_QD.C
TX_QF.C
TX_QFS.C
TX_QI.C
TX_QIG.C
TX_QP.C
TX_QR.C
TX_QS.C
TXE_QC.C
TXE_QD.C
TXE_QF.C
TXE_QFS.C
TXE_QIG.C
TXE_QP.C
TXE_QR.C
TXE_QS.C
Semaphore Component
TX_SEM.H
TX_SC.C
TX_SCLE.C
TX_SD.C
TX_SG.C
TX_SI.C
TX_SIG.C
TX_SP.C
TX_SPRI.C
TXE_SC.C
TXE_SD.C
TXE_SG.C
TXE_SIG.C
TXE_SP.C
TXE_SPRI.C
Mutex Component
TX_MUT.H
TX_MC.C
TX_MCLE.C
TX_MD.C
TX_MG.C
TX_MI.C
TX_MIG.C
TX_MP.C
TX_MPC.C
TX_MPRI.C
TXE_MC.C
TXE_MD.C
TXE_MG.C
TXE_MIG.C
TXE_MP.C
TXE_MPRI.C
Event Flag Component
TX_EVE.H
TX_EFC.C
TX_EFCLE.C
TX_EFD.C
TX_EFG.C
TX_EFI.C
TX_EFIG.C
TX_EFS.C
TXE_EFC.C
TXE_EFD.C
TXE_EFG.C
TXE_EFIG.C
TXE_EFS.C
Block Memory Component
TX_BLO.H
TX_BA.C
TX_BPC.C
TX_BPCLE.C
TX_BPD.C
TX_BPI.C
TX_BPIG.C
TX_BPP.C
TX_BR.C
TXE_BA.C
TXE_BPC.C
TXE_BPD.C
TXE_BPIG.C
TXE_BPP.C
TXE_BR.C
Byte Memory Component
TX_BYT.H
TX_BYTA.C
TX_BYTC.C
TX_BYTCL.C
TX_BYTD.C
TX_BYTI.C
TX_BYTIG.C
TX_BYTPP.C
TX_BYTR.C
TX_BYTS.C
TXE_BTYA.C
TXE_BYTC.C
TXE_BYTD.C
TXE_BYTG.C
TXE_BYTP.C
TXE_BYTR.C
ThreadX API Services
Entry Function
Byte Memory Services
Block Memory Services
Event Flag Services
Interrupt Control
Message Queue Services
Semaphore Services
Mutex Services
Thread Control Services
Time Services
Timer Services
ThreadX Constants
Alphabetic Listings
Listing by Value
ThreadX Data Types
ThreadX Source Files
ThreadX C Include Files
ThreadX C Source Files
ThreadX Port Specific Assembly Language Files
ASCII Character Codes in HEX
ASCII Character Codes
Index