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
评论0
最新资源