The SeCtx library makes it possible to use sequential functions in an event driven system such as a bare metal (non RTOS) system.
It does so by implementing a method for saving and restoring the stack by using the standard C library functions setjmp/longjmp.
See Bare Metal Systems for an introduction.
◆ SeCtx_destructor
| #define SeCtx_destructor |
( |
|
o | ) |
|
◆ SeCtx_setStackTop
| #define SeCtx_setStackTop |
( |
|
o, |
|
|
|
stackMark |
|
) |
| (*(stackMark)=1,(o)->stackTop=stackMark,setjmp((o)->startContext)) |
◆ SeCtx
◆ SeCtxTask
| typedef void(* SeCtxTask) (struct SeCtx *ctx) |
The task/thread entry point.
◆ SeCtx_constructor()
| void SeCtx_constructor |
( |
SeCtx * |
o, |
|
|
SeCtxTask |
t, |
|
|
void * |
buf, |
|
|
int |
bufLen |
|
) |
| |
Create a Context Manager instance.
- Parameters
-
| o | uninitialized data of size sizeof(SeCtx). |
| t | the task/thread to call |
| buf | buffer used for storing the stack when switching from sequential mode to event driven mode. |
| bufLen | buffer length. |
- See also
- SeCtx_panic
◆ SeCtx_panic()
| void SeCtx_panic |
( |
SeCtx * |
o, |
|
|
U32 |
size |
|
) |
| |
Function you must implement.
This function is called if the buffer provided in SeCtx_constructor is too small.
- Parameters
-
| o | Context whose stack buffer could not be allocated or is too small; NULL for a dynamic stack request exceeding 40 KiB. |
| size | Required stack-save size in bytes. |
◆ SeCtx_restore()
| void SeCtx_restore |
( |
SeCtx * |
o | ) |
|
◆ SeCtx_save()
| void SeCtx_save |
( |
SeCtx * |
o | ) |
|