BÙI QUC BO
1
ARM PROGRAMMING
Bùi Quc Bo
Why use RTOS
•Three sources of LCD messages
•Mix of fast and slow hardware
•Mix of continuous, periodic, event driven, high
priority and low priority requirements
BÙI QUC BO
2
Why use RTOS
Concurrent processing
BÙI QUC BO
3
Scheduler
Scheduler là 1 ph5n c6a kernel dùng ñ9 quy:t
ñ;nh tác v= nào ñư?c ch@y t@i mAi thBi ñi9m.
Kernel có th9 dFng ph=c hGi ho@t ñHng c6a
1 tác v= trong khi tác v= ñang ch@y.
MHt tác v= th9 dFng chính bKng cách
delay (sleep) mHt khong thBi gian, hoNc ch
(block) ñ9 ñ?i mHt sO kiPn (vd: keypressed)
hay 1 tài nguyên (vd: serialport)
Scheduler
BÙI QUC BO
4
Scheduler
At (1) task 1 is executing.
At (2) the kernel suspends task 1 ...
and at (3) resumes task 2.
While task 2 is executing (4), it locks a
processor peripheral for it's own
exclusive access.
At (5) the kernel suspends task 2 ...
... and at (6) resumes task 3.
Scheduler
Task 3 tries to access the same processor
peripheral, finding it locked, task 3 cannot
continue so suspends itself at (7).
At (8) the kernel resumes task 1.
Etc.
The next time task 2 is executing (9) it finishes
with the processor peripheral and unlocks it.
The next time task 3 is executing (10) it finds it
can now access the
processor peripheral and this time executes
until suspended by the kernel.
BÙI QUC BO
5
Realtime scheduler
MAi tác v= phi ñáp \ng (response)
trong thBi gian qui ñ;nh (deadline).
MAi tác v= 1 m\c ưu tiên riêng
Scheduler s] ñm bo tác v= có quy^n
ưu tiên cao luôn ñư?c thOc thi bKng
cách t@m dFng tác v= quy^n ưu tiên
th`p.
Realtime OS
Display
Keypad LCD
ADC
Analog Input filter
Sample rate: 5Khz
Response time: 0b100ms
control
output