📄 db.h
字号:
/***************************************************************************
*****************************************************************************
**
** File Name
** ---------
**
** DB.H
**
*****************************************************************************
*****************************************************************************
**
** Description
** -----------
**
** Debug Object public interfaces. The Debug Object is a special object
** that enables developers to interrogate numerous internals. Interrogation
** can either be local (from within the same device), or from a remote
** device via a serial port, backplane, or over the network.
**
*****************************************************************************
*****************************************************************************
**
** Source Change Indices
** ---------------------
**
** Porting: <none>0----<major> Customization: <none>----4<major>
**
** * Allows for whatever additional debug object services the
** application developer requires.
**
*****************************************************************************
*****************************************************************************
**
** Services List
** -------------
**
** DB_Init() - Allocate/Create/Initialize the object
**
*****************************************************************************
*****************************************************************************
** **
** 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. **
** **
*****************************************************************************
*****************************************************************************
*/
/****************************************************************************
*****************************************************************************
**
** Change Log
** ----------
**
**
*****************************************************************************
*****************************************************************************
*/
#ifndef DB_H
#define DB_H
/****************************************************************************
*****************************************************************************
**
** Network object interface - Constants
**
*****************************************************************************
*****************************************************************************
*/
/*---------------------------------------------------------------------------
**
** Class and revision numbers.
**
**---------------------------------------------------------------------------
*/
#define DB_CLASS_NUMBER 0x8A
#define DB_REVISION 2
/*---------------------------------------------------------------------------
**
** Class and instance attribute numbers.
**
**---------------------------------------------------------------------------
*/
/* None defined... */
/*---------------------------------------------------------------------------
**
** Debug Object specific service codes.
**
**---------------------------------------------------------------------------
*/
#define DB_SC_READ 0x4b
#define DB_SC_WRITE 0x4c /* Unused */
#define DB_SC_EXECUTE_COMMAND 0x4d
#define DB_SC_ECHO_PACKET 0x4e
/*---------------------------------------------------------------------------
**
** Debug Object specific sub-commands.
**
**---------------------------------------------------------------------------
*/
#define DB_CMD_GET_REVISION 1 /* Basic version information */
#define DB_CMD_GET_VERSIONS 2
#define DB_CMD_GET_NODE_TIME 10 /* OS details */
#define DB_CMD_GET_HEAP_STATUS 11
#define DB_CMD_GET_STATIC_HEAP_STATUS 12
#define DB_CMD_GET_TASK_STATUS 13
#define DB_CMD_GET_EVENT_LOG_COUNTS 14 /* Interesting events logged */
#define DB_CMD_GET_EVENT_LOG_ENTRY 15
#define DB_CMD_GET_HEAP_BUCKETS 16 /* For heap tuning */
#define DB_CMD_GET_CNET_NETWORK_STATUS 20 /* ControlNet specifics */
#define DB_CMD_GET_CNET_TRANSPORT_STATUS 21
#define DB_CMD_GET_CNET_CON_UCMM_COUNTS 22
#define DB_CMD_GET_NETLINX_DP_SET1 30 /* NetLinx dualport specific */
#define DB_CMD_CLR_NETLINX_DP_SET1 31
/*---------------------------------------------------------------------------
**
** The above command specs fit within the bounds of the spec for the
** debug object, which allows device specific commands to be added
** to the object.
** The bottom line of all this means that data is retreived via
** execute command request packets. In general, a packet looks like:
**
** The following is present only in direct debug packets:
** 0xXXYY Sequence number
**
** The following are present only in UCMM or class 3 packets
** and are stripped off by the message router prior to arrival
** at the debug object's message queue:
** 0x208A Class segment - Debug object
** 0x2401 Instance segment - Instance 1
**
** The following are present in all debug object get attr request packets:
** 0x4d Service code (execute command)
** 0x00 IOI size (in words)
** 0xXX Device specific command
** 0xYY Command specific parameter(s) or 0 if unused
**
**---------------------------------------------------------------------------
*/
/****************************************************************************
*****************************************************************************
**
** Network object interface - Packets
**
*****************************************************************************
*****************************************************************************
*/
/*---------------------------------------------------------------------------
**
** DB_LeDirectHeaderType
**
** Direct debug protocol header.
** This gets stuffed in ahead of the standard request header
** (one of the following structures)
** for packets sent directly to the debug object via the debug fixed tags.
**
**---------------------------------------------------------------------------
*/
typedef packet_struct DB_LeDirectHeaderType
{
LeUINT16 iLeSequence; /* Packet sequence number */
}
GNU_PACKED DB_LeDirectHeaderType;
/*---------------------------------------------------------------------------
**
** DB_GenericRequestHeaderType
** DB_EventLogRequestHeaderType
** DB_ReadRequestHeaderType
**
** Request headers for the various request packets sent to the debug object.
** The IOI size is always 0 by the time the packet reaches the
** debug object. The remaining header is command specific data/parameters.
**
** Response header is standard CNet response header (service code, Ioi size,
** general status, specific status size, optional specific status),
** followed by the response data (defined in other structures in this file.)
**
**---------------------------------------------------------------------------
*/
typedef packet_struct DB_GenericRequestHeaderType
{
UINT8 bService; /* Always DB_SC_EXECUTE_COMMAND */
UINT8 bIoiSize; /* Always 0 */
UINT8 bCommand;
UINT8 bParameters;
}
GNU_PACKED DB_GenericRequestHeaderType;
typedef packet_struct DB_EventLogRequestHeaderType
{
UINT8 bService; /* Always DB_SC_EXECUTE_COMMAND */
UINT8 bIoiSize; /* Always 0 */
UINT8 bCommand;
UINT8 bParameters;
LeUINT32 lLeEventNumber;
}
GNU_PACKED DB_EventLogRequestHeaderType;
typedef packet_struct DB_ReadRequestHeaderType
{
UINT8 bService; /* Always DB_SC_READ */
UINT8 bIoiSize; /* Always 0 */
LeUINT32 lLeAddress;
LeUINT32 lLeSize;
}
GNU_PACKED DB_ReadRequestHeaderType;
/*---------------------------------------------------------------------------
**
** DB_upsHeaderType
**
** Union of pointers to all debug object request packet headers.
** Helps to eliminate those unsightly type casts.
**
**---------------------------------------------------------------------------
*/
typedef union DB_upsHeaderType
{
DB_GenericRequestHeaderType *Generic;
DB_EventLogRequestHeaderType *EventLog;
DB_ReadRequestHeaderType *Read;
}
DB_upsHeaderType;
/*---------------------------------------------------------------------------
**
** The following structures are responses to the various information
** gathering requests that can be sent to the debug object.
**
**---------------------------------------------------------------------------
*/
/*---------------------------------------------------------------------------
**
** DB_ConnectionUcmmCountsType
**
** Command response structure - Connection and UCMM counts.
**
** Response contains the number of class 1 connections configured
** (in the Connection Configuration object (CC object) as well as the
** number of active class 3 connections and interesting UCMM counts.
**
** Command request: DB_GenericRequestHeaderType
** bCommand = DB_CMD_GET_CNET_CON_UCMM_COUNTS
** bParameter = Unused
**
**---------------------------------------------------------------------------
*/
typedef packet_struct DB_CnetConnectionUcmmCountsType
{
UINT8 bClass1Config; /* Class 1 */
UINT8 bClass1Active;
UINT8 bClass3Client; /* Class 3 */
UINT8 bClass3Server;
UINT8 bUcmmClientMax; /* UCMM client max transactions allowed */
UINT8 bUcmmClientHiWater; /* UCMM client worst backlog */
UINT8 bUcmmClientCurrent; /* UCMM client current backlog */
UINT8 bUcmmServerMax; /* UCMM server max transactions allowed */
UINT8 bUcmmServerHiWater; /* UCMM server worst backlog */
UINT8 bUcmmServerCurrent; /* UCMM server current backlog */
}
GNU_PACKED DB_CnetConnectionUcmmCountsType;
/*---------------------------------------------------------------------------
**
** DB_LeCnetNetworkStatusType
**
** Command response structure - ControlNet network status data.
**
** Response is a copy of the CNet communications ASIC LED's the current
** network attachment state, identity object status and
** internal device status.
**
** Command request: DB_GenericRequestHeaderType
** bCommand = DB_CMD_GET_CNET_NETWORK_STATUS
** bParameter = Unused
**
**---------------------------------------------------------------------------
*/
typedef packet_struct DB_LeCnetNetworkStatusType
{
UINT8 bLeds; /* Network LED state as defined in CD.h */
UINT8 bNetStatus; /* Network status as defined in CD.h */
LeUINT16 iLeIdObjStatus; /* ID object status as defined in ID.h */
LeUINT16 iLeDeviceStatus; /* Internal device status as defined in ID.h */
UINT8 bKeeperMacId; /* Mac id of the network keeper */
UINT8 bTuiFlags; /* Latest TUI packet flags (keeper state) */
}
GNU_PACKED DB_LeCnetNetworkStatusType;
/*---------------------------------------------------------------------------
**
** DB_LeCnetTransportStatusType
**
** Command response structure - Transport status.
**
** Status is returned as several bit arrays, one bit per transport.
** Class 1 producer transports have an additional 2 bit arrays to indicate
** current ownership of the dedicated double transmit buffers.
**
** Command request: DB_GenericRequestHeaderType
** bCommand = DB_CMD_GET_CNET_TRANSPORT_STATUS
** bParameter = Unused
**
**---------------------------------------------------------------------------
*/
typedef packet_struct DB_LeCnetTransportStatusType
{
LeUINT16 iLeClass1ConTransports; /* Max number of transports available */
LeUINT16 iLeClass1ProTransports;
LeUINT16 iLeClass3Transports;
UINT8 abClass1Consumer[ 32 ]; /* Bit mask of active transports */
UINT8 abClass1Producer[ 32 ]; /* 0 = Inactive transport */
UINT8 abClass3[ 32 ]; /* 1 = Active transport */
UINT8 abClass1ProducerBufA[ 32 ];/* Bit mask of transport buf ownership */
UINT8 abClass1ProducerBufB[ 32 ];/* 0 = Host, 1 = ASIC */
}
GNU_PACKED DB_LeCnetTransportStatusType;
/*---------------------------------------------------------------------------
**
** DB_LeEventLogCountType
**
** Command response structure - Log entry counts.
**
** Response contains the number of events of each type that have been logged
** since the device was power cycled or reset.
**
** Command request: DB_GenericRequestHeaderType
** bCommand = DB_CMD_GET_EVENT_LOG_COUNTS
** bParameter = Unused
**
**---------------------------------------------------------------------------
*/
typedef packet_struct DB_LeEventLogCountType
{
LeUINT32 lLeTrivial; /* Held in non-retentive log */
LeUINT32 lLeWarning; /* Held in non-retentive log */
LeUINT32 lLeImportant; /* Held in retentive log */
LeUINT32 lLeSevere; /* Held in retentive log */
LeUINT32 lLeFatal; /* Fatal in log */
}
GNU_PACKED DB_LeLogCountType;
/*---------------------------------------------------------------------------
**
** DB_PARAM_XXX
** DB_LeEventLogEntryType
**
** Command response structure - Event log entry.
**
** Response contains the details of one event in one of the event logs.
** (Non-retentive, retentive, or fatal.) The fatal event will be the
** event prior to a reset after the fatal event and may not be available
** from all devices. For the non-retentive and retentive logs the first
** event found with an event number greater or equal to that given in the
** request will be returned. (Request event 0 to return the oldest event
** in the selected event log.) If the end of the event list is reached,
** a response with event number == 0 will be returned with no additional
** event data in the packet.
**
** Command request: DB_EventLogRequestHeaderType
** bCommand = DB_CMD_GET_EVENT_LOG_ENTRY
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -