Prusa MINI Firmware overview
|
#include "lwip/opt.h"
#include "lwip/err.h"
#include "lwip/timeouts.h"
#include "lwip/netif.h"
Go to the source code of this file.
Functions to sync with TCPIP thread
◆ LOCK_TCPIP_CORE
#define LOCK_TCPIP_CORE |
( |
| ) |
|
◆ UNLOCK_TCPIP_CORE
#define UNLOCK_TCPIP_CORE |
( |
| ) |
|
◆ tcpip_callback
◆ tcpip_init_done_fn
typedef void(* tcpip_init_done_fn) (void *arg) |
Function prototype for the init_done function passed to tcpip_init
◆ tcpip_callback_fn
typedef void(* tcpip_callback_fn) (void *ctx) |
◆ tcpip_init()
Initialize this module:
- initialize all sub modules
- start the tcpip_thread
- Parameters
-
initfunc | a function to call when tcpip_thread is running and finished initializing |
arg | argument to pass to initfunc |
469 LWIP_ASSERT(
"failed to create tcpip_thread mbox", 0);
471 #if LWIP_TCPIP_CORE_LOCKING
473 LWIP_ASSERT(
"failed to create lock_tcpip_core", 0);
◆ tcpip_inpkt()
Pass a received packet to tcpip_thread for input processing
- Parameters
-
p | the received packet |
inp | the network interface on which the packet was received |
input_fn | input function to call |
171 #if LWIP_TCPIP_CORE_LOCKING_INPUT
175 ret = input_fn(p, inp);
◆ tcpip_input()
Pass a received packet to tcpip_thread for input processing with ethernet_input or ip_input. Don't call directly, pass to netif_add() and call netif->input().
- Parameters
-
p | the received packet, p->payload pointing to the Ethernet header or to an IP header (if inp doesn't have NETIF_FLAG_ETHARP or NETIF_FLAG_ETHERNET flags) |
inp | the network interface on which the packet was received |
◆ tcpip_callback_with_block()
Call a specific function in the thread context of tcpip_thread for easy access synchronization. A function called in that way may access lwIP core code without fearing concurrent access.
- Parameters
-
function | the function to call |
ctx | parameter passed to f |
block | 1 to block until the request is posted, 0 to non-blocking mode |
- Returns
- ERR_OK if the function was called, another err_t if not
246 msg->msg.cb.function =
function;
◆ tcpip_callbackmsg_new()
Allocate a structure for a static callback message and initialize it. This is intended to be used to send "static" messages from interrupt context.
- Parameters
-
function | the function to call |
ctx | parameter passed to function |
- Returns
- a struct pointer to pass to tcpip_trycallback().
422 msg->msg.cb.function =
function;
424 return (
struct tcpip_callback_msg*)
msg;
◆ tcpip_callbackmsg_delete()
void tcpip_callbackmsg_delete |
( |
struct tcpip_callback_msg * |
msg | ) |
|
◆ tcpip_trycallback()
err_t tcpip_trycallback |
( |
struct tcpip_callback_msg * |
msg | ) |
|
Try to post a callback-message to the tcpip_thread mbox This is intended to be used to send "static" messages from interrupt context.
- Parameters
-
msg | pointer to the message to post |
- Returns
- sys_mbox_trypost() return code
◆ pbuf_free_callback()
A simple wrapper function that allows you to free a pbuf from interrupt context.
- Parameters
-
p | The pbuf (chain) to be dereferenced. |
- Returns
- ERR_OK if callback could be enqueued, an err_t if not
◆ mem_free_callback()
A simple wrapper function that allows you to free heap memory from interrupt context.
- Parameters
-
- Returns
- ERR_OK if callback could be enqueued, an err_t if not
#define sys_mbox_valid_val(mbox)
Definition: sys.h:311
err_t tcpip_callback_with_block(tcpip_callback_fn function, void *ctx, u8_t block)
Definition: tcpip.c:234
void * memp_malloc(memp_t type)
Definition: memp.c:385
void lwip_init(void)
Definition: init.c:337
#define TCPIP_DEBUG
Definition: opt.h:2814
#define LWIP_ASSERT(message, assertion)
Definition: debug.h:116
void memp_free(memp_t type, void *mem)
Definition: memp.c:469
Definition: tcpip_priv.h:114
err_t sys_mbox_new(sys_mbox_t *mbox, int size)
Definition: sys_arch.c:50
static sys_mbox_t mbox
Definition: tcpip.c:61
static void * tcpip_init_done_arg
Definition: tcpip.c:60
#define NETIF_FLAG_ETHARP
Definition: netif.h:91
#define UNLOCK_TCPIP_CORE()
Definition: tcpip.h:61
sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio)
Definition: sys_arch.c:376
#define NULL
Definition: usbd_def.h:53
void sys_mbox_post(sys_mbox_t *mbox, void *msg)
Definition: sys_arch.c:96
void * msg
Definition: tcpip_priv.h:128
static void tcpip_thread(void *arg)
Definition: tcpip.c:87
#define TCPIP_MBOX_SIZE
Definition: opt.h:1566
netif_input_fn input_fn
Definition: tcpip_priv.h:138
err_t tcpip_inpkt(struct pbuf *p, struct netif *inp, netif_input_fn input_fn)
Definition: tcpip.c:169
struct tcpip_msg::@61::@64 inp
err_t sys_mutex_new(sys_mutex_t *mutex)
Definition: sys_arch.c:319
Definition: tcpip_priv.h:120
Definition: tcpip_priv.h:123
s8_t err_t
Definition: err.h:57
#define NETIF_FLAG_ETHERNET
Definition: netif.h:95
#define TCPIP_THREAD_PRIO
Definition: opt.h:1557
void * ctx
Definition: tcpip_priv.h:142
static void pbuf_free_int(void *p)
Definition: tcpip.c:487
#define TCPIP_THREAD_NAME
Definition: opt.h:1539
err_t sys_mbox_trypost(sys_mbox_t *mbox, void *msg)
Definition: sys_arch.c:104
#define TCPIP_THREAD_STACKSIZE
Definition: opt.h:1548
struct pbuf * p
Definition: tcpip_priv.h:136
void mem_free(void *rmem)
Definition: mem.c:419
#define LWIP_DEBUGF(debug, message)
Definition: debug.h:164
static tcpip_init_done_fn tcpip_init_done
Definition: tcpip.c:59
#define LOCK_TCPIP_CORE()
Definition: tcpip.h:60
Definition: tcpip_priv.h:119