tcpipconfig.h

来自「本附件为嵌入式Web的相关资料」· C头文件 代码 · 共 245 行

H
245
字号
/*********************************************************************
 *
 *	Microchip TCP/IP Stack Demo Application Configuration Header
 *
 *********************************************************************
 * FileName:        TCPIPConfig.h
 * Dependencies:    Microchip TCP/IP Stack
 * Processor:       PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F
 * Complier:        Microchip C18 v3.02 or higher
 *					Microchip C30 v2.01 or higher
 * Company:         Microchip Technology, Inc.
 *
 * Software License Agreement
 *
 * This software is owned by Microchip Technology Inc. ("Microchip") 
 * and is supplied to you for use exclusively as described in the 
 * associated software agreement.  This software is protected by 
 * software and other intellectual property laws.  Any use in 
 * violation of the software license may subject the user to criminal 
 * sanctions as well as civil liability.  Copyright 2006 Microchip
 * Technology Inc.  All rights reserved.
 *
 * This software is provided "AS IS."  MICROCHIP DISCLAIMS ALL 
 * WARRANTIES, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, NOT LIMITED 
 * TO MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND 
 * INFRINGEMENT.  Microchip shall in no event be liable for special, 
 * incidental, or consequential damages.
 *
 *
 * Author               Date        Comment
 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Howard Schlunder		10/04/2006	Original
 ********************************************************************/
#ifndef __TCPIPCONFIG_H
#define __TCPIPCONFIG_H

#include "mchp_tcp_ip\tcpip.h"

/*
 * Modules to include in this project
 * For demo purpose only, each sample project defines one or more
 * of following defines in compiler command-line options. (See
 * each MPLAB Project Node Properties under "Project->Edit Project" menu.
 * In real applcation, user may want to define them here.
 */
#define STACK_USE_ICMP
#define STACK_USE_HTTP_SERVER
#define STACK_USE_DHCP
#define STACK_USE_ANNOUNCE				// Microchip Embedded Ethernet Device Discoverer server/client


//#define STACK_USE_UART
//#define STACK_USE_SLIP
//#define STACK_USE_IP_GLEANING
//#define STACK_USE_FTP_SERVER
//#define STACK_USE_SMTP_CLIENT
//#define STACK_USE_SNMP_SERVER
//#define STACK_USE_TFTP_CLIENT
//#define STACK_USE_GENERIC_TCP_CLIENT_EXAMPLE	// HTTP Client example in GenericTCPClient.c
//#define STACK_USE_GENERIC_TCP_SERVER_EXAMPLE	// ToUpper server example in GenericTCPServer.c
//#define STACK_USE_TELNET_SERVER			// Telnet server
//#define STACK_USE_DNS					// Domain Name Service Client
//#define STACK_USE_NBNS					// NetBIOS Name Service Server


/*
 * This value is used by TCP to implement timeout actions.
 * If SNMP module is in use, this value should be 100 as required
 * by SNMP protocol unless main application is providing separate
 * tick which 10mS.
 */
#define TICKS_PER_SECOND               (100)        // 10ms

#if (TICKS_PER_SECOND < 10 || TICKS_PER_SECOND > 255)
#error Invalid TICKS_PER_SECONDS specified.
#endif

/*
 * Manually select prescale value to achieve necessary tick period
 * for a given clock frequency.
 */
#define TICK_PRESCALE_VALUE             (8)


/*
 * Following low level modules are automatically enabled/disabled based on high-level
 * module selections.
 * If you need them with your custom application, enable it here.
 */
//#define STACK_USE_TCP
//#define STACK_USE_UDP

/*
 * Uncomment following line if this stack will be used in CLIENT
 * mode.  In CLIENT mode, some functions specific to client operation
 * are enabled.
 */
//#define STACK_CLIENT_MODE


// When MPFS is stored in internal program memory (instead of external EEPROM), FTP is not supported.
#if !defined(MPFS_USE_EEPROM)
	#undef STACK_USE_FTP_SERVER
#endif


// Uncomment following line if SNMP TRAP support is unneeded
//#define SNMP_TRAP_DISABLED

// When SLIP is used, DHCP is not supported.
#if defined(STACK_USE_SLIP)
	#undef STACK_USE_DHCP
#endif

// When IP Gleaning is enabled, ICMP must also be enabled.
#if defined(STACK_USE_IP_GLEANING)
    #if !defined(STACK_USE_ICMP)
        #define STACK_USE_ICMP
    #endif
#endif


// Make sure that STACK_CLIENT_MODE is defined if a service 
// depends on it
#if defined(STACK_USE_FTP_SERVER) || \
	defined(STACK_USE_SNMP_SERVER) || \
	defined(STACK_USE_DNS) || \
	defined(STACK_USE_GENERIC_TCP_CLIENT_EXAMPLE) || \
	defined(STACK_USE_TFTP_CLIENT) || \
	defined(STACK_USE_SMTP_CLIENT)
	#if !defined(STACK_CLIENT_MODE)
	    #define STACK_CLIENT_MODE
	#endif
#endif

// Make sure that STACK_USE_TCP is defined if a service depends on 
// it
#if defined(STACK_USE_HTTP_SERVER) || \
	defined(STACK_USE_FTP_SERVER) || \
	defined(STACK_USE_TELNET_SERVER) || \
	defined(STACK_USE_GENERIC_TCP_CLIENT_EXAMPLE) || \
	defined(STACK_USE_GENERIC_TCP_SERVER_EXAMPLE) || \
	defined(STACK_USE_SMTP_CLIENT)
    #if !defined(STACK_USE_TCP)
        #define STACK_USE_TCP
    #endif
#endif

// Make sure that STACK_USE_UDP is defined if a service depends 
// on it
#if defined(STACK_USE_DHCP) || \
	defined(STACK_USE_DNS) || \
	defined(STACK_USE_NBNS) || \
	defined(STACK_USE_SNMP_SERVER) || \
	defined(STACK_USE_TFTP_CLIENT) || \
	defined(STACK_USE_ANNOUNCE)
    #if !defined(STACK_USE_UDP)
        #define STACK_USE_UDP
    #endif
#endif


/*
 * DHCP requires unfragmented packet size of at least 328 bytes,
 * and while in SLIP mode, our maximum packet size is less than
 * 255.  Hence disallow DHCP module while SLIP is in use.
 * If required, one can use DHCP while SLIP is in use by modifying
 * C18 linker scipt file such that C18 compiler can allocate
 * a static array larger than 255 bytes.
 * Due to very specific application that would require this,
 * sample stack does not provide such facility.  Interested users
 * must do this on their own.
 */
#if defined(STACK_USE_SLIP)
	#define NON_MCHP_MAC
#endif


//
// Default Address information - If not found in data EEPROM.
//
#define MY_DEFAULT_HOST_NAME			"MCHPBOARD"

#define MY_DEFAULT_MAC_BYTE1            (0x00)
#define MY_DEFAULT_MAC_BYTE2            (0x04)
#define MY_DEFAULT_MAC_BYTE3            (0xA3)
#define MY_DEFAULT_MAC_BYTE4            (0x00)
#define MY_DEFAULT_MAC_BYTE5            (0x00)
#define MY_DEFAULT_MAC_BYTE6            (0x00)

#define MY_DEFAULT_IP_ADDR_BYTE1        (10ul)
#define MY_DEFAULT_IP_ADDR_BYTE2        (10ul)
#define MY_DEFAULT_IP_ADDR_BYTE3        (33ul)
#define MY_DEFAULT_IP_ADDR_BYTE4        (203ul)

#define MY_DEFAULT_MASK_BYTE1           (255ul)
#define MY_DEFAULT_MASK_BYTE2           (255ul)
#define MY_DEFAULT_MASK_BYTE3           (0ul)
#define MY_DEFAULT_MASK_BYTE4           (0ul)

#define MY_DEFAULT_GATE_BYTE1           MY_DEFAULT_IP_ADDR_BYTE1
#define MY_DEFAULT_GATE_BYTE2           MY_DEFAULT_IP_ADDR_BYTE2
#define MY_DEFAULT_GATE_BYTE3           MY_DEFAULT_IP_ADDR_BYTE3
#define MY_DEFAULT_GATE_BYTE4           (1ul)

#define MY_DEFAULT_DNS_BYTE1			MY_DEFAULT_GATE_BYTE1
#define MY_DEFAULT_DNS_BYTE2			MY_DEFAULT_GATE_BYTE2
#define MY_DEFAULT_DNS_BYTE3			MY_DEFAULT_GATE_BYTE3
#define MY_DEFAULT_DNS_BYTE4			MY_DEFAULT_GATE_BYTE4

/*
 * TCP configurations
 * To minmize page update, match number of sockets and
 * HTTP connections with different page sources in a
 * page.
 * For example, if page contains reference to 3 more pages,
 * browser may try to open 4 simultaneous HTTP connections,
 * and to minimize browser delay, set HTTP connections to
 * 4, MAX_TCP_SOCKETS to 4.
 * If you are using other applications, you should
 * keep at least one socket available for them.
 */

// Maximum TCP sockets to be defined.
// Note that each TCP socket consumes 22 bytes of RAM (sizeof(TCB_STUB)), 
// and a goodly chunk of Ethernet buffer RAM (TCP_TX_FIFO_SIZE + 1 + TCP_RX_FIFO_SIZE + sizeof(TCB))
// for each socket)
#define MAX_TCP_SOCKETS     (4ul)
#define TCP_TX_FIFO_SIZE	(1300ul)
#define TCP_RX_FIFO_SIZE	(80ul)

// Maximum avaialble UDP Sockets
#define MAX_UDP_SOCKETS     (2ul)

// Maximum numbers of simultaneous HTTP connections allowed.
// Each connection consumes 10 bytes and a TCP socket
#define MAX_HTTP_CONNECTIONS	(4ul)

#if defined(LCD_DATA_IO)
	#define USE_LCD
#endif


#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?