| 1 | /* |
| 2 | * coRoutine.h |
| 3 | * |
| 4 | * [Generated from coRoutine, 25 September 1996] |
| 5 | */ |
| 6 | |
| 7 | #if !defined(__CC_NORCROFT) || !defined(__arm) |
| 8 | #error You must use the Norcroft ARM Compiler for Sapphire programs |
| 9 | #endif |
| 10 | |
| 11 | #pragma include_only_once |
| 12 | #pragma force_top_level |
| 13 | |
| 14 | #ifndef __coRoutine_h |
| 15 | #define __coRoutine_h |
| 16 | |
| 17 | #ifndef __sapphire_h |
| 18 | #include "sapphire.h" |
| 19 | #endif |
| 20 | |
| 21 | /*----- Overview ----------------------------------------------------------* |
| 22 | * |
| 23 | * Functions provided: |
| 24 | * |
| 25 | * coRout_create |
| 26 | * coRout_switch |
| 27 | * coRout_destroy |
| 28 | * coRout_end |
| 29 | */ |
| 30 | |
| 31 | /* --- coRout_create --- * |
| 32 | * |
| 33 | * On entry: R0 == pointer to coroutine |
| 34 | * R1 == R10 value to pass to coroutine |
| 35 | * R2 == R12 value to pass to coroutine |
| 36 | * R3 == size of stack to pass (0 for default) |
| 37 | * |
| 38 | * On exit: R0 == coroutine handle |
| 39 | * May return an error |
| 40 | * |
| 41 | * Use: Creates a new coroutine. It may be given control using |
| 42 | * coRout_switch. Its registers are on entry: |
| 43 | * |
| 44 | * R0 == its coroutine handle |
| 45 | * R10 == value passed to coRout_create in R1 |
| 46 | * R12 == value passed to coRout_create in R2 |
| 47 | * R13 == pointer to the stack created for it |
| 48 | */ |
| 49 | |
| 50 | extern routine coRout_create; |
| 51 | |
| 52 | /* --- coRout_switch --- * |
| 53 | * |
| 54 | * On entry: R0 == coroutine to switch to, or 0 for main |
| 55 | * |
| 56 | * On exit: -- |
| 57 | * |
| 58 | * Use: Switches context to another coroutine. |
| 59 | */ |
| 60 | |
| 61 | extern routine coRout_switch; |
| 62 | |
| 63 | /* --- coRout_destroy --- * |
| 64 | * |
| 65 | * On entry: R0 == coroutine handle to destroy |
| 66 | * |
| 67 | * On exit: -- |
| 68 | * |
| 69 | * Use: Destroys a coroutine. |
| 70 | */ |
| 71 | |
| 72 | extern routine coRout_destroy; |
| 73 | |
| 74 | /* --- coRout_end --- * |
| 75 | * |
| 76 | * On entry: -- |
| 77 | * |
| 78 | * On exit: Doesn't. |
| 79 | * |
| 80 | * Use: Terminates the current coroutine. |
| 81 | */ |
| 82 | |
| 83 | extern routine coRout_end; |
| 84 | |
| 85 | /*----- That's all, folks -------------------------------------------------*/ |
| 86 | |
| 87 | #endif |