STM32F7 Ethernet interface for nucleo STM32F767

Embed: (wiki syntax)

« Back to documentation index

tcpip.h File Reference

tcpip.h File Reference

Functions to sync with TCPIP thread. More...

Go to the source code of this file.

Typedefs

typedef void(* tcpip_init_done_fn )(void *arg)
 Function prototype for the init_done function passed to tcpip_init.
typedef void(* tcpip_callback_fn )(void *ctx)
 Function prototype for functions passed to tcpip_callback()

Functions

void tcpip_init (tcpip_init_done_fn tcpip_init_done, void *arg)
 Initialize this module:

  • initialize all sub modules
  • start the tcpip_thread.

err_t tcpip_inpkt (struct pbuf *p, struct netif *inp, netif_input_fn input_fn)
 Pass a received packet to tcpip_thread for input processing.
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_with_block (tcpip_callback_fn function, void *ctx, u8_t block)
 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_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.
err_t pbuf_free_callback (struct pbuf *p)
 A simple wrapper function that allows you to free a pbuf from interrupt context.
err_t mem_free_callback (void *m)
 A simple wrapper function that allows you to free heap memory from interrupt context.
err_t tcpip_timeout (u32_t msecs, sys_timeout_handler h, void *arg)
 call sys_timeout in tcpip_thread
err_t tcpip_untimeout (sys_timeout_handler h, void *arg)
 call sys_untimeout in tcpip_thread

Variables

sys_mutex_t lock_tcpip_core
 The global semaphore to lock the stack.

Detailed Description

Functions to sync with TCPIP thread.

Definition in file tcpip.h.


Typedef Documentation

typedef void(* tcpip_callback_fn)(void *ctx)

Function prototype for functions passed to tcpip_callback()

Definition at line 70 of file tcpip.h.

typedef void(* tcpip_init_done_fn)(void *arg)

Function prototype for the init_done function passed to tcpip_init.

Definition at line 68 of file tcpip.h.


Function Documentation

err_t mem_free_callback ( void *  m )

A simple wrapper function that allows you to free heap memory from interrupt context.

Parameters:
mthe heap memory to free
Returns:
ERR_OK if callback could be enqueued, an err_t if not

Definition at line 513 of file lwip_tcpip.c.

err_t pbuf_free_callback ( struct pbuf p )

A simple wrapper function that allows you to free a pbuf from interrupt context.

Parameters:
pThe pbuf (chain) to be dereferenced.
Returns:
ERR_OK if callback could be enqueued, an err_t if not

Definition at line 500 of file lwip_tcpip.c.

err_t tcpip_callback_with_block ( tcpip_callback_fn  function,
void *  ctx,
u8_t  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:
functionthe function to call
ctxparameter passed to f
block1 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

Definition at line 234 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

Definition at line 433 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.

This is intended to be used to send "static" messages from interrupt context.

Parameters:
functionthe function to call
ctxparameter passed to function
Returns:
a struct pointer to pass to tcpip_trycallback().

Definition at line 415 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 462 of file lwip_tcpip.c.

err_t tcpip_inpkt ( struct pbuf p,
struct netif inp,
netif_input_fn  input_fn 
)

Pass a received packet to tcpip_thread for input processing.

Parameters:
pthe received packet
inpthe network interface on which the packet was received
input_fninput function to call

Definition at line 169 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 212 of file lwip_tcpip.c.

err_t tcpip_timeout ( u32_t  msecs,
sys_timeout_handler  h,
void *  arg 
)

call sys_timeout in tcpip_thread

Parameters:
msecstime in milliseconds for timeout
hfunction to be called on timeout
argargument to pass to timeout function h
Returns:
ERR_MEM on memory error, ERR_OK otherwise

Definition at line 269 of file lwip_tcpip.c.

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:
msgpointer to the message to post
Returns:
sys_mbox_trypost() return code

Definition at line 446 of file lwip_tcpip.c.

err_t tcpip_untimeout ( sys_timeout_handler  h,
void *  arg 
)

call sys_untimeout in tcpip_thread

Parameters:
hfunction to be called on timeout
argargument to pass to timeout function h
Returns:
ERR_MEM on memory error, ERR_OK otherwise

Definition at line 296 of file lwip_tcpip.c.


Variable Documentation

sys_mutex_t lock_tcpip_core

The global semaphore to lock the stack.

Definition at line 65 of file lwip_tcpip.c.