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

Introduction to uCOS II v2 6 m10

18 231 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

Thông tin cơ bản

Định dạng
Số trang 18
Dung lượng 317,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 Memory Management • Fixed-size memory block management o To prevent fragmentation • Multiple partitions can be created with different sizes • Blocks allocated from certain partitions must be returned back to the same partitions Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Memory Management cont’d Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Memory Management APIs • Available memory operations are: o o o o o o Creating a memory partition Obtaining a memory block Returning a memory block Obtaining status of a memory partition Naming a memory partition Getting the name of a memory partition Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Creating a Partition, OSMemCreate • A partition must be created before used OS_MEM *CommTxBuf; INT8U *CommTxPart[100][32]; void main(void){ CommTxBuf = OSMemCreate(CommTXPart, 100, 32, &err); } Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Creating a Partition, OSMemCreate cont’d OS_MEM *OSMemCreate (void *addr, INT32U nblks, INT32U blksize, INT8U *err) • • • • addr: The starting address of the memory partition nblks: The number of memory blocks to create from the partition blksize: The size (in bytes) of each block in the memory partition err: o o o o o No error Invalid address No available resources Invalid number # blocks Invalid block size Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Obtaining a Memory Block, OSMemGet void *OSMemGet (OS_MEM *pmem, INT8U *err) • • pmem: A pointer to the memory partition control block to get the block from err: o o o • No error No free blocks PMEM is null Return value: o o Non-null for successful creation Null for failure Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Naming a Memory Partition, OSMemNameSet void OSMemNameSet (OS_MEM *pmem, char *pname, INT8U *err) • • • pmem: A pointer to the memory partition control block to give a name to it pname: A pointer to an ASCII string that contains the name err: o o o o No error pmem is null pname is null Long name Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Getting a Memory Partition Name, OSMemNameGet INT8U OSMemNameGet (OS_MEM *pmem, char *pname, INT8U *err) • • • pmem: A pointer to the memory partition control block to get its name pname: A pointer to an ASCII string that will receive the name err: o o o • No error pmem is null pname is null Return value: Name length Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Returning a Memory Block, OSMemPut INT8U OSMemPut (OS_MEM *pmem, void *pblk) • • • pmem: A pointer to the memory partition control block that the block belongs to pblk: A pointer to the memory block being released Return value: o o o o No error Freeing more than allocation pmem is null pblk is null Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Obtaining Status of a Memory Partition, OSMemQuery INT8U OSMemQuery (OS_MEM *pmem, OS_MEM_DATA *pdata) • • • pmem: A pointer to the desired memory partition control block pdata: A pointer to the returned memory partition control block information Return value: o o o No error pmem is null pdata is null Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 Waiting for Memory Blocks from a Partition • Waiting for memory blocks is not supported in µC/OS-II • It might be desirable to wait for memory blocks from a full partition • Semaphores are here to help • Semaphores will guard the partition Amr Ali Abdel-Naby@2010 Introduction to uCOS-II V2.6 [...]... Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Obtaining a Memory Block, OSMemGet void *OSMemGet (OS_MEM *pmem, INT8U *err) • • pmem: A pointer to the memory partition control block to get the block from err: o o o • No error No free blocks PMEM is null Return value: o o Non-null for successful creation Null for failure Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Naming a Memory Partition,... Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Obtaining Status of a Memory Partition, OSMemQuery INT8U OSMemQuery (OS_MEM *pmem, OS_MEM_DATA *pdata) • • • pmem: A pointer to the desired memory partition control block pdata: A pointer to the returned memory partition control block information Return value: o o o No error pmem is null pdata is null Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Waiting... pointer to the memory partition control block to give a name to it pname: A pointer to an ASCII string that contains the name err: o o o o No error pmem is null pname is null Long name Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Getting a Memory Partition Name, OSMemNameGet INT8U OSMemNameGet (OS_MEM *pmem, char *pname, INT8U *err) • • • pmem: A pointer to the memory partition control block to. .. its name pname: A pointer to an ASCII string that will receive the name err: o o o • No error pmem is null pname is null Return value: Name length Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Returning a Memory Block, OSMemPut INT8U OSMemPut (OS_MEM *pmem, void *pblk) • • • pmem: A pointer to the memory partition control block that the block belongs to pblk: A pointer to the memory block being... uCOS- II V2. 6 Waiting for Memory Blocks from a Partition • Waiting for memory blocks is not supported in µC/OS -II • It might be desirable to wait for memory blocks from a full partition • Semaphores are here to help • Semaphores will guard the partition Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 ... main(void){ CommTxBuf = OSMemCreate(CommTXPart, 100, 32, &err); } Amr Ali Abdel-Naby@2010 Introduction to uCOS- II V2. 6 Creating a Partition, OSMemCreate cont’d OS_MEM *OSMemCreate (void *addr, INT32U nblks, INT32U blksize, INT8U *err) • • • • addr: The starting address of the memory partition nblks: The number of memory blocks to create from the partition blksize: The size (in bytes) of each block in the memory

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

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN