ProSoft Technology MVI69-ADM User Manual

Page 284

Advertising
background image

CIP Messaging Library Functions

MVI-ADM ♦ 'C' Programmable

Developer's Guide

'C' Programmable Application Development Module

Page 284 of 342

ProSoft Technology, Inc.

February 20, 2013

rxdata_proc

Syntax

int rxdata_proc( MVIHANDLE objHandle, MVICIPRECVSTRUC *sRecv);

Parameters

objHandle

handle of registered object

sRecv

pointer to structure of type MVICIPRECVSTRUC

Description
rxdata_proc is an optional callback function which may be passed to the CIP API
in the MVIcip_RegisterAssemblyObj call. If the rxdata_proc callback has been
registered, the CIP API calls it when Class 1 scheduled data is received for the
registered object specified by objHandle.

sRecv is a pointer to a structure of type MVICIPRECVSTRUC. this structure is
shown below:

typedef struct tagMVICIPRECVSTRUC
{
DWORD reg_param; // value passed via MVIcip_Register AssemblyObj
MVIHANDLE connHandle; // unique value which identifies this connection
BYTE*' rxData; // pointer to buffer of received data
WORD dataSize; // size of received data in bytes
} MVICIPRECVSTRUC;

reg_param is the value that was passed to MVIcip_RegisterAssemblyObj. The
application may use this to store an index or pointer. It is not used by the CIP
API.

connHandle is the connection identifier passed to the connect_proc callback
when this connection was opened.

rxData is a pointer to a buffer containing the received data. dataSize is the size of
the received data in bytes.

Note: Use of the rxdata_proc callback is not recommended. Registering this callback increases
CPU overhead and reduces overall performance, especially for relatively small RPI values. It is

recommended that this callback only be used when the RPI is set to 10ms or greater.

This routine is called directly from an interrupt service routine in the backplane device driver. It

should not perform any operating system calls and should execute as quickly as possible (200us

maximum). Its only function should be to copy the data to a local buffer. The data must not be
processed in the callback routine, or backplane communications may be disrupted.

Return Value
The rxdata_proc routine must return MVI_SUCCESS.

Example

MVIHANDLE Handle;
int _loadds rxdata_proc( MVIHANDLE objHandle, MVICIPRECVSTRUC *sRecv )
{
// Copy the data to our local buffer.

Advertising