⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ab_cfg.h

📁 基于EthernetIP协议的应用程序,可以读取AB公司Controllogix系列Ethernetip协议PLC数据. 此软件代码可用于工业控制.
💻 H
📖 第 1 页 / 共 2 页
字号:
/****************************************************************************
*****************************************************************************
**
** File Name
** ---------
**
** AB_CFG.H
**
*****************************************************************************
*****************************************************************************
**
** Description
** -----------
**
** Basic Services API - Configuration for entire example code
**
** This source file contains the configuration selections needed to customize
** a particular build of the Ethernet Example Code.
**
** The definitions in this file are the "fine tuning" compile switches
** and definitions for the overall configruation of the example code.
**
** The "coarse tuning" switches are selected in the file AB_ENV.H
**
*****************************************************************************
*****************************************************************************
**
** Source Change Indices
** ---------------------
**
** Porting: <none>--2--<major>         Customization: <none>----4<major>
**
*****************************************************************************
*****************************************************************************
**                                                                         **
** ETHERNET/IP EXAMPLE CODE                                                **
** COPYRIGHT (c) 2000-2005 ODVA (Open DeviceNet Vendor Association)		   **
**						   & ControlNet International Ltd.                 **
**                                                                         **
** All rights reserved, except as specifically licensed in writing.        **
** Use of the Ethernet/IP Example Protocol Software is subject to          **
** ODVA's and ControlNet International's Terms of Use Agreement.           **
** The following work constitutes example program code and is intended     **
** merely to illustrate useful programming techniques.  The user is        **
** responsible for applying the code correctly.  The code is provided      **
** AS IS without warranty and is in no way guaranteed to be error-free.    **
**                                                                         **
*****************************************************************************
*****************************************************************************
*/

/****************************************************************************
*****************************************************************************
**
** Change Log
** ----------
**
**
*****************************************************************************
*****************************************************************************
*/

#ifndef AB_CFG_H
#define AB_CFG_H



/****************************************************************************
**
** Example Code Environment Dependent Computed Configuration
**
** NOTE:  The application developer should NOT modify anything in this next
**        section.  These are configuration options that are COMPUTED based
**        upon the application defined environment.
**
*****************************************************************************
*/

/*---------------------------------------------------------------------------
** Endian Order Selection (this is determined by the processor)
**---------------------------------------------------------------------------
*/

#ifdef INTEL80x86
#define LITTLE_ENDIAN
#endif

/*---------------------------------------------------------------------------
** Microsoft visual C++ specifics
**---------------------------------------------------------------------------
*/

#ifdef MICROSOFTC
#pragma warning( disable : 4761 4305 4244 )
#define MICROSOFT32
#endif



/****************************************************************************
**
** User Specified Configuration Customization (fine tuning)
**
** NOTE:  This is where application developers can fine-tune their specific
**        configuration.  The contents of this file from here to the end of
**        the file are expected to be "fine-tuned" by the application
**        developer.
**
*****************************************************************************
*/

/****************************************************************************
**
** Debug Support Options
**
*****************************************************************************
*/

/*---------------------------------------------------------------------------
** Debugging Options (when defined) enable features of the example code which
** are normally useful for debugging and problem investigation during the
** development phase of a project.  It is NOT normally expected that any
** of these options will be left enabled in final production code.
**---------------------------------------------------------------------------
*/

/* #define DEBUG */                            /* global scope debugging enable */
/* #define DEBUG_HEAP_BUCKET_DEMAND */      /* heap bucket demand monitor    */
/* #define DEBUG_HEAP_WALKER */             /* heap walk at each malloc/free */
/* #define DEBUG_HEAP_HISTORY */            /* heap malloc/free history      */


/****************************************************************************
**
** Diagnostic Support Options
**
*****************************************************************************
*/

/*---------------------------------------------------------------------------
** Diagnostic Options enable useful features of the example code which are
** intended to provide run-time checking of certain critical parameters.
** Diagnostic Options differ from Debug Options because they represent
** features which MAY make sense to leave enabled in final production code.
**---------------------------------------------------------------------------
*/

/****************************************************************************
**
** AD component (Application Data Handler)
**
*****************************************************************************
*/

/****************************************************************************
**
** CD component (Communications Device)
**
*****************************************************************************
*/

/*---------------------------------------------------------------------------
** Number of Communication Ports
**---------------------------------------------------------------------------
*/

#define CD_NPORTS                      2


/*---------------------------------------------------------------------------
** Communications Port Numbers
**---------------------------------------------------------------------------
*/

#define CD_ETHERNET_PORT               2
#define CD_CONTROLNET_PORT             0


/*---------------------------------------------------------------------------
** Unconnected Transmit Default Retry Limit
**---------------------------------------------------------------------------
*/

#define CD_RETRY_LIMIT                 3
#define EN_CD_RETRY_LIMIT              1


/*---------------------------------------------------------------------------
** Max number of class 1 and class 3 connections allowed.
** These numbers are used to define the number of transports allowed
** at any given time.
**
** HACK ALERT!!!
** The CNA10 numbers are artifically reduced from 31 until the
** final 1.4 firmware interface is in place in the ASIC driver.
**---------------------------------------------------------------------------
*/

#define CD_NUM_CLASS_1                31
#define CD_NUM_CLASS_3                32

/* Number of transports allowed for ethernet driver */
#define EN_CD_NUM_CLASS_1             31
#define EN_CD_NUM_CLASS_3             32

/*
** Define the network interface that the TCP/IP 
** driver will use.  The ETHERNET_INTERFACE is
** the name of the driver, and ETHERNET_INTERFACE_INSTANCE
** is the instance of the driver actually used.
*/
#define ETHERNET_INTERFACE            "enet"
#define ETHERNET_INTERFACE_INSTANCE   "enet0"

/*
** Some enhancements have been made to the WindRiver
** motorola FEC driver for Class 1 messaging.  To
** take advantage of these enhancements define 
** MOTFEC_CLASS_1.  Note that the enhanced driver
** must be part of the project.
*/


#if CD_NUM_CLASS_1 > EN_CD_NUM_CLASS_1
#define MAX_CLASS_1 CD_NUM_CLASS_1
#else
#define MAX_CLASS_1 EN_CD_NUM_CLASS_1
#endif




/*---------------------------------------------------------------------------
** Number of connections that can be linked to a transport at one time.
**---------------------------------------------------------------------------
*/

#define CN_CD_MAX_MULTICAST           16
#define EN_CD_MAX_MULTICAST           16


/*---------------------------------------------------------------------------
** Number of socket connections that can exist at one time.
**---------------------------------------------------------------------------
*/
/* max TCP sockets we'll open */
#define MAX_TCP_SOCKETS 64
#define EN_MAX_INCOMING_CONNECTIONS 48
#define EN_MAX_OUTGOING_CONNECTIONS 32

/****************************************************************************
**
** CA component (CNA10 ASIC driver - internal subcomponent of CD)
**
*****************************************************************************
*/

/*---------------------------------------------------------------------------
** Acceptable CNA10 ASIC firmware revision numbers are
** defined and selected in the file CA.H
**
** ASIC Dual Port Base Address, Default MAC-ID, and other setup parameters
** are defined and selected in the file ABU_INIT.C
**---------------------------------------------------------------------------
*/


/****************************************************************************
**
** GS Component (General Services)
**
*****************************************************************************
*/

/*---------------------------------------------------------------------------
** Heap configuration
**---------------------------------------------------------------------------
*/
/*jjw */
#ifndef CD_EN_OBJECTS

	#define GS_HEAP_MIN_BLK_SIZE          16  /* size of smallest heap block   */
	#define GS_HEAP_MAX_BLK_SIZE         576  /* size of max block (in bytes)  */

	#define GS_HEAP_NUM_PARTITIONS         5  /* num of memory heap partitions */

	#define GS_PARTITION_SIZES                16,  48,  96, 176, 576
	#define GS_PARTITION_CAPACITIES           30, 100,  30,  35,   3

#else

	#define TCP_RCV_BUF_SIZE 4096L
	#define GS_HEAP_MIN_BLK_SIZE          16L  /* size of smallest heap block   */
	#define GS_HEAP_MAX_BLK_SIZE          4800  /* size of max block (in bytes)  */

	#define GS_HEAP_NUM_PARTITIONS         5  /* num of memory heap partitions */

	#define GS_PARTITION_SIZES                16,  96,  800,  2400, 4800
	#define GS_PARTITION_CAPACITIES           60,  1024,  1024,  256,   20 /* Ethernet messages around 600 bytes, tribbles around
                                                                64.  When pounding this with 1000's of messages, it could take
                                                                a lot of memory to support */
	#undef  GS_TOTAL_HEAP_SIZE
	#define GS_TOTAL_HEAP_SIZE  ((16 * 60) + (96 * 1024) + (800 * 1024) + (2400 * 256) + (4800 * 20) + 65535) /* 256K heap ( dynamic + static ) */

#endif

/* #define GS_HEAP_PROMOTION */           /* try bigger malloc on failure  */


/*---------------------------------------------------------------------------
** Allocate task stacks from the static heap
**---------------------------------------------------------------------------
*/

/*---------------------------------------------------------------------------
** System time support
**---------------------------------------------------------------------------
*/

#define GS_SYSTEM_TIME_SUPPORT            /* enable/disable system time    */


/*---------------------------------------------------------------------------
** Event table configuration
**---------------------------------------------------------------------------
*/

#define GS_FATAL_ON_RETENTIVE_OVERFLOW    /* event table overflow action   */
#define GS_RETENTIVE_EVENT_RECORDS     16 /* size of event records table   */
#define GS_NON_RETENTIVE_EVENT_RECORDS 16 /* size of event records table   */


/*---------------------------------------------------------------------------
** CPU Resource values
**---------------------------------------------------------------------------
*/

#define CPU_100_PERCENT          100000L
#define CPU_20_PERCENT            20000L
#define CPU_15_PERCENT            15000L
#define CPU_10_PERCENT            10000L
#define CPU_1_PERCENT              1000L

#define GS_TOTAL_CPU_RESOURCE   CPU_100_PERCENT      /* Total Resource available */
#define GS_MIN_CPU_RESOURCE     CPU_20_PERCENT       /* Point where allocs are rejected */


/*
** Class 1 connection values.
**
** The function CM_CalcCPUtimeForConnection() uses these values to
** calculate the percentage of CPU time it takes to keep this
** connection alive.
**
** Note that these values and the CM_CalcCPUtimeForConnection() function
** may not be used by every application.
** For example, the bridge object, BR, uses them to calculate the
** CPU time used by its connections.  However, other applications, such as
** a scanner, may use values defined for each of its application data areas
** instead.  In that case, the BF would calculate the CPU overhead time for
** the connection.
**
** These values are to be determined emperically.
** Example values are:
**       #define CPU_PKT_OVERHEAD         60L       /* 0.006% *//*
**       #define CPU_BYTE_OVERHEAD        19L       /* 0.0019%*//*
**
** These values were derived for a 16Mhz 186 platform.
**
** The default values are 0.  Therefore, no CPU resource will be
** reserved for bridged connections unless these values are changed.
*/


/*
** Class 3 connections are not time critical and can therefore be handled by
** the CPU resource reserve that is guaranteed by GS_MIN_CPU_RESOURCE.
** However, once the CPU resource reaches the GS_MIN_CPU_RESOURCE value
** we want to start rejecting any new ones.  Therefore a small CPU resource
** value is reserved for Class 3 connections.
**
** An example value is CPU_1_PERCENT.
** The default value is 0.  Therefore, no CPU resource will be
** reserved for bridged CLASS3 connections unless this value is changed.
*/

/*
** The CPU_CN_NUT_CONSTANT is used to calculate the percentage of
** CPU time used by the CD layer when there are no connections open.
**
** The ControlNet CD needs to reserve CPU bandwidth.
** However, other CD implementations may not.
** Remember that the NUT time in the MAC params structure is

⌨️ 快捷键说明

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