Reflective Memory

Download as pdf or txt
Download as pdf or txt
You are on page 1of 149

GE Intelligent Platforms

Operators Reference
Common RFM2g* Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g* Drivers

Publication No: 523-000447-000 Rev. F

Document History Operators Reference Manual Document Number: 523-000447-000 Rev. F March 25, 2010 Waste Electrical and Electronic Equipment (WEEE) Returns
GE is registered with an approved Producer Compliance Scheme (PCS) and, subject to suitable contractual arrangements being in place, will ensure WEEE is processed in accordance with the requirements of the WEEE Directive. GE will evaluate requests to take back products purchased by our customers before August 13, 2005 on a case by case basis. A WEEE management fee may apply.

Table of Contents
List of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1 Application Program Interface (API) Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11 1.2 Using the Application Program Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12 1.2.1 Opening the RFM2g Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12 1.2.2 Routine Code for Use with API Function Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12 1.3 RFM2g Error Codes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 1.4 RFM2g API Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16 1.5 RFM2g Opening and Closing API Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18 1.5.1 RFM2gOpen() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18 1.5.2 RFM2gClose() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20 1.6 RFM2g Configuration API Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21 1.6.1 RFM2gGetConfig() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22 1.6.2 RFM2gUserMemory() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23 1.6.3 RFM2gUnMapUserMemory() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 1.6.4 RFM2gUserMemoryBytes() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26 1.6.5 RFM2gUnMapUserMemoryBytes() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 1.6.6 RFM2gNodeID() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30 1.6.7 RFM2gBoardID() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 1.6.8 RFM2gSize() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32 1.6.9 RFM2gFirst() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 1.6.10 RFM2gDeviceName() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34 1.6.11 RFM2gDllVersion() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 1.6.12 RFM2gDriverVersion() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36 1.6.13 RFM2gGetDMAThreshold() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37 1.6.14 RFM2gSetDMAThreshold() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38 1.6.15 RFM2gGetDMAByteSwap() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40 1.6.16 RFM2gSetDMAByteSwap() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .41 1.6.17 RFM2gGetPIOByteSwap() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42 1.6.18 RFM2gSetPIOByteSwap() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .43 1.7 RFM2g Data Transfer API Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44 1.7.1 Data Transfer Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44 Big Endian and Little Endian Data Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44 Using Direct Memory Access (DMA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .45 1.7.2 RFM2gRead() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .46 1.7.3 RFM2gWrite() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48 1.7.4 RFM2gPeek8(), RFM2gPeek16(), RFM2gPeek32() and RFM2gPeek64() . . . . . . . . . . . . . . . . . . . . . . . . . .50 1.7.5 RFM2gPoke8(), RFM2gPoke16(), RFM2gPoke32() and RFM2gPoke64() . . . . . . . . . . . . . . . . . . . . . . . . .52 1.8 RFM2g Interrupt Event API Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54 1.8.1 RFM2gEnableEvent() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55
Table of Contents 3

1.8.2 RFM2gDisableEvent() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 1.8.3 RFM2gSendEvent() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .59 1.8.4 RFM2gWaitForEvent() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .61 1.8.5 RFM2gEnableEventCallback() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .64 1.8.6 RFM2gDisableEventCallback() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .66 1.8.7 RFM2gClearEvent() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .68 1.8.8 RFM2gCancelWaitForEvent() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70 1.8.9 RFM2gClearEventCount() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72 1.8.10 RFM2gGetEventCount() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .74 1.9 RFM2g Utility API Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .76 1.9.1 RFM2gErrorMsg() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .77 1.9.2 RFM2gGetLed() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .78 1.9.3 RFM2gSetLed() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79 1.9.4 RFM2gCheckRingCont() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80 1.9.5 RFM2gGetDebugFlags() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81 1.9.6 RFM2g SetDebugFlags() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83 1.9.7 RFM2gGetDarkOnDark() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .85 1.9.8 RFM2gSetDarkOnDark() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .86 1.9.9 RFM2gClearOwnData() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .87 1.9.10 RFM2gGetTransmit() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .88 1.9.11 RFM2gSetTransmit() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89 1.9.12 RFM2gGetLoopback() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .90 1.9.13 RFM2gSetLoopback() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .91 1.9.14 RFM2gGetParityEnable() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .92 1.9.15 RFM2gSetParityEnable() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .93 1.9.16 RFM2gGetMemoryOffset() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .94 1.9.17 RFM2gSetMemoryOffset() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95 1.9.18 RFM2gGetSlidingWindow() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96 1.9.19 RFM2gSetSlidingWindow() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .97

2 rfm2g_util.c Utility Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98


2.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98 2.2 RFM2g Command Line Interpreter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98 2.2.1 Using the Command Line Interpreter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98 Notes On Entering Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .99 Notes On Device Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .99 2.2.2 Command Line Interpreter Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 2.3 Utility Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 2.3.1 boardid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 2.3.2 cancelwait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 2.3.3 checkring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 2.3.4 clearevent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 2.3.5 cleareventcount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 2.3.6 clearowndata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 2.3.7 config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
4 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.8 devname . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.9 disableevent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.10 disablecallback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.11 dllversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.12 driverversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.13 drvspecific . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.14 dump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.15 enableevent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.16 enablecallback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.17 errormsg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.18 exit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.19 first . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.20 getdarkondark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.21 getdebug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.22 getdmabyteswap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.23 geteventcount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.24 getled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.25 getmemoryoffset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.26 getloopback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.27 getparityenable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.28 getpiobyteswap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.29 getslidingwindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.30 getthreshold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.31 gettransmit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.32 help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.33 mapuser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.34 mapuserbytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.35 memop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.36 nodeid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.37 peek8, peek16, peek32 and peek64 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.38 performancetest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.39 poke8, poke16, poke32 and poke64 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.40 quit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.41 read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.42 repeat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.43 return . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.44 send . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.45 setdarkondark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.46 setdebug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.47 setdmabyteswap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.48 setled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.49 setloopback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.50 setmemoryoffset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.51 setparityenable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

106 107 108 108 109 109 110 111 112 113 113 113 114 114 114 115 115 116 116 116 116 117 117 117 118 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 135 136 136 137

Table of Contents 5

2.3.52 setpiobyteswap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.53 setslidingwindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.54 setthreshold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.55 settransmit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.56 size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.57 unmapuser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.58 unmapuserbytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.59 wait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.60 write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4 Troubleshooting the rfm2g_util.c Command Line Interpreter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4.1 Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1 3.2 3.3 3.4 3.5 rfm2g_sender.c. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . rfm2g_receiver.c. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . rfm2g_map.c. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . rfm2g_sender.c and rfm2g_receiver.c Example Workflow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . rfm2g_map.c Example Workflow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

137 138 138 139 139 140 140 141 142 143 143 144 144 145 145 147

3 RFM2g Sample Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .144

Maintenance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .148

6 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

List of Tables
Table 1-1 Common RFM2g Error Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15 Table 1-2 RFM2g API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16 Table 1-3 RFM2g Opening and Closing API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18 Table 1-4 RFM2g Configuration API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21 Table 1-5 RFM2g Data Transfer API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44 Table 1-6 RFM2g Interrupt Event API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54 Table 1-7 RFM2gEnableEvent() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55 Table 1-8 RFM2gDisableEvent() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 Table 1-9 RFM2gWaitForEvent() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .61 Table 1-10 RFM2gEnableEventCallback() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .64 Table 1-11 RFM2gDisableEventCallback() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .66 Table 1-12 RFM2g Utility API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .76 Table 2-1 RFM2g Driver Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

List of Tables 7

Overview
Thismanualprovidesinformationonthecommoncomponentsincludedinthe RFM2g*drivers,whichenablesyoutoaccessthefeaturesofavarietyofPCIand PMCRFM2ghardware.

Features
TheRFM2gdriverprovidesallofthenecessaryfiles,scriptsandprogramsforyou toinstall,testanduseanyofthesupportedReflectiveMemory(RFM)Interface cardsinyoursystem. TheRFM2gdriverprovidesthefollowingcommonfeatures: ApplicationProgramInterface(API)LibraryApplicationprogramsmayuse theservicesprovidedbytheRFM2gApplicationProgramInterface(API) librarytoaccessthefeaturesoftheRFM2gdevicesinaportableway.Using theAPIlibrarymakesiteasytouseadifferentmodelofRFMinterface,orto rehostyourapplicationprogramonadifferentsupportedhostplatform. SeeChapter1ApplicationProgramInterface(API)Library,page11. CommandLineInterpreterTherfm2g_util.cprogramisacommandline interpreterthatenablesausertoexercisevariousRFM2gAPIcommandsby enteringcommandsatthekeyboard.Touserfm2g_util.c,followthedirec tionsinyourdriverspecificmanual.Youcanenterhelptodisplayalistof commands.SeeChapter2rfm2g_util.cUtilityProgram,page98formore information. ExampleProgramsTheRFM2gdrivercontainstherfm2g_sender.c, rfm2g_receiver.candrfm2g_map.csampleprograms,whichprovideexam plesonhowtousethedriverandAPIwithyourapplication.SeeChapter3 RFM2gSampleApplications,page144.

8 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

References
NOTE
For a list of the files distributed with your RFM2g driver, see your driver-specific manual.

ThefollowingisalistofreferencedocumentationrelatedtoRFM2gdrivers: VMIPCI5565*UltrahighSpeedFiberOpticReflectiveMemorywithInterrupts ProductManual,GEDocumentNumber500855565000 VMIPMC5565*UltrahighSpeedFiberOpticReflectiveMemorywithInterrupts ProductManual,GEDocumentNumber500755565000 VMIPCI5565PIORC*UltrahighSpeedFiberOpticReflectiveMemorywith InterruptsProductManual,GEDocumentNumber5009367855565000 VMIPMC5565PIORC*UltrahighSpeedFiberOpticReflectiveMemorywith InterruptsProductManual,GEDocumentNumber5009367755565000 VMIACC5595*,2Gb/sReflectiveMemoryHubAssembly,GEDocumentNum ber522805595000 VMISFTRFM2g*Specification,NetworkandSharedMemoryDriver, GEDocumentNumber820000447000 PleasecallyourGEsalesrepresentativeformoreinformation.

Overview 9

Organization
Thismanualiscomposedofthefollowingchapters: OverviewprovidesageneraldescriptionoftheRFM2g. Chapter1:ApplicationProgramInterface(API)LibrarydescribestheAPIthat comeswiththeRFM2gdevicedriverthatprovidestheapplicationdeveloperwith acommonAPIfordevelopingportableRFM2gapplicationsthatareplatform independent. Chapter2:rfm2g_util.cUtilityProgramdescribesthecommandlineinterpreter (rfm2g_util.c)thatenablestheusertoexercisevariousRFM2gcommandsby enteringcommandsatthestandardinput(usuallytheconsolekeyboard). Chapter3:RFM2gSampleApplicationscontainsinformationonthethreesample applicationprogramsdeliveredwiththeRFM2gdriverintherfm2g/samples folder. MaintenanceprovidesGEscontactinformationrelativetothecareand maintenanceoftheunit.

10 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1 Application Program Interface (API) Library


1.1 Introduction
TheAPIthatcomeswiththeRFM2gdevicedriverprovidestheapplication developerwithacommonAPIfordevelopingportableRFM2gapplicationsthat areplatformindependent.TheAPIislocatedinthefilerfm2g_api.h. Therfm2g_api.hfiledefinesthecommonapplicationprograminterfaceprovided bythedriver.UsethisheaderfileinapplicationprogramstoaccesstheRFM2g device.ThisfileissuitableforinclusionineitherastandardCorC++compilation. TheAPIconsistsofthisheaderfileandlibrariesforthefollowingdevelopment language: ANSICLanguageBindingsAClanguageAPIprovidesfunctionsand macrodefinitionsthatassisttheapplicationsprogrammerinusingtheraw featuresofthedevicedriveranditsassociatedhardware. ApplicationsthattakeadvantageoftheAPIwillbeportabletootherplatforms becausetheidiosyncrasiesofthehostsystemareabstractedbytheAPI. ThedrivercontainsAPIfunctionsthatenableyouto: Openandclosethedriver Configuretheboard Transferdata Control/handleinterruptevents BeforeanapplicationprogramcanaccessanRFM2gdevice,thatdevicemustbe opened.Whenthedeviceisopenedsuccessfully,ahandleisreturnedtothe applicationwhichisusedinallsubsequentoperationsinvolvingthedevice driver.ThehandlesfirstcallmustbeusedtoinitializetheAPI. Inadditiontotheservicesprovidedbythedriver,anapplicationprogramcan directlyaccessthesharedmemorycontainedontheRFM2ginterface.Whenthe applicationopenstheRFM2gdevice,thememoryareaoftheRFM2gdevicecan bemappedintothevirtualmemoryspaceoftheapplicationprogram.The programcanthentreattheRFM2gasifitwereanordinarymemory.Indirect pointerreferencestotheRFM2gwillworknormally.

NOTE

The operating system does not perform memory bounds checking if the indirect method is used. Data corruption of system memory is likely to occur if a user application increments a pointer beyond the end of valid Reflective Memory.

Application Program Interface (API) Library 11

1.2 Using the Application Program Interface


TheRFM2gdriversrfm2g_util.c programisacommandlineapplicationthat enablesyoutoexercisealmostallofthedriversAPIfunctions.Onceyouhave builtandarerunningtherfm2g_util.cprogram,enterhelpatthepromptto obtainalistofcommandsthatcanberunusingrfm2g_util.c.Toobtaindetailed helpforaspecificcommand,enterhelp[command],where[command]isanyofthe commandslistedbythehelpcommand. Thecodeinthe rfm2g_util.cfilecanbeusedasanexampleofhowtouseeach APIcommandbyexaminingthefunctiondo[command](),where[command]is anyofthecommandslistedbythehelpcommand.

1.2.1 Opening the RFM2g Driver


BeforeusinganyoftheRFM2gcommands,youmustcalltheRFM2gOpen() functiontoopentheRFM2gdeviceusingthecodeshowninRoutineCodefor UsewithAPIFunctionExamplesbelow.

1.2.2 Routine Code for Use with API Function Examples


Thefollowingroutine,rfm2gTestApiCommand(),canbeusedwiththeexample codelistedattheendofeachfunction. Thecodedoesthefollowing: OpenstheRFM2gdriver ExecutesthecodefortheinsertedAPIfunction Printsanerrormessagewhenanerroroccurs ClosestheRFM2gdriver ReturnsanRFM2G_STATUScode Tousethisroutine,replacetheline: /* Place API command example here */

12 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

withthecodeprovidedintheAPIfunctionexample.
#define DEVICE /* Place OS specific device name in quotes before this comment */ RFM2G_STATUS rfm2gTestApiCommand(void) { RFM2GHANDLE Handle; RFM2G_STATUS result; /* Open the Reflective Memory device */ result = RFM2gOpen( DEVICE, &Handle ); if( result != RFM2G_SUCCESS ) { printf( "ERROR: RFM2gOpen() failed.\n" ); printf( "ERROR MSG: %s\n", RFM2gErrorMsg(result)); return(-1); } { /* Place API command example here */ } if( result != RFM2G_SUCCESS ) { printf( "ERROR: API command returned error.\n" ); printf( "ERROR MSG: %s\n", RFM2gErrorMsg(result)); } /* Close the Reflective Memory device */ RFM2gClose( &Handle ); return(result); }

NOTE

Three sample application programs (rfm2g_sender.c, rfm2g_receiver.c and rfm2g_map.c) are delivered with the RFM2g driver that show how to use the driver and API with your application. See Chapter 3 RFM2g Sample Applications, page 144 for more information.

Application Program Interface (API) Library 13

1.3 RFM2g Error Codes


ThefollowingisalistofthecommonerrorcodesthatcanbeoutputbytheRFM2g devicedriver.Driversmaydefineadditionalerrorcodesthataredriverspecific. Refertoyourdriverspecificmanualformoreinformation. YoumaycalltheRFM2gAPIsRFM2gErrorMsg()functionwiththeerrorcodeto retrieveadescriptionoftheerrorcode.

NOTE

Error code values are driver-specific. Use the error code name instead of the value in user applications.

14 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

Table 1-1 Common RFM2g Error Code


Error Code RFM2G_SUCCESS RFM2G_NOT_IMPLEMENTED RFM2G_DRIVER_ERROR RFM2G_TIMED_OUT RFM2G_LOW_MEMORY RFM2G_MEM_NOT_MAPPED RFM2G_OS_ERROR RFM2G_EVENT_IN_USE RFM2G_NOT_SUPPORTED RFM2G_NOT_OPEN RFM2G_NO_RFM2G_BOARD RFM2G_BAD_PARAMETER_1 RFM2G_BAD_PARAMETER_2 RFM2G_BAD_PARAMETER_3 RFM2G_BAD_PARAMETER_4 RFM2G_BAD_PARAMETER_5 RFM2G_BAD_PARAMETER_6 RFM2G_BAD_PARAMETER_7 RFM2G_BAD_PARAMETER_8 RFM2G_BAD_PARAMETER_9 RFM2G_OUT_OF_RANGE RFM2G_MAP_NOT_ALLOWED RFM2G_LINK_TEST_FAIL RFM2G_MEM_READ_ONLY RFM2G_UNALIGNED_OFFSET RFM2G_UNALIGNED_ADDRESS RFM2G_LSEEK_ERROR RFM2G_READ_ERROR RFM2G_WRITE_ERROR RFM2G_HANDLE_NOT_NULL RFM2G_MODULE_NOT_LOADED RFM2G_NOT_ENABLED RFM2G_ALREADY_ENABLED RFM2G_EVENT_NOT_IN_USE RFM2G_BAD_RFM2G_BOARD_ID RFM2G_NULL_DESCRIPTOR RFM2G_WAIT_EVENT_CANCELED RFM2G_DMA_FAILED RFM2G_NOT_INITIALIZED RFM2G_UNALIGNED_LENGTH RFM2G_SIGNALED RFM2G_NODE_ID_SELF RFM2G_MAX_ERROR_CODE Description No error Function is not currently implemented An error occurred during a call to the driver A wait timed out A memory allocation failed Memory is not mapped for this device Function failed for other OS defined error The Event is already being waited on Capability not supported by this particular Driver/Board Device not open Driver did not find RFM2g device Parameter 1 to the function is either NULL or invalid Parameter 2 to the function is either NULL or invalid Parameter 3 to the function is either NULL or invalid Parameter 4 to the function is either NULL or invalid Parameter 5 to the function is either NULL or invalid Parameter 6 to the function is either NULL or invalid Parameter 7 to the function is either NULL or invalid Parameter 8 to the function is either NULL or invalid Parameter 9 to the function is either NULL or invalid Board offset/range extends outside board memory Desired board offset is not legal for board memory size Ring continuity test failed Function attempted to change memory outside of User Memory area An offset is not properly aligned for the corresponding data width An address is not properly aligned for the corresponding data width The lseek(2) operation preceding a read or write failed The read(2) operation was not successful The write(2) operation was not successful Cannot initialize a non-NULL handle pointer The driver module has not been loaded into the kernel An attempt was made to use an interrupt that has not been enabled An attempt was made to enable an interrupt that was already enabled No process is waiting on the interrupt Invalid RFM2g board ID RFM2GHANDLE is null Wait for event canceled DMA operation failed Cannot initialize a handle pointer An offset is not properly aligned for the corresponding data length Signal from OS Cannot send event to self Invalid error code

Application Program Interface (API) Library 15

1.4 RFM2g API Functions


ThefollowingRFM2gAPIfunctionsintherfm2g_api.hfilecanbeusedwiththe RFM2gdriver.
Table 1-2 RFM2g API Functions
Opening and Closing API Functions API Function RFM2gOpen() RFM2gClose() Description Opens the RFM2g driver and returns an RFM2g handle. Closes an open RFM2g handle and releases resources allocated to it. RFM2g Configuration API Functions API Function RFM2gGetConfig() RFM2gUserMemory() RFM2gUnMapUserMemory() RFM2gUserMemoryBytes() RFM2gUnMapUserMemoryBytes() RFM2gNodeID() RFM2gBoardID() RFM2gSize() RFM2gFirst() RFM2gDeviceName() RFM2gDllVersion() RFM2gDriverVersion() RFM2gGetDMAThreshold() RFM2gSetDMAThreshold() RFM2gGetDMAByteSwap() RFM2gSetDMAByteSwap() RFM2gGetPIOByteSwap() RFM2gSetPIOByteSwap() Description Obtains a copy of the RFM2GCONFIG configuration structure. Maps RFM2g memory to the user space. Unmaps RFM2g memory from the user space that was mapped using RFM2gUserMemory() Maps RFM2g memory to the user space. Unmaps RFM2g memory from the user space that was mapped using RFM2gUserMemoryBytes() Returns the RFM2g device node ID. Returns the ID of the board corresponding to the passed-in handle. Returns the total amount of memory space available on the RFM2g device. Returns the first available RFM2g offset. Returns the device name associated with an RFM2g handle. Returns the DLL version. Returns the RFM2g device driver version. Returns the current DMA (Direct Memory Access) threshold value. Sets the transfer size at which reads and writes will use DMA. Returns the state of DMA byte swapping specified by RFM2gGetDMAThreshold(). Sets the current ON/OFF state of DMA byte swapping. Returns the state of PIO byte swapping specified by RFM2gSetPIOByteSwap(). Sets the current ON/OFF state of PIO (Programmed IO) byte swapping. RFM2g Data Transfer API Functions API Function RFM2gRead() RFM2gWrite() RFM2gPeek8(), RFM2gPeek16(), RFM2gPeek32() and RFM2gPeek64() RFM2gPoke8(), RFM2gPoke16(), RFM2gPoke32() and RFM2gPoke64() Description Reads one or more bytes starting at an offset in Reflective Memory. Writes one or more bytes starting at an offset in Reflective Memory. Reads a single byte, word or longword from an offset in Reflective Memory. Writes a single byte, word or longword to an offset in Reflective Memory. RFM2g Interrupt Event API Functions API Function RFM2gEnableEvent() RFM2gDisableEvent() RFM2gSendEvent() Description Enables reception of an RFM2g interrupt event. Disables the reception of an RFM2g event. Transmits the specified RFM2g interrupt event to one or all other RFM2g node IDs.

16 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

Table 1-2 RFM2g API Functions (Continued)


Opening and Closing API Functions API Function RFM2gWaitForEvent() RFM2gEnableEventCallback() RFM2gDisableEventCallback() RFM2gClearEvent() RFM2gClearEventCount() RFM2gGetEventCount() RFM2gCancelWaitForEvent() Description Blocks the calling process until an occurrence of the specified RFM2g interrupt event is received or a timeout (if enabled) expires. Enables the interrupt notification for one event on one board. Disables the interrupt notification for one event on one board. Flushes all pending events for a specified event type. Clears the event counter for an interrupt event type. Gets the number of interrupt events for a given event type. Cancels any pending RFM2gWaitForEvent() calls for a specified event type. RFM2g Utility API Functions API Function RFM2gErrorMsg() RFM2gGetLed() RFM2gSetLed() RFM2gCheckRingCont() RFM2gGetDebugFlags() RFM2gSetDebugFlags() RFM2gGetDarkOnDark() RFM2gSetDarkOnDark() RFM2gClearOwnData() RFM2gGetTransmit() RFM2gSetTransmit() RFM2gGetLoopback() RFM2gSetLoopback() RFM2gGetParityEnable() RFM2gSetParityEnable() RFM2gGetMemoryOffset() RFM2gSetMemoryOffset() RFM2gGetSlidingWindow() RFM2gSetSlidingWindow() Description Returns a pointer to a text string describing an error code. Retrieves the current ON/OFF state of the Reflective Memory board's STATUS LED. Sets the ON/OFF state of the Reflective Memory board's STATUS LED. Returns the fiber ring continuity through nodes. Retrieves a copy of all RFM2g device driver debug control flags. Sets or clears the device driver debug control flags. Retrieves the current ON/OFF state of the Reflective Memory boards Dark on Dark feature. Sets the ON/OFF state of the Reflective Memory boards Dark on Dark feature. Returns the state of the Own Data bit and resets the state if set, calling this function will turn OFF the Own Data LED if ON. Retrieves the current ON/OFF state of the Reflective Memory boards transmitter. Sets the ON/OFF state of the Reflective Memory boards transmitter. Retrieves the current ON/OFF state of the Reflective Memory boards loopback of the transmit signal to the receiver circuit internally. Sets the ON/OFF state of the Reflective Memory boards loopback of the transmit signal to the receiver circuit internally. Retrieves the current ON/OFF state of the Reflective Memory boards parity checking on all onboard memory accesses. Sets the ON/OFF state of the Reflective Memory boards parity checking on all onboard memory accesses. Gets the memory offset of the Reflective Memory board. Sets the memory offset of the Reflective Memory board. Retrieves the base Reflective Memory offset and size of the current sliding window. Sets the base Reflective Memory offset of the sliding window.

Application Program Interface (API) Library 17

1.5 RFM2g Opening and Closing API Functions


ThefollowingAPIfunctionsintherfm2g_api.hfilecanbeusedtoopenandclose theRFM2gdriver.
Table 1-3 RFM2g Opening and Closing API Functions
API Function RFM2gOpen() RFM2gClose() Description Opens the RFM2g driver and returns an RFM2g handle. Closes an open RFM2g handle and releases resources allocated to it.

1.5.1 RFM2gOpen()
TheRFM2gOpen()functionconnectstheapplicationprogramtotheRFM2g devicedriverandAPIlibrary.TheAPIlibrarywillopenthespecifiedRFM2g deviceandreturnahandlewhichtheprogrammustuseinallfurtherreferences totheRFM2gdevice. SeveralprogramsandexecutionthreadsmayhavethesameRFM2ginterface openatanygiventime.ThedriverandtheAPIlibraryarethreadsafe;however,it istheresponsibilityoftheapplicationprogramtoperformwhateveraccess synchronizationisneededforanydatastructuresmanagedbytheprograminthe RFM2garea.

NOTE

Because RFM2g interface device names are dynamically assigned, users who have multiple RFM2g devices in a chassis should exercise care when replacing RFM2g boards. Removing an RFM2g interface may cause the name assigned to other RFM2g boards to be changed.

Operation MostservicesavailableviatheAPIrequiretheuseofanRFM2GHANDLEto identifytheconnectionbetweentheapplicationprogramandtheopenedRFM2g interface. Syntax


STDRFM2GCALL RFM2gOpen(char*DevicePath,RFM2GHANDLE*rh );

Parameters
DevicePath

Pathtospecialdevicefile(I).Refertoyourdriverspecific manualfortheformatofDevicePath. PointertoanRFM2GHANDLEstructure(IO).

rh

18 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_BAD_PARAMETER_1 NULLorinvalid DevicePath. RFM2G_BAD_PARAMETER_2 rhisNULL RFM2G_HANDLE_NOT_NULL *rhisnotNULL. RFM2G_OS_ERROR Operatingsystem(OS)returnedanerror. RFM2G_NOT_OPEN Deviceisnotopen. RFM2G_NOT_IMPLEMENTED APIfunctionisnotimplemented

inthedriver.
RFM2G_LOW_MEMORY Systemrefusedrequest. RFM2G_NO_RFM2G_BOARD NoRFM2gdevicefound. RFM2G_BAD_RFM2G_BOARD_ID RFM2gdevicehasbadboard

ID. Example SeeSection1.2.2 RoutineCodeforUsewithAPIFunctionExamplesonpage12 foranexampleoftheRFM2gOpen()command. RelatedCommands RFM2gClose()

Application Program Interface (API) Library 19

1.5.2 RFM2gClose()
TheRFM2gClose()functionallowsanapplicationprogramtoterminateits connectionwiththeRFM2gservices.OncetheRFM2ghandleisclosed,allofthe facilitiesusingthathandlearenolongeraccessible,includingthelocalRFM2g memory,whichmaybemappedintotheapplicationprogramsvirtualmemory space. Syntax
STDRFM2GCALL RFM2gClose( RFM2GHANDLE *rh );

Parameters
rh

InitializedpreviouslywithacalltoRFM2gOpen()(I).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplementedinthe

driver.
RFM2G_NOT_OPENDeviceisnotopen.

Example SeeSection1.2.2 RoutineCodeforUsewithAPIFunctionExamplesonpage12 foranexampleoftheRFM2gClose()command. RelatedCommands RFM2gOpen()

20 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.6 RFM2g Configuration API Functions


ThefollowingAPIfunctionsintherfm2g_api.hfilecanbeusedtoperform configurationontheRFM2gdriver.
Table 1-4 RFM2g Configuration API Functions
API Function RFM2gGetConfig() RFM2gUserMemory() RFM2gUnMapUserMemory() RFM2gUnMapUserMemoryBytes() RFM2gUnmpaUserBytes RFM2gNodeID() RFM2gBoardID() RFM2gSize() RFM2gFirst() RFM2gDeviceName() RFM2gDllVersion() RFM2gDriverVersion() RFM2gGetDMAThreshold() RFM2gSetDMAThreshold() RFM2gGetDMAByteSwap() RFM2gSetDMAByteSwap() RFM2gGetPIOByteSwap() RFM2gSetPIOByteSwap() Description Obtains a copy of the RFM2GCONFIG configuration structure. Maps RFM2g memory to the user space. Unmaps RFM2g memory from the user space that was mapped using RFM2gUserMemory(). Maps RFM2g memory to the user space. Unmaps RFM2g memory from the user space that was mapped using RFM2gUserMemory(). Returns the RFM2g device node ID. Returns the ID of the board corresponding to the passed-in handle. Returns the total amount of memory space available on the RFM2g device. Returns the first available RFM2g offset. Returns the device name associated with an RFM2g handle. Returns the DLL version. Returns the RFM2g device driver version. Returns the current DMA threshold value. Sets the transfer size at which reads and writes will use DMA. Returns the state of DMA byte swapping specified by RFM2gSetDMAThreshold(). Sets the current ON/OFF state of DMA byte swapping. Returns the state of PIO byte swapping specified by RFM2gSetPIOByteSwap(). Sets the current ON/OFF state of PIO byte swapping.

Application Program Interface (API) Library 21

1.6.1 RFM2gGetConfig()
TheRFM2gGetConfig()functionallowsanapplicationprogramtoobtainacopy oftheRFM2GCONFIGhardwareconfigurationstructurecreatedbythedevice driverduringitsinitialization. TheRFM2GCONFIGstructureisdriverspecific.Refertoyourdrivers installationmanualforstructuredefinitioninformation. Syntax
STDRFM2GCALL RFM2gGetConfig( RFM2GHANDLE rh, RFM2GCONFIG *Config );

Parameters
rh Config

HandletoopenRFM2gdevice(I). PointertoRFM2GCONFIGstructuretobefilled(O).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPEN Deviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplementedinthe

driver.
RFM2G_BAD_PARAMETER_2ConfigisNULL.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2GCONFIG Rfm2gConfig; result = RFM2gGetConfig(Handle, &Rfm2gConfig);

RelatedCommands RFM2gNodeID() RFM2gBoardID() RFM2gSize() RFM2gFirst() RFM2gDeviceName() RFM2gDllVersion() RFM2gDriverVersion()

22 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.6.2 RFM2gUserMemory()
TheRFM2gUserMemory()functionmapstheReflectiveMemoryaddressspaceto auserlevelpointer,allowingdirectaccesstoRFMmemoryviapointer dereferencing.AlltransfersusingthispointerwillusePIOandwillnotuse DMA. Syntax
STDRFM2GCALL RFM2gUserMemory( RFM2GHANDLE rh, volatile void **UserMemoryPtr, RFM2G_UINT64 Offset, RFM2G_UINT32 Pages );

Parameters
rh UserMemoryPtr

HandletoopenRFM2gdevice(I). WheretoputthepointertomappedRFM2gspace(IO).

NOTE
Offset Pages

The volatile keyword must be used to force an implementation to suppress optimization.

BasebyteoffsetofRFM2gmemorytomap(I). Numberofpagestomap(I).

NOTE

Page size is system-dependent. Refer to your driver-specific manual for information on using this parameter.

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rh isNULL. RFM2G_OS_ERROR OSreturnedanerror. RFM2G_NOT_OPEN Deviceisnotopen. RFM2G_NOT_IMPLEMENTED APIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2 UserMemoryPtrisNULL. RFM2G_BAD_PARAMETER_4 Pagesis0. RFM2G_MEM_NOT_MAPPED Systemmemorymapcallfailed. RFM2G_OUT_OF_RANGE Mappingwouldgobeyondendof

RFM2gmemory.

Application Program Interface (API) Library 23

Example Usethefollowingcodebyinsertingitintotheexampleroutineinthesection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UINT32 Offset = 0; RFM2G_UINT32 Pages = 1; volatile RFM2G_UINT32 *pUser; /* Must be volatile */ result = RFM2gUserMemory(Handle, (volatile void **)&pUser, Offset, Pages);

RelatedCommands RFM2gUnMapUserMemory()

24 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.6.3 RFM2gUnMapUserMemory()
TheRFM2gUnMapUserMemory()functionunmapsamemoryspacemappedby RFM2gUserMemory(). Syntax
STDRFM2GCALL RFM2gUnMapUserMemory( RFM2GHANDLE rh, volatile void **UserMemoryPtr, RFM2G_UINT32 Pages );

Parameters
rh UserMemoryPtr

HandletoopenRFM2gdevice(I). PointertomappedRFM2gspace(IO).

NOTE
Pages

The volatile keyword must be used to force an implementation to suppress optimization.

ThenumberofpagesoriginallymappedtoUserMemoryPtr(I). Refertoyourdriverspecificmanualforinformationonusing thisparameter.

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROR OSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2 UserMemoryPtrisNULL. RFM2G_BAD_PARAMETER_3Pagesis0. RFM2G_OUT_OF_RANGE Mappingwouldgobeyondendof

RFM2gmemory. Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UINT32 Offset = 0; RFM2G_UINT32 Pages = 1; volatile RFM2G_UINT32 *pUser;

/* Must be volatile */

result = RFM2gMapUserMemory(Handle, (volatile void **)&pUser, Offset, Pages); if (result == RFM2G_SUCCESS) { result = RFM2gUnMapUserMemory(Handle, (volatile void **)&pUser, Pages); } }

RelatedCommands RFM2gUserMemory()
Application Program Interface (API) Library 25

1.6.4 RFM2gUserMemoryBytes()
TheRFM2gUserMemoryBytes()functionmapstheReflectiveMemoryaddress spacetoauserlevelpointer,allowingdirectaccesstoRFMmemoryviapointer dereferencing.AlltransfersusingthispointerwillusePIOandwillnotuse DMA.ThisfunctionissimilartotheRFM2gUserMemory()exceptthatittakesthe numberforbytesinsteadofthenumberforpages.Userapplicationshould choosethisfunctionoverRFM2gUserMemory()forportabilityacrossplatforms withdifferentpagesizes. Syntax
STDRFM2GCALL RFM2gMapUserBytes( RFM2GHANDLE rh, volatile void **UserBytePtr, RFM2G_UINT64 Offset, RFM2G_UINT32 Bytes );

Parameters
rh UserMemoryPtr

HandletoopenRFM2gdevice(I). WheretoputthepointertomappedRFM2gspace(IO).

NOTE
Offset Bytes

The volatile keyword must be used to force an implementation to suppress optimization.

BasebyteoffsetofRFM2gmemorytomap(I). Numberofbytestomap(I).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2 UserBytePtrisNULL. RFM2G_BAD_PARAMETER_4Bytesis0. RFM2G_MAP_NOT_ALLOWED InvalidmapOffsetandBytes

(BytessizebeyondsizeofmemoryonRFM2gdevice).
RFM2G_OUT_OF_RANGEMappingwouldgobeyondendof

RFM2gmemory.

26 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UINT32 Offset = 0; RFM2G_UINT32 Bytes = 4096; volatile char *pUser; /* Must be volatile */ result = RFM2gUserMemoryBytes(Handle, (volatile void **)&pUser, Offset, Bytes);

RelatedCommands RFM2gUnMapUserMemoryBytes()

Application Program Interface (API) Library 27

1.6.5 RFM2gUnMapUserMemoryBytes()
TheRFM2gUnMapUserMemoryBytes()functionunmapsamemorybytespace mappedbyRFM2gUserMemoryBytes(). Syntax
STDRFM2GCALL RFM2gUnMapUserMemoryBytes( RFM2GHANDLE rh, volatile void **UserMemoryPtr, RFM2G_UINT32 Bytes );

Parameters
rh UserMemoryPtr

HandletoopenRFM2gdevice(I). PointertomappedRFM2gspace(IO).

NOTE
Bytes

The volatile keyword must be used to force an implementation to suppress optimization.

ThenumberofbytesoriginallymappedtoUserMemoryPtr(I). Refertoyourdriverspecificmanualforinformationonusing thisparameter.

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rh isNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTED APIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2 UserMemoryPtrisNULL. RFM2G_BAD_PARAMETER_3Bytesis0. RFM2G_OUT_OF_RANGE Mappingwouldgobeyondendof

RFM2gmemory.

28 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UINT32 Offset = 0; RFM2G_UINT32 Bytes = 4096; volatile char *pUser = NULL; /* Must be volatile */ result = RFM2gUserMemoryBytes(Handle, (volatile void **)&pUser, Offset, Bytes); if (result == RFM2G_SUCCESS) { result = RFM2gUnMapUserMemoryBytes(Handle, (volatile void **)&pUser, Bytes);

RelatedCommands RFM2gUserMemoryBytes()

Application Program Interface (API) Library 29

1.6.6 RFM2gNodeID()
TheRFM2gNodeID()functionreturnsthevalueoftheRFM2gdevicenodeID. EachRFM2gdeviceonanRFM2gnetworkisuniquelyidentifiedbyitsnodeID, whichismanuallysetbyjumpersonthedevicewhentheRFM2gnetworkis installed.ThedriverdeterminesthenodeIDwhenthedeviceisinitialized. Syntax
STDRFM2GCALL RFM2gNodeID( RFM2GHANDLE rh, RFM2G_NODE *NodeIdPtr );

Parameters
rh NodeIdPtr

HandletocurrentlyopenedRFM2gdevice(I). NodeIDofthecurrentlyopenedRFM2gdevice(O).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2NodeIdPtrisNULL.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_NODE NodeId; result = RFM2gNodeID(Handle, &NodeId);

RelatedCommands RFM2gBoardID() RFM2gGetConfig()

30 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.6.7 RFM2gBoardID()
TheRFM2gBoardID()functionreturnstheRFM2ginterfacemodeltype.Each RFM2gmodeltypeisuniquelyidentifiedbyanumericvalueassignedby GEandrecordedasafixedconstantinanRFM2ghardwareregister.Thedriver andsupportlibraryreadthisvaluewhenthedeviceisopened.Theapplication programusestheRFM2gBoardID()numbertoobtainthatvalue. Syntax
STDRFM2GCALL RFM2gBoardID( RFM2GHANDLE rh, RFM2G_UINT8*BoardIdPtr );

Parameters
rh BoardIdPtr

HandletocurrentlyopenedRFM2gdevice(I). BoardIDofthecurrentlyopenedRFM2gdevice(O).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTED APIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2BoardIdPtrisNULL.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UINT8 BoardId; result = RFM2gBoardID(Handle, &BoardId)

RelatedCommands RFM2gNodeID() RFM2gGetConfig()

Application Program Interface (API) Library 31

1.6.8 RFM2gSize()
TheRFM2gSize()functionreturnsthetotalamountofmemoryspaceavailableon theRFM2gdevice.TheapplicationprogrammayaccessRFM2gspacebetween offsetRFM2gFirst()andRFM2gSize()1. RFM2gboardsmaybeconfiguredwithavarietyofmemorysizes.Thedevice driverandAPIlibrarydeterminetheamountofmemorycontainedonanRFM2g deviceasitisopened.AnapplicationprogrammaythenuseRFM2gSize()to obtainthenumberofbytesontheboard. Syntax
STDRFM2GCALL RFM2gSize( RFM2GHANDLE rh, RFM2g_UINT32 *SizePtr );

Parameters
rh SizePtr

HandletoopenRFM2gdevice(I). PointertovariablethatisfilledwiththeRFM2gsizevalue(O).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rh isNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2SizePtrisNULL.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UNIT32 Size result = RFM2GgSize(Handle, &Size); if (result == RFM2G_SUCCESS) { printf( "The RFM2g interface contains %lu bytes of memory.\n", Size ); }

RelatedCommands RFM2gGetConfig() RFM2gFirst()

32 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.6.9 RFM2gFirst()
TheRFM2gFirst()functionreturnsthefirstRFM2goffsetavailableforusebyan applicationprogram.TheentirememoryspaceoftheRFM2gdeviceismapped intothevirtualaddressspaceoftheapplicationprogram. Syntax
STDRFM2GCALL RFM2gFirst( RFM2GHANDLE rh, RFM2G_UINT32 *FirstPtr );

Parameters
rh FirstPtr

HandletoopenRFM2gdevice(I). Pointertothevariablefilledwiththeoffsetofthefirstlocation ofRFMmemory(O).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rh isNULL. RFM2G_OS_ERROR OSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2FirstPtrisNULL.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UINT32 first; result = RFM2gFirst(Handle, &first);

RelatedCommands RFM2gGetConfig() RFM2gSize()

Application Program Interface (API) Library 33

1.6.10 RFM2gDeviceName()
TheRFM2gDeviceName()functionreturnsanullterminatedstringcontaining thefirst64charactersofthedevicefilenameassociatedwiththegivenRFM2gfile handle. Syntax
STDRFM2GCALL RFM2gDeviceName( RFM2GHANDLE rh, char *NamePtr );

Parameters
rh NamePtr

InitializedpreviouslywithacalltoRFM2gOpen()(I). Pointertothechararraythatisfilledwiththedevicefilename forthegivenRFM2gdevice(O).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPEN Deviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2NamePtrisNULL.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_CHAR name[64]; name[0] = 0; result = RFM2gDeviceName(Handle, name); if(result == RFM2G_SUCCESS) { printf("RFM2gDeviceName : %s\n", name); }

RelatedCommands RFM2gGetConfig()

34 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.6.11 RFM2gDllVersion()
TheRFM2gDllVersion()functionreturnsanASCIIstringwithwhichan applicationprogramcandeterminetheversionoftheDLLorAPIlibrary.This stringcontainstheproductionreleaselevelofthelibraryandisuniquebetween differentversionsoftheAPIlibrary. Syntax
STDRFM2GCALL RFM2gDllVersion( RFM2GHANDLE rh, char *VersionPtr );

Parameters
rh VersionPtr

HandletoopenRFM2gdevice(I). Pointertowherethestringcontainingtheproductionrelease leveloftheDLLorAPIlibrary(O)willbecopied.

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROR OSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTED APIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2VersionPtrisNULL.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_CHAR version[64]; version[0] = 0; result = RFM2gDllVersion(Handle, version); if(result == RFM2G_SUCCESS) { printf(RFM2gDllVersion:%s\n, version); }

RelatedCommands RFM2gDriverVersion() RFM2gGetConfig()

Application Program Interface (API) Library 35

1.6.12 RFM2gDriverVersion()
TheRFM2gDriverVersion()functionreturnsanASCIIstringwithwhichan applicationprogramcandeterminetheGEproductionreleaseversionofthe underlyingRFM2gdevicedriver. Syntax
STDRFM2GCALL RFM2gDriverVersion( RFM2GHANDLE rh, char *VersionPtr );

Parameters
rh VersionPtr

HandletoopenRFM2gdevice(I). Pointertowherethestringcontainingtheproductionversion oftheRFM2gdevicedriverwillbecopied(O).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROR OSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTED APIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2 VersionPtrisNULL.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_CHAR drvVersion[64]; drvVersion[0] = 0; result = RFM2gDriverVersion(Handle, drvVersion); if(result == RFM2G_SUCCESS) { printf("RFM2gDriverVersion : %s\n", drvVersion); }

RelatedCommands RFM2gDllVersion() RFM2gGetConfig()

36 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.6.13 RFM2gGetDMAThreshold()
TheRFM2gGetDMAThreshold()functionreturnsthelengthofthecurrent minimumDMAI/Orequestofthedevicedriver.TheRFM2gdevicedriverwill usethebusmasterDMAfeaturepresentonsomeRFM2gdevicesifanI/Orequest qualifies(i.e.ifthesizeislargerthanorequaltotheThreshold).Oneofthe criteriaforperformingtheDMAisthattheI/Otransferbelongenoughthatthe timesavedbyperformingtheDMAoffsetstheoverheadprocessinginvolved withinitializingtheDMAitself.ThedefaultDMAthresholdisdriverdependent. RefertoyourdriverspecificmanualforthedefaultDMAthresholdvalue. Thiscommandisusefulsincetheamountofthisoverheadcanvarybetweenhost computerconfigurations.Theapplicationprogramcansetanewthresholdusing theRFM2gGetDMAThreshold()function. Syntax
STDRFM2GCALL RFM2gGetDMAThreshold( RFM2GHANDLE rh, RFM2G_UINT32 *Threshold );

Parameters
rh Threshold

HandletoopenRFM2gdevice(I). PointertothevariablewherethecurrentDMAthresholdvalue willbecopied(O).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTED APIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2ThresholdisNULL.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UINT32 Threshold; result = RFM2gGetDMAThreshold(Handle, &Threshold);

RelatedCommands RFM2gSetDMAThreshold() RFM2gRead() RFM2gWrite()

Application Program Interface (API) Library 37

1.6.14 RFM2gSetDMAThreshold()
TheRFM2gSetDMAThreshold()functionsetsthetransfersizeatwhichreadsand writeswilluseDMAtotransferdata.IfRFM2gRead()orRFM2gWrite()iscalled, DMAwillbeusedifthesizeofthedataislargerthanorequaltotheThreshold. Athresholdcanbesetperdevice. TheamountofcyclestakentosetupaDMAtransfercanincreasethetransfer timeforsmalltransfersizes.ThetransfersizeforwhichDMAsaremoreefficient thanstandardtransfersvaries,dependingonthesystem. DMAisgenerallypreferredoverthePIOmethodfortransferringdata.PIO operationsrequiretheusageoftheCPUtoprocessthetransfer,whileDMA enablestheReflectiveMemorycontrollertoaccesssystemmemorywhileleaving theCPUsresourcesunaffected.However,thebestvaluetouse(i.e.PIOvs.DMA) issystemdependent.TheRFM2gdriverperformsapproximatelyfivePCI accessestosetupandprocessaDMArequestandgeneratesaninterrupton completionoftheDMAoperation.Ingeneral,DMAisthepreferredmethodifa PIOtransferrequiresmorethansixtotenPCIcyclestocomplete. AThresholdvalueof0xFFFFFFFFspecifiesthatDMAswillneverbeusedfor datatransfer.

NOTE

The default value for the DMA Threshold is driver-dependent and should be changed only if recommended by the drivers documentation. Refer to your driver-specific manual for more information, including the default value.

Syntax
STDRFM2GCALL RFM2gSetDMAThreshold( RFM2GHANDLE rh, RFM2G_UINT32 Threshold );

Parameters
rh Threshold

HandletocurrentlyopenedRFM2gdevice(I). NewDMAthresholdvalue(I).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.

38 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


/* Set DMA threshold to 256 bytes */ result = RFM2gSetDMAThreshold(Handle, 256);

RelatedCommands RFM2gGetDMAByteSwap() RFM2gWrite() RFM2gRead()

Application Program Interface (API) Library 39

1.6.15 RFM2gGetDMAByteSwap()
TheRFM2gGetDMAByteSwap()functionreturnsthestateofDMAbyte swappinghardware,whichisspecifiedbytheRFM2gSetDMAByteSwap() function. Syntax
STDRFM2GCALL RFM2gGetDMAByteSwap( RFM2GHANDLE rh, RFM2G_BOOL *byteSwap )

Parameters
rh byteSwap

HandletocurrentlyopenedRFM2gdevice(I). PointertowherethestateoftheDMAbyteswaphardwareis written(RFM2G_TRUEwhenDMAbyteswappingisON,or RFM2G_FALSEwhenDMAbyteswappingisOFF)(O).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTED APIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2byteSwapisNULL.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_BOOL byteSwap; result = RFM2gGetDMAByteSwap(Handle, &byteSwap);

RelatedCommands RFM2gSetDMAByteSwap() RFM2gWrite() RFM2gRead()

40 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.6.16 RFM2gSetDMAByteSwap()
TheRFM2gSetDMAByteSwap()functionenablesordisablesbyteswappingDMA transferstoorfromanRFM2gdevice.Thisfunctionprovides4byteswapsonly (i.e.byteswappingbasedonsizeisnotperformedbytheRFM2gdevice).

NOTE
Syntax

DMA byte swapping may be enabled by default when the driver has been built for use on big endian systems. Refer to your driver-specific manual for the default setting of DMA byte swapping.

STDRFM2GCALL RFM2gSetDMAByteSwap( RFM2GHANDLE rh, RFM2G_BOOL byteSwap )

Parameters
rh byteSwap

HandletocurrentlyopenedRFM2gdevice(I). ThestateoftheDMAbyteswap(RFM2G_TRUE=>ONor RFM2G_FALSE=>OFF)(I).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPEN Deviceisnotopen. RFM2G_NOT_IMPLEMENTED APIfunctionisnotimplemented

inthedriver. Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_BOOL byteSwap = RFM2G_TRUE; /* Turn byte swap on */ result = RFM2gSetDMAByteSwap(Handle, byteSwap);

RelatedCommands RFM2gGetDMAByteSwap() RFM2gWrite() RFM2gRead()

Application Program Interface (API) Library 41

1.6.17 RFM2gGetPIOByteSwap()
TheRFM2gGetPIOByteSwap()functionreturnsthestateofPIObyteswapping, whichisspecifiedusingtheRFM2gSetPIOByteSwap()function. Refertosection1.7.1 DataTransferConsiderations,page44forinformationon byteswappingandPIO. Syntax
STDRFM2GCALL RFM2gGetPIOByteSwap( RFM2GHANDLE rh, RFM2G_BOOL *byteSwap )

Parameters
rh byteSwap

HandletocurrentlyopenedRFM2gdevice(I). PointertowherethestateofthePIObyteswapiswritten (RFM2G_TRUEwhenPIObyteswappingisON,or RFM2G_FALSEwhenPIObyteswappingisOFF)(O).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPEN Deviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2byteSwapisNULL.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_BOOL byteSwap; result = RFM2gGetPIOByteSwap(Handle, &byteSwap);

RelatedCommands RFM2gSetPIOByteSwap() RFM2gRead() RFM2gWrite() RFM2gUserMemory() RFM2gPeek8(),RFM2gPeek16(),RFM2gPeek32()andRFM2gPeek64() RFM2gPoke8(),RFM2gPoke16(),RFM2gPoke32()andRFM2gPoke64()

42 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.6.18 RFM2gSetPIOByteSwap()
TheRFM2gSetPIOByteSwap()functionenablesordisablesbyteswappingofPIO transferstoorfromanRFM2gdevice.Thisfunctionprovides4byteswaps(i.e. byteswappingbasedonsizeisnotperformedbytheRFM2gdevice). Refertosection1.7.1 DataTransferConsiderations,page44forinformationon byteswappingandPIO.

NOTE
Syntax

PIO byte swapping is enabled by default when the driver has been built for use on big endian systems. Refer to your driver-specific manual for the default setting of PIO byte swapping.

STDRFM2GCALL RFM2gSetPIOByteSwap( RFM2GHANDLE rh, RFM2G_BOOL byteSwap )

Parameters
rh byteSwap

HandletocurrentlyopenedRFM2gdevice(I). ThestateofthePIObyteswap(RFM2G_TRUE=>ONor RFM2G_FALSE=>OFF)(I).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROR OSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTED APIfunctionisnotimplemented

inthedriver. Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12.


RFM2G_BOOL byteSwap = RFM2G_TRUE /* Turn byte swap on */ result = RFM2gSetPIOByteSwap(Handle, byteSwap);

RelatedCommands RFM2gGetPIOByteSwap() RFM2gRead() RFM2gWrite() RFM2gUserMemory() RFM2gPeek8(),RFM2gPeek16(),RFM2gPeek32()andRFM2gPeek64() RFM2gPoke8(),RFM2gPoke16(),RFM2gPoke32()andRFM2gPoke64()

Application Program Interface (API) Library 43

1.7 RFM2g Data Transfer API Functions


ThefollowingAPIfunctionsintherfm2g_api.hfilecanbeusedtotransferdata withtheRFM2gdriver.
Table 1-5 RFM2g Data Transfer API Functions
API Function RFM2gRead() RFM2gWrite() RFM2gPeek8(), RFM2gPeek16(), RFM2gPeek32() and RFM2gPeek64() RFM2gPoke8(), RFM2gPoke16(), RFM2gPoke32() and RFM2gPoke64() Description Reads one or more bytes starting at an offset in Reflective Memory. Writes one or more bytes starting at an offset in Reflective Memory. Reads a single byte, word or longword from an offset in Reflective Memory. Writes a single byte, word or longword to an offset in Reflective Memory.

1.7.1 Data Transfer Considerations


Thefollowinginformationshouldbeconsideredwhentransferringdatausingthe APIcommandsinthissection,pointersobtainedfromRFM2gUserMemory()or anyofthefollowingrfm2g_util.ccommandlineinterpretercommands: peek8 peek16 peek32 peek64 poke8 poke16 poke32 poke64 read write SeeChapter2rfm2g_util.cUtilityProgram,page98formoreinformationon thecommandlineinterpreter.

Big Endian and Little Endian Data Conversions


x86(Intelbased)processorsuselittleendianbyteorderingwhenstoring sequencesofbyteswhileotherprocessors,suchastheSunfamilyofSPARC processorsandPowerPC,usethebigendianmethod. TheRFM2gAPIaccessesReflectiveMemoryusinglittleendianbyteordering.If somesystemsontheReflectiveMemorynetworkareusinglittleendianordering andothersareusingbigendianordering,youmayhavetoperformthenecessary byteswappingpriortousingtheRFM2gdriverwiththemultibytedatashared betweenthesystems,dependingontheDMAandPIObyteswapsettings.See section1.6.16 RFM2gSetDMAByteSwap(),page41andsection 1.6.18 RFM2gSetPIOByteSwap(),page43formoreinformation.

44 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

Using Direct Memory Access (DMA)


Basedonthesizeofthedata,theusermustdeterminewhetherornottouseDMA totransferdata.DMAbypassesasystemsCPU,allowingthesystemCPUto continueexecutionwhilesystemmemoryisbeingaccessedbytheRFM2gdevice. AnapplicationprogramwilluseDMAaccordingtoitsownI/Orequirements. TheRFM2gdriverwillattempttofulfilldatamovingrequestsusingthebus masterDMAfeatureoftheRFM2ginterfacesifthetransferisgreaterthanthe currentDMAthreshold. Iftherequestdoesnotmeettheconstraintslistedabove,thedriverwillmovethe datausingprogrammedI/O. Somesystemsmayrequirecachemanagementroutinestobecalledbeforeand/or afterDMAaccesses,andmayalsoplacerestrictionsonthesizeoftheDMA transfer.Refertoyourdriverspecificmanualtodeterminewhetherornotcache managementfunctionsshouldbecalledandforanyrestrictionsplacedonDMA transfers.Seesection1.6.15 RFM2gGetDMAByteSwap(),page40formore information.

Application Program Interface (API) Library 45

1.7.2 RFM2gRead()
TheRFM2gRead()functionisusedtotransferoneormorebytesfromRFM2g memorytosystemmemory. TheRFM2gdriverattemptstofulfilltheRFM2gRead()requestusingthebus masterDMAfeatureavailableontheRFM2gdevice.Thedriverwillmovethe datausingtheDMAfeatureifthelengthoftheI/Orequestisatleastaslongasthe minimumDMAthreshold.

NOTE

See section Big Endian and Little Endian Data Conversions, page 44 for information on the big endian/little endian byte-reordering process used by the RFM2g driver when accessing multibyte data. The DMA feature can be used as an alternative method for transferring data. See section Using Direct Memory Access (DMA), page 45 for more information. If byte swapping is enabled on the RFM2g device, the Offset and Length must be width aligned.

IftheRFM2gdevicedoesnotsupportthebusmasterDMAfeature,oriftheI/O requestdoesnotmeettheconstraintslistedabove,thenthedriverwillmovethe datausingPIO. Refertosection1.7.1 DataTransferConsiderations,page44forinformationon byteswapping.

CAUTION
Syntax

An application program must not attempt to access the RFM2g contents at an offset less than that returned by the RFM2gFirst() function.

STDRFM2GCALL RFM2gRead( RFM2GHANDLE rh, RFM2G_UINT32 Offset, void *Buffer, RFM2G_UINT32 Length );

Parameters
rh Offset

HandletoopenRFM2gdevice(I). WidthalignedoffsettoReflectiveMemoryatwhichtobegin theread(I).Validoffsetvaluesare0x0to0x3FFFFFFfor64MB cards,0x0to0x7FFFFFFfor128MBcardsand0x0to0x0FFFFFF for256MBcards. PointertowheredataiscopiedfromReflectiveMemory(O). Numberofbytestotransfer(I).Validvaluesare0to([RFM Size]rfmOffset).

Buffer Length

46 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_3 BufferisNULL. RFM2G_BAD_PARAMETER_4Lengthisnotalignedtodata

width.
RFM2G_OUT_OF_RANGEOffsetandLengthisbeyondthe

endofmemoryonRFM2Gdevice.
RFM2G_DMA_FAILEDDMAfailed. RFM2G_UNALIGNED_OFFSETOffsetnotalignedwithdata

size.
RFM2G_READ_ERRORDatanotalignedand/orsystemerror. RFM2G_LSEEK_ERROR Failureoflseek(2)command. RFM2G_UNALIGNED_ADDRESSBufferisnotalignedtodata

width. Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UINT8 Buffer[128]; RFM2G_UINT32 rfmBytes = sizeof(Buffer); RFM2G_UINT32 Offset = 0; result = RFM2gRead(Handle, Offset, Buffer, rfmBytes);

RelatedCommands RFM2gWrite() RFM2gSetDMAThreshold() RFM2gSetDMAByteSwap() RFM2gSetPIOByteSwap()

Application Program Interface (API) Library 47

1.7.3 RFM2gWrite()
TheRFM2gWrite()functiontransfersoneormoreI/Odatabuffersfromthe applicationprogramtotheRFM2gnodebeginningatthespecifiedaligned memoryoffset. IftheRFM2ginterfacesupportsthebusmasterDMAfeatureandtheI/Orequest meetscertainconstraints,theRFM2gdevicedriverwilluseDMAtoperformthe I/Otransfer.SeethediscussionfortheRFM2gRead()functionforadescriptionof theconstraintsfortheDMAtransfersupport. TheRFM2gWrite()writesoneormorebytesstartingatanoffsetinReflective Memory(i.e.allowsanapplicationprogramtooutput(write)arbitrarysizedI/O buffers).ThedriverwillmovethedatausingtheDMAfeatureifthelengthofthe I/OrequestisatleastaslongastheminimumDMAthreshold.

NOTE

See section Big Endian and Little Endian Data Conversions, page 44 for information on the big endian/little endian byte-reordering process used by the RFM2g driver when accessing multibyte data. The DMA feature can be used as an alternative method for transferring data. See section Using Direct Memory Access (DMA), page 45 for more information. If byte swapping is enabled on the RFM2g device, the Offset and Length must be width aligned.

Syntax
STDRFM2GCALL RFM2gWrite( RFM2GHANDLE rh, RFM2G_UINT32 Offset, void *Buffer, RFM2G_UINT32 Length );

Parameters
rh Offset

HandletoopenRFM2gdevice(I). WidthalignedoffsetinReflectiveMemoryatwhichtobegin thewrite(I).Validoffsetvaluesare0x0to0x3FFFFFFfor64MB cards,0x0to0x7FFFFFFfor128MBcardsand0x0to 0x0FFFFFFFfor256MBcards. PointertowheredataiscopiedtoReflectiveMemory(I). Numberofbytesunitstowrite(I).Validvaluesare0to([RFM Size]rfmOffset).

Buffer Length

48 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPEN Deviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_3BufferisNULL. RFM2G_BAD_PARAMETER_4 Lengthisnotalignedtodata

width.
RFM2G_OUT_OF_RANGEOffsetandLengthisbeyondthe

endofmemoryonRFM2Gdevice.
RFM2G_DMA_FAILED DMAfailed. RFM2G_UNALIGNED_OFFSETOffsetnotalignedwithdata

size.
RFM2G_WRITE_ERRORDatanotalignedand/orsystemerror. RFM2G_READ_ERRORDatanotalignedand/orsystemerror. RFM2G_LSEEK_ERRORFailureoflseek(2)command. RFM2G_UNALIGNED_ADDRESS Bufferisnotalignedtodata

width. Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UINT8 Buffer[4]; RFM2G_UINT32 rfmBytes = sizeof(Buffer); RFM2G_UINT32 Offset = 0; Buffer[0] = 0; Buffer[1] = 1; Buffer[2] = 2; Buffer[3] = 3; result = RFM2gWrite(Handle, Offset, (void*)Buffer, rfmBytes);

RelatedCommands RFM2gRead() RFM2gSetDMAThreshold() RFM2gGetDMAByteSwap() RFM2gSetPIOByteSwap()

Application Program Interface (API) Library 49

1.7.4 RFM2gPeek8(), RFM2gPeek16(), RFM2gPeek32() and RFM2gPeek64()


TheRFM2gPeek()functionsreturnthecontentsofthespecifiedRFM2goffset.The specifiedmemoryoffsetisaccessedaseitheran8bitbyte,a16bitword,a32bit longwordora64bitlongword.

NOTE

See section Big Endian and Little Endian Data Conversions, page 44 for information on the big endian/little endian byte-reordering process used by the RFM2g driver when accessing multibyte data.

Operation TheRFM2gPeek()functionsreturnthecontentsoftheindicatedRFM2gmemory locationandmakenoattempttolocktheRFM2gduringtheaccess. Refertosection1.7.1 DataTransferConsiderations,page44forinformationon byteswapping. Syntax


STDRFM2GCALL RFM2gPeek8( RFM2GHANDLE rh, RFM2G_UINT32 Offset, RFM2G_UINT8 *Value ); STDRFM2GCALL RFM2gPeek16( RFM2GHANDLE rh, RFM2G_UINT32 Offset, RFM2G_UINT16 *Value ); STDRFM2GCALL RFM2gPeek32( RFM2GHANDLE rh, RFM2G_UINT32 Offset, RFM2G_UINT32 *Value ); STDRFM2GCALL RFM2gPeek64( RFM2GHANDLE rh, RFM2G_UINT32 Offset, RFM2G_UINT64 *Value );

Parameters
rh Offset Value

HandletoopenRFM2gdevice(I). OffsetinReflectiveMemoryfromwhichtoread(I). PointertowherethevalueisreadfromOffset(O).

ReturnValues Success
RFM2G_SUCCESS

50 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

Failure

RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPEN Deviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_3ValueisNULL. RFM2G_OUT_OF_RANGEOffsetisbeyondtheendofRFM2G

memory.
RFM2G_UNALIGNED_OFFSETOffsetnotalignedwithdata

size. Example(RFM2gPeek8()) Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UINT8 Value; RFM2G_UINT32 Offset = 0; result = RFM2gPeek8(Handle, Offset, &Value);

Example(RFM2gPeek16()) Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UINT16 Value; RFM2G_UINT32 Offset = 0; result = RFM2gPeek16(Handle, Offset, &Value);

Example(RFM2gPeek32()) Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UINT32 Value; RFM2G_UINT32 Offset = 0; result = RFM2gPeek32(Handle, Offset, &Value);

Example(RFM2gPeek64()) Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UINT64 Value; RFM2G_UINT32 Offset = 0; result = RFM2gPeek64(Handle, Offset, &Value);

RelatedCommands RFM2gPoke8(),RFM2gPoke16(),RFM2gPoke32()andRFM2gPoke64() RFM2gSetPIOByteSwap()


Application Program Interface (API) Library 51

1.7.5 RFM2gPoke8(), RFM2gPoke16(), RFM2gPoke32() and RFM2gPoke64()


TheRFM2gPoke()functionsareusedtoupdateavalueintheRFM2gusingeither an8bitbyte,a16bitword,a32bitlongwordora64bitlongwordaccess.No attemptatRFM2gsharedmemorylockingisperformed.

NOTE

See section Big Endian and Little Endian Data Conversions, page 44 for information on the big endian/little endian byte-reordering process used by the RFM2g driver when accessing multibyte data.

Syntax
STDRFM2GCALL RFM2gPoke8( RFM2GHANDLE rh, RFM2G_UINT32 Offset, RFM2G_UINT8 Value ); STDRFM2GCALL RFM2gPoke16( RFM2GHANDLE rh, RFM2G_UINT32 Offset, RFM2G_UINT16 Value ); STDRFM2GCALL RFM2gPoke32( RFM2GHANDLE rh, RFM2G_UINT32 Offset, RFM2G_UINT32 Value ); STDRFM2GCALL RFM2gPoke64( RFM2GHANDLE rh, RFM2G_UINT32 Offset, RFM2G_UINT64 Value );

Parameters
rh Offset Value

HandletoopenRFM2gdevice(I). OffsetinReflectiveMemoryfromwhichtoread(I). ValuewrittentoOffset(I).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROR OSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTED APIfunctionisnotimplemented

inthedriver.
RFM2G_UNALIGNED_OFFSETOffsetnotalignedwithdata

size.

52 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

Example(RFM2gPoke8()) Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UINT8 Value = 0; RFM2G_UINT32 Offset = 0; result = RFM2gPoke8(Handle, Offset, Value);

Example(RFM2gPoke16()) UsethefollowingcodebyinsertingitintotheexampleroutineinSection1.2.2 RoutineCodeforUsewithAPIFunctionExamplesonpage12:


RFM2G_UINT16 Value = 0; RFM2G_UINT32 Offset = 0; result = RFM2gPoke16(Handle, Offset, Value);

Example(RFM2gPoke32()) UsethefollowingcodebyinsertingitintotheexampleroutineinSection1.2.2 RoutineCodeforUsewithAPIFunctionExamplesonpage12:


RFM2G_UINT32 Value = 0; RFM2G_UINT32 Offset = 0; result = RFM2gPoke32(Handle, Offset, Value);

Example(RFM2gPoke64()) Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UINT64 Value = 0; RFM2G_UINT32 Offset = 0; result = RFM2gPoke64(Handle, Offset, Value);

RelatedCommands RFM2gPeek8(),RFM2gPeek16(),RFM2gPeek32()andRFM2gPeek64() RFM2gSetPIOByteSwap()

Application Program Interface (API) Library 53

1.8 RFM2g Interrupt Event API Functions


ThefollowingAPIfunctionsintherfm2g_api.hfilecanbeusedtoperformevent relatedoperationswiththeRFM2gdriver.
Table 1-6 RFM2g Interrupt Event API Functions
API Function RFM2gEnableEvent() RFM2gDisableEvent() RFM2gSendEvent() RFM2gWaitForEvent() RFM2gEnableEventCallback() RFM2gDisableEventCallback() RFM2gClearEvent() RFM2gCancelWaitForEvent() RFM2gClearEventCount() RFM2gGetEventCount() Description Enables reception of an RFM2g interrupt event. Disables the reception of an RFM2g event. Transmits the specified RFM2g interrupt event to one or all other RFM2g node IDs. Blocks the calling process until an occurrence of the specified RFM2g interrupt event is received or a timeout (if enabled) expires. Enables the interrupt notification for one event on one board. Disables the interrupt notification for one event on one board. Flushes all pending events for a specified event type. Cancels any pending RFM2gWaitForEvent() calls for the specified event type. Clears the event counter for an interrupt event type. Gets the number of interrupt events for a given event type.

54 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.8.1 RFM2gEnableEvent()
RFM2gnetworkinterruptsarenotenabledbydefault.TheRFM2gEnableEvent() functionenablesaneventsoaninterruptcanbegeneratedonthereceivingnode. OnlyRFM2ginterrupteventslistedintheEventTypeparameterdescription(see theParametersectionbelow)maybecontrolledinthisway.Userapplicationsare notifiedofreceivedeventsbyusingtheRFM2gWaitForEvent()or RFM2gEnableEventCallback()function. ThebehaviorofRFM2gEnableEvent()varies,dependingonthefollowing scenariosregardingRFM2gEnableEvent():
Table 1-7 RFM2gEnableEvent()
Existing Condition(s) The event is disabled. The event is enabled. RFM2gEnableEvent() Behavior RFM2G_SUCCESS RFM2G_SUCCESS

Syntax
STDRFM2GCALL RFM2gEnableEvent( RFM2GHANDLE rh, RFM2GEVENTTYPE EventType );

Parameters
rh EventType

HandletoopenRFM2gdevice(I). Specifieswhichinterrupteventtoenable(I). InterruptscorrelatetothefollowingeventIDs: Interrupt


ResetInterrupt NetworkInterrupt1 NetworkInterrupt2 NetworkInterrupt3 NetworkInterrupt4 (InitInterrupt) BadDataInterrupt RXFIFOFullInterrupt RoguePacketDetectedand RemovedInterrupt RXFIFOAlmostFullInterrupt SyncLossOccurredInterrupt MemoryWriteInhibited MemoryParityError

Event

EventID
RFM2GEVENT_RESET RFM2GEVENT_INTR1 RFM2GEVENT_INTR2 RFM2GEVENT_INTR3 RFM2GEVENT_INTR4 RFM2GEVENT_BAD_DATA RFM2GEVENT_RXFIFO_FULL RFM2GEVENT_ROGUE_PKT RFM2GEVENT_RXFIFO_AFULL RFM2GEVENT_SYNC_LOSS RFM2GEVENT_MEM_ WRITE_INHIBITED RFM2GEVENT_LOCAL_ MEM_PARITY_ERR

Application Program Interface (API) Library 55

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPEN Deviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2EventTypeisinvalid. RFM2G_DRIVER_ERRORInternaldrivererror. RFM2G_ALREADY_ENABLED Thespecifiedeventisalready

enabled. Example Thefollowingexamplecodeenablesuserinterruptevent1.Usethefollowing codebyinsertingitintotheexampleroutineinsection1.2.2 RoutineCodeforUse withAPIFunctionExamples,page12:


result = RFM2gEnableEvent(Handle, RFM2GEVENT_INTR1);

RelatedCommands RFM2gDisableEvent() RFM2gClearEvent() RFM2gSendEvent() RFM2gWaitForEvent() RFM2gCancelWaitForEvent() RFM2gEnableEventCallback() RFM2gDisableEventCallback()

56 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.8.2 RFM2gDisableEvent()
TheRFM2gDisableEvent()functiondisablesthegenerationofaCPUinterrupt whenanRFM2geventisreceivedonthecurrentnode. ThebehaviorofRFM2gDisableEvent()varies,dependingonthefollowing scenariosregardingRFM2gEnableEvent(),RFM2gEnableEventCallback()and RFM2gWaitForEvent():
Table 1-8 RFM2gDisableEvent()
Existing Condition(s) The event is not enabled. The event is enabled without a pending callback or RFM2gWaitForEvent(). The event is enabled and a callback is registered. The event is enabled with a pending RFM2gWaitForEvent(). RFM2gDisableEvent() Behavior RFM2G_SUCCESS RFM2G_SUCCESS RFM2G_SUCCESS The callback is not affected. The callback will not occur until the event is enabled and received. RFM2G_SUCCESS RFM2gWaitForEvent() remains pending.

NOTE

RFM2gDisableEvent() will disable an event only if it was enabled using the same handle.

Evenifdisabled,theRFM2gdevicecontinuesstoringreceivedeventsinan onboardFIFOuntilenabledorcleared. Syntax


STDRFM2GCALL RFM2gDisableEvent( RFM2GHANDLE rh, RFM2GEVENTTYPE EventType );

Parameters
rh EventType

HandletoopenRFM2gdevice(I). Specifieswhichinterrupteventtodisable(I). InterruptscorrelatetothefollowingeventIDs: Interrupt


ResetInterrupt NetworkInterrupt1 NetworkInterrupt2 NetworkInterrupt3 NetworkInterrupt4 (InitInterrupt) BadDataInterrupt RXFIFOFullInterrupt RoguePacketDetected andRemovedInterrupt RXFIFOAlmostFullInterrupt SyncLossOccurredInterrupt MemoryWriteInhibited MemoryParityError

EventID
RFM2GEVENT_RESET RFM2GEVENT_INTR1 RFM2GEVENT_INTR2 RFM2GEVENT_INTR3 RFM2GEVENT_INTR4 RFM2GEVENT_BAD_DATA RFM2GEVENT_RXFIFO_FULL RFM2GEVENT_ROGUE_PKT RFM2GEVENT_RXFIFO_AFULL RFM2GEVENT_SYNC_LOSS RFM2GEVENT_MEM _WRITE_INHIBITED RFM2GEVENT_LOCAL _MEM_PARITY_ERR

Application Program Interface (API) Library 57

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROR OSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2EventTypeisinvalid. RFM2G_DRIVER_ERROR Internaldrivererror.

Example Thefollowingexamplecodedisablesuserinterrupt1.Usethefollowingcodeby insertingitintotheexampleroutineinsection1.2.2 RoutineCodeforUsewith APIFunctionExamples,page12:


result = RFM2gDisableEvent(Handle, RFM2GEVENT_INTR1);

RelatedCommands RFM2gEnableEvent() RFM2gClearEvent() RFM2gSendEvent() RFM2gWaitForEvent() RFM2gCancelWaitForEvent() RFM2gEnableEventCallback() RFM2gDisableEventCallback()

58 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.8.3 RFM2gSendEvent()
TheRFM2gSendEvent()functionsendsaninterrupteventanda32bitlongword valuetoanothernode.FiveRFM2ginterrupteventtypesareavailableforan applicationprogramtouseinsignalingeventstootherRFM2gnodes. Syntax
RFM2G_STATUS RFM2gSendEvent( RFM2GHANDLE rh, RFM2G_NODE ToNode, RFM2GEVENTTYPE EventType, RFM2G_UINT32 ExtendedData );

Parameters
rh ToNode

HandletoopenRFM2gdevice(I). Whowillreceivetheinterruptevent(I)(RFM2G_NODE_ALL sendstheeventtoallnodes).

NOTE
EventType

A node cannot send an event to itself.

Thetypeofinterrupteventtosend(I). InterruptscorrelatetothefollowingeventIDs: Interrupt


ResetInterrupt NetworkInterrupt1 NetworkInterrupt2 NetworkInterrupt3 NetworkInterrupt4

EventID
RFM2GEVENT_RESET RFM2GEVENT_INTR1 RFM2GEVENT_INTR2 RFM2GEVENT_INTR3 RFM2GEVENT_INTR4

ExtendedData

Userdefineddata(I).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROR OSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2InvalidToNode. RFM2G_BAD_PARAMETER_3 InvalidEventType. RFM2G_DRIVER_ERRORInternaldrivererror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NODE_ID_SELFCannotsendeventtoself.

Application Program Interface (API) Library 59

Example Thefollowingexamplecodesendsuserinterrupt1.Usethefollowingcodeby insertingitintotheexampleroutineinsection1.2.2 RoutineCodeforUsewith APIFunctionExamples,page12:


/* Send interrupt event 1 to node 0 with extended data value 0 */ result = RFM2gSendEvent(Handle, 0x0, RFM2GEVENT_INTR1, 0x0);

RelatedCommands RFM2gEnableEvent() RFM2gDisableEvent() RFM2gClearEvent() RFM2gWaitForEvent() RFM2gCancelWaitForEvent() RFM2gEnableEventCallback() RFM2gDisableEventCallback()

60 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.8.4 RFM2gWaitForEvent()
TheRFM2gWaitForEvent()functionallowsanapplicationprogramtodetermine thatanRFM2ginterrupteventhasbeenreceived.TheRFM2gWaitForEvent() functionblocksuntilthenextRFM2ginterrupteventoftherequestedtypehas beenreceived,thenreturns. Thespecifiedeventisdisabledifoneofthefollowingerroreventsoccurs,andthe
RFM2gEnableEvent()mustbecalledtoreenabletheinterrupt:

ErrorEventID RFM2GEVENT_BAD_DATA RFM2GEVENT_SYNC_LOSS

Description BadDataInterrupt SyncLossOccurredInterrupt

NOTE

Ensure that events do not interrupt continuously if they are re-enabled.

ThebehaviorofRFM2gWaitForEvent()varies,dependingonthefollowing scenariosregardingRFM2gWaitForEvent(),RFM2gEnableEventCallback(), RFM2gDisableEvent()andRFM2gClose():


Table 1-9 RFM2gWaitForEvent()
Existing Condition(s) The event is enabled. RFM2gWaitForEvent() Behavior RFM2G_SUCCESS Event received RFM2G_TIMED_OUT Event not received before timeout RFM2G_WAIT_EVENT_CANCELED User called RFM2gCancelWaitForEvent() RFM2G_SUCCESS Event received RFM2G_TIMED-OUT Event not received before timeout RFM2G_WAIT_EVENT_CANCELED User called RFM2gCancelWaitForEvent()

The event is not enabled.

RFM2gCancelWaitForEvent() is called for the event. RFM2G_SUCCESS Event received RFM2G_TIMED_OUT Event not received before timeout RFM2G_WAIT_EVENT_CANCELED User called RFM2gCancelWaitForEvent() The event is enabled and a callback is registered. RFM2G_EVENT_IN_USE

Another thread is pending on RFM2gWaitForEvent(). RFM2G_EVENT_IN_USE

Syntax
RFM2G_STATUS RFM2gWaitForEvent( RFM2GHANDLE rh, RFM2GEVENTINFO *EventInfo );

Parameters
rh EventInfo

HandletoopenRFM2gdevice(I). PointertoRFM2GEVENTINFOstructurecontainingtheevent typeandtime,inmilliseconds,towaitfortheeventbefore returning.

Application Program Interface (API) Library 61

Thefollowingistherfm2gEventInfostructureusedbytheEventInfoparameter ofRFM2gWaitForEvent():
typedef struct rfm2gEventInfo { RFM2G_UINT32 ExtendedInfo; RFM2G_NODE NodeId; RFM2GEVENTTYPE Event; RFM2G_UINT32 Timeout; void * pDrvSpec; } RFM2GEVENTINFO;

/* /* /* /* /*

Data passed with event Source Node Event type timeout value to wait for event mSec Driver specific

*/ */ */ */ */

Therfm2gEventInfostructureparametersare:
ExtendedInfo NodeId Event

Userdatathataccompaniesanevent(O). RFMnodethatsenttheevent(O). Specifieswhichinterrupteventtowaitupon(I). InterruptscorrelatetothefollowingeventIDs: Interrupt


ResetInterrupt NetworkInterrupt1 NetworkInterrupt2 NetworkInterrupt3 NetworkInterrupt4 (InitInterrupt) BadDataInterrupt RXFIFOFullInterrupt RoguePacketDetected andRemovedInterrupt RXFIFOAlmostFull Interrupt SyncLossOccurred Interrupt MemoryWriteInhibited MemoryParityError

EventID
RFM2GEVENT_RESET RFM2GEVENT_INTR1 RFM2GEVENT_INTR2 RFM2GEVENT_INTR3 RFM2GEVENT_INTR4 RFM2GEVENT_BAD_DATA RFM2GEVENT_RXFIFO_FULL RFM2GEVENT_ROGUE_PKT RFM2GEVENT_RXFIFO_AFULL RFM2GEVENT_SYNC_LOSS RFM2GEVENT_MEM _WRITE_INHIBITED RFM2GEVENT_LOCAL _MEM_PARITY_ERR

Timeout

Indicatesthetimeout,inmilliseconds,towaitfortheevent beforereturning(I).Nonzerovaluesuseatimeout,as determinedbythefollowingcriteria: Value


RFM2G_INFINITE_TIMEOUT RFM2G_NOWAIT [value]

Description
Waitforeverforeventtooccur Donotwaitforeventtooccur. Numberofmillisecondsto waitforeventtooccur.

pDrvSpec

Driverspecificdatathataccompaniesanevent(I).Referto yourdriverspecificmanualformoreinformation.

62 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2 EventInfoisNULLor EventInfoeventhasinvalideventtype. RFM2G_EVENT_IN_USEEventisalreadybeingwaitedon. RFM2G_TIMED_OUT Timedoutwaitingforevent. RFM2G_WAIT_EVENT_CANCELED RFM2gCancelWaitForEvent()calledforthisevent. RFM2G_DRIVER_ERROR Internaldrivererror.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2GEVENTINFO info; info.EventType = RFM2GEVENT_INT1; info.mSecToWait = 10000; /* Wait 10 seconds */ result = RFM2gWaitForEvent(Handle, &info);

RelatedCommands RFM2gEnableEvent() RFM2gDisableEvent() RFM2gClearEvent() RFM2gSendEvent() RFM2gCancelWaitForEvent() RFM2gEnableEventCallback() RFM2gDisableEventCallback()

Application Program Interface (API) Library 63

1.8.5 RFM2gEnableEventCallback()
TheRFM2gEnableEventCallback()functionenablestheinterruptnotificationfor oneeventononeboard. Thespecifiedeventisdisabledifoneofthefollowingerroreventsoccurs,andthe RFM2gEnableEvent()mustbecalledtoreenabletheinterrupt: ErrorEventID
RFM2GEVENT_BAD_DATA RFM2GEVENT_SYNC_LOSS

Description
BadDataInterrupt SyncLossOccurredInterrupt

NOTE

Ensure that events do not interrupt continuously if they are re-enabled.

ThebehaviorofRFM2gEnableEventCallback()varies,dependingonthefollowing scenariosregardingRFM2gEnableEvent()andRFM2gWaitForEvent():
Table 1-10 RFM2gEnableEventCallback()
Existing Condition(s) The event is enabled and a callback is registered. The event is enabled without an enabled callback. The event is enabled with a pending RFM2gWaitForEvent(). RFM2gDisableEvent() Behavior RFM2G_EVENT_IN_USE RFM2G_SUCCESS RFM2G_EVENT_IN_USE

Syntax
STDRFM2GCALL RFM2gEnableEventCallback ( RFM2GHANDLE rh, RFM2GEVENTTYPE EventType, RFM2G_EVENT_FUNCPTR pEventFunc ); void rfmSampleFunc( RFM2GHANDLE rh, RFM2GEVENTINFO EventInfo )

Parameters
rh EventType

HandletoopenRFM2gdevice(I). Specifieswhichinterrupteventtodisable(I). InterruptscorrelatetothefollowingeventIDs: Interrupt


ResetInterrupt NetworkInterrupt1 NetworkInterrupt2 NetworkInterrupt3 NetworkInterrupt4 (InitInterrupt) BadDataInterrupt RXFIFOFullInterrupt RoguePacketDetectedand RemovedInterrupt RXFIFOAlmostFull Interrupt SyncLossOccurredInterrupt MemoryWriteInhibited MemoryParityError

EventID
RFM2GEVENT_RESET RFM2GEVENT_INTR1 RFM2GEVENT_INTR2 RFM2GEVENT_INTR3 RFM2GEVENT_INTR4 RFM2GEVENT_BAD_DATA RFM2GEVENT_RXFIFO_FULL RFM2GEVENT_ROGUE_PKT RFM2GEVENT_RXFIFO _AFULL RFM2GEVENT_SYNC_LOSS RFM2GEVENT_MEM _WRITE_INHIBITED RFM2GEVENT_LOCAL _MEM_PARITY_ERR

pEventFunc

Theaddressofthefunctiontobecalledwhentheeventoccurs(I).

64 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTED APIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2 InvalidEventType. RFM2G_BAD_PARAMETER_3pEventFuncisNULL. RFM2G_EVENT_IN_USE Eventisalreadybeingwaitedon. RFM2G_DRIVER_ERROR Internaldrivererror. RFM2G_WAIT_EVENT_CANCELEDWaitforeventcanceled.

Example ThefollowingexamplecoderegistersthefunctionMyEventCallback,whichis calledwhenthehardwarereturnstheRFM2GEVENT_INTR1interrupt.Usethe followingcodebyinsertingitintotheexampleroutineinsection1.2.2 Routine CodeforUsewithAPIFunctionExamples,page12:


result = RFM2gEnableEventCallback(Handle, RFM2GEVENT_INTR1, MyEventCallback);

RelatedCommands RFM2gEnableEvent() RFM2gDisableEvent() RFM2gClearEvent() RFM2gSendEvent() RFM2gWaitForEvent() RFM2gCancelWaitForEvent() RFM2gDisableEventCallback()

Application Program Interface (API) Library 65

1.8.6 RFM2gDisableEventCallback()
TheRFM2gDisableEventCallback()functiondisablesinterruptnotificationfor oneeventbythishandle. Thespecifiedeventisdisabledifoneofthefollowingerroreventsoccurs,andthe RFM2gEnableEvent()mustbecalledtoreenabletheinterrupt: ErrorEventID
RFM2GEVENT_BAD_DATA RFM2GEVENT_SYNC_LOSS

Description
BadDataInterrupt SyncLossOccurred Interrupt

NOTE

Ensure that events do not interrupt continuously if they are re-enabled.

ThebehaviorofRFM2gDisableEventCallback()varies,dependingonthe followingscenariosregardingRFM2gEnableEvent()and RFM2gEnableEventCallback():


Table 1-11 RFM2gDisableEventCallback()
Existing Condition(s) The event is enabled and a callback is registered. The event is enabled without a registered callback. RFM2gDisableEvent() Behavior RFM2G_SUCCESS The callback is terminated without calling the user function. RFM2G_SUCCESS

Syntax
STDRFM2GCALL RFM2gDisableEventCallback( RFM2GHANDLE rh, RFM2GEVENTTYPE EventType );

Parameters
rh EventType

HandletoopenRFM2gdevice(I). Specifieswhichinterrupteventtodisable(I). InterruptscorrelatetothefollowingeventIDs: Interrupt


ResetInterrupt NetworkInterrupt1 NetworkInterrupt2 NetworkInterrupt3 NetworkInterrupt4 (InitInterrupt) BadDataInterrupt RXFIFOFullInterrupt RoguePacketDetected andRemovedInterrupt RXFIFOAlmostFull Interrupt SyncLossOccurred Interrupt MemoryWriteInhibited MemoryParityError

EventID
RFM2GEVENT_RESET RFM2GEVENT_INTR1 RFM2GEVENT_INTR2 RFM2GEVENT_INTR3 RFM2GEVENT_INTR4 RFM2GEVENT_BAD_DATA RFM2GEVENT _RXFIFO_FULL RFM2GEVENT_ROGUE_PKT RFM2GEVENT_RXFIFO_AFULL RFM2GEVENT_SYNC_LOSS RFM2GEVENT_MEM _WRITE_INHIBITED RFM2GEVENT_LOCAL _MEM_PARITY_ERR

66 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPEN Deviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2 InvalidEventType. RFM2G_EVENT_NOT_IN_USE Eventnotregisteredfor

callback.
RFM2G_EVENT_NOT_IN_USENocallbackwassetupforthe

specifiedevent. Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


result = RFM2gDisableEventCallback(Handle, RFM2GEVENT_INTR1);

RelatedCommands RFM2gEnableEvent() RFM2gDisableEvent() RFM2gClearEvent() RFM2gSendEvent() RFM2gWaitForEvent() RFM2gCancelWaitForEvent() RFM2gEnableEventCallback()

Application Program Interface (API) Library 67

1.8.7 RFM2gClearEvent()
TheRFM2gClearEvent()functionclearsanyorallpendinginterrupteventsfora specifiedevent. Syntax
STDRFM2GCALL RFM2gClearEvent( RFM2GHANDLE rh, RFM2GEVENTTYPE EventType );

Parameters
rh EventType

HandletoopenRFM2gdevice(I). TheeventFIFOtoclear(I). InterruptscorrelatetothefollowingeventIDs: Interrupt


ResetInterrupt NetworkInterrupt1 NetworkInterrupt2 NetworkInterrupt3 NetworkInterrupt4 (InitInterrupt) BadDataInterrupt RXFIFOFull Interrupt RoguePacket DetectedandRemoved Interrupt RXFIFOAlmostFull Interrupt SyncLossOccurred Interrupt MemoryWriteInhibited MemoryParityError Allinterrupts

EventID
RFM2GEVENT_RESET RFM2GEVENT_INTR1 RFM2GEVENT_INTR2 RFM2GEVENT_INTR3 RFM2GEVENT_INTR4 RFM2GEVENT_BAD_DATA RFM2GEVENT_RXFIFO_FULL RFM2GEVENT_ROGUE_PKT

RFM2GEVENT_RXFIFO_AFULL RFM2GEVENT_SYNC_LOSS RFM2GEVENT_MEM _WRITE_INHIBITED RFM2GEVENT_LOCAL _MEM_PARITY_ERR RFM2GEVENT_LAST

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rh isNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2InvalidEventType. RFM2G_DRIVER_ERROR Internaldrivererror.

68 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


result = RFM2gClearEvent(Handle, RFM2GEVENT_INTR1);

RelatedCommands RFM2gEnableEvent() RFM2gDisableEvent() RFM2gSendEvent() RFM2gWaitForEvent() RFM2gCancelWaitForEvent() RFM2gEnableEventCallback() RFM2gDisableEventCallback()

Application Program Interface (API) Library 69

1.8.8 RFM2gCancelWaitForEvent()
TheRFM2gCancelWaitForEvent()functioncancelsanypending RFM2gWaitForEvent()callsonaneventbythishandle.Ifacallbackhasbeen registeredtothespecifiedevent,thecallbackwillbecanceled.

NOTE
Syntax

A canceled RFM2gWaitForEvent() call returns a value of RFM2G_WAIT_EVENT_CANCELED.

STDRFM2GCALL RFM2gCancelWaitForEvent( RFM2GHANDLE rh, RFM2GEVENTTYPE EventType );

Parameters
rh EventType

HandletoopenRFM2gdevice(I). Specifieswhichinterrupteventtocancel(I). InterruptscorrelatetothefollowingeventIDs:

Interrupt
ResetInterrupt NetworkInterrupt1 NetworkInterrupt2 NetworkInterrupt3 NetworkInterrupt4 (InitInterrupt) BadDataInterrupt RXFIFOFull Interrupt RoguePacket DetectedandRemoved Interrupt RXFIFOAlmostFull Interrupt SyncLossOccurred Interrupt MemoryWriteInhibited MemoryParityError

EventID
RFM2GEVENT_RESET RFM2GEVENT_INTR1 RFM2GEVENT_INTR2 RFM2GEVENT_INTR3 RFM2GEVENT_INTR4 RFM2GEVENT_BAD_DATA RFM2GEVENT_RXFIFO_FULL RFM2GEVENT_ROGUE_PKT

RFM2GEVENT_RXFIFO_AFULL RFM2GEVENT_SYNC_LOSS RFM2GEVENT_MEM _WRITE_INHIBITED RFM2GEVENT_LOCAL _MEM_PARITY_ERR

70 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPEN Deviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_EVENT_NOT_IN_USENowaitispendingfortheevent. RFM2G_BAD_PARAMETER_2InvalidEventType.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


result = RFM2gCancelWaitForEvent(Handle, RFM2GEVENT_INTR1);

RelatedCommands RFM2gEnableEvent() RFM2gDisableEvent() RFM2gClearEvent() RFM2gSendEvent() RFM2gWaitForEvent() RFM2gEnableEventCallback() RFM2gDisableEventCallback()

Application Program Interface (API) Library 71

1.8.9 RFM2gClearEventCount()
TheRFM2gClearEventCount()functionclearseventcountsforaspecifiedevent orallevents. Syntax
STDRFM2GCALL RFM2gClearEvent( RFM2GHANDLE rh, RFM2GEVENTTYPE EventType );

Parameters
rh EventType

HandletoopenRFM2gdevice(I). Theeventcounttoclear(I). InterruptscorrelatetothefollowingeventIDs:

Interrupt
ResetInterrupt NetworkInterrupt1 NetworkInterrupt2 NetworkInterrupt3 NetworkInterrupt4 (InitInterrupt) BadDataInterrupt RXFIFOFull Interrupt RoguePacket DetectedandRemoved Interrupt RXFIFOAlmostFull Interrupt SyncLossOccurred Interrupt MemoryWriteInhibited MemoryParityError Allinterrupts

EventID
RFM2GEVENT_RESET RFM2GEVENT_INTR1 RFM2GEVENT_INTR2 RFM2GEVENT_INTR3 RFM2GEVENT_INTR4 RFM2GEVENT_BAD_DATA RFM2GEVENT_RXFIFO_FULL RFM2GEVENT_ROGUE_PKT

RFM2GEVENT_RXFIFO_AFULL RFM2GEVENT_SYNC_LOSS RFM2GEVENT_MEM _WRITE_INHIBITED RFM2GEVENT_LOCAL _MEM_PARITY_ERR RFM2GEVENT_LAST

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPEN Deviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2InvalidEventType. RFM2G_DRIVER_ERRORInternaldrivererror.

72 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


result = RFM2gClearEvent(Handle, RFM2GEVENT_INTR1);

RelatedCommands RFM2gEnableEvent() RFM2gDisableEvent() RFM2gSendEvent() RFM2gWaitForEvent() RFM2gCancelWaitForEvent() RFM2gEnableEventCallback() RFM2gDisableEventCallback()

Application Program Interface (API) Library 73

1.8.10 RFM2gGetEventCount()
TheRFM2gGetEventCount()functionreturnstheeventcountforaspecified event. Syntax
STDRFM2GCALL RFM2gGetEventCount(RFM2GHANDLE rh, RFM2GEVENTTYPE EventType), RFM2G_UINT32 *Count);

Example:
RFM2G_UINT32 Count; result = RFM2gClearEvent(Handle, RFM2GEVENT_INTR1, &Count);

Parameters:
rh EventType

HandletoopenRFM2gdevice(I). TheeventFIFOtoclear(I). InterruptscorrelatetothefollowingeventIDs: Interrupt


ResetInterrupt NetworkInterrupt1 NetworkInterrupt2 NetworkInterrupt3 NetworkInterrupt4 (InitInterrupt) BadDataInterrupt RXFIFOFull Interrupt RoguePacket DetectedandRemoved Interrupt RXFIFOAlmostFull Interrupt SyncLossOccurred Interrupt MemoryWriteInhibited MemoryParityError

EventID
RFM2GEVENT_RESET RFM2GEVENT_INTR1 RFM2GEVENT_INTR2 RFM2GEVENT_INTR3 RFM2GEVENT_INTR4 RFM2GEVENT_BAD_DATA RFM2GEVENT_RXFIFO_FULL RFM2GEVENT_ROGUE_PKT

RFM2GEVENT_RXFIFO_AFULL RFM2GEVENT_SYNC_LOSS RFM2GEVENT_MEM _WRITE_INHIBITED RFM2GEVENT_LOCAL _MEM_PARITY_ERR

Count

Pointertowheretheeventcountofthespecifiedeventis written(O).

74 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROR OSreturnedanerror. RFM2G_NOT_OPEN Deviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2InvalidEventType. RFM2G_DRIVER_ERRORInternaldrivererror.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


result = RFM2gClearEvent(Handle, RFM2GEVENT_INTR1);

RelatedCommands RFM2gEnableEvent() RFM2gDisableEvent() RFM2gSendEvent() RFM2gWaitForEvent() RFM2gCancelWaitForEvent() RFM2gEnableEventCallback() RFM2gDisableEventCallback()

Application Program Interface (API) Library 75

1.9 RFM2g Utility API Functions


ThefollowingAPIfunctionsintherfm2g_api.hfileareutilityfunctionsthatare providedbytheRFM2gdriver.
Table 1-12 RFM2g Utility API Functions
API Function RFM2gErrorMsg() RFM2gGetLed() RFM2gSetLed() RFM2gCheckRingCont() RFM2gGetDebugFlags() RFM2gSetDebugFlags() RFM2gGetDarkOnDark() RFM2gSetDarkOnDark() RFM2gClearOwnData() RFM2gGetTransmit() RFM2gSetTransmit() RFM2gGetLoopback() RFM2gSetLoopback() RFM2gGetParityEnable() RFM2gSetParityEnable() RFM2gGetMemoryOffset() RFM2gSetMemoryOffset() RFM2gGetSlidingWindow() RFM2gSetSlidingWindow() Description Returns a pointer to a text string describing an error code. Retrieves the current ON/OFF state of the Reflective Memory board's STATUS LED. Sets the ON/OFF state of the Reflective Memory board's STATUS LED. Returns the fiber ring continuity through nodes. Retrieves a copy of all RFM2g device driver debug control flags. Sets or clears the device driver debug control flags. Retrieves the current ON/OFF state of the Reflective Memory boards Dark on Dark feature. Sets the ON/OFF state of the Reflective Memory boards Dark on Dark feature. Returns the state of the Own Data bit and resets the state if set. Calling this function will turn OFF the Own Data LED if ON. Retrieves the current ON/OFF state of the Reflective Memory boards transmitter. Sets the ON/OFF state of the Reflective Memory boards transmitter. Retrieves the current ON/OFF state of the Reflective Memory boards loopback of the transmit signal to the receiver circuit internally. Sets the ON/OFF state of the Reflective Memory boards loopback of the transmit signal to the receiver circuit internally. Retrieves the current ON/OFF state of the Reflective Memory boards parity checking on all onboard memory accesses. Sets the ON/OFF state of the Reflective Memory boards parity checking on all onboard memory accesses. Gets the memory offset of the Reflective Memory board. Sets the memory offset of the Reflective Memory board. Retrieves the base Reflective Memory offset and size of the current sliding window. Sets the base Reflective Memory offset of the sliding window.

76 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.9.1 RFM2gErrorMsg()
TheRFM2gErrorMsg()functionreturnsapointertoatextstringdescribinga runtimeerror. RuntimeerrorsaredetectedbytheAPI.Atextdescriptionoftheerrorisoutputto thescreenifdebugmodeisenabledandreturnsthestringthroughthereturn pointer. Syntax
char* RFM2gErrorMsg( RFM2G_STATUS ErrorCode );

Parameters
ErrorCode

ReturncodefromanAPIfunction(I).

ReturnValues char* Theaddresspointingtoacharacterstringthatdescribesthe errorparameter.Thefollowingstringisreturnedifaninvalid ErrorCodeispassed:


UNKNOWN RFM2G ERROR [%d] where[%d]istheErrorCodevalue.

Failure Example

ANULLpointer.

Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


result = RFM2G_SUCCESS; printf(RFM2g Error Message : %s\n, RFM2gErrorMsg(result));

Application Program Interface (API) Library 77

1.9.2 RFM2gGetLed()
TheRFM2gGetLed()functionretrievesthecurrentON/OFFstateoftheReflective MemoryboardsSTATUSLED. Syntax
STDRFM2GCALL RFM2gGetLed( RFM2GHANDLE rh, RFM2G_BOOL *Led );

Parameters
rh Led

HandletoopenRFM2gdevice(I). PointertowherethestateoftheSTATUSLEDiswritten (RFM2G_ONwhentheLEDisON,orRFM2G_OFFwhenthe LEDisOFF)(O).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rh isNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTED APIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2LedisNULL.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_BOOL Led; result = RFM2gGetLed(Handle, &Led);

RelatedCommands RFM2gSetLed()

78 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.9.3 RFM2gSetLed()
TheRFM2gSetLed()functionsetsthecurrentON/OFFstateoftheReflective MemoryboardsSTATUSLED. Syntax
STDRFM2GCALL RFM2gSetLed( RFM2GHANDLE rh, RFM2G_BOOL Led );

Parameters
rh Led

HandletoopenRFM2gdevice(I). ThestateoftheFailLED:RFM2G_FALSE=>OFF, RFM2G_TRUE=>ON(I).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPEN Deviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver. Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


result = RFM2gSetLed(Handle, RFM2G_TRUE);

RelatedCommands RFM2gGetLed()

Application Program Interface (API) Library 79

1.9.4 RFM2gCheckRingCont()
TheRFM2gCheckRingCont()functionisadiagnosticaidthatshowswhetheror notthefiberringiscontinuousthroughallnodesinthering.Nodataiswrittento theReflectiveMemorylocations. Syntax
STDRFM2GCALL RFM2gCheckRingCont( RFM2GHANDLE rh );

Parameters
rh

HandletocurrentlyopenedRFM2gdevice(I).

ReturnValues Success Failure


RFM2G_SUCCESS Linkisclosedandintact. RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_LINK_TEST_FAILLinkisopen. RFM2G_DRIVER_ERRORInternaldrivererror.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


result = RFM2gCheckRingCont(Handle); if(result == RFM2G_SUCCESS) { printf(Ring Intact); }

80 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.9.5 RFM2gGetDebugFlags() NOTE


Application programs should not use this function unless directed to do so by GE support personnel.

TheRFM2gGetDebugFlags()functionreturnsacopyofthecurrentsettingofthe debugflagsofthedevicedriver.TheRFM2gdevicedrivercangeneratedebug messagesbycheckingabitinthedriversdebugflagsvariable. Amaximumof32debugmessageclassesarepossible.Eachdebugmessageclass isassignedtoanindividualbitwithinthis32bitcontrolword.Anonzerobit impliesthatthecorrespondingdebugmessageclasscanbegeneratedbythe RFM2gdevicedriver. Syntax


STDRFM2GCALL RFM2gGetDebugFlags( RFM2GHANDLE rh, RFM2G_UNIT32 *Flags )

Parameters
rh Flags

HandletocurrentlyopenedRFM2gdevice(I). Pointertowheredebugflagsarewritten(O).Thefollowingare possibledebugflags: DebugFlag


RFM2G_DBERROR RFM2G_DBINIT RFM2G_DBINTR RFM2G_DBIOCTL RFM2G_DBMMAP RFM2G_DBOPEN RFM2G_DBCLOSE RFM2G_DBREAD RFM2G_DBWRITE RFM2G_DBPEEK RFM2G_DBPOKE RFM2G_DBSTRAT RFM2G_DBTIMER RFM2G_DBTRACE RFM2G_DBMUTEX RFM2G_DBINTR_NOT RFM2G_DBSLOW RFM2G_DBMINPHYS

Description
Reportcriticalerrors Tracedeviceprobingandsearch Traceinterruptservice Traceioctl(2)systemcalls Tracemmap(2)systemcalls Traceopen(2)systemcalls Traceclose(2)systemcalls Traceread(2)systemcalls Tracewrite(2)systemcalls Tracepeeks Tracepokes Traceread/writestrategy Traceintervaltimer Tracesubroutineentry/exit Tracesynchronizationand locking TracenonRFMinterruptservice Letsyslogdgetthemessage Traceminphyslimits
Application Program Interface (API) Library 81

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2 FlagsisNULL.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UINT32 lFlag; result = RFM2gGetDebugFlags(Handle, &lFlag);

RelatedCommands RFM2gSetDebugFlags()

82 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.9.6 RFM2g SetDebugFlags() NOTE


Application programs should not use this function unless directed to do so by GE support personnel.

EachpossibleRFM2gdevicedriverdebugoutputmessageisassignedtoadebug messageclass.Thedevicedriverwillgeneratemessagesofthatclassifthe correspondingflagbitissetinthecontrolword.TheRFM2gSetDebugFlags() functionallowsanapplicationprogramtosetthatcontrolword(i.e.this commandsetsthedriversdebugflags). Applicationprogramsdonotnormallyneedtoalterthesettingofthedebug messageoutputcontrolword.Insomecases,enablingdebugflagscanseverely impacttheperformanceofthehostsystem. Operation TheRFM2gSetDebugFlags()functionspecifiesthenewdebugmessagecontrol word.Thechangeiseffectiveimmediately. Syntax
STDRFM2GCALL RFM2gSetDebugFlags( RFM2GHANDLE rh, RFM2G_UNIT32 Flags );

Application Program Interface (API) Library 83

Parameters
rh Flags

HandletocurrentlyopenedRFM2gdevice(I). Debugflags(I).Thefollowingarepossibledebugflagstoset:

DebugFlag RFM2G_DBERROR RFM2G_DBINIT RFM2G_DBINTR RFM2G_DBIOCTL RFM2G_DBMMAP RFM2G_DBOPEN RFM2G_DBCLOSE RFM2G_DBREAD RFM2G_DBWRITE RFM2G_DBPEEK RFM2G_DBPOKE RFM2G_DBSTRAT RFM2G_DBTIMER RFM2G_DBTRACE RFM2G_DBMUTEX RFM2G_DBINTR_NOT RFM2G_DBSLOW

Description Reportcriticalerrors Tracedeviceprobingandsearch Traceinterruptservice Traceioctl(2)systemcalls Tracemmap(2)systemcalls Traceopen(2)systemcalls Traceclose(2)systemcalls Traceread(2)systemcalls Tracewrite(2)systemcalls Tracepeeks Tracepokes Traceread/writestrategy Traceintervaltimer Tracesubroutineentry/exit Tracesynchronizationand locking TracenonRFMinterruptservice Letsyslogdgetthemessage

RFM2G_DBMINPHYSTraceminphyslimits RFM2G_DBDMATraceDMAcalls ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.

84 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UNIT32 lFlag = RFM2G_DBERROR; result = RFM2gSetDebugFlags(Handle, lFlag);

RelatedCommands RFM2gGetDebugFlags()

1.9.7 RFM2gGetDarkOnDark()
TheRFM2gGetDarkOnDark()functionretrievesthecurrentON/OFFstateofthe ReflectiveMemoryboardsDarkOnDarkfeature. Syntax
STDRFM2GCALL RFM2gGetDarkOnDark( RFM2GHANDLE rh, RFM2G_BOOL *state );

Parameters
rh state

HandletoopenRFM2gdevice(I). PointertowherethestateoftheDarkonDarkfeatureis written(RFM2G_ONwhentheDarkOnDarkisON,or RFM2G_OFFwhentheDarkOnDarkisOFF)(O).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2StateisNULL.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_BOOL DarkOnDark; result = RFM2gGetDarkOnDark(Handle, &DarkOnDark);

RelatedCommands RFM2gSetDarkOnDark()

Application Program Interface (API) Library 85

1.9.8 RFM2gSetDarkOnDark()
TheRFM2gSetDarkOnDark()functionsetsthecurrentON/OFFstateofthe ReflectiveMemoryboardsDarkOnDarkfeature. Syntax
STDRFM2GCALL RFM2gSetDarkOnDark( RFM2GHANDLE rh, RFM2G_BOOL state );

Parameters
rh state

HandletoopenRFM2gdevice(I). ThestateoftheDarkOnDark:RFM2G_FALSE=>OFF, RFM2G_TRUE=>ON(I).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver. Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


result = RFM2gSetDarkOnDark(Handle, RFM2G_TRUE);

RelatedCommands RFM2gGetDarkOnDark()

86 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.9.9 RFM2gClearOwnData()
TheRFM2gClearOwnData()functionretrievesthecurrentON/OFFstateofthe ReflectiveMemoryboardsOwnDatabitandresetsthestateifset.Callingthis functionwillturnOFFtheOwnDataLEDifON. Syntax
STDRFM2GCALL RFM2gClearOwnData( RFM2GHANDLE rh, RFM2G_BOOL *state );

Parameters
rh state

HandletoopenRFM2gdevice(I). PointertowherethestateoftheOwnDataLEDfeatureis written(RFM2G_ONwhentheOwnDataLEDisON,or RFM2G_OFFwhentheOwnDataLEDisOFF)(O).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NOT_OPENDeviceisnotopen. RFM2G_BAD_PARAMETER_1ifthehandleisNULL RFM2G_BAD_PARAMETER_2 ifthestateisNULL RFM2G_OS_ERRORifioctl(2)fails

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_BOOL OwnData; result = RFM2gClearOwnData(Handle, OwnData);

Application Program Interface (API) Library 87

1.9.10 RFM2gGetTransmit()
TheRFM2gGetTransmit()functionretrievesthecurrentON/OFFstateofthe ReflectiveMemoryboardsTransmitter. Syntax
STDRFM2GCALL RFM2gGetTranmit( RFM2GHANDLE rh, RFM2G_BOOL *state);

Parameters
rh state

HandletoopenRFM2gdevice(I). PointertowherethestateoftheTransmitteriswritten (RFM2G_ONwhentheTransmitterisON,orRFM2G_OFF whentheTransmitterisOFF)(O).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROR OSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTED APIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2 StateisNULL.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_BOOL Transmit; result = RFM2gGetTransmit(Handle, &Transmit);

RelatedCommands RFM2gSetTransmit()

88 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.9.11 RFM2gSetTransmit()
TheRFM2gSetTransmit()functionsetsthecurrentON/OFFstateoftheReflective MemoryboardsTransmitter. Syntax
STDRFM2GCALL RFM2gSetTransmit( RFM2GHANDLE rh, RFM2G_BOOL state);

Parameters
rh state

HandletoopenRFM2gdevice(I). ThestateoftheTransmitter:RFM2G_FALSE=>OFF, RFM2G_TRUE=>ON(I).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver. Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


result = RFM2gSetTransmit(Handle, RFM2G_TRUE);

RelatedCommands RFM2gGetTransmit()

Application Program Interface (API) Library 89

1.9.12 RFM2gGetLoopback()
TheRFM2gGetLoopback()functionretrievesthecurrentON/OFFstateofthe ReflectiveMemoryboardsloopbackofthetransmitsignaltothereceivercircuit internally. Syntax
STDRFM2GCALL RFM2gGetLoopback( RFM2GHANDLE rh, RFM2G_BOOL *state );

Parameters
rh state

HandletoopenRFM2gdevice(I). PointertowherethestateoftheLoopbackiswritten (RFM2G_ONwhentheLoopbackisON,orRFM2G_OFFwhen theLoopbackisOFF)(O).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROR OSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTED APIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2StateisNULL.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_BOOL Loopback; result = RFM2gGetLoopback(Handle, &Loopback);

RelatedCommands RFM2gSetLoopback()

90 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.9.13 RFM2gSetLoopback()
TheRFM2gSetLoopback()functionsetsthecurrentON/OFFstateoftheReflective Memoryboardsloopbackofthetransmitsignaltothereceivercircuitinternally. Syntax
STDRFM2GCALL RFM2gSetLoopback( RFM2GHANDLE rh, RFM2G_BOOL state );

Parameters
rh state

HandletoopenRFM2gdevice(I). ThestateoftheLoopback:RFM2G_FALSE=>OFF, RFM2G_TRUE=>ON(I).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTOR rhisNULL. RFM2G_OS_ERROR OSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver. Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


result = RFM2gSetLoopback(Handle, RFM2G_TRUE);

RelatedCommands RFM2gSetLoopback()

Application Program Interface (API) Library 91

1.9.14 RFM2gGetParityEnable()
TheRFM2gGetParityEnable()functionretrievesthecurrentON/OFFstateofthe ReflectiveMemoryboardsparitycheckingonallonboardmemoryaccesses. Syntax
STDRFM2GCALL RFM2gGetParityEnable( RFM2GHANDLE rh, RFM2G_BOOL *state );

Parameters
rh state

HandletoopenRFM2gdevice(I). PointertowherethestateoftheParityEnableiswritten (RFM2G_ONwhentheParityEnableisON,orRFM2G_OFF whentheParityEnableisOFF)(O).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROR OSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTEDAPIfunctionisnotimplemented

inthedriver.
RFM2G_BAD_PARAMETER_2StateisNULL.

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_BOOL ParityEnable; result = RFM2gGetParityEnable(Handle, &ParityEnable);

RelatedCommands RFM2gSetParityEnable()

92 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.9.15 RFM2gSetParityEnable()
TheRFM2gSetParityEnable()functionsetsthecurrentON/OFFstateofthe ReflectiveMemoryboardsparitycheckingonallonboardmemoryaccesses. Syntax
STDRFM2GCALL RFM2gSetParityEnable( RFM2GHANDLE rh, RFM2G_BOOL state );

Parameters
rh state

HandletoopenRFM2gdevice(I). PointertowherethestateoftheSetParityEnablefeatureis written(RFM2G_ONwhentheSetParityEnableisON,or RFM2G_OFFwhentheSetParityEnableisOFF)(I).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NULL_DESCRIPTORrhisNULL. RFM2G_OS_ERROROSreturnedanerror. RFM2G_NOT_OPENDeviceisnotopen. RFM2G_NOT_IMPLEMENTED APIfunctionisnotimplemented

inthedriver. Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


result = RFM2gSetParityEnable(Handle, RFM2G_TRUE);

RelatedCommands RFM2gGetParityEnable()

Application Program Interface (API) Library 93

1.9.16 RFM2gGetMemoryOffset()
TheRFM2gGetMemoryOffset()functionretrievestheReflectiveMemoryboards memorywindow. Syntax
STDRFM2GCALL RFM2gGetMemoryOffset( RFM2GHANDLE rh, RFM2G_MEM_OFFSETTYPE *Offset);

Parameters
rh Offset

HandletoopenRFM2gdevice(I). Pointertowherethecurrentoffsettothenetworkaddressis written(O).

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NOT_OPENifthedevicehasnotyetbeenopened. RFM2G_BAD_PARAMETER_1 ifthehandleisNULL RFM2G_BAD_PARAMETER_2 iftheoffsetisNULL RFM2G_OS_ERROR ifIOCTL(2)fails

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_MEM_OFFSETTYPE MemoryOffset; result = RFM2gGetMemoryOffset(Handle, &MemoryOffset);

RelatedCommands RFM2gSetMemoryOffset()

94 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.9.17 RFM2gSetMemoryOffset()
TheRFM2gSetMemoryOffset()functionsetstheReflectiveMemoryboards memorywindow. Syntax
STDRFM2GCALL RFM2gSetMemoryOffset( RFM2GHANDLE rh, RFM2G_MEM_OFFSETTYPE offset);

Parameters
rh Offset

HandletoopenRFM2gdevice(I) Theoffsettothenetworkaddress(I) ValidOffsets RFM2G_MEM_OFFSET0 RFM2G_MEM_OFFSET1 RFM2G_MEM_OFFSET2 RFM2G_MEM_OFFSET3 Description 1st64MegabyteMemoryOffset 2nd64MegabyteMemoryOffset 3rd64MegabyteMemoryOffset 4th64MegabyteMemoryOffset

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NOT_OPENifthedevicehasnotyetbeenopened. RFM2G_BAD_PARAMETER_1ifthehandleisNULL RFM2G_BAD_PARAMETER_2iftheoffsetisNULL RFM2G_OS_ERRORifIOCTL(2)fails

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


result = RFM2gSetLed(Handle, RFM2G_TRUE);

RelatedCommands RFM2gGetMemoryOffset()

Application Program Interface (API) Library 95

1.9.18 RFM2gGetSlidingWindow()
TheRFM2gGetSlidingWindow()functionretrievesthebaseReflectiveMemory offsetandsizeofthecurrentslidingmemorywindow. Syntax
STDRFM2GCALL RFM2gGetSlidingWindow(RFM2GHANDLE rh, RFM2G_UINT32 *offset, RFM2G_UINT32 *size);

Parameters
rh offset size

HandletoopenRFM2gdevice(I) Offsetofthecurrentslidingmemorywindow(O) Sizeofthecurrentslidingmemorywindowinbytes.Maybe settoNULLifthesizeisnotrequested.(O)

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NOT_OPENifthedevicehasnotyetbeenopened. RFM2G_NOT_SUPPORTEDiftheSlidingMemoryWindow

featureisnotsupportedbytheReflectiveMemoryboards firmware.
RFM2G_BAD_PARAMETER_1ifthehandleisNULL RFM2G_BAD_PARAMETER_2iftheoffsetisNULL RFM2G_OS_ERRORifregisteraccessesfail

Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UINT32 offset, size;

Result = RFM2gGetSlidingWindow(Handle, &offset, &size);

RelatedCommands RFM2gSetSlidingWindow()

96 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

1.9.19 RFM2gSetSlidingWindow()
TheRFM2gSetSlidingWindow()functionsetsthebaseReflectiveMemoryoffset oftheslidingmemorywindow.Thesizeoftheslidingwindowissetwith switchesorjumpersontheReflectiveMemoryboard.Theavailablewindowsizes are2MByte,16MByte,64MByte,andthetotalmemorysize.Theoffsetofthe slidingwindowmustbeamultipleofthesizeoftheslidingwindow. Syntax
STDRFM2GCALL RFM2gSetSlidingWindow(RFM2GHANDLE rh, RFM2G_UINT32 offset);

Parameters
rh offset

HandletoopenRFM2gdevice(I) Offsetoftheslidingmemorywindow(I)

ReturnValues Success Failure


RFM2G_SUCCESS RFM2G_NOT_OPENifthedevicehasnotyetbeenopened. RFM2G_NOT_SUPPORTEDiftheSlidingMemoryWindow featureisnotsupportedbytheReflectiveMemoryboards firmware. RFM2G_BAD_PARAMETER_1ifthehandleisNULL RFM2G_BAD_PARAMETER_2iftheoffsetisnotamultipleofthe

windowsize.
RFM2G_OUT_OF_RANGEiftheoffsetandwindowsizeexceed

theReflectiveMemoryboardsmemorysize.
RFM2G_OS_ERRORifregisteraccessesfail RFM2G_DRIVER_ERRORifthedriverreturnsaninvalidwindow

size. Example Usethefollowingcodebyinsertingitintotheexampleroutineinsection 1.2.2 RoutineCodeforUsewithAPIFunctionExamples,page12:


RFM2G_UINT32 offset = 0x00400000; /* A valid offset for a 2MB window */ Result = RFM2gSetSlidingWindow(Handle, offset);

RelatedCommands RFM2gGetSlidingWindow()

Application Program Interface (API) Library 97

2 rfm2g_util.c Utility Program


2.1 Introduction
TheRFM2gdriverisdeliveredwithacommandlineinterpreter(rfm2g_util.c) thatenablesyoutoexercisevariousRFM2gcommandsbyenteringcommandsat thestandardinput(usuallytheconsolekeyboard).Theutilityprovidesa convenientmethodofaccessingmostoftheservicesprovidedbythedriver.

2.2 RFM2g Command Line Interpreter


Therfm2g_util.ccommandlineinterpreterprogramisautilitythatenablesyou tovieworchangethecontentsofaRFM2gboardandprovidesaneasymethodof operatingthedevicedriver. Noprogrammingisrequiredtousethecommandlineinterpreterprogram. Instead,simpleASCIItextcommandsareused.Asinglecommandmaybegiven onacommandlinewhenthecommandlineinterpreterprogramisrunning,or multiplecommandsmaybereadfromthestandardinputfile. ReflectiveMemorycanbedisplayedorchanged.RFM2ginterrupteventsmaybe sentorreceived.TheprogramalsoallowsasynchronousnotificationofRFM interruptevents. ThecommandlineinterpreterprogramiscodedintheANSIdialectoftheC language.Thesourcecodefortheprogramisprovidedtoserveasanexampleof howtousethelanguagebindingsprovidedbythedriverandtheDLLorlibrary.

2.2.1 Using the Command Line Interpreter


Thecommandlineinterpreterprogramisnotcasesensitive,souppercaseand lowercasecharactersmaybeintermixedatwillandwillnotaffectexecution.In addition,thecommandlineinterpreterprogramattemptstoreducetheamountof typingthatmaybenecessary.Wheneverakeywordisrequired(suchasa commandname),onlythefirstfewcharactersneedtobetypedtouniquely identifythecommand.Ifyoudonottypeenoughcharactersforthecommandline interpretertoselectasinglecommand,allofthepossiblecommandswillbe listed,alongwithanothercommandprompt. Forexample,fivecommandsinthecommandlineinterpreterprogrambeginwith thecharacterd(thedevname,disableevent,disablecallback,dllversionand driverversioncommands).However,thefirsttwolettersofthedevname commandwillspecifyitasauniquecommandtothecommandlineinterpreter. So,insteadofhavingtotype:
devname

onlythefirsttwolettersneedstobetyped:
de

98 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

Ifthetypedcharactersarenotenoughtouniquelyidentifythecommand,the commandlineinterpreteroutputsanerrormessageandshowsatableofthe possiblenames.Sincetherearefivecommandsthatbeginwiththeletterd,the typedinput:


d

producesthismessage:
d Ambiguous command 'd'. This could be devname disableevent disablecallback dllversion driverversion

Notes On Entering Numbers


Wheneverthecommandlineinterpreterexpectsanumber,anyClanguagestyle numbermaybeused.Ifitbeginswith0x,ahexadecimalvaluefollows;ifitbegins witha0,anoctalvaluefollows;otherwise,thenumberisassumedtobedecimal.

Notes On Device Numbers


Whentherfm2g_util.cutilityisstarted,youwillbepromptedforadevice number.RefertoyourdriverspecificmanualforthecorrectRFM2gdevice numbertouse. Onceadevicenumberhasbeenentered,itdisplaysnexttotheutilityprompt.In thefollowingexample,boardnumber0hasbeenentered:
UTIL0 >

rfm2g_util.c Utility Program 99

2.2.2 Command Line Interpreter Example


Thefollowingisanexampleworkflowillustratinghowthecommandline interpreterprogramcanbeused.Examplesarealsoprovidedwiththe descriptionsofindividualcommandswithinthecommandlineinterpreter. 1. Starttheutilityprogrambyfollowingthedirectionsinyourdriverspecific manual.Thefollowingisdisplayedintheconsolewindow:
PCI RFM2g Commandline Diagnostic Utility Please enter device number:

2. TypeanRFM2gdevicenumberandpress<ENTER>.

NOTE

Refer to your driver-specific manual for the correct RFM2g device number to use.

Apromptdisplaysthatincludesthedevicenumber.Forexample,ifyou entered0:
UTIL0 >

3. ViewthecontentsofRFM2gmemoryatoffset0x0byentering:
peek8 0x0

4. Observetheoutput. 5. Exitthecommandlineinterpreterprogrambyentering:
quit

Thefollowingpromptdisplays:
Exit? (y/n):

6. Enterytoconfirm.

100 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3 Utility Commands


Thecommandswhichareimplementedinthecommandlineinterpreterprogram aredescribedanddemonstratedinthissection. Thetablebelowlistseachcommandincludedinthecommandlineinterpreter andashortdescriptionofeach.
Table 2-1 RFM2g Driver Commands
Command boardid cancelwait checkring clearevent cleareventcount clearowndata config devname disableevent disablecallback dllversion driverversion drvspecific dump enableevent enablecallback errormsg exit first getdarkondark getdebug getdmabyteswap geteventcount getled getmemoryoffset getloopback getparityenable getpiobyteswap getslidingwindow getthreshold gettransmit help mapuser Description Returns the board ID of the currently opened RFM2g device. Cancels any pending calls for a specified event type. Returns the fiber ring continuity through all nodes in a ring. Clear any pending events for a specified event. Clear one or all interrupt event counts. The Reflective Memory boards Own Data LED was OFF. Display RFM2g board configuration information. Returns the device name associated with a RFM2g handle. Disables the reception of a specified RFM2g interrupt event. Disables the interrupt notification for a specified event notification. Returns the DLL or library version. Returns the RFM2g device driver version. Enter a driver-specific menu. Peek and display an area of Reflective Memory. Enable the receiving of a specified RFM2g event. Enables the interrupt notification for a specified event. Prints a text string describing an error code. Terminate the command line interpreter program. Returns the first available RFM2g offset. Returns the state of the RFM2g Dark on Dark feature. Retrieves a copy of all RFM2g device driver debug message class control flags. Returns the state of DMA byte swapping hardware. Retrieves the count of received interrupt events. Retrieves the current ON/OFF state of the Reflective Memory board's STATUS LED. Gets the memory offset of the Reflective Memory board. Retrieves the current ON/OFF state of the Reflective Memory boards loopback of the transmit signal to the receiver circuit internally. Retrieves the current ON/OFF state of the Reflective Memory boards parity checking on all onboard memory accesses. Returns the state of PIO byte swapping hardware. Get the offset and size of the current Sliding Window. Returns the current DMA threshold value. Retrieves the current ON/OFF state of the Reflective Memory boards transmitter. Display command help. Retrieves RFM2g memory information or maps RFM2g memory to the user space.

rfm2g_util.c Utility Program 101

Table 2-1 RFM2g Driver Commands (Continued)


Command mapuserbytes memop nodeid peek8, peek16, peek32 and peek64 performancetest poke8, poke16, poke32 and poke64 quit read repeat return send setdarkondark setdebug setdmabyteswap setled setloopback setmemoryoffset setparityenable setpiobyteswap setslidingwindow setthreshold settransmit size unmapuser unmapuserbytes wait write Description Retrieves RFM2g memory byte information or maps RFM2g memory bytes to the user space. Fill or verify an area of Reflective Memory. Returns the RFM2g device node ID. Peek an element from RFM2g memory. Display the speed of system reads and writes. Poke an element to RFM2g memory. Terminate the command line interpreter program. Reads memory contents starting at the specified offset in Reflective Memory and dumps data read to output. Repeat a command line interpreter command. Exit a driver-specific sub-menu. Sends an RFM2g interrupt event to another node. Sets the ON/OFF state of the Reflective Memory boards Dark on Dark feature. Sets the drivers debug display word (i.e. debug flags). Sets the ON/OFF state of DMA byte swapping hardware. Sets the current ON/OFF state of the Reflective Memory board's STATUS LED. Sets the ON/OFF state of the Reflective Memory boards loopback of the transmit signal to the receiver circuit internally. Sets the memory offset of the Reflective Memory board. Sets the ON/OFF state of the Reflective Memory boards parity checking on all onboard memory accesses. Sets the ON/OFF state of PIO byte swapping hardware. Set the offset of the Sliding Window. Sets the transfer size at which reads and writes will use DMA. Sets the ON/OFF state of the Reflective Memory boards transmitter. Returns the total amount of virtual memory space available on the RFM2g device. Unmaps RFM2g buffer memory from the user space. Unmaps RFM2g buffer memory from the user space. Blocks the calling process until an occurrence of an RFM2g interrupt event is received or a timeout expires. Writes a value starting at the specified offset in Reflective Memory.

102 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.1 boardid
TheboardidcommandreturnstheRFM2ginterfacemodeltype.EachRFM2g interfacemodeltypeisuniquelyidentifiedbyanumericvalueassignedby GEandrecordedasafixedconstantinanRFM2ghardwareregister.Thedriver andsupportlibraryreadthisvaluewhenthedeviceisopened.Theutilitycalls RFM2gBoardID() toobtaintheRFM2gboardID. Syntax
boardid

Example
UTIL0 > boardid Board ID UTIL0 > 0x65 (VMIPCI-5565)

2.3.2 cancelwait
Thecancelwaitcommandcancelsanypendingcallsonanevent.Ifacallbackhas beenregisteredtothespecifiedevent,thecallbackwillbecanceled.Theutility calls RFM2gCancelWaitForEvent() tocancelthependingcalls. Syntax
cancelwait event

Parameters
event

Specifieswhichinterrupteventtocancel(I). InterruptscorrelatetothefollowingeventIDs: Interrupt


ResetInterrupt NetworkInterrupt1 NetworkInterrupt2 NetworkInterrupt3 NetworkInterrupt4(InitInterrupt) BadDataInterrupt RXFIFOFullInterrupt RoguePacketDetectedandRemoved RXRIFOAlmostFull SYNCLoss MemWriteInhibited LocalMemParityError AllEvents

EventID
0 1 2 3 4 5 6 7 8 9 10 11 12

Example
UTIL0 > cancelwait 1 RFM2gWaitForEvent has been canceled for the "NETWORK INT 1" event. UTIL0 >

rfm2g_util.c Utility Program 103

2.3.3 checkring
Thecheckringcommandisadiagnosticaidthatshowswhetherornotthefiber ringiscontinuousthroughallnodesinthering.Nodataiswrittentothe ReflectiveMemorylocations.TheutilitycallsRFM2gCheckRingCont()toobtain theRFM2gringstatus. Syntax
checkring

Example
UTIL0 > checkring The Reflective Memory link is intact UTIL0 >

2.3.4 clearevent
Thecleareventcommandclearsallpendinginterrupteventsforaspecifiedevent. TheutilitycallsRFM2gClearEvent()function. Syntax
clearevent event

Parameters
event

TheeventFIFOtoclear(I),whichisoneofthefollowing: NumberEventtoClear
0RESET 1NETWORKINT1 2NETWORKINT2 3NETWORKINT3 4NETWORKINT4 5BADDATA 6FIFOFULL 7ROGUEPACKET 8RXFIFOALMOSTFULL 9SYNCLOSS 10MEMWRITEINHIBITED 11LOCALMEMPARITYERROR 12ALLEVENTS

Example
UTIL0 > clearevent 0 The "RESET" interrupt event was flushed. UTIL0 >

104 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.5 cleareventcount
Thecleareventcountcommandclearseventcountsforaspecifiedeventorall events.Theutilitycalls RFM2gClearEventCount()function. Syntax
cleareventcount event

Parameters
event

Whereeventisoneofthefollowinginterruptsevents[012]: NumberEventtoClear
0RESET 1NETWORKINT1 2NETWORKINT2 3NETWORKINT3 4NETWORKINT4 5BADDATA 6RXFIFOFULL 7ROGUEPACKET 8RXFIFOALMOSTFULL 9SYNCLOSS 10MEMWRITEINHIBITED 11LOCALMEMPARITYERROR 12ALLEVENTS

Example
Please enter device Number: 0 UTIL0 > cleareventcount 0 The "RESET" interrupt event count cleared. UTIL0 >

2.3.6 clearowndata
TheclearowndatacommandturnstheReflectiveMemoryboardsOwnDataLED OFF.TheutilitycallsRFM2gClearOwnData() function. Syntax
clearowndata

Example
UTIL0 > cleareventcount The Reflective Memory boards Own Data LED was turned off. UTIL0 >

rfm2g_util.c Utility Program 105

2.3.7 config
TheconfigcommandwilldisplaythevaluesofmembersintheRFM2GCONFIG structure.Theutilitycalls RFM2gGetConfig() toobtaintheRFM2GCONFIG structure. Syntax
config

Example
UTIL0 > config Driver Part Number Driver Version Device Name Board Instance Board ID Node ID Installed Memory Board Revision PLX Revision UTIL0 > "VMISFT-RFM2G-ABC-037" "RELEASE 2.00" "RFM2G_0" 0 0x65 0x01 134217728d (0x08000000) 0x04 0xAD

2.3.8 devname
Thedevnamecommanddisplaysastringcontainingthefirst64charactersofthe devicenameassociatedwithaRFM2gfilehandle.Theutilitycalls RFM2gDeviceName() toobtaintheRFM2gdevicename. Syntax
devname

Example
UTIL0 > devname Device Name: UTIL0 > "rfm2g_0

106 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.9 disableevent
ThedisableeventcommanddisablesthereceptionofanRFM2gevent.Theutility callsRFM2gDisableEvent()todisabletheevent. Syntax
disableevent event

Parameters
event

Specifieswhichinterrupteventtodisable(I).Interrupts correlatetothefollowingeventIDs: Interrupt


ResetInterrupt NetworkInterrupt1 NetworkInterrupt2 NetworkInterrupt3 NetworkInterrupt4(InitInterrupt) BadDataInterrupt RXFIFOFullInterrupt RoguePacketDetectedandRemoved RXRIFOAlmostFull SYNCLoss MemWriteInhibited LocalMemParityError

EventID
0 1 2 3 4 5 6 7 8 9 10 11

Example
UTIL0 > disableevent 0 Interrupt event "RESET" is disabled. UTIL0 >

rfm2g_util.c Utility Program 107

2.3.10 disablecallback
Thedisablecallbackcommanddisableseventnotificationforaspecifiedevent. TheutilitycallsRFM2gDisableEventCallback()todisableeventnotification. Syntax
disablecallback event

Parameters
event

Specifieswhicheventnotificationtodisable(I).Events correlatetothefollowingeventIDs: Interrupt


ResetInterrupt NetworkInterrupt1 NetworkInterrupt2 NetworkInterrupt3 NetworkInterrupt4(InitInterrupt) BadDataInterrupt RXFIFOFullInterrupt RoguePacketDetectedandRemoved RXRIFOAlmostFull SYNCLoss MemWriteInhibited LocalMemParityError

EventID
0 1 2 3 4 5 6 7 8 9 10 11

Example
UTIL0 > disableevent 1 Interrupt event "NETWORK INT 1" is disabled. UTIL0 >

2.3.11 dllversion
ThedllversioncommanddisplaysanASCIIstringshowingtheversionofthe DLLorAPIlibrary.Thisstringcontainstheproductionreleaselevelofthelibrary andisuniquebetweendifferentversionsoftheAPIlibrary.Theutilitycalls RFM2gDllVersion() toreturnthelibraryversion. Syntax
dllversion

Example
UTIL0 > dllversion Dll Version: UTIL0 > "R01.00"

108 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.12 driverversion
ThedriverversioncommanddisplaysanASCIIstringshowingtheGE productionreleaseversionoftheunderlyingRFM2gdevicedriver.Theutility callsRFM2gDriverVersion() toreturnthedriverversion. Syntax
driverversion

Example
UTIL0 > driverversion Driver Version: UTIL0 > "R01.00"

2.3.13 drvspecific
Thedrvspecificcommandenablestheuseofthedriverspecificsubmenu commandsprovidedinadditiontothecommoncommandsdiscussedinthis chapter.Refertoyourdriverspecificmanualforinformationoncommands specifictoyourRFM2gdriver. Syntax
drvspecific

Examples Toaccessdriverspecificcommands:
UTIL0 > drvspecific Welcome to the driver specific menu UTILDRVSPEC0 >

Todisplayalistofdriverspecificcommands:
UTILDRVSPEC0 > help COMMAND PARAMETERS --------------------------------------------------help [command] repeat [-p] count cmd [arg...] return UTILDRVSPEC0 >

Toexitthedriverspecificcommands:
UTILDRVSPEC0 > return Welcome to the main menu UTIL0 >

rfm2g_util.c Utility Program 109

2.3.14 dump
ThedumpcommandenablestheusertopeekanddisplayanareaofReflective Memory.Thisutilitycalls RFM2gPeek8(), RFM2gPeek16(), RFM2gPeek32()or RFM2gPeek64().

NOTE

See section Big Endian and Little Endian Data Conversions, page 44 for information on the big endian/little endian byte-reordering process used by the RFM2g driver when accessing multibyte data.

Syntax
dump offset width length

Parameters
offset

WidthalignedoffsetinReflectiveMemoryatwhichtobegin thepeekanddisplay(I).Validoffsetvaluesare0x0to 0x3FFFFFFfor64MBcards,0x0to0x7FFFFFFfor128MBcards or0x0to0x0FFFFFFfor256MBcards. Indicatesaccesswidthinbits,whichisoneofthefollowing(I): Value 1 2 4 8 Description 8bitbyte 16bitword 32bitlongword 64bitlongword

width

length

Numberofwidthunitstopeekanddisplay(I),whichis determinedusingtheformula[buffersize]/width.For example,thelengthofabuffersizeof1024in32bitlongwords is256(1024/4=256). WidthBit bytes words 32bitlongword 64bitlong MaximumLength(Dec/Hex) for128MBCards 134217728(0x8000000) 67108864(0x4000000) 33554432(0x2000000) 16777216(0x1000000)

Example
UTIL0 > dump 0 8 4 0 1 0x00000000:0123456789ABCDEF 0123456789ABCDEF|.#Eg.#Eg ........| 0x00000010:0123456789ABCDEF 0123456789ABCDEF|.#Eg.#Eg ........| UTIL0 >

110 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.15 enableevent
RFM2geventinterruptsarenotenabledbydefault.Theenableeventcommand enablesaspecificRFMeventsoasysteminterruptcanbegeneratedonthe receivingnode.TheutilitycallsRFM2gEnableEvent()toenabletheRFMevent. Syntax
enableevent event

Parameters
event

Theinterrupteventtoenable.Interruptscorrelatetothe followingeventIDs: Interrupt


ResetInterrupt NetworkInterrupt1 NetworkInterrupt2 NetworkInterrupt3 NetworkInterrupt4(InitInterrupt) BadDataInterrupt RXFIFOFullInterrupt RoguePacketDetectedandRemoved RXRIFOAlmostFull SYNCLoss MemWriteInhibited LocalMemParityError

EventID
0 1 2 3 4 5 6 7 8 9 10 11

Example
UTIL0 > enableevent 0 Interrupt event "RESET" is enabled. UTIL0 >

rfm2g_util.c Utility Program 111

2.3.16 enablecallback
Theenablecallbackcommandenablestheinterruptnotificationforoneeventon oneboard. Amessageisreturnedtotheconsolewindoweachtimeaneventcallsuccessfully occursusingthiscommand.Forexample,iffourcallbackshavebeenpreviously performedandanewcallbackismadefromRFM2GEVENT_INTR3,the followingdisplaysintheconsolewindow:
EventCallback: Counter = 5 node 2 Received RFM2GEVENT_INTR3 interrupt from node 0

Extendedinformationforavaluecanalsobedisplayed.Forexample:
Asynchronous Event Notification has been enabled for the "NETWORK INT 1" event.

Theutilitycalls RFM2gEnableEventCallback() toenableinterruptnotification. Syntax


enablecallback event

Parameters
event

Specifieswhichinterruptnotificationtoenable(I).Interrupts correlatetothefollowingeventIDs:

Interrupt
ResetInterrupt NetworkInterrupt1 NetworkInterrupt2 NetworkInterrupt3 NetworkInterrupt4(InitInterrupt) BadDataInterrupt RXFIFOFullInterrupt RoguePacketDetectedandRemoved RXRIFOAlmostFull SYNCLoss MemWriteInhibited LocalMemParityError

EventID
0 1 2 3 4 5 6 7 8 9 10 11

Example
UTIL0 > enablecallback 1 Asynchronous Event Notification has been enabled for the "NETWORK INT 1" event. UTIL0 >

112 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.17 errormsg
Theerrormsgcommandprintsatextstringdescribingaruntimeerror. RuntimeerrorsarereturnedbytheAPIfunctions.Theutilitycalls
RFM2gErrorMsg()toobtaintheerrorcodepointer.

Syntax
errormsg ErrorCode

Parameters
ErrorCode

ReturncodefromanAPIfunction(I).

Example
UTIL0 > errormsg 0 ErrorCode = 0, Msg = No current error UTIL0 >

2.3.18 exit
Theexitcommandterminatesthecommandlineinterpreterprogram. Syntax
exit

Example
UTIL0 > exit Exit? (y/n):y

2.3.19 first
ThefirstcommanddisplaysthefirstRFM2goffsetavailableforusebyan applicationprogram.TheutilitycallsRFM2gFirst() toreturnthefirstavailable RFM2goffset. Syntax
first

Example
UTIL0 > first First 0x00000000

rfm2g_util.c Utility Program 113

2.3.20 getdarkondark
ThegetdarkondarkcommandreturnsthestateoftheRFM2gDarkonDark feature.TheutilitycallsRFM2gGetDarkOnDark()toretrievethestateoftheDark onDarkfeature. Syntax
getdarkondark

Example
Please enter device number: 0 UTIL0 > getdarkondark The Reflective Memory boards Dark On Dark feature is turned OFF. UTIL0 >

2.3.21 getdebug NOTE


Users should not use this command unless directed to do so by GE support personnel.

Thegetdebugcommanddisplaysacopyofthecurrentsettingofthedebugflags ofthedevicedriver.TheRFM2gdevicedrivercangeneratedebugmessagesby checkingabitinthedriversdebugflagsvariable. Amaximumof32debugmessageclassesarepossible.Eachdebugmessageclass isassignedtoanindividualbitwithinthis32bitcontrolword.Anonzero(0)bit impliesthatthecorrespondingdebugmessageclasscanbegeneratedbythe RFM2gdevicedriver.TheutilitycallsRFM2gGetDebugFlags()toretrievedebug controlflags. Syntax


getdebug

Example
UTIL0 > getdebug Current Debug Flags: 0x00000000 UTIL0 >

2.3.22 getdmabyteswap
ThegetdmabyteswapcommandreturnsthestateoftheDMAbyteswapping hardware.TheutilitycallsRFM2gGetDMAByteSwap()toreturntheDMAbyte swappingstate. Syntax
getdmabyteswap

Example
UTIL0 > getdmabyteswap The Reflective Memory board's DMA Byte Swap is ON. UTIL0 >

114 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.23 geteventcount
Thegeteventcountcommanddisplaysthecurrenteventcountforthespecified eventorallevents.TheutilitycallsRFM2gGetEventCount()toretrieveevent countforthespecifiedeventorallevents. Syntax
geteventcount

Parameters
event

Whereeventisoneofthefollowinginterruptevents[012]:

Interrupt
Reset NetworkInterrupt1 NetworkInterrupt2 NetworkInterrupt3 NetworkInterrupt4(InitInterrupt) BadDataInterrupt RXFIFOFullInterrupt RoguePacketDetectedandRemoved RXRIFOAlmostFull SYNCLoss MemWriteInhibited LocalMemParityError AllEvents

EventID
0 1 2 3 4 5 6 7 8 9 10 11 12

Example
UTIL0 > geteventcount 1 The event count for Network INT 1 is 0 UTIL0 >

2.3.24 getled
ThegetledcommanddisplaysthecurrentON/OFFstateoftheReflectiveMemory boardsSTATUSLED.TheutilitycallsRFM2gGetLed() toretrievetheSTATUS LEDstate. EveryRFM2ginterfaceboardhasaSTATUSLEDwhichisturnedONwhenever theRFM2gdeviceisresetandturnedOFFbytheRFM2gdevicedriverduring initialization.WhentheRFM2gdevicedriverisunloaded,theSTATUSLEDis turnedONagain. Syntax
getled

Example
UTIL0 > getled The Reflective Memory board's Status LED is OFF. UTIL0 >

rfm2g_util.c Utility Program 115

2.3.25 getmemoryoffset
Thegetmemoryoffsetcommanddisplaysthenetworkmemoryoffsetofthe ReflectiveMemoryboard.TheutilitycallsRFM2gGetMemoryOffset()toretrieve thenetworkmemoryoffset. Syntax
getmemoryoffset

Example
UTIL0 > getmemoryoffset The Reflective Memory board's memory offset is 0x00000000. UTIL0 >

2.3.26 getloopback
ThegetloopbackcommanddisplaysthestateoftheRFM2Gtransmitloopback hardware.TheutilitycallsRFM2gGetLoopback()toreturnthetransmitloopback state. Syntax
getloopback

Example
UTIL0 > getloopback The Reflective Memory boards transmit loopback is Off. UTIL0 >

2.3.27 getparityenable
ThegetparityenablecommanddisplaysthestateoftheRFM2gsparityenable. TheutilitycallsRFM2gGetParityEnable()todisplaytheparityenablestate. Syntax
getparityenable

Example
UTIL0 > getparityenable The Reflective Memory boards parity enable is Off. UTIL0 >

2.3.28 getpiobyteswap
ThegetpiobyteswapcommanddisplaysthestateofPIObyteswapping hardware.Theutilitycalls RFM2gGetPIOByteSwap()toreturnthePIObyte swappingstate. Syntax
getpiobyteswap

Example
UTIL0 > getpiobyteswap The Reflective Memory board's PIO Byte Swap is ON. UTIL0 >
116 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.29 getslidingwindow
Thegetslidingwindowcommanddisplaystheoffsetandsizeofthecurrent slidingmemorywindow.TheutilitycallsRFM2gGetSlidingWindow()toretrieve theinformation. Syntax
getslidingwindow

Example
UTIL0 > getslidingwindow The 2 MByte Sliding Window begins at offset 0x00400000. UTIL0 >

2.3.30 getthreshold
ThegetthresholdcommanddisplaysthevalueofthecurrentDMAthreshold.The RFM2gdevicedriverwillusethebusmasterDMAfeaturepresentonsome RFM2gdevicesifanI/Orequestqualifies(i.e.ifthesizeislargerthanorequalto theThreshold).OneofthecriteriaforperformingtheDMAisthattheI/O transferbelongenoughthatthetimesavedbyperformingtheDMAoffsetsthe overheadprocessinginvolvedwiththeDMAitself.ThedefaultDMAthresholdis driverdependent.RefertoyourdriverspecificmanualforthedefaultDMA thresholdvalue. Thiscommandisusefulsincetheamountofthisoverheadcanvarybetweenhost computerconfigurations.Theusercansetanewthresholdusingthesetthreshold command.TheutilitycallsRFM2gGetDMAThreshold() toreturnthecurrent DMAthresholdvalue. Syntax
getthreshold

Example
UTIL0 > getthreshold Current DMA Threshold: "32" UTIL0 >

2.3.31 gettransmit
ThegettransmitcommanddisplaysstatusoftheReflectiveMemoryboards transmitter.TheutilitycallsRFM2gGetTransmit()todisplaythestateofthe ReflectiveMemoryboardstransmitter. Syntax
gettransmit

Example
UTIL0 > gettransmit The Reflective Memory boards Transmitter is ON UTIL0 >

rfm2g_util.c Utility Program 117

2.3.32 help
Thehelpcommandliststhenameofeachdefinedcommandandashort descriptionofit.Thiscommandcanalsobeusedtoshowdetailedusage informationforaspecificrfm2g_util.ccommand. Syntax
help command

Parameters
command

Thecommandhelptodisplay(I).Enteringhelp displaysalist ofallcommandsforwhichhelpisavailable.Enteringhelp followedbythecommanddisplayshelpinformationforthe commandifanyisavailable.

118 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

Examples
UTIL0 > help setled setled: Set the current ON/OFF state of the Reflective Memory board's Status LED Usage: setled state "state" is one of the following (0-1): 0 for OFF 1 for ON UTIL0 > help COMMAND PARAMETERS --------------------------------------------------boardid cancelwait event checkring clearevent event cleareventcount event clearowndata config devname disableevent event disablecallback event dllversion driverversion drvspecific dump offset width length enableevent event enablecallback event

Press ENTER for more commands ... COMMAND PARAMETERS --------------------------------------------------errormsg ErrorCode exit first getdarkondark getdebug getdmabyteswap geteventcount event getled getmemoryoffset getloopback getparityenable getpiobyteswap getthreshold gettransmit help [command] mapuser offset pages

rfm2g_util.c Utility Program 119

Press ENTER for more commands ... COMMAND PARAMETERS --------------------------------------------------mapuserbytes offset bytes memop pattern offset width length verify float patterntype nodeid peek8 offset peek16 offset peek32 offset peek64 offset performancetest poke8 value offset poke16 value offset poke32 value offset poke64 value offset quit read offset width length display repeat [-p] count cmd [arg...] send event tonode [ext_data] Press ENTER for more commands ... COMMAND PARAMETERS --------------------------------------------------setdarkondark state setdebug flag setdmabyteswap state setled state setloopback state setmemoryoffset offset setparityenable state setpiobyteswap state setthreshold value settransmit state size unmapuser UserMemoryPtr pages unmapuserbytes UserMemoryPtr bytes wait event timeout write value offset width length UTIL0 >

120 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.33 mapuser
ThemapusercommandallowstheusertomapRFMmemorypagestotheuser space. TheutilitycallsRFM2gUserMemory() tomapRFM2gmemory.Refertodriver specificmanualforadditionalfunctionality.

NOTE
Syntax

When using the RFM2g-DRV-LNX Linux version of the driver, the mapped area must be reserved by booting Linux with the Linux mem command.

mapuser offset pages

Parameters
offset

OffsetinReflectiveMemoryatwhichtobeginthemapping(I). Validoffsetvaluesare0x0to[sizeofReflectiveMemoryon devicesystemmemorypagesize]. Numberofmemorypagestomap(I).

pages

Examples Thefollowingexampledisplaysthevaluesofthemappedregion:
UTIL0 > mapuser mapuser: Get Set the User buffer offset and pages Usage: mapuser offset pages "offset" is the beginning offset to map. "pages" is the number of pages of memory to map. UTIL0 >

Thefollowingexamplemapsabufferthatbeginsatoffset0andis100system pageslongandLinuxwasbootedwiththememsettingmem=63M:
UTIL0 > mapuser 0 100 RFM2gUserMemory assigned UserMemoryPtr = 0x50000000 UTIL0 >

rfm2g_util.c Utility Program 121

2.3.34 mapuserbytes
ThemapuserbytescommandallowstheusertomapRFMmemorytotheuser space. Theutilitycalls RFM2gMapUserBytes()tomapRFM2gmemorybytes.Referto driverspecificmanualforadditionalfunctionality. Syntax
mapuserbytes offset bytes

Parameters
offset

OffsetinReflectiveMemoryatwhichtobeginthemapping(I). Validoffsetvaluesare0x0to[sizeofReflectiveMemoryon devicesystemmemorypagesize]. Numberofmemorybytestomap(I).

bytes

Examples Thefollowingexampledisplaysthevaluesofthemappedregion:
UTIL0 > mapuserbytes mapuserbytes: Get Set the User buffer offset and pages Usage: mapuserbytes offset bytes "offset" is the beginning offset to map. "bytes" is the number of bytes of memory to map. UTIL0 >

Thefollowingexamplemapsabufferthatbeginsatoffset0andis100system passeslongandLinuxwasbootedwiththememsettingmem=63M:
UTIL0 > mapuserbytes 0 0x64000 RFM2gUserMemoryByte assigned UserMemoryPtr = 0x50000000 UTIL0 >

122 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.35 memop
ThememopcommandallowstheusertofillorverifyanareaofReflective Memory.ThisutilitycallsRFM2gPoke8(), RFM2gPoke16(), RFM2gPoke32() or RFM2gPoke64()tofillthememory. Syntax
memop pattern offset width length verify float patterntype

Parameters
pattern offset

Thepatterntowriteorverify(I). WidthalignedoffsetinReflectiveMemoryatwhichtobegin thereadorverify(I).Validoffsetvaluesare0x0to0x3FFFFFF for64MBcards,and0x0to0x7FFFFFFfor128MBcards.


Indicatesaccesswidthinbits,whichisoneofthefollowing(I):

width

Value 1 2 4 8
length

Description 8bitbyte 16bitword 32bitlongword 64bitlongword

Numberofwidthunitstowriteorverify(I),whichis determinedusingtheformula[buffersize]/width.For example,thelengthofabuffersizeof1024in32bitlongwords is256(1024/4=256). WidthBit bytes words 32bitlongword 64bitlong MaximumLength(Dec/Hex) for128MBCards 134217728(0x8000000) 67108864(0x4000000) 33554432(0x2000000) 16777216(0x1000000)

verify float

Writes(0)orverifies(1)thepatterninReflectiveMemory. Specifieswhetherthepatternis(1)orisnot(0)afloatingpoint value. Specifiesthepatterntype,whichisoneofthefollowing(I): Type 0 1 2 3 Description Patternforfixeddata Patternforincrementingaddress Patternforincrementingtransferscount Patternforinvertedincrementing address

patterntype

Example Thefollowingexamplewritesthevalue0x123456789ABCDEFtoReflective Memory,startingatoffset0.RFM2gPoke64()iscalled128times,incrementing offset8eachtimeitiscalled:


UTIL0 > memop 0x123456789ABCDEF 0 8 128 0 0
rfm2g_util.c Utility Program 123

2.3.36 nodeid
ThenodeidcommanddisplaysthevalueoftheRFM2gdevicenodeID.Each RFM2gdeviceonaRFM2gnetworkisuniquelyidentifiedbyitsnodeID,whichis manuallysetbyswitchesonthedevicewhentheRFM2gnetworkisinstalled.The utilitycallsRFM2gNodeID()toreturntheRFM2gdevicenodeID. Syntax
nodeid

Example
UTIL0 > nodeId Node ID UTIL0 > 0x01

124 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.37 peek8, peek16, peek32 and peek64


ThepeekcommandsdisplaythecontentsofthespecifiedRFM2goffset.The specifiedmemoryoffsetisaccessedaseitheran8bitbyte,a16bitword,a32bit longwordora64bitlongwordandisdisplayedasahexadecimalversionofthe RFM2gcontents. ThesecommandsmakenoattempttolocktheRFM2gduringtheaccess.These utilitiescallRFM2gPeek8(), RFM2gPeek16(), RFM2gPeek32()and RFM2gPeek64() toreadfromanRFM2goffset.

NOTE

See the section Big Endian and Little Endian Data Conversions, page 44 for information on the big endian/little endian byte-reordering process used by the RFM2g driver when accessing multibyte data.

Syntax
peek8 offset peek16 offset peek32 offset peek64 offset

Parameters
offset

OffsetinReflectiveMemoryfromwhichtoread(I).

Example(peek8)
UTIL0 > peek8 0 Data: 0x78 Read from Offset: 0x00000000 UTIL0 >

Example(peek16)
UTIL0 > peek16 0 Data: 0x5678 Read from Offset: 0x00000000 UTIL0 >

Example(peek32)
UTIL0 > peek32 0 Data: 0x12345678 UTIL0 > Read from Offset: 0x00000000

Example(peek64)
UTIL0 > peek64 0 Data: 0x123456789ABCDEF UTIL0 > Read from Offset: 0x00000000

rfm2g_util.c Utility Program 125

2.3.38 performancetest
Theperformancetestcommandusesthe RFM2gRead() andRFM2gWrite()API functionstodisplaythespeedofreadsandwritesperformedonyoursystem. Syntax
performancetest

Example

NOTE

The numbers in the following example are for illustration purposes only. Your actual system performance will vary.

UTIL0 > performancetest GE RFM2g Performance Test (DMA Threshold is 32) --------------------------------------------------Bytes Read IOps Read MBps Write IOps 4 277760 1.1 900823 8 456448 3.5 1254411 12 343536 3.9 1197772 16 275421 4.2 900820 20 229826 4.4 724569 [...] 1048576 245 245.5 142 1310720 196 245.6 113 1572864 163 245.3 94 1835008 140 245.9 81 2097152 122 245.0 71 UTIL0 >

Write MBps 3.4 9.6 13.7 13.7 13.8 142.0 141.9 141.8 141.8 142.0

126 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.39 poke8, poke16, poke32 and poke64


ThepokecommandsmaybeusedtosetorupdateconsecutiveRFM2glocations. Thespecifiedmemoryoffsetiswrittenaseitheran8bitbyte,a16bitword,a 32bitlongwordora64bitlongwordandmustbeenteredinhexadecimalformat. ThesecommandsmakenoattempttolocktheRFM2gsharedmemoryduringthe access.Theutilitycalls RFM2gPoke8(), RFM2gPoke16(), RFM2gPoke32()and RFM2gPoke64()towritetoanRFM2goffset.

NOTE

See section Big Endian and Little Endian Data Conversions, page 44 for information on the big endian/little endian byte-reordering process used by the RFM2g driver when accessing multibyte data.

Syntax
poke8 value offset poke16 value offset poke32 value offset poke64 value offset

Parameters
value offset

Valuewrittentooffset(I).

Example(poke8)
UTIL0 > poke8 255 0 Data: 0xFF Written to Offset: 0x00000000 UTIL0 >

Example(poke16)
UTIL0 > poke16 65535 0 Data: 0xFFFF Written to Offset: 0x00000000 UTIL0 >

Example(poke32)
UTIL0 > poke32 4294967295 0 Data: 0xFFFFFFFF Written to Offset: 0x00000000 UTIL0 >

Example(poke64)
UTIL0 > poke64 0x123456789ABCDEF 0 Data: 0x123456789ABCDEF Written to Offset: 0x00000000 UTIL0 >

rfm2g_util.c Utility Program 127

2.3.40 quit
Thequitcommandterminatesthecommandlineinterpreter. Syntax
quit

Example
UTIL0 > quit Exit? (y/n): UTIL0 > y C: >

128 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.41 read
ThereadcommandreadsdatafromtheRFM2gnodetosystemmemory.Once transferred,thedataisdisplayed.TheutilitycallsRFM2gRead()toreaddata buffers.IfDMAthresholdandotherconditionsaremet,DMAwillbeused; otherwise,PIOwillbeused.

NOTE

See section Big Endian and Little Endian Data Conversions, page 44 for information on the big endian/little endian byte-reordering process used by the RFM2g driver when accessing multibyte data. If byte swapping is enabled on the RFM2g device, offset and length must be width aligned.

Syntax
read offset width length display

Parameters
offset

OffsetinReflectiveMemoryatwhichtobegintheread(I). Validoffsetvaluesare0x0to0x3FFFFFFfor64MBcards,and 0x0to0x7FFFFFFfor128MBcards. Indicatesaccesswidthinbits,whichisoneofthefollowing(I): Value 1 2 4 8 Description 8bitbyte 16bitword 32bitlongword 64bitlongword

width

length

Numberofwidthunitstodisplay(I),whichisdetermined usingtheformula[buffersize]/width.Forexample,thelength ofabuffersizeof1024in32bitlongwordsis256(1024/4= 256). WidthBit bytes words 32bitlongword 64bitlong MaximumLength(Dec/Hex) for128MBCards 134217728(0x8000000) 67108864(0x4000000) 33554432(0x2000000) 16777216(0x1000000)

display

Displayreaddatatotheoutputdevice(0=donotdisplay; 1=displayinformation(default)).

rfm2g_util.c Utility Program 129

Example
UTIL0 >read 0 1 0x40 0 0x00000000: 00 0x00000010: 00 0x00000020: 00 0x00000030: 00 1 00 00 00 00 2 00 00 00 00 3 00 00 00 00 4 00 00 00 00 5 00 00 00 00 6 00 00 00 00 7 00 00 00 00 8 00 00 00 00 9 00 00 00 00 A 00 00 00 00 B 00 00 00 00 C 00 00 00 00 D 00 00 00 00 E 00 00 00 00 F 00 00 00 00

|................| |................| |................| |................|

UTIL0 >read 0 1 0x40 0 UTIL0 >

2.3.42 repeat
Therepeatcommandisusedtoexecuteanotherutilitycommandaspecified numberoftimes,asrapidlyaspossible.Thecommandtobeexecutedissupplied asanargumenttotherepeatcommand. The-pswitchmaybeusefultomarktheprogressofcommandswithlarge repetitioncounts.Iftheswitchisused,thecurrentpassnumberisoutputtothe screen,followedbyaTABcharacter.Iftheswitchisomitted,noindicationofthe repeatcommandsprogressisgiven. Therepeatcommandimmediatelystopsifanerrorisreportedwhilethe commandisexecuting. Syntax
repeat [-p] count cmd [arg...]

Parameters
-p

Displaysthenumberoftimesthespecifiedutilitycommand hasrepeatedandupdatesthisnumbertothescreen. Thenumberoftimestorepeatthespecifiedutilitycommand. Theutilitycommandtorepeat. Anyargumentsrequiredbythespecifiedutilitycommandto repeat.

count cmd arg...

Example
UTIL0 > Network Network Network Network UTIL0 > repeat 4 send 1 Int 1 interrupt Int 1 interrupt Int 1 interrupt Int 1 interrupt 0XFF event event event event was was was was sent sent sent sent to to to to node node node node 255. 255. 255. 255.

130 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.43 return
Thereturncommandisusedtoexitadriverspecificsubmenuofcommands (accessedusingthedrvspecificcommand)sothatyoucanusecommon rfm2g_util.ccommands. Refertoyourdriverspecificmanualforinformationoncommandsspecificto yourRFM2gdriver. Syntax
return

Examples Toaccessdriverspecificcommands:
UTIL0 > drvspecific Welcome to the driver specific menu UTILDRVSPEC >

Todisplayalistofdriverspecificcommands:
UTILDRVSPEC > help COMMAND PARAMETERS --------------------------------------------------help [command] repeat [-p] count cmd [arg...] return UTILDRVSPEC >

Toexitthedriverspecificcommands:
UTILDRVSPEC > return Welcome to the main menu UTIL0 >

rfm2g_util.c Utility Program 131

2.3.44 send
Usethesendcommandtotransmitaninterrupteventandabinaryvalueto anothernode.RFM2ginterrupteventtypesareavailableforanapplication programtouseinsignalingeventstootherRFM2gnodes. IfthedestinationRFM2gnodenumberisgivenas-1,theeventwillbebroadcast toallotherRFM2gnodesonthenetwork.Theext_dataparameterisauser defined,32bitvaluetosendwiththeinterruptevent.Theutilitycalls RFM2gSendEvent()tosendtheRFM2ginterruptevent. Syntax
send event tonode [ext_data]

Parameters
event

Thetypeofinterrupteventtosend(I). InterruptscorrelatetothefollowingeventIDs: Interrupt


ResetInterrupt NetworkInterrupt1 NetworkInterrupt2 NetworkInterrupt3 NetworkInterrupt4

EventID
0 1 2 3 4

tonode

Whowillreceivetheinterruptevent(I)(1sendstheeventto allnodes).

NOTE
ext_data

A node cannot send an event to itself.

Userdefined32bitextendeddatatosend(I).

Example
UTIL0 > send 0 0 "RESET" interrupt event was sent to node 0. UTIL0 >

132 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.45 setdarkondark
ThesetdarkondarkcommandsetsthestateoftheRFM2gDarkonDarkfeature. TheutilityRFM2gSetDarkOnDark()setsthestateoftheDarkonDarkfeature. Syntax
setdarkondark state

Parameters
state

SetsthestateofDarkonDarkfeature,whichisoneofthe following(I): StateDescription 0TurnsDarkOnDarkOFF 1TurnsDarkOnDarkON


UTIL0 > setdarkondark 1 The Reflective Memory boards Dark On Dark feature is turned ON. UTIL0 >

Example

rfm2g_util.c Utility Program 133

2.3.46 setdebug NOTE


Application programs should not use this command unless directed to do so by GE support personnel.

EachpossibleRFM2gdevicedriverdebugoutputmessageisassignedtoadebug messageclass.Thedevicedriverwillgeneratemessagesofthatclassifthe correspondingflagbitissetinthecontrolword.Thesetdebugcommandallows anapplicationprogramtosetthatcontrolword(i.e.thiscommandsetsthe driversdebugflags).Thechangeiseffectiveimmediately. Applicationprogramsdonotnormallyneedtoalterthesettingofthedebug messageoutputcontrolword.TheutilitycallsRFM2gSetDebugFlags() toturn debugflagsONorOFF. Syntax
setdebug [-] flag

Parameters
flag

Clearsinsteadofsettingtheflag. Newdebugflags(I).Validstringsare:
String allflags close dma error init intr ioctl minphys mmap mutex not_intr open peek poke read slow strat timer trace write Description TurnsalldebugflagsON Traceclose(2)systemcalls TraceDMAcalls Reportcriticalerrors Tracedeviceprobingandsearch Traceinterruptservice Traceioctl(2)systemcalls Traceminphyslimits Tracemmap(2)systemcalls Tracesynchronizationandlocking TracenonRFMinterruptservice Traceopen(2)systemcalls Tracepeeks Tracepokes Traceread(2)systemcalls Letsyslogdgetthemessage Traceread/writestrategy Traceintervaltimer Tracesubroutineentry/exit Tracewrite(2)systemcalls

Example
UTIL0 > setdebug error Debug Flag error was set. UTIL0 >
134 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.47 setdmabyteswap
ThesetdmabyteswapcommandenablesordisablesbyteswappingDMA transferstoorfromanRFM2gdevice.Thiscommandprovides4byteswapsonly (i.e.byteswappingbasedonsizeisnotperformedbytheRFM2gdevice).The utilitycallsRFM2gSetDMAByteSwap() toturnDMAbyteswappingONorOFF.

NOTE
Syntax

DMA byte swapping may be enabled by default when the driver has been built for use on big endian systems. Refer to your driver-specific manual for the default setting of DMA byte swapping.

setdmabyteswap

state

Parameters
state

SetsthestateofDMAbyteswapping,whichisoneofthe following(I): StateDescription 0TurnsDMAbyteswappingOFF 1TurnsDMAbyteswappingON

Example

UTIL0 > setdmabyteswap 1 The Reflective Memory board's DMA Byte Swap is ON. UTIL0 >

2.3.48 setled
ThesetledcommandsetsthecurrentON/OFFstateoftheReflectiveMemory boardsSTATUSLED.Theutilitycalls RFM2gSetLed()toturntheSTATUSLED ONorOFF. Syntax
setled state

Parameters
state

ThestateoftheSTATUSLED:0=>OFF,1=>ON(O).

Example
UTIL0 > setled 1 The Reflective Memory boards status LED is ON UTIL0 >

rfm2g_util.c Utility Program 135

2.3.49 setloopback
ThesetloopbackcommandsetsthestateoftheRFM2Gtransmitloopback hardware.TheutilitycallsRFM2gSetLoopback() tosetthetransmitloopback state. Syntax
setloopback state

Parameters
state

Setsthestateoftransmitloopbackhardware,whichisoneof thefollowing(I): StateDescription 0TurnsloopbackOFF 1TurnsloopbackON

Example

UTIL0 > setloopback 0 The Reflective Memory boards transmit loopback is OFF. UTIL0 >

2.3.50 setmemoryoffset
ThesetmemoryoffsetcommandsetsthememoryoffsetstatusoftheReflective Memoryboard.Theutilitycalls RFM2gSetMemoryOffset()tosetthememory offset. Syntax
setmemoryoffset offset

Parameters
offset

Theoffsettothenetworkaddressdescription. Nooffset 0x4000000 0x8000000 0xc000000

0 1 2 3 Example

UTIL0 > setmemoryoffset 1 The Reflective Memory board's memory offset is 0x40000000. UTIL0 >

136 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.51 setparityenable
ThesetparityenablecommandsetsthestateoftheRFM2gsparityenable.The utilityRFM2gSetParityEnable()setsthestateoftheparityenable. Syntax
setparityenable state

Parameters
state

SetsthestateofParityEnable,whichisoneofthefollowing(I): StateDescription 0TurnsParityEnableOFF 1TurnsParityEnableON

Example

UTIL0 > setparityenable 0 The Reflective Memory boards parity enable is OFF. UTIL0 >

2.3.52 setpiobyteswap
ThesetpiobyteswapcommandenablesordisablesbyteswappingPIOtransfers toorfromanRFM2gdevice.Thisfunctionprovides4byteswapsonly(i.e.byte swappingbasedonsizeisnotperformedbytheRFM2gdevice).Theutilitycalls RFM2gSetPIOByteSwap()toturnPIObyteswappingONorOFF.

NOTE
Syntax

PIO byte swapping may be enabled by default when the driver has been built for use on big endian systems. Refer to your driver-specific manual for the default setting of PIO byte swapping.

setpiobyteswap state

Parameters
state

SetsthestateofPIObyteswapping,whichisoneofthe following(I): StateDescription 0TurnsPIObyteswappingOFF 1TurnsPIObyteswappingON

Example

UTIL0 > setpiobyteswap 1 The Reflective Memory board's PIO Byte Swap is ON. UTIL0 >

rfm2g_util.c Utility Program 137

2.3.53 setslidingwindow
ThesetslidingwindowcommandsetsthebaseReflectiveMemoryoffsetofthe slidingmemorywindow.Thesizeoftheslidingwindowissetwithswitchesor jumpersontheReflectiveMemoryboard.Theavailablewindowsizesare 2MByte,16MByte,64MByte,andthetotalmemorysize.Theoffsetofthesliding windowmustbeamultipleofthesizeoftheslidingwindow.Theutilitycalls RFM2gGetSlidingWindow()togetthewindowsize,and RFM2gSetSlidingWindow()tosettheoffset. Syntax
setslidingwindow offset

Example
UTIL0 > setslidingwindow 0x00400000 The 2 MByte Sliding Window begins at offset 0x00400000. UTIL0 >

2.3.54 setthreshold
Thesetthresholdcommandsetsthetransfersizeatwhichreadsandwriteswill useDMAtotransferdata.Ifthereadorwritecommandisused,DMAwillbe usedifthesizeofthedataislargerthanorequaltothethresholdvalue.A thresholdcanbesetforeachhandlecreatedbyacallto RFM2gOpen(). TheamountofcyclestakentosetupaDMAtransfercanincreasethetransfer timeforsmalltransfersizes.ThetransfersizeforwhichDMAsaremoreefficient thanstandardtransfersvaries,dependingonthesystem. DMAisgenerallypreferredoverthePIOmethodfortransferringdata.PIO operationsrequiretheusageoftheCPUtoprocessthetransfer,whileDMA enablestheReflectiveMemorycontrollertoaccesssystemmemorywhileleaving theCPUsresourcesunaffected.However,thebestvaluetouse(i.e.PIOvs.DMA) issystemdependent.TheRFM2gdriverperformsapproximatelyfivePCI accessestosetupandprocessaDMArequestandgeneratesaninterrupton completionoftheDMAoperation.Ingeneral,DMAisthepreferredmethodifa PIOtransferrequiresmorethansixtotenPCIcyclestocomplete. Avalueof0xFFFFFFFFspecifiesthatDMAswillneverbeusedfordatatransfer. TheutilitycallsRFM2gSetDMAThreshold()tosettheDMAthresholdsize.

NOTE

The default DMA threshold value is driver-dependent and should be changed only if recommended by the drivers documentation. Refer to your driver-specific manual for more information, including the default value.

Syntax
setthreshold value

Parameters
value

NewDMAthresholdvalue(I).

Example
UTIL0 > setthreshold 128 UTIL0 >
138 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.55 settransmit
ThesettransmitcommandsetsthestateoftheRFM2gstransmitter.Theutility RFM2gSetTransmit()setsthestateoftheReflectiveMemoryboardstransmitter. Syntax
settransmit state

Parameters
state

SetsthestateofTransmitter,whichisoneofthefollowing(I): StateDescription 0TurnsTransmitterOFF 1TurnsTransmitterON

Example
UTIL0 > settransmit 1 The Reflective Memory boards Transmitter is ON. UTIL0 >

2.3.56 size
Thesizecommanddisplaysthevalueofthetotalamountofvirtualmemory spaceavailableontheRFM2gdevice.TheusermayaccessRFM2gspacebetween offset0andRFM2gSize(rh)-1. RFM2gboardsmaybeconfiguredwithavarietyofmemorysizes.Thedevice driverandAPIlibrarydeterminetheamountofmemorycontainedonaRFM2g deviceasitisinitialized.Ausermaythenusesizetoobtainthenumberofbytes ontheboard.TheutilitycallsRFM2gSize() toreturntheRFM2gdevicestotal availablememoryspace. Syntax
size

Example
UTIL0 > size Size UTIL0 > 134217728 (0x08000000)

rfm2g_util.c Utility Program 139

2.3.57 unmapuser
TheunmapusercommandunmapstheRFM2gmemorybufferfromusermemory space.TheutilitycallsRFM2gUnMapUserMemory()tounmaptheRFM2gmemory buffer. Syntax
unmapuser UserMemoryPtr pages

Parameters
UserMemoryPtr Pages

Pointerreturnedbythemapusercommand(O). Thenumberofpagesmappedbythemapusercommand(O).

Example
UTIL0 > unmapuser 0x50000000 100 UTIL0 >

2.3.58 unmapuserbytes
TheunmapuserbytescommandunmapstheRFM2gmemorybufferfromuser memoryspace.TheutilitycallsRFM2gUnMapUserBytes()tounmaptheRFM2g memorybytesbuffer. Syntax
unmapuserbytes UserMemoryPtr bytes

Parameters
UserMemoryPtr Pages

Pointerreturnedbythemapuserbytescommand(O). Thenumberofpagesmappedbythemapuserbytescommand (O).

Example
UTIL0 > unmapuserbytes 0x50000000 100 UTIL0 >

140 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.3.59 wait
ThewaitcommandallowstheusertowaitforanRFM2ginterruptevent.The utilityprogramblocksuntilthenextRFM2ginterrupteventoftherequestedtype hasbeenreceived,orthetimeoutperiodexpires.Theeventmustbeenabledby thisapplicationbeforeitcanbereceived;otherwise,atimeoutwilloccur.The utilitycallsRFM2gWaitForEvent()towaitfortheRFM2gevent. Syntax
wait event timeout

Parameters
event

Thetypeofinterrupteventonwhichtowait(I). InterruptscorrelatetothefollowingeventIDs: Interrupt


ResetInterrupt NetworkInterrupt1 NetworkInterrupt2 NetworkInterrupt3 NetworkInterrupt4(InitInterrupt) BadDataInterrupt RXFIFOFullInterrupt RoguePacketDetectedandRemoved RXRIFOAlmostFull SYNCLoss MemWriteInhibited LocalMemParityError

EventID
0 1 2 3 4 5 6 7 8 9 10 11

timeout

Indicatesthetime,inmilliseconds,towaitfortheeventbefore returning.

Example
UTIL0 > wait 1 1000 Waiting for event... Received Network INT 1 event from node 5. This events extended data is 0X12345678. UTIL0 > wait 0 0 Waiting for event ... Notification for this event has already been requested. UTIL0 > wait 0 10000 Waiting for event ... Notification for this event has already been requested. UTIL0 > wait 1 0 Waiting for event ... Timed out. UTIL0 > wait 1 10000 Waiting for event ... Timed out. UTIL0 >

rfm2g_util.c Utility Program 141

2.3.60 write
ThewritecommandwritesoneormorebytesstartingatanoffsetinReflective Memory(i.e.allowstheusertofillmemoryareawithabyte,wordorlongword). TheutilitycallsRFM2gWrite() towritedatabuffers.IfDMAthresholdandother conditionsaremet,DMAwillbeused;otherwise,PIOwillbeused.

NOTE

See section Big Endian and Little Endian Data Conversions, page 44 for information on the big endian/little endian byte-reordering process used by the RFM2g driver when accessing multibyte data. If byte swapping is enabled on the RFM2g device, offset and length must be width aligned.

Syntax
write value offset width length

Parameters
value

Byte,wordorlongwordvaluetowritetotherangespecifiedby offset,lengthandwidth(I). WidthalignedoffsetinReflectiveMemoryatwhichtobegin thewrite(I).Validoffsetvaluesare0x0to0x3FFFFFFfor64MB cards,and0x0to0x7FFFFFFfor128MBcards. Indicatesaccesswidthinbits,whichisoneofthefollowing(I): Value 1 2 4 8 Description 8bitbyte 16bitword 32bitlongword 64bitlongword

offset

width

length

Numberofwidthunitstowrite(I),whichisdeterminedusing theformula[buffersize]/width.Forexample,thelengthofa buffersizeof1024in32bitlongwordsis256(1024/4=256). WidthBit bytes words 32bitlongword 64bitlong MaximumLength(Dec/Hex) for128MBCards 134217728(0x8000000) 67108864(0x4000000) 33554432(0x2000000) 16777216(0x1000000)

Example
UTIL0 Write Write UTIL0 > write 0 0 1 16 1000 used DMA. completed. >

142 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

2.4 Troubleshooting the rfm2g_util.c Command Line Interpreter


IfyouencounterproblemsbuildingorexercisingtheRFM2gdriver,thissection containspossiblesolutionsanddiscussesthemostcommonsourcesoferrorsand howtoreduceerrorpossibilities.

2.4.1 Errors
Usethefollowingmethodtoperformdriverbuildtroubleshooting. Ifthecompileroutputsthefollowingerror,theoperatingsystemforwhichthefile istobecompiledhasnotbeendefinedinthebuildspecification.
C:\RFM2g\PCI\VxWorks\rfm2g_util.c:59: #error Please define DEVICE_PREFIX for your driver.

Toresolvethiserror,definetheoperatingsysteminthebuildoptionsasfollows: OperatingSystem VxWorks Solaris Linux Windows BuildOptionDefinition DRFM2G_VXWORKS DRFM2G_SOLARIS DRFM2G_LINUX None

rfm2g_util.c Utility Program 143

3 RFM2g Sample Applications


Thischaptercontainsinformationonthethreesampleapplicationprograms deliveredwiththeRFM2gdriverintherfm2g/samplesfolder.Theseprograms provideexamplesonhowtousethedriverandAPIwithyourapplicationandare intendedtoworktogethertodemonstratebasicdatatransferandinterrupt handshaking: rfm2g_sender.c rfm2g_receiver.c rfm2g_map.c Tousetheprogramstogether,itisassumedthat: Twosystemsarepresent EachsystemcontainsaReflectiveMemorycard TheReflectiveMemorycardsinthesystemsareconnectedtoeachother EachsystemhastheRFM2gdevicedriverinstalled Seeyourdriverspecificdocumentationforthelocationofthesefilesand informationonhowtobuildtheexecutableprograms.

3.1 rfm2g_sender.c
Therfm2g_sender.cprogramrunsonsystem1anddoesthefollowing: 1. WritesasmallbufferofdatatoReflectiveMemory 2. Sendsaninterrupteventtosystemnumber2 3. Waitstoreceiveaninterrupteventfromsystemnumber2 4. Readsabufferofdata(writtenbysystemnumber2)fromadifferentReflec tiveMemorylocation 5. ClosestheRFM2gdriver.

3.2 rfm2g_receiver.c
Therfm2g_receiver.cprogramrunsonsystem2anddoesthefollowing: 1. OpenstheRFM2gdriver 2. Waitstoreceiveaninterrupteventfromsystemnumber1 3. Readsthebufferofdata(writtenbysystemnumber1)fromReflectiveMem ory 4. WritesthebufferofdatatoadifferentReflectiveMemorylocation 5. Sendsaninterrupteventtosystemnumber1 6. ClosestheRFM2gdriver.

144 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

3.3 rfm2g_map.c
Therfm2g_map.cprogramdemonstratestheusageoftheRFM2gUserMemory() function,whichenablesyoutoobtainapointerfordirectlyaccessingthememory oftheRFM2gdevice.

3.4 rfm2g_sender.c and rfm2g_receiver.c Example Workflow


Thefollowingisanexampleworkflowusingtherfm2g_sender.cand rfm2g_receiver.cprograms. Inthisexample: Verbosemodeisnotenabledforrfm2g_sender.corrfm2g_receiver.c. Continuousmodeisenabledforrfm2g_receiver.c. Thedevicenumberofthehostcomputerrunningtherfm2g_sender.cpro gramis0. Thedevicenumberofthetargetcomputerrunningtherfm2g_receiver.c programis3. 1. Starttherfm2g_sender.cprogramonthehostsystembyfollowingthe directionsinyourdriverspecificmanual. Thefollowingisdisplayedintheconsolewindow:
PCI RFM2g Sender Please enter device number:

2. TypetheRFM2ghostsdevicenumber(0,1,etc.)andpress<ENTER>. Thefollowingisdisplayedinthehostsconsolewindow:
Do you wish for sender to loop continuously? (Y/N):

3. EnterYtousetherfm2g_sender.ccommandincontinuousmodesothatit willruncontinuously. or EnterNifyoudonotwanttouserfm2g_sender.cincontinuousmode. Thefollowingisdisplayedinthehostsconsolewindow:


Do you wish for sender to be verbose? (Y/N):

4. EnterY tousetherfm2g_sender.ccommandinverbosemodesothatthe buffercontentsaredumpedtothescreenwhileitisrunning. or EnterN ifyoudonotwanttouserfm2g_sender.cinverbosemode. Thefollowingisdisplayedinthehostsconsolewindow:


What is the Reflective Memory Node ID of the computer running the "RFM2G_receiver" program?

5. TypetheRFM2gtargetsdevicenumber(0,1,etc.)andpress<ENTER>. Thefollowingisdisplayedinthehostsconsolewindow:
Start the "RFM2G_receiver" program on the other computer. Press RETURN to continue ...

RFM2g Sample Applications 145

6. Starttherfm2g_receiver.cprogramonthetargetsystembyfollowingthe directionsinyourdriverspecificmanual. Thefollowingisdisplayedintheconsolewindow:


PCI RFM2g Receiver Please enter device number:

7. TypetheRFM2gtargetsdevicenumber(0,1,etc.)andpress<ENTER>. Thefollowingisdisplayedinthetargetsconsolewindow:
Do you wish for receiver to loop continuously? (Y/N):

8. EnterYtousetherfmwg_receiver.ccommandincontinuousmodesothatit willruncontinuously. or EnterNifyoudonotwanttouserfm2g_receiver.cincontinuousmode. Thefollowingisdisplayedinthetargetsconsolewindow:


Do you wish for receiver to be verbose? (Y/N):

9. EnterYtousetherfm2g_receiver.ccommandinverbosemodesothatthe buffercontentsaredumpedtothescreenwhileitisrunning. or EnterNifyoudonotwanttouserfm2g_receiver.cinverbosemode. Thefollowingisdisplayedinthetargetsconsolewindow:


Waiting 60 seconds to receive an interrupt from the other Node ...Received the interrupt from Node 3. Data was read from Reflective Memory. The data was written to Reflective Memory starting at offset 0x2000. An interrupt was sent to Node 3. Success!

10. Returntothehostsystem.Thefollowingisdisplayedinthehostsconsole window:


The data was written to Reflective Memory. was sent to Node 3. An interrupt

Waiting 60 seconds for an interrupt from Node 3 ... Received the interrupt from Node 3. Success!

146 Common RFM2g Application Program Interface (API) and Command Line Interpreter for VMISFT/RFM2g Drivers

3.5 rfm2g_map.c Example Workflow


Thefollowingisanexampleworkflowusingtherfm2g_,map.cprogram. Inthisexample,theRFM2gdevicesnumberis0. 1. Starttherfm2g_map.cprogrambyfollowingthedirectionsinyourdriver specificmanual. Thefollowingisdisplayedintheconsolewindow:
PCI RFM2g Map Please enter device number:

2. TypetheRFM2gdevicesnumber(0,1,etc.)andpress<ENTER>. Thefollowingisdisplayedinthehostsconsolewindow:
Wrote: Wrote: Wrote: Wrote: A5A50000, A5A50001, A5A50002, A5A50003, Read: Read: Read: Read: A5A50000 A5A50001 A5A50002 A5A50003

Success!

RFM2g Sample Applications 147

Maintenance
IfaGEproductmalfunctions,pleaseverifythefollowing: 1. Softwareversionresidentontheproduct 2. Systemconfiguration 3. Electricalconnections 4. Jumperorconfigurationoptions 5. Boardsarefullyinsertedintotheirproperconnectorlocation 6. Connectorpinsarecleanandfreefromcontamination 7. Nocomponentsoradjacentboardsweredisturbedwheninsertingorremov ingtheboardfromthechassis 8. QualityofcablesandI/Oconnections Ifproductsmustbereturned,contactGEforaReturnMaterialAuthorization (RMA)Number.ThisRMANumbermustbeobtainedpriortoanyreturnfrom CustomerCare. GECustomerCareisavailableat:18004332682inNorthAmerica, or+17804017700forinternationalcalls.Or,visitourwebsitewww.geip.com.

Maintenance Prints
Userlevelrepairsarenotrecommended.Thedrawingsanddiagramsinthis manualareforreferencepurposesonly.

Maintenance 148

2010 GE Intelligent Platforms Embedded Systems, Inc. All rights reserved. * indicates a trademark of GE Intelligent Platforms, Inc. and/or its affiliates. All other trademarks are the property of their respective owners. Confidential Information - This document contains Confidential/Proprietary Information of GE Intelligent Platforms, Inc. and/or its suppliers or vendors. Distribution or reproduction prohibited without permission. THIS DOCUMENT AND ITS CONTENTS ARE PROVIDED "AS IS", WITH NO REPRESENTATIONS OR WARRANTIES OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF DESIGN, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. ALL OTHER LIABILITY ARISING FROM RELIANCE UPON ANY INFORMATION CONTAINED HEREIN IS EXPRESSLY DISCLAIMED.

GE Intelligent Platforms Information Centers


Americas: 1 800 322 3616 or 1 256 880 0444 Asia Pacific: 86 10 6561 1561 Europe, Middle East and Africa: Germany +49 821 5034-0 UK +44 1327 359444

Additional Resources
For more information, please visit the GE Intelligent Platforms Embedded Systems web site at:

www.ge-ip.com

Publication No. 523-000447-000 Rev. F

You might also like