P40vrpc.c, B-81 – Rockwell Automation 1785-Vx0B, D17856.5.9 PLC-5 VME VMEbus Programmable Controllers User Manual User Manual

Page 239

Advertising
background image

Sample API Modules

Appendix B

B-81

/* The PCCC Restore Port Configuration reply packet structure. */
typedef struct
{
UBYTE lnhHi;
UBYTE lnhLo;
UBYTE reserved[4];
UBYTE cmd;
UBYTE sts;
UWORD tns;
PLC540V_PCCC_DATA_TYPE data;
} PLC540V_PCCC_RPC_RPY_TYPE;
#define kPLC540V_PCCC_RPC_RPY_SIZE (sizeof(PLC540V_PCCC_RPC_RPY_TYPE))
#pragma pack()

void plc540v_pccc_restore_port_config(
ULONG vmeCmdBlkAddr,
UWORD baseAddress,
VME_DATA_WIDTH_TYPE width,
VME_ADDRESS_MODIFIER_TYPE addrMod,
PLC540V_PCCC_RPC_RPY_TYPE *reply,
PLC540V_STATUS_TYPE *status);
#endif

#include <stdio.h>
#include <stdlib.h>
#include <mem.h>
#include ”epc_obm.h”
#include ”epc_err.h”
#include ”busmgr.h”
#include ”p40vrpc.h”

/***************************************************************************/
/************************* PRIVATE DEFINITIONS ****************************/
/***************************************************************************/
#define kPLC540V_PCCC_RPC_CMD 0x0F
#define kPLC540V_PCCC_RPC_FNC 0x90

/***************************************************************************/
/************************* PRIVATE TYPE DEFINITIONS ************************/
/***************************************************************************/

/***************************************************************************/
/*************************** PRIVATE FUNCTIONS *****************************/
/***************************************************************************/

/*****************************************************************************
* PURPOSE: This function sends the PCCC Restore Port Configuration command
* to the PLC-5/40V.
*
* INPUT: ULONG vmeCmdBlkAddr contains the VME address where the
* command block will be copied to so the PLC-5/40V can
* access its information.
*
* UWORD baseAddress contains the base address of the
* PLC-5/40V.
*
* VME_DATA_WIDTH_TYPE width contains the data width that
* should be used for the copy operations. It can be D16 or D08.
*
* VME_ADDRESS_MODIFIER_TYPE addrMod defines the address space
* in which the VME data is accessed. It can be A16 or A24.

P40VRPC.C

Advertising