📄 bf.h
字号:
/****************************************************************************
*****************************************************************************
**
** File Name
** ---------
**
** BF.H
**
*****************************************************************************
*****************************************************************************
**
** Description
** -----------
**
** Public interface definitions for the Buffer Fragment mapper.
**
** The Buffer Fragment mapper is an object that is internal to the
** ControlNet stack code. Its purpose is to provide a common location
** to hold the details of how externally defined connection points are
** mapped to internal application memory areas.
**
** There is one entry in the Buffer Fragment mapper for each
** external connection point.
** Connection points are identified by a class/instance pair.
**
** Internal memory may be organized into any number of application data
** areas. An application data area may be a reserved area of memory,
** a dual port memory, a backplane, another network interface,
** or any number of things.
**
** The Buffer Fragment mapper assumes that there are specific access
** and handshaking rules required to access each particular area of
** application data and hence maintains a second list of the mapping
** entries, sorted by application data area. This list may be accessed
** at any time by an application data manager task, as long as that task
** has a higher priority than the Buffer Fragment mapper task.
**
** Other tasks may inquire about the details of an entry in the
** Buffer Fragment mapper lists at any time, provided that they are
** higher priority than the Buffer Fragment mapper task.
**
*****************************************************************************
*****************************************************************************
**
** Source Change Indices
** ---------------------
**
** Porting: <none>-1---<major> Customization: <none>0----<major>
**
*****************************************************************************
*****************************************************************************
**
** Services List
** -------------
**
** BF_GetAccessRequest() - Get messaging request tribble for app area
** BF_GetActiveSubList() - Get start address of active entry list
** BF_Init() - Initialization
** BF_UpdateMapping() - Update the buffer pointer of one mapping
**
*****************************************************************************
*****************************************************************************
** **
** 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 BF_H
#define BF_H
/****************************************************************************
*****************************************************************************
**
** Network object interface - Constants
**
*****************************************************************************
****************************************************************************/
/* None defined */
/****************************************************************************
*****************************************************************************
**
** Network object interface - Packets
**
*****************************************************************************
****************************************************************************/
/* None defined */
#ifdef BUFFER_FRAGMENT_MAPPER
/****************************************************************************
*****************************************************************************
**
** Public internal object interface - Constants
**
*****************************************************************************
****************************************************************************/
/*
** Max number of sub-lists into which the active mapping entry list
** for each application data area can be split.
** There are separate lists for producer and consumer data, so this
** number must be a multiple of 2, with a minimum value of 2.
*/
#define BF_NUM_SUB_LISTS 4
/****************************************************************************
*****************************************************************************
**
** Public internal object interface - Enums
**
*****************************************************************************
****************************************************************************/
/* None defined */
/****************************************************************************
*****************************************************************************
**
** Public internal object interface - Structures
**
*****************************************************************************
****************************************************************************/
/*---------------------------------------------------------------------------
**
** BF_ActiveEntryType
**
** Structure that describes a mapping entry that has
** active class 1 connection(s).
** Arrays of these are kept sorted by app data area.
** The starting address of one of these arrays can be obtained via the
** BF_GetActiveSubList() service.
**
**---------------------------------------------------------------------------
*/
typedef struct BF_ActiveEntryType
{
/*
** Pointer to source memory for copy.
** Pointer to destination memory for copy.
** Either of these may be the app data or transport buffer memory.
** Which is which is determined by the app memory area.
** That is, the app memory area determines the direction of the copy.
** Size of memory piece.
** Offset of data portion of memory in transport buffer.
** (Size of status portion.)
*/
void *pSource;
void *pDestination;
UINT16 iResyncSize;
UINT16 iTranBufOffset;
/*
** Callback function to add object specific status ahead or instead of
** the data in the transport buffer.
*/
FD_pFuncPIIType pAddStatus;
/*
** Transport ID for this entry.
*/
UINT16 iTransportId;
/*
** Port associated with this transport.
*/
UINT16 iPort;
}
BF_ActiveEntryType;
/*---------------------------------------------------------------------------
**
** BF_InquireType
**
** Structure used to inquire about or reserve a mapping entry.
** (See the InquireTrrblType).
**
**---------------------------------------------------------------------------
*/
typedef struct BF_InquireType
{
/*
** Always filled in by requestor.
** Pro or con is implied by the pro/con copy of this structure
** in the tribble.
*/
UINT16 iClass; /* Mapping entry identity */
UINT16 iInstance;
/*
** Filled in by requestor for reserve requests,
** returned with inquire responses.
*/
UINT16 iResyncSize; /* Current resync size if active */
UINT16 iResyncRate; /* Current resync rate if active */
UINT16 iStatusBit; /* Connection good/bad/run/idle bit # */
UINT16 iStatusStyle; /* Consumed run/idle status style */
/*
** Returned with all responses.
*/
AD_AppDataAreaIdType eAppDataAreaId; /* Which app data area to use */
UINT16 iAppDataAreaOffset; /* Offset of data in app data */
UINT16 iMaxMappingSize; /* Max size of mapped data */
UINT16 iTransportId; /* Transport ID if active, 0 if not */
}
BF_InquireType;
/****************************************************************************
*****************************************************************************
**
** Public internal object interface - Tribbles
**
*****************************************************************************
****************************************************************************/
/*---------------------------------------------------------------------------
**
** NOTE:
** In the following tribble definitions:
** - All sizes and offsets are expressed in bytes.
** - A size of 0 specified in activation or access requests will use the
** size given when the entry was added.
** - The producer/consumer flag (fCon):
** FALSE (producer) copies from the app data to the communications memory.
** TRUE (consumer) copies from the communications memory to the app data.
** - Activated entries take part in resync operations.
** Deactivated entries don't.
** Active and deactive entries may take part in messaging get/put requests.
**
**---------------------------------------------------------------------------
*/
/*---------------------------------------------------------------------------
**
** BF_AccessTrrblType
**
** Tribble used to request access to the application data associated
** with a particular class/instance mapping entry. This request gets
** queued up to the application data area for later processing when
** BF_ProcessAccessRequests() is called by the application data handling
** task.
**
**---------------------------------------------------------------------------
**
** Tribble request code(s):
** TREQ_ACCESS_MAPPED_DATA
**
**---------------------------------------------------------------------------
*/
typedef struct BF_AccessTrrblType
{
GS_TRRBL_HEADER; /* the standard tribble header */
/*
** This portion of the tribble is filled in by the task requesting access.
*/
UINT16 iClass; /* Used to identify mapping entry */
UINT16 iInstance;
BOOL fCon; /* Consumer (Write to app data) */
UINT16 iMappedOffset; /* Offset into mapped app data */
CB_ComBufType *pComBuf; /* Combuf to get/put data from/to */
UINT16 iSize; /* Portion of buffer to copy */
void *xAccessParams; /* Additional params to define access */
void *xUserHandle; /* Handle for this access request */
/*
** The remaining fields are filled in by BF prior to forwarding the
** tribble to AD.
*/
AD_AppDataAreaIdType eAppDataAreaId; /* Which app data area to use */
UINT16 iAppDataAreaOffset; /* Start of mapping entry */
UINT32 lCpuTime; /* CPU time to copy data */
BOOL fSet;
}
BF_AccessTrrblType;
/*---------------------------------------------------------------------------
**
** BF_ActivateTrrblType
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -