Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 15 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
15
Dung lượng
322,5 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 Mutexes • They are used to gain exclusive access to resources • They reduce priority inversion problem (priority ceiling protocol is supported) OSMutexCreate() OSMutexDel() OSMutexPost() Task Amr Ali Abdel-Naby@2010 OSMutexPend() OSMutexAccept() OSMutexQuery() Task Introduction to uCOS-II V2.6 Creating a Mutex, OSMutexCreate OS_EVENT *OSMutexCreate (INT8U prio, INT8U *err) • • prio: Ceiling priroity err: o o o o o • No error Called from ISR Priority exists Invalid priority 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 a Mutex, OSMutexDel OS_EVENT *OSMutexDel (OS_EVENT *pevent, INT8U opt, INT8U *err) • • pevent: A pointer to the mutex 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 Invalid option There are tasks pending pevent is null pevent is not a semaphore Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Deleting a Mutex, OSMutexDel cont’d OS_EVENT *OSMutexDel (OS_EVENT *pevent, INT8U opt, INT8U *err) • Return value: Null if successful Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Waiting on a Mutex (Blocking), OSMutexPend void OSMutexPend (OS_EVENT *pevent, INT16U timeout, INT8U *err) • • pevent: A pointer to the mutex to acquire timeout: o o • err: o o o o o wait for ever !0 wait with specific timeout No error Timeout pevent is not a mutex pevent is null Called from ISR Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Signaling a Mutex, OSMutexPost INT8U OSMutexPost (OS_EVENT *pevent) • • pevent: A pointer to the mutex to release Return value: o o o o o No error Not mutex owner Called from ISR pevent is not a mutex pevent is null Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Getting a Mutex without Waiting, OSMutexAccept INT8U OSMutexAccept (OS_EVENT *pevent, INT8U *err) • • pevent: A pointer to the mutex to acquire err: o o o o • No error Called from ISR pevent is not a mutex pevent is null Return value: o o resource available case of error or mutex is no available Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Obtaining the Status of a Mutex, OSMutexQuery INT8U OSMutexQuery (OS_EVENT *pevent, OS_MUTEX_DATA *pdata) • • • pevent: A pointer to the desired mutex pdata: A pointer to the returned mutex information Return value: o o o o No error Called from ISR pevent is not a mutex pevent is null Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 [...]... Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Waiting on a Mutex (Blocking), OSMutexPend void OSMutexPend (OS_EVENT *pevent, INT16U timeout, INT8U *err) • • pevent: A pointer to the mutex to acquire timeout: o o • err: o o o o o 0 wait for ever !0 wait with specific timeout No error Timeout pevent is not a mutex pevent is null Called from ISR Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Signaling... Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Obtaining the Status of a Mutex, OSMutexQuery INT8U OSMutexQuery (OS_EVENT *pevent, OS_MUTEX_DATA *pdata) • • • pevent: A pointer to the desired mutex pdata: A pointer to the returned mutex information Return value: o o o o No error Called from ISR pevent is not a mutex pevent is null Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 ... OSMutexPost (OS_EVENT *pevent) • • pevent: A pointer to the mutex to release Return value: o o o o o No error Not mutex owner Called from ISR pevent is not a mutex pevent is null Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Getting a Mutex without Waiting, OSMutexAccept INT8U OSMutexAccept (OS_EVENT *pevent, INT8U *err) • • pevent: A pointer to the mutex to acquire err: o o o o • No error Called from