beautypg.com

Common.h, Appendix b – Rockwell Automation 1785-Vx0B, D17856.5.9 PLC-5 VME VMEbus Programmable Controllers User Manual User Manual

Page 161

background image

Sample API Modules

Appendix B

B-3

#ifndef COMMON_H
#define COMMON_H 1

///////////////////////////////////////////////////////////////////////////////
// Definitions for the COMMON USE THROUGHOUT THE API //
///////////////////////////////////////////////////////////////////////////////

/* Macros to access the high and low word of an unsigned long. */
#define HIWORD(a) ((unsigned short) ((unsigned long) a >> 16))
#define LOWORD(a) ((unsigned short) ((unsigned long) a & 0x0000FFFF))

// Common type definitions...
typedef unsigned char UBYTE;
typedef signed char SBYTE;
typedef unsigned short UWORD;
typedef signed short SWORD;
typedef unsigned long ULONG;
typedef signed long SLONG;

typedef unsigned char BOOL;
#define kTRUE 1
#define kFALSE 0

#pragma pack(1)
/***************************************************************************/
/************************ INTEL VERSION OF DEFINITIONS *********************/
/***************************************************************************/
typedef enum
{
kPLC540V_SUCCESS=0,
kPLC540V_FAILURE=257,
kPLC540V_READ_REGISTER_FAILED=258,
kPLC540V_WRITE_REGISTER_FAILED=259,
kPLC540V_NOT_READY=260,
kPLC540V_NOT_PASSED=261,
kPLC540V_COPY_CMDBLK_TO_VME_FAILED=262,
kPLC540V_CMDCTRL_WRDY_TIMEOUT=263,
kPLC540V_RESPONSE_TIMEOUT=264,
kPLC540V_COPY_PCCC_PACKET_TO_VME_FAILED=265,
kPLC540V_GET_REPLYBLK_FROM_VME_FAILED=266,
kPLC540V_ELEMENT_COUNT_TOO_LARGE=267,
kPLC540V_ILLEGAL_PCCC_DATA_ID=268,
} PLC540V_LIBRARY_STATUS_TYPE;

typedef enum
{
kPLC540V_STATUS=0,
kEPC_STATUS=1,
kPCCC_STATUS=2,
} STATUS_CATEGORY_TYPE;

typedef union
{
UBYTE value;
struct
{

UBYTE localError:4;
UBYTE remoteError:4;

}statusFields;
} PCCC_STATUS_FIELDS_TYPE;

COMMON.H