lwIP 2.2.1 Lightweight IP stack

Macros
Core locking and MPU
lwIP » Options (lwipopts.h) » Infrastructure

## Macros
#define | LWIP_MPU_COMPATIBLE 0
#define | LWIP_TCPIP_CORE_LOCKING 1
#define | LWIP_TCPIP_CORE_LOCKING_INPUT 0
#define | SYS_LIGHTWEIGHT_PROT 1
#define | LWIP_ASSERT_CORE_LOCKED()
#define | LWIP_MARK_TCPIP_THREAD()

## Detailed Description

## Macro Definition Documentation

## ◆ LWIP_ASSERT_CORE_LOCKED

#define LWIP_ASSERT_CORE_LOCKED | ( |  | ) |

Macro/function to check whether lwIP's threading/locking requirements are satisfied during current function call. This macro usually calls a function that is implemented in the OS-dependent sys layer and performs the following checks:

- Not in ISR (this should be checked for NO_SYS==1, too!)
- If LWIP_TCPIP_CORE_LOCKING = 1: TCPIP core lock is held
- If LWIP_TCPIP_CORE_LOCKING = 0: function is called from TCPIP thread
  See also
    Multithreading

## ◆ LWIP_MARK_TCPIP_THREAD

#define LWIP_MARK_TCPIP_THREAD | ( |  | ) |

Called as first thing in the lwIP TCPIP thread. Can be used in conjunction with LWIP_ASSERT_CORE_LOCKED to check core locking.

See also
  Multithreading

## ◆ LWIP_MPU_COMPATIBLE

#define LWIP_MPU_COMPATIBLE 0

LWIP_MPU_COMPATIBLE: enables special memory management mechanism which makes lwip able to work on MPU (Memory Protection Unit) system by not passing stack-pointers to other threads (this decreases performance as memory is allocated from pools instead of keeping it on the stack)

## ◆ LWIP_TCPIP_CORE_LOCKING

#define LWIP_TCPIP_CORE_LOCKING 1

LWIP_TCPIP_CORE_LOCKING Creates a global mutex that is held during TCPIP thread operations. Can be locked by client code to perform lwIP operations without changing into TCPIP thread using callbacks. See LOCK_TCPIP_CORE() and UNLOCK_TCPIP_CORE(). Your system should provide mutexes supporting priority inversion to use this.

## ◆ LWIP_TCPIP_CORE_LOCKING_INPUT

#define LWIP_TCPIP_CORE_LOCKING_INPUT 0

LWIP_TCPIP_CORE_LOCKING_INPUT: when LWIP_TCPIP_CORE_LOCKING is enabled, this lets tcpip_input() grab the mutex for input packets as well, instead of allocating a message and passing it to tcpip_thread.

ATTENTION: this does not work when tcpip_input() is called from interrupt context!

## ◆ SYS_LIGHTWEIGHT_PROT

#define SYS_LIGHTWEIGHT_PROT 1

SYS_LIGHTWEIGHT_PROT==1: enable inter-task protection (and task-vs-interrupt protection) for certain critical regions during buffer allocation, deallocation and memory allocation and deallocation. ATTENTION: This is required when using lwIP from more than one context! If you disable this, you must be sure what you are doing!