初始化版本

This commit is contained in:
冯佳
2026-02-09 10:27:21 +08:00
commit 64d767932f
4467 changed files with 2486822 additions and 0 deletions

69
lwip/port/arch/cc.h Normal file
View File

@ -0,0 +1,69 @@
#ifndef __ARCH_CC_H__
#define __ARCH_CC_H__
#include <stdint.h>
#include <stddef.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
/* Compiler specific types */
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 uintptr_t mem_ptr_t;
/* Formatters for printf */
#define U16_F "u"
#define S16_F "d"
#define X16_F "x"
#define U32_F "u"
#define S32_F "d"
#define X32_F "x"
#define SZT_F "u"
#define X8_F "02x"
/* Endianness (Usually Little Endian for ARM) */
#ifndef BYTE_ORDER
#define BYTE_ORDER LITTLE_ENDIAN
#endif
/* Compiler hints for packing structures */
#if defined(__GNUC__)
#define PACK_STRUCT_BEGIN
#define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
#define PACK_STRUCT_END
#define PACK_STRUCT_FIELD(x) x
#elif defined(__CC_ARM)
#define PACK_STRUCT_BEGIN __packed
#define PACK_STRUCT_STRUCT
#define PACK_STRUCT_END
#define PACK_STRUCT_FIELD(x) x
#elif defined(__IAR_SYSTEMS_ICC__)
#define PACK_STRUCT_BEGIN
#define PACK_STRUCT_STRUCT
#define PACK_STRUCT_END
#define PACK_STRUCT_FIELD(x) x
#define PACK_STRUCT_USE_INCLUDES
#else
#define PACK_STRUCT_BEGIN
#define PACK_STRUCT_STRUCT
#define PACK_STRUCT_END
#define PACK_STRUCT_FIELD(x) x
#endif
/* Platform specific diagnostic output */
extern void osal_kprintf(const char *fmt, ...);
#define LWIP_PLATFORM_DIAG(x) do { osal_kprintf x; } while(0)
/* Assert */
#define LWIP_PLATFORM_ASSERT(x) do { osal_kprintf("Assertion \"%s\" failed at line %d in %s\n", \
x, __LINE__, __FILE__); } while(0)
/* Random number generator */
#define LWIP_RAND() ((u32_t)rand())
#endif /* __ARCH_CC_H__ */

34
lwip/port/arch/sys_arch.h Normal file
View File

@ -0,0 +1,34 @@
#ifndef __ARCH_SYS_ARCH_H__
#define __ARCH_SYS_ARCH_H__
#include "osal.h"
/* LwIP Type Mapping to OSAL Types */
typedef osal_sem_t sys_sem_t;
typedef osal_mutex_t sys_mutex_t;
typedef osal_mq_t sys_mbox_t;
typedef osal_thread_t sys_thread_t;
/* LwIP Constants */
#define SYS_MBOX_NULL NULL
#define SYS_SEM_NULL NULL
/* OSAL returns OSAL_ETIMEOUT, LwIP expects SYS_ARCH_TIMEOUT (usually 0xFFFFFFFF) */
#define SYS_ARCH_TIMEOUT 0xffffffffUL
/* Protection (Critical Section) */
typedef uint32_t sys_prot_t;
static inline sys_prot_t sys_arch_protect(void)
{
osal_enter_critical();
return 1;
}
static inline void sys_arch_unprotect(sys_prot_t pval)
{
(void)pval;
osal_exit_critical();
}
#endif /* __ARCH_SYS_ARCH_H__ */