RTA-OS3.1 Reference Guide
RTA-OS3.1 Reference Guide
1
Reference Guide
Copyright
The data in this document may not be altered or amended without special
notification from ETAS GmbH. ETAS GmbH undertakes no further obligation
in relation to this document. The software described in it can only be used
if the customer is in possession of a general license agreement or single li-
cense. Using and copying is only allowed in concurrence with the specifica-
tions stipulated in the contract. Under no circumstances may any part of this
document be copied, reproduced, transmitted, stored in a retrieval system or
translated into another language without the express written permission of
ETAS GmbH.
The names and designations used in this document are trademarks or brands
belonging to the respective owners.
Document: 10483-RG-1.0.0
2 Copyright
Contents
1 Introduction 12
1.1 About You . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.2 Document Conventions . . . . . . . . . . . . . . . . . . . . . . . . 12
1.3 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Contents 3
2.40 Os_ResetISRMaxExecutionTime . . . . . . . . . . . . . . . . . . . 87
2.41 Os_ResetISRMaxStackUsage . . . . . . . . . . . . . . . . . . . . . 89
2.42 Os_ResetTaskMaxExecutionTime . . . . . . . . . . . . . . . . . . 91
2.43 Os_ResetTaskMaxStackUsage . . . . . . . . . . . . . . . . . . . . 93
2.44 Os_Restart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
2.45 Os_SetRestartPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
2.46 Os_TimingFaultDetected . . . . . . . . . . . . . . . . . . . . . . . . 99
2.47 ReleaseResource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
2.48 ResumeAllInterrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
2.49 ResumeOSInterrupts . . . . . . . . . . . . . . . . . . . . . . . . . . 105
2.50 Schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
2.51 SetAbsAlarm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
2.52 SetEvent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
2.53 SetRelAlarm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
2.54 SetScheduleTableAsync . . . . . . . . . . . . . . . . . . . . . . . . 115
2.55 ShutdownOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
2.56 StartOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
2.57 StartScheduleTableAbs . . . . . . . . . . . . . . . . . . . . . . . . . 121
2.58 StartScheduleTableRel . . . . . . . . . . . . . . . . . . . . . . . . . 123
2.59 StartScheduleTableSynchron . . . . . . . . . . . . . . . . . . . . 125
2.60 StopScheduleTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
2.61 SuspendAllInterrupts . . . . . . . . . . . . . . . . . . . . . . . . . . 129
2.62 SuspendOSInterrupts . . . . . . . . . . . . . . . . . . . . . . . . . . 131
2.63 SyncScheduleTable . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
2.64 TerminateApplication . . . . . . . . . . . . . . . . . . . . . . . . . . 136
2.65 TerminateTask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
2.66 WaitEvent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
4 Contents
3.18 Os_Cbk_TimeOverrunHook . . . . . . . . . . . . . . . . . . . . . . 170
3.19 PostTaskHook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
3.20 PreTaskHook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
3.21 ProtectionHook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
3.22 ShutdownHook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
3.23 StartupHook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Contents 5
4.39 TaskStateRefType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
4.40 TaskStateType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
4.41 TaskType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
4.42 TickRefType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
4.43 TickType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
4.44 TrustedFunctionIndexType . . . . . . . . . . . . . . . . . . . . . . 195
4.45 TrustedFunctionParameterRefType . . . . . . . . . . . . . . . . 195
4.46 boolean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
4.47 float32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
4.48 float64 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
4.49 sint16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
4.50 sint16_least . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
4.51 sint32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
4.52 sint32_least . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
4.53 sint8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
4.54 sint8_least . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
4.55 uint16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
4.56 uint16_least . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
4.57 uint32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
4.58 uint32_least . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
4.59 uint8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
4.60 uint8_least . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
6 Contents
5.23 OSSWTICKSPERSECOND . . . . . . . . . . . . . . . . . . . . . . . . 207
5.24 OSTICKDURATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
5.25 OSTICKDURATION_<CounterID> . . . . . . . . . . . . . . . . . . 207
5.26 OSTICKSPERBASE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
5.27 OSTICKSPERBASE_<CounterID> . . . . . . . . . . . . . . . . . . 208
5.28 OS_EXTENDED_STATUS . . . . . . . . . . . . . . . . . . . . . . . . 208
5.29 OS_MAIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
5.30 OS_NOAPPMODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
5.31 OS_NUM_ALARMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
5.32 OS_NUM_APPLICATIONS . . . . . . . . . . . . . . . . . . . . . . . . 209
5.33 OS_NUM_APPMODES . . . . . . . . . . . . . . . . . . . . . . . . . . 209
5.34 OS_NUM_COUNTERS . . . . . . . . . . . . . . . . . . . . . . . . . . 210
5.35 OS_NUM_EVENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
5.36 OS_NUM_ISRS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
5.37 OS_NUM_RESOURCES . . . . . . . . . . . . . . . . . . . . . . . . . . 210
5.38 OS_NUM_SCHEDULETABLES . . . . . . . . . . . . . . . . . . . . . 210
5.39 OS_NUM_TASKS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
5.40 OS_NUM_TRUSTED_FUNCTIONS . . . . . . . . . . . . . . . . . . 211
5.41 OS_REGSET_<RegisterSetID>_SIZE . . . . . . . . . . . . . . . . 211
5.42 OS_SCALABILITY_CLASS_1 . . . . . . . . . . . . . . . . . . . . . . 211
5.43 OS_SCALABILITY_CLASS_2 . . . . . . . . . . . . . . . . . . . . . . 211
5.44 OS_SCALABILITY_CLASS_3 . . . . . . . . . . . . . . . . . . . . . . 212
5.45 OS_SCALABILITY_CLASS_4 . . . . . . . . . . . . . . . . . . . . . . 212
5.46 OS_STACK_MONITORING . . . . . . . . . . . . . . . . . . . . . . . . 212
5.47 OS_STANDARD_STATUS . . . . . . . . . . . . . . . . . . . . . . . . 213
5.48 OS_TICKS2<Unit>_<CounterID>(ticks) . . . . . . . . . . . . . 213
5.49 OS_TIME_MONITORING . . . . . . . . . . . . . . . . . . . . . . . . . 214
5.50 TASK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Contents 7
6.17 Os_LogProfileStart . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
6.18 Os_LogTaskTracepoint . . . . . . . . . . . . . . . . . . . . . . . . . 247
6.19 Os_LogTaskTracepointData . . . . . . . . . . . . . . . . . . . . . . 249
6.20 Os_LogTaskTracepointValue . . . . . . . . . . . . . . . . . . . . . 251
6.21 Os_LogTracepoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
6.22 Os_LogTracepointData . . . . . . . . . . . . . . . . . . . . . . . . . 255
6.23 Os_LogTracepointValue . . . . . . . . . . . . . . . . . . . . . . . . 257
6.24 Os_SetTraceRepeat . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
6.25 Os_SetTriggerWindow . . . . . . . . . . . . . . . . . . . . . . . . . 260
6.26 Os_StartBurstingTrace . . . . . . . . . . . . . . . . . . . . . . . . . 262
6.27 Os_StartFreeRunningTrace . . . . . . . . . . . . . . . . . . . . . . 263
6.28 Os_StartTriggeringTrace . . . . . . . . . . . . . . . . . . . . . . . . 264
6.29 Os_StopTrace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
6.30 Os_TraceCommInit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
6.31 Os_TraceDumpAsync . . . . . . . . . . . . . . . . . . . . . . . . . . 268
6.32 Os_TriggerNow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
6.33 Os_TriggerOnActivation . . . . . . . . . . . . . . . . . . . . . . . . 270
6.34 Os_TriggerOnAdvanceCounter . . . . . . . . . . . . . . . . . . . 271
6.35 Os_TriggerOnAlarmExpiry . . . . . . . . . . . . . . . . . . . . . . . 272
6.36 Os_TriggerOnCat1ISRStart . . . . . . . . . . . . . . . . . . . . . . 273
6.37 Os_TriggerOnCat1ISRStop . . . . . . . . . . . . . . . . . . . . . . 274
6.38 Os_TriggerOnCat2ISRStart . . . . . . . . . . . . . . . . . . . . . . 275
6.39 Os_TriggerOnCat2ISRStop . . . . . . . . . . . . . . . . . . . . . . 276
6.40 Os_TriggerOnChain . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
6.41 Os_TriggerOnError . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
6.42 Os_TriggerOnGetResource . . . . . . . . . . . . . . . . . . . . . . 279
6.43 Os_TriggerOnIncrementCounter . . . . . . . . . . . . . . . . . . 280
6.44 Os_TriggerOnIntervalEnd . . . . . . . . . . . . . . . . . . . . . . . 281
6.45 Os_TriggerOnIntervalStart . . . . . . . . . . . . . . . . . . . . . . 282
6.46 Os_TriggerOnIntervalStop . . . . . . . . . . . . . . . . . . . . . . . 283
6.47 Os_TriggerOnReleaseResource . . . . . . . . . . . . . . . . . . . 284
6.48 Os_TriggerOnScheduleTableExpiry . . . . . . . . . . . . . . . . 285
6.49 Os_TriggerOnSetEvent . . . . . . . . . . . . . . . . . . . . . . . . . 286
6.50 Os_TriggerOnShutdown . . . . . . . . . . . . . . . . . . . . . . . . 287
6.51 Os_TriggerOnTaskStart . . . . . . . . . . . . . . . . . . . . . . . . . 288
6.52 Os_TriggerOnTaskStop . . . . . . . . . . . . . . . . . . . . . . . . . 289
6.53 Os_TriggerOnTaskTracepoint . . . . . . . . . . . . . . . . . . . . . 290
6.54 Os_TriggerOnTracepoint . . . . . . . . . . . . . . . . . . . . . . . . 291
6.55 Os_UploadTraceData . . . . . . . . . . . . . . . . . . . . . . . . . . 292
8 Contents
7 RTA-TRACE Callbacks 294
7.1 Guide to Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . 294
7.2 Os_Cbk_TraceCommDataReady . . . . . . . . . . . . . . . . . . . 295
7.3 Os_Cbk_TraceCommInitTarget . . . . . . . . . . . . . . . . . . . . 296
7.4 Os_Cbk_TraceCommTxByte . . . . . . . . . . . . . . . . . . . . . 297
7.5 Os_Cbk_TraceCommTxEnd . . . . . . . . . . . . . . . . . . . . . . 298
7.6 Os_Cbk_TraceCommTxReady . . . . . . . . . . . . . . . . . . . . 299
7.7 Os_Cbk_TraceCommTxStart . . . . . . . . . . . . . . . . . . . . . 300
Contents 9
11 Configuration Language 307
11.1 Configuration Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
11.2 Understanding AUTOSAR XML Configuration . . . . . . . . . 307
11.2.1 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
11.3 ECU Configuration Description . . . . . . . . . . . . . . . . . . . 309
11.4 RTA-OS3.x Configuration Language Extensions . . . . . . . . 311
11.4.1 Container: OsAppMode . . . . . . . . . . . . . . . . . 313
11.4.2 Container: OsRTATarget . . . . . . . . . . . . . . . . . 313
11.4.3 Container: OsCounter . . . . . . . . . . . . . . . . . . 314
11.4.4 Container: OsIsr . . . . . . . . . . . . . . . . . . . . . . 314
11.4.5 Container: OsOS . . . . . . . . . . . . . . . . . . . . . . 315
11.4.6 Container: OsRegSet . . . . . . . . . . . . . . . . . . . 316
11.4.7 Container: OsTask . . . . . . . . . . . . . . . . . . . . . 316
11.4.8 Container: OsTrace . . . . . . . . . . . . . . . . . . . . 316
11.5 Project Description Files . . . . . . . . . . . . . . . . . . . . . . . . 321
10 Contents
14 Compatibility and Migration 336
14.1 ETAS Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
14.2 API Call Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . 337
14.2.1 Tasksets . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
14.2.2 Time Monitoring . . . . . . . . . . . . . . . . . . . . . . 340
14.2.3 Schedules . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
14.2.4 OSEK COM . . . . . . . . . . . . . . . . . . . . . . . . . . 341
14.2.5 Behavior of StartOS() . . . . . . . . . . . . . . . . . 341
14.2.6 Behavior of ShutdownOS() . . . . . . . . . . . . . . . 341
14.2.7 Hardware Counter Driver . . . . . . . . . . . . . . . . 341
14.2.8 Forbidding of Zero for SetRelAlarm() . . . . . . . 341
14.2.9 Changes to Schedule Table API . . . . . . . . . . . . 342
14.2.10 Software Counter Driver . . . . . . . . . . . . . . . . 342
14.2.11 Stack Monitoring . . . . . . . . . . . . . . . . . . . . . . 342
14.2.12 Restarting the OS . . . . . . . . . . . . . . . . . . . . . 342
Contents 11
1 Introduction
This guide contains the complete technical reference for RTA-OS3.x. The con-
tent is arranged into two parts:
• Part 1 deals with the OS kernel, describing the API, types, macros, etc.
that are supported by RTA-OS3.x and common to all target hardware.
• Part 2 deals with the PC-based tooling provided with RTA-OS3.x. The com-
mand line interfaces, input and output file formats etc. that are common
to all target hardware are described.
For each supported target there is an Target/Compiler Port Guide which pro-
vides auxiliary details for port-specific OS features.
You should also be familiar with common use of the Microsoft Windows 2000,
Windows XP or Windows Vista operating systems, including installing soft-
ware, selecting menu items, clicking buttons, navigating files and folders.
12 Introduction
The “Open file” dialog box appears The names of program windows,
dialog boxes, fields, etc. are en-
closed in double quotes.
1.3 References
OSEK is a European automotive industry standards effort to produce open
systems interfaces for vehicle electronics. For details of the OSEK standards,
please refer to:
http://www.osek-vdx.org
http://www.autosar.org
Introduction 13
2 RTA-OS3.x API calls
Syntax
/* C function prototype for the API call */
ReturnValue NameOfAPICall(Parameter Type, ...)
Parameters
A list of parameters for each API call and their mode:
out The parameter is passed out of the API call by passing a reference
(pointer) to the parameter into the call.
inout The parameter is passed into the call and then (updated) and passed
out.
Return Values
Where API calls return a StatusType the values of the type returned and
an indication of the reason for the error/warning are listed. The build column
indicates whether the value is returned for both standard and extended status
builds or for extended status build only.
Description
A detailed description of the behavior of the API call.
Portability
The RTA-OS3.x API includes four classes of API calls:
OSEK OS calls are those specified by the OSEK OS standard. OSEK OS calls
are portable to other implementations of OSEK OS and are portable to
other implementations of AUTOSAR OS R3.x.
Example Code
A C code listing showing how to use the API calls
Calling Environment
The valid calling environment for the API call. A 3 indicates that a call can be
made in the indicated context. A 7 indicates that the call cannot be made in
the indicated context.
See Also
A list of related API calls.
Syntax
StatusType ActivateTask(
TaskType TaskID
)
Parameters
Return Values
The call returns values of type StatusType.
Description
If TaskID is in the suspended state then it is transferred into the ready state.
If TaskID is in either the ready or the running state and the total number of
queued activations is less than the task activation limit then the requested
activation is queued.
- if the caller is a non-preemptive task the rescheduling does not occur until
the caller terminates or makes a Schedule() call.
- if the caller is a preemptive task and TaskID is higher priority then reschedul-
ing will take place immediately.
Portability
Example
TASK(MyTask){
...
ActivateTask(YourTask);
...
}
Calling Environment
See Also
ChainTask
DeclareTask
GetTaskID
GetTaskState
TerminateTask
Syntax
StatusType CallAndProtectFunction(
TrustedFunctionIndexType FunctionIndex,
TrustedFunctionParameterRefType FunctionParams,
Os_TimeLimitType TimeLimit
)
Parameters
Return Values
The call returns values of type StatusType.
Description
This is exactly the same as CallTrustedFunction, but with the addition of a
Timing Protection execution limit and the ability to recover from a memory
protection violation.
If the function execution time reaches the specified limit, then Protection-
Hook gets called with Reason ’E_OS_PROTECTION_TIME’. Within Protection-
Hook you can choose to shutdown or kill the OS-Application. Alternatively if
you return PRO_TERMINATETASKISR then you merely terminate the remain-
ing execution of the function and CallAndProtectFunction will return with a
status of E_OS_PROTECTION_TIME.
Similarly resource and interrupt lock violations can cause termination with
’E_OS_PROTECTION_LOCKED’, and memory violations can cause termination
with ’E_OS_PROTECTION_MEMORY’ or ’E_OS_PROTECTION_EXCEPTION’.
Example
TASK(MyTask){
struct {
uint32 val1;
uint32 val2;
} data = {1U, 2U};
...
CallAndProtectFunction(Func3, &data, (0.001 *
OSSWTICKSPERSECOND)); /* Limit 1ms */
...
}
Calling Environment
See Also
CallTrustedFunction
Os_TimeLimitType
ProtectionHook
Syntax
StatusType CallTrustedFunction(
TrustedFunctionIndexType FunctionIndex,
TrustedFunctionParameterRefType FunctionParams
)
Parameters
Return Values
The call returns values of type StatusType.
Description
Call a function provided by an OS-application. The service is typically used
to allow a non-trusted OS-Application to call a function provided by a trusted
OS-Application. It is, however, equally possible to call a function provided by
an untrusted OS-Application.
When a function is called, it will always run with same access permissions
as the OS-Application to which it belongs. When called from a non-trusted
OS-Application this may mean that the call will trigger a mode switch and will
execute with all memory protection mechanisms disabled.
Example
TASK(MyTask){
struct {
uint32 val1;
uint32 val2;
} data = {1U, 2U};
...
CallTrustedFunction(Func1, (TrustedFunctionParameterRefType)0U);
CallTrustedFunction(Func2, &value);
CallTrustedFunction(Func3, &data);
...
}
Calling Environment
See Also
CallAndProtectFunction
Syntax
StatusType CancelAlarm(
AlarmType AlarmID
)
Parameters
Return Values
The call returns values of type StatusType.
Description
This call cancels (stops) the specified alarm.
Portability
Example
TASK(MyExtendedTask){
...
CancelAlarm(TimeOutAlarm);
...
}
See Also
CancelAlarm
DeclareAlarm
GetAlarm
GetAlarmBase
SetRelAlarm
Syntax
StatusType ChainTask(
TaskType TaskID
)
Parameters
Return Values
The call returns values of type StatusType.
Description
This service causes the termination of the calling task followed by the activa-
tion of TaskID. A successful call of ChainTask() does not return to the calling
context.
Standard or linked resources held by the calling task are also released auto-
matically and this is reported as an error condition in extended status.
A task can chain itself without affecting the queued activation count.
Portability
Example
TASK(MyTask){
...
ChainTask(YourTask);
/* Any code here will not execute if the call is successful */
...
}
Calling Environment
See Also
ActivateTask
DeclareTask
GetTaskID
GetTaskState
TerminateTask
Syntax
AccessType CheckISRMemoryAccess(
ISRType ISRID,
MemoryStartAddressType Address,
MemorySizeType Size
)
Parameters
Return Values
The call returns values of type AccessType.
Description
If ISRID represents a valid ISR, then CheckISRMemoryAccess() determines
whether the inclusive range of memory addresses from Address to (Ad-
dress+Size) is:
- readable by ISRID
- writeable by ISRID
- executable by ISRID
If a memory access condition is not valid for the whole specified memory
area, then CheckISRMemoryAccess() reports no access for the type. That
is, if any address in the range is not writeable, CheckTaskMemoryAccess()
reports the range is not writeable.
Portability
Example
ISR(MyISR){
if (OSMEMORY_IS_WRITEABLE(CheckISRMemoryAccess(MyISR, &datum,
sizeof(datum)))) {
datum = ...
}
}
Calling Environment
See Also
CheckTaskMemoryAccess
Os_Cbk_CheckMemoryAccess
Syntax
ObjectAccessType CheckObjectAccess(
ApplicationType ApplID,
ObjectTypeType ObjectType,
Os_AnyType Object
)
Parameters
Return Values
The call returns values of type ObjectAccessType.
Description
The call returns ACCESS only if AppID can access the specified OS Object.
NO_ACCESS is returned otherwise.
Portability
Calling Environment
See Also
CheckObjectOwnership
Syntax
ApplicationType CheckObjectOwnership(
ObjectTypeType ObjectType,
Os_AnyType Object
)
Parameters
Return Values
The call returns values of type ApplicationType.
Description
The call returns the identifier of the OS-Application that owns the Object, or
INVALID_OSAPPLICATION if the ObjectType and Object do not match an object
that is owned by an OS-Application.
Portability
Example
ApplicationType OwningApplication =
CheckObjectOwnership(OBJECT_TASK, Task1);
See Also
CheckObjectAccess
Syntax
AccessType CheckTaskMemoryAccess(
TaskType TaskID,
MemoryStartAddressType Address,
MemorySizeType Size
)
Parameters
Return Values
The call returns values of type AccessType.
Description
If TaskID represents a valid task, then CheckTaskMemoryAccess() determines
whether the inclusive range of memory addresses from Address to (Ad-
dress+Size) is:
- readable by TaskID
- writeable by TaskID
- executable by TaskID
If a memory access condition is not valid for the whole specified memory
area, then CheckTaskMemoryAccess() reports no access for the type. That
is, if any address in the range is not writeable, CheckTaskMemoryAccess()
reports the range is not writeable.
Portability
Example
TASK(MyTask){
if (OSMEMORY_IS_WRITEABLE(CheckTaskMemoryAccess(MyTask, &datum,
sizeof(datum)))) {
datum = ...
}
}
Calling Environment
See Also
CheckISRMemoryAccess
OSMEMORY_IS_EXECUTABLE
OSMEMORY_IS_READABLE
OSMEMORY_IS_STACKSPACE
OSMEMORY_IS_WRITEABLE
Os_Cbk_CheckMemoryAccess
Os_Cbk_SetMemoryAccess
Syntax
StatusType ClearEvent(
EventMaskType Mask
)
Parameters
Return Values
The call returns values of type StatusType.
Description
The events of the extended task calling ClearEvent are cleared according to
the event mask Mask.
Any events that are not set in the event mask remain unchanged.
Portability
Example
TASK(MyExtendedTask){
EventMaskType WhatHappened;
while (WaitEvent(Event1 | Event2 | Event3) == E_OK ) {
GetEvent(MyExtendedTask, &WhatHappened);
if (WhatHappened & Event1) {
ClearEvent(Event1);
/* Take action on Event1 */
...
Calling Environment
See Also
DeclareEvent
GetEvent
SetEvent
WaitEvent
Syntax
void DisableAllInterrupts(void)
Description
This call is intended to start a (short) critical section of the code. This critical
section must be finished by calling EnableAllInterrupts(). No API calls are
allowed within the critical section.
The call does not support nesting. If nesting is needed for critical sections,
e.g. for libraries, then SuspendAllInterrupts()/ResumeAllInterrupts() should
be used.
Portability
Example
TASK(MyTask){
...
DisableAllInterrupts();
/* Critical section */
/* No RTA-OS API calls allowed */
EnableAllInterrupts();
...
}
Calling Environment
See Also
EnableAllInterrupts
ResumeAllInterrupts
ResumeOSInterrupts
SuspendAllInterrupts
SuspendOSInterrupts
Syntax
void EnableAllInterrupts(void)
Description
This API call marks the end of a critical section that is protected from any
maskable interrupt occurring. The critical section must have been entered
using the DisableAllInterrupts() call.
This call restores the state of the interrupt mask saved by DisableAllInter-
rupts().
Portability
Example
TASK(MyTask){
...
DisableAllInterrupts();
/* Critical section */
/* No RTA-OS API calls allowed */
EnableAllInterrupts();
...
}
Calling Environment
See Also
DisableAllInterrupts
ResumeAllInterrupts
ResumeOSInterrupts
SuspendAllInterrupts
SuspendOSInterrupts
Syntax
AppModeType GetActiveApplicationMode(void)
Return Values
The call returns values of type AppModeType.
Description
The call returns the currently active application mode (i.e. the value of
parameter that was passed to StartOS()). The call can be used to write
application-mode dependent code.
Portability
Example
TASK(MyTask){
...
if (GetActiveApplicationMode() == DiagnosticsMode) {
/* Send diagnostic message */
}
...
}
Calling Environment
See Also
StartOS
Syntax
StatusType GetAlarm(
AlarmType AlarmID,
TickRefType Tick
)
Parameters
Return Values
The call returns values of type StatusType.
Description
Returns the relative number of ticks from the point at which the call was made
before the alarm AlarmID is due to expire.
Note that between making this call and evaluating the out parameter Tick
the task may have been preempted and the alarm may have already expired.
Exercise caution when making program decisions based on the value of Tick.
Example
TASK(MyTask){
TickType TicksToExpiry;
...
GetAlarm(MyAlarm, &TicksToExpiry);
...
}
Calling Environment
See Also
CancelAlarm
DeclareAlarm
GetAlarmBase
SetAbsAlarm
SetRelAlarm
Syntax
StatusType GetAlarmBase(
AlarmType AlarmID,
AlarmBaseRefType Info
)
Parameters
Return Values
The call returns values of type StatusType.
Description
GetAlarmBase() reads the alarm base characteristics. These are the static
properties of the counter with which AlarmID is associated.
The out parameter Info refers to a structure in which the information of data
type AlarmBaseType gets stored.
Example
TASK(MyTask){
AlarmBaseType Info;
TickType maxallowedvalue;
TickType ticksperbase;
TickType mincycle;
GetAlarmBase(MyAlarm, &Info);
maxallowedvalue = Info.maxallowedvalue;
ticksperbase = Info.ticksperbase;
mincycle = Info.mincycle;
}
Calling Environment
See Also
CancelAlarm
DeclareAlarm
GetAlarm
SetAbsAlarm
SetRelAlarm
Syntax
ApplicationType GetApplicationID(void)
Return Values
The call returns values of type ApplicationType.
Description
The call returns the currently running OS-Application. This is the OS-
Application that owns the currently running task or Category 2 ISR.
Portability
Example
if (GetApplicationID() == App1) {
...
}
Calling Environment
See Also
GetISRID
GetTaskID
Syntax
StatusType GetCounterValue(
CounterType CounterID,
TickRefType Value
)
Parameters
Return Values
The call returns values of type StatusType.
Description
Returns the current value of the specified counter CounterID in Value.
The Operating System ensures that the lowest value is zero and consecutive
reads return an increasing count value until the counter wraps.
Example
Task(MyTask){
TickType Value;
...
GetCounterValue(MyCounter,&Value);
...
}
Calling Environment
See Also
GetElapsedCounterValue
IncrementCounter
Os_AdvanceCounter
Os_AdvanceCounter_<CounterID>
Os_IncrementCounter_<CounterID>
Syntax
StatusType GetElapsedCounterValue(
CounterType CounterID,
TickRefType Value,
TickRefType ElapsedValue
)
Parameters
Return Values
The call returns values of type StatusType.
Value is updated with the current value of the counter when the call returns.
Note that the call can only return a value up to maxallowedvalue ticks in
length.
If the counter has ticked more than maxallowedvalue ticks since Value then
ElapsedValue will be Value modulo maxallowedvalue.
Portability
Example
Task(MyTask){
TickType Value;
TickType ElapsedValue;
...
GetCounterValue(MyCounterID,&Value);
/* Value => current count */
...
GetElapsedCounterValue(MyCounter,&Value,&ElapsedValue);
/* ElapsedValue => ticks since original Value, Value => current
count */
...
}
Calling Environment
See Also
GetCounterValue
Syntax
StatusType GetEvent(
TaskType TaskID,
EventMaskRefType Event
)
Parameters
Return Values
The call returns values of type StatusType.
Description
This call returns all events that are set for the extended task TaskID.
Note that all set events are returned, regardless of which events the task may
have been waiting for.
Example
TASK(MyExtendedTask){
EventMaskType WhatHappened;
while (WaitEvent(Event1 | Event2 | Event3) == E_OK ) {
GetEvent(MyExtendedTask, &WhatHappened);
if(WhatHappened & Event1) {
ClearEvent(Event1);
/* Take action on Event1 */
...
} else if (WhatHappened & (Event2 | Event3) {
ClearEvent(Event2 | Event3);
/* Take action on Event2 or Event3 */
...
}
}
}
Calling Environment
See Also
ClearEvent
DeclareEvent
SetEvent
WaitEvent
Syntax
ISRType GetISRID(void)
Return Values
The call returns values of type ISRType.
Description
The call returns the ID of the currently running Category2 ISR or INVALID_ISR
if no ISR is running. The main use of the call is to identify which ISR is running
in hook functions.
Portability
Example
FUNC(void, OS_APPL_CODE) ErrorHook(StatusType Error){
ISRType ISRInError;
TaskType TaskInError;
ISRInError = GetISRID();
if (ISRInError != INVALID_ISR) {
/* Must be an ISR in error */
} else {
/* Maybe it’s a task in error */
GetTaskID(&TaskInError);
...
}
...
}
Calling Environment
Syntax
StatusType GetResource(
ResourceType ResID
)
Parameters
Return Values
The call returns values of type StatusType.
Description
This call enters a named critical section (the resource), protecting the code
inside the critical section against concurrent access by any other tasks and
ISRs that are configured to be able to access the resource.
Nested resource occupation is allowed, but only where the inner critical
sections are completely executed within the surrounding critical section as
shown in the example.
Nested occupation of the same resource is not allowed, although you can use
linked resources to achieve this effect.
A system where Category 2 ISRs can lock a resource has slightly higher run-
time overheads than one where only Tasks lock resources.
Portability
Example
TASK(MyTask){
...
GetResource(Outer);
/* Outer Critical Section */
...
GetResource(Inner);
/* Inner Critical Section */
ReleaseResource(Inner);
...
ReleaseResource(Outer);
...
}
Calling Environment
See Also
DeclareResource
ReleaseResource
Syntax
StatusType GetScheduleTableStatus(
ScheduleTableType ScheduleTableID,
ScheduleTableStatusRefType ScheduleStatus
)
Parameters
Return Values
The call returns values of type StatusType.
Description
This call returns the status of the ScheduleTableID.
Portability
GetScheduleTableStatus(MyScheduleTable, &Status);
if (Status != SCHEDULETABLE_RUNNING){
StartScheduleTableAbs(MyScheduleTable,42);
}
...
}
Calling Environment
See Also
DeclareScheduleTable
NextScheduleTable
SetScheduleTableAsync
StartScheduleTableAbs
StartScheduleTableRel
StartScheduleTableSynchron
StopScheduleTable
SyncScheduleTable
Syntax
StatusType GetTaskID(
TaskRefType TaskID
)
Parameters
Return Values
The call returns values of type StatusType.
Description
The call returns a reference to the currently running Task. If the call is made
from a task, then it will return the identifier of that task. If the call is made
from an ISR, then it will return the identifier of the task that was running
when the interrupt occurred. The main use of the call is to identify which task
is running in hook functions.
Portability
Calling Environment
See Also
DeclareTask
GetISRID
GetTaskID
GetTaskState
TerminateTask
Syntax
StatusType GetTaskState(
TaskType TaskID,
TaskStateRefType State
)
Parameters
Return Values
The call returns values of type StatusType.
Description
The call returns the state of the task at the point GetTaskState() was called.
The main use of this API is to check that an extended task is not in the sus-
pended state before setting an event.
Portability
Example
TASK(MyTask){
...
TaskStateType CurrentState;
...
GetTaskState(YourTask, &CurrentState);
switch (CurrrentState) {
case SUSPENDED:
/* YourTask is suspended */
case READY:
/* YourTask is ready to run */
case WAITING:
/* YourTask is waiting (for an event) */
case RUNNING:
/* YourTask is running. Not possible as MyTask must be
running to make the call */
}
...
}
Calling Environment
See Also
DeclareTask
GetTaskID
GetTaskState
TerminateTask
Syntax
StatusType IncrementCounter(
CounterType CounterID
)
Parameters
Return Values
The call returns values of type StatusType.
Description
This call increments (adds one to) CounterID. CounterID must be a software
counter.
If any alarms on the counter are triggered by the increment then the alarm
actions will be executed before the call returns.
Note that if an error occurs during the expiry of an alarm (for example, a task
activation raises E_OS_LIMIT), the error hook(s) are called for each error that
occurs.
Portability
Calling Environment
See Also
Os_AdvanceCounter
Os_AdvanceCounter_<CounterID>
Os_IncrementCounter_<CounterID>
Syntax
StatusType NextScheduleTable(
ScheduleTableType ScheduleTableID_From,
ScheduleTableType ScheduleTableID_To
)
Parameters
Return Values
The call returns values of type StatusType.
Description
This call starts the processing of schedule table of ScheduleTableID_To
ScheduleTableID_From.FinalDelay ticks after the Final Expiry Point on Sched-
uleTableID_From has been processed.
If either schedule table is not valid or they are driven by different counters
then the states of both tables remain unchanged.
Portability
Example
TASK(MyTask){
/* Stop MyScheduleTable at the end and start
YourScheduleTable */
NextScheduleTableAbs(MyScheduleTable, YourScheduleTable);
...
}
Calling Environment
See Also
DeclareScheduleTable
GetScheduleTableStatus
SetScheduleTableAsync
StartScheduleTableAbs
StartScheduleTableRel
StartScheduleTableSynchron
StopScheduleTable
SyncScheduleTable
Syntax
StatusType Os_AdvanceCounter(
CounterType CounterID
)
Parameters
Return Values
The call returns values of type StatusType.
Description
This call tells the OS that the counter value has matched the value previously
set via the Os_Cbk_Set_<CounterID> callback.
The OS will then process any alarm or expiry point actions that are due. It will
then either set a new match value (via Os_Cbk_Set_<CounterID>) or cancel
counter matching (via Os_Cbk_Cancel_<CounterID>).
Note that it is possible for the new counter match value to be reached before
leaving any interrupt that is being used to drive the counter. It is important
that this occurrence is not missed because otherwise the counter will not
be awoken again until a complete wrap of the underlying hardware counter
value has occurred.
Portability
Example
/* For systems where the interrupt will be re-entered
automatically if the match occurs before leaving the ISR: */
ISR(SimpleCounterDriver){
Os_AdvanceCounter(MyHWCounter);
}
/* For systems where the software can force the interrupt to get
re-entered if the match occurs before leaving the ISR: */
ISR(RetriggeringCounterDriver){
Os_ScheduleTableStatusType CurrentState;
Os_AdvanceCounter(MyHWCounter);
Os_Cbk_State_MyHWCounter(&CurrentState);
if (CurrentState.Running && CurrentState.Pending) {
/* Retrigger this interrupt */
}
}
/* For systems where the software has to loop if the match occurs
before leaving the ISR: */
ISR(LoopingCounterDriver){
Os_ScheduleTableStatusType CurrentState;
do {
Os_AdvanceCounter(MyHWCounter);
Os_Cbk_State_MyHWCounter(&CurrentState);
} while (CurrentState.Running && CurrentState.Pending);
}
Calling Environment
IncrementCounter
Os_AdvanceCounter_<CounterID>
Os_Cbk_Cancel_<CounterID>
Os_Cbk_Set_<CounterID>
Os_Cbk_State_<CounterID>
Os_IncrementCounter_<CounterID>
Syntax
StatusType Os_AdvanceCounter_CounterID(void)
Return Values
The call returns values of type StatusType.
Description
This call has the same behavior as Os_AdvanceCounter(CounterID) but is cus-
tomized for a specific counter. This makes the call faster and more suitable
for use in interrupt handlers.
Portability
Example
/* For systems where the interrupt will be re-entered
automatically if the match occurs before leaving the ISR: */
ISR(SimpleCounterDriver){
Os_AdvanceCounter_MyHWCounter();
}
/* For systems where the software can force the interrupt to get
re-entered if the match occurs before leaving the ISR: */
ISR(RetriggeringCounterDriver){
Os_ScheduleTableStatusType CurrentState;
Os_AdvanceCounter_MyHWCounter();
Os_Cbk_State_MyHWCounter(&CurrentState);
if (CurrentState.Running && CurrentState.Pending) {
/* Retrigger this interrupt */
}
}
/* For systems where the software has to loop if the match occurs
before leaving the ISR: */
ISR(LoopingCounterDriver){
Os_ScheduleTableStatusType CurrentState;
do {
Os_AdvanceCounter_MyHWCounter();
Os_Cbk_State_MyHWCounter(&CurrentState);
} while (CurrentState.Running && CurrentState.Pending);
Calling Environment
See Also
IncrementCounter
Os_AdvanceCounter
Os_Cbk_Cancel_<CounterID>
Os_Cbk_Set_<CounterID>
Os_Cbk_State_<CounterID>
Os_IncrementCounter_<CounterID>
Syntax
Os_StopwatchTickType Os_GetExecutionTime(void)
Return Values
The call returns values of type Os_StopwatchTickType.
Description
Returns the net execution time consumed (i.e. excluding all preemptions)
since the start of the Task or ISR.
Any value read in PostTaskHook() is valid, but it will be greater than the value
that is used to determine a task’s maximum execution time.
If the value overflows, then the returned value will be the wrapped value.
Time monitoring must be enabled for this API to give meaningful results. It
returns zero if time monitoring is not enabled.
Portability
Example
TASK(MyTask){
Os_StopwatchTickType Start, Finish, Used, APICallCorrection;
Start = GetExecutionTime();
Finish = GetExecutionTime();
APICallCorrection = Finish - Start; /* Get time for
GetExecutionTime() call itself. */
Start = GetExecutionTime();
Call3rdPartyLibraryFunction(); /* Measure 3rd Party
Library Code Execution Time */
Finish = GetExecutionTime();
Used = Finish - Start - APICallCorrection; /* Calculate the
amount of time used. */
}
See Also
Os_GetISRMaxExecutionTime
Os_GetTaskMaxExecutionTime
Os_ResetISRMaxExecutionTime
Os_ResetTaskMaxExecutionTime
Syntax
Os_StopwatchTickType Os_GetISRMaxExecutionTime(
ISRType ISRID
)
Parameters
Return Values
The call returns values of type Os_StopwatchTickType.
Description
Returns the maximum observed execution time for the Category 2 ISR iden-
tified by ISRID.
This maximum value is over all complete invocations of the Category 2 ISR
that have completed since the previous call to ResetISRMaxExecutionTime()
for that Category 2 ISR or to StartOS().
Portability
Example
TASK(LoggingTask){
Os_StopwatchTickType ExecutionTimes[MAXISRS];
...
ExecutionTimes[0] = GetISRMaxExecutionTime(ISR1);
ExecutionTimes[1] = GetISRMaxExecutionTime(ISR2);
...
}
See Also
Os_GetExecutionTime
Os_GetTaskMaxExecutionTime
Os_ResetISRMaxExecutionTime
Os_ResetTaskMaxExecutionTime
Syntax
Os_StackSizeType Os_GetISRMaxStackUsage(
ISRType ISRID
)
Parameters
Return Values
The call returns values of type Os_StackSizeType.
Description
Returns the maximum observed stack usage for the Category 2 ISR identified
by ISRID.
This maximum value is over all invocations of the Category 2 ISR since the
previous call to ResetISRMaxStackUsage() for that Category 2 ISR or to Star-
tOS().
Portability
Example
TASK(LoggingTask){
Os_StackSizeType StackUsages[MAXISRS];
...
StackUsages[0] = GetISRMaxStackUsage(ISR1);
StackUsages[1] = GetISRMaxStackUsage(ISR2);
...
}
See Also
Os_GetStackUsage
Os_GetTaskMaxStackUsage
Os_ResetISRMaxStackUsage
Os_ResetTaskMaxStackUsage
Syntax
Os_StackSizeType Os_GetStackSize(
Os_StackValueType Base,
Os_StackValueType Sample
)
Parameters
Return Values
The call returns values of type Os_StackSizeType.
Description
Returns the difference between 2 Os_StackValueType values. To obtain a cor-
rect value, it is important that ’Base’ represents an instant when the stack
size was smaller than (or the same as) the point at which ’Sample’ was mea-
sured.
Portability
Example
Os_StackValueType start_position;
Os_StackValueType end_position;
Os_StackSizeType stack_size;
TASK(MyTask){
start_position = Os_GetStackValue();
nested_call();
stack_size = Os_GetStackSize(start_position, end_position);
}
void nested_call(void) {
end_position = Os_GetStackValue();
}
See Also
Os_GetStackUsage
Os_GetStackValue
Syntax
Os_StackSizeType Os_GetStackUsage(void)
Return Values
The call returns values of type Os_StackSizeType.
Description
Returns the amount of stack used by the calling Task or ISR at the point of the
call.
The value is measured from the point at which the OS kernel starts to run the
Task or ISR, and it includes overheads within the kernel so that the values re-
turned can be used directly in the configuration of the stack allocation budget
for a Task or ISR.
Calling this API has the side-effect of updating the recorded maximum stack
usage for the calling Task or ISR (where necessary).
If the Task/ISR has a stack allocation budget, then a stack overrun may be
reported before this API returns.
Portability
Example
TASK(MyTask){
Os_StackSizeType stack_size;
stack_size = Os_GetStackUsage();
nested_call();
}
void nested_call(void) {
Os_GetStackUsage(); /* Identifies a possible max stack usage
location */
}
See Also
Os_Cbk_StackOverrunHook
Os_GetISRMaxStackUsage
Os_GetTaskMaxStackUsage
Os_ResetISRMaxStackUsage
Os_ResetTaskMaxStackUsage
Syntax
Os_StackValueType Os_GetStackValue(void)
Return Values
The call returns values of type Os_StackValueType.
Description
Returns the current position of the stack pointer (or pointers).
Portability
Example
Os_StackValueType start_position;
Os_StackValueType end_position;
Os_StackSizeType stack_size;
TASK(MyTask){
start_position = Os_GetStackValue();
nested_call();
stack_size = Os_GetStackSize(start_position, end_position);
}
void nested_call(void) {
end_position = Os_GetStackValue();
}
Calling Environment
See Also
Os_GetStackSize
Os_GetStackUsage
Syntax
Os_StopwatchTickType Os_GetTaskMaxExecutionTime(
TaskType TaskID
)
Parameters
Return Values
The call returns values of type Os_StopwatchTickType.
Description
Returns the maximum observed execution time for TaskID.
This maximum value is over all complete invocations of TaskID that have
completed since the previous call to ResetTaskMaxExecutionTime() for TaskID
or to StartOS().
Portability
Example
TASK(LoggingTask){
Os_StopwatchTickType ExecutionTimes[MAXTASKS];
...
ExecutionTimes[0] = GetTaskMaxExecutionTime(Task1);
ExecutionTimes[1] = GetTaskMaxExecutionTime(Task2);
ExecutionTimes[2] = GetTaskMaxExecutionTime(Task3);
ExecutionTimes[3] = GetTaskMaxExecutionTime(Task4);
...
}
See Also
Os_GetExecutionTime
Os_GetISRMaxExecutionTime
Os_ResetISRMaxExecutionTime
Os_ResetTaskMaxExecutionTime
Syntax
Os_StackSizeType Os_GetTaskMaxStackUsage(
TaskType TaskID
)
Parameters
Return Values
The call returns values of type Os_StackSizeType.
Description
Returns the maximum observed stack usage for TaskID.
This maximum value is over all invocations of TaskID since the previous call
to ResetTaskMaxStackUsage() for TaskID or to StartOS().
Portability
Example
TASK(LoggingTask){
Os_StackSizeType StackUsages[MAXTASKS];
...
StackUsages[0] = GetTaskMaxStackUsage(Task1);
StackUsages[1] = GetTaskMaxStackUsage(Task2);
StackUsages[2] = GetTaskMaxStackUsage(Task3);
StackUsages[3] = GetTaskMaxStackUsage(Task4);
...
}
See Also
Os_GetISRMaxStackUsage
Os_GetStackUsage
Os_ResetISRMaxStackUsage
Os_ResetTaskMaxStackUsage
Syntax
void Os_GetVersionInfo(
Std_VersionInfoType *versioninfo
)
Parameters
Description
The content of the structure ’Std_VersionInfoType’ is defined in Std_Types.h
Portability
Example
Std_VersionInfoType ver;
Os_GetVersionInfo(&ver);
Calling Environment
See Also
None.
Syntax
StatusType IncrementCounter_<CounterID>(void)
Return Values
The call returns values of type StatusType.
Description
This call has the same behavior as IncrementCounter(CounterID) but is cus-
tomized for a named counter. This makes the call faster and more suitable
for use in interrupt handlers.
Portability
Example
ISR(MillisecondTimerInterrupt){
...
Os_IncrementCounter_MillisecondCounter();
...
}
Calling Environment
See Also
IncrementCounter
Os_AdvanceCounter
Os_AdvanceCounter_<CounterID>
Syntax
StatusType Os_ResetISRMaxExecutionTime(
ISRType ISRID
)
Parameters
Return Values
The call returns values of type StatusType.
Description
Reset the maximum observed execution time for the Category 2 ISR identified
by ISRID to zero.
Portability
Example
TASK(ProfilingTask){
Os_StopwatchTickType ExecutionTimeLog[SAMPLES];
...
ExecutionTimeLog[index++] = Os_GetISRMaxExecutionTime(ISR1);
Os_ResetISRMaxExecutionTime(ISR1);
...
}
See Also
Os_GetExecutionTime
Os_GetISRMaxExecutionTime
Os_GetTaskMaxExecutionTime
Os_ResetTaskMaxExecutionTime
Syntax
StatusType Os_ResetISRMaxStackUsage(
ISRType ISRID
)
Parameters
Return Values
The call returns values of type StatusType.
Description
Reset the maximum observed stack usage for ISRID to zero.
Portability
Example
TASK(ProfilingTask){
Os_StackSizeType StackUsageLog[SAMPLES];
...
StackUsageLog[index++] = Os_GetISRMaxStackUsage(ISR1);
Os_ResetISRMaxStackUsage(ISR1);
...
}
See Also
Os_GetISRMaxStackUsage
Os_GetStackUsage
Os_GetTaskMaxStackUsage
Os_ResetTaskMaxStackUsage
Syntax
StatusType Os_ResetTaskMaxExecutionTime(
TaskType TaskID
)
Parameters
Return Values
The call returns values of type StatusType.
Description
Reset the maximum observed execution time for TaskID to zero.
Portability
Example
TASK(ProfilingTask){
Os_StopwatchTickType ExecutionTimeLog[SAMPLES];
...
ExecutionTimeLog[index++] = Os_GetTaskMaxExecutionTime(Task1);
Os_ResetTaskMaxExecutionTime(Task1);
...
}
See Also
Os_GetExecutionTime
Os_GetISRMaxExecutionTime
Os_GetTaskMaxExecutionTime
Os_ResetISRMaxExecutionTime
Syntax
StatusType Os_ResetTaskMaxStackUsage(
TaskType TaskID
)
Parameters
Return Values
The call returns values of type StatusType.
Description
Reset the maximum observed stack usage for TaskID to zero.
Portability
Example
TASK(ProfilingTask){
Os_StackSizeType StackUsageLog[SAMPLES];
...
StackUsageLog[index++] = Os_GetTaskMaxStackUsage(Task1);
Os_ResetTaskMaxStackUsage(Task1);
...
}
See Also
Os_GetISRMaxStackUsage
Os_GetStackUsage
Os_GetTaskMaxStackUsage
Os_ResetISRMaxStackUsage
Syntax
StatusType Os_Restart(void)
Return Values
The call returns values of type StatusType.
Description
The call re-initializes any necessary context and branches to the restart point
set by Os_SetRestartPoint. The call does not return to the calling context.
The restart point must occur before a call to StartOS(), so that all OS re-
initialization re-occurs with the subsequent call to StartOS().
Portability
Example
FUNC(void, OS_APPL_CODE) ShutdownHook(StatusType Error){
...
Os_Restart();
...
}
Calling Environment
Os_SetRestartPoint
ShutdownOS
StartOS
Syntax
StatusType Os_SetRestartPoint(void)
Return Values
The call returns values of type StatusType.
Description
The call marks the location from which the code should resume following a
call to Os_Restart(). The location must be outside of OS control, i.e. at a point
before StartOS() was called. Making the call when a restart point is already
sets the restart point to the new location.
Portability
Example
OS_MAIN() {
...
Os_SetRestartPoint();
...
StartOS(OSDEFAULTAPPMODE);
Calling Environment
Os_Restart
ShutdownOS
StartOS
Syntax
void Os_TimingFaultDetected(void)
Description
When timing protection is configured and a timing interrupt is being used to
enforce time limits, the timing interrupt must call this API whenever it runs.
The timing interrupt must run whenever the time limit that was set by the
most recent call to Os_Cbk_SetTimeLimit() has been reached - unless a sub-
sequent call to Os_Cbk_SuspendTimeLimit() has occurred to cancel it.
The timing interrupt must be a Category 1 ISR, and it should have priority
higher than the highest Category 2 ISR. It is recommended that no other
Category 1 ISRs are used. If you must have some, you should ensure that the
timing interrupt cannot preempt them.
Portability
Example
CAT1_ISR(timing_interrupt) {
/* Reset pending interrupt flags here if needed */
Os_TimingFaultDetected();
}
Calling Environment
Os_Cbk_SetTimeLimit
Os_Cbk_SuspendTimeLimit
ProtectionHook
Syntax
StatusType ReleaseResource(
ResourceType ResID
)
Parameters
Return Values
The call returns values of type StatusType.
Description
ReleaseResource is the counterpart of GetResource and serves to quit a crit-
ical section in the code.
Portability
Example
TASK(MyTask){
...
GetResource(Outer);
/* Outer Critical Section */
...
GetResource(Inner);
Calling Environment
See Also
DeclareResource
GetResource
Syntax
void ResumeAllInterrupts(void)
Description
This API call marks the end of a critical section that is protected from any
maskable interrupt occurring. The critical section must have been entered
using the SuspendAllInterrupts() call.
Portability
Example
TASK(MyTask){
...
SuspendAllInterrupts():
/* Critical Section 1 */
FunctionWithNestedCriticalSection();
ResumeAllInterrupts():
...
}
void FunctionWithNestedCriticalSection(void) {
...
SuspendAllInterrupts():
/* Critical Section 2 */
ResumeAllInterrupts():
...
}
See Also
DisableAllInterrupts
EnableAllInterrupts
ResumeOSInterrupts
SuspendAllInterrupts
SuspendOSInterrupts
Syntax
void ResumeOSInterrupts(void)
Description
This API call marks the end of a critical section that is protected from any
Category 2 (OS level) interrupt occurring. The critical section must have been
entered using the SuspendOSInterrupts() call.
Portability
Example
TASK(MyTask){
...
SuspendOSInterrupts():
/* Longer Critical Section */
SuspendAllInterrupts();
/* Shorter Critical Section */
ResumeAllInterrupts();
ResumeOSInterrupts():
...
}
See Also
DisableAllInterrupts
EnableAllInterrupts
ResumeAllInterrupts
SuspendAllInterrupts
SuspendOSInterrupts
Syntax
StatusType Schedule(void)
Return Values
The call returns values of type StatusType.
Description
The call allows a non-preemptive task or a task/ISR that uses an internal re-
source to offer a preemption point.
1. The calling task is non-preemptive and a higher priority task has been
activated while the calling task was in the running state.
This service has no influence on preemptive tasks or ISRs that do not use
internal resources.
Note that allowing ISRs to share internal resources is an RTA-OS specific fea-
ture.
Portability
Calling Environment
See Also
DeclareTask
GetTaskID
GetTaskState
TerminateTask
Syntax
StatusType SetAbsAlarm(
AlarmType AlarmID,
TickType start,
TickType cycle
)
Parameters
Return Values
The call returns values of type StatusType.
Description
This call starts an alarm running and sets the match value with the associated
counter that triggers the alarm.
If cycle is equal to zero then the alarm will be triggered once only. If cycle is
nonzero then the alarm will be triggered every cycle ticks after start.
You must cancel an alarm if it is running before you can restart it with different
values.
Note that if the value of start is less than or equal to the current counter value
then AlarmID will not be triggered until a full wrap of the underlying counter.
Portability
Example
TASK(MyTask){
...
/* SingleShotAlarm at tick 42 */
SetAbsAlarm(SingleShotAlarm, 42, 0);
...
/* PeriodicAlarm at 10, 60, 110, 160,... */
SetAbsAlarm(PeriodicAlarm, 10, 50);
...
}
Calling Environment
See Also
CancelAlarm
DeclareAlarm
GetAlarm
GetAlarmBase
SetRelAlarm
Syntax
StatusType SetEvent(
TaskType TaskID,
EventMaskType Mask
)
Parameters
Return Values
The call returns values of type StatusType.
Description
This API call sets events for task TaskID according to Mask.
Events cannot be set for extended tasks that are in the suspended state.
In extended status this results in the error E_OS_STATE. In standard status,
setting an event for a suspended task has no effect.
Example
TASK(MyTask) {
...
/* Set a single event */
SetEvent(MyExtendedTask, Event1);
...
/* Set multiple events */
SetEvent(MyOtherExtendedTask, Event1 | Event2 | Event3);
...
}
Calling Environment
See Also
ClearEvent
DeclareEvent
SetEvent
WaitEvent
Syntax
StatusType SetRelAlarm(
AlarmType AlarmID,
TickType increment,
TickType cycle
)
Parameters
Return Values
The call returns values of type StatusType.
Description
This call starts an alarm running and sets the match value with the associated
counter that triggers the alarm. The match value is equal to the current
counter value plus the increment.
When the alarm expires, the statically configured action (activate a task / set
an event / run an alarm callback / increment a counter) occurs.
You must cancel an alarm if it is running before you can restart it with different
values.
Care must be taken when the value of increment is small because the out-
come of SetRelAlarm() can produce different results depending on whether
the counter has ticked past the match value before the call completes. It will
either result in the alarm expiring almost immediately or when the value is
reached again (after the next wrap of the underlying counter).
Portability
Example
TASK(MyTask){
...
/* SingleShotAlarm in Now+123 ticks */
SetRelAlarm(SingleShotAlarm, 123, 0);
...
/* PeriodicAlarm at Now+42, Now+142, Now+242... */
SetRelAlarm(PeriodicAlarm, 42, 100);
...
}
Calling Environment
See Also
CancelAlarm
DeclareAlarm
GetAlarm
GetAlarmBase
SetAbsAlarm
Syntax
StatusType SetScheduleTableAsync(
ScheduleTableType ScheduleTableID
)
Parameters
Return Values
The call returns values of type StatusType.
Description
This call sets the status of ScheduleTableID to SCHEDULETABLE_RUNNING if
and only if ScheduleTableID is running and is configured as explicitly synchro-
nized.
Portability
Calling Environment
See Also
DeclareScheduleTable
GetScheduleTableStatus
NextScheduleTable
StartScheduleTableAbs
StartScheduleTableRel
StartScheduleTableSynchron
StopScheduleTable
SyncScheduleTable
Syntax
void ShutdownOS(
StatusType Error
)
Parameters
Description
This API causes the OS to shut down. Task scheduling, all interrupts, alarms
and schedule tables are stopped.
Portability
Example
TASK(MyTask){
...
if (ErrorCondition != E_OK) {
ShutdownOS(ErrorCondition);
}
...
}
See Also
Os_Restart
Os_SetRestartPoint
StartOS
Syntax
void StartOS(
AppModeType Mode
)
Parameters
Description
StartOS() initializes all internal OS data structures and starts the OS in the
specified Mode.
Any tasks that are autostarted in the specified Mode are set to the ready
state.
Any alarms or schedule tables that are autostarted in the specified Mode are
initialized appropriately.
The Mode OSDEFAULTAPPMODE must always exist, but other names can be
configured as needed.
StartOS() is only allowed outside the context of the OS. It has no effect if
called while the OS is already running.
Example
OS_MAIN() {
/* Initialize target hardware before starting OS */
StartOS(OSDEFAULTAPPMODE);
}
Calling Environment
See Also
Os_Cbk_Idle
Os_Restart
Os_SetRestartPoint
ShutdownOS
Syntax
StatusType StartScheduleTableAbs(
ScheduleTableType ScheduleTableID,
TickType Start
)
Parameters
Return Values
The call returns values of type StatusType.
Description
If the parameters are valid, this call starts ScheduleTableID running and sets
the state of ScheduleTableID to SCHEDULETABLE_RUNNING.
Portability
Example
TASK(MyTask){
/* Start MyScheduleTable when the associated counter reaches
100 */
StartScheduleTableAbs(MyScheduleTable, 100);
...
}
Calling Environment
See Also
DeclareScheduleTable
GetScheduleTableStatus
NextScheduleTable
SetScheduleTableAsync
StartScheduleTableRel
StartScheduleTableSynchron
StopScheduleTable
SyncScheduleTable
Syntax
StatusType StartScheduleTableRel(
ScheduleTableType ScheduleTableID,
TickType Offset
)
Parameters
Return Values
The call returns values of type StatusType.
Description
If the parameters are valid, this call starts ScheduleTableID running and sets
the state of ScheduleTableID to SCHEDULETABLE_RUNNING.
Portability
Example
TASK(MyTask){
...
/* Start MyScheduleTable at Now+42 ticks */
StartScheduleTableRel(MyScheduleTable, 42);
...
}
Calling Environment
See Also
DeclareScheduleTable
GetScheduleTableStatus
NextScheduleTable
StartScheduleTableAbs
StartScheduleTableSynchron
StopScheduleTable
SyncScheduleTable
Syntax
StatusType StartScheduleTableSynchron(
ScheduleTableType ScheduleTableID
)
Parameters
Return Values
The call returns values of type StatusType.
Description
This call primes the explicitly synchronized ScheduleTableID to start syn-
chronously once a synchronization count to be provided by the call Sync-
ScheduleTable(). The call returns E_OS_ID if ScheduleTableID is not explicitly
synchronized.
Example
TASK(MyTask){
StartScheduleTableSynchron(MyScheduleTable);
...
SyncScheduleTable(MyScheduleTable, 12U);
}
Calling Environment
See Also
DeclareScheduleTable
GetScheduleTableStatus
NextScheduleTable
StartScheduleTableAbs
StartScheduleTableRel
StopScheduleTable
SyncScheduleTable
Syntax
StatusType StopScheduleTable(
ScheduleTableType ScheduleTableID
)
Parameters
Return Values
The call returns values of type StatusType.
Description
This call stops ScheduleTableID immediately. A call to StartSched-
uleTableAbs(), StartScheduleTableRel() or StartScheduleTableSynchron()
(where appropriate) will re-start ScheduleTableID at the start.
Note that any schedule table that was nexted from ScheduleTableID will
not start and will remain in the state SCHEDULETABLE_NEXT. StopSched-
uleTable() will need to be called on such tables in order to reset their state.
Portability
Calling Environment
See Also
DeclareScheduleTable
GetScheduleTableStatus
NextScheduleTable
StartScheduleTableAbs
StartScheduleTableRel
StartScheduleTableSynchron
Syntax
void SuspendAllInterrupts(void)
Description
This API call marks the start of a critical section that is protected from any
maskable Category 1 or Category 2 interrupt occurring. The critical section
must be left by using the ResumeAllInterrupts() call.
The call saves the current interrupt mask so that it can be restored later by
the ResumeAllInterrupts() call.
Portability
Example
TASK(MyTask){
...
SuspendAllInterrupts();
...
ResumeAllInterrupts();
...
}
Calling Environment
DisableAllInterrupts
EnableAllInterrupts
ResumeAllInterrupts
ResumeOSInterrupts
SuspendOSInterrupts
Syntax
void SuspendOSInterrupts(void)
Description
This API call marks the start of a critical section that is protected from any
Category 2 interrupt occurring. Category 1 interrupts may still occur. The
critical section must be left using the ResumeOSInterrupts() call.
The call saves the current interrupt mask so that it can be restored later by
the ResumeOSInterrupts() call.
Portability
Example
TASK(MyTask){
...
SuspendOSInterrupts();
/* Longer Critical Section */
...
SuspendAllInterrupts();
/* Shorter Critical Section */
ResumeAllInterrupts();
...
ResumeOSInterrupts();
...
}
See Also
DisableAllInterrupts
EnableAllInterrupts
ResumeAllInterrupts
ResumeOSInterrupts
SuspendOSInterrupts
Syntax
StatusType SyncScheduleTable(
ScheduleTableType ScheduleTableID,
TickType Value
)
Parameters
Return Values
The call returns values of type StatusType.
Description
This call provides the synchronization Value for an explicitly synchronized ta-
ble ScheduleTableID. ScheduleTableID must be either waiting for a synchro-
nization value or be running.
Control of and knowledge about the synchronizing counter is outside the do-
main of the OS. The OS assumes that the synchronizing counter has a du-
ration equal to ScheduleTableID and that the resolution of the synchronizing
The first expiry point that will be processed is the one with the smallest stati-
cally configured offset. The smallest offset is known as the InitialOffset. The
point at which the first expiry point is processed is determined as follows:
- if Value is less than the InitialOffset, then the first expiry point will be pro-
cessed when InitialOffset-Value ticks have elapsed on the counter driving
ScheduleTableID.
- if Value is greater than or equal to InitialOffset, then the first expiry point will
be processed when (Duration-Value)+InitialOffset ticks have elapsed. This
may require a full wrap of the underlying drive counter before the first expiry
point is processed.
Portability
Calling Environment
See Also
DeclareScheduleTable
GetScheduleTableStatus
NextScheduleTable
SetScheduleTableAsync
StartScheduleTableAbs
StartScheduleTableRel
StartScheduleTableSynchron
StopScheduleTable
Syntax
StatusType TerminateApplication(
RestartType RestartOption
)
Return Values
The call returns values of type StatusType.
Description
This call terminates the OS-Application that owns the calling task or ISR.
The running task/ISR of the OS-Application is forcibly terminated. The ready
tasks/ISRs of the OS-Application are forcibly terminated before they are re-
sumed.
The interrupt sources for all Category 2 ISRs owned by the OS-Application are
disabled by the OS calling Os_Cbk_Disable_<ISRName>() for each ISRName
owned by the OS-Application.
All alarms owned by the OS-Application are cancelled. All schedule tables
owned by the OS-Application are stopped.
Applications should take note of the following race conditions when using
TerminateApplication():
- there is no guarantee that the restart task will execute before any other task
in the OS-Application unless the restart task has the highest priority
- tasks (and events set for them) in other OS-Applications that are triggered
by alarms or schedule in terminated OS-Application will not be activated (or
set). This may cause other OS-Applications to fail.
Portability
Example
TASK(MyTask){
...
if (ErrorDetected == TRUE) {
TerminateApplication(RESTART);
}
}
Calling Environment
Os_Cbk_Disable_<ISRName>
Os_Cbk_Terminated_<ISRName>
TerminateTask
Syntax
StatusType TerminateTask(void)
Return Values
The call returns values of type StatusType.
Description
This call terminates the calling task. This transfers the calling task from the
running state to the suspended state. The call does not return to the calling
context if successful.
If the calling task has queued activations pending then the next instance of
the task is automatically transferred into the ready state.
Standard or linked resources are also released automatically and this is re-
ported as an error condition in extended status.
Portability
Calling Environment
See Also
DeclareTask
GetTaskID
GetTaskState
TerminateTask
Syntax
StatusType WaitEvent(
EventMaskType Mask
)
Parameters
Return Values
The call returns values of type StatusType.
Description
Puts the calling task into the waiting state until one of the specified events is
set.
If one or more of the events is already set, then the task remains in the run-
ning state.
Portability
Calling Environment
See Also
ClearEvent
DeclareEvent
GetEvent
SetEvent
Syntax
/* C function prototype for the callback */
ReturnValue NameOfCallback(Parameter Type, ...)
Parameters
A list of parameters for each callback and their mode:
out The parameter is passed out of the API callback by passing a reference
(pointer) to the parameter into the call.
inout The parameter is passed into the callback and then (updated) and
passed out.
Return Values
A description of the return value of the callback,
Description
A detailed description of the required functionality of the callback.
Portability
The portability of the call between OSEK OS, AUTOSAR OS, RTA-OS3.x and
RTA-TRACE.
Example Code
A C code listing showing how to implement the callback.
Configuration Condition
The configuration of RTA-OS3.x that requires user code to implement the call-
back.
See Also
A list of related callbacks.
Syntax
FUNC(void, OS_APPL_CODE) ErrorHook(
StatusType Error
)
Parameters
Description
This is called when an API call returns a StatusType not equal to E_OK. The
StatusType is passed into ErrorHook().
Macros are provided for obtaining information about the source of the error
ErrorHook(), but they are only available if the OS has been configured to gen-
erate them.
Portability
Configuration Condition
Required when the ErrorHook is configured.
Syntax
FUNC(void, OS_APPL_CODE) Os_Cbk_Cancel_<CounterID>(void)
Description
The callback must prevent interrupts related to the hardware counter occur-
ring.
The interrupt source should be disabled and any interrupt that has become
pending while the callback was running should be cleared.
Portability
Example
FUNC(void, OS_APPL_CODE) Os_Cbk_Cancel_MyCounter(void){
DISABLE_HW_COUNTER_INTERRUPT_SOURCE;
CLEAR_HW_COUNTER_PENDING_INTERRUPT;
}
Configuration Condition
Required for each hardware counter configured.
See Also
Os_Cbk_Now_<CounterID>
Os_Cbk_Set_<CounterID>
Os_Cbk_State_<CounterID>
Syntax
FUNC(AccessType, OS_APPL_CODE) Os_Cbk_CheckMemoryAccess(
ApplicationType Application,
TaskType TaskID,
ISRType ISRID,
MemoryStartAddressType Address,
MemorySizeType Size
)
Parameters
Return Values
The call returns values of type AccessType.
Description
The OS calls this when the CheckTaskMemoryAccess() or CheckISRMemory-
Access() service calls are made.
It is provided so that you have full control over the access permissions that
you wish to apply on a particular project. For example, you may choose to
limit write-access for untrusted code but allow any read and execute access.
Alternatively you may wish to limit read/write and execute access for un-
trusted code.
Portability
Example
FUNC(AccessType, OS_APPL_CODE)
Os_Cbk_CheckMemoryAccess(ApplicationType Application, TaskType
TaskID, ISRType ISRID, MemoryStartAddressType Address,
MemorySizeType Size) {
AccessType Access = OS_ACCESS_EXECUTE;
/* Check for stack space in address range */
if ((Address >= STACK_BASE) && (Address + Size < STACK_BASE +
STACK_SIZE) ) {
Access |= OS_ACCESS_STACK;
}
/* Address range is read/write if it is in RAM */
if ((Address >= RAM_BASE) && (Address + Size < RAM_BASE +
RAM_SIZE) ) {
Access |= (OS_ACCESS_WRITE | OS_ACCESS_READ);
}
switch (Application) {
case APP1:
/* Trusted application - no further restrictions */
break;
case APP2:
/* Untrusted application - write restrictions */
if ((Address <= APP2_BASE) || (Address + Size > APP2_BASE +
APP2_SIZE) ) {
Access &= ~OS_ACCESS_WRITE;
Configuration Condition
Required when memory protection is configured.
See Also
CheckISRMemoryAccess
CheckTaskMemoryAccess
Os_Cbk_SetMemoryAccess
Syntax
FUNC(void, OS_APPL_CODE) Os_Cbk_Disable_<ISRName>(void)
Description
The OS calls this function during TerminateApplication to request that the
interrupt source associated with the named ISR is disabled.
Portability
Example
FUNC(void, OS_APPL_CODE) Os_Cbk_Disable_App2Isr1(void) {
disable_interrupt_source(_App2Isr1_);
}
Configuration Condition
Required for each ISR if TerminateApplication is supported.
See Also
ProtectionHook
TerminateApplication
Syntax
FUNC(Os_StopwatchTickType, OS_APPL_CODE) Os_Cbk_GetStopwatch(void)
Return Values
The call returns values of type Os_StopwatchTickType.
Description
Os_Cbk_GetStopwatch() must return the current value of a free-running timer
which increments and overflows at the end of its range.
This timer provides the timebase for execution time and trace measurements.
Portability
Example
FUNC(Os_StopwatchTickType, OS_APPL_CODE)
Os_Cbk_GetStopwatch(void){
return (Os_StopwatchTickType) HARDWARE_TIMER_CHANNEL;
}
Configuration Condition
The callback must be provided if time monitoring or tracing is configured in
the OS.
See Also
Os_GetExecutionTime
Os_GetISRMaxExecutionTime
Os_GetTaskMaxExecutionTime
Os_ResetISRMaxExecutionTime
Os_ResetTaskMaxExecutionTime
Syntax
FUNC(boolean, OS_APPL_CODE) Os_Cbk_Idle(void)
Return Values
The call returns values of type boolean.
Description
Os_Cbk_Idle() is called when the OS first becomes idle after startup. Any
autostarted tasks will have run before it gets called.
If Os_Cbk_Idle() exits with a return value TRUE then it will be called again
immediately. If Os_Cbk_Idle() exits with a return value FALSE then it will not
be called again and the OS will busy wait when there are no tasks or ISRs
ready to run.
Portability
Example
FUNC(boolean, OS_APPL_CODE) Os_Cbk_Idle(void) {
sleep();
return TRUE;
}
Configuration Condition
Optional in user code. No configuration required.
See Also
StartOS
ShutdownOS
Syntax
FUNC(TickType, OS_APPL_CODE) Os_Cbk_Now_<CounterID>(void)
Return Values
The call returns values of type TickType.
Description
The callback must return the current value of hardware counter.
Portability
Example
FUNC(TickType, OS_APPL_CODE) Os_Cbk_Now_MyCounter(void){
return (TickType) HW_COUNTER_NOW_VALUE;
}
Configuration Condition
Required for each hardware counter configured.
See Also
Os_Cbk_Cancel_<CounterID>
Os_Cbk_Set_<CounterID>
Os_Cbk_State_<CounterID>
Syntax
FUNC(void, OS_APPL_CODE) Os_Cbk_RegSetRestore_<RegisterSetID>(
Os_RegSetDepthType Depth
)
Description
This callback is provided so that the application can restore the current con-
text for register set <RegisterSetID>.
Portability
Example
#ifdef OS_REGSET_FP_SIZE
static fp_context_save_area fpsave[OS_REGSET_FP_SIZE];
FUNC(void, OS_APPL_CODE)
Os_Cbk_RegSetRestore_FP(Os_RegSetDepthType Depth){
... = fpsave[Depth];
}
#endif /* OS_REGSET_FP_SIZE */
Configuration Condition
The callback must be provided if Register Set <RegisterSetID> exists and
preemption may require its context to be restored.
See Also
OS_REGSET_<RegisterSetID>_SIZE
Os_Cbk_RegSetSave_<RegisterSetID>
Syntax
FUNC(void, OS_APPL_CODE) Os_Cbk_RegSetSave_<RegisterSetID>(
Os_RegSetDepthType Depth
)
Description
This callback is provided so that the application can save the current context
for register set <RegisterSetID>.
Portability
Example
#ifdef OS_REGSET_FP_SIZE
static fp_context_save_area fpsave[OS_REGSET_FP_SIZE];
FUNC(void, OS_APPL_CODE) Os_Cbk_RegSetSave_FP(Os_RegSetDepthType
Depth){
fpsave[Depth] = ...;
}
#endif /* OS_REGSET_FP_SIZE */
Configuration Condition
The callback must be provided if Register Set <RegisterSetID> exists and
preemption may require its context to be saved.
See Also
OS_REGSET_<RegisterSetID>_SIZE
Os_Cbk_RegSetRestore_<RegisterSetID>
Syntax
FUNC(void, OS_APPL_CODE) Os_Cbk_SetMemoryAccess(
Os_UntrustedContextRefType ApplicationContext
)
Parameters
Description
This callback is provided so that you have full control over the memory pro-
tection hardware on your device, and so that you can decide the degree of
protection that you want to apply on a particular project. For example, you
may choose to limit write-access for untrusted code but allow any read and
execute access. Alternatively you may wish to limit read/write and execute
access for untrusted code.
When using memory protection features, you must initialize the memory pro-
tection hardware before calling StartOS(). You can choose what hardware to
use, how many regions to protect and what restrictions to apply.
Note:
When ’AlignedAddress’ is present, its value is initially set to the same value
as ’Address’. You may change its value so that it reflects the next address on
the stack that would be legal for the MPU. For example you might change it
from 0x580 to 0x500 if the region has to start on a 256-byte boundary (and
the stack grows to lower addresses!).
RTA-OS will detect the change in ’AlignedAddress’ and ensure that the stack is
moved to this position just before the untrusted code is run so that it operates
in the memory protection region that you set up.
You will have to account for these adjustments in any stack budgets that you
declare.
’FunctionID’ is only present when there are untrusted functions. Its value will
be INVALID_FUNCTION, except when the callback is for an untrusted function.
In this case, ’FunctionID’ contains the function identifier.
You must not attempt to move the stack to a position that would not be on the
normal stack. This will invalidate many of the assumptions and optimizations
in RTA-OS.
This mechanism is only available on the RTA-OS target ports that support it
and provide the command-line option ’Enable stack repositioning’.
Portability
Example
FUNC(void, OS_APPL_CODE)
Os_Cbk_SetMemoryAccess(Os_UntrustedContextRefType
ApplicationContext) {
/*
* When called for an Untrusted Task:
* ApplicationContext->Application contains the ID of the OS
Application that the task belongs to.
* ApplicationContext->TaskID is the ID of the task
* ApplicationContext->ISRID is INVALID_ISR
* ApplicationContext->FunctionID (when present) is
INVALID_FUNCTION
* ApplicationContext->Address is the starting address for the
task’s stack. (If stack monitoring is disabled, this will
be zero.)
* ApplicationContext->Size is the stack budget configured for
the task. (Zero if no budget or if stack monitoring is
disabled.)
*
* When called for an Untrusted ISR:
* ApplicationContext->Application contains the ID of the OS
Application that the ISR belongs to.
* ApplicationContext->TaskID is INVALID_TASK
* ApplicationContext->ISRID is the ID of the ISR
* ApplicationContext->FunctionID (when present) is
INVALID_FUNCTION
* ApplicationContext->Address is the starting address for the
ISR’s stack. (If stack monitoring is disabled, this will be
zero.)
* ApplicationContext->Size is the stack budget configured for
the ISR. (Zero if no budget or if stack monitoring is
disabled.)
*
* When called for an Untrusted function, an untrusted
application-specific error hook,
* an untrusted application-specific startup hook or an
untrusted application-specific shutdown hook:
* ApplicationContext->Application contains the ID of the OS
Application that the function/hook belongs to.
* ApplicationContext->TaskID is INVALID_TASK
Configuration Condition
The callback must be provided memory protection is selected and there are
untrusted OS Applications.
See Also
Os_Cbk_CheckMemoryAccess
Os_UntrustedContextType
Syntax
FUNC(void,OS_APPL_CODE) Os_Cbk_SetTimeLimit(
Os_TimeLimitType Limit
)
Return Values
The call returns values of type Os_TimeLimitType.
Description
Os_Cbk_SetTimeLimit() must be implemented if timing protection is config-
ured and a timing interrupt is being used to enforce time limits.
You must use it to ensure that the timing interrupt is enabled and
that it will fire after ’Limit’ ticks from now, unless cancelled by
Os_Cbk_SuspendTimeLimit().
Portability
Example
FUNC(void,OS_APPL_CODE) Os_Cbk_SetTimeLimit(Os_TimeLimitType
Limit) {
Os_TimeLimitType now = <read current counter value>;
if (Limit == 0) {
Os_TimingFaultDetected();
}
<set current counter compare value>(now + Limit + 1);
}
Configuration Condition
The callback must be provided if timing protection is configured and a timing
interrupt is being used to enforce time limits.
Os_TimingFaultDetected
Os_Cbk_SuspendTimeLimit
ProtectionHook
Os_TimeLimitType
Syntax
FUNC(void, OS_APPL_CODE) Os_Cbk_Set_<CounterID>(
TickType Match
)
Parameters
Description
The callback must set up the hardware counter to raise the appropriate inter-
rupt when its value reaches the new Match value.
Match is an absolute value at which the next counter action needs to be pro-
cessed.
- Where intervals are short, it is possible for the hardware count to have
already moved past the Match value at the point this get called. If so, it is
important to ensure that the interrupt pending bit gets set in software.
- Where an alarm can be started with an interval shorter than one already set,
the code must be able to reduce the match value and detect if this means that
the hardware count has already passed this point.
The callback does not normally initialize the underlying hardware. This is
normally done in initialization code before the OS is started.
Portability
Configuration Condition
Required for each hardware counter configured.
See Also
Os_AdvanceCounter
SetAbsAlarm
SetRelAlarm
Os_Cbk_Cancel_<CounterID>
Os_Cbk_Now_<CounterID>
Os_Cbk_State_<CounterID>
Syntax
FUNC(void, OS_APPL_CODE) Os_Cbk_StackOverrunHook(
Os_StackSizeType Overrun,
Os_StackOverrunType Reason
)
Parameters
Description
This hook routine is called if:
(a) a stack allocation budget has been specified for a task/ISR and this budget
has been exceeded.
(b) an ECC task failed to start because there was no space on the stack
(c) an ECC task failed to resume from wait because there was no space on
the stack
(d) an ECC task failed to wait because it was using too much stack (and its
state could not, therefore, be safely preserved)
A default version of the hook is present in the kernel that calls Pro-
tectionHook() (if configured, otherwise ShutdownOS()) with the status
E_OS_STACKFAULT. You can implement Os_Cbk_StackOverrunHook within
your application to override this behavior.
OS_BUDGET and OS_ECC_WAIT can only occur when Stack Monitoring is con-
figured.
Portability
Example
FUNC(void, OS_APPL_CODE) Os_Cbk_StackOverrunHook(Os_StackSizeType
Overrun, Os_StackOverrunType Reason) {
switch (Reason) {
case OS_BUDGET:
/* The currently running task or ISR has exceeded its stack
budget */
break;
case OS_ECC_START:
/* An ECC task has failed to start because there is
insufficient room on the stack */
break;
case OS_ECC_RESUME:
/* An ECC task has failed to resume from wait because there
is insufficient room on the stack */
break;
case OS_ECC_WAIT:
/* An ECC task has failed to enter the waiting state
because it is exceeding its stack budget */
break;
}
}
Configuration Condition
Optional when Stack Monitoring is configured and budgets are assigned, or
when there are ECC tasks.
Os_GetStackUsage
Os_GetISRMaxStackUsage
Os_GetTaskMaxStackUsage
Os_ResetISRMaxStackUsage
Os_ResetTaskMaxStackUsage
GetISRID
GetTaskID
Syntax
FUNC(void, OS_APPL_CODE) Os_Cbk_State_<CounterID>(
Os_CounterStatusRefType State
)
Parameters
Description
This function must update the counter status structure to indicate if it is run-
ning, whether a counter interrupt is pending, and how long the interval is to
the next match.
Portability
Example
FUNC(void, OS_APPL_CODE)
Os_Cbk_State_MyCounter(Os_CounterStatusRefType State) {
State.Delay = HW_OUTPUT_COMPARE_VALUE - HW_COUNTER_NOW_VALUE;
State.Pending = counter_interrupt_pending();
State.Running = counter_interrupt_enabled();
}
Configuration Condition
Required for each hardware counter configured.
See Also
Os_Cbk_Cancel_<CounterID>
Os_Cbk_Now_<CounterID>
Os_Cbk_Set_<CounterID>
Syntax
FUNC(Os_TimeLimitType,OS_APPL_CODE) Os_Cbk_SuspendTimeLimit(void)
Return Values
The call returns values of type Os_TimeLimitType.
Description
Os_Cbk_SuspendTimeLimit() must be implemented if timing protection is con-
figured and a timing interrupt is being used to enforce time limits.
The return value must be the number of ticks that were remaining to the limit
at the point that the call was made.
Portability
Example
FUNC(Os_TimeLimitType,OS_APPL_CODE) Os_Cbk_SuspendTimeLimit(void)
{
Os_TimeLimitType now = <read current counter value>;
<disable timing interrupt>;
<clear timing interrupt pending flag>;
return now - <read current counter compare value>;
}
Configuration Condition
The callback must be provided if timing protection is configured and a timing
interrupt is being used to enforce time limits.
See Also
Os_TimingFaultDetected
Os_Cbk_SetTimeLimit
ProtectionHook
Os_TimeLimitType
Syntax
FUNC(void, OS_APPL_CODE) Os_Cbk_Terminated_<ISRName>(void)
Description
This callback is provided so that the application can take appropriate action
when a Category 2 ISR is forcibly terminated by the OS.
On target processors where you have to clear some ’interrupt pending’ status
for the interrupt source, you must use this callback to clear the status. If you
fail to do this, the interrupt will be re-entered when the processor priority is
subsequently lowered.
Portability
Example
FUNC(void, OS_APPL_CODE) Os_Cbk_Terminated_App2Isr1(void) {
clear_interrupt_source(_App2Isr1_);
}
Configuration Condition
Required for each Category 2 ISR if forced termination of interrupts is sup-
ported.
See Also
ProtectionHook
TerminateApplication
Syntax
FUNC(void, OS_APPL_CODE) Os_Cbk_TimeOverrunHook(
Os_StopwatchTickType Overrun
)
Parameters
Description
This hook routine is called if an execution budget has been specified for a
task/ISR and the execution time has exceeded this budget.
Budget overruns are detected at preemption points or when the Task/ISR ter-
minated. This hook is called once, when the overrun is first detected.
GetTaskID() and GetISRID() can be used to determine which Task or ISR has
overrun.
Portability
Example
FUNC(void, OS_APPL_CODE)
Os_Cbk_TimeOverrunHook(Os_StopwatchTickType Overrun) {
}
Configuration Condition
Required when Time Monitoring is configured and budgets are assigned.
Os_GetExecutionTime
Os_GetISRMaxExecutionTime
Os_GetTaskMaxExecutionTime
Os_ResetISRMaxExecutionTime
Os_ResetTaskMaxExecutionTime
GetISRID
GetTaskID
Syntax
FUNC(void, OS_APPL_CODE) PostTaskHook(void)
Description
This hook routine is called by the operating system immediately before it
leaves the running state.
The PostTaskHook is not called if a task is leaving the running state because
the ShutdownOS() call has been made.
Portability
Example
FUNC(void, OS_APPL_CODE) PostTaskHook(void){
TaskType LeavingTask;
GetTaskID(&LeavingTask);
if (LeavingTask == TaskA) {
/* Do action for leaving A */
} else if (LeavingTask == TaskB) {
/* Do action for leaving B */
}
...
}
Configuration Condition
Required when the PostTaskHook is configured.
See Also
PreTaskHook
Syntax
FUNC(void, OS_APPL_CODE) PreTaskHook(void)
Description
This hook routine is called by the operating system immediately after it enters
the running state but before the task itself begins to execute.
Portability
Example
FUNC(void, OS_APPL_CODE) PreTaskHook(void){
TaskType EnteringTask;
GetTaskID(&EnteringTask);
if (EnteringTask == TaskA) {
/* Do action for entering A */
} else if (EnteringTask == TaskB) {
/* Do action for entering B */
}
...
}
Configuration Condition
Required when the PreTaskHook is configured.
See Also
PostTaskHook
Syntax
FUNC(ProtectionReturnType, OS_APPL_CODE) ProtectionHook(
StatusType FatalError
)
Parameters
Return Values
The call returns values of type ProtectionReturnType.
Description
This is called when a timing or memory protection fault occurs. The type of
fault is passed into ProtectionHook().
The return type determines what action the OS takes after the callback:
PRO_IGNORE: The fault is ignored and processing continues. Only allowed for
E_OS_PROTECTION_ARRIVAL.
Portability
Example
FUNC(ProtectionReturnType, OS_APPL_CODE)
ProtectionHook(StatusType FatalError) {
switch (FatalError) {
case E_OS_PROTECTION_MEMORY:
/* A memory protection error has been detected */
break;
case E_OS_PROTECTION_TIME:
/* Task, Category 2 ISR or time-limited function
exceeds its execution time */
break;
case E_OS_PROTECTION_ARRIVAL:
/* Task/Category 2 arrives before its timeframe has
expired */
return PRO_IGNORE; /* This is the only case where
PRO_IGNORE is allowed */
case E_OS_PROTECTION_LOCKED:
/* Task/Category 2 ISR blocks for too long */
break;
case E_OS_PROTECTION_EXCEPTION:
/* Trap occurred */
break;
}
return PRO_SHUTDOWN;
}
Configuration Condition
Required when the ProtectionHook is configured. Should be configured when
timing or memory protection are required.
See Also
Os_Cbk_Terminated_<ISRName>
Syntax
FUNC(void, OS_APPL_CODE) ShutdownHook(
StatusType Error
)
Parameters
Description
If a ShutdownHook() is configured, this hook routine is called by the operating
system when the OS API call ShutdownOS() has been called.
This routine is called during the operating system shutdown. The OS can be
restarted from the ShutdownHook() using Os_Restart()
Portability
Example
FUNC(void, OS_APPL_CODE) ShutdownHook(StatusType Error){
if (Error == E_OS_STACKFAULT) {
/* Attempt recovery by restart */
Os_Restart();
/* Never reach here... */
} else if (Error == E_OK) {
/* Normal shutdown procedure */
}
...
}
Configuration Condition
Required when the ShutdownHook is configured.
See Also
Os_Restart
StartupHook
Syntax
FUNC(void, OS_APPL_CODE) StartupHook(void)
Description
If a StartupHook() is configured, this hook routine is called by the OS at the
end of the OS initialization, but before the scheduler is running.
The application can start tasks, initialize device drivers and so on within Star-
tupHook().
Portability
Example
FUNC(void, OS_APPL_CODE) StartupHook(void){
/* Enable timer interrupt */
CHANNEL0_CONTROL_REG |= ONE_MILLISECOND_TIMER;
CHANNEL0_CONTROL_REG |= ENABLE;
}
Configuration Condition
Required when the StartupHook is configured.
See Also
ShutdownHook
4.1 AccessType
An integral value that holds information about how a specific memory region
can be accessed.
Portability
Constants
OS_ACCESS_READ
OS_ACCESS_WRITE
OS_ACCESS_EXECUTE
OS_ACCESS_STACK
Example
FUNC(AccessType,OS_APPL_CODE)
Os_Cbk_CheckMemoryAccess(ApplicationType Application, TaskType
TaskID, ISRType ISRID, MemoryStartAddressType Address,
MemorySizeType Size) {
AccessType Access = OS_ACCESS_EXECUTE;
/* Address range is read/write if it is in RAM */
if ((Address >= RAM_BASE) && (Address + Size < RAM_BASE +
RAM_SIZE) ) {
Access |= (OS_ACCESS_WRITE | OS_ACCESS_READ);
}
...
return Access;
}
4.2 AlarmBaseRefType
A pointer to an object of AlarmBaseType.
Portability
4.3 AlarmBaseType
Defines the configuration of a counter. The type is a C struct that contains
the fields maxallowedvalue, ticksperbase and mincycle.
Portability
Values
All values are of type TickType.
Example
TickType max,min,ticks;
AlarmBaseType SomeAlarmBase;
AlarmBaseRefType PointerToSomeAlarmBase = &SomeAlarmBase;
max = SomeAlarmBase.maxallowedvalue;
ticks = SomeAlarmBase.ticksperbase;
min = SomeAlarmBase.mincycle;
4.4 AlarmType
The type of an Alarm.
Portability
Example
AlarmType SomeAlarm;
4.5 AppModeType
The type of an application mode.
Values
Example
AppModeType SomeAppMode;
4.6 ApplicationType
The type of an OS-Application.
Portability
Values
Symbolic names of the OS-Applications declared at configuration time.
Constants
INVALID_OSAPPLICATION
Example
ApplicationType SomeOSApplication;
4.7 CounterType
The type of a Counter.
Portability
Example
CounterType SomeCounter;
4.8 EventMaskRefType
A pointer to an object of EventMaskType.
Example
EventMaskRefType SomeEventRef;
4.9 EventMaskType
The type of an event.
Portability
Values
Symbolic names of the EventMasks declared at configuration time.
Example
EventMaskType SomeEvent;
4.10 ISRRefType
A pointer to an object of ISRType.
Portability
Example
ISRType SomeISR;
ISRRefType PointerToSomeISR = &SomeISR;
4.11 ISRType
The type of a ISR.
Portability
Values
The symbolic names of ISRs declared at configuration time.
Example
ISRType SomeISR;
4.12 MemorySizeType
This data type holds the size (in bytes) of a memory region.
Portability
Example
MemorySizeType DatumSize = sizeof(datum);
CheckISRMemoryAccess(SomeISR, &datum, DatumSize);
4.13 MemoryStartAddressType
This data type is a pointer which is able to point to any location in the address
space.
Portability
Example
MemoryStartAddressType StartAddress = &datum;
CheckISRMemoryAccess(SomeISR, StartAddress, sizeof(datum));
4.14 OSServiceIdType
The type of a OS API call. Used only in the ErrorHook(). The values take the
form OSServiceId__APICallName_ where _APICallName_ represents the name
of an API call (without any leading Os_).
Portability
4.15 ObjectAccessType
Enumerated type defining whether an OS-Application has access to an object.
Portability
Values
ACCESS
NO_ACCESS
Example
if (ACCESS == CheckObjectAccess(MyOSApp, OBJECT_TASK, MyTask)
{...}
4.16 ObjectTypeType
Enumerated type defining the type of an OS object.
Portability
OBJECT_TASK
OBJECT_ISR
OBJECT_ALARM
OBJECT_RESOURCE
OBJECT_COUNTER
OBJECT_SCHEDULETABLE
Example
if (ACCESS == CheckObjectAccess(MyOSApp, OBJECT_TASK, MyTask)
{...}
4.17 Os_AnyType
A reference to an OS object.
Portability
Example
CheckObjectOwnership(OBJECT_TASK, Task1);
4.18 Os_CounterStatusRefType
A pointer to an object of Os_CounterStatusType.
Portability
Example
Os_CounterStatusType MyHwCounterStatus;
do {
Os_AdvanceCounter_MyHWCounter();
Os_Cbk_State_MyHWCounter(&MyHwCounterStatus);
} while (MyHwCounterStatus.Running && MyHwCounterStatus.Pending);
4.19 Os_CounterStatusType
Defines the status of a hardware counter. The type is a C struct that contains
the fields Running, Pending and Delay.
Delay is a value that defines the number of ticks - relative to the last expiry
- at which the next expiry is due. An Os_CounterStatusType.Delay value of
zero represents maxallowedvalue+1 (the modulus) of the counter.
The Delay field is only valid when Running and Pending are TRUE.
Portability
Example
Os_CounterStatusType CounterStatus;
4.20 Os_StackOverrunType
Enumerated type defining the reason for a stack overrun.
Portability
Values
OS_BUDGET
OS_ECC_START
OS_ECC_RESUME
OS_ECC_WAIT
Example
FUNC(void, OS_APPL_CODE) Os_Cbk_StackOverrunHook(Os_StackSizeType
Overrun, Os_StackOverrunType Reason) {
switch (Reason) {
case OS_BUDGET:
/* The currently running task or ISR has exceeded its stack
budget */
break;
case OS_ECC_START:
/* An ECC task has failed to start because there is
insufficient room on the stack */
break;
case OS_ECC_RESUME:
/* An ECC task has failed to resume from wait because there
is insufficient room on the stack */
break;
4.21 Os_StackSizeType
An unsigned value representing an amount of stack in bytes.
Portability
Example
Os_StackSizeType stack_size;
stack_size = Os_GetStackSize(start_position, end_position);
4.22 Os_StackValueType
An unsigned value representing the position of the stack pointer (ESP).
Portability
Example
Os_StackValueType start_position;
start_position = Os_GetStackValue();
4.23 Os_StopwatchTickType
Scalar representing ticks of a stopwatch (time monitoring or protection)
counter.
Portability
4.24 Os_TimeLimitType
Scalar representing an execution time limit, used with timing protection. The
duration of one Os_TimeLimitType is the same as one Os_StopwatchTickType
Portability
Example
Os_TimeLimitType limit = 100;
CallAndProtectFunction(Func3, &data, limit);
4.25 Os_UntrustedContextRefType
A pointer to an object of Os_UntrustedContextType.
Portability
Example
FUNC(void, OS_APPL_CODE)
Os_Cbk_SetMemoryAccess(Os_UntrustedContextRefType
ApplicationContext) {}
4.26 Os_UntrustedContextType
Defines the context of the untrusted code that is about to be executed. It is
only used by the Os_Cbk_SetMemoryAccess() callback when memory protec-
tion features are configured.
Portability
Values
ApplicationType Application
TaskType TaskID
ISRType ISRID
MemoryStartAddressType Address
MemorySizeType Size
4.27 PhysicalTimeType
Scalar representing a units of physical (wall clock) time.
Portability
Example
PhysicalTimeType Milliseconds = OS_TICKS2MS_MyCounter(42);
4.28 ProtectionReturnType
Enumerated type defining the action taken following a protection fault.
Portability
Values
PRO_IGNORE
PRO_TERMINATETASKISR
PRO_TERMINATEAPPL
PRO_TERMINATEAPPL_RESTART
PRO_SHUTDOWN
Example
FUNC(ProtectionReturnType, OS_APPL_CODE)
ProtectionHook(StatusType FatalError) {
switch (FatalError) {
case E_OS_PROTECTION_MEMORY:
/* A memory protection error has been detected */
break;
case E_OS_PROTECTION_TIME:
/* Task, Category 2 ISR or time-limited function
exceeds its execution time */
break;
case E_OS_PROTECTION_ARRIVAL:
/* Task/Category 2 arrives before its timeframe has
expired */
4.29 ResourceType
The type of a Resource.
Portability
Values
Constants
RES_SCHEDULER
Example
ResourceType SomeResource;
4.30 RestartType
Enumerated type defining the action to be taken in TerminateApplication().
Portability
Values
RESTART
NO_RESTART
4.31 ScheduleTableRefType
A pointer to an object of ScheduleTableType.
Portability
Example
ScheduleTableType SomeScheduleTable;
ScheduleTableRefType PointerToSomeScheduleTable =
&SomeScheduleTable;
4.32 ScheduleTableStatusRefType
A pointer to an object of ScheduleTableStatusType.
Portability
Example
ScheduleTableStatusType SomeScheduleTableStatus;
GetScheduleTableStatus(&SomeScheduleTableStatus);
4.33 ScheduleTableStatusType
Enumerated type defining the runtime state of a schedule table.
Portability
Values
SCHEDULETABLE_STOPPED
SCHEDULETABLE_NEXT
SCHEDULETABLE_WAITING
SCHEDULETABLE_RUNNING
SCHEDULETABLE_RUNNING_AND_SYNCHRONOUS
4.34 ScheduleTableType
The type of a ScheduleTable.
Portability
Example
ScheduleTableType SomeScheduleTable;
4.35 StatusType
Enumeration type defining the status of an API call.
Portability
Values
E_OK
E_OS_ACCESS
E_OS_CALLEVEL
E_OS_ID
E_OS_LIMIT
E_OS_NOFUNC
E_OS_RESOURCE
E_OS_STATE
E_OS_VALUE
E_OS_SERVICEID
E_OS_ILLEGAL_ADDRESS
E_OS_MISSINGEND
E_OS_DISABLEDINT
E_OS_STACKFAULT
E_OS_PROTECTION_MEMORY
E_OS_PROTECTION_TIME
E_OS_PROTECTION_ARRIVAL
E_OS_PROTECTION_LOCKED
E_OS_PROTECTION_EXCEPTION
E_OS_SYS_NO_RESTART
E_OS_SYS_RESTART
E_OS_SYS_OVERRUN
4.36 Std_ReturnType
AUTOSAR’s standard API service return type. This is NOT used by AUTOSAR
OS. The type is an 8-bit unsigned integer whose top 6 bits may encode
module-specific error codes.
Portability
Values
E_OK=0
E_NOT_OK=1
Example
Std_ReturnType ErrorCode;
Std_ReturnType ErrorMask = 0x03;
ErrorCode = Rte_Call_SomePort_SomeOperation(self, 42);
if ((ErrorCode & ErrorMask)== E_NOT_OK) {
/* call succeeded */
}
4.37 Std_VersionInfoType
A C struct whose fields contained AUTOSAR version information for a module.
(Defined in Std_Types.h)
vendorID
moduleID
instanceID
sw_major_version
sw_minor_version
sw_patch_version
Values
Example
Std_VersionInfoType Version;
GetVersionInfo(&Version);
if (Version.vendorID == 11) {
/* Make ETAS-specific API call */
AdvanceCounter(HardwareCounter);
}
4.38 TaskRefType
A pointer to an object of TaskType.
Portability
Example
TaskType SomeTask;
TaskRefType TaskRef = &SomeTask;
4.39 TaskStateRefType
A pointer to an object of TaskStateType.
Portability
Example
TaskStateType TaskState;
TaskStateRefType TaskStateRef = &TaskState;
4.40 TaskStateType
Enumerated type defining the current state of a task.
Values
SUSPENDED
READY
WAITING
RUNNING
Example
TaskStateType TaskState;
GetTaskState(&TaskState);
4.41 TaskType
The type of a task.
Portability
Values
The symbolic names of tasks declared at configuration time.
Constants
INVALID_TASK
Example
TaskType SomeTask;
4.42 TickRefType
A pointer to an object of TickType.
Portability
4.43 TickType
Scalar representing a ticks of a counter.
Portability
Example
TickType StartTime = 42;
TickType NoRepeat = 0;
SetAbsAlarm(MyAlarm,StartTime,NoRepeat);
4.44 TrustedFunctionIndexType
The index value of a Trusted function.
Portability
Values
Symbolic names of the Trusted functions declared at configuration time.
Constants
INVALID_FUNCTION
Example
CallTrustedFunction(Func3, &data);
4.45 TrustedFunctionParameterRefType
A reference to the parameters for a Trusted function.
Portability
4.46 boolean
Addressable 8 bits only for use with TRUE/FALSE. (Defined in Plat-
form_Types.h)
Portability
Values
0=FALSE
1=TRUE
Example
if (Condition == TRUE) {
x = y;
}
4.47 float32
Single precision floating point number. (Defined in Platform_Types.h)
Portability
Example
float32 x;
4.48 float64
Double precision floating point number. (Defined in Platform_Types.h)
Portability
Example
float64 x;
4.49 sint16
Signed 16-bit integer. (Defined in Platform_Types.h)
Values
-32768..32767
Example
sint16 x;
4.50 sint16_least
Signed integer at least 16-bits wide. (Defined in Platform_Types.h)
Portability
Values
At least -32768..32767
Example
sint16_least x;
4.51 sint32
Signed 32-bit integer. (Defined in Platform_Types.h)
Portability
Values
-2147483648..2147483647
Example
sint32 x;
4.52 sint32_least
Signed integer at least 32-bits wide. (Defined in Platform_Types.h)
Values
At least -2147483648..2147483647
Example
sint32_least x;
4.53 sint8
Signed 8-bit integer. (Defined in Platform_Types.h)
Portability
Values
-128..127
Example
sint8 x;
4.54 sint8_least
Signed integer at least 8-bits wide. (Defined in Platform_Types.h)
Portability
Values
At least -128..127
Example
sint8_least x;
4.55 uint16
Unsigned 16-bit integer. (Defined in Platform_Types.h)
Values
0..65535
Example
uint16 x;
4.56 uint16_least
Unsigned integer at least 16-bits wide. (Defined in Platform_Types.h)
Portability
Values
At least 0..65535
Example
uint16_least x;
4.57 uint32
Unsigned 32-bit integer. (Defined in Platform_Types.h)
Portability
Values
0..4294967295
Example
uint32 x;
4.58 uint32_least
Unsigned integer at least 32-bits wide. (Defined in Platform_Types.h)
Values
At least 0..4294967295
Example
uint32_least x;
4.59 uint8
Unsigned 8-bit integer. (Defined in Platform_Types.h)
Portability
Values
0..255
Example
uint8 x;
4.60 uint8_least
Unsigned integer at least 8-bits wide. (Defined in Platform_Types.h)
Portability
Values
At least 0..255
Example
uint8_least x;
5.1 ALARMCALLBACK
Declares an alarm callback. The only OS API calls that can be made in an
alarm callback are SuspendAllInterrupts() and ResumeAllInterrupts().
Portability
Example
ALARMCALLBACK(MyCallback){...}
5.2 CAT1_ISR
Macro that should be used to create a Category 1 ISR entry function. This
macro exists to help make your code portable between targets.
Portability
Example
CAT1_ISR(MyISR) {...}
5.3 DeclareAlarm
This is used to declare an alarm and works similarly to external declaration
of variables in C. You will not normally need to use this because RTA-OS auto-
matically declares all Alarms in your configuration.
Portability
Example
DeclareAlarm(MyAlarm);
5.4 DeclareCounter
This is used to declare a Counter and works similarly to external declaration
of variables in C. You will not normally need to use this because RTA-OS auto-
matically declares all Counters in your configuration.
Example
DeclareCounter(MyCounter);
5.5 DeclareEvent
This is used to declare an Event and works similarly to external declaration
of variables in C. You will not normally need to use this because RTA-OS auto-
matically declares all Events in your configuration.
Portability
Example
DeclareEvent(MyEvent);
5.6 DeclareISR
This is used to declare an ISR and works similarly to external declaration of
variables in C. You will not normally need to use this because RTA-OS auto-
matically declares all ISRs in your configuration.
Portability
Example
DeclareISR(MyISR);
5.7 DeclareResource
This is used to declare a Resource and works similarly to external declara-
tion of variables in C. You will not normally need to use this because RTA-OS
automatically declares all Resources in your configuration.
Portability
5.8 DeclareScheduleTable
This is used to declare a ScheduleTable and works similarly to external decla-
ration of variables in C. You will not normally need to use this because RTA-OS
automatically declares all ScheduleTables in your configuration.
Portability
Example
DeclareScheduleTable(MyScheduleTable);
5.9 DeclareTask
This is used to declare a Task and works similarly to external declaration of
variables in C. You will not normally need to use this because RTA-OS auto-
matically declares all Tasks in your configuration.
Portability
Example
DeclareTask(MyTask);
5.10 ISR
Macro that must be used to create a Category 2 ISR entry function.
Portability
Example
ISR(MyISR) {...}
5.11 OSCYCLEDURATION
Duration of an instruction cycle in nanoseconds.
Example
time_in_ns = CycleMeasurement * OSCYCLEDURATION;
5.12 OSCYCLESPERSECOND
The number of instruction cycles per second.
Portability
Example
time_in_secs = CycleMeasurement / OSCYCLESPERSECOND;
5.13 OSErrorGetServiceId
Returns the identifier of the service that generated an error.
Portability
Example
OSServiceIdType WhatServiceFailed = OSErrorGetServiceId();
5.14 OSMAXALLOWEDVALUE
Constant definition of the maximum possible value of the Counter called Sys-
temCounter in ticks.
Portability
5.15 OSMAXALLOWEDVALUE_<CounterID>
Constant definition of the maximum possible value of the Counter called
CounterID in ticks.
Portability
Example
SetAbsAlarm(MyAlarm,OSMAXALLOWEDVALUE_SomeCounter,0)
5.16 OSMEMORY_IS_EXECUTABLE
Check whether access rights indicate that memory is executable.
Portability
Example
rights = CheckTaskMemoryAccess(MyTask, &datum, sizeof(datum));
if (OSMEMORY_IS_EXECUTABLE(rights)) {...}
5.17 OSMEMORY_IS_READABLE
Check whether access rights indicate that memory is readable.
Portability
Example
rights = CheckTaskMemoryAccess(MyTask, &datum, sizeof(datum));
if (OSMEMORY_IS_READABLE(rights)) {...}
5.18 OSMEMORY_IS_STACKSPACE
Check whether access rights indicate that memory is stack space.
Example
rights = CheckTaskMemoryAccess(MyTask, &datum, sizeof(datum));
if (OSMEMORY_IS_STACKSPACE(rights)) {...}
5.19 OSMEMORY_IS_WRITEABLE
Check whether access rights indicate that memory is writeable.
Portability
Example
rights = CheckTaskMemoryAccess(MyTask, &datum, sizeof(datum));
if (OSMEMORY_IS_WRITEABLE(rights)) {...}
5.20 OSMINCYCLE
Constant definition of the minimum number of ticks for a cyclic alarm on the
Counter called SystemCounter.
Portability
Example
if (ComputedValue < OSMINCYCLE) {
SetAbsAlarm(MyAlarm,42,OSMINCYCLE);
} else {
SetAbsAlarm(MyAlarm,42,ComputedValue);
}
5.21 OSMINCYCLE_<CounterID>
Constant definition of the minimum number of ticks for a cyclic alarm on the
Counter called CounterID.
Portability
5.22 OSSWTICKDURATION
Duration of a stopwatch tick in nanoseconds.
Portability
Example
time_in_ns = StopwatchMeasurement * OSSWTICKDURATION;
5.23 OSSWTICKSPERSECOND
The number of stopwatch ticks per second.
Portability
Example
time_in_secs = CycleMeasurement / OSSWTICKSPERSECOND;
5.24 OSTICKDURATION
Duration of a tick of the Counter called SystemCounter in nanoseconds.
Portability
Example
uint32 RealTimeDeadline = 50000000; /* 50 ms */
TickType Deadline = (TickType)RealTimeDeadline / OSTICKDURATION;
SetRelAlarm(Timeout,Deadline,0);
5.25 OSTICKDURATION_<CounterID>
Duration of a tick of the Counter called CounterID in nanoseconds.
Example
uint32 RealTimeDeadline = 50000000; /* 50 ms */
TickType Deadline = (TickType)RealTimeDeadline /
OSTICKDURATION_SomeCounter;
SetRelAlarm(Timeout,Deadline,0);
5.26 OSTICKSPERBASE
Constant definition of the ticks per base setting of the Counter called System-
Counter in ticks.
Portability
5.27 OSTICKSPERBASE_<CounterID>
Constant definition of the ticks per base setting of the Counter called Coun-
terID in ticks.
Portability
5.28 OS_EXTENDED_STATUS
Defined when extended status is configured.
Portability
Example
#ifdef OS_EXTENDED_STATUS
CheckStatusType = ActivateTask(Task1);
if (CheckStatusType == E_OS_LIMIT) {
/* Log an error */
}
#else
ActivateTask(Task1);
#endif
Portability
Example
#include "Os.h"
OS_MAIN() {
/* Initialize target hardware */
StartOS(OSDEFAULTAPPMODE);
}
5.30 OS_NOAPPMODE
The value returned by GetActiveApplicationMode() when the OS is not run-
ning.
Portability
5.31 OS_NUM_ALARMS
The number of alarms declared.
Portability
5.32 OS_NUM_APPLICATIONS
The number of OS Applications declared.
Portability
5.33 OS_NUM_APPMODES
The number of AppModes declared.
5.34 OS_NUM_COUNTERS
The number of counters declared.
Portability
5.35 OS_NUM_EVENTS
The number of Events declared.
Portability
5.36 OS_NUM_ISRS
The number of Category 2 ISRs declared.
Portability
5.37 OS_NUM_RESOURCES
The number of resources declared (excludes internal).
Portability
5.38 OS_NUM_SCHEDULETABLES
The number of schedule tables declared.
Portability
5.39 OS_NUM_TASKS
The number of tasks declared.
5.40 OS_NUM_TRUSTED_FUNCTIONS
The number of Trusted functions declared.
Portability
5.41 OS_REGSET_<RegisterSetID>_SIZE
This macro defines the size of the buffer needed to preserve Register Set
<RegisterSetID> at run time. If no buffer is needed, then it is not declared.
This can happen if no task/ISR that uses the register set can be preempted
by another one that also uses it.
Portability
Example
#ifdef OS_REGSET_FP_SIZE
fp_context_save_area fpsave[OS_REGSET_FP_SIZE];
#endif /* OS_REGSET_FP_SIZE */
5.42 OS_SCALABILITY_CLASS_1
Defined when AUTOSAR Scalability Class 1 is configured.
Portability
Example
#ifdef OS_SCALABILITY_CLASS_1
ALARMCALLBACK(OnlyInSC1){
...
}
#endif
5.43 OS_SCALABILITY_CLASS_2
Defined when AUTOSAR Scalability Class 2 is configured.
Example
#if defined(OS_SCALABILITY_CLASS_2) ||
defined(OS_SCALABILITY_CLASS_4)
StartScheduleTableSynchron(Table);
#endif
5.44 OS_SCALABILITY_CLASS_3
Defined when AUTOSAR Scalability Class 3 is configured.
Portability
Example
#if defined(OS_SCALABILITY_CLASS_3) ||
defined(OS_SCALABILITY_CLASS_4)
FUNC(void, OS_APPL_CODE)
ErrorHook_MyApplication(StatusType Error){
/* Handle OS-Application error */
}
#endif
5.45 OS_SCALABILITY_CLASS_4
Defined when AUTOSAR Scalability Class 4 is configured.
Portability
Example
#if defined(OS_SCALABILITY_CLASS_3) ||
defined(OS_SCALABILITY_CLASS_4)
FUNC(void, OS_APPL_CODE)
ErrorHook_MyApplication(StatusType Error){
/* Handle OS-Application error */
}
#endif
5.46 OS_STACK_MONITORING
This macro is only defined if stack monitoring is configured.
Example
FUNC(boolean, OS_APPL_CODE) Os_Cbk_Idle(void){
#ifdef OS_STACK_MONITORING
Os_StackSizeType Task1Stack, Task2Stack, Task3Stack;
Task1Stack = Os_GetTaskMaxStackUsage(Task1);
Task2Stack = Os_GetTaskMaxStackUsage(Task2);
...
TaskNStack = Os_GetTaskMaxStackUsage(TaskN);
#endif
return TRUE;
}
5.47 OS_STANDARD_STATUS
Defined when standard status is configured.
Portability
Example
#ifdef OS_STANDARD_STATUS
ActivateTask(Task1);
#else
CheckStatusType = ActivateTask(Task1);
if (CheckStatusType == E_OS_LIMIT) {
/* Log an error */
}
#endif
5.48 OS_TICKS2<Unit>_<CounterID>(ticks)
Converts ticks on CounterID to Unit where Unit is: NS (nanosecond), MS (Mil-
lisecond), US (Microsecond), SEC(Second).
Portability
5.49 OS_TIME_MONITORING
This macro is only defined if time monitoring is configured.
Portability
Example
#ifdef OS_TIME_MONITORING
Os_StopwatchTickType start,end,function_duration;
start = Os_GetExecutionTime();
#endif
ThirdPartyFunction(x,y);
#ifdef OS_TIME_MONITORING
end = Os_GetExecutionTime();
function_duration = end - start;
#endif
5.50 TASK
Macro that must be used to create the task’s entry function.
Portability
Example
TASK(MyTask) {...}
Syntax
/* C function prototype for the API call */
ReturnValue NameOfAPICall(Parameter Type, ...)
Parameters
A list of parameters for each API call and their mode:
out The parameter is passed out of the API call by passing a reference
(pointer) to the parameter into the call.
inout The parameter is passed into the call and then (updated) and passed
out.
Return Values
Where API calls return a StatusType the values of the type returned and
an indication of the reason for the error/warning are listed. The build column
indicates whether the value is returned for both standard and extended status
builds or for extended status build only.
Description
A detailed description of the behavior of the API call.
Portability
The RTA-OS3.x API includes four classes of API calls:
OSEK OS calls are those specified by the OSEK OS standard. OSEK OS calls
are portable to other implementations of OSEK OS and are portable to
other implementations of AUTOSAR OS R3.x.
Example Code
A C code listing showing how to use the API calls
Calling Environment
The valid calling environment for the API call. A 3 indicates that a call can be
made in the indicated context. A 7 indicates that the call cannot be made in
the indicated context.
See Also
A list of related API calls.
Syntax
void Os_CheckTraceOutput(void)
Description
When tracing in free-running mode, this must be called regularly by the ap-
plication. It is used to detect when the trace buffer has data to upload to
RTA-TRACE.
Portability
Example
Os_CheckTraceOutput();
Calling Environment
See Also
Os_Cbk_TraceCommDataReady
Os_Cbk_TraceCommTxByte
Os_Cbk_TraceCommTxEnd
Os_Cbk_TraceCommTxReady
Os_Cbk_TraceCommTxStart
Syntax
void Os_ClearTrigger(void)
Description
This API call clears all trigger conditions that have been set using an
Os_TriggerOnXXX() API.
Trace information will continue to be logged in the trace buffer, but no trace
record will trigger the upload of the trace buffer to the host.
Portability
Example
Os_ClearTrigger();
Calling Environment
See Also
Os_SetTraceRepeat
Os_SetTriggerWindow
Os_StartBurstingTrace
Os_StartFreeRunningTrace
Syntax
void Os_DisableTraceCategories(
Os_TraceCategoriesType CategoriesMask
)
Parameters
Description
Trace categories are used to filter whether tracepoints, task tracepoints and
intervals get recorded and are typically used to control the volume of data
that gets traced.
This call disables the specified run-time categories and therefore will inhibit
the logging of all tracepoints, task tracepoints and intervals that are filtered
by these categories.
Categories not listed in the call will be left in their current state.
Portability
Example
Os_DisableTraceCategories(DebugTracePoints | DataLogTracePoints);
/* Disable DebugTracePoints and DataLogTracePoints*/
_
Os LogTracepoint(tpTest, DebugTracePoints); /* tpTest is not
recorded: DebugTracePoints is disabled */
Os_LogTracepoint(tpTest, OS_TRACE_CATEGORY_ALWAYS); /* tpTest is
recorded here */
Os_DisableTraceCategories(OS_TRACE_ALL_CATEGORIES); /* Disable
all categories except for OS_TRACE_CATEGORY_ALWAYS */
See Also
Os_EnableTraceCategories
Syntax
void Os_DisableTraceClasses(
Os_TraceClassesType ClassMask
)
Parameters
Description
Trace classes are used to filter whether complete types of trace events get
recorded. They are typically used to control the volume of data that gets
traced.
This call disables the specified run-time classes and therefore will inhibit the
tracing of events that are filtered by these classes.
Classes not listed in the call will be left in their current state.
Portability
Example
Os_DisableTraceClasses(OS_TRACE_TRACEPOINT_CLASS);
Os_LogTracepoint(tpTest, OS_TRACE_ALL_CATEGORIES); /* Will not
get recorded */
Calling Environment
Syntax
void Os_EnableTraceCategories(
Os_TraceCategoriesType CategoriesMask
)
Parameters
Description
Trace categories are used to filter whether tracepoints, task tracepoints and
intervals get recorded and are typically used to control the volume of data
that gets traced.
Categories not listed in the call will be left in their current state.
Portability
Example
Os_EnableTraceCategories(DebugTracePoints | DataLogTracePoints);
Os_LogTracepoint(tpTest, DebugTracePoints); /* tpTest is recorded
*/
Os_LogTracepoint(tpTest, FunctionProfileTracePoints); /* tpTest
is not recorded - FunctionProfileTracePoints not enabled */
Os_LogTracepoint(tpTest, OS_TRACE_ALL_CATEGORIES); /* tpTest is
recorded */
See Also
Os_DisableTraceCategories
Syntax
void Os_EnableTraceClasses(
Os_TraceClassesType ClassMask
)
Parameters
Description
Trace classes are used to filter whether complete types of trace events get
recorded. They are typically used to control the volume of data that gets
traced.
Classes not listed in the call will be left in their current state.
Portability
Example
Os_EnableTraceClasses(OS_TRACE_TRACEPOINT_CLASS);
Os_LogTracepoint(tpTest, OS_TRACE_ALL_CATEGORIES); /* Will get
recorded */
Calling Environment
Syntax
void Os_LogCat1ISREnd(
ISRType ISRID
)
Parameters
Description
This call marks the end of a Category 1 ISR. This type of ISR is not controlled
by the operating system so no automatic tracing of it can occur. If Category
1 ISRs need to be logged then it is necessary to do this manually using this
call.
Take care to ensure that both the start and end of the Category 1 ISR logged,
otherwise the resulting trace will be incorrect.
Portability
Example
CAT1_ISR(Category1Handler) {
Os_LogCat1ISRStart(Category1Handler);
...
Os_LogCat1ISREnd(Category1Handler);
}
Calling Environment
Syntax
void Os_LogCat1ISRStart(
ISRType ISRID
)
Parameters
Description
This call marks the start of a Category 1 ISR. This type of ISR is not controlled
by the operating system so no automatic tracing of it can occur. If Category
1 ISRs need to be logged then it is necessary to do this manually using this
call.
Take care to ensure that both the start and end of the Category 1 ISR are
logged, otherwise the resulting trace will be incorrect.
Portability
Example
CAT1_ISR(Category1Handler) {
Os_LogCat1ISRStart(Category1Handler);
...
Os_LogCat1ISREnd(Category1Handler);
}
Calling Environment
Syntax
void Os_LogCriticalExecutionEnd(
Os_TraceInfoType CriticalExecutionID
)
Parameters
Description
Logs the end of a critical point of execution in the trace buffer. This is typically
used to indicate that a task/ISR has completed a time-critical section of code.
This might be needed if the deadline that needs to be met by the task/ISR
occurs before the end of the task/ISR.
Portability
Example
TASK(MyTask){
...
ReadSensor(X);
Os_LogCriticalExecutionEnd(SensorRead);
...
WriteActuator(Y);
Os_LogCriticalExecutionEnd(SensorRead);
...
TerminateTask();
}
See Also
None.
Syntax
void Os_LogIntervalEnd(
Os_TraceIntervalIDType IntervalID,
Os_TraceCategoriesType CategoryMask
)
Parameters
Description
Log the end of an interval in the trace buffer.
Portability
Example
Os_LogIntervalStart(EndToEndTime, SystemLoggingCategory);
...
Os_LogIntervalEnd(EndToEndTime, SystemLoggingCategory);
Calling Environment
Os_LogIntervalEndData
Os_LogIntervalEndValue
Os_LogIntervalStart
Os_LogIntervalStartData
Os_LogIntervalStartValue
Syntax
void Os_LogIntervalEndData(
Os_TraceIntervalIDType IntervalID,
Os_TraceDataPtrType DataPtr,
Os_TraceDataLengthType Length,
Os_TraceCategoriesType CategoryMask
)
Parameters
Description
Log the end of an interval in the trace buffer and associate some data with it.
Portability
Example
Os_LogIntervalStart(EndToEndTime, SystemLoggingCategory);
...
Os_LogIntervalEndData(EndToEndTime, &DataBlock,
4,SystemLoggingCategory);
See Also
Os_LogIntervalEnd
Os_LogIntervalEndValue
Os_LogIntervalStart
Os_LogIntervalStartData
Os_LogIntervalStartValue
Syntax
void Os_LogIntervalEndValue(
Os_TraceIntervalIDType IntervalID,
Os_TraceValueType Value,
Os_TraceCategoriesType CategoryMask
)
Parameters
Description
Log the end of an interval in the trace buffer and associate a value with it.
Portability
Example
Os_LogIntervalStart(EndToEndTime, SystemLoggingCategory);
...
Os_LogIntervalEndValue(EndToEndTime, 42, SystemLoggingCategory);
Calling Environment
Os_LogIntervalEnd
Os_LogIntervalEndData
Os_LogIntervalEndValue
Os_LogIntervalStartData
Os_LogIntervalStartValue
Syntax
void Os_LogIntervalStart(
Os_TraceIntervalIDType IntervalID,
Os_TraceCategoriesType CategoryMask
)
Parameters
Description
Log the start of an interval in the trace buffer.
Portability
Example
Os_LogIntervalStart(EndToEndTime, SystemLoggingCategory);
...
Os_LogIntervalEnd(EndToEndTime, SystemLoggingCategory);
Calling Environment
Os_LogIntervalEnd
Os_LogIntervalEndData
Os_LogIntervalEndValue
Os_LogIntervalStartData
Os_LogIntervalStartValue
Syntax
void Os_LogIntervalStartData(
Os_TraceIntervalIDType IntervalID,
Os_TraceDataPtrType DataPtr,
Os_TraceDataLengthType Length,
Os_TraceCategoriesType CategoryMask
)
Parameters
Description
Log the start of an interval in the trace buffer and associate some data with
it.
Portability
Example
Os_LogIntervalStartData(EndToEndTime, &DataBlock, 4,
SystemLoggingCategory);
...
Os_LogIntervalEnd(EndToEndTimeSystemLoggingCategory);
See Also
Os_LogIntervalEnd
Os_LogIntervalEndData
Os_LogIntervalEndValue
Os_LogIntervalStart
Os_LogIntervalStartValue
Syntax
void Os_LogIntervalStartValue(
Os_TraceIntervalIDType IntervalID,
Os_TraceValueType Value,
Os_TraceCategoriesType CategoryMask
)
Parameters
Description
Log the start of an interval in the trace buffer and associate a value with it.
Portability
Example
Os_LogIntervalStartValue(EndToEndTime, 42, SystemLoggingCategory);
...
Os_LogIntervalEnd(EndToEndTime, SystemLoggingCategory);
Calling Environment
Os_LogIntervalEnd
Os_LogIntervalEndData
Os_LogIntervalEndValue
Os_LogIntervalStart
Os_LogIntervalStartData
Syntax
void Os_LogProfileStart(
Os_TraceInfoType ProfileID
)
Parameters
Description
Logs which execution profile is active in the trace buffer. Execution profiles
can be used to identify which route is taken through a Task or ISR when this
depends on external conditions.
Portability
Example
TASK(MyTask){
if (some_condition()) {
Os_LogProfileStart(TrueRoute);
...
} else {
Os_LogProfileStart(FalseRoute);
...
}
TerminateTask();
}
See Also
None.
Syntax
void Os_LogTaskTracepoint(
Os_TraceTracepointIDType TaskTracepointID,
Os_TraceCategoriesType CategoryMask
)
Parameters
Description
Log the task tracepoint event in the trace buffer.
Portability
Example
Os_LogTaskTracepoint(MyTaskTracePoint, ACategory);
Calling Environment
Os_LogTaskTracepointData
Os_LogTaskTracepointValue
Os_LogTracepoint
Os_LogTracepointData
Os_LogTracepointValue
Syntax
void Os_LogTaskTracepointData(
Os_TraceTracepointIDType TracepointID,
Os_TraceDataPtrType DataPtr,
Os_TraceDataLengthType Length,
Os_TraceCategoriesType CategoryMask
)
Parameters
Description
Log the task tracepoint event in the trace buffer and associate some data
with it.
Portability
Example
Os_LogTaskTracepointData(MyTracePoint, &DataBlock, 4, ACategory);
See Also
Os_LogTaskTracepoint
Os_LogTaskTracepointValue
Os_LogTracepoint
Os_LogTracepointData
Os_LogTracepointValue
Syntax
void Os_LogTaskTracepointValue(
Os_TraceTracepointIDType TracepointID,
Os_TraceValueType Value,
Os_TraceCategoriesType CategoryMask
)
Parameters
Description
Log the task tracepoint event in the trace buffer and associate a value with
it.
Portability
Example
Os_LogTaskTracepointValue(MyTracePoint, 99, ACategory);
Calling Environment
Os_LogTaskTracepoint
Os_LogTaskTracepointData
Os_LogTracepoint
Os_LogTracepointData
Os_LogTracepointValue
Syntax
void Os_LogTracepoint(
Os_TraceTracepointIDType TracepointID,
Os_TraceCategoriesType CategoryMask
)
Parameters
Description
Log the tracepoint event in the trace buffer.
Portability
Example
Os_LogTracepoint(MyTracepoint, ACategory);
Calling Environment
Os_LogTracepoint
Os_LogTracepointData
Os_LogTracepointData
Os_LogTracepointValue
Os_LogTracepointValue
Syntax
void Os_LogTracepointData(
Os_TraceTracepointIDType TracepointID,
Os_TraceDataPtrType DataPtr,
Os_TraceDataLengthType Length,
Os_TraceCategoriesType CategoryMask
)
Parameters
Description
Log the tracepoint event in the trace buffer and associate some data with it.
Portability
Example
Os_LogTracepointData(MyTracePoint, &DataBlock, 4, ACategory);
Calling Environment
Os_LogTracepoint
Os_LogTracepoint
Os_LogTracepointData
Os_LogTracepointValue
Os_LogTracepointValue
Syntax
void Os_LogTracepointValue(
Os_TraceTracepointIDType TracepointID,
Os_TraceValueType Value,
Os_TraceCategoriesType CategoryMask
)
Parameters
Description
Log the tracepoint event in the trace buffer and associate a value with it.
Portability
Example
Os_LogTracepointValue(MyTracePoint, 99, ACategory);
Calling Environment
Os_LogTracepoint
Os_LogTracepoint
Os_LogTracepointData
Os_LogTracepointData
Os_LogTracepointValue
Syntax
void Os_SetTraceRepeat(
boolean Repeat
)
Parameters
Description
When TRUE, bursting and triggering trace modes automatically restart once
the most recent trace content has been transmitted from the trace buffer to
the RTA-TRACE client.
Portability
Example
Os_SetTraceRepeat(TRUE);
Calling Environment
See Also
Os_StartBurstingTrace
Os_StartTriggeringTrace
Syntax
void Os_SetTriggerWindow(
Os_TraceIndexType Before,
Os_TraceIndexType After
)
Parameters
Description
This call sets the number of records to be recorded before and after a trigger
event.
When the trigger occurs, tracing events continue to be logged until After trace
records have been written to the trace buffer, and the data is then uploaded.
The total number of records uploaded (Before + After) is limited by the size
of the trace buffer.
Note that a trace event that contains data values may require multiple
records to be written to the trace buffer. This means that the number of
complete events seen before or after the trigger point may be less than the
number of records requested.
Portability
Example
extern FUNC(void, OS_APPL_CODE) StartupHook(){
...
Os_SetTriggerWindow(100,50);
Os_StartTriggeringTrace();
...
}
See Also
Os_StartBurstingTrace
Os_StartFreeRunningTrace
Syntax
void Os_StartBurstingTrace(void)
Description
Bursting trace mode logs trace information into the trace buffer until the
buffer is full. When the trace buffer is full, tracing stops and data transfer
begins. No attempt is made to upload data to the host until the trace buffer
has filled.
The trace buffer is cleared and tracing restarts again if this call is made while
tracing.
Portability
Example
extern FUNC(void, OS_APPL_CODE) StartupHook(){
...
Os_StartBurstingTrace();
...
}
Calling Environment
See Also
Os_SetTraceRepeat
Os_StartFreeRunningTrace
Os_StartTriggeringTrace
Syntax
void Os_StartFreeRunningTrace(void)
Description
Free running trace mode logs trace information while there is space in the
trace buffer. Data is uploaded to the host from the buffer as soon as it is
available, concurrently with capture.
If the trace buffer becomes full, logging of trace data is suspended until there
is space in the buffer. When space in the buffer is available again, tracing
resumes. The buffer might become full if the communications link is too slow
for the desired volume of trace data.
The trace buffer is cleared and tracing restarts again if this call is made while
tracing.
Portability
Example
extern FUNC(void, OS_APPL_CODE) StartupHook(){
...
Os_StartFreeRunningTrace();
...
}
Calling Environment
See Also
Os_StartBurstingTrace
Os_StartTriggeringTrace
Syntax
void Os_StartTriggeringTrace(void)
Description
Triggering trace mode logs trace information into the buffer continuously,
waiting for a trigger condition. If the buffer overflows, then new trace infor-
mation overwrites existing information.
When a triggering event occurs (for example, when a task starts execut-
ing), data collection continues until post-trigger number of trace records are
logged. Data transfer to the host then begins.
The trace buffer is cleared and tracing restarts again if this call is made while
tracing.
Portability
Example
extern FUNC(void, OS_APPL_CODE) StartupHook(){
...
Os_SetTriggerWindow(100,50);
Os_StartTriggeringTrace();
...
}
See Also
Os_SetTraceRepeat
Os_SetTriggerWindow
Os_StartBurstingTrace
Os_StartFreeRunningTrace
Syntax
void Os_StopTrace(void)
Description
Stops data logging to the trace buffer. Any data remaining in the trace buffer
is uploaded to the host.
Note that the call does not stop the data link.
Portability
Example
Os_StopTrace();
Calling Environment
See Also
Os_StartBurstingTrace
Os_StartFreeRunningTrace
Os_StartTriggeringTrace
Syntax
Os_TraceStatusType Os_TraceCommInit(void)
Return Values
The call returns values of type Os_TraceStatusType.
Description
This function is used to initialize a trace communications link. It should not
be used if you use a debugger link to extract trace data.
Portability
Example
extern FUNC(void, OS_APPL_CODE) StartupHook(){
...
Os_TraceCommInit();
Os_StartFreeRunningTrace();
...
}
Calling Environment
See Also
Os_Cbk_TraceCommInitTarget
Syntax
void Os_TraceDumpAsync(
Os_AsyncPushCallbackType fn
)
Description
This API is normally called in response to Os_Cbk_TraceCommDataReady(). It
gets passed a reference to a function that can transmit a single character. It
will call this function for each character that needs to be transmitted before
returning to the caller.
Portability
Example
FUNC(void, OS_APPL_CODE) push_async_io(uint8 val) {
while(!async_tx_ready) {/* wait for room */}
async_transmit(val) ;
}
FUNC(void, OS_APPL_CODE) Os_Cbk_TraceCommDataReady(void) {
Os_TraceDumpAsync(push_async_io);
}
Calling Environment
See Also
Os_Cbk_TraceCommDataReady
Syntax
void Os_TriggerNow(void)
Description
This API call forces a trigger condition to occur. This will cause the trace buffer
to be uploaded, regardless of any other trigger conditions.
The call does not modify the state of the trigger conditions.
Portability
Example
Os_TriggerNow();
Calling Environment
See Also
None.
Syntax
void Os_TriggerOnActivation(
TaskType TaskID
)
Parameters
Description
Causes a trace trigger to occur when specified task is activated.
The trigger will occur when a task is activated through ActivateTask, StartOS,
Alarms or ScheduleTables.
Portability
Example
Os_TriggerOnActivation(InterestingTask);
Calling Environment
See Also
Os_TriggerOnChain
Syntax
void Os_TriggerOnAdvanceCounter(
CounterType CounterID
)
Parameters
Description
Causes a trace trigger to occur when a specified hardware counter is ad-
vanced.
Portability
Example
Os_TriggerOnAdvanceCounter(HWCounter);
Calling Environment
See Also
Os_TriggerOnIncrementCounter
Syntax
void Os_TriggerOnAlarmExpiry(
AlarmType AlarmID
)
Parameters
Description
Causes a trace trigger to occur when a specified alarm expires.
Portability
Example
Os_TriggerOnAlarmExpiry(Alarm_10ms);
Calling Environment
See Also
None.
Syntax
void Os_TriggerOnCat1ISRStart(
ISRType ISRID
)
Parameters
Description
Causes a trace trigger to occur when a specified Category 1 ISR starts run-
ning.
ISRID can be set to OS_TRIGGER_ANY, in which case any such ISR will cause
the trigger to occur.
Note that Category 1 ISRs are not controlled by RTA-OS, so you are respon-
sible for calling Os_LogCat1ISRStart() at the beginning of your interrupt han-
dler.
Portability
Example
Os_TriggerOnCat1ISRStart(InterestingCat1ISR);
Calling Environment
See Also
Os_LogCat1ISREnd
Os_TriggerOnCat1ISRStop
Syntax
void Os_TriggerOnCat1ISRStop(
ISRType ISRID
)
Parameters
Description
Causes a trace trigger to occur when a specified Category 1 ISR stops run-
ning.
ISRID can be set to OS_TRIGGER_ANY, in which case any such ISR will cause
the trigger to occur.
Note that Category 1 ISRs are not controlled by RTA-OS, so you are responsi-
ble for calling Os_LogCat1ISREnd() at the end of your interrupt handler.
Portability
Example
Os_TriggerOnCat1ISRStop(InterestingCat1ISR);
Calling Environment
See Also
Os_LogCat1ISREnd
Os_LogCat1ISRStart
Os_TriggerOnCat1ISRStart
Syntax
void Os_TriggerOnCat2ISRStart(
ISRType ISRID
)
Parameters
Description
Causes a trace trigger to occur when a specified Category 2 ISR starts run-
ning.
ISRID can be set to OS_TRIGGER_ANY, in which case any such ISR will cause
the trigger to occur.
Portability
Example
Os_TriggerOnCat2ISRStart(InterestingCat2ISR);
Calling Environment
See Also
Os_TriggerOnCat2ISRStop
Syntax
void Os_TriggerOnCat2ISRStop(
ISRType ISRID
)
Parameters
Description
Causes a trace trigger to occur when a specified Category 2 ISR stops run-
ning.
ISRID can be set to OS_TRIGGER_ANY, in which case any such ISR will cause
the trigger to occur.
Portability
Example
Os_TriggerOnCat2ISRStop(InterestingCat2ISR);
Calling Environment
See Also
Os_TriggerOnCat2ISRStart
Syntax
void Os_TriggerOnChain(
TaskType TaskID
)
Parameters
Description
Causes a trace trigger to occur when an attempt is made to chain a specified
task. (Noting that chain attempts can fail.)
TaskID can be set to OS_TRIGGER_ANY, in which case chaining of any task will
cause the trigger to occur.
Portability
Example
Os_TriggerOnChain(InterestingTask);
Calling Environment
See Also
Os_TriggerOnActivation
Syntax
void Os_TriggerOnError(
StatusType Error
)
Parameters
Description
Causes a trace trigger to occur when a specified error is raised.
Error can be set to OS_TRIGGER_ANY, in which case any error will cause the
trigger to occur.
Portability
Example
Os_TriggerOnError(E_OS_LIMIT);
Calling Environment
See Also
None.
Syntax
void Os_TriggerOnGetResource(
ResourceType ResourceID
)
Parameters
Description
Causes a trace trigger to occur when a specified resource is locked.
Portability
Example
Os_TriggerOnGetResource(CriticalSection);
Calling Environment
See Also
Os_TriggerOnReleaseResource
Syntax
void Os_TriggerOnIncrementCounter(
CounterType CounterID
)
Parameters
Description
Causes a trace trigger to occur when a specified counter is incremented.
Portability
Example
Os_TriggerOnIncrementCounter(SWCounter);
Calling Environment
See Also
Os_TriggerOnAdvanceCounter
Syntax
void Os_TriggerOnIntervalEnd(
Os_TraceIntervalIDType IntervalID
)
Parameters
Description
Causes a trace trigger to occur when a specified interval ends.
IntervalID can be set to OS_TRIGGER_ANY, in which case any interval end will
cause the trigger to occur.
Portability
Example
Os_TriggerOnIntervalEnd(EndToEndTimeMeasurement);
Calling Environment
See Also
Os_TriggerOnIntervalStart
Os_TriggerOnIntervalStop
Syntax
void Os_TriggerOnIntervalStart(
Os_TraceIntervalIDType IntervalID
)
Parameters
Description
Causes a trace trigger to occur when a specified interval starts.
Portability
Example
Os_TriggerOnIntervalStart(EndToEndTimeMeasurement);
See Also
Os_TriggerOnIntervalEnd
Os_TriggerOnIntervalStop
Syntax
void Os_TriggerOnIntervalStop(
Os_TraceIntervalIDType IntervalID
)
Parameters
Description
This call is a synonym for Os_TriggerOnIntervalEnd.
IntervalID can be set to OS_TRIGGER_ANY, in which case any interval end will
cause the trigger to occur.
Portability
Example
Os_TriggerOnIntervalStop(EndToEndTimeMeasurement);
Calling Environment
See Also
Os_TriggerOnIntervalEnd
Syntax
void Os_TriggerOnReleaseResource(
ResourceType ResourceID
)
Parameters
Description
Causes a trace trigger to occur when a specified resource is unlocked.
Portability
Example
Os_TriggerOnReleaseResource(CriticalSection);
Calling Environment
See Also
Os_TriggerOnGetResource
Syntax
void Os_TriggerOnScheduleTableExpiry(
ExpiryID
)
Parameters
Description
Causes a trace trigger to occur when a specific expiry point is reached.
ExpiryID can be set to OS_TRIGGER_ANY, in which case any expiry *or alarm*
will cause the trigger to occur.
Portability
Example
StartScheduleTableRel(SchedTable, 1);
Os_TriggerOnScheduleTableExpiry(SchedTable_ep1);
IncrementCounter(SystemCounter);
...
Calling Environment
See Also
None.
Syntax
void Os_TriggerOnSetEvent(
TaskType TaskID
)
Parameters
Description
Causes a trace trigger to occur when an event is set for a specified task.
TaskID can be set to OS_TRIGGER_ANY, in which case any event setting will
cause the trigger to occur.
Portability
Example
Os_TriggerOnSetEvent(ExtendedTask);
Calling Environment
See Also
None.
Syntax
void Os_TriggerOnShutdown(
StatusType Status
)
Parameters
Description
Causes a trace trigger to occur when a specific status is passed to Shut-
downOS.
Portability
Example
Os_TriggerOnShutdown(E_OK); /* Trigger on normal shutdown */
Calling Environment
See Also
ShutdownOS
Syntax
void Os_TriggerOnTaskStart(
TaskType TaskID
)
Parameters
Description
Causes a trace trigger to occur when a specified task starts running.
TaskID can be set to OS_TRIGGER_ANY, in which case any task start will cause
the trigger to occur.
Note that a TaskID is started when its entry function is called, or when it
resumes from the WAITING state.
Portability
Example
Os_TriggerOnTaskStart(InterestingTask);
Calling Environment
See Also
Os_TriggerOnTaskStop
Syntax
void Os_TriggerOnTaskStop(
TaskType TaskID
)
Parameters
Description
Causes a trace trigger to occur when a specified task stops running.
TaskID can be set to OS_TRIGGER_ANY, in which case any task stop will cause
the trigger to occur.
Note that a TaskID is stopped when its entry function is called, or when it
enters the WAITING state.
Portability
Example
Os_TriggerOnTaskStop(InterestingTask);
Calling Environment
See Also
Os_TriggerOnTaskStart
Syntax
void Os_TriggerOnTaskTracepoint(
Os_TraceTracepointIDType TaskTracepointID,
TaskType TaskID
)
Parameters
Description
Causes a trace trigger to occur when a specified task-tracepoint for a speci-
fied task is logged.
Portability
Example
Os_TriggerOnTaskTracepoint(MyTaskTracepoint,InterestingTask);
Calling Environment
See Also
Os_TriggerOnTracepoint
Syntax
void Os_TriggerOnTracepoint(
Os_TraceTracepointIDType TracepointID
)
Parameters
Description
Causes a trace trigger to occur when a specified tracepoint is logged.
Portability
Example
Os_TriggerOnTracepoint(MyTracepoint);
Calling Environment
See Also
Os_TriggerOnTaskTracepoint
Syntax
void Os_UploadTraceData(void)
Description
This API is responsible for sending individual bytes of trace data over a serial
communications link. It uses callbacks into the application code to manage
access to the actual communications link.
As a special case in interrupt mode, this function should be called from the
Os_Cbk_TraceCommDataReady() callback and the transmit-interrupt handler.
Portability
Example
/* This callback occurs when a new frame is ready for upload */
FUNC(void, OS_APPL_CODE) Os_Cbk_TraceCommDataReady(void) {
Os_UploadTraceData(); /* Causes call to
Os_Cbk_TraceCommTxStart() */
}
ISR(asyncio) {
Os_UploadTraceData();
}
FUNC(void, OS_APPL_CODE) Os_Cbk_TraceCommTxStart(void) {
/* Called from UploadTraceData when the first byte of a frame
is ready to send.
* It is immediately followed by a call to
Os_Cbk_TraceCommTxByte().
* In interrupt mode, this is used to enable the transmit
interrupt.
*/
enable_asyncio_interrupt();
}
FUNC(void, OS_APPL_CODE) Os_Cbk_TraceCommTxByte(uint8 val) {
Calling Environment
See Also
Os_Cbk_TraceCommDataReady
Os_Cbk_TraceCommTxByte
Os_Cbk_TraceCommTxEnd
Os_Cbk_TraceCommTxReady
Os_Cbk_TraceCommTxStart
Os_CheckTraceOutput
Syntax
/* C function prototype for the callback */
ReturnValue NameOfCallback(Parameter Type, ...)
Parameters
A list of parameters for each callback and their mode:
out The parameter is passed out of the API callback by passing a reference
(pointer) to the parameter into the call.
inout The parameter is passed into the callback and then (updated) and
passed out.
Return Values
A description of the return value of the callback,
Description
A detailed description of the required functionality of the callback.
Portability
The portability of the call between OSEK OS, AUTOSAR OS, RTA-OS3.x and
RTA-TRACE.
Example Code
A C code listing showing how to implement the callback.
Configuration Condition
The configuration of RTA-TRACE that requires user code to implement the call-
back.
See Also
A list of related callbacks.
Syntax
FUNC(void, OS_APPL_CODE) Os_Cbk_TraceCommDataReady(void)
Description
When tracing in Bursting or Triggering modes, this gets called automatically
when there is a new frame of data to be uploaded to RTA-TRACE.
Portability
Example
FUNC(void, OS_APPL_CODE) Os_Cbk_TraceCommDataReady(void) {
Os_UploadTraceData(); /* Causes call to
Os_Cbk_TraceCommTxStart() */
}
Configuration Condition
The callback may be provided if a communications link is used with tracing.
A default version is present in the kernel library.
See Also
Os_UploadTraceData
Os_CheckTraceOutput
Os_Cbk_TraceCommTxStart
Os_Cbk_TraceCommTxByte
Os_Cbk_TraceCommTxEnd
Os_Cbk_TraceCommTxReady
Syntax
FUNC(Os_TraceStatusType, OS_APPL_CODE)
Os_Cbk_TraceCommInitTarget(void)
Return Values
The call returns values of type Os_TraceStatusType.
Description
Os_Cbk_TraceCommInitTarget supports the Os_TraceCommInit by providing
application-specific code to initialize the communication link to RTA-TRACE.
Typically it sets up an RS232 link.
E_OK should be returned if the initialization succeeded. Any other value will
result in trace communication being disabled.
Portability
Example
FUNC(Os_TraceStatusType, OS_APPL_CODE)
Os_Cbk_TraceCommInitTarget(void){
initialize_uart();
return E_OK;
}
Configuration Condition
The callback must be provided if Os_TraceCommInit is used to initialize trac-
ing using an external communications link.
See Also
Os_TraceCommInit
Syntax
FUNC(void, OS_APPL_CODE) Os_Cbk_TraceCommTxByte(
uint8 val
)
Description
This is called from UploadTraceData when there is a byte of data to send.
Portability
Example
FUNC(void, OS_APPL_CODE) Os_Cbk_TraceCommTxByte(uint8 val) {
/* Called from UploadTraceData when there is a byte ready to
send */
async_transmit(val);
}
Configuration Condition
The callback must be provided if Os_UploadTraceData is used.
See Also
Os_UploadTraceData
Os_CheckTraceOutput
Os_Cbk_TraceCommDataReady
Os_Cbk_TraceCommTxStart
Os_Cbk_TraceCommTxEnd
Os_Cbk_TraceCommTxReady
Syntax
FUNC(void, OS_APPL_CODE) Os_Cbk_TraceCommTxEnd(void)
Description
This is called from UploadTraceData when the last byte of a frame has been
sent.
Portability
Example
FUNC(void, OS_APPL_CODE) Os_Cbk_TraceCommTxEnd(void) {
disable_asyncio_interrupt();
}
Configuration Condition
The callback must be provided if Os_UploadTraceData is used.
See Also
Os_UploadTraceData
Os_CheckTraceOutput
Os_Cbk_TraceCommDataReady
Os_Cbk_TraceCommTxStart
Os_Cbk_TraceCommTxByte
Os_Cbk_TraceCommTxReady
Syntax
FUNC(boolean, OS_APPL_CODE) Os_Cbk_TraceCommTxReady(void)
Return Values
The call returns values of type boolean.
Description
This is called from UploadTraceData to determine whether there is room in
the transmit buffer to send the next byte.
This should always return true in interrupt mode, because the interrupt
should only fire when there is room to send the next byte.
Portability
Example
FUNC(boolean, OS_APPL_CODE) Os_Cbk_TraceCommTxReady(void) {
return async_tx_ready();
}
Configuration Condition
The callback must be provided if Os_UploadTraceData is used.
See Also
Os_UploadTraceData
Os_CheckTraceOutput
Os_Cbk_TraceCommDataReady
Os_Cbk_TraceCommTxStart
Os_Cbk_TraceCommTxByte
Os_Cbk_TraceCommTxEnd
Syntax
FUNC(void, OS_APPL_CODE) Os_Cbk_TraceCommTxStart(void)
Description
This is called from UploadTraceData when the first byte of a frame is ready to
send.
Portability
Example
FUNC(void, OS_APPL_CODE) Os_Cbk_TraceCommTxStart(void) {
enable_asyncio_interrupt();
}
Configuration Condition
The callback must be provided if Os_UploadTraceData is used.
See Also
Os_UploadTraceData
Os_CheckTraceOutput
Os_Cbk_TraceCommDataReady
Os_Cbk_TraceCommTxByte
Os_Cbk_TraceCommTxEnd
Os_Cbk_TraceCommTxReady
8.1 Os_AsyncPushCallbackType
Type that represents a pointer to a void function that gets passed a single
uint8 value. Used by Os_TraceDumpAsync()
Portability
8.2 Os_TraceCategoriesType
Type that is used to contain mask values relating to user-defined trace filter
categories. An all and a non category are defined by default.
Portability
Values
OS_TRACE_NO_CATEGORIES
OS_TRACE_ALL_CATEGORIES
Example
Os_TraceCategoriesType ExtraTracing = DebugTracePoints |
DataLogTracePoints;
8.3 Os_TraceClassesType
Type that is used to contain mask values relating to trace filter classes.
Portability
OS_TRACE_ACTIVATIONS_CLASS
OS_TRACE_RESOURCES_CLASS
OS_TRACE_INTERRUPT_LOCKS_CLASS
OS_TRACE_SWITCHING_OVERHEADS_CLASS
OS_TRACE_TASKS_AND_ISRS_CLASS
OS_TRACE_ERRORS_CLASS
OS_TRACE_TASK_TRACEPOINT_CLASS
OS_TRACE_TRACEPOINT_CLASS
OS_TRACE_INTERVALS_CLASS
OS_TRACE_MESSAGE_DATA_CLASS
OS_TRACE_STARTUP_AND_SHUTDOWN_CLASS
OS_TRACE_ALARMS_CLASS
OS_TRACE_SCHEDULETABLES_CLASS
OS_TRACE_OSEK_EVENTS_CLASS
OS_TRACE_EXPIRY_POINTS_CLASS
OS_TRACE_NO_CLASSES
OS_TRACE_ALL_CLASSES
Example
Os_TraceClassesType AllTracepoints = OS_TRACE_TRACEPOINT_CLASS |
OS_TRACE_TASK_TRACEPOINT_CLASS;
8.4 Os_TraceDataLengthType
The length of a data block (in bytes).
Portability
Example
Os_TraceDataLengthType BlockLength = 8;
8.5 Os_TraceDataPtrType
A pointer to a block of data to log at a trace point or interval.
Portability
8.6 Os_TraceExpiryIDType
Enumerated type that defines Expiry points.
Portability
Values
The names of expiry points. These are generated using the pattern <sched-
uletable_name>_<expiry_name>.
8.7 Os_TraceIndexType
An unsigned integer value of at least 16 bits representing a number of trace
records.
Portability
Example
Os_TraceIndexType PreTriggerRecords = 100;
8.8 Os_TraceInfoType
An unsigned integer value representing a traced object.
Portability
8.9 Os_TraceIntervalIDType
Enumerated type that defines RTA-TRACE trace intervals.
Portability
8.10 Os_TraceStatusType
Type containing the status of a trace API call.
Portability
Values
OS_TRACE_STATUS_OK
OS_TRACE_STATUS_COMM_INIT_FAILURE
8.11 Os_TraceTracepointIDType
Enumerated type that defines RTA-TRACE tracepoints.
Portability
Values
The names of user defined trace points.
8.12 Os_TraceValueType
An unsigned integer value representing either 16 or 32 bits depending on the
configuration of compact time.
Portability
9.1 OS_NUM_INTERVALS
The number of Trace Intervals declared.
Portability
9.2 OS_NUM_TASKTRACEPOINTS
The number of TaskTracepoints declared.
Portability
9.3 OS_NUM_TRACECATEGORIES
The number of Trace Categories declared.
Portability
9.4 OS_NUM_TRACEPOINTS
The number of Tracepoints declared.
Portability
9.5 OS_TRACE
This macro is only defined if tracing is enabled.
Portability
Example
#ifdef OS_TRACE
...
#endif
10.1 Namespace
The C programming language provides a single global scope for all names.
This prevents any two names declared in an entire program code from be-
ing identical even if the names are declared in different compilation units.
The AUTOSAR standard defines a naming convention for every basic soft-
ware module to avoid problems with namespace clashes. This is defined by
the “AUTOSAR General Requirements on Basic Software Modules”. RTA-OS3.x
has been implemented to satisfy these requirements. The namespace used
by RTA-OS3.x therefore reserves all names that are prefixed by:
• OS*
• Os*
Note however, that the interface provided by AUTOSAR OS R3.x does not
comply with the AUTOSAR naming convention. This means that the names
used by AUTOSAR OS R3.x for types, API calls, macros, constants, callbacks
etc. are also reserved names and should not be duplicated in user code
The two forms can be used interchangeably in user code if required, but only
the second form represents standard AUTOSAR OS R3.x API.
Every AUTOSAR XML file needs to reference the AUTOSAR schema instance
that defines the structure of the XML elements for AUTOSAR XML files. In the
simple case this is done as follows:
If you need to mix AUTOSAR and non-AUTOSAR content within the same file
then it is recommended that you use autosar as the namespace identifier.
This is done as follows:
In this case, all elements must now occur between <autosar:AUTOSAR> and
</autosar:AUTOSAR> have the form <autosar:TAG-NAME>.
<AUTOSAR>
<TOP-LEVEL-PACKAGES>
<AR-PACKAGE>
<SHORT-NAME>MyPackage</SHORT-NAME>
<DESC>This is one of my packages</DESC>
</AR-PACKAGE>
...
<AR-PACKAGE>
<SHORT-NAME>MyOtherPackage</SHORT-NAME>
<DESC>This is another</DESC>
</AR-PACKAGE>
</TOP-LEVEL-PACKAGES>
</AUTOSAR>
Rather than define a dedicated set of XML tags for the configuration of
each basic software module, the ECU configuration description defines a
<MODULE-CONFIGURATION> that contains CONTAINERS that hold configuration
data in a <CONTAINER>.
By default, references are rooted at /AUTOSAR. For the OS there are things
like:
• /AUTOSAR/Os/OsTask/OsTaskPriority
• /AUTOSAR/Os/OsResource
• /AUTOSAR/Os/OsIsr
<ELEMENTS>
<MODULE-CONFIGURATION>
<SHORT-NAME>MyOSConfiguration</SHORT-NAME>
<DEFINITION-REF>/AUTOSAR/Os</DEFINITION-REF>
<CONTAINERS>
<!-- Configuration containers -->
<CONTAINER>
<SHORT-NAME>MyTask</SHORT-NAME>
<DEFINITION-REF>/AUTOSAR/Os/OsTask</DEFINITION-REF>
<!-- Parameters (or sub-containers) as defined by the
DEFINITION-REF -->
<PARAMETER-VALUES>
<INTEGER-VALUE>
<DEFINITION-REF DEST="INTEGER-PARAM-DEF">/
AUTOSAR/Os/OsTask/OsTaskPriority</DEFINITION
-REF>
<VALUE>27</VALUE>
</INTEGER-VALUE>
<INTEGER-VALUE>
The AUTOSAR <PACKAGE> name for the VSMD must not be AUTOSAR so
that tools can distinguish between standard configuration and vendor-
specific configuration. In RTA-OS3.x, the VSMD <PACKAGE> is called
RTAOS and all references to RTA-OS configuration objects have the form
/RTAOS/path to configuration element. References to standard AU-
TOSAR objects retain the form /AUTOSAR/path to configuration element.
For example:
<CONTAINER>
<PARAMETER-VALUES>
<!-- Standard AUTOSAR configuration parameters -->
<ENUMERATION-VALUE>
<DEFINITION-REF DEST="ENUMERATION-PARAM-DEF">/AUTOSAR/Os/
OsOS/OsStatus</DEFINITION-REF>
<VALUE>...</VALUE>
</ENUMERATION-VALUE>
<ENUMERATION-VALUE>
<DEFINITION-REF DEST="ENUMERATION-PARAM-DEF">/AUTOSAR/Os/
OsOS/OsScalabilityClass</DEFINITION-REF>
<VALUE>...</VALUE>
</ENUMERATION-VALUE>
<BOOLEAN-VALUE>
<DEFINITION-REF DEST="BOOLEAN-PARAM-DEF">/AUTOSAR/Os/OsOS
/OsStackMonitoring</DEFINITION-REF>
<VALUE>...</VALUE>
</BOOLEAN-VALUE>
<!-- ... -->
Integer Parameters
Description
Parameters to represent a specific piece of target hardware.
Multiplicity
0..1
String Parameters
Sub-container: Param
Description
Target-specific parameter representation.
Multiplicity
0..*
String Parameters
Enumeration Parameters
Integer Parameters
String Parameters
Reference Parameters
Boolean Parameters
Integer Parameters
String Parameters
Sub-container: Param
Description
Representation of parameters
Multiplicity
0..*
String Parameters
Sub-container: OsHooks
Boolean Parameters
Description
Target specific register sets that can be associated with a task or ISR. By
association with a task or ISR, the integrator is specifying that a specific task
or ISR uses this register set. Having no association defined allows potential
optimization.
Multiplicity
0..*
Enumeration Parameters
String Parameters
Reference Parameters
Description
RTA-TRACE Data
Boolean Parameters
Enumeration Parameters
Integer Parameters
Sub-container: OsEnumeration
Description
Specifies an enumeration for tracing.
Multiplicity
0..*
Multiplicity
0..*
String Parameters
Sub-container: OsTraceTracepoint
Description
Specifies a tracepoint
Multiplicity
0..*
Integer Parameters
String Parameters
Sub-container: OsTraceTaskTracepoint
Description
Specifies a task tracepoint
Multiplicity
0..*
Integer Parameters
Reference Parameters
Sub-container: OsInterval
Description
Specifies a named interval.
Multiplicity
0..*
Integer Parameters
String Parameters
Sub-container: Param
Description
Representation of name-value pairs
Multiplicity
0..*
String Parameters
Description
Specifies an unnamed trace class.
Multiplicity
0..*
Boolean Parameters
Enumeration Parameters
Sub-container: OsCategory
Description
Specifies a named trace class.
Multiplicity
0..*
Boolean Parameters
Integer Parameters
Project files are specific to the RTA-OS3.x tools and may not be portable
to third party AUTOSAR tooling.
The tools shipped with RTA-OS3.x can be invoked from the command line,
making them easy to integrate into a build process. All commands accept any
number of XML input files together with tool-specific options as parameters.
The ordering of command line parameters is unimportant: options and XML
files can be mixed freely.
Some command line options can be specified using either short or long
(POSIX style) names. The two options forms provide identical functionality
and can be used interchangeably.
When a command line option takes an argument, the argument appears im-
mediately following short name options and after a colon following long name
options. For example, an option with argument arg could appear as either
The two forms are equivalent and can be mixed on the command line.
12.1 rtaoscfg
The command rtaoscfg runs the graphical RTA-OS3.x configuration editor.
12.1.1 Options
Option Description
@<FILE> Read command line parameters from
<FILE>. Each command in <FILE>
must appear on a separate. Quo-
tation marks are not required to es-
cape white space for filenames inside
a command file. The @<FILE> option
can itself appear multiple times inside
<FILE>.
1. STANDARD
2. EXTENDED
rtaoscfg does not generate any files directly. When the Builder is used in
rtaoscfg this calls rtaosgen. See Section 12.2.2 for details of the files gener-
ated by rtaosgen.
12.1.3 Examples
12.2 rtaosgen
The command rtaosgen runs the RTA-OS3.x kernel library generator.
12.2.1 Options
Option Description
@<FILE> Read command line parameters from
<FILE>. Each command in <FILE>
must appear on a separate. Quo-
tation marks are not required to es-
cape white space for filenames inside
a command file. The @<FILE> option
can itself appear multiple times inside
<FILE>.
--build:<OPTION> Pass <OPTION> to the build environ-
ment. <OPTION> may be one of:
1
Keeping source code is only possible with a valid source code license
1. STANDARD
2. EXTENDED
When rtaosgen runs and terminates without generating any errors or fatal
messages then it will have generated the following files:
There may be other files which are generated that are specific to your port. A
list of additional files that can be generated can be found in the Target/Com-
piler Port Guide for your port.
12.2.3 Examples
List which sample files can be generated for the ManchesterMk1 target:
rtaosgen --target:ManchesterMk1 --samples:?
For example, the OS has a RUNNINGTASK attribute that shows the task that is
currently running.
The following sections present the ORTI objects generated. Each section has
the following structure:
Object
Name of the ORTI object
Description
A description of the ORTI object.
Attributes
The attributes for the ORTI object.
Attribute Description
Attribute Name Attribute ORTI file description - Description of attribute
Each row of the table names the attribute being described and gives a brief
explanation of it. The name of each attribute is given in the Attribute column.
Attributes that are prefix with vs_ have been added for RTA-OS3.x support
and are not standard ORTI attributes. Your debugger may or may not be able
to display these attributes depending on how well it conforms to the ORTI
standard.
13.2.1 OS
Object
OS
Description
There is only one OS object. It takes the name of the RTA-OS3.x project.
Attributes
Attribute Description
RUNNINGTASK Running task - The name of the TASK
that is currently running. If an ISR in-
terrupts a task this attribute will con-
tinue to display the name of the task
that was interrupted while the ISR is
executing.
RUNNINGTASKPRIORITY Running task priority - The current pri-
ority of the running task, using the
same terms as in the OIL file. RUN-
NINGTASKPRIORITY does not show the
effect of locking a resource shared by
tasks and ISRs.
RUNNINGISR2 Running cat 2 ISR - The value of this
attribute is the name of the Category
2 ISR that is currently running (if there
is one). NO_ISR is displayed if no Cat-
egory 2 ISR is currently running.
SERVICETRACE OS Services Watch- Indicates the en-
try or exit of a service routine (an RTA-
OS3.x Component API call) and the
name of this routine. Some debug-
gers recognize this attribute as a spe-
cial trace attribute and can provide ad-
ditional diagnostic support. On other
debuggers, you will be shown which
API call was most recently entered or
completed.
LASTERROR Last OSEK error - Gives the name of
the last error that has occurred. Ini-
tially set to E_OK.
13.2.2 Task
Object
TASK
Description
Generated in response to task declarations in the configuration file.
Attributes
Attribute Description
STATE State - The task state. One of SUS-
PENDED, RUNNING, READY and WAIT-
ING.
vs_BASEPRIORITY Base priority - Gives the base priority
of the task. The base priority is the pri-
ority of the task as defined in the OIL
file.
PRIORITY Dispatch priority - Gives the dispatch
priority of the task. The dispatch pri-
ority is the priority that the task starts
running at. This can be higher than the
base priority if internal resources are
used or if the task is non-preemptable.
CURRENTACTIVATIONS Activations - Gives the maximum num-
ber of activations allowed.
Object
RESOURCE
Description
Generated in response to resource declarations in the configuration file.
Attributes
Attribute Description
PRIORITY Ceiling Priority - Gives the ceiling prior-
ity of the resource in terms of the task
priority that defines the ceiling.
LOCKER Resource locker - Shows the current
holder of the resource.
STATE Resource State - Shows the state of
the resource as locked or not locked.
13.2.6 Events
13.2.7 Counter
13.2.8 Alarm
Object
ALARM
Description
Only generated in response to alarm declarations in the configuration file.
Attributes
Attribute Description
ALARMTIME Alarm Time - Shows when the alarm
expires next. Refer to the Count value
in the COUNTER object to establish the
current count value.
CYCLETIME Cycle Time - Gives the period of the cy-
cle for a cyclic alarm. CYCLETIME will
be zero for a single-shot alarm.
• Activate a task.
• Set an event.
Object
SCHEDULETABLE
Description
Only generated in response to alarm declarations in the configuration file.
Attributes
Attribute Description
COUNTER Counter - Gives the name of the
counter to which this alarm is at-
tached.
STATE State - Indicates the state of the
schedule table.
EXPIRYTIME Expiry Time - The tick at which the
next expiry point is due to be pro-
cessed.
NEXT Next table - The next schedule table (if
set).
This chapter provides compatibility information for RTA-OS3.x with other ETAS
tooling and outlines the major changes between RTA-OS3.x and the earlier
RTA-OSEK series of operating systems to assist users migrating to RTA-OS3.x.
3 Fully compatible
3 Partially compatible, see the notes for more details
7 Not compatible
1. OSEK API calls are portable with the exceptions which have slightly
modified behavior in AUTOSAR OS:
• All API calls, types and variables are prefixed Os_. For example:
LogTracepoint(MyTracepoint)
becomes
Os_LogTracepoint(MyTracepoint).
becomes
OS_TRACE_ERRORS_CLASS.
5. ASCET uses non-OSEK calls from the ERCOSEK API and is therefore not
compatible with RTA-OS3.x.
6. ASCET uses the RTA-OSEK API such that generated code is compatible
with RTA-OS3.x. The generated OIL file is not compatible with RTA-OS3.x
and will need to be converted to XML.
RTA-OSEK v4.x
RTA-OSEK v5.x
See Section
RTA-OS3.x
API call
ActivateTask 3 3 3 3 3 3 3 3 3
ActivateTaskset 3 3 14.2.1
AdvanceSchedule 3 3 14.2.3
AssignTaskset 3 3 14.2.1
CallTrustedFunction 3 3 3
CancelAlarm 3 3 3 3 3 3 3 3 3
ChainTask 3 3 3 3 3 3 3 3 3
ChainTaskset 3 3 14.2.1
CheckISRMemoryAccess 3 3 3
CheckObjectAccess 3 3 3
CheckObjectOwnership 3 3 3
CheckTaskMemoryAccess 3 3 3
ClearEvent 3 3 3 3 3 3 3 3 3
CloseCOM 3 3 3 3 14.2.4
DisableAllInterrupts 3 3 3 3 3 3 3 3 3
EnableAllInterrupts 3 3 3 3 3 3 3 3 3
GetActiveApplicationMode 3 3 3 3 3 3 3 3 3
GetAlarm 3 3 3 3 3 3 3 3 3
GetAlarmBase 3 3 3 3 3 3 3 3 3
GetApplicationID 3 3 3
GetArrivalpointDelay 3 3 14.2.3
GetArrivalpointNext 3 3 14.2.3
GetArrivalpointTasksetRef 3 3 14.2.3
GetCounterValue 3 3 3 3 3 3 3
GetElapsedCounterValue 3 3 3 3 3
GetEvent 3 3 3 3 3 3 3 3 3
GetExecutionTime 3 3 14.2.2
GetISRID 3 3 3 3 3 3 3
GetLargestExecutionTime 3 3 14.2.2
GetMessageResource 3 3 3 3 14.2.4
GetMessageStatus 3 3 3 3 14.2.4
GetResource 3 3 3 3 3 3 3 3 3
GetScheduleNext 3 3 14.2.3
GetScheduleStatus 3 3 14.2.3
GetScheduleTableStatus 3 3 3 3 3 3 3 3
GetScheduleValue 3 3 14.2.3
GetStackOffset 3 3 14.2.11
GetTaskID 3 3 3 3 3 3 3 3 3
GetTasksetRef 3 3 14.2.1
GetTaskState 3 3 3 3 3 3 3 3 3
IncrementCounter 3 3 3 3 3 3 3
RTA-OSEK v4.x
RTA-OSEK v5.x
See Section
RTA-OS3.x
API call
InitCOM 3 3 3 3 14.2.4
InitCounter 3
MergeTaskset 3 3 14.2.1
NextScheduleTable 3 3 3 3 3 3 3
Os_AdvanceCounter 3
Os_GetExecutionTime 3 14.2.2
Os_GetISRMaxExecutionTime 3 14.2.2
Os_GetISRMaxStackUsage 3 14.2.11
Os_GetStackUsage 3 14.2.11
Os_GetStackValue 3 14.2.11
Os_GetTaskMaxExecutionTime 3 14.2.2
Os_GetTaskMaxStackUsage 3 14.2.11
Os_ResetISRMaxExecutionTime 3 14.2.2
Os_ResetISRMaxStackUsage 3 14.2.11
Os_ResetTaskMaxExecutionTime 3 14.2.2
Os_ResetTaskMaxStackUsage 3 14.2.11
Os_Restart 3
Os_SetRestartPoint 3
osAdvanceCounter 3 14.2.7
osResetOS 3 14.2.12
ReadFlag 3 3 3 3 14.2.4
ReceiveMessage 3 3 3 3 14.2.4
ReleaseMessageResource 3 3 3 3 14.2.4
ReleaseResource 3 3 3 3 3 3 3 3 3
RemoveTaskset 3 3 14.2.1
ResetFlag 3 3 3 3 14.2.4
ResetLargestExecutionTime 3 3 14.2.2
ResumeAllInterrupts 3 3 3 3 3 3 3 3 3
ResumeOSInterrupts 3 3 3 3 3 3 3 3 3
Schedule 3 3 3 3 3 3 3 3 3
SendMessage 3 3 3 3 14.2.4
SetAbsAlarm 3 3 3 3 3 3 3 3 3
SetArrivalpointDelay 3 3 14.2.3
SetArrivalpointNext 3 3 14.2.3
SetEvent 3 3 3 3 3 3 3 3 3
SetRelAlarm 3 3 3 3 3 3 3 3 3 14.2.8
SetScheduleNext 3 3
SetScheduleTableAsync 3 3 3
ShutdownOS 3 3 3 3 3 3 3 3 3 14.2.6
StartCOM 3 3 3 3 14.2.4
StartOS 3 3 3 3 3 3 3 3 3 14.2.5
StartSchedule 3 3 14.2.3
RTA-OSEK v4.x
RTA-OSEK v5.x
See Section
RTA-OS3.x
API call
StartScheduleTable 3 3 14.2.9
StartScheduleTableAbs 3 3 3 3 3
StartScheduleTableRel 3 3 3 3 3
StartScheduleTableSynchron 3 3 3
StopCOM 3 3 3 3 14.2.4
StopSchedule 3 3 14.2.3
StopScheduleTable 3 3 3 3 3 3 3
SuspendAllInterrupts 3 3 3 3 3 3 3 3 3
SuspendOSInterrupts 3 3 3 3 3 3 3 3 3
SyncScheduleTable 3 3 3
TerminateApplication 3 3 3
TerminateTask 3 3 3 3 3 3 3 3 3
TestArrivalpointWriteable 3 3 14.2.3
TestEquivalentTaskset 3 3 14.2.1
TestSubTaskset 3 3 14.2.1
Tick_<CounterID> 3 3 14.2.10
TickSchedule 3 3 14.2.3
WaitEvent 3 3 3 3 3 3 3 3 3
14.2.1 Tasksets
The RTA-OSEK timing build is replaced by the configuration option ‘Time Moni-
toring’. This provides means that it is possible to use EXTENDED status without
needing to provide stub implementations for time monitoring.
In RTA-OS3.x the API calls are modified to take the Os_ prefix but have
identical behavior as the old RTA-OSEK calls. However, there are now spe-
cific calls for tasks and ISRs that replace the GetLargestExecutionTime and
GetLargestExecutionTime calls.
• Os_GetLargestExecutionTime is replaced by
Os_Get[Task|ISR]MaxExecutionTime
14.2.3 Schedules
In OSEK OS, OSEK COM features may be provided by the OS (when OSEK
COM is not used). This feature is deprecated in AUTOSAR OS R3.x as internal
communication for applications is provided by the AUTOSAR RTE.
The StartOS() call may return in OSEK OS. This is the behavior provided
in RTA-OSEK. In AUTOSAR OS this behavior is prohibited - the call must not
return. This is the behavior provided by RTA-OS3.x. This means that it is
no longer possible to use an idle loop placed after StartOS() as the idle
mechanism. In RTA-OS3.x the kernel will busy wait by default when there are
no tasks and ISRs to run. You can replace this default behavior by providing
a function called Os_Cbk_Idle() that implements your own idle (background
task) functionality.
RTA-OSEK required you to calculate the amount of stack used by each task
or ISR. You can still do this with RTA-OS3.x, but an additional API call,
Os_GetStackUsage(), has been provided that returns the stack consumed
by the calling task/ISR alone at the point of the call. The avoids the need to
do any stack calculations yourself.
RTA-OS3.x also logs the worst-case observed stack usage for each task/ISR
when a context switch (or a call to Os_GetStackUsage() is made. Addi-
tional API calls are provided to get the largest observed stack usage for each
task/ISR and to reset the largest observed value.
The best way to get technical support is by email. Any problems or questions
about the use of the product should be sent to:
If you prefer to discuss your problem with the technical support team, you
call the support hotline on:
In either case, it is helpful if you can provide technical support with the fol-
lowing information:
ETAS GmbH
Borsigstrasse 14 Phone: +49 711 89661-0
70469 Stuttgart Fax: +49 711 89661-300
Germany WWW: www.etas.com
Contact details for your local sales office and local technical support team
(where available) can be found on the ETAS web site:
A EventMaskType, 181
AccessType, 178
ActivateTask, 16 F
AlarmBaseRefType, 178 float32, 196
AlarmBaseType, 179 float64, 196
ALARMCALLBACK, 201
G
AlarmType, 179
GetActiveApplicationMode, 39
ApplicationType, 180
GetAlarm, 40
AppModeType, 179
GetAlarmBase, 42
AUTOSAR OS includes
GetApplicationID, 44
Os.h, 329
GetCounterValue, 45
Os_Cfg.h, 329
GetElapsedCounterValue, 47
Os_MemMap.h, 329
GetEvent, 49
B GetISRID, 51
boolean, 196 GetResource, 53
GetScheduleTableStatus, 55
C GetTaskID, 57
CallAndProtectFunction, 18 GetTaskState, 59
CallTrustedFunction, 21
I
CancelAlarm, 23
IncrementCounter, 61
CAT1_ISR, 201
ISR, 203
ChainTask, 25
ISRRefType, 181
CheckISRMemoryAccess, 27
ISRType, 181
CheckObjectAccess, 29
CheckObjectOwnership, 31 L
CheckTaskMemoryAccess, 33 Library
ClearEvent, 35 Name of, 329
CounterType, 180
M
D MemorySizeType, 182
DeclareAlarm, 201 MemoryStartAddressType, 182
DeclareCounter, 201
DeclareEvent, 202 N
DeclareISR, 202 NextScheduleTable, 63
DeclareResource, 202
DeclareScheduleTable, 203 O
DeclareTask, 203 ObjectAccessType, 183
DisableAllInterrupts, 37 ObjectTypeType, 183
Os_AdvanceCounter, 65
E Os_AdvanceCounter_<CounterID>,
EnableAllInterrupts, 38 68
ErrorHook, 144 Os_AnyType, 184
EventMaskRefType, 180 Os_AsyncPushCallbackType, 301
Index 345
Os_Cbk_Cancel_<CounterID>, 146 Os_IncrementCounter_<CounterID>,
Os_Cbk_CheckMemoryAccess, 147 86
Os_Cbk_Disable_<ISRName>, 150 Os_LogCat1ISREnd, 227
Os_Cbk_GetStopwatch, 151 Os_LogCat1ISRStart, 229
Os_Cbk_Idle, 152 Os_LogCriticalExecutionEnd, 231
Os_Cbk_Now_<CounterID>, 153 Os_LogIntervalEnd, 233
Os_LogIntervalEndData, 235
Os_Cbk_RegSetRestore_<RegisterSetID>,
154 Os_LogIntervalEndValue, 237
Os_Cbk_RegSetSave_<RegisterSetID>, Os_LogIntervalStart, 239
155 Os_LogIntervalStartData, 241
Os_Cbk_Set_<CounterID>, 162 Os_LogIntervalStartValue, 243
Os_Cbk_SetMemoryAccess, 156 Os_LogProfileStart, 245
Os_Cbk_SetTimeLimit, 160 Os_LogTaskTracepoint, 247
Os_Cbk_StackOverrunHook, 164 Os_LogTaskTracepointData, 249
Os_Cbk_State_<CounterID>, 167 Os_LogTaskTracepointValue, 251
Os_Cbk_SuspendTimeLimit, 168 Os_LogTracepoint, 253
Os_LogTracepointData, 255
Os_Cbk_Terminated_<ISRName>,
Os_LogTracepointValue, 257
169
OS_MAIN, 209
Os_Cbk_TimeOverrunHook, 170
OS_NOAPPMODE, 209
Os_Cbk_TraceCommDataReady, 295
OS_NUM_ALARMS, 209
Os_Cbk_TraceCommInitTarget, 296
OS_NUM_APPLICATIONS, 209
Os_Cbk_TraceCommTxByte, 297
OS_NUM_APPMODES, 209
Os_Cbk_TraceCommTxEnd, 298
OS_NUM_COUNTERS, 210
Os_Cbk_TraceCommTxReady, 299
OS_NUM_EVENTS, 210
Os_Cbk_TraceCommTxStart, 300
OS_NUM_INTERVALS, 305
Os_CheckTraceOutput, 217
OS_NUM_ISRS, 210
Os_ClearTrigger, 218
OS_NUM_RESOURCES, 210
Os_CounterStatusRefType, 184
OS_NUM_SCHEDULETABLES, 210
Os_CounterStatusType, 184
OS_NUM_TASKS, 210
Os_DisableTraceCategories, 219 OS_NUM_TASKTRACEPOINTS, 305
Os_DisableTraceClasses, 221 OS_NUM_TRACECATEGORIES, 305
Os_EnableTraceCategories, 223 OS_NUM_TRACEPOINTS, 305
Os_EnableTraceClasses, 225 OS_NUM_TRUSTED_FUNCTIONS, 211
OS_EXTENDED_STATUS, 208 OS_REGSET_<RegisterSetID>_SIZE,
Os_GetExecutionTime, 70 211
Os_GetISRMaxExecutionTime, 72 Os_ResetISRMaxExecutionTime, 87
Os_GetISRMaxStackUsage, 74 Os_ResetISRMaxStackUsage, 89
Os_GetStackSize, 76 Os_ResetTaskMaxExecutionTime, 91
Os_GetStackUsage, 78 Os_ResetTaskMaxStackUsage, 93
Os_GetStackValue, 80 Os_Restart, 95
Os_GetTaskMaxExecutionTime, 81 OS_SCALABILITY_CLASS_1, 211
Os_GetTaskMaxStackUsage, 83 OS_SCALABILITY_CLASS_2, 211
Os_GetVersionInfo, 85 OS_SCALABILITY_CLASS_3, 212
346 Index
OS_SCALABILITY_CLASS_4, 212 Os_TriggerOnIncrementCounter, 280
Os_SetRestartPoint, 97 Os_TriggerOnIntervalEnd, 281
Os_SetTraceRepeat, 259 Os_TriggerOnIntervalStart, 282
Os_SetTriggerWindow, 260 Os_TriggerOnIntervalStop, 283
OS_STACK_MONITORING, 212 Os_TriggerOnReleaseResource, 284
Os_StackOverrunType, 185 Os_TriggerOnScheduleTableExpiry,
Os_StackSizeType, 186 285
Os_StackValueType, 186 Os_TriggerOnSetEvent, 286
OS_STANDARD_STATUS, 213 Os_TriggerOnShutdown, 287
Os_StartBurstingTrace, 262 Os_TriggerOnTaskStart, 288
Os_StartFreeRunningTrace, 263 Os_TriggerOnTaskStop, 289
Os_StartTriggeringTrace, 264 Os_TriggerOnTaskTracepoint, 290
Os_StopTrace, 266 Os_TriggerOnTracepoint, 291
Os_StopwatchTickType, 186 Os_UntrustedContextRefType, 187
OS_TICKS2<Unit>_<CounterID>(ticks),Os_UntrustedContextType, 187
213 Os_UploadTraceData, 292
OS_TIME_MONITORING, 214 OsAppMode, 313
Os_TimeLimitType, 187 OsAppModeId, 313
Os_TimingFaultDetected, 99 OsCategory, 320
OS_TRACE, 305 OsCategoryAutostart, 320
Os_TraceCategoriesType, 301 OsCategoryFilter, 321
Os_TraceClassesType, 301 OsCategoryMask, 321
Os_TraceCommInit, 267 OsClass, 320
Os_TraceDataLengthType, 302 OsClassAutostart, 320
Os_TraceDataPtrType, 302 OsClassFilter, 320
Os_TraceDumpAsync, 268 OsCounter, 314
Os_TraceExpiryIDType, 303 OSCYCLEDURATION, 203
Os_TraceIndexType, 303 OSCYCLESPERSECOND, 204
Os_TraceInfoType, 303 OsCyclesPerSecond, 315
Os_TraceIntervalIDType, 303 OsDefCat1Stack, 315
Os_TraceStatusType, 304 OsDefCat2Stack, 315
Os_TraceTracepointIDType, 304 OsDefTaskStack, 315
Os_TraceValueType, 304 OsEnumeration, 317
Os_TriggerNow, 269 OSErrorGetServiceId, 204
Os_TriggerOnActivation, 270 OsFormat, 314
Os_TriggerOnAdvanceCounter, 271 OsHooks, 315
Os_TriggerOnAlarmExpiry, 272 OsInterval, 319
Os_TriggerOnCat1ISRStart, 273 OsIntervalFormat, 319
Os_TriggerOnCat1ISRStop, 274 OsIntervalID, 319
Os_TriggerOnCat2ISRStart, 275 OsIsr, 314
Os_TriggerOnCat2ISRStop, 276 OsIsrAddress, 314
Os_TriggerOnChain, 277 OsIsrBudget, 314
Os_TriggerOnError, 278 OsIsrPriority, 314
Os_TriggerOnGetResource, 279 OsIsrRef, 319
Index 347
OsIsrStackAllocation, 314 OsTraceTgtStack, 317
OSMAXALLOWEDVALUE, 204 OsTraceTgtTrigger, 317
OSMAXALLOWEDVALUE_<CounterID>, OsTraceTracepoint, 318
205 OsTraceTracepointFormat, 318
OSMEMORY_IS_EXECUTABLE, 205 OsTraceTracepointID, 318
OSMEMORY_IS_READABLE, 205
OSMEMORY_IS_STACKSPACE, 205 P
OSMEMORY_IS_WRITEABLE, 206 Param, 313, 315, 318, 319
OSMINCYCLE, 206 PhysicalTimeType, 188
OSMINCYCLE_<CounterID>, 206 PostTaskHook, 172
OsOS, 315 PreTaskHook, 173
OsRegSet, 316 ProtectionHook, 174
OsRegSetRef, 314, 316 ProtectionReturnType, 188
OsRTATarget, 313
R
OsRTATargetName, 313
ReleaseResource, 101
OsRTATargetVariant, 313
ResourceType, 189
OsRTATargetVersion, 313
RestartType, 189
OSServiceIdType, 182
ResumeAllInterrupts, 103
OsStackFaultHook, 315
ResumeOSInterrupts, 105
OsSuppressVectorGen, 315
rtaoscfg
OSSWTICKDURATION, 207
Options, 322
OSSWTICKSPERSECOND, 207
rtaosgen
OsTask, 316
Options, 325
OsTaskBudget, 316
OsTaskRef, 319 S
OsTaskStackAllocation, 316 Schedule, 107
OsTaskWaitStack, 316 ScheduleTableRefType, 190
OSTICKDURATION, 207 ScheduleTableStatusRefType, 190
OSTICKDURATION_<CounterID>, 207 ScheduleTableStatusType, 190
OSTICKSPERBASE, 208 ScheduleTableType, 191
OSTICKSPERBASE_<CounterID>, 208 SetAbsAlarm, 109
OsTicksPerSecond, 315 SetEvent, 111
OsTrace, 316 SetRelAlarm, 113
OsTraceAuto, 317 SetScheduleTableAsync, 115
OsTraceAutoComms, 317 ShutdownHook, 176
OsTraceAutoRepeat, 317 ShutdownOS, 117
OsTraceBufferSize, 317 sint16, 196
OsTraceCompactID, 317 sint16_least, 197
OsTraceCompactTime, 317 sint32, 197
OsTraceEnabled, 317 sint32_least, 197
OsTraceFilter, 314, 316 sint8, 198
OsTraceTaskTracepoint, 318 sint8_least, 198
OsTraceTaskTracepointFormat, 319 StartOS, 119
OsTraceTaskTracepointID, 318 StartScheduleTableAbs, 121
348 Index
StartScheduleTableRel, 123 TickRefType, 194
StartScheduleTableSynchron, 125 TickType, 195
StartupHook, 177 TrustedFunctionIndexType, 195
StatusType, 191 TrustedFunctionParameterRefType,
Std_ReturnType, 192 195
Std_VersionInfoType, 192
StopScheduleTable, 127 U
SuspendAllInterrupts, 129 uint16, 198
SuspendOSInterrupts, 131 uint16_least, 199
SyncScheduleTable, 133 uint32, 199
uint32_least, 199
T uint8, 200
TASK, 214 uint8_least, 200
TaskRefType, 193
TaskStateRefType, 193 V
TaskStateType, 193 Value, 314, 315, 318, 319
TaskType, 194
TerminateApplication, 136 W
TerminateTask, 139 WaitEvent, 141
Index 349