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

📄 ad_util.h

📁 基于EthernetIP协议的应用程序,可以读取AB公司Controllogix系列Ethernetip协议PLC数据. 此软件代码可用于工业控制.
💻 H
字号:
/****************************************************************************
*****************************************************************************
**
** File Name
** ---------
**
** AD_Util.H
**
*****************************************************************************
*****************************************************************************
**
** Description
** -----------
**
** Private definitions for the Application Data Area manager.
**
*****************************************************************************
*****************************************************************************
**
** Source Change Indices
** ---------------------
**
** Porting: <none>----4<major>         Customization: <none>----4<major>
**
*****************************************************************************
*****************************************************************************
**
** Services List
** -------------
**
**    ad_DemoLoopback()          - Demo application data loopback
**    ad_ProcessAccessRequest()  - Process a messaging access to app data
**    ad_ResyncCommAndAppaBufs() - Resync app data with transport buffers
**    ad_Task()                  - Demo application processing task
**
*****************************************************************************
*****************************************************************************
**                                                                         **
** 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 AD_UTIL_H
#define AD_UTIL_H



/****************************************************************************
*****************************************************************************
**
** Private internal object interface - Constants
**
*****************************************************************************
****************************************************************************/

/*
** Bit message values for the application task.
** Periodic application timer and scheduled data consumed.
*/

#define AD_BIT_MSG_TIMER            0x0001
#define AD_BIT_MSG_SCHEDULED_CON    0x0002
#define AD_BIT_MSG_SENT_PRO			0x0003 /* October,14th 2005, H.F. */



/****************************************************************************
*****************************************************************************
**
** Private internal object interface - Enums
**
*****************************************************************************
****************************************************************************/

/*---------------------------------------------------------------------------
**
** ad_DemoLoopType
**
** Determines which type of demo loopback is being requested.
**
**---------------------------------------------------------------------------
*/

typedef enum {
   AD_DEMOLOOP_SCHED,
   AD_DEMOLOOP_UNSCHED,
   AD_DEMOLOOP_PERIODIC,
   AD_DEMOLOOP_SENT_PRO		/* October,14th 2005, H.F. */
}
ad_DemoLoopType;


/****************************************************************************
*****************************************************************************
**
** Private internal object interface - Structures
**
*****************************************************************************
****************************************************************************/

/*---------------------------------------------------------------------------
**
** ad_DataAreaType
**
** Info about one app data area.
**
**---------------------------------------------------------------------------
*/

typedef struct ad_DataAreaType
{
   /*
   ** Base address of data area.
   ** Size of data area (in bytes).
   */

   UINT8  *pabBaseAddress;
   UINT16  iSize;
}
ad_DataAreaType;



/*---------------------------------------------------------------------------
**
** ad_DataType
**
** Private data for the application data area manager's use.
**
**---------------------------------------------------------------------------
*/

typedef struct ad_DataType
{
   /*
   ** Data about each app data area.
   */

   ad_DataAreaType  asDataArea[ AD_NUM_APP_DATA_AREAS ];
}
ad_DataType;



/*---------------------------------------------------------------------------
**
** ad_upsTrrblType
**
** Union of pointers to all tribble types used by the application task,
** Helps to eliminate those unsightly type casts.
**
**---------------------------------------------------------------------------
*/

typedef union ad_upsTrrblType
{
   GS_TrrblType          *Generic;
   GS_BitMsgTrrblType    *BitMsg;
   BF_AccessTrrblType    *Access;
}
ad_upsTrrblType;



/****************************************************************************
*****************************************************************************
**
** Private internal object interface - Globals
**
*****************************************************************************
****************************************************************************/

/*
** Data structure holding private globals.
*/

extern ad_DataType ad_s;



/****************************************************************************
*****************************************************************************
**
** Private internal object interface - Services
**
*****************************************************************************
****************************************************************************/

/*---------------------------------------------------------------------------
**
** ad_DemoLoopback()
**
** Demonstration loopback of input and output data areas.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    eLoopType         - One of AD_DEMOLOOP_SCHED, AD_DEMOLOOP_UNSCHED,
**                        or AD_DEMOLOOP_PERIODIC to determine which type
**                        of loopback was requested.
**
** Outputs:
**    None
**
** Usage:
**    ad_DemoLoopback( AD_DEMOLOOP_SCHED );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void ad_DemoLoopback( ad_DemoLoopType eLoopType );



/*---------------------------------------------------------------------------
**
** ad_ProcessAccessRequest()
**
** Process one app data area access tribble.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl                  - Pointer to request tribble/combuf
**
** Outputs:
**    None
**
** Usage:
**    ad_ProcessAccessRequest( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void ad_ProcessAccessRequest( BF_AccessTrrblType *pTrrbl );



/*---------------------------------------------------------------------------
**
** ad_ResyncCommAndAppBufs()
**
** Resynchronize one portion of application data with its active transport
** buffers.  This will either copy data from the application data into
** transport buffers or from transport buffers into application data
** depending on the data copy direction associated with this piece of
** application data.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    eAppDataAreaId          - Which app data area
**    fCon                    - Copy direction
**
** Outputs:
**    Return                  - Number of connections processed
**                              0 when last portion of area serviced
**
** Usage:
**    ad_ResyncCommAndAppBufs( AD_APP_DATA_AREA_CON, TRUE )
**
**---------------------------------------------------------------------------
*/

EXTFUNC void ad_ResyncCommAndAppBufs( AD_AppDataAreaIdType eAppDataAreaId,
                                      BOOL fCon );



/*---------------------------------------------------------------------------
**
** ad_Task()
**
** Application Data Area manager task.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    None
**
** Outputs:
**    None
**
** Usage:
**    GS_NewTask( ad_Task, ... );
**
**---------------------------------------------------------------------------
*/

EXTFUNC TASKRETURN ad_Task( TASKPARAM );



#endif  /* inclusion lock */

/****************************************************************************
*****************************************************************************
**
** End of AD_Util.H
**
*****************************************************************************
****************************************************************************/

⌨️ 快捷键说明

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