#include "lwip/opt.h"
#include "lwip/err.h"
#include "arch/sys_arch.h"
Go to the source code of this file.
|
#define | SYS_ARCH_TIMEOUT 0xffffffffUL |
|
#define | SYS_MBOX_EMPTY SYS_ARCH_TIMEOUT |
|
#define | sys_sem_wait(sem) sys_arch_sem_wait(sem, 0) |
|
#define | sys_sem_valid_val(sem) sys_sem_valid(&(sem)) |
|
#define | sys_sem_set_invalid_val(sem) sys_sem_set_invalid(&(sem)) |
|
#define | sys_mbox_tryfetch(mbox, msg) sys_arch_mbox_tryfetch(mbox, msg) |
|
#define | sys_mbox_fetch(mbox, msg) sys_arch_mbox_fetch(mbox, msg, 0) |
|
#define | sys_mbox_valid_val(mbox) sys_mbox_valid(&(mbox)) |
|
#define | sys_mbox_set_invalid_val(mbox) sys_mbox_set_invalid(&(mbox)) |
|
#define | SYS_ARCH_DECL_PROTECT(lev) |
|
#define | SYS_ARCH_PROTECT(lev) |
|
#define | SYS_ARCH_UNPROTECT(lev) |
|
#define | SYS_ARCH_INC(var, val) |
|
#define | SYS_ARCH_DEC(var, val) |
|
#define | SYS_ARCH_GET(var, ret) |
|
#define | SYS_ARCH_SET(var, val) |
|
|
err_t | sys_mutex_new (sys_mutex_t *mutex) |
|
void | sys_mutex_lock (sys_mutex_t *mutex) |
|
void | sys_mutex_unlock (sys_mutex_t *mutex) |
|
void | sys_mutex_free (sys_mutex_t *mutex) |
|
int | sys_mutex_valid (sys_mutex_t *mutex) |
|
void | sys_mutex_set_invalid (sys_mutex_t *mutex) |
|
err_t | sys_sem_new (sys_sem_t *sem, u8_t count) |
|
void | sys_sem_signal (sys_sem_t *sem) |
|
u32_t | sys_arch_sem_wait (sys_sem_t *sem, u32_t timeout) |
|
void | sys_sem_free (sys_sem_t *sem) |
|
int | sys_sem_valid (sys_sem_t *sem) |
|
void | sys_sem_set_invalid (sys_sem_t *sem) |
|
void | sys_msleep (u32_t ms) |
|
err_t | sys_mbox_new (sys_mbox_t *mbox, int size) |
|
void | sys_mbox_post (sys_mbox_t *mbox, void *msg) |
|
err_t | sys_mbox_trypost (sys_mbox_t *mbox, void *msg) |
|
u32_t | sys_arch_mbox_fetch (sys_mbox_t *mbox, void **msg, u32_t timeout) |
|
u32_t | sys_arch_mbox_tryfetch (sys_mbox_t *mbox, void **msg) |
|
void | sys_mbox_free (sys_mbox_t *mbox) |
|
int | sys_mbox_valid (sys_mbox_t *mbox) |
|
void | sys_mbox_set_invalid (sys_mbox_t *mbox) |
|
sys_thread_t | sys_thread_new (const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio) |
|
void | sys_init (void) |
|
u32_t | sys_jiffies (void) |
|
u32_t | sys_now (void) |
|
#define SYS_ARCH_DEC |
( |
|
var, |
|
|
|
val |
|
) |
| |
Value:do { \
SYS_ARCH_DECL_PROTECT(old_level); \
SYS_ARCH_PROTECT(old_level); \
var -= val; \
SYS_ARCH_UNPROTECT(old_level); \
} while(0)
Definition at line 327 of file sys.h.
#define SYS_ARCH_DECL_PROTECT |
( |
|
lev | ) |
|
SYS_LIGHTWEIGHT_PROT define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection for certain critical regions during buffer allocation, deallocation and memory allocation and deallocation.
Definition at line 304 of file sys.h.
#define SYS_ARCH_GET |
( |
|
var, |
|
|
|
ret |
|
) |
| |
Value:do { \
SYS_ARCH_DECL_PROTECT(old_level); \
SYS_ARCH_PROTECT(old_level); \
ret = var; \
SYS_ARCH_UNPROTECT(old_level); \
} while(0)
Definition at line 336 of file sys.h.
#define SYS_ARCH_INC |
( |
|
var, |
|
|
|
val |
|
) |
| |
Value:do { \
SYS_ARCH_DECL_PROTECT(old_level); \
SYS_ARCH_PROTECT(old_level); \
var += val; \
SYS_ARCH_UNPROTECT(old_level); \
} while(0)
Definition at line 318 of file sys.h.
#define SYS_ARCH_PROTECT |
( |
|
lev | ) |
|
#define SYS_ARCH_SET |
( |
|
var, |
|
|
|
val |
|
) |
| |
Value:do { \
SYS_ARCH_DECL_PROTECT(old_level); \
SYS_ARCH_PROTECT(old_level); \
var = val; \
SYS_ARCH_UNPROTECT(old_level); \
} while(0)
Definition at line 345 of file sys.h.
#define SYS_ARCH_TIMEOUT 0xffffffffUL |
Return code for timeouts from sys_arch_mbox_fetch and sys_arch_sem_wait
Definition at line 82 of file sys.h.
#define SYS_ARCH_UNPROTECT |
( |
|
lev | ) |
|
sys_mbox_tryfetch() returns SYS_MBOX_EMPTY if appropriate. For now we use the same magic value, but we allow this to change in future.
Definition at line 87 of file sys.h.
For now, we map straight to sys_arch implementation.
Definition at line 214 of file sys.h.
Wait for a semaphore - forever/no timeout
Definition at line 157 of file sys.h.
typedef void(* lwip_thread_fn) (void *arg) |
Function prototype for thread functions
Definition at line 93 of file sys.h.
Wait for a new message to arrive in the mbox
- Parameters
-
mbox | mbox to get a message from |
msg | pointer where the message is stored |
timeout | maximum time (in milliseconds) to wait for a message (0 = wait forever) |
- Returns
- time (in milliseconds) waited for a message, may be 0 if not waited or SYS_ARCH_TIMEOUT on timeout The returned time has to be accurate to prevent timer jitter!
Definition at line 143 of file sys_arch.c.
Wait for a new message to arrive in the mbox
- Parameters
-
mbox | mbox to get a message from |
msg | pointer where the message is stored |
- Returns
- 0 (milliseconds) if a message has been received or SYS_MBOX_EMPTY if the mailbox is empty
Definition at line 186 of file sys_arch.c.
Wait for a semaphore for the specified timeout
- Parameters
-
sem | the semaphore to wait for |
timeout | timeout in milliseconds to wait (0 = wait forever) |
- Returns
- time (in milliseconds) waited for the semaphore or SYS_ARCH_TIMEOUT on timeout
Definition at line 263 of file sys_arch.c.
u32_t sys_jiffies |
( |
void |
| ) |
|
Ticks/jiffies since power up.
Delete an mbox
- Parameters
-
Definition at line 76 of file sys_arch.c.
Create a new mbox of specified size
- Parameters
-
mbox | pointer to the mbox to create |
size | (minimum) number of messages in this mbox |
- Returns
- ERR_OK if successful, another err_t otherwise
Definition at line 52 of file sys_arch.c.
void sys_mbox_post |
( |
sys_mbox_t * |
mbox, |
|
|
void * |
msg |
|
) |
| |
Post a message to an mbox - may not fail -> blocks if full, only used from tasks not from ISR
- Parameters
-
mbox | mbox to posts the message |
msg | message to post (ATTENTION: can be NULL) |
Definition at line 98 of file sys_arch.c.
Set an mbox invalid so that sys_mbox_valid returns 0
Definition at line 213 of file sys_arch.c.
Try to post a message to an mbox - may fail if full or ISR
- Parameters
-
mbox | mbox to posts the message |
msg | message to post (ATTENTION: can be NULL) |
Definition at line 106 of file sys_arch.c.
Check if an mbox is valid/allocated: return 1 for valid, 0 for invalid
Definition at line 205 of file sys_arch.c.
void sys_msleep |
( |
u32_t |
ms | ) |
|
Sleep for some ms. Timeouts are NOT processed while sleeping.
- Parameters
-
ms | number of milliseconds to sleep |
Definition at line 55 of file sys.c.
Delete a semaphore
- Parameters
-
Definition at line 360 of file sys_arch.c.
Lock a mutex
- Parameters
-
Definition at line 370 of file sys_arch.c.
Define LWIP_COMPAT_MUTEX if the port has no mutexes and binary semaphores should be used instead Create a new mutex
- Parameters
-
mutex | pointer to the mutex to create |
- Returns
- a new mutex
Definition at line 339 of file sys_arch.c.
Set a mutex invalid so that sys_mutex_valid returns 0
Unlock a mutex
- Parameters
-
Definition at line 377 of file sys_arch.c.
Check if a mutex is valid/allocated: return 1 for valid, 0 for invalid
Returns the current time in milliseconds, may be the same as sys_jiffies or at least based on it.
Delete a semaphore
- Parameters
-
Definition at line 303 of file sys_arch.c.
Create a new semaphore
- Parameters
-
sem | pointer to the semaphore to create |
count | initial count of the semaphore |
- Returns
- ERR_OK if successful, another err_t otherwise
Definition at line 221 of file sys_arch.c.
Set a semaphore invalid so that sys_sem_valid returns 0
Definition at line 321 of file sys_arch.c.
Signals a semaphore
- Parameters
-
sem | the semaphore to signal |
Definition at line 296 of file sys_arch.c.
Check if a semaphore is valid/allocated: return 1 for valid, 0 for invalid
Definition at line 312 of file sys_arch.c.
The only thread function: Creates a new thread ATTENTION: although this function returns a value, it MUST NOT FAIL (ports have to assert this!)
- Parameters
-
name | human-readable name for the thread (used for debugging purposes) |
thread | thread-function |
arg | parameter passed to 'thread' |
stacksize | stack size in bytes for the new thread (may be ignored by ports) |
prio | priority of the new thread (may be ignored by ports) |
Definition at line 391 of file sys_arch.c.