Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
coos.h@2:360f136fabaa, 2013-09-16 (annotated)
- Committer:
- akouz
- Date:
- Mon Sep 16 11:40:39 2013 +0000
- Revision:
- 2:360f136fabaa
- Child:
- 4:690def0f4387
"HelloWorld" on top of an simple cooperative operating system COOS
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
akouz | 2:360f136fabaa | 1 | #ifndef __COOS_H |
akouz | 2:360f136fabaa | 2 | #define __COOS_H |
akouz | 2:360f136fabaa | 3 | |
akouz | 2:360f136fabaa | 4 | //########################################################## |
akouz | 2:360f136fabaa | 5 | // Common includes |
akouz | 2:360f136fabaa | 6 | //########################################################## |
akouz | 2:360f136fabaa | 7 | |
akouz | 2:360f136fabaa | 8 | #include <setjmp.h> |
akouz | 2:360f136fabaa | 9 | |
akouz | 2:360f136fabaa | 10 | //########################################################## |
akouz | 2:360f136fabaa | 11 | // def & enum |
akouz | 2:360f136fabaa | 12 | //########################################################## |
akouz | 2:360f136fabaa | 13 | enum{ |
akouz | 2:360f136fabaa | 14 | MAX_TASKS = 8, |
akouz | 2:360f136fabaa | 15 | STOP = -2 |
akouz | 2:360f136fabaa | 16 | }; |
akouz | 2:360f136fabaa | 17 | |
akouz | 2:360f136fabaa | 18 | #define DELAY(__delay) if (!setjmp(COOS_task_context[COOS_task_no])) {longjmp(COOS_main_context, __delay+1);} else |
akouz | 2:360f136fabaa | 19 | |
akouz | 2:360f136fabaa | 20 | //########################################################## |
akouz | 2:360f136fabaa | 21 | // var |
akouz | 2:360f136fabaa | 22 | //########################################################## |
akouz | 2:360f136fabaa | 23 | |
akouz | 2:360f136fabaa | 24 | extern jmp_buf COOS_main_context; |
akouz | 2:360f136fabaa | 25 | extern jmp_buf COOS_task_context[MAX_TASKS]; /* store environment for all tasks */ |
akouz | 2:360f136fabaa | 26 | extern volatile uchar COOS_task_no; |
akouz | 2:360f136fabaa | 27 | |
akouz | 2:360f136fabaa | 28 | //########################################################## |
akouz | 2:360f136fabaa | 29 | // func |
akouz | 2:360f136fabaa | 30 | //########################################################## |
akouz | 2:360f136fabaa | 31 | |
akouz | 2:360f136fabaa | 32 | void shutdown_task(uchar task_No); |
akouz | 2:360f136fabaa | 33 | void wake_up_task(uchar task_No); |
akouz | 2:360f136fabaa | 34 | |
akouz | 2:360f136fabaa | 35 | #endif /* __COOS_H */ |