Macros | |
#define | SYS_ARCH_DEC(var, val) |
#define | SYS_ARCH_DECL_PROTECT(lev) sys_prot_t 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. More... | |
#define | SYS_ARCH_GET(var, ret) |
#define | SYS_ARCH_INC(var, val) |
#define | SYS_ARCH_PROTECT(lev) lev = sys_arch_protect() |
SYS_ARCH_PROTECT Perform a "fast" protect. More... | |
#define | SYS_ARCH_SET(var, val) |
#define | SYS_ARCH_TIMEOUT 0xffffffffUL |
Return code for timeouts from sys_arch_mbox_fetch and sys_arch_sem_wait. More... | |
#define | SYS_ARCH_UNPROTECT(lev) sys_arch_unprotect(lev) |
SYS_ARCH_UNPROTECT Perform a "fast" set of the protection level to "lev". More... | |
#define | SYS_MBOX_EMPTY SYS_ARCH_TIMEOUT |
sys_mbox_tryfetch() returns SYS_MBOX_EMPTY if appropriate. More... | |
#define | sys_mbox_fetch(mbox, msg) sys_arch_mbox_fetch(mbox, msg, 0) |
#define | sys_mbox_tryfetch(mbox, msg) sys_arch_mbox_tryfetch(mbox, msg) |
For now, we map straight to sys_arch implementation. More... | |
#define | sys_mutex_free(mutex) sys_sem_free(mutex) |
#define | sys_mutex_lock(mutex) sys_sem_wait(mutex) |
#define | sys_mutex_new(mutex) sys_sem_new(mutex, 1) |
#define | sys_mutex_set_invalid(mutex) sys_sem_set_invalid(mutex) |
#define | sys_mutex_t sys_sem_t |
Define LWIP_COMPAT_MUTEX if the port has no mutexes and binary semaphores should be used instead. More... | |
#define | sys_mutex_unlock(mutex) sys_sem_signal(mutex) |
#define | sys_mutex_valid(mutex) sys_sem_valid(mutex) |
#define | sys_sem_wait(sem) sys_arch_sem_wait(sem, 0) |
Wait for a semaphore - forever/no timeout. More... | |
Typedefs | |
typedef void(* | lwip_thread_fn )(void *arg) |
Function prototype for thread functions. More... | |
Functions | |
u32_t | sys_arch_mbox_fetch (sys_mbox_t *mbox, void **msg, u32_t timeout) |
Wait for a new message to arrive in the mbox. More... | |
u32_t | sys_arch_mbox_tryfetch (sys_mbox_t *mbox, void **msg) |
Wait for a new message to arrive in the mbox. More... | |
sys_prot_t | sys_arch_protect (void) |
u32_t | sys_arch_sem_wait (sys_sem_t *sem, u32_t timeout) |
Wait for a semaphore for the specified timeout. More... | |
void | sys_arch_unprotect (sys_prot_t pval) |
void | sys_init (void) |
u32_t | sys_jiffies (void) |
Ticks/jiffies since power up. More... | |
void | sys_mbox_free (sys_mbox_t *mbox) |
Delete an mbox. More... | |
err_t | sys_mbox_new (sys_mbox_t *mbox, int size) |
Create a new mbox of specified size. More... | |
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. More... | |
void | sys_mbox_set_invalid (sys_mbox_t *mbox) |
Set an mbox invalid so that sys_mbox_valid returns 0. More... | |
err_t | sys_mbox_trypost (sys_mbox_t *mbox, void *msg) |
Try to post a message to an mbox - may fail if full or ISR. More... | |
int | sys_mbox_valid (sys_mbox_t *mbox) |
Check if an mbox is valid/allocated: return 1 for valid, 0 for invalid. More... | |
void | sys_msleep (u32_t ms) |
Sleep for some ms. More... | |
u32_t | sys_now (void) |
Returns the current time in milliseconds, may be the same as sys_jiffies or at least based on it. More... | |
void | sys_sem_free (sys_sem_t *sem) |
Delete a semaphore. More... | |
err_t | sys_sem_new (sys_sem_t *sem, u8_t count) |
Create a new semaphore. More... | |
void | sys_sem_set_invalid (sys_sem_t *sem) |
Set a semaphore invalid so that sys_sem_valid returns 0. More... | |
void | sys_sem_signal (sys_sem_t *sem) |
Signals a semaphore. More... | |
int | sys_sem_valid (sys_sem_t *sem) |
Check if a sempahore is valid/allocated: return 1 for valid, 0 for invalid. More... | |
sys_thread_t | sys_thread_new (const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio) |
The only thread function: Creates a new thread. More... | |
#define SYS_ARCH_DEC | ( | var, | |
val | |||
) |
Referenced by netconn_recv_data().
#define SYS_ARCH_DECL_PROTECT | ( | lev | ) | sys_prot_t 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.
SYS_ARCH_DECL_PROTECT declare a protection variable. This macro will default to defining a variable of type sys_prot_t. If a particular port needs a different implementation, then this macro may be defined in sys_arch.h.
#define SYS_ARCH_GET | ( | var, | |
ret | |||
) |
Referenced by lwip_ioctl().
#define SYS_ARCH_INC | ( | var, | |
val | |||
) |
Referenced by recv_tcp().
#define SYS_ARCH_PROTECT | ( | lev | ) | lev = sys_arch_protect() |
SYS_ARCH_PROTECT Perform a "fast" protect.
This could be implemented by disabling interrupts for an embedded system or by using a semaphore or mutex. The implementation should allow calling SYS_ARCH_PROTECT when already protected. The old protection level is returned in the variable "lev". This macro will default to calling the sys_arch_protect() function which should be implemented in sys_arch.c. If a particular port needs a different implementation, then this macro may be defined in sys_arch.h
#define SYS_ARCH_SET | ( | var, | |
val | |||
) |
#define SYS_ARCH_TIMEOUT 0xffffffffUL |
Return code for timeouts from sys_arch_mbox_fetch and sys_arch_sem_wait.
Referenced by lwip_select(), netconn_accept(), netconn_recv_data(), sys_arch_mbox_fetch(), and sys_arch_sem_wait().
#define SYS_ARCH_UNPROTECT | ( | lev | ) | sys_arch_unprotect(lev) |
SYS_ARCH_UNPROTECT Perform a "fast" set of the protection level to "lev".
This could be implemented by setting the interrupt level to "lev" within the MACRO or by using a semaphore or mutex. This macro will default to calling the sys_arch_unprotect() function which should be implemented in sys_arch.c. If a particular port needs a different implementation, then this macro may be defined in sys_arch.h
#define SYS_MBOX_EMPTY SYS_ARCH_TIMEOUT |
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.
Referenced by netconn_drain(), and sys_arch_mbox_tryfetch().
#define sys_mbox_fetch | ( | mbox, | |
msg | |||
) | sys_arch_mbox_fetch(mbox, msg, 0) |
#define sys_mbox_tryfetch | ( | mbox, | |
msg | |||
) | sys_arch_mbox_tryfetch(mbox, msg) |
For now, we map straight to sys_arch implementation.
Referenced by netconn_drain().
#define sys_mutex_free | ( | mutex | ) | sys_sem_free(mutex) |
#define sys_mutex_lock | ( | mutex | ) | sys_sem_wait(mutex) |
Referenced by mem_malloc().
#define sys_mutex_new | ( | mutex | ) | sys_sem_new(mutex, 1) |
Referenced by mem_init(), and tcpip_init().
#define sys_mutex_set_invalid | ( | mutex | ) | sys_sem_set_invalid(mutex) |
#define sys_mutex_t sys_sem_t |
Define LWIP_COMPAT_MUTEX if the port has no mutexes and binary semaphores should be used instead.
#define sys_mutex_unlock | ( | mutex | ) | sys_sem_signal(mutex) |
Referenced by mem_malloc().
#define sys_mutex_valid | ( | mutex | ) | sys_sem_valid(mutex) |
#define sys_sem_wait | ( | sem | ) | sys_arch_sem_wait(sem, 0) |
Wait for a semaphore - forever/no timeout.
Referenced by prvlwIPInit().
u32_t sys_arch_mbox_fetch | ( | sys_mbox_t * | mbox, |
void ** | msg, | ||
u32_t | timeout | ||
) |
Wait for a new message to arrive in the mbox.
mbox | mbox to get a message from |
msg | pointer where the message is stored |
timeout | maximum time (in milliseconds) to wait for a message |
References ERR_MEM, NULL, pdFALSE, SYS_ARCH_BLOCKING_TICKTIMEOUT, SYS_ARCH_TIMEOUT, xQueueReceive, and xTaskGetTickCount().
Referenced by netconn_accept(), and netconn_recv_data().
u32_t sys_arch_mbox_tryfetch | ( | sys_mbox_t * | mbox, |
void ** | msg | ||
) |
Wait for a new message to arrive in the mbox.
mbox | mbox to get a message from |
msg | pointer where the message is stored |
timeout | maximum time (in milliseconds) to wait for a message |
References NULL, pdFALSE, SYS_MBOX_EMPTY, and xQueueReceive.
sys_prot_t sys_arch_protect | ( | void | ) |
Wait for a semaphore for the specified timeout.
sem | the semaphore to wait for |
timeout | timeout in milliseconds to wait (0 = wait forever) |
References ERR_MEM, NULL, pdFALSE, SYS_ARCH_BLOCKING_TICKTIMEOUT, SYS_ARCH_TIMEOUT, xSemaphoreTake, and xTaskGetTickCount().
Referenced by do_write(), lwip_getsockopt(), lwip_select(), lwip_setsockopt(), sys_msleep(), and tcpip_apimsg().
void sys_arch_unprotect | ( | sys_prot_t | pval | ) |
References NbActiveThreads, TimeoutlistPerThread::pid, SYS_THREAD_MAX, and Threads_TimeoutsList.
Referenced by lwip_init().
void sys_mbox_free | ( | sys_mbox_t * | mbox | ) |
Delete an mbox.
mbox | mbox to delete |
References lwip_stats, stats_sys::mbox, NULL, stats_::sys, SYS_MBOX_NULL, stats_syselem::used, and vQueueDelete().
Referenced by accept_function(), do_listen(), netconn_drain(), and netconn_new_with_proto_and_callback().
err_t sys_mbox_new | ( | sys_mbox_t * | mbox, |
int | size | ||
) |
Create a new mbox of specified size.
mbox | pointer to the mbox to create |
size | (miminum) number of messages in this mbox |
References ERR_MEM, ERR_OK, lwip_stats, stats_syselem::max, stats_sys::mbox, NULL, stats_::sys, SYS_MBOX_NULL, stats_syselem::used, and xQueueCreate().
Referenced by do_listen(), netconn_alloc(), and tcpip_init().
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.
mbox | mbox to posts the message |
msg | message to post (ATTENTION: can be NULL) |
References NULL, pdTRUE, SYS_ARCH_BLOCKING_TICKTIMEOUT, and xQueueSend.
Referenced by tcpip_apimsg(), tcpip_callback_with_block(), tcpip_timeout(), and tcpip_untimeout().
void sys_mbox_set_invalid | ( | sys_mbox_t * | mbox | ) |
Set an mbox invalid so that sys_mbox_valid returns 0.
References NULL.
Referenced by accept_function(), do_listen(), netconn_alloc(), and netconn_drain().
err_t sys_mbox_trypost | ( | sys_mbox_t * | mbox, |
void * | msg | ||
) |
Try to post a message to an mbox - may fail if full or ISR.
mbox | mbox to posts the message |
msg | message to post (ATTENTION: can be NULL) |
References ERR_MEM, ERR_OK, errQUEUE_FULL, NULL, and xQueueSend.
Referenced by accept_function(), err_tcp(), recv_tcp(), tcpip_callback_with_block(), and tcpip_input().
int sys_mbox_valid | ( | sys_mbox_t * | mbox | ) |
Check if an mbox is valid/allocated: return 1 for valid, 0 for invalid.
Referenced by accept_function(), do_listen(), err_tcp(), netconn_accept(), netconn_drain(), netconn_free(), netconn_new_with_proto_and_callback(), netconn_recv(), netconn_recv_data(), recv_tcp(), tcpip_apimsg(), tcpip_callback_with_block(), tcpip_input(), tcpip_timeout(), and tcpip_untimeout().
Sleep for some ms.
Timeouts are NOT processed while sleeping.
ms | number of milliseconds to sleep |
References ERR_OK, sys_arch_sem_wait(), sys_sem_free(), and sys_sem_new().
Returns the current time in milliseconds, may be the same as sys_jiffies or at least based on it.
Referenced by sys_timeouts_init().
Delete a semaphore.
sem | semaphore to delete |
References lwip_stats, NULL, stats_sys::sem, stats_::sys, SYS_SEM_NULL, stats_syselem::used, and vQueueDelete().
Referenced by lwip_select(), netconn_alloc(), netconn_free(), netconn_new_with_proto_and_callback(), prvlwIPInit(), and sys_msleep().
Create a new semaphore.
sem | pointer to the semaphore to create |
count | initial count of the semaphore |
References ERR_MEM, ERR_OK, lwip_stats, stats_syselem::max, NULL, stats_sys::sem, stats_::sys, SYS_SEM_NULL, stats_syselem::used, vSemaphoreCreateBinary, and xSemaphoreTake.
Referenced by lwip_select(), netconn_alloc(), prvlwIPInit(), and sys_msleep().
Set a semaphore invalid so that sys_sem_valid returns 0.
References NULL.
Referenced by netconn_free().
Signals a semaphore.
sem | the semaphore to signal |
References NULL, and xSemaphoreGive.
Referenced by do_close(), do_close_internal(), do_connect(), do_connected(), do_delconn(), do_writemore(), err_tcp(), event_callback(), lwip_getsockopt_internal(), lwip_setsockopt_internal(), and tcpip_init_done().
int sys_sem_valid | ( | sys_sem_t * | sem | ) |
Check if a sempahore is valid/allocated: return 1 for valid, 0 for invalid.
Referenced by do_delconn(), and netconn_new_with_proto_and_callback().
sys_thread_t sys_thread_new | ( | const char * | name, |
lwip_thread_fn | thread, | ||
void * | arg, | ||
int | stacksize, | ||
int | prio | ||
) |
The only thread function: Creates a new thread.
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) |
References NbActiveThreads, NULL, pdPASS, TimeoutlistPerThread::pid, SYS_ARCH_DECL_PROTECT(), SYS_ARCH_PROTECT(), SYS_ARCH_UNPROTECT(), Threads_TimeoutsList, and xTaskCreate.
Referenced by low_level_init(), portTASK_FUNCTION(), and tcpip_init().