Presentation is loading. Please wait.

Presentation is loading. Please wait.

Final Labs. Labs  Providing the Wakeup-Highest Option in the OSFlagPost()  Providing Non-Destructive-Read Message API for Message Queue Management in.

Similar presentations


Presentation on theme: "Final Labs. Labs  Providing the Wakeup-Highest Option in the OSFlagPost()  Providing Non-Destructive-Read Message API for Message Queue Management in."— Presentation transcript:

1 Final Labs

2 Labs  Providing the Wakeup-Highest Option in the OSFlagPost()  Providing Non-Destructive-Read Message API for Message Queue Management in MicroC/OS-II  Providing Flush( ) API for Semaphore Operating in MicroC/OS-II  Providing a Three-Dimension Mapping Scheme for Ready List Management in MicroC/OS-II

3 Providing the Wakeup-Highest Option in the OSFlagPost()

4 In OSFlagPost()  All tasks that satisfy their conditions (flags) are waked up  In this Lab You add the option that only wake up the highest priority task If possible, please add the option parameters  Option == 1: wake up all  Option == 2: wake up the highest

5 Providing Non-Destructive-Read Message API for Message Queue Management in MicroC/OS-II

6 Non-Destructive-Read Message  In current MicroC/OS- Ⅱ The OSQPend() function would delete the message in the message queue  Objective in this Lab Add two new APIs called OSQNondestructive() and OSQMegDelete() By OSQNondestructive(), we would receive a message while leave it intact in the message queue Thus, we may allow multiple tasks to receive the same message at different times The message is deleted until OSQMsgDelete() is invoke

7 Providing Flush( ) API for Semaphore Operating in MicroC/OS-II

8 Flush( ) API for Semaphore Operating  Objective Add a new API called OSSemFlush( ) for semaphore management OSSemFlush() would remove all tasks waiting in a semaphore’s waiting list  These tasks are returned from waiting state to their original states  用於讓所有正在等待同一個 semaphore 的 tasks 全部 unblock , 意思是這些 tasks 從 semaphores 的 waiting list 上移除,且 tasks 由 waiting 狀態回到之前原本的狀態。 Thus, OSSemFlush() would signal a set of tasks  OSSemFlush() 的主要功能在於 signal 一群 tasks 。

9 Providing a Three-Dimension Mapping Scheme for Ready List Management in MicroC/OS-II

10 Three-Dimension Mapping Scheme  Objective 更改 MicroC/OS-II 中 Ready List 的 Mapping 方式  將原本二維的 mapping 方式變動至三維 從二維 8×8 的 mapping 方式改至三維 4×4×4 Tasks 的總數量不變,仍然是 0~63 ,共 64 個 tasks

11 Ready List in MicroC/OS-II

12 Approach 原始的 Priority 分法 Task’s Priority 現在的 Priority 分法 Bit position in OSRdyGrp and index into OSRdyTb1[OS_LOWEST_PRIO/8+1] and Index into OSRdyTb2[OS_LOWEST_PRIO/8+1] [OS_LOWEST_PRIO/8+1] Bit position in OSRdyTb1[OS_LOWEST_PRIO/8+1] and Index into OSRdyTb2[OS_LOWEST_PRIO/8+1] [OS_LOWEST_PRIO/8+1] Bit position in OSRdyTb2[OS_LOWEST_PRIO/8+1] [OS_LOWEST_PRIO/8+1] 00ZZYYXX 原始的 Priority 分法

13 Approach (Cont.)  New ready list 包含三個變數 OSRdyGrp OSRdyTb1[] OSRdyTb2[][]  規則如下 : Bit 0 in OSRdyGrp is 1 when any bit in OSRdyTbl[0] is 1. Bit 1 in OSRdyGrp is 1 when any bit in OSRdyTbl[1] is 1. Bit 2 in OSRdyGrp is 1 when any bit in OSRdyTbl[2] is 1 Bit 3 in OSRdyGrp is 1 when any bit in OSRdyTbl[3] is 1. Bit 0 in OSRdyTbl[0] is 1 when any bit in OSRdyTb2[0][0] is 1. Bit 1 in OSRdyTbl[0] is 1 when any bit in OSRdyTb2[0][1] is 1. Bit 2 in OSRdyTbl[0] is 1 when any bit in OSRdyTb2[0][2] is 1 Bit 3 in OSRdyTbl[0] is 1 when any bit in OSRdyTb2[0][3] is 1 其它以此類推 …

14 Approach (Cont.)

15 Possible Modified Functions  OS_CORE.C: OSIntExit() OSStart() OSTimeTick() OS_EventTaskRdy() OS_EventTaskWait() OS_EventTO() OS_EventWaitListInit() OS_InitRdyList() OS_Sched() OS_TCBInit()  OS_TIME.C OSTimeDly()  OS_TASK.C OSTaskChangePrio()

16 Deadline  2007, 1, 19


Download ppt "Final Labs. Labs  Providing the Wakeup-Highest Option in the OSFlagPost()  Providing Non-Destructive-Read Message API for Message Queue Management in."

Similar presentations


Ads by Google