📄 en_xport.h
字号:
/****************************************************************************
*****************************************************************************
**
** File Name
** ---------
**
** EN_XPORT.H
**
*****************************************************************************
*****************************************************************************
**
** Description
** -----------
**
** Private interface definitions for TCPIP transport management.
**
*****************************************************************************
*****************************************************************************
**
** Source Change Indices
** ---------------------
**
** Porting Changes
**
** Porting: <none>0----<major> Customization: <none>0----<major>
**
*****************************************************************************
*****************************************************************************
**
** Services List
** -------------
**
** en_cd_FreeTransportBuffers() - Free buffers for a transport
** en_cd_ProcessAPITxList() - Build packets to send on Change of State
** EN_CD_TxAPITask() - Change of State data transmission 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. **
** **
*****************************************************************************
*****************************************************************************
*/
#ifndef EN_XPORT_H
#define EN_XPORT_H
/****************************************************************************
**
** Constants
**
*****************************************************************************
*/
#define MAIN_RX_BUFFER_SIZE 8192 /* 8 K bytes */
#define MAIN_RX_SAFETY_SIZE 640 /* bytes */
#define SM_SCH_TX_BUFFER_SIZE 520 /* bytes */
#define BUF_PATTERN 0x55
#define SM_UNSCH_TX_BUFFER_TIMEOUT 5000 /* milliseconds */
#define SM_MAX_INT_COUNT_MOD 127 /* NUTS per macrocycle */
#ifndef A_CURRENT_B_FREE
#define INITIAL 0
#define FIRST_GET 1
#define A_CURRENT_B_FREE 2
#define A_CURRENT_B_PENDING 3
#define A_FREE_B_CURRENT 4
#define A_PENDING_B_CURRENT 5
#endif
/****************************************************************************
**
** Typedefs
**
*****************************************************************************
*/
/*---------------------------------------------------------------------------
**
** en_CycleType
**
** Main receive buffer receiving / parsing cycle
**
**---------------------------------------------------------------------------
*/
typedef enum
{
CYCLE_A,
CYCLE_B
} en_CycleType;
/*---------------------------------------------------------------------------
**
** en_BufferStateType
**
** Scheduled Transmit buffer state
**
**---------------------------------------------------------------------------
*/
typedef enum
{
BUFFER_HELD,
BUFFER_LOCKED,
BUFFER_LOCK_PENDING,
BUFFER_AVAILABLE
} en_BufferStateType;
/*---------------------------------------------------------------------------
**
** en_MainRxBufferType
**
** Main Receive buffer
**
**---------------------------------------------------------------------------
*/
typedef struct
{
UINT8 abData[MAIN_RX_BUFFER_SIZE]; /* MainRx buffer data array */
UINT32 lBufferStartAddr; /* 20 bit physical address */
UINT32 lSafetyZoneAddr;
UINT32 lRxAddr;
UINT8 *pParse;
UINT16 aiParseSize[2];
en_CycleType eParseCycle;
en_CycleType eRxCycle;
} en_MainRxBufferType;
/*---------------------------------------------------------------------------
**
** en_ScheduledTxBufferType
**
** Scheduled Transmission buffer
**
**---------------------------------------------------------------------------
*/
typedef struct
{
UINT8 abData[SM_SCH_TX_BUFFER_SIZE];/* SchTx buffer data array */
UINT8 *pData; /* Pointer to packet data in buffer */
UINT32 lBufferStartAddr; /* 20 bit physical address */
UINT16 iDataSize; /* Size in bytes */
UINT8 bTargetNut; /* Packet intended for this NUT */
UINT8 bPad; /* Pad structure to even word */
en_BufferStateType eState;
} en_ScheduledTxBufferType;
/****************************************************************************
**
** Globals
**
*****************************************************************************
*/
/* Counter that is updated every MSEC for use by the task handling COF data. */
extern UINT32 MsecTime;
/****************************************************************************
**
** Public Services
**
*****************************************************************************
*/
/*---------------------------------------------------------------------------
**
** EN_CD_TxAPITask()
**
** This is the task that builds and sends Change of State data transmissions.
**
**---------------------------------------------------------------------------
**
** Inputs:
** None
**
** Outputs:
** None
**
** Usage:
** EN_CD_TxAPITask();
**
**---------------------------------------------------------------------------
*/
EXTFUNC TASKRETURN EN_CD_TxAPITask( TASKPARAM );
/****************************************************************************
**
** Private Services
**
*****************************************************************************
*/
/*---------------------------------------------------------------------------
**
** en_cd_FreeTransportBuffers()
**
** Free previously allocated buffers for a communications transport.
**
**---------------------------------------------------------------------------
**
** Inputs:
** psTranRecord - Pointer to transport record
**
** Outputs:
** Return - Success / failure code
**
** Usage:
** iCode = en_cd_FreeTransportBuffers( psTranRecord );
**
**---------------------------------------------------------------------------
*/
EXTFUNC StatusType en_cd_FreeTransportBuffers( cd_TransportRecordType *psTranRecord );
/*---------------------------------------------------------------------------
**
** en_cd_ProcessAPITxList()
**
** Walk the Change of State transmit list for the next API xmit.
**
**---------------------------------------------------------------------------
**
** Inputs:
** None
**
** Outputs:
** None
**
** Usage:
** en_cd_ProcessAPITxList()
**
**---------------------------------------------------------------------------
*/
EXTFUNC void en_cd_ProcessAPITxList( cd_TransportRecordType *pTransport );
#endif /* inclusion lock */
/****************************************************************************
**
** End of EN_XPORT.H
**
*****************************************************************************
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -