Tải bản đầy đủ (.ppt) (15 trang)

Introduction to uCOS II v2 6 m5

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (145.38 KB, 15 trang )

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: 5 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


Semaphores
• Semaphores are 16 bit unsigned integers used for resource
sharing or to signal the occurrence of an event.

OSSemCreate()
OSSemDel()
OSSemPost()

OSSemAccept()
OSSemPend()
OSSemQuery()

ISR

Task

N


Task
OSSemPost()

Amr Ali Abdel-Naby@2010

N
OSSemAccept()

Introduction to uCOS-II V2.6

ISR


Creating a Semaphore,
OSSemCreate
OS_EVENT *OSSemCreate (INT16U cnt)


cnt: The initial value for the semaphore
o
o



0  No resource available
N  Resource initially available

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 Semaphore, OSSemDel
OS_EVENT *OSSemDel (OS_EVENT *pevent, INT8U opt, INT8U
*err)



pevent: A pointer to the semaphore 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 Semaphore, OSSemDel
cont’d
OS_EVENT *OSSemDel (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 Semaphore (Blocking),
OSSemPend

void OSSemPend (OS_EVENT *pevent, INT16U timeout, INT8U
*err)



pevent: A pointer to the semaphore 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 semaphore.
pevent is null.
Called from ISR

Amr Ali Abdel-Naby@2010


Introduction to uCOS-II V2.6


Signaling a Semaphore, OSSemPost
INT8U OSSemPost (OS_EVENT *pevent)



pevent: A pointer to the semaphore to post to
Return value:
o
o
o
o

No error
Semaphore overflow
pevent is not a semaphore.
pevent is null.

Amr Ali Abdel-Naby@2010

Introduction to uCOS-II V2.6


Getting a Semaphore without Waiting,
OSSemAccept
INT16U OSSemAccept (OS_EVENT *pevent)




pevent: A pointer to the semaphore to pend to
Return value:
o
o

Count
0  case of error or semaphore is no available

Amr Ali Abdel-Naby@2010

Introduction to uCOS-II V2.6


Obtaining the Status of a Semaphore,
OSSemQuery
INT8U OSSemQuery (OS_EVENT *pevent, OS_SEM_DATA *pdata)




pevent: A pointer to the desired semaphore
pdata: A pointer to the returned semaphore information
Return value:
o
o
o

No error
pevent is not a semaphore.

pevent is null.

Amr Ali Abdel-Naby@2010

Introduction to uCOS-II V2.6



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×