Escolar Documentos
Profissional Documentos
Cultura Documentos
block
Details with Message Queues
pT
emperatures[0] = }
pT
emperatures[1] =
OSQPost(pOseQueueTemp,
(void*)pT
emperatures);
}
}
Trade-offs among
Flexibility, speed, memory space, disabled
interrupt time length
Refer to documents
Pitfalls
•Passing Pointers through a queue may create
shared data bugs
void vReadT
emperaturesT
ask(void) void vReadTemperaturesTask(void)
{ {
int *pT
emperatures; int iT
emperatures[2];
W hile(TRUE) { W hile(TRUE) {
… …
pTemperatures =
(int*)malloc(2*sizeof*pT
emperatures); iT
emperatures[0] =
iT
emperatures[1] =
pT
emperatures[0] =
pT
emperatures[1] = OSQPost(pOseQueueT emp,
(void*)iT
emperatures);
OSQPost(pOseQueueTemp, }
(void*)pT
emperatures); }
}
}
Timer Functions
}
Events
• Procedure
1. More than task can block waiting
2. The events occurs
3. The RTOS will unblock all of tasks
Form group of events and any subset of
events within the group
Need to reset events automatically or
manually
Comparison for Intertask Comm.
ISR
RTOS
TaskLow
Time
ISR
RTOS
TaskLow
Time
Call Return
RTOS
Send Message
TaskHigh to mailbox
TaskLow
Time
Jump or call
RTOS
TaskLow
Time
High-priority
ISR
Low-priority
ISR
RTOS
Time