Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

OS mode (TCPIP thread)

OS mode (TCPIP thread)
[lwIP]

Use this mode if you run an OS on your system. More...

Functions

err_t tcpip_input (struct pbuf *p, struct netif *inp)
 Pass a received packet to tcpip_thread for input processing with ethernet_input or ip_input.
err_t tcpip_callback (tcpip_callback_fn function, void *ctx)
 Call a specific function in the thread context of tcpip_thread for easy access synchronization.
err_t tcpip_try_callback (tcpip_callback_fn function, void *ctx)
 Call a specific function in the thread context of tcpip_thread for easy access synchronization.
struct tcpip_callback_msg * tcpip_callbackmsg_new (tcpip_callback_fn function, void *ctx)
 Allocate a structure for a static callback message and initialize it.
void tcpip_callbackmsg_delete (struct tcpip_callback_msg *msg)
 Free a callback message allocated by tcpip_callbackmsg_new().
err_t tcpip_callbackmsg_trycallback (struct tcpip_callback_msg *msg)
 Try to post a callback-message to the tcpip_thread tcpip_mbox.
err_t tcpip_callbackmsg_trycallback_fromisr (struct tcpip_callback_msg *msg)
 Try to post a callback-message to the tcpip_thread mbox.
void tcpip_init (tcpip_init_done_fn initfunc, void *arg)
 Initialize this module:

  • initialize all sub modules
  • start the tcpip_thread.


Detailed Description

Use this mode if you run an OS on your system.

It is recommended to use an RTOS that correctly handles priority inversion and to use LWIP_TCPIP_CORE_LOCKING.
Porting: implement all functions in Porting (system abstraction layer).
You can use "raw" APIs together with tcpip_callback, and all Sequential-style APIs.


Function Documentation

err_t tcpip_callback ( tcpip_callback_fn  function,
void *  ctx 
)

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. Blocks until the request is posted. Must not be called from interrupt context!

Parameters:
functionthe function to call
ctxparameter passed to f
Returns:
ERR_OK if the function was called, another err_t if not
See also:
tcpip_try_callback

Definition at line 309 of file lwip_tcpip.c.

void tcpip_callbackmsg_delete ( struct tcpip_callback_msg *  msg )

Free a callback message allocated by tcpip_callbackmsg_new().

Parameters:
msgthe message to free
See also:
tcpip_callbackmsg_new()

Definition at line 552 of file lwip_tcpip.c.

struct tcpip_callback_msg* tcpip_callbackmsg_new ( tcpip_callback_fn  function,
void *  ctx 
) [read]

Allocate a structure for a static callback message and initialize it.

The message has a special type such that lwIP never frees it. This is intended to be used to send "static" messages from interrupt context, e.g. the message is allocated once and posted several times from an IRQ using tcpip_callbackmsg_trycallback(). Example usage: Trigger execution of an ethernet IRQ DPC routine in lwIP thread context.

Parameters:
functionthe function to call
ctxparameter passed to function
Returns:
a struct pointer to pass to tcpip_callbackmsg_trycallback().
See also:
tcpip_callbackmsg_trycallback()
tcpip_callbackmsg_delete()

Definition at line 531 of file lwip_tcpip.c.

err_t tcpip_callbackmsg_trycallback ( struct tcpip_callback_msg *  msg )

Try to post a callback-message to the tcpip_thread tcpip_mbox.

Parameters:
msgpointer to the message to post
Returns:
sys_mbox_trypost() return code
See also:
tcpip_callbackmsg_new()

Definition at line 567 of file lwip_tcpip.c.

err_t tcpip_callbackmsg_trycallback_fromisr ( struct tcpip_callback_msg *  msg )

Try to post a callback-message to the tcpip_thread mbox.

Same as tcpip_callbackmsg_trycallback but calls sys_mbox_trypost_fromisr(), mainly to help FreeRTOS, where calls differ between task level and ISR level.

Parameters:
msgpointer to the message to post
Returns:
sys_mbox_trypost_fromisr() return code (without change, so this knowledge can be used to e.g. propagate "bool needs_scheduling")
See also:
tcpip_callbackmsg_new()

Definition at line 586 of file lwip_tcpip.c.

void tcpip_init ( tcpip_init_done_fn  initfunc,
void *  arg 
)

Initialize this module:

  • initialize all sub modules
  • start the tcpip_thread.

Parameters:
initfunca function to call when tcpip_thread is running and finished initializing
argargument to pass to initfunc

Definition at line 602 of file lwip_tcpip.c.

err_t tcpip_input ( struct pbuf p,
struct netif inp 
)

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:
pthe 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)
inpthe network interface on which the packet was received

Definition at line 283 of file lwip_tcpip.c.

err_t tcpip_try_callback ( tcpip_callback_fn  function,
void *  ctx 
)

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. Does NOT block when the request cannot be posted because the tcpip_mbox is full, but returns ERR_MEM instead. Can be called from interrupt context.

Parameters:
functionthe function to call
ctxparameter passed to f
Returns:
ERR_OK if the function was called, another err_t if not
See also:
tcpip_callback

Definition at line 345 of file lwip_tcpip.c.