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

📄 cd_util.h

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

   /*
   ** Array of pointers to transport records.
   */

   UINT16 iRadioActiveScheduledProdBits;
   UINT16 iRadioActiveP2PConsumerBits;
   UINT16 iRadioActiveMultiCastConBits;

   /*
   ** Array of pointers to transport records.
   */

#if CD_NUM_TRANSPORTS > EN_CD_NUM_TRANSPORTS
   struct cd_TransportRecordType *apTransportRecords[ CD_NUM_TRANSPORTS ];
#else
   struct cd_TransportRecordType *apTransportRecords[ EN_CD_NUM_TRANSPORTS ];
#endif
}
cd_DataType;



/*---------------------------------------------------------------------------
**
** cd_upsTrrblType
**
** Union of pointers to all tribble types used by CD.
**
**---------------------------------------------------------------------------
*/

typedef union cd_upsTrrblType
{
   GS_TrrblType                *Generic;
   CD_PacketTrrblType          *Packet;
   CD_TimeoutTrrblType         *Timeout;
   CD_TransportTrrblType       *Tran;
   GS_BitMsgTrrblType          *Bit;
}
cd_upsTrrblType;



/*---------------------------------------------------------------------------
**
** cd_RadioactiveMaskType
**
** Various masks used to eliminate the radioactive connections problem.  
** mask used to isolate transport index, radioactive bits and incarnation
** serial number.
**
**---------------------------------------------------------------------------
*/

typedef struct cd_RadioactiveMaskType
{
UINT16	nBitCount;       /* number of bits of index */
UINT16	nRadioactiveMask;/* Masks off the radioactive bits of the connection id */
UINT16	nTransportMask;  /* masks off the transport index in the Connection ID */
UINT16   nIncarnation;  /* Boot serial number */
} cd_RadioactiveMaskType;


/****************************************************************************
**
** Globals
**
*****************************************************************************
*/

/*---------------------------------------------------------------------------
**
** cd_s
**
** Private global communications device data.
**
**---------------------------------------------------------------------------
*/

extern cd_DataType cd_s;



/****************************************************************************
**
** Private Services
**
*****************************************************************************
*/

/*---------------------------------------------------------------------------
**
** cd_AllocateTransport()
**
** Allocate a new transport
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl                  - Pointer to transport tribble
**    fProducer               - Flag to indicate producer
**
** Outputs:
**    Return                  - Completion status
**
** Usage:
**
**    eStatus = cd_AllocateTransport( psTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC StatusType cd_AllocateTransport( CD_TransportTrrblType *psTrrbl,
                                                            BOOL fProducer );



/*---------------------------------------------------------------------------
**
** cd_CalcLinkTimeout()
**
** Calculate the unscheduled transmission link timeout based on the
** current network parameters. Accounts for number of nodes, cable system
** length, phase of the moon, etc.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    None
**
** Outputs:
**    None
**
** Usage:
**    cd_CalcLinkTimeout();
**
**---------------------------------------------------------------------------
*/

EXTFUNC void cd_CalcLinkTimeout( void );



/*---------------------------------------------------------------------------
**
** cd_CommissionTransports()
** cd_DecommissionTransports()
**
** Build or tear down transport(s)
** Both sides of a class 1 connection (2 transports)
** or a class 3 connection (1 transport).
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl                  - Pointer to transport tribble
**
** Outputs:
**    Return                  - Completion status
**
** Usage:
**
**    eStatus = cd_CommissionTransports( psTrrbl );
**    eStatus = cd_DecommissionTransports( psTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC StatusType cd_CommissionTransports( CD_TransportTrrblType *psTrrbl );
EXTFUNC StatusType cd_DecommissionTransports( CD_TransportTrrblType *psTrrbl );



/*---------------------------------------------------------------------------
**
** cd_DeleteTransport()
**
** Delete a transport
** (one side of a class 1 or both sides of a class 3 connection).
**
**---------------------------------------------------------------------------
**
** Inputs:
**	  psConnRecord			  - connection
**    iTransportId            - Transport number to delete
**    iConnectionSn           - Serial number of connection requesting delete.
**    iPort                   - Port number of connection
**
** Outputs:
**    Return                  - Completion status
**
** Usage:
**
**    eStatus = cd_DeleteTransport( iPort, iTransportId, iConnectionSn, psConnRecord );
**
**---------------------------------------------------------------------------
*/

/*
** start edits: October,11th 2005, H.F.
**
** add input:

EXTFUNC StatusType cd_DeleteTransport( UINT16 iPort, UINT16 iTransportId, UINT16 iConnectionSn );

**
*/

EXTFUNC StatusType cd_DeleteTransport( UINT16 iPort, UINT16 iTransportId, UINT16 iConnectionSn, CM_ConnectionRecordType * psConnRecord );

/*
** end edits: October,11th 2005, H.F.
*/


/*---------------------------------------------------------------------------
**
** cd_FlushUnscheduledTx()
**
** Flush the ASIC's unscheduled transmit FIFO.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    None
**
** Outputs:
**    None
**
** Usage:
**    cd_FlushUnscheduledTx();
**
**---------------------------------------------------------------------------
*/

EXTFUNC void cd_FlushUnscheduledTx( void );



/*---------------------------------------------------------------------------
**
** cd_GetNetMode()
**
** Get the current network operating mode of the node.
** (Listen-only, offline, or online)
**
**---------------------------------------------------------------------------
**
** Inputs:
**    None
**
** Outputs:
**    Return            - Current network operating mode
**
** Usage:
**    iMode = cd_GetNetMode();
**
**---------------------------------------------------------------------------
*/

EXTFUNC UINT8 cd_GetNetMode( void );



/*---------------------------------------------------------------------------
**
** cd_Init()
**
** Communication Device ASIC data/task creation/allocation/initialization.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    iOptions                   - Bit mask of initialization options
**
** Outputs:
**    Return                     - Success/failure status
**
** Usage:
**    eStatus = cd_Init( AB_COLD_START_RESOURCE );
**
**---------------------------------------------------------------------------
*/

EXTFUNC StatusType cd_Init( UINT16 iOptions );



/*---------------------------------------------------------------------------
**
** cd_LinkConnSnToTransport()
**
** Link connection serial number to transport record.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    iConnSn                    - Connection Serial Number
**    pTr                        - Pointer to Transport Record
**    iPort                      - Port of connection
**
** Outputs:
**    Return                     - Number of conn SN's linked to the transport.
**                                 OR -1 if Error.
**
** Usage:
**    iLocation = cd_LinkConnSnToTransport( iConnectionSn, pTransportRec, iPort  );
**
**---------------------------------------------------------------------------
*/

INT8 cd_LinkConnSnToTransport( UINT16 iConnSn, cd_TransportRecordType  *pTr, UINT16 iPort );



/*---------------------------------------------------------------------------
**
** cd_LoadUnschedTxPacket()
**
** Load one unscheduled packet into the ASIC Tx buffer. The packet can be
** any sort of unscheduled packet, with either a fixed or generic tag.
** It could also be a configuration packet.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl                  - Pointer to trrbl/combuf containing the packet
**    pabHeader               - Pointer to header of packet
**                              (size-control-tag bytes)
**    iHeaderSize             - Number of bytes in the header
**    iTotalSize              - Number of bytes in the packet & header
**    fConfig                 - Configuration or normal packet
**
** Outputs:
**    None
**
** Usage:
**
**    cd_LoadUnschedTxPacket( pTrrbl, (UINT8*)(&sHeader),

⌨️ 快捷键说明

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