Osekturbo OS/Mpc5xx V.2.2.1
Total Page:16
File Type:pdf, Size:1020Kb
Freescale Semiconductor, Inc. OSEKturbo OS/MPC5xx v.2.2.1 Technical Reference Because of last-minute software changes, some information in this manual may be inaccurate. Please read the readme.txt file for the latest information. Revised: June 2003 For More Information: www.freescale.com Freescale Semiconductor, Inc. © 2003 MOTOROLA, ALL RIGHTS RESERVED Motorola reserves the right to make changes without further notice to any products herein to improve reliability, function or design. Motorola does not assume any liability arising out of the application or use of any product or circuit described herein; neither does it convey any license under its patent rights nor the rights of others. Motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the Motorola product could create a situation where personal injury or death may occur. Should Buyer purchase or use Motorola products for any such unintended or unauthorized application, Buyer shall indemnify and hold Motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that Motorola was negligent regarding the design or manufacture of the part. Motorola and B are registered trademarks of Motorola, Inc. Motorola, Inc. is an Equal Employment Opportunity/Affirmative Action Employer. Legal Notices The information in this document has been carefully checked and is believed to be entirely reliable, however, no responsibility is assumed for inaccuracies. Furthermore, Motorola reserves the right to make changes to any products herein to improve reliability, function or design. Motorola does not assume liability arising out of the application or use of any product or circuit described herein; neither does it convey any license under its patent rights or the rights of others. The software described in this document is furnished under a license agreement. The software may be used or copied only in accordance with the terms of the agreement. No part of this publication may be reproduced or transmitted in any form or by any means - graphic, electronic, electrical, mechanical, chemical, including photocopying, recording in any medium, taping, by any computer or information storage retrieval systems, etc., without prior permissions in writing from Motorola Inc. Permission is granted to reproduce and transmit the Problem Report Form, the Customer Satisfaction Survey, and the Registration Form to Motorola. Important Notice to Users While every effort has been made to ensure the accuracy of all information in this document, Motorola assumes no liability to any party for any loss or damage caused by errors or omissions or by statements of any kind in this document, its updates, supplements, or special editions, whether such errors are omissions or statements resulting from negligence, accident, or any other cause. Motorola further assumes no liability arising out of the application or use of any product or system described herein; nor any liability for incidental or consequential damages arising from the use of this document. Motorola disclaims all warranties regarding the information contained herein, whether expressed, implied or statutory, including implied warranties of merchantability or fitness for a particular purpose. Trademarks OSEK/VDX is a registered trademark of Siemens AG. Diab, D-CC, and SingleStep are trademarks of Wind River Systems, Inc. Metrowerks, the Metrowerks logo and CodeWarrior are registered trademarks of Metrowerks Inc. Microsoft, MS-DOS and Windows are trademarks of Microsoft. For More Information: www.freescale.com Freescale Semiconductor, Inc. Contents 1 Introduction 13 OSEK OS Overview . 15 Typographical Conventions . 17 References . 17 Definitions, Acronyms and Abbreviations . 18 Technical Support Information . 19 2 Operating System Architecture 21 Processing Levels . 21 Conformance Classes . 22 OSEK OS Overall Architecture . 25 Application Program Interface . 26 3 Task Management 29 Task Concept. 29 Extended Tasks . 30 Basic Tasks . 32 Task Priorities . 33 Tasks Stacks . 34 Stack Allocation . 34 Single Stack . 34 Programming Issues . 35 Configuration Options . 35 Data Types . 35 Task Definition . 35 Run-time Services . 37 Constants. 38 Conventions . 38 4 Scheduler 41 General . 41 Scheduling Policy. 42 Non-preemptive Scheduling . 42 Full-preemptive Scheduling. 43 Mixed-preemptive Scheduling. 44 Groups of Tasks . 45 Programming Issues . 45 Configuration Options . 45 OSEKturbo OS/MPC5xx TR–3 For More Information: www.freescale.com Freescale Semiconductor, Inc. Contents Run-time Services . 46 5 Interrupt Processing 47 General . 47 ISR Categories . 48 ISR Category 1 . 48 ISR Category 2 . 49 Interrupt Level Manipulation . 50 ISR Stack . 50 Interrupt Dispatcher . 51 Programming Issues . 52 Configuration Options . 52 Run-time Services . 52 Conventions . 53 ISR Definition . 54 Interrupt Vector Definition . 55 6 Resource Management 57 General . 57 Access to Resources . 58 Restrictions when using resources . 59 Priority Ceiling Protocol . 59 Scheduler as a Resource . 61 Internal resources. 61 Programming Issues . 62 Configuration Option . 62 Data Types . 63 Run-time Services . 63 Resource Definition . 63 7 Counters and Alarms 65 General . 65 Counters . 66 Alarms . 68 Alarm Callback. 70 TimeScale . 71 Programming Issues . 71 Configuration Options . 71 TR–4 OSEKturbo OS/MPC5xx For More Information: www.freescale.com Freescale Semiconductor, Inc. Contents Data Types . 72 Counters and Alarm Generation . 73 Run-time Services . 75 Constants. 76 8Events 79 General . 79 Events and Scheduling . 80 Programming Issues . 82 Configuration Options . 82 Data Types . 82 Events Definition . 82 Run-time Services . 83 9 Communication 85 Message Concept . 85 Unqueued Messages . 86 Queued Messages . 88 Data Consistency . 89 Programming Issues . 89 Configuration Options . 89 Identifiers . 89 Message Definition . 90 Run-time Services . 90 Callback Function . 91 Usage of Messages . 92 10 Error Handling and Special Routines 93 General . 93 Hook Routines . 93 Error Handling . 98 Error Interface. 98 Macros for ErrorHook . 99 Extended Status . 100 Possible Error Reasons . 100 Start-up Routine . 101 Application Modes . 101 System Shutdown . 102 OSEKturbo OS/MPC5xx TR–5 For More Information: www.freescale.com Freescale Semiconductor, Inc. Contents Programming Issues . 102 Configuration Options . 102 11 System Configuration 105 General . 105 Application Configuration File . 106 OIL Concept . 106 OIL File . 106 OIL Format . 107 Implementation Definition . 107 Implementation Definition Grammar . 107 Application Definition . 110 Object Definition . 110 Include Directive . 111 Comments . 111 File Structure. 111 Configuration File Rules . 112 12 System Objects Definition 113 General . 113 OS Definition . 114 Global System Attributes . 114 CPU Related Attributes. 116 Stack Related Attributes . ..