Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 18 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
18
Dung lượng
370 KB
Nội dung
Introduction to uCOS-II V2.6 About SwiftACT • A Technology services startup company o Under establishment • Areas of specialties: o o Mobile telecommunication services development Embedded systems development • Types of services: o o o o Consultation Managed services Sourcing Training Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 About Me • Graduated 2004 o ECE, ASU: yrs distinction • 5+ years in embedded systems development o SDLC, Apps, MW, DD, Porting, • 3+ years in SW engineering o PSP, CMMI, Systematic reuse, • 3+ years in SW testing o IBM certified, ISTQB certified, Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Copyright • Materials in this course is the property of Amr Ali Abdel-Naby • Reproduction or transmission of the materials in any manner without the copyright owner permission is a law violation Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Course References • MicroC/OS-II The Real-Time Kernel, 2nd Edition, by Jean J Labrosse Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Outline • • • • • • • • • • Introduction to µC/OS-II Kernel Structure Task Management Time Management Semaphore Management Mutual Exclusion Semaphores Event Flag Management Message Mailbox Management Message Queue Management Memory Management Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Outline • • • • • • • • • • Introduction to µC/OS-II Kernel Structure Task Management Time Management Semaphore Management Mutual Exclusion Semaphores Event Flag Management Message Mailbox Management Message Queue Management Memory Management Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Event Flags • Used for synchronization of tasks with the occurrence of multiples of events • Events are grouped o 8, 16 or 32 bits per group • Types of synchronization o o ORed: Any event occurred ANDed: All events occured Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Event Flags cont’d Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Event Flags Management APIs OSFlagCreate () OSFlagDel() OSFlagPost () OSFlagAccept () OSFlagPend () OSQFlagQuery () Task Task ISR Amr Ali Abdel-Naby@2010 OSFlagPost() OSFlagAccept () OSQFlagQuery () Introduction to uCOS-II V2.6 ISR Creating an Event Flag Group, OSFlagCreate OS_FLAG_GRP *OSFlagCreate (OS_FLAGS flags, INT8U *err) • • flags: A bit pattern that contains the initial values err: o o o • No error Called from ISR No available resources Return value: o o Non-null for successful creation Null for failure Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Deleting an Event Flag Group, OSFlagDel OS_FLAG_GRP *OSFlagDel (OS_FLAG_GRP *pgrp, INT8U opt, INT8U *err) • • pgrp: A pointer to the desired event flag group to be deleted opt: Delete options o o • Delete always Delete if no pending tasks err: o o o o o o No error Called from ISR pgrp is not a flag group pgrp is null Invalid options There are tasks pending Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Deleting an Event Flag Group, OSFlagDel cont’d OS_FLAG_GRP *OSFlagDel (OS_FLAG_GRP *pgrp, INT8U opt, INT8U *err) • Return value: Null if successful Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Waiting for Events of an Event Flag Group, OSFlagPend OS_FLAGS OSFlagPend (OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U wait_type, INT16U timeout, INT8U *err) • • • • pgrp: A pointer to the desired event flag group to pend to flags: A bit pattern that indicates which flags we will wait for wait_type: Specifies whether you want ALL bits to be set/cleared or ANY of the bits to be set/cleared as well as flags consumptions or not timeout: o o wait for ever !0 wait with specific timeout Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Waiting for Events of an Event Flag Group, OSFlagPend cont’d OS_FLAGS OSFlagPend (OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U wait_type, INT16U timeout, INT8U *err) • err: o o o o o o • No error Called from ISR pgrp is not a flag group pgrp is null Timeout Improper wait type specified Return value: Final flag group state Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Setting or Clearing Events in an Event Flag Group, OSFlagPost OS_FLAGS OSFlagPost (OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U opt, INT8U *err) • • • • pgrp: A pointer to the desired event flag group to post to flags: A bit pattern that indicates which flags will be changed opt: Indicates whether flags are set or cleared err: o o o o • No error pgrp is not a flag group pgrp is null Invalid options Return value: Final flag group state Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Looking for Events of an Event Flag Group, OSFlagAccept OS_FLAGS OSFlagAccept (OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U wait_type, INT8U *err) • • • • pgrp: A pointer to the desired event flag group to pend to flags: A bit pattern that indicates which flags we will wait for wait_type: Specifies whether you want ALL bits to be set/cleared or ANY of the bits to be set/cleared err: o o o o o • No error pgrp is not a flag group Improper wait type specified pgrp is null Flags not available Return value: Final flag group state Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Querying an Event Flag Group, OSFlagQuery OS_FLAGS OSFlagQuery (OS_FLAG_GRP *pgrp, INT8U *err) • • pgrp: A pointer to the desired event flag group err: o o o • No error pgrp is null pgrp is not a flag group Return value: current value of the flag group Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 [...]... Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Deleting an Event Flag Group, OSFlagDel cont’d OS_FLAG_GRP *OSFlagDel (OS_FLAG_GRP *pgrp, INT8U opt, INT8U *err) • Return value: Null if successful Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Waiting for Events of an Event Flag Group, OSFlagPend OS_FLAGS OSFlagPend (OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U wait_type, INT16U timeout, INT8U *err)... • • pgrp: A pointer to the desired event flag group to pend to flags: A bit pattern that indicates which flags we will wait for wait_type: Specifies whether you want ALL bits to be set/cleared or ANY of the bits to be set/cleared as well as flags consumptions or not timeout: o o 0 wait for ever !0 wait with specific timeout Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Waiting for Events... Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Querying an Event Flag Group, OSFlagQuery OS_FLAGS OSFlagQuery (OS_FLAG_GRP *pgrp, INT8U *err) • • pgrp: A pointer to the desired event flag group err: o o o • No error pgrp is null pgrp is not a flag group Return value: current value of the flag group Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 ... INT16U timeout, INT8U *err) • err: o o o o o o • No error Called from ISR pgrp is not a flag group pgrp is null Timeout Improper wait type specified Return value: Final flag group state Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Setting or Clearing Events in an Event Flag Group, OSFlagPost OS_FLAGS OSFlagPost (OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U opt, INT8U *err) • • • • pgrp: A pointer to. .. • • • • pgrp: A pointer to the desired event flag group to post to flags: A bit pattern that indicates which flags will be changed opt: Indicates whether flags are set or cleared err: o o o o • No error pgrp is not a flag group pgrp is null Invalid options Return value: Final flag group state Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Looking for Events of an Event Flag Group, OSFlagAccept... to the desired event flag group to pend to flags: A bit pattern that indicates which flags we will wait for wait_type: Specifies whether you want ALL bits to be set/cleared or ANY of the bits to be set/cleared err: o o o o o • No error pgrp is not a flag group Improper wait type specified pgrp is null Flags not available Return value: Final flag group state Amr Ali Abdel-Naby@2010 Introduction to uCOS- II. .. available resources Return value: o o Non-null for successful creation Null for failure Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Deleting an Event Flag Group, OSFlagDel OS_FLAG_GRP *OSFlagDel (OS_FLAG_GRP *pgrp, INT8U opt, INT8U *err) • • pgrp: A pointer to the desired event flag group to be deleted opt: Delete options o o • Delete always Delete if no pending tasks err: o o o o o o No error