36 |
|
|
37 |
#include "lwip/opt.h" |
#include "lwip/opt.h" |
38 |
|
|
39 |
|
|
40 |
#if NO_SYS |
#if NO_SYS |
41 |
|
|
42 |
/* For a totally minimal and standalone system, we provide null |
/* For a totally minimal and standalone system, we provide null |
58 |
|
|
59 |
#define sys_thread_new(t,a) |
#define sys_thread_new(t,a) |
60 |
|
|
61 |
|
/* We don't need protection if there is no OS */ |
62 |
|
#define SYS_ARCH_DECL_PROTECT(lev) |
63 |
|
#define SYS_ARCH_PROTECT(lev) |
64 |
|
#define SYS_ARCH_UNPROTECT(lev) |
65 |
|
|
66 |
#else /* NO_SYS */ |
#else /* NO_SYS */ |
67 |
|
|
68 |
#include "arch/sys_arch.h" |
#include "arch/sys_arch.h" |
93 |
* |
* |
94 |
*/ |
*/ |
95 |
void sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg); |
void sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg); |
96 |
void sys_timeout_remove(sys_timeout_handler h, void *arg); |
void sys_untimeout(sys_timeout_handler h, void *arg); |
97 |
struct sys_timeouts *sys_arch_timeouts(void); |
struct sys_timeouts *sys_arch_timeouts(void); |
98 |
|
|
99 |
/* Semaphore functions. */ |
/* Semaphore functions. */ |
116 |
In some implementations they can provide a more light-weight protection |
In some implementations they can provide a more light-weight protection |
117 |
mechanism than using semaphores. Otherwise semaphores can be used for |
mechanism than using semaphores. Otherwise semaphores can be used for |
118 |
implementation */ |
implementation */ |
119 |
u32_t sys_arch_protect(void); |
#ifndef SYS_ARCH_PROTECT |
120 |
void sys_arch_unprotect(u32_t pval); |
/** SYS_LIGHTWEIGHT_PROT |
121 |
|
* define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection |
122 |
|
* for certain critical regions during buffer allocation, deallocation and memory |
123 |
|
* allocation and deallocation. |
124 |
|
*/ |
125 |
|
#ifdef SYS_LIGHTWEIGHT_PROT |
126 |
|
|
127 |
|
/** SYS_ARCH_DECL_PROTECT |
128 |
|
* declare a protection variable. This macro will default to defining a variable of |
129 |
|
* type sys_prot_t. If a particular port needs a different implementation, then |
130 |
|
* this macro may be defined in sys_arch.h. |
131 |
|
*/ |
132 |
|
#define SYS_ARCH_DECL_PROTECT(lev) sys_prot_t lev |
133 |
|
/** SYS_ARCH_PROTECT |
134 |
|
* Perform a "fast" protect. This could be implemented by |
135 |
|
* disabling interrupts for an embedded system or by using a semaphore or |
136 |
|
* mutex. The implementation should allow calling SYS_ARCH_PROTECT when |
137 |
|
* already protected. The old protection level is returned in the variable |
138 |
|
* "lev". This macro will default to calling the sys_arch_protect() function |
139 |
|
* which should be implemented in sys_arch.c. If a particular port needs a |
140 |
|
* different implementation, then this macro may be defined in sys_arch.h |
141 |
|
*/ |
142 |
|
#define SYS_ARCH_PROTECT(lev) lev = sys_arch_protect() |
143 |
|
/** SYS_ARCH_UNPROTECT |
144 |
|
* Perform a "fast" set of the protection level to "lev". This could be |
145 |
|
* implemented by setting the interrupt level to "lev" within the MACRO or by |
146 |
|
* using a semaphore or mutex. This macro will default to calling the |
147 |
|
* sys_arch_unprotect() function which should be implemented in |
148 |
|
* sys_arch.c. If a particular port needs a different implementation, then |
149 |
|
* this macro may be defined in sys_arch.h |
150 |
|
*/ |
151 |
|
#define SYS_ARCH_UNPROTECT(lev) sys_arch_unprotect(lev) |
152 |
|
sys_prot_t sys_arch_protect(void); |
153 |
|
void sys_arch_unprotect(sys_prot_t pval); |
154 |
|
#endif /* SYS_LIGHTWEIGHT_PROT */ |
155 |
|
|
156 |
|
#endif /* SYS_ARCH_PROTECT */ |
157 |
|
|
158 |
/* Thread functions. */ |
/* Thread functions. */ |
159 |
void sys_thread_new(void (* thread)(void *arg), void *arg); |
sys_thread_t sys_thread_new(void (* thread)(void *arg), void *arg); |
160 |
|
|
161 |
/* The following functions are used only in Unix code, and |
/* The following functions are used only in Unix code, and |
162 |
can be omitted when porting the stack. */ |
can be omitted when porting the stack. */ |