没有合适的资源?快使用搜索试试~ 我知道了~
HelloM3_Using the FreeRTOS Real Time Kernel - A Practical Guide_...
4星 · 超过85%的资源 需积分: 10 21 下载量 9 浏览量
2013-07-07
12:43:56
上传
评论
收藏 1.72MB PDF 举报
温馨提示
试读
163页
elloM3_Using the FreeRTOS Real Time Kernel - A Practical Guide_opened
资源推荐
资源详情
资源评论
USING THE F
REE
RTOS
REAL TIME KERNEL
A Practical Guide
Richard Barry
This page intentionally left blank
© 2009 Richard Barry
All text, source code and diagrams are the exclusive property of Richard Barry. Distribution or
publication in any form is strictly prohibited without prior written authority from Richard Barry.
FreeRTOS™, FreeRTOS.org™ and the FreeRTOS logo are trade marks of Richard Barry.
Version 1.0.5
http://www.FreeRTOS.org
FreeRTOS
Designed For Microcontrollers;
i
© 2009 Richard Barry. Distribution or publication in any form is strictly prohibited.
CONTENTS
CONTENTS I
LIST OF FIGURES .........................................................................................................................V
LIST OF CODE LISTINGS.............................................................................................................VI
LIST OF TABLES...........................................................................................................................IX
LIST OF NOTATION.......................................................................................................................X
CHAPTER 1
TASK MANAGEMENT......................................................................................... 1
1.1
C
HAPTER
I
NTRODUCTION AND
S
COPE
..................................................................................... 2
An Introduction to Multi Tasking in Small Embedded Systems ..................................................... 2
A Note About Terminology ........................................................................................................... 2
Scope........................................................................................................................................... 3
1.2
T
ASK
F
UNCTIONS
................................................................................................................... 4
1.3
T
OP
L
EVEL
T
ASK
S
TATES
....................................................................................................... 5
1.4
C
REATING
T
ASKS
................................................................................................................... 6
xTaskCreate() API Function ......................................................................................................... 6
Example 1.
Creating Tasks...................................................................................................... 8
Example 2.
Using the Task Parameter................................................................................... 12
1.5
T
ASK
P
RIORITIES
................................................................................................................. 15
Example 3.
Experimenting with priorities ............................................................................... 16
1.6
E
XPANDING THE
‘N
OT
R
UNNING
’
S
TATE
................................................................................. 19
The Blocked State...................................................................................................................... 19
The Suspended State................................................................................................................. 19
The Ready State ........................................................................................................................ 20
Completing the State Transition Diagram................................................................................... 20
Example 4.
Using the Blocked state to create a delay............................................................ 20
vTaskDelayUntil() API function................................................................................................... 24
1.7
T
HE
I
DLE
T
ASK AND THE
I
DLE
T
ASK
H
OOK
............................................................................. 29
Idle Task Hook Functions........................................................................................................... 29
Limitations on the Implementation of Idle Task Hook Functions ................................................. 29
Example 7.
Defining an Idle Task Hook Function................................................................... 30
1.8
C
HANGING THE
P
RIORITY OF A
T
ASK
..................................................................................... 32
vTaskPrioritySet() API function................................................................................................... 32
uxTaskPriorityGet() API function ................................................................................................ 32
Example 8.
Changing task priorities....................................................................................... 33
1.9
D
ELETING A
T
ASK
................................................................................................................. 38
http://www.FreeRTOS.org
FreeRTOS
Designed For Microcontrollers;
ii
© 2009 Richard Barry. Distribution or publication in any form is strictly prohibited.
vTaskDelete() API function......................................................................................................... 38
Example 9.
Deleting tasks ..................................................................................................... 39
1.10
T
HE
S
CHEDULING
A
LGORITHM
–
A
S
UMMARY
........................................................................ 42
Prioritized Preemptive Scheduling.............................................................................................. 42
Selecting Task Priorities............................................................................................................. 43
Co-operative Scheduling............................................................................................................ 44
CHAPTER 2
QUEUE MANAGEMENT ................................................................................... 45
2.1
C
HAPTER
I
NTRODUCTION AND
S
COPE
................................................................................... 46
Scope......................................................................................................................................... 46
2.2
C
HARACTERISTICS OF A
Q
UEUE
............................................................................................ 47
Data Storage.............................................................................................................................. 47
Access by Multiple Tasks ........................................................................................................... 47
Blocking on Queue Reads.......................................................................................................... 47
Blocking on Queue Writes.......................................................................................................... 47
2.3
U
SING A
Q
UEUE
................................................................................................................... 49
xQueueCreate() API Function .................................................................................................... 49
xQueueSendToBack() and xQueueSendToFront() API Functions.............................................. 50
xQueueReceive() and xQueuePeek() API Functions.................................................................. 51
uxQueueMessagesWaiting() API Function................................................................................. 53
Example 10.
Blocking When Receiving From a Queue............................................................ 54
Using Queues to Transfer Compound Types ............................................................................. 58
Example 11.
Blocking When Sending to a Queue / Sending Structures on a Queue............... 59
2.4
W
ORKING WITH
L
ARGE
D
ATA
................................................................................................ 66
CHAPTER 3
INTERRUPT MANAGEMENT............................................................................ 67
3.1
C
HAPTER
I
NTRODUCTION AND
S
COPE
................................................................................... 68
Events........................................................................................................................................ 68
Scope......................................................................................................................................... 68
3.2
D
EFERRED
I
NTERRUPT PROCESSING
..................................................................................... 69
Binary Semaphores used for Synchronization............................................................................ 69
vSemaphoreCreateBinary() API Function................................................................................... 70
xSemaphoreTake() API Function ............................................................................................... 72
xSemaphoreGiveFromISR() API Function.................................................................................. 74
Example 12.
Using a Binary Semaphore to Synchronize a Task with an Interrupt................... 75
3.3
C
OUNTING
S
EMAPHORES
...................................................................................................... 80
xSemaphoreCreateCounting() API Function .............................................................................. 83
Example 13.
Using a Counting Semaphore to Synchronize a Task with an Interrupt............... 84
3.4
U
SING
Q
UEUES WITHIN AN
I
NTERRUPT
S
ERVICE
R
OUTINE
...................................................... 87
xQueueSendToFrontFromISR() and xQueueSendToBackFromISR() API Functions.................. 87
Efficient Queue Usage ............................................................................................................... 88
剩余162页未读,继续阅读
资源评论
- qq_238998392014-11-24HelloM3不知道啥意思
- 隐星魂2014-10-22官方要钱的书
180228
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功