Barracuda Application Server C/C++ Reference
NO
SeCtx.h
1 /*
2  * ____ _________ __ _
3  * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____
4  * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/
5  * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__
6  * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
7  * /____/
8  *
9  ****************************************************************************
10  * HEADER
11  *
12  * $Id: SeCtx.h 4914 2021-12-01 18:24:30Z wini $
13  *
14  * COPYRIGHT: Real Time Logic LLC, 2014 - 2017
15  *
16  * This software is copyrighted by and is the sole property of Real
17  * Time Logic LLC. All rights, title, ownership, or other interests in
18  * the software remain the property of Real Time Logic LLC. This
19  * software may only be used in accordance with the terms and
20  * conditions stipulated in the corresponding license agreement under
21  * which the software has been supplied. Any unauthorized use,
22  * duplication, transmission, distribution, or disclosure of this
23  * software is expressly forbidden.
24  *
25  * This Copyright notice may not be removed or modified without prior
26  * written consent of Real Time Logic LLC.
27  *
28  * Real Time Logic LLC. reserves the right to modify this software
29  * without notice.
30  *
31  * http://sharkssl.com
32  ****************************************************************************
33  *
34  */
35 
36 #define SE_CTX
37 
38 
59 #include <setjmp.h>
60 #include <TargConfig.h>
61 
62 struct SeCtx;
63 
65 typedef void (*SeCtxTask)(struct SeCtx* ctx);
66 
70 typedef struct SeCtx
71 {
72  jmp_buf savedContext;
73 #ifndef NDEBUG
74  U32 magic1;
75 #endif
76  jmp_buf startContext;
77 #ifndef NDEBUG
78  U32 magic2;
79 #endif
80  SeCtxTask task;
81  U8* stackTop;
82  void* stackBuf;
83 #ifndef NDEBUG
84  U8* currentStack;
85 #endif
86  U32 timeout;
87  U32 startTime;
88  U16 stackBufLen;
89  U8 hasContext;
90  U8 ready;
91 #ifdef SECTX_EX
92  SECTX_EX;
93 #endif
95 
96 #define SeCtx_setStackTop(o, stackMark) \
97  (*(stackMark)=1,(o)->stackTop=stackMark,setjmp((o)->startContext))
98 
99 #ifdef DYNAMIC_SE_CTX
101 void SeCtx_destructor(SeCtx* o);
102 #else
103 
104 
113 void SeCtx_constructor(SeCtx* o, SeCtxTask t, void* buf, int bufLen);
114 #define SeCtx_destructor(o)
115 #endif
116 
117 void SeCtx_save(SeCtx* o);
118 
119 void SeCtx_restore(SeCtx* o);
120 
124 void SeCtx_panic(SeCtx* o, U32 size);
125  /* end group SeCtx */
SeCtx_constructor
void SeCtx_constructor(SeCtx *o, SeCtxTask t, void *buf, int bufLen)
Create a Context Manager instance.
SeCtx_panic
void SeCtx_panic(SeCtx *o, U32 size)
Function you must implement.
SeCtx
struct SeCtx SeCtx
SeCtx structure: See Context Manager and Bare Metal Systems for details.
SeCtxTask
void(* SeCtxTask)(struct SeCtx *ctx)
The task/thread entry point.
Definition: SeCtx.h:65
SeCtx
SeCtx structure: See Context Manager and Bare Metal Systems for details.
Definition: SeCtx.h:71