📄 en.h
字号:
/****************************************************************************
*****************************************************************************
**
** File Name
** ---------
**
** EN.H
**
*****************************************************************************
*****************************************************************************
**
** Description
** -----------
**
** Communications Device Public Interfaces.
**
** Public interface definitions for the Communications Device, a "virtual"
** hardware device that is a device independent abstraction of any
** general communications device.
**
** The device independent CD interface shields the upper level software
** from any device specific details.
**
*****************************************************************************
*****************************************************************************
**
** Source Change Indices
** ---------------------
**
** Porting: <none>0----<major> Customization: <none>0----<major>
**
*****************************************************************************
*****************************************************************************
**
** Services List
** -------------
**
** EN_CD_Init() - One time initialization
** EN_CD_TxUnscheduledTask() - Unscheduled packet transmit processing task
** EN_CD_ConfigTask() - Device configuration request processing task
** EN_CD_GetTransportBuffer() - Attempt to get a Tx buffer
** EN_CD_PutTransportBuffer() - Indicate a gotten Tx buffer is ready to send
**
*****************************************************************************
*****************************************************************************
** **
** 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_H
#define EN_H
/*
** See if this code is to be included.
*/
#include "ab.h"
#ifdef CD_EN_OBJECTS
#include "gs.h" /* General Services */
#include "cb.h" /* ComBuf support */
#include "ci.h" /* General ControlNet International definitions */
#include "cm.h" /* Connection Manager publics */
#include "cd_util.h"
#include "en_xport.h"
#include "en_util.h"
/****************************************************************************
**
** Constants
**
*****************************************************************************
*/
/*
** Tag indexes 0 through b are reserved for fixed tags and
** the SMAC's gen tag
*/
/* Screener can only accept 127 tags. */
#define MIN_TAG_INDEX 0x0c
#define MAX_TAG_INDEX 0x8b
/* While loop limits */
/****************************************************************************
**
** Typedefs
**
*****************************************************************************
*/
typedef enum ENCDCommandMessageType
{
SENDINCORPMESSAGE, /* Data portion of message is incorporated in body */
SENDCOMMBUF, /* Data portion of message is attached as a commbuf */
SENDSID, /* Message has Session ID attached */
CLOSECONNECTION /* Connection is to be shut down, and resources released */
} ENCDCommandMessageType;
typedef struct
{
enum ENCDCommandMessageType Command;
UINT32 Sid; /* Session Id for encap connections */
CB_ComBufType *pcbDestHost; /* ptr to host/ip addr in ComBuf */
PKTBUF *PacketBuf; /* Pointer to buffer, or NULL */
} EnCdMessageType;
/*---------------------------------------------------------------------------
**
** en_InternalDataType
**
** TCPIP internal data structure.
**
**---------------------------------------------------------------------------
*/
typedef struct en_InternalDataType
{
/*
** CNet Object and TCPIP configuration
*/
/*
** Events used by the TCPIP driver
*/
GS_MsgQueueType xAPIUpdateTaskQid;
/*
** Buffers used by the SMAC ASIC
*/
en_MainRxBufferType sMainRxBuf;
en_ScheduledTxBufferType asSchTxBuf[2];
en_ScheduledTxBufferType *pNextSchTxBuf;
CB_ComBufType *pUnschTxComBuf;
/*
** Events used by the TCPIP driver
*/
/*
** Event used to indicate data available for parsing in MainRx Buffer
*/
GS_SemaphoreType xAPITxListUpdateDone;
GS_SemaphoreType xMainRxDataAvailSemaphore;
en_TagEntryType asGenTags[ MAX_TAG_INDEX + 1 ];
}
en_InternalDataType;
/****************************************************************************
**
** Globals
**
*****************************************************************************
*/
extern volatile CD_DataType CD_s[ CD_NPORTS + 1 ];
extern UINT32 MsecTime;
extern UINT32 iNextMsecTarget; /* Next Msec timer should fire the semaphore at */
/*---------------------------------------------------------------------------
**
** en_s
**
** Internal ASIC interface data structure.
** Contains all global data used to interface with TCP/IP layer.
**
**---------------------------------------------------------------------------
*/
extern volatile en_InternalDataType en_s;
/****************************************************************************
**
** Public Services
**
*****************************************************************************
*/
/*---------------------------------------------------------------------------
**
** EN_Init()
**
** Communication Device ASIC data/task creation/allocation/initialization.
**
**---------------------------------------------------------------------------
**
** Inputs:
** iOptions - Bit mask of initialization options
**
** Outputs:
** Return - Success/failure status
**
** Usage:
** eStatus = EN_Init( AB_COLD_START_RESOURCE );
**
**---------------------------------------------------------------------------
*/
EXTFUNC StatusType EN_Init( UINT16 iOptions );
/*---------------------------------------------------------------------------
**
** EN_CD_ConfigTask()
**
** Communications device configuration request processing task.
**
**---------------------------------------------------------------------------
**
** Inputs:
** None
**
** Outputs:
** None
**
** Usage:
** GS_NewTask( EN_CD_ConfigTask, ... );
**
**---------------------------------------------------------------------------
*/
EXTFUNC TASKRETURN EN_CD_ConfigTask( TASKPARAM );
/*---------------------------------------------------------------------------
**
** EN_CD_TxUnscheduledTask()
**
** Communications device unscheduled packet transmission processing task.
**
**---------------------------------------------------------------------------
**
** Inputs:
** None
**
** Outputs:
** None
**
** Usage:
** GS_NewTask( EN_CD_ConfigTask, ... );
**
**---------------------------------------------------------------------------
*/
EXTFUNC TASKRETURN EN_CD_TxUnscheduledTask( TASKPARAM );
/*---------------------------------------------------------------------------
**
** EN_CD_Init()
**
** Communication Device object data/task creation/allocation/initialization.
**
**---------------------------------------------------------------------------
**
** Inputs:
** iOptions - Bit mask of initialization options
**
** Outputs:
** Return - Success/failure status
**
** Usage:
** eStatus = EN_CD_Init( AB_COLD_START_RESOURCE );
**
**---------------------------------------------------------------------------
*/
EXTFUNC StatusType EN_CD_Init( UINT16 iOptions );
/*---------------------------------------------------------------------------
**
** EN_CD_GetTransportBuffer()
**
** Attempt to get an available transport buffer for transmission.
**
**---------------------------------------------------------------------------
**
** Inputs:
** iTransportId - Which transport
**
** Outputs:
** Return - Pointer to transport buffer
** NULL if none currently available
**
** Usage:
** pBuffer = EN_CD_GetTransportBuffer( iTransport );
**
**---------------------------------------------------------------------------
*/
EXTFUNC UINT8 *EN_CD_GetTransportBuffer( UINT16 iTransport );
/*---------------------------------------------------------------------------
**
** EN_CD_PutTransportBuffer()
**
** Put a previously gotten transport buffer for transmission.
**
**---------------------------------------------------------------------------
**
** Inputs:
** iTransportId - Which transport
**
** Outputs:
** None
**
** Usage:
** EN_CD_PutTransportBuffer( iTransport );
**
**---------------------------------------------------------------------------
*/
EXTFUNC void EN_CD_PutTransportBuffer( UINT16 iTransport );
/*---------------------------------------------------------------------------
**
** NETCONFIG_Init()
**
** Ethernet startup task. Once the OS is started, and initialized this
** task is spawned. From here the rest of the ethernet layer is started.
**
**---------------------------------------------------------------------------
**
** Inputs:
** None
**
** Outputs:
** None
**
** Usage:
** NETCONFIG_Init( void );
**
**---------------------------------------------------------------------------
*/
EXTFUNC TASKRETURN NETCONFIG_Init( TASKPARAM );
#endif /* #ifdef CD_EN_OBJECTS */
#endif /* inclusion lock */
/****************************************************************************
**
** End of EN.H
**
*****************************************************************************
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -