forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extmod/modlwip: Initial commit of the lwip network stack module
- Loading branch information
Showing
4 changed files
with
1,053 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#ifndef __CC_H__ | ||
#define __CC_H__ | ||
|
||
#include <stdint.h> | ||
|
||
// Generate lwip's internal types from stdint | ||
|
||
typedef uint8_t u8_t; | ||
typedef int8_t s8_t; | ||
typedef uint16_t u16_t; | ||
typedef int16_t s16_t; | ||
typedef uint32_t u32_t; | ||
typedef int32_t s32_t; | ||
|
||
typedef u32_t mem_ptr_t; | ||
|
||
#define U16_F "hu" | ||
#define S16_F "hd" | ||
#define X16_F "hx" | ||
#define U32_F "u" | ||
#define S32_F "d" | ||
#define X32_F "x" | ||
|
||
#define X8_F "02x" | ||
#define SZT_F "u" | ||
|
||
#define BYTE_ORDER LITTLE_ENDIAN | ||
|
||
#define LWIP_CHKSUM_ALGORITHM 2 | ||
|
||
#include <assert.h> | ||
#define LWIP_PLATFORM_DIAG(x) | ||
#define LWIP_PLATFORM_ASSERT(x) { assert(1); } | ||
|
||
//#define PACK_STRUCT_FIELD(x) x __attribute__((packed)) | ||
#define PACK_STRUCT_FIELD(x) x | ||
#define PACK_STRUCT_STRUCT __attribute__((packed)) | ||
#define PACK_STRUCT_BEGIN | ||
#define PACK_STRUCT_END | ||
|
||
#endif /* __ARCH_CC_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#ifndef __PERF_H__ | ||
#define __PERF_H__ | ||
|
||
#define PERF_START /* null definition */ | ||
#define PERF_STOP(x) /* null definition */ | ||
|
||
#endif /* __PERF_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#ifndef __LWIPOPTS_H__ | ||
#define __LWIPOPTS_H__ | ||
|
||
// We're running without an OS for this port. We don't provide any services except light protection. | ||
#define NO_SYS 1 | ||
|
||
#define SYS_LIGHTWEIGHT_PROT 1 | ||
#include <stdint.h> | ||
typedef uint32_t sys_prot_t; | ||
|
||
#define TCP_LISTEN_BACKLOG 1 | ||
|
||
// We'll put these into a proper ifdef once somebody implements an ethernet driver | ||
#define LWIP_ARP 0 | ||
#define LWIP_ETHERNET 0 | ||
|
||
#define LWIP_DNS 1 | ||
|
||
#define LWIP_NETCONN 0 | ||
#define LWIP_SOCKET 0 | ||
|
||
#ifdef MICROPY_PY_LWIP_SLIP | ||
#define LWIP_HAVE_SLIPIF 1 | ||
#endif | ||
|
||
// For now, we can simply define this as a macro for the timer code. But this function isn't | ||
// universal and other ports will need to do something else. It may be necessary to move | ||
// things like this into a port-provided header file. | ||
#define sys_now HAL_GetTick | ||
|
||
#endif | ||
|
Oops, something went wrong.