Real Time Executive for
Military Systems
C Applications User's Guide


Table of Contents

The RTEMS C Applications User's Guide is available as an individual document.

To preview individual chapters or to jump directly to a particular topic in the C Applications User's Guide, select one from the following list:

1 Overview
1.1 Introduction
1.2 Real-time Application Systems
1.3 Real-time Executive
1.4 RTEMS Application Architecture
1.5 RTEMS Internal Architecture
1.6 User Customization and Extensibility
1.7 Portability
1.8 Memory Requirements
1.9 Audience
1.10 Conventions
1.11 Manual Organization
2 Key Concepts
2.1 Introduction
2.2 Objects
2.3 Communication and Synchronization
2.4 Time
2.5 Memory Management
3 Initialization Manager
3.1 Introduction
3.2 Background
3.2.2 The System Initialization Task
3.2.3 The Idle Task
3.2.4 Initialization Manager Failure
3.3 Operations
3.3.1 Initializing RTEMS
3.3.2 Shutting Down RTEMS
3.4 Directives
3.4.1 INITIALIZE_EXECUTIVE - Initialize RTEMS
3.4.2 INITIALIZE_EXECUTIVE_EARLY - Initialize RTEMS and do NOT Start Multitasking
3.4.3 INITIALIZE_EXECUTIVE_LATE - Complete Initialization and Start Multitasking
3.4.4 SHUTDOWN_EXECUTIVE - Shutdown RTEMS
4 Task Manager
4.1 Introduction
4.2 Background
4.2.1 Task Definition
4.2.2 Task Control Block
4.2.3 Task States
4.2.4 Task Priority
4.2.5 Task Mode
4.2.6 Accessing Task Arguments
4.2.7 Floating Point Considerations
4.2.8 Building a Task's Attribute Set
4.2.9 Building a Mode and Mask
4.3 Operations
4.3.1 Creating Tasks
4.3.2 Obtaining Task IDs
4.3.3 Starting and Restarting Tasks
4.3.4 Suspending and Resuming Tasks
4.3.5 Delaying the Currently Executing Task
4.3.6 Changing Task Priority
4.3.7 Changing Task Mode
4.3.8 Notepad Locations
4.3.9 Task Deletion
4.4 Directives
4.4.1 TASK_CREATE - Create a task
4.4.2 TASK_IDENT - Get ID of a task
4.4.3 TASK_START - Start a task
4.4.4 TASK_RESTART - Restart a task
4.4.5 TASK_DELETE - Delete a task
4.4.6 TASK_SUSPEND - Suspend a task
4.4.7 TASK_RESUME - Resume a task
4.4.8 TASK_SET_PRIORITY - Set task priority
4.4.9 TASK_MODE - Change current task's mode
4.4.10 TASK_GET_NOTE - Get task notepad entry
4.4.11 TASK_SET_NOTE - Set task notepad entry
4.4.12 TASK_WAKE_AFTER - Wake up after interval
4.4.13 TASK_WAKE_WHEN - Wake up when specified
5 Interrupt Manager
5.1 Introduction
5.2 Background
5.2.1 Processing an Interrupt
5.2.2 RTEMS Interrupt Levels
5.2.3 Disabling of Interrupts by RTEMS
5.3 Operations
5.3.1 Establishing an ISR
5.3.2 Directives Allowed from an ISR
5.4 Directives
5.4.1 INTERRUPT_CATCH - Establish an ISR
6 Clock Manager
6.1 Introduction
6.2 Background
6.2.1 Required Support
6.2.2 Time and Date Data Structures
6.2.3 Timeslicing
6.2.4 Delays
6.2.5 Timeouts
6.3 Operations
6.3.1 Announcing a Tick
6.3.2 Setting the Time
6.3.3 Obtaining the Time
6.4 Directives
6.4.1 CLOCK_SET - Set system date and time
6.4.2 CLOCK_GET - Get system date and time information
6.4.3 CLOCK_TICK - Announce a clock tick
7 Timer Manager
7.1 Introduction
7.2 Background
7.2.1 Timers
7.2.2 Timer Service Routines
7.3 Operations
7.3.1 Creating a Timer
7.3.2 Obtaining Timer IDs
7.3.3 Initiating an Interval Timer
7.3.4 Initiating a Time of Day Timer
7.3.5 Canceling a Timer
7.3.6 Resetting a Timer
7.3.7 Deleting a Timer
7.4 Directives
7.4.1 TIMER_CREATE - Create a timer
7.4.2 TIMER_IDENT - Get ID of a timer
7.4.3 TIMER_CANCEL - Cancel a timer
7.4.4 TIMER_DELETE - Delete a timer
7.4.5 TIMER_FIRE_AFTER - Fire timer after interval
7.4.6 TIMER_FIRE_WHEN - Fire timer when specified
7.4.7 TIMER_RESET - Reset an interval timer
8 Semaphore Manager
8.1 Introduction
8.2 Background
8.2.1 Nested Resource Access
8.2.2 Priority Inversion
8.2.3 Priority Inheritance
8.2.4 Building an Attribute Set
8.3 Operations
8.3.1 Creating a Semaphore
8.3.2 Obtaining Semaphore IDs
8.3.3 Acquiring a Semaphore
8.3.4 Releasing a Semaphore
8.3.5 Deleting a Semaphore
8.4 Directives
8.4.1 SEMAPHORE_CREATE - Create a semaphore
8.4.2 SEMAPHORE_IDENT - Get ID of a semaphore
8.4.3 SEMAPHORE_DELETE - Delete a semaphore
8.4.4 SEMAPHORE_OBTAIN - Acquire a semaphore
8.4.5 SEMAPHORE_RELEASE - Release a semaphore
9 Message Manager
9.1 Introduction
9.2 Background
9.2.1 Messages
9.2.2 Message Queues
9.2.3 Building an Attribute Set
9.2.4 Building an Option Set
9.3 Operations
9.3.1 Creating a Message Queue
9.3.2 Obtaining Message Queue IDs
9.3.3 Receiving a Message
9.3.4 Sending a Message
9.3.5 Broadcasting a Message
9.3.6 Deleting a Message Queue
9.4 Directives
9.4.1 MESSAGE_QUEUE_CREATE - Create a queue
9.4.2 MESSAGE_QUEUE_IDENT - Get ID of a queue
9.4.3 MESSAGE_QUEUE_DELETE - Delete a queue
9.4.4 MESSAGE_QUEUE_SEND - Put message at rear of a queue
9.4.5 MESSAGE_QUEUE_URGENT - Put message at front of a queue
9.4.6 MESSAGE_QUEUE_BROADCAST - Broadcast N messages to a queue
9.4.7 MESSAGE_QUEUE_RECEIVE - Receive message from a queue
9.4.8 MESSAGE_QUEUE_FLUSH - Flush all messages on a queue
10 Event Manager
10.1 Introduction
10.2 Background
10.2.1 Event Sets
10.2.2 Building an Event Set or Condition
10.2.3 Building an Option Set
10.3 Operations
10.3.1 Sending an Event Set
10.3.2 Receiving an Event Set
10.3.3 Determining the Pending Event Set
10.3.4 Receiving all Pending Events
10.4 Directives
10.4.1 EVENT_SEND - Send event set to a task
10.4.2 EVENT_RECEIVE - Receive event condition
11 Signal Manager
11.1 Introduction
11.2 Background
11.2.1 Definitions
11.2.2 A Comparison of ASRs and ISRs
11.2.3 Building a Signal Set
11.2.4 Building an ASR's Mode
11.3 Operations
11.3.1 Establishing an ASR
11.3.2 Sending a Signal Set
11.3.3 Processing an ASR
11.4 Directives
11.4.1 SIGNAL_CATCH - Establish an ASR
11.4.2 SIGNAL_SEND - Send signal set to a task
12 Partition Manager
12.1 Introduction
12.2 Background
12.2.1 Definitions
12.2.2 Building an Attribute Set
12.3 Operations
12.3.1 Creating a Partition
12.3.2 Obtaining Partition IDs
12.3.3 Acquiring a Buffer
12.3.4 Releasing a Buffer
12.3.5 Deleting a Partition
12.4 Directives
12.4.1 PARTITION_CREATE - Create a partition
12.4.2 PARTITION_IDENT - Get ID of a partition
12.4.3 PARTITION_DELETE - Delete a partition
12.4.4 PARTITION_GET_BUFFER - Get buffer from a partition
12.4.5 PARTITION_RETURN_BUFFER - Return buffer to a partition
13 Region Manager
13.1 Introduction
13.2 Background
13.2.1 Definitions
13.2.2 Building an Attribute Set
13.2.3 Building an Option Set
13.3 Operations
13.3.1 Creating a Region
13.3.2 Obtaining Region IDs
13.3.3 Adding Memory to a Region
13.3.4 Acquiring a Segment
13.3.5 Releasing a Segment
13.3.6 Obtaining the Size of a Segment
13.3.7 Deleting a Region
13.4 Directives
13.4.1 REGION_CREATE - Create a region
13.4.2 REGION_IDENT - Get ID of a region
13.4.3 REGION_DELETE - Delete a region
13.4.4 REGION_EXTEND - Add memory to a region
13.4.5 REGION_GET_SEGMENT - Get segment from a region
13.4.6 REGION_RETURN_SEGMENT - Return segment to a region
13.4.7 REGION_GET_SEGMENT_SIZE - Obtain size of a segment
14 Dual-Ported Memory Manager
14.1 Introduction
14.2 Background
14.3 Operations
14.3.1 Creating a Port
14.3.2 Obtaining Port IDs
14.3.3 Converting an Address
14.3.4 Deleting a DPMA Port
14.4 Directives
14.4.1 PORT_CREATE - Create a port
14.4.2 PORT_IDENT - Get ID of a port
14.4.3 PORT_DELETE - Delete a port
14.4.4 PORT_EXTERNAL_TO_INTERNAL - Convert external to internal address
14.4.5 PORT_INTERNAL_TO_EXTERNAL - Convert internal to external address
15 I/O Manager
15.1 Introduction
15.2 Background
15.2.1 Device Driver Table
15.2.2 Major and Minor Device Numbers
15.2.3 Device Driver Environment
15.2.4 Device Driver Interface
15.2.5 Device Driver Initialization
15.3 Operations
15.4 Directives
15.4.1 IO_INITIALIZE - Initialize a device driver
15.4.2 IO_OPEN - Open a device
15.4.3 IO_CLOSE - Close a device
15.4.4 IO_READ - Read from a device
15.4.5 IO_WRITE - Write to a device
15.4.6 IO_CONTROL - Special device services
16 Fatal Error Manager
16.1 Introduction
16.2 Background
16.3 Operations
16.3.1 Announcing a Fatal Error
16.4 Directives
16.4.1 FATAL_ERROR_OCCURRED - Invoke the fatal error handler
17 Scheduling Concepts
17.1 Introduction
17.2 Scheduling Mechanisms
17.2.1 Task Priority
17.2.2 Preemption
17.2.3 Timeslicing
17.2.4 Manual Round-Robin
17.2.5 Dispatching Tasks
17.3 Task State Transitions
18 Rate Monotonic Manager
18.1 Introduction
18.2 Background
18.2.1 Definitions
18.2.2 Rate Monotonic Scheduling Algorithm
18.2.3 Schedulability Analysis
18.2.3.1 Assumptions
18.2.3.2 Processor Utilization Rule
18.2.3.3 Processor Utilization Rule Example
18.2.3.4 First Deadline Rule
18.2.3.5 First Deadline Rule Example
18.2.3.6 Relaxation of Assumptions
18.2.4 Further Reading
18.3 Operations
18.3.1 Creating a Rate Monotonic Period
18.3.2 Manipulating a Period
18.3.3 Obtaining a Period's Status
18.3.4 Canceling a Period
18.3.5 Deleting a Rate Monotonic Period
18.3.6 Examples
18.3.6.1 Simple Periodic Task
18.3.6.2 Task with Multiple Periods
18.4 Directives
18.4.1 RATE_MONOTONIC_CREATE - Create a rate monotonic period
18.4.2 RATE_MONOTONIC_IDENT - Get ID of a period
18.4.3 RATE_MONOTONIC_CANCEL - Cancel a period
18.4.4 RATE_MONOTONIC_DELETE - Delete a rate monotonic period
18.4.5 RATE_MONOTONIC_PERIOD - Conclude current/Start next period
19 Board Support Packages
19.1 Introduction
19.2 Reset and Initialization
19.2.1 Interrupt Stack Requirements
19.2.2 Processors with a Separate Interrupt Stack
19.2.3 Processors without a Separate Interrupt Stack
19.3 Device Drivers
19.3.1 Clock Tick Device Driver
19.4 User Extensions
19.5 Multiprocessor Communications Interface (MPCI)
19.5.1 Tightly-Coupled Systems
19.5.2 Loosely-Coupled Systems
19.5.3 Systems with Mixed Coupling
19.5.4 Heterogeneous Systems
20 User Extensions Manager
20.1 Introduction
20.2 Background
20.2.1 Extension Sets
20.2.2 TCB Extension Area
20.2.3 Extensions
20.2.3.1 TASK_CREATE Extension
20.2.3.2 TASK_START Extension
20.2.3.3 TASK_RESTART Extension
20.2.3.4 TASK_DELETE Extension
20.2.3.5 TASK_SWITCH Extension
20.2.3.6 TASK_BEGIN Extension
20.2.3.7 TASK_EXITTED Extension
20.2.3.8 FATAL Error Extension
20.2.4 Order of Invocation
20.3 Operations
20.3.1 Creating an Extension Set
20.3.2 Obtaining Extension Set IDs
20.3.3 Deleting an Extension Set
20.4 Directives
20.4.1 EXTENSION_CREATE - Create a extension set
20.4.2 EXTENSION_IDENT - Get ID of a extension set
20.4.3 EXTENSION_DELETE - Delete a extension set
21 Configuring a System
21.1 Configuration Table
21.2 CPU Dependent Information Table
21.3 Initialization Task Table
21.4 Driver Address Table
21.5 User Extensions Table
21.6 Multiprocessor Configuration Table
21.7 Multiprocessor Communications Interface Table
21.8 Determining Memory Requirements
21.9 Sizing the RTEMS RAM Workspace
22 Multiprocessing Manager
22.1 Introduction
22.2 Background
22.2.1 Nodes
22.2.2 Global Objects
22.2.3 Global Object Table
22.2.4 Remote Operations
22.2.5 Proxies
22.2.6 Multiprocessor Configuration Table
22.3 Multiprocessor Communications Interface Layer
22.3.1 INITIALIZATION
22.3.2 GET_PACKET
22.3.3 RETURN_PACKET
22.3.4 RECEIVE_PACKET
22.3.5 SEND_PACKET
22.3.6 Supporting Heterogeneous Environments
22.4 Operations
22.4.1 Announcing a Packet
22.5 Directives
22.5.1 MULTIPROCESSING_ANNOUNCE - Announce the arrival of a packet
23 Directive Status Codes
24 Example Application
25 Glossary