MeterLogger
|
#include "lwip/opt.h"
#include "lwip/api_msg.h"
#include "lwip/netifapi.h"
#include "lwip/pbuf.h"
#include "lwip/api.h"
#include "lwip/sys.h"
#include "lwip/timers.h"
#include "lwip/netif.h"
Go to the source code of this file.
Data Structures | |
struct | tcpip_msg |
Macros | |
#define | LWIP_TCPIP_THREAD_ALIVE() |
#define | LOCK_TCPIP_CORE() |
#define | UNLOCK_TCPIP_CORE() |
#define | TCPIP_APIMSG(m) tcpip_apimsg(m) |
#define | TCPIP_APIMSG_ACK(m) sys_sem_signal(&m->conn->op_completed) |
#define | TCPIP_NETIFAPI(m) tcpip_netifapi(m) |
#define | TCPIP_NETIFAPI_ACK(m) sys_sem_signal(&m->sem) |
#define | tcpip_callback(f, ctx) tcpip_callback_with_block(f, ctx, 1) |
Typedefs | |
typedef void(* | tcpip_init_done_fn) (void *arg) |
typedef void(* | tcpip_callback_fn) (void *ctx) |
Enumerations | |
enum | tcpip_msg_type { TCPIP_MSG_INPKT, TCPIP_MSG_CALLBACK } |
Functions | |
void | tcpip_init (tcpip_init_done_fn tcpip_init_done, void *arg) |
err_t | tcpip_input (struct pbuf *p, struct netif *inp) |
err_t | tcpip_callback_with_block (tcpip_callback_fn function, void *ctx, u8_t block) |
err_t | pbuf_free_callback (struct pbuf *p) |
err_t | mem_free_callback (void *m) |
#define LOCK_TCPIP_CORE | ( | ) |
Definition at line 67 of file tcpip.h.
Referenced by tcpip_callback_with_block(), tcpip_input(), and tcpip_thread().
#define LWIP_TCPIP_THREAD_ALIVE | ( | ) |
Define this to something that triggers a watchdog. This is called from tcpip_thread after processing a message.
Definition at line 54 of file tcpip.h.
Referenced by tcpip_thread().
#define TCPIP_APIMSG_ACK | ( | m | ) | sys_sem_signal(&m->conn->op_completed) |
#define tcpip_callback | ( | f, | |
ctx | |||
) | tcpip_callback_with_block(f, ctx, 1) |
Definition at line 99 of file tcpip.h.
Referenced by netif_set_link_down().
#define TCPIP_NETIFAPI_ACK | ( | m | ) | sys_sem_signal(&m->sem) |
#define UNLOCK_TCPIP_CORE | ( | ) |
Definition at line 68 of file tcpip.h.
Referenced by tcpip_callback_with_block(), tcpip_input(), and tcpip_thread().
typedef void(* tcpip_callback_fn) (void *ctx) |
Function prototype for functions passed to tcpip_callback()
typedef void(* tcpip_init_done_fn) (void *arg) |
enum tcpip_msg_type |
Enumerator | |
---|---|
TCPIP_MSG_INPKT | |
TCPIP_MSG_CALLBACK |
Definition at line 110 of file tcpip.h.
err_t mem_free_callback | ( | void * | m | ) |
A simple wrapper function that allows you to free heap memory from interrupt context.
m | the heap memory to free |
Definition at line 455 of file tcpip.c.
References mem_free(), and tcpip_callback_with_block().
A simple wrapper function that allows you to free a pbuf from interrupt context.
p | The pbuf (chain) to be dereferenced. |
Definition at line 442 of file tcpip.c.
References pbuf_free_int(), and tcpip_callback_with_block().
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.
f | the function to call |
ctx | parameter passed to f |
block | 1 to block until the request is posted, 0 to non-blocking mode |
Definition at line 206 of file tcpip.c.
References tcpip_msg::cb, tcpip_msg::ctx, ERR_MEM, ERR_OK, ERR_VAL, LOCK_TCPIP_CORE, mbox, memp_free(), memp_malloc(), tcpip_msg::msg, NULL, sys_arch_sem_wait(), sys_mbox_post(), sys_mbox_trypost(), sys_mbox_valid(), sys_sem_free(), sys_sem_new(), sys_sem_wait, TCPIP_MSG_CALLBACK, tcpip_msg::type, and UNLOCK_TCPIP_CORE.
Referenced by mem_free_callback(), and pbuf_free_callback().
void tcpip_init | ( | tcpip_init_done_fn | initfunc, |
void * | arg | ||
) |
Initialize this module:
initfunc | a function to call when tcpip_thread is running and finished initializing |
arg | argument to pass to initfunc |
Definition at line 404 of file tcpip.c.
References ERR_OK, LWIP_ASSERT, lwip_init(), mbox, NULL, sys_mbox_new(), sys_mutex_new(), sys_thread_new(), tcpip_init_done, tcpip_init_done_arg, TCPIP_MBOX_SIZE, tcpip_thread(), TCPIP_THREAD_NAME, TCPIP_THREAD_PRIO, and TCPIP_THREAD_STACKSIZE.
Pass a received packet to tcpip_thread for input processing
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 |
Definition at line 156 of file tcpip.c.
References ERR_MEM, ERR_OK, ERR_VAL, tcpip_msg::inp, ip_input(), LOCK_TCPIP_CORE, LWIP_DEBUGF, mbox, memp_free(), memp_malloc(), tcpip_msg::msg, NETIF_FLAG_ETHARP, NETIF_FLAG_ETHERNET, NULL, tcpip_msg::p, sys_mbox_trypost(), sys_mbox_valid(), TCPIP_DEBUG, TCPIP_MSG_INPKT, tcpip_msg::type, and UNLOCK_TCPIP_CORE.
Referenced by netif_init().