81 lines
2.9 KiB
C
81 lines
2.9 KiB
C
|
|
#ifndef _ZTMS_LWIP_H_
|
||
|
|
#define _ZTMS_LWIP_H_
|
||
|
|
|
||
|
|
#include "lwip/opt.h"
|
||
|
|
|
||
|
|
//*****************************************************************************
|
||
|
|
//
|
||
|
|
// Ensure that AUTOIP COOP option is configured correctly.
|
||
|
|
//
|
||
|
|
//*****************************************************************************
|
||
|
|
#undef LWIP_DHCP_AUTOIP_COOP
|
||
|
|
#define LWIP_DHCP_AUTOIP_COOP ((LWIP_DHCP) && (LWIP_AUTOIP))
|
||
|
|
|
||
|
|
//*****************************************************************************
|
||
|
|
//
|
||
|
|
// lwIP API Header Files
|
||
|
|
//
|
||
|
|
//*****************************************************************************
|
||
|
|
#include <stdint.h>
|
||
|
|
#include "lwip/api.h"
|
||
|
|
#include "lwip/netifapi.h"
|
||
|
|
#include "lwip/tcp.h"
|
||
|
|
#include "lwip/udp.h"
|
||
|
|
#include "lwip/tcpip.h"
|
||
|
|
#include "lwip/sockets.h"
|
||
|
|
#include "lwip/mem.h"
|
||
|
|
#include "lwip/stats.h"
|
||
|
|
#include "lwip/def.h"
|
||
|
|
#include "lwip/tcp_impl.h"
|
||
|
|
#include "lwip/timers.h"
|
||
|
|
|
||
|
|
//*****************************************************************************
|
||
|
|
//
|
||
|
|
// IP Address Acquisition Modes
|
||
|
|
//
|
||
|
|
//*****************************************************************************
|
||
|
|
#define IPADDR_USE_STATIC 0
|
||
|
|
#define IPADDR_USE_DHCP 1
|
||
|
|
#define IPADDR_USE_AUTOIP 2
|
||
|
|
|
||
|
|
typedef struct {
|
||
|
|
uint8_t Addr0; // 192
|
||
|
|
uint8_t Addr1; // 168
|
||
|
|
uint8_t Addr2; // 1
|
||
|
|
uint8_t Addr3; // 100
|
||
|
|
} NETWORK_IPADDR;
|
||
|
|
|
||
|
|
//*****************************************************************************
|
||
|
|
//
|
||
|
|
// Hardware timer interrupt callback function type (available only when running
|
||
|
|
// on TM4C parts). This function is called in interrupt context whenever the
|
||
|
|
// Ethernet MAC reports an interrupt from the IEEE-1588 timestamping
|
||
|
|
// timer. The first parameter is the base address of the MAC and the second
|
||
|
|
// is the interrupt status as reported via EthMACTimestampIntStatus.
|
||
|
|
//
|
||
|
|
//*****************************************************************************
|
||
|
|
typedef void (* tHardwareTimerHandler)(uint32_t ui32Base,
|
||
|
|
uint32_t ui32IntStatus);
|
||
|
|
|
||
|
|
//*****************************************************************************
|
||
|
|
//
|
||
|
|
// lwIP Abstraction Layer API
|
||
|
|
//
|
||
|
|
//*****************************************************************************
|
||
|
|
|
||
|
|
extern void BSP_LwipInit(NETWORK_IPADDR IpAddr, NETWORK_IPADDR MaskAddr, NETWORK_IPADDR GwAddr, uint64_t Mac);
|
||
|
|
extern void lwIPInit(uint32_t ui32SysClkHz, const uint8_t *pui8Mac,
|
||
|
|
uint32_t ui32IPAddr, uint32_t ui32NetMask,
|
||
|
|
uint32_t ui32GWAddr, uint32_t ui32IPMode);
|
||
|
|
extern void lwIPTimerCallbackRegister(tHardwareTimerHandler pfnTimerFunc);
|
||
|
|
extern void lwIPTimer(uint32_t ui32TimeMS);
|
||
|
|
extern void lwIPEthernetIntHandler(void);
|
||
|
|
extern uint32_t lwIPLocalIPAddrGet(void);
|
||
|
|
extern uint32_t lwIPLocalNetMaskGet(void);
|
||
|
|
extern uint32_t lwIPLocalGWAddrGet(void);
|
||
|
|
extern void lwIPLocalMACGet(uint8_t *pui8Mac);
|
||
|
|
extern void lwIPNetworkConfigChange(uint32_t ui32IPAddr, uint32_t ui32NetMask,
|
||
|
|
uint32_t ui32GWAddr, uint32_t ui32IPMode);
|
||
|
|
extern uint32_t lwIPAcceptUDPPort(uint16_t ui16Port);
|
||
|
|
#endif
|