📄 stacktsk.h
字号:
/*********************************************************************
*
* Microchip TCP/IP Stack Definitions for PIC18
*
*********************************************************************
* File Name: StackTsk.h
* Dependencies: Compiler.h
* Processor: PIC18
* Complier: MCC18 v1.00.50 or higher
* HITECH PICC-18 V8.10PL1 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
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Nilesh Rajbharti 8/10/01 Original (Rev 1.0)
* Nilesh Rajbharti 2/9/02 Cleanup
* Nilesh Rajbharti 5/22/02 Rev 2.0 (See version.log for detail)
* Nilesh Rajbharti 8/7/03 Rev 2.21 - TFTP Client addition
* Howard Schlunder 9/30/04 Added MCHP_MAC, MAC_POWER_ON_TEST,
EEPROM_BUFFER_SIZE, USE_LCD
********************************************************************/
#ifndef STACK_TSK_H
#define STACK_TSK_H
/* commented by lfei 07/03/28 ***
#include "Compiler.h"
*********************************/
/*
* 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 is 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 (256)
#if (TICK_PRESCALE_VALUE != 2 && \
TICK_PRESCALE_VALUE != 4 && \
TICK_PRESCALE_VALUE != 8 && \
TICK_PRESCALE_VALUE != 16 && \
TICK_PRESCALE_VALUE != 32 && \
TICK_PRESCALE_VALUE != 64 && \
TICK_PRESCALE_VALUE != 128 && \
TICK_PRESCALE_VALUE != 256 )
#error Invalid TICK_PRESCALE_VALUE specified.
#endif
#if defined(WIN32)
#undef TICKS_PER_SECOND
#define TICKS_PER_SECOND (1)
#endif
/*
* This value is for performance enhancing features specific to
* Microchip Ethernet controllers. If a non-Microchip Ethernet
* controller is used, this define must be commented out. When
* defined, checksum computations will be offloaded to the hardware.
*/
#define MCHP_MAC
/*
* This value is specific to the Microchip Ethernet controllers.
* If a different Ethernet controller is used, this define is not
* used. If a Microchip controller is used and a self memory test
* should be done when the MACInit() function is called,
* uncomment this definition. The test requires ~512 bytes of
* program memory.
*/
//#define MAC_POWER_ON_TEST
/*
* This value is specific to the Microchip Ethernet controllers.
* If a different Ethernet controller is used, this define is not
* used. Ideally, when MAC_FILTER_BROADCASTS is defined, all
* broadcast packets that are received would be discarded by the
* hardware, except for ARP requests for our IP address. This could
* be accomplished by filtering all broadcasts, but allowing the ARPs
* using the patter match filter. The code for this feature has been
* partially implemented, but it is not complete nor tested, so this
* option should remain unused in this stack version.
*/
//#define MAC_FILTER_BROADCASTS
/*
* SPI Serial EEPROM buffer size. To enhance performance while
* cooperatively sharing the SPI bus with other peripherals, bytes
* read and written to the memory are locally buffered. This
* parameter has no effect if spieeprom.c is not included in the
* project. Legal sizes are 1 to the EEPROM page size.
*/
#define EEPROM_BUFFER_SIZE (12)
/*
* The PICDEM.net board has an LCD module on it while other boards
* do not have one. Uncomment this define if an LCD is present and
* it should be used.
*/
//#define USE_LCD
/*
* This value is for Microchip 24LC256 - 256kb serial EEPROM
*/
#define EEPROM_CONTROL (0xa0)
/*
* Number of bytes to be reserved before MPFS storage is to start.
*
* These bytes host application configurations such as IP Address,
* MAC Address, and any other required variables.
*
* After making any change to this variable, MPFS.exe must be
* executed with correct block size.
* See MPFS.exe help message by executing MPFS /?
*/
#define MPFS_RESERVE_BLOCK (32)
/*
* Comment/Uncomment following lines depending on types of modules
* are required.
*/
#define STACK_USE_ICMP
//#define STACK_USE_HTTP_SERVER//*****************************************************
/*
* 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 application, user may want to define them here.
*/
//#define STACK_USE_SLIP
//#define STACK_USE_IP_GLEANING
//#define STACK_USE_DHCP
//#define STACK_USE_FTP_SERVER//**********************************************
//#define STACK_USE_SNMP_SERVER//************************************************=-
/* Open the macro by lfei to test 2007/03/03 */
#define STACK_USE_TFTP_CLIENT
/**************************************/
//#define STACK_USE_ANNOUNCE
/*
* 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 SNMP TRAP support is required
//#define SNMP_TRAP_DISABED
/*
* When SLIP is used, DHCP is not supported.
*/
#if defined(STACK_USE_SLIP)
#undef STACK_USE_DHCP
#endif
/*
* When MPFS_USE_PGRM is used, FTP is not supported.
*/
#if defined(MPFS_USE_PGRM)
#undef STACK_USE_FTP_SERVER
#endif
/*
* Comment following line if StackTsk should wait for acknowledgement
* from remote host before transmitting another packet.
* Commenting following line may reduce throughput.
*/
#define TCP_NO_WAIT_FOR_ACK
/*
* 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
/*
* If html pages are stored in internal program memory,
* uncomment MPFS_USE_PRGM and comment MPFS_USE_EEPROM
* If html pages are stored in external eeprom memory,
* comment MPFS_USE_PRGM and uncomment MPFS_USE_EEPROM
*/
//#define MPFS_USE_PGRM
//#define MPFS_USE_EEPROM
#if defined(MPFS_USE_PGRM) && defined(MPFS_USE_EEPROM)
#error Invalid MPFS Storage option specified.
#endif
//#if !defined(MPFS_USE_PGRM) && !defined(MPFS_USE_EEPROM)
//#error You have not specified MPFS storage option.
//#endif
//*******************************************************************************************
/*
* When HTTP is enabled, TCP must be enabled.
*/
#if defined(STACK_USE_HTTP_SERVER)
#if !defined(STACK_USE_TCP)
#define STACK_USE_TCP
#endif
#endif
/*
* When FTP is enabled, TCP must be enabled.
*/
#if defined(STACK_USE_FTP_SERVER)
#if !defined(STACK_USE_TCP)
#define STACK_USE_TCP
#endif
#endif
/*
* When Announce is enabled, UDP must be enabled.
*/
#if defined(STACK_USE_ANNOUNCE)
#if !defined(STACK_USE_UDP)
#define STACK_USE_UDP
#endif
#endif
#if defined(STACK_USE_FTP_SERVER) && !defined(STACK_CLIENT_MODE)
#define STACK_CLIENT_MODE
#endif
#if defined(STACK_USE_SNMP_SERVER) && !defined(STACK_CLIENT_MODE)
#define STACK_CLIENT_MODE
#endif
/*
* When DHCP is enabled, UDP must also be enabled.
*/
#if defined(STACK_USE_DHCP)
#if !defined(STACK_USE_UDP)
#define STACK_USE_UDP
#endif
#endif
#if defined(STACK_USE_SNMP_SERVER) && !defined(STACK_USE_UDP)
#define STACK_USE_UDP
#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
/*
* When TFTP Client is enabled, UDP must also be enabled.
* And client mode must also be enabled.
*/
#if defined(STACK_USE_TFTP_CLIENT) && !defined(STACK_USE_UDP)
#define STACK_USE_UDP
#endif
#if defined(STACK_USE_TFTP_CLIENT) && !defined(STACK_CLIENT_MODE)
#define STACK_CLIENT_MODE
#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 script 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)
#if defined(STACK_USE_DHCP)
#error DHCP cannot be used when SLIP is enabled.
#endif
#endif
/*
* Modify following macros depending on your interrupt usage
*/
#define ENABLE_INTERRUPTS() INTCON_GIEH = 1
#define DISBALE_INTERRUPTS() INTCON_GIEH = 0
/*
* Default Address information - If not found in data EEPROM.
*/
//---added by lfei 2007/02/05 to test------------------
#define MY_DEFAULT_IP_ADDR_BYTE1 (192)
#define MY_DEFAULT_IP_ADDR_BYTE2 (168)
#define MY_DEFAULT_IP_ADDR_BYTE3 (0)
#define MY_DEFAULT_IP_ADDR_BYTE4 (8)
//------------------------------------------
#define MY_DEFAULT_MASK_BYTE1 (0xff)
#define MY_DEFAULT_MASK_BYTE2 (0xff)
#define MY_DEFAULT_MASK_BYTE3 (0xff)
#define MY_DEFAULT_MASK_BYTE4 (0x00)
#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 MY_DEFAULT_IP_ADDR_BYTE4
/* added by lfei 2007/03/06 *****************/
#define MY_DEFAULT_MAC_BYTE1 (0x00)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -