sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
tcpip.c File Reference
#include "lwip/opt.h"
#include "lwip/priv/tcpip_priv.h"
#include "lwip/sys.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "lwip/init.h"
#include "lwip/ip.h"
#include "lwip/pbuf.h"
#include "lwip/etharp.h"
#include "netif/ethernet.h"

Go to the source code of this file.

Macros

#define TCPIP_MSG_VAR_REF(name)
#define TCPIP_MSG_VAR_DECLARE(name)
#define TCPIP_MSG_VAR_ALLOC(name)
#define TCPIP_MSG_VAR_FREE(name)

Functions

err_t tcpip_inpkt (struct pbuf *p, struct netif *inp, netif_input_fn input_fn)
err_t tcpip_input (struct pbuf *p, struct netif *inp)
err_t tcpip_callback (tcpip_callback_fn function, void *ctx)
err_t tcpip_try_callback (tcpip_callback_fn function, void *ctx)
err_t tcpip_send_msg_wait_sem (tcpip_callback_fn fn, void *apimsg, sys_sem_t *sem)
err_t tcpip_api_call (tcpip_api_call_fn fn, struct tcpip_api_call_data *call)
struct tcpip_callback_msg * tcpip_callbackmsg_new (tcpip_callback_fn function, void *ctx)
void tcpip_callbackmsg_delete (struct tcpip_callback_msg *msg)
err_t tcpip_callbackmsg_trycallback (struct tcpip_callback_msg *msg)
err_t tcpip_callbackmsg_trycallback_fromisr (struct tcpip_callback_msg *msg)
err_t tcpip_callback_wait (tcpip_callback_fn function, void *ctx)
void tcpip_init (tcpip_init_done_fn initfunc, void *arg)
err_t pbuf_free_callback (struct pbuf *p)
err_t mem_free_callback (void *m)

Detailed Description

Sequential API Main thread module

Definition in file tcpip.c.

Macro Definition Documentation

◆ TCPIP_MSG_VAR_ALLOC

#define TCPIP_MSG_VAR_ALLOC ( name)
Value:
API_VAR_ALLOC(struct tcpip_msg, MEMP_TCPIP_MSG_API, name, ERR_MEM)
@ ERR_MEM
Definition err.h:57

Definition at line 55 of file tcpip.c.

◆ TCPIP_MSG_VAR_DECLARE

#define TCPIP_MSG_VAR_DECLARE ( name)
Value:
API_VAR_DECLARE(struct tcpip_msg, name)

Definition at line 54 of file tcpip.c.

◆ TCPIP_MSG_VAR_FREE

#define TCPIP_MSG_VAR_FREE ( name)
Value:
API_VAR_FREE(MEMP_TCPIP_MSG_API, name)

Definition at line 56 of file tcpip.c.

◆ TCPIP_MSG_VAR_REF

#define TCPIP_MSG_VAR_REF ( name)
Value:
API_VAR_REF(name)

Definition at line 53 of file tcpip.c.

Function Documentation

◆ mem_free_callback()

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 710 of file tcpip.c.

◆ pbuf_free_callback()

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 697 of file tcpip.c.

◆ tcpip_api_call()

err_t tcpip_api_call ( tcpip_api_call_fn fn,
struct tcpip_api_call_data * call )

Synchronously calls function in TCPIP thread and waits for its completion. It is recommended to use LWIP_TCPIP_CORE_LOCKING (preferred) or LWIP_NETCONN_SEM_PER_THREAD. If not, a semaphore is created and destroyed on every call which is usually an expensive/slow operation.

Parameters
fnFunction to call
callCall parameters
Returns
Return value from tcpip_api_call_fn

Definition at line 487 of file tcpip.c.

◆ tcpip_callback_wait()

err_t tcpip_callback_wait ( tcpip_callback_fn function,
void * ctx )

Sends a message to TCPIP thread to call a function. Caller thread blocks until the function returns. It is recommended to use LWIP_TCPIP_CORE_LOCKING (preferred) or LWIP_NETCONN_SEM_PER_THREAD. If not, a semaphore is created and destroyed on every call which is usually an expensive/slow operation.

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

Definition at line 619 of file tcpip.c.

◆ tcpip_inpkt()

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 254 of file tcpip.c.

◆ tcpip_send_msg_wait_sem()

err_t tcpip_send_msg_wait_sem ( tcpip_callback_fn fn,
void * apimsg,
sys_sem_t * sem )

Sends a message to TCPIP thread to call a function. Caller thread blocks on on a provided semaphore, which is NOT automatically signalled by TCPIP thread, this has to be done by the user. It is recommended to use LWIP_TCPIP_CORE_LOCKING since this is the way with least runtime overhead.

Parameters
fnfunction to be called from TCPIP thread
apimsgargument to API function
semsemaphore to wait on
Returns
ERR_OK if the function was called, another err_t if not

Definition at line 451 of file tcpip.c.