`
`Operating System
`Specification 2.1r1
`
`OSEK/VDX
`
`Operating System
`
`Version 2.1 revision 1
`
`13. November 2000
`
`This document is an official release and replaces all previously distributed documents. The OSEK group retains the right to
`make changes to this document without notice and does not accept any liability for errors.
`All rights reserved. No part of this document may be reproduced, in any form or by any means, without permission in
`writing from the OSEK/VDX steering committee.
`
`OSEK OS 2.1r1
`
`© by OSEK
`
`Document: OS21r1.doc
`
`Page 1 of 85
`
`PETITIONERS' EXHIBIT 1015
`
`
`
`OSEK/VDX
`
`Operating System
`Specification 2.1r1
`
`Preface
`OSEK/VDX is a joint project of the automotive industry. It aims at an industry standard for an
`open-ended architecture for distributed control units in vehicles.
`For detailed information about OSEK project goals and partners, please refer to the “OSEK
`Binding Specification”.
`
`This document describes the concept of a real-time operating system, capable of multitasking,
`which can be used for motor vehicles. It is not a product description which relates to a specific
`implementation.
`
`This document also specifies the OSEK operating system - Application Program Interface.
`
`General conventions, explanations of terms and abbreviations have been compiled in the
`additional inter-project "OSEK Overall Glossary".
`
`Regarding implementation and system generation aspects please refer
`Implementation Language" (OIL) specification.
`
`to the "OSEK
`
`OSEK OS 2.1r1
`
`© by OSEK
`
`2
`
`Page 2 of 85
`
`
`
`OSEK/VDX
`
`Operating System
`Specification 2.1r1
`
`Table of Contents
`
`1 Introduction...................................................................................................................... 7
`1.1 System philosophy.................................................................................................... 7
`1.2 Purpose of this document ......................................................................................... 9
`1.3 Structure of this document.......................................................................................10
`
`2 Summary.........................................................................................................................12
`
`3 Architecture of the OSEK operating system.....................................................................13
`3.1 Processing levels .....................................................................................................13
`3.2 Conformance classes ...............................................................................................14
`3.3 Relationship between OSEK OS and OSEKtime OS................................................16
`
`4 Task management ............................................................................................................17
`4.1 Task concept ...........................................................................................................17
`4.2 Task state model .....................................................................................................17
`4.2.1
`Extended tasks ...............................................................................................17
`4.2.2
`Basic tasks .....................................................................................................18
`4.2.3
`Comparison of the task types..........................................................................19
`4.3 Activating a task......................................................................................................20
`4.4 Task switching mechanism.......................................................................................20
`4.5 Task priority............................................................................................................20
`4.6 Scheduling policy ....................................................................................................21
`4.6.1
`Non pre-emptive scheduling ...........................................................................21
`4.6.2
`Full pre-emptive scheduling ............................................................................22
`4.6.3 Mixed pre-emptive scheduling ........................................................................23
`4.6.4
`Selecting the scheduling policy .......................................................................24
`4.7 Termination of tasks................................................................................................24
`4.8 Application modes...................................................................................................24
`4.8.1
`Start up performance......................................................................................25
`4.8.2
`Support of exclusive applications....................................................................25
`4.8.3
`Supported by all conformance classes .............................................................25
`
`5 Interrupt processing.........................................................................................................26
`
`6 Event mechanism.............................................................................................................29
`
`7 Resource management .....................................................................................................31
`7.1 Behaviour during access to occupied resources........................................................31
`7.2 Restrictions when using resources............................................................................31
`7.3 Scheduler as a resource ...........................................................................................32
`7.4 General problems with synchronisation mechanisms.................................................32
`7.4.1
`Explanation of priority inversion.....................................................................32
`7.4.2
`Deadlocks ......................................................................................................33
`7.5 OSEK Priority Ceiling Protocol...............................................................................33
`7.6 OSEK Priority Ceiling Protocol with extensions for interrupt levels .........................34
`
`8 Alarms.............................................................................................................................37
`8.1 Counters..................................................................................................................37
`8.2 Alarm management..................................................................................................37
`
`9 Messages.........................................................................................................................39
`
`OSEK OS 2.1r1
`
`© by OSEK
`
`3
`
`Page 3 of 85
`
`
`
`OSEK/VDX
`
`Operating System
`Specification 2.1r1
`
`10 Error handling, tracing and debugging............................................................................. 40
`10.1 Hook routines......................................................................................................... 40
`10.2 Error handling ........................................................................................................ 41
`10.3 System start-up....................................................................................................... 42
`10.4 System shutdown.................................................................................................... 43
`10.5 Debugging.............................................................................................................. 44
`
`11 Description of system services ........................................................................................ 45
`11.1 Definition of system objects.................................................................................... 45
`11.2 Conventions ........................................................................................................... 45
`11.2.1 Type of calls.................................................................................................. 45
`11.2.2 Legitimacy of calls......................................................................................... 45
`11.2.3 Error characteristics ...................................................................................... 45
`
`12 Specification of operating system services....................................................................... 47
`12.1 Common datatypes................................................................................................. 47
`12.2 Task management................................................................................................... 48
`12.2.1 Data types ..................................................................................................... 48
`12.2.2 Constructional elements................................................................................. 49
`12.2.2.1 DeclareTask............................................................................................................ 49
`12.2.3 System services ............................................................................................. 49
`12.2.3.1 ActivateTask........................................................................................................... 49
`12.2.3.2 TerminateTask........................................................................................................ 50
`12.2.3.3 ChainTask .............................................................................................................. 50
`12.2.3.4 Schedule ................................................................................................................. 51
`12.2.3.5 GetTaskID .............................................................................................................. 52
`12.2.3.6 GetTaskState........................................................................................................... 52
`12.2.4 Constants ...................................................................................................... 53
`12.2.5 Naming convention........................................................................................ 53
`12.3 Interrupt handling ................................................................................................... 53
`12.3.1 Data types ..................................................................................................... 53
`12.3.2 System services ............................................................................................. 54
`12.3.2.1 EnterISR................................................................................................................. 54
`12.3.2.2 LeaveISR ................................................................................................................ 54
`12.3.2.3 EnableInterrupt....................................................................................................... 55
`12.3.2.4 DisableInterrupt ...................................................................................................... 55
`12.3.2.5 GetInterruptDescriptor ............................................................................................ 56
`12.3.2.6 EnableAllInterrupts................................................................................................. 56
`12.3.2.7 DisableAllInterrupts................................................................................................ 57
`12.3.2.8 ResumeOSInterrupts ............................................................................................... 57
`12.3.2.9 SuspendOSInterrupts .............................................................................................. 58
`12.3.3 Constants ...................................................................................................... 58
`12.3.4 Naming convention........................................................................................ 58
`12.4 Resource management ............................................................................................ 59
`12.4.1 Data types ..................................................................................................... 59
`12.4.2 Constructional elements................................................................................. 59
`12.4.2.1 DeclareResource ..................................................................................................... 59
`12.4.3 System services ............................................................................................. 59
`12.4.3.1 GetResource............................................................................................................ 59
`12.4.3.2 ReleaseResource...................................................................................................... 60
`12.4.4 Constants ...................................................................................................... 60
`12.5 Event control.......................................................................................................... 61
`12.5.1 Data types ..................................................................................................... 61
`
`4
`
`© by OSEK
`
`OSEK OS 2.1r1
`
`Page 4 of 85
`
`
`
`OSEK/VDX
`
`Operating System
`Specification 2.1r1
`
`12.5.2 Constructional elements..................................................................................61
`12.5.2.1 DeclareEvent........................................................................................................... 61
`12.5.3 System services ..............................................................................................61
`12.5.3.1 SetEvent..................................................................................................................61
`12.5.3.2 ClearEvent ..............................................................................................................62
`12.5.3.3 GetEvent .................................................................................................................62
`12.5.3.4 WaitEvent ...............................................................................................................63
`12.6 Alarms.....................................................................................................................63
`12.6.1 Data types ......................................................................................................63
`12.6.2 Constructional elements..................................................................................64
`12.6.2.1 DeclareAlarm..........................................................................................................64
`12.6.3 System services ..............................................................................................64
`12.6.3.1 GetAlarmBase.........................................................................................................64
`12.6.3.2 GetAlarm ................................................................................................................64
`12.6.3.3 SetRelAlarm............................................................................................................65
`12.6.3.4 SetAbsAlarm...........................................................................................................66
`12.6.3.5 CancelAlarm...........................................................................................................67
`12.6.4 Constants .......................................................................................................67
`12.7 Operating system execution control .........................................................................67
`12.7.1 Data types ......................................................................................................67
`12.7.2 System services ..............................................................................................68
`12.7.2.1 GetActiveApplicationMode .....................................................................................68
`12.7.2.2 StartOS ...................................................................................................................68
`12.7.2.3 ShutdownOS ...........................................................................................................68
`12.7.3 Constants .......................................................................................................69
`12.8 Hook routines .........................................................................................................69
`12.8.1 ErrorHook .....................................................................................................69
`12.8.2 PreTaskHook .................................................................................................69
`12.8.3 PostTaskHook ...............................................................................................70
`12.8.4 StartupHook ..................................................................................................70
`12.8.5 ShutdownHook ..............................................................................................70
`
`13 Implementation and application specific topics.................................................................71
`13.1 Implementation hints. ..............................................................................................71
`13.1.1 Aspects of implementation..............................................................................71
`13.1.2 Parameters of implementation.........................................................................71
`13.1.2.1 Functionality...........................................................................................................71
`13.1.2.2 Hardware resources .................................................................................................72
`13.1.2.3 Performance............................................................................................................ 72
`13.1.2.4 Configuration of run time context............................................................................72
`13.2 Application design hints...........................................................................................73
`13.2.1 Resource management....................................................................................73
`13.2.1.1 Occupation in LIFO order .......................................................................................73
`13.2.1.2 Call level of API-services ........................................................................................73
`13.2.1.3 Resources still occupied at task termination.............................................................74
`13.2.2 Placement of API calls....................................................................................74
`13.2.3
`Interrupt service routines................................................................................74
`13.2.3.1 Local variables in ISRs of category 3 .......................................................................74
`13.2.3.2 Nested interrupts of different categories...................................................................75
`13.2.3.3 Direct manipulation of interrupt levels ....................................................................76
`13.2.4 Priority and pre-emption.................................................................................76
`13.2.5 Parameter to pass to ShutdownOS .................................................................76
`13.2.6 Error handling ................................................................................................76
`13.2.7 Errors and warnings .......................................................................................77
`
`OSEK OS 2.1r1
`
`© by OSEK
`
`5
`
`Page 5 of 85
`
`
`
`OSEK/VDX
`
`Operating System
`Specification 2.1r1
`
`13.3 Implementation specific tools.................................................................................. 78
`
`14 Changes from specification 1.0 to 2.1r1 .......................................................................... 79
`14.1 Changes from specification 1.0 to 2.0r1 .................................................................. 79
`14.1.1 Conceptual changes....................................................................................... 79
`14.1.1.1 Conformance classes............................................................................................... 79
`14.1.1.2 Messages................................................................................................................. 79
`14.1.1.3 Multiple requesting of task activation...................................................................... 79
`14.1.1.4 Application modes .................................................................................................. 79
`14.1.1.5 Counters ................................................................................................................. 79
`14.1.1.6 Hook routines.......................................................................................................... 80
`14.1.1.7 OS execution control............................................................................................... 80
`14.1.2 Clarifications ................................................................................................. 80
`14.1.2.1 Scheduling of non pre-emptive tasks ....................................................................... 80
`14.1.2.2 Services available on which level ............................................................................ 80
`14.1.2.3 Interrupt processing ................................................................................................ 80
`14.1.2.4 Priority ceiling ........................................................................................................ 80
`14.1.2.5 Types and constants ................................................................................................ 80
`14.1.2.6 Naming conventions ............................................................................................... 80
`14.1.3 Changes of the documentation....................................................................... 81
`14.1.3.1 Document structure................................................................................................. 81
`14.1.3.2 New chapters .......................................................................................................... 81
`14.1.3.3 Removed chapters ................................................................................................... 81
`14.2 Changes from specification 2.0r1 to 2.1 and 2.1r1................................................... 81
`14.2.1 Behaviour of ChainTask/TerminateTask with allocated resources is
`undefined....................................................................................................... 81
`14.2.2 GetTaskID is allowed in ISRs........................................................................ 81
`14.2.3
`Interrupt handling has been clarified and extended. ........................................ 82
`14.2.4 Error checking of GetResource/ReleaseResource have been modified............ 82
`14.2.5 Added constant OSTICKSPERBASE............................................................ 82
`14.2.6 ShutdownOS is allowed in ISRs and certain hook routines............................. 82
`14.2.7 Behaviour of ShutdownOS after ShutdownHook returns is
`implementation defined.................................................................................. 82
`14.2.8 Added constant OSDEFAULTAPPMODE.................................................... 82
`14.2.9 ErrorHook is never called recursively. ........................................................... 82
`14.2.10 Local Messages added to specification........................................................... 82
`14.2.11 Startup/shutdown when OSEK and OSEKtime coexist (2.1r1) ...................... 82
`
`15 Index .............................................................................................................................. 83
`15.1 List of figures ......................................................................................................... 84
`
`16 History ........................................................................................................................... 85
`
`6
`
`© by OSEK
`
`OSEK OS 2.1r1
`
`Page 6 of 85
`
`
`
`OSEK/VDX
`
`Operating System
`Specification 2.1r1
`
`1 Introduction
`
`The specification of the OSEK operating system is to represent a uniform environment which
`supports efficient utilisation of resources for automotive control unit application software. The
`OSEK operating system is a single processor operating system meant for distributed embedded
`control units.
`
`1.1 System philosophy
`Automotive applications are characterised by stringent real-time requirements. Therefore the
`OSEK operating system offers the necessary functionality to support event driven control
`systems.
`
`The specified operating system services constitute a basis to enable the integration of software
`modules made by various manufacturers. To be able to react to the specific features of the
`individual control units as determined by their performance and the requirements of a minimum
`consumption of resources, the prime focus was not to achieve 100% compatibility between the
`application modules, but their direct portability.
`
`As the operating system is intended for use in any type of control units, it must support time-
`critical applications on a wide range of hardware. A high degree of modularity and ability for
`flexible configuration are prerequisites to make the operating system suitable for low-end
`microprocessors and complex control units alike. These requirements have been supported by
`definition of "conformance classes" (see chapter 3.2, Conformance classes) and a certain
`capability for application specific adaptations.
`
`For time-critical applications dynamic generation of system objects was left out. Instead,
`generation of system objects was assigned to the system generation phase. Error inquiries
`within the operating system are obviated to a large extent, so as not to affect the speed of the
`overall system unnecessarily. On the other hand, a system version with extended error inquiries
`has been defined. It is intended for the test phase and for less time-critical applications. Even at
`that stage defined uniform system appearance is ensured.
`Standardised interfaces
`The interface between the application software and the operating system is defined by system
`services. The interface is identical for all implementations of the operating system on various
`processor families.
`
`System services are specified in an ISO/ANSI-C-like syntax, however the implementation
`language of the system services is not specified.
`Scalability
`Different conformance classes, various scheduling mechanisms and the configuration features
`make the OSEK operating system feasible for a broad spectrum of applications and hardware.
`
`The OSEK operating system is designed to require only a minimum of hardware resources
`(RAM, ROM, CPU time) and therefore runs even on 8 bit microcontrollers.
`Error checking
`The OSEK operating system offers two levels of error checking, extended status for
`development phase and standard status for production phase.
`
`OSEK OS 2.1r1
`
`© by OSEK
`
`7
`
`Page 7 of 85
`
`
`
`OSEK/VDX
`
`Operating System
`Specification 2.1r1
`
`The extended status allows for enhanced plausibility checks on calling operating system
`services. Due to the additional error checking it requires more execution time and memory
`space than the standard version. However, many errors can be found in a test phase. After all
`errors have been eliminated, the system can be recompiled with the standard version.
`Portability of application software
`One of the goals of OSEK is to support the portability and re-usability of application software.
`Therefore the interface between the application software and the operation system is defined
`by standardised system services with well-defined functionality. Use of standardised system
`services reduces the effort to maintain and to port application software and development cost.
`
`Portability means the ability to transfer an application software module from one ECU to
`another ECU without bigger changes inside the application.
`
`The application software lies on the operating system and in parallel on a application-specific
`Input/Output System interface which is not standardised in the OSEK specification. The
`application software module can have several interfaces. There are interfaces to the operating
`system for real time control and resource management, but also interfaces to other software
`modules to represent a complete functionality in a system and at least to the hardware, if the
`application has to work directly with microcontroller modules.
`
`For better portability of application software, the OSEK defines a language for a standardised
`configuration information. This language "OIL" (OSEK Implementation Language) supports a
`portable description of all OSEK specific objects such as "tasks" and "alarms" etc.
`
`module 1
`
`module 2
`
`module 3
`
`module n
`
`application
`software
`
`OSEK operation system
`
`Input/Output System
`
`µController
`
`Figure 1–1
`
`Software interfaces inside ECU1
`
`During the process to port application software from one ECU to another ECU it is necessary
`to consider characteristics of the software development process, the development environment,
`and the hardware architecture of the ECU, for example:
`
`1 OSEK OS allows direct interfacing between application and the hardware.
`
`8
`
`© by OSEK
`
`OSEK OS 2.1r1
`
`Page 8 of 85
`
`
`
`OSEK/VDX
`
`Operating System
`Specification 2.1r1
`
`•
`Software development guidelines
`•
`File management system
`•
`Data allocation and stack usage of the compiler
`• Memory architecture of the ECU
`•
`Timing behaviour of the ECU
`•
`Different microcontroller specific interfaces e.g. ports, A/D converter, serial
`communication and watchdog timer
`Placement of the API calls
`
`•
`
`This means that the OSEK specifications are not enough to describe an OSEK implementation
`completely. The implementation has to supply specific documentation.
`Support of Portability
`implementations to the
`The certification process ensures the conformance of different
`specification. Chapter 13 of this specification collects implementation specific details which
`have to be regarded to increase portability of an application between various OSEK
`implementations. Herein only the operating system interface to the application is considered.
`Special support for automotive requirements
`Specific requirements for an OSEK operating system arise in the application context of
`software development for automotive control units. Requirements such as reliability, real-time
`capability, and cost sensitivity are addressed by the following features:
`•
`The OSEK operating system is configured and scaled statically. The number of tasks,
`resources, and services required is statically specified by the user.
`The specification of the OSEK operating system supports implementations capable of
`running on ROM, i.e. the code could be executed from Read-Only-Memory.
`The OSEK operating system supports portability of application tasks.
`The specification of the OSEK operating system provides a predictable and documented
`behaviour to enable operating system implementations, which meet automotive real-time
`requirements.
`The specification of the OSEK operating system allows the implementation of
`predictable performance parameters.
`
`•
`
`•
`•
`
`•
`
`1.2 Purpose of this document
`The following description is to be regarded as a generic description which is mandatory for any
`implementation of the OSEK operating system. This concerns the general description of
`strategy and functionality, the interface of the calls, the meaning and declaration of the
`parameters and the possible error codes.
`
`The specification leaves a certain amount of flexibility. On the one hand, the description is
`generic enough for future upgrades, on the other hand, there is some explicitly specified
`implementation-specific scope in the description.
`
`implementation specific issues. The conformance classes
`Any implementation defines all
`supported by the implementation must be indicated precisely, and the issues identified as
`implementation-specific must be documented.
`
`It is assumed that the description of the OSEK operating system is to be updated in the future,
`and will be adapted to extended requirements. Therefore, each implementation must specify
`
`OSEK OS 2.1r1
`
`© by OSEK
`
`9
`
`Page 9 of 85