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

📄 cm_targt.h

📁 基于EthernetIP协议的应用程序,可以读取AB公司Controllogix系列Ethernetip协议PLC数据. 此软件代码可用于工业控制.
💻 H
📖 第 1 页 / 共 2 页
字号:
*/

cm_ConnectionRecordType* cm_FindConnection( UINT16  iConnectionSn,
                                            UINT16  iOrigVendorId,
                                            UINT32  lOrigDeviceSn,
                                            UINT16  iOrigConnectionSn,
                                            UINT16  iPort,
                                            UINT16  iClass,
                                            UINT16  iInstance,
                                            UINT16  iProConnPoint,
                                            UINT16  iConConnPoint );



/*---------------------------------------------------------------------------
**
** cm_GetPrivateRecord()
** cm_GetPublicRecord()
**
** Convert a public connection record pointer to a private connection
** record pointer and vice-versa.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    psConnRecord      - Pointer to public/private connection record
**
** Outputs:
**    Return            - Pointer to private/public connection record
**
** Usage:
**    psPrivate = cm_GetPrivateRecord( psPublic );
**    psPublic  = cm_GetPublicRecord(  psPrivate );
**
**---------------------------------------------------------------------------
*/

#define cm_GetPrivateRecord( psPublic ) \
   (cm_ConnectionRecordType*)((UINT8*)(psPublic) - LL_DOUBLE_LINK_HEADER_SIZE )

#define cm_GetPublicRecord( psPrivate ) \
   ( &((psPrivate)->sPublic) )



/*---------------------------------------------------------------------------
**
** cm_InquireConnection()
**
** Inquire if a connection is active or not.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to inquire tribble.
**
** Outputs:
**    None
**
** Usage:
**    cm_InquireConnection( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void cm_InquireConnection( CM_InquireTrrblType *pTrrbl );



/*---------------------------------------------------------------------------
**
** cm_IssueAppOpenClose()
**
** Issue an app open, app open complete, or app close tribble to the object
** that this connection is trying to connect to.
** The tribble issued is determined by the processing state of the connection.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    psConnRecord      - Pointer to connection record to process
**
** Outputs:
**    None
**
** Usage:
**    cm_IssueAppOpenClose( psConnRecord );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void cm_IssueAppOpenClose( cm_ConnectionRecordType *psConnRecord );



/*---------------------------------------------------------------------------
**
** cm_IssueFwdReply()
**
** Issue a reply packet to a forward open or forward close.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    psConnRecord      - Pointer to connection record to process
**
** Outputs:
**    None
**
** Usage:
**    cm_IssueFwdReply( psConnRecord );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void cm_IssueFwdReply( cm_ConnectionRecordType *psConnRecord );



/*---------------------------------------------------------------------------
**
** CM_ObjectTask()
**
** Main processing task for the connection manager object.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    None
**
** Outputs:
**    None
**
** Usage:
**    GS_NewTask( cm_ObjectTask... );
**
**---------------------------------------------------------------------------
*/

EXTFUNC TASKRETURN cm_ObjectTask( TASKPARAM );



/*---------------------------------------------------------------------------
**
** cm_PackConnId()
** cm_UnpackConnId()
**
** Pack or unpack a connection ID to/from a forward open packet into
** a byte array in tag screener order.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    psLeConnId        - Connection ID structure in wire order
**    abConnid          - Byte array containing connection id
**
** Outputs:
**    None
**
** Usage:
**    cm_PackConnId( psLeConnId, abConnId );
**    cm_UnpackConnId( abConnId, psLeConnId );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void cm_PackConnId( CM_LeConnIdType *psLeConnId, UINT8 abConnId[] );
EXTFUNC void cm_UnpackConnId( UINT8 abConnId[], CM_LeConnIdType *psLeConnId );



/*---------------------------------------------------------------------------
**
** cm_ParseFwdOpen()
**
** Parse the interesting information from a forward open packet.
** Fill in the data and pointers to data in a connection record.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pCombuf           - Pointer to combuf containing forward open packet
**    psConnRecord      - Pointers to conn record to parse into
**
** Outputs:
**    None
**
** Usage:
**    cm_ParseFwdOpen( pCombuf, psConnRecord );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void cm_ParseFwdOpen( CB_ComBufType           *pCombuf,
                              cm_ConnectionRecordType *psConnRecord
                            );



/*---------------------------------------------------------------------------
**
** cm_ProcessAppClose()
** cm_ProcessAppOpen()
** cm_ProcessAppOpenComplete()
**
** Process the response tribble from an app close, app open, or
** app open complete request to the object we're connecting to.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to response tribble
**
** Outputs:
**    None
**
** Usage:
**    cm_ProcessAppClose( pTrrbl );
**    cm_ProcessAppOpen( pTrrbl );
**    cm_ProcessAppOpenComplete( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void cm_ProcessAppClose( CM_AppOpenCloseTrrblType *pTrrbl );
EXTFUNC void cm_ProcessAppOpen( CM_AppOpenCloseTrrblType *pTrrbl );
EXTFUNC void cm_ProcessAppOpenComplete( CM_AppOpenCloseTrrblType *pTrrbl );



/*---------------------------------------------------------------------------
**
** cm_ProcessFwdClose()
**
** Initial forward close tribble processing.
** Subsequent processing steps are:
**
**    Send app close request.
**    Process app close response.
**    Send stop channel request.
**    Process stop channel response.
**    Return forward close tribble that now contains a forward close reply.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to forward close requst tribble
**
** Outputs:
**    None
**
** Usage:
**    cm_ProcessFwdClose( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void cm_ProcessFwdClose( CD_PacketTrrblType *pTrrbl );



/*---------------------------------------------------------------------------
**
** cm_ProcessFwdOpen()
**
** Initial forward open tribble processing.
** Subsequent processing steps are:
**
**    Send app open request.
**    Process app open response.
**    Send prepare channel request.
**    Send start channel request.
**    Process prepare channel response.
**    Process start channel response.
**    Return forward open tribble that now contains a forward open reply.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to forward open requst tribble
**
** Outputs:
**    None
**
** Usage:
**    cm_ProcessFwdOpen( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void cm_ProcessFwdOpen( CD_PacketTrrblType* pTrrbl );



/*---------------------------------------------------------------------------
**
** cm_ProcessImAlive()
**
** Process the receipt of an I'm Alive! packet from another node that has
** just powered up and come on line.
** Shut down any exsiting connections with that node.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to I'm alive tribble
**
** Outputs:
**    None
**
** Usage:
**    cm_ProcessImAlive( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void cm_ProcessImAlive( CD_PacketTrrblType *pTrrbl );



/*---------------------------------------------------------------------------
**
** cm_ProcessNewRxPacket()
**
** Process a newly received packet,
** most likely a forward open or a forward close.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    upsTrrbl          - Pointer to packet tribble
**
** Outputs:
**    None
**
** Usage:
**    cm_ProcessNewRxPacket( upsTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void cm_ProcessNewRxPacket( cm_upsTrrblType upsTrrbl );



/*---------------------------------------------------------------------------
**
** cm_ProcessTimer()
**
** Process an expired transport watchdog timer.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to timeout tribble
**
** Outputs:
**    None
**
** Usage:
**    cm_ProcessTimer( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void cm_ProcessTimer( CD_TimeoutTrrblType *pTrrbl );



/*---------------------------------------------------------------------------
**
** cm_SelectConnectionSn()
**
** Select a unique (to this node) connection serial number.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    None
**
** Outputs:
**    Return            - Unique connection serial number
**
** Usage:
**    iConnId = cm_SelectConnectionSn();
**
**---------------------------------------------------------------------------
*/

EXTFUNC UINT16 cm_SelectConnectionSn( void );



/*---------------------------------------------------------------------------
**
** cm_UnpackSchedule()
**
** Unpack the rate and starting nut from an IOI schedule segment byte.
** Highest 1 bit is the rate, all lower bits are the starting NUT.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    psConnRecord      - Pointer to connection record
**    bSchedule         - Schedule byte
**
** Outputs:
**    None
**
** Usage:
**    cm_UnpackSchedule( psConnRecord, bSchedule );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void cm_UnpackSchedule( cm_ConnectionRecordType *psConnRecord, UINT8 bSchedule );



/*---------------------------------------------------------------------------
**
** cm_ValidateKey()
**
** Validate the information in an electronic key segment of a forward open.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    psConnRecord      - Pointer to related connection record
**
** Outputs:
**    None
**
** Usage:
**    cm_ValidateKey( psConnRecord );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void cm_ValidateKey( cm_ConnectionRecordType *psConnRecord );



/*---------------------------------------------------------------------------
**
** cm_ZeroConnRecord()
**
** Zero all data in a a newly allocated connection record.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    psConnRecord      - Pointer to new connection record
**
** Outputs:
**    None
**
** Usage:
**    cm_ZeroConnRecord( psConnRecord );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void cm_ZeroConnRecord( cm_ConnectionRecordType *psConnRecord );

#endif  /* #ifdef CORE_OBJECTS */
#endif  /* inclusion lock */

/****************************************************************************
**
** End of CM_TARGT.H
**
*****************************************************************************
*/

⌨️ 快捷键说明

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