bf_util.h

来自「基于EthernetIP协议的应用程序,可以读取AB公司Controllogix」· C头文件 代码 · 共 648 行 · 第 1/2 页

H
648
字号


/*---------------------------------------------------------------------------
**
** bf_upsTrrblType
**
** Union of pointers to all tribble types used by the buffer fragment mapper.
** Helps to eliminate those unsightly type casts.
**
**---------------------------------------------------------------------------
*/

typedef union bf_upsTrrblType
{
   GS_TrrblType          *Generic;
   BF_AccessTrrblType    *Access;
   BF_ActivateTrrblType  *Activate;
   BF_AddTrrblType       *Add;
   BF_DeTrrblType        *Delete;
   BF_DeTrrblType        *Deactivate;
   BF_InquireTrrblType   *Inquire;
   BF_InquireTrrblType   *Reserve;
   BF_RegisterTrrblType  *Register;
}
bf_upsTrrblType;

  

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

/*---------------------------------------------------------------------------
**
** BF_xQid
**
** Buffer fragment manager task queue id.
**
**---------------------------------------------------------------------------
*/

extern GS_MsgQueueType BF_xQid;

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

extern volatile bf_DataType bf_s;



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

/*---------------------------------------------------------------------------
**
** bf_AccessMapping()
**
** Queue up a request to access the application data mapped
** via a class and instance.  The request is processed and the tribble
** reurned when the application data manager task calls
** BF_ProcessAccessRequests().
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to request tribble
**
** Outputs:
**    None
**
** Usage:
**    bf_AccessMapping( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void bf_AccessMapping( BF_AccessTrrblType *pTrrbl );



/*---------------------------------------------------------------------------
**
** bf_ActivateMapping()
**
** Activate a mapping entry.
** Associate a transport with it and move it into the active entry list
** and the list sorted by transport ID.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to request tribble
**
** Outputs:
**    None
**
** Usage:
**    bf_ActivateMapping( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void bf_ActivateMapping( BF_ActivateTrrblType *pTrrbl );



/*---------------------------------------------------------------------------
**
** bf_AddMapping()
**
** Add a mapping entry.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to add request tribble
**
** Outputs:
**    None
**
** Usage:
**    bf_AddMapping( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void bf_AddMapping( BF_AddTrrblType *pTrrbl );



/*---------------------------------------------------------------------------
**
** bf_DeactivateMapping()
**
** Deactivate a mapping entry.
** Disassociate all transports and remove the entry from the active entry
** list and the list sorted by transport ID.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to request tribble
**
** Outputs:
**    None
**
** Usage:
**    bf_DeactivateMapping( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void bf_DeactivateMapping( BF_DeTrrblType *pTrrbl );



/*---------------------------------------------------------------------------
**
** bf_DeleteMapping()
**
** Delete a mapping entry.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to delete request tribble
**
** Outputs:
**    None
**
** Usage:
**    bf_DeleteMapping( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void bf_DeleteMapping( BF_DeTrrblType *pTrrbl );



/*---------------------------------------------------------------------------
**
** bf_FindMapping()
**
** Look for a mapping entry that matches the given class and instance.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    iClass            - Class and instance to look for
**    iInstance
**    fCon              - Consumer (write to app mem)
**
** Outputs:
**    Return            - Index of matching entry or BF_NO_MAPPING
**
** Usage:
**    iMapping = bf_FindMapping( iClass, iInstance, fCon );
**
**---------------------------------------------------------------------------
*/

EXTFUNC UINT16 bf_FindMapping( UINT16 iClass, UINT16 iInstance, BOOL fCon );



/*---------------------------------------------------------------------------
**
** bf_InquireMappings()
**
** Get all the vital info for a producer and consumer mapping.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    psTrrbl           - Pointer to inquiry tribble
**
** Outputs:
**    None
**
** Usage:
**    bf_InquireMapping( upsTrrbl.Inquire );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void bf_InquireMappings( BF_InquireTrrblType *psTrrbl );



/*---------------------------------------------------------------------------
**
** bf_MoveActiveEntry()
**
** Move an active mapping entry in the active entry list.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    iDest             - Index of destination record
**    iSrc              - Index of source record
**
** Outputs:
**    None
**
** Usage:
**    bf_MoveActiveEntry( iDest, iSrc );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void bf_MoveActiveEntry( UINT16 iDest, UINT16 iSrc );



/*---------------------------------------------------------------------------
**
** bf_RegisterAppDataArea()
**
** Register a new application data area.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to registration tribble
**
** Outputs:
**    None
**
** Usage:
**    bf_RegisterAppDataArea( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void bf_RegisterAppDataArea( BF_RegisterTrrblType *pTrrbl );



/*---------------------------------------------------------------------------
**
** bf_Task()
**
** Buffer Fragment manager task.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    None
**
** Outputs:
**    None
**
** Usage:
**    GS_NewTask( bf_Task, ... );
**
**---------------------------------------------------------------------------
*/

EXTFUNC TASKRETURN bf_Task( TASKPARAM );



#endif  /* #ifdef BUFFER_FRAGMENT_MAPPER */
#endif  /* inclusion lock */

/****************************************************************************
*****************************************************************************
**
** End of BF_Util.H
**
*****************************************************************************
****************************************************************************/

⌨️ 快捷键说明

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