1. Trang chủ
  2. » Cao đẳng - Đại học

Introduction to uCOS II v2 6 m9

20 268 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

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 Message Queues • A message queue is a μC/OS-II object that allows a task or an ISR to send pointer-sized variables to another task OSQPost() OSQPostFront() OSQFlush() OSQPostOpt() OSQCreate() OSQPend() OSQAccept() OSQQuery() Task Task ISR Amr Ali Abdel-Naby@2010 OSQPost() OSQPostFront() OSQFlush() OSQAccept() OSQPostOpt() Introduction to uCOS-II V2.6 Message Creating a Message Queue, OSQCreate OS_EVENT *OSQCreate (void **start, INT16U size) • • • start: A pointer to the base address of the message queue storage area size: # of elements in queue 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 Message Queue, OSQDel OS_EVENT *OSQDel (OS_EVENT *pevent, INT8U opt, INT8U *err) • • pevent: A pointer to the message queue 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 message queue Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Deleting a Message Queue, OSQDel cont’d OS_EVENT *OSQDel (OS_EVENT *pevent, INT8U opt, INT8U *err) • Return value: Null if successful Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Waiting for a Message at a Queue (Blocking), OSQPend void *OSQPend (OS_EVENT *pevent, INT16U timeout, INT8U *err) • • pevent: A pointer to the message queue to pend to timeout: o o •  wait for ever !0  wait with specific timeout err: o o o o o No error Timeout pevent is not a message queue pevent is null Called from ISR Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Sending a Message to a Queue (FIFO), OSQPost INT8U OSQPost (OS_EVENT *pevent, void *msg) • • • pevent: A pointer to the message queue to post to msg: A pointer to the message to send Return value: o o o o No error Message queue is full pevent is not a message queue pevent is null Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Sending a Message to a Queue (LIFO), OSQPostFront • OSQPostFront = OSQPost with LIFO instead of FIFO Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Sending a Message to a Queue (FIFO or LIFO), OSQPostOpt INT8U OSQPostOpt (OS_EVENT *pevent, void *msg, INT8U opt) • • OSQPostOpt = OSQPost + options opt: o o o o Post with FIFO Post with LIFO Post with FIFO + Broadcast Post with LIFO + Broadcast Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Getting a Message without Waiting, OSQAccept void *OSQAccept (OS_EVENT *pevent, INT8U *err) • • pevent: A pointer to the message queue to pend to err: o o o o • No error pevent is not a message queue pevent is null Queue is empty Return value: o o !0  Message received  Case of error or message queue is empty Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Flushing a Queue, OSQFlush INT8U OSQFlush (OS_EVENT *pevent) • • pevent: A pointer to the message queue to be flushed Return value: o o o No error pevent is not a message queue pevent is null Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Obtaining the Status of a Queue, OSQQuery INT8U OSQQuery (OS_EVENT *pevent, OS_Q_DATA *pdata) • • • pevent: A pointer to the desired message queue pdata: A pointer to the returned message queue information Return value: o o o No error pevent is not a message queue pevent is null Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Using a Message Queue when Reading Analog Inputs M U X Amr Ali Abdel-Naby@2010 ADC ADC Task Introduction to uCOS-II V2.6 Using a Queue as a Counting Semaphore OS_EVENT *QSem; void *QMsgTbl[N_RESOURCES]; void main(void){ QSem = OSQCreate(&QMsgTbl[0], N_RESOURCES); for (i=0; i[...]... instead of FIFO Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Sending a Message to a Queue (FIFO or LIFO), OSQPostOpt INT8U OSQPostOpt (OS_EVENT *pevent, void *msg, INT8U opt) • • OSQPostOpt = OSQPost + options opt: o o o o Post with FIFO Post with LIFO Post with FIFO + Broadcast Post with LIFO + Broadcast Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Getting a Message without Waiting, OSQAccept... Introduction to uCOS- II V2. 6 Sending a Message to a Queue (FIFO), OSQPost INT8U OSQPost (OS_EVENT *pevent, void *msg) • • • pevent: A pointer to the message queue to post to msg: A pointer to the message to send Return value: o o o o No error Message queue is full pevent is not a message queue pevent is null Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Sending a Message to a Queue (LIFO), OSQPostFront... Introduction to uCOS- II V2. 6 Waiting for a Message at a Queue (Blocking), OSQPend void *OSQPend (OS_EVENT *pevent, INT16U timeout, INT8U *err) • • pevent: A pointer to the message queue to pend to timeout: o o • 0  wait for ever !0  wait with specific timeout err: o o o o o No error Timeout pevent is not a message queue pevent is null Called from ISR Amr Ali Abdel-Naby@2010 Introduction to uCOS- II. .. Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Obtaining the Status of a Queue, OSQQuery INT8U OSQQuery (OS_EVENT *pevent, OS_Q_DATA *pdata) • • • pevent: A pointer to the desired message queue pdata: A pointer to the returned message queue information Return value: o o o No error pevent is not a message queue pevent is null Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Using a Message Queue... • • pevent: A pointer to the message queue to pend to err: o o o o • No error pevent is not a message queue pevent is null Queue is empty Return value: o o !0  Message received 0  Case of error or message queue is empty Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Flushing a Queue, OSQFlush INT8U OSQFlush (OS_EVENT *pevent) • • pevent: A pointer to the message queue to be flushed Return value:... X Amr Ali Abdel-Naby@2010 ADC ADC Task Introduction to uCOS- II V2. 6 Using a Queue as a Counting Semaphore OS_EVENT *QSem; void *QMsgTbl[N_RESOURCES]; void main(void){ QSem = OSQCreate(&QMsgTbl[0], N_RESOURCES); for (i=0; i

Ngày đăng: 10/08/2016, 09:56

Xem thêm: Introduction to uCOS II v2 6 m9

TỪ KHÓA LIÊN QUAN