Anda di halaman 1dari 259
Simple Re itis wi Syatemn -Chowdary Venkateswara Penumuchu Copyrighted material ‘Order this book online at word comi07-0904 oremail orlersarraford.com ‘Mos Trafford tiles are also availible at majoe online book rete © Copyright 2007 ChowdaryV. enum, Al ight ory No prof hie publication may be reproduced red real ptr, eanamtted any em by any means lectene, mecha, photocopying, ecsding roars witeur che writen pri persion of che athe [Notefor Librarians: A cataloguingecord for this book svat fica Liteary and Archiver Canada at wor colectionseanada.calamiclinder em] Printed in Victor, BC, Camda. Asn 9784-4251-1702-5 Wat Tend bier that tithe rnp of ool a bots individuals and corpenatinnn te mathe oon ‘hat are exsronnentaly and ecialysownd. You, ture, are porting the reponibl conduct exh tine you pursiace a Toafird both or maker fone poblbing ewe To fd outer arc helping, ple vise ‘ouw afin comireponsibipablabinghmd (Our minion ito ciety provide the world finer, mos somprohensve book publaing rervie, enabling every author to expercice cis. To find out bo ts publ your boc, yor soa, and have it avaiable tworlvide visits enkne atwaretrafferd com/O310 PITRE: swrertintsom [Norts America & international roll five: | 888 232 4444 (USA & Canada) ‘phone: 250383 6864 Lon. 250 383 GHO4 emati info@ueafon-com “The United Kingdom & Europe phone: +44 (0)1865 722113 + local ate 0845 230 9601 ‘ese: 04 (01865722 868 » emai: infauk@reatond.com oR7esaa2 CONTENTS Preface..... a ieee 9 1 What is RTOS and why do we need it? 1 2 Mutual exclusion, thread synchronization and scheduling 25 2.1 Mutex implementation in SROS........ 30 2.44 threadOdject 31 2.4.2 mutexObjectinit() 32 2.1.3 mutexObjectLock() 32 2.1.4 mutexObjectLock() assembly implementation... 35. 2.1.5 SROS data structures in the first version......... . 40 2.1.6 — mutexObjectRelease()............ sesceomanacinsnensee dd 2.1.7 — scheduler 4B 2.1.8 — Scheduler Implementation in SROS B 2.2 — Interrupts handling in RTOS 44 2.3 Interrupt Handler in SROS.. 46 2.4 — Creation of thread in RTOS 47 2.5 — Creation of thread in SROS 48 2.6 RTOS initialization and starting. 51 2.7 SROS initialization and starting SL 2.8 List node, memory management of list nodes in SROS 3 2.9 _ Insertion and deletion of list nodes in the linked lists used in SROS...... 55 2.10 semaphore. 59 2.11. Semaphore implementation in SROS 60 2.11.1. semaphoreObjectinit(} 61 2.11.2 semaphoreObjectPendi) . a coe 1 2.11.3 semaphoreObjectPost() 63 2.12 Mailbox. 65 2.13 Mailbox implementation in SROS. 66 2.13.1 mailboxObjectinit() 67 2.13.2 mailboxObjectPosi()...... csreiecesrcaireacsamisicnanaieas OB 2.13.3 mailboxObjectPend() n 2.14 Example application using SROS..... 14 2.15 Exercises, short term assignments . . : 84 3 Timer Support 85 8.1 Need for timer support... . 85 3.2 Timersupport implementation in RTOS 86 3.3 Timer support implementation in SROS 86 3.3.1 mutexObjectLock() ee 87 3.3.2 Timer management in SROS 89 3.33 Inserting a threadObject into timerList..................-0 93 3.3.4 Deleting a threadObject from the timerLis 7 3.3.5 mutexObjectRelease(). 100

Anda mungkin juga menyukai