Last active
October 30, 2019 19:28
-
-
Save gitlarryf/fa17401561ab210db86a718a97d1c60a to your computer and use it in GitHub Desktop.
MVI69E-LDM Neon Extension module interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% File : mvi69.neon | |
% Author : Larry Frieson | |
% Desc : Contains definitions, structures, and function templates for all functions defined in the MVI69E API. This file | |
% is distributed as part of the Neon Extension API for the MVI69E-LDM module. | |
% Date : 10/14/2019 | |
% | |
% Copyright (C) 2019 ProSoft Technology, Inc. All rights reserved. | |
% | |
% Revision History: | |
% 10/14/2019 17:56:43 LEF - created. | |
% | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
IMPORT struct | |
EXPORT MVI69VersionInfo | |
EXPORT MVI69IOConfig | |
EXPORT MVI69ModuleInfo | |
EXPORT MVI69SPConfig | |
EXPORT Open | |
EXPORT OpenNB | |
EXPORT Close | |
EXPORT GetVersionInfo | |
EXPORT SetLED | |
EXPORT GetSetupJumper | |
EXPORT GetModuleInfo | |
EXPORT SetModuleInfo | |
EXPORT GetSerialConfig | |
EXPORT SetSerialConfig | |
EXPORT GetScanCounter | |
EXPORT GetScanMode | |
EXPORT GetIOConfig | |
EXPORT SetIOConfig | |
EXPORT ReadOutputImage | |
EXPORT WriteInputImage | |
EXPORT WaitForInputScan | |
EXPORT WaitForOutputScan | |
EXPORT GetMsgRequestFromBp | |
EXPORT SendMsgResponseToBp | |
%*************************************************** | |
% API Function Return Values | |
% | |
% These values are returned by the API functions | |
% to indicate success or possible error conditions. | |
%**************************************************** | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_SUCCESS : Number % function returned successfully | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_ERR_BADPARAM : Number % parameter contains invalid value | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_ERR_REOPEN : Number % already open | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_ERR_NODEVICE : Number % device is not present | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_ERR_NOACCESS : Number % handle is invalid or not opened | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_ERR_TIMEOUT : Number % action timeout | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_ERR_MSGTOOBIG : Number % The message is too large | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_ERR_BADCONFIG : Number % The IO is not configured properly | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_ERR_MEMALLOC : Number % Unable to allocate memory | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_ERR_NOTSUPPORTED: Number % Function is not supported on this platform | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_ERR_DRIVERFAIL : Number % Device driver error | |
%************************************ | |
% LED DEFINITIONS | |
% | |
% These values are passed to the | |
% MVI69_SetLED function. | |
%************************************ | |
% LED Identifiers | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_LEDID_OK : Number % Selects OK LED | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_LEDID_CFG : Number % Selects CFG LED | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_LEDID_P1 : Number % Selects P1 LED | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_LEDID_P2 : Number % Selects P2 LED | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_LEDID_BP : Number % Selects BP LED | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_LEDID_NET : Number % Selects NET LED | |
% LED States | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_LED_STATE_OFF : Number % LED is OFF | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_LED_STATE_GREEN : Number % LED is GREEN | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_LED_STATE_RED : Number % LED is RED | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_LED_STATE_YELLOW: Number % LED is YELLOW (RED & GREEN both on) | |
%************************************************************** | |
% SERIAL PORT CONFIGURATION | |
% | |
% These values are returned from the MVI69_GetSerialConfig | |
% function, and passed to the MVI69_SetSerialConfig function. | |
% | |
%************************************************************** | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_SERIAL_CONFIG_NONE : Number% No jumper is installed | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_SERIAL_CONFIG_RS232: Number% Port is configured for RS-232 | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_SERIAL_CONFIG_RS422: Number% Port is configured for RS-422 | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_SERIAL_CONFIG_RS485: Number% Port is configured for RS-485 | |
%************************************************************** | |
% SCAN MODE | |
% | |
% These values are returned from the MVI69_GetScanMode | |
% function. | |
% | |
%*************************************************************** | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_PROGRAM_MODE : Number % Processor is in Program Mode | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_RUN_MODE : Number % Processor is in RUN mode | |
%************************************************************** | |
% IO IMAGE MAXIMUM SIZES | |
% | |
% These are the maximum supported sizes in words for the | |
% input and output images. | |
% | |
%*************************************************************** | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_MAX_INPUT_WORDS : Number % Max number of 16 bit values for the INPUT image | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_MAX_OUTPUT_WORDS: Number % Max number of 16 bit values for the OUTPUT image | |
%*************************************************************** | |
% MESSAGE BUFFER MAXIMUM SIZES | |
% | |
% These are the maximum supported sizes in bytes for the | |
% receive and send message buffers. | |
% | |
%*************************************************************** | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_MAX_MSG_RCVBUF_LEN : Number | |
EXPORT DECLARE EXTENSION CONSTANT MVI69_MAX_MSG_SNDBUF_LEN : Number | |
EXPORT TYPE MVI69Handle IS POINTER % Backplane driver handle, required by all API calls. | |
%************************************************************ | |
% Structure Name: MVI69VERSIONINFO | |
% | |
% Description: | |
% | |
% Returned by MVI69_GetVersionInfo(). | |
% Software version numbers. | |
% | |
%************************************************************* | |
TYPE MVI69VersionInfo IS RECORD | |
APISeries: Number % API series | |
APIRevision: Number % API revision | |
DDSeries: Number % Device driver series | |
DDRevision: Number % Device driver revision | |
END RECORD | |
LET Struct_MVI69VersionInfo: struct.Struct := struct.make([ | |
struct.field("APISeries", struct.Type.int32LE, 4), | |
struct.field("APIRevision", struct.Type.int32LE, 4), | |
struct.field("DDSeries", struct.Type.int32LE, 4), | |
struct.field("DDRevision", struct.Type.int32LE, 4), | |
]) | |
FUNCTION MVI69VersionInfo.pack(self: MVI69VersionInfo): Bytes | |
VAR d: Dictionary<Object> := {} | |
d["APISeries"] := self.APISeries | |
d["APIRevision"] := self.APIRevision | |
d["DDSeries"] := self.DDSeries | |
d["DDRevision"] := self.DDRevision | |
RETURN Struct_MVI69VersionInfo.pack(d) | |
END FUNCTION | |
FUNCTION MVI69VersionInfo.unpack(INOUT self: MVI69VersionInfo, data: Bytes) | |
LET d: Dictionary<Object> := Struct_MVI69VersionInfo.unpack(data) | |
self.APISeries := d["APISeries"] | |
self.APIRevision := d["APIRevision"] | |
self.DDSeries := d["DDSeries"] | |
self.DDRevision := d["DDRevision"] | |
END FUNCTION | |
%************************************************************ | |
% Structure Name: MVI69IOCONFIG | |
% | |
% Description: | |
% | |
% Returned by MVI69_GetIOConfig(). | |
% | |
%************************************************************* | |
TYPE MVI69IOConfig IS RECORD | |
MappedInputWords : Number % # of mapped input words | |
MappedOutputWords : Number % # of mapped output words | |
MsgRcvBufSize : Number % max size of received messages | |
MsgSndBufSize : Number % mas size of sent messages | |
END RECORD | |
%************************************************************ | |
% Structure Name: MVI69MODULEINFO | |
% | |
% Description: | |
% | |
% Returned by MVI69_GetModuleInfo(). | |
% | |
%************************************************************* | |
TYPE MVI69ModuleInfo IS RECORD | |
VendorID: Number % Vendor identification (WORD) | |
DeviceType: Number % Device type code (WORD) | |
ProductCode: Number % Device model code (WORD) | |
MajorRevision: Number % Module major revision (BYTE) | |
MinorRevision: Number % Module minor revision (BYTE) | |
SerialNo: Number % Serial number (UINT32) | |
Name: String % Device name (string) | |
END RECORD | |
%************************************************************ | |
% Structure Name: MVI69SPCONFIG | |
% | |
% Description: | |
% | |
% Serial Port configuration structure | |
% | |
%************************************************************* | |
TYPE MVI69SPConfig IS RECORD | |
port_num: Number | |
port_cfg: Number | |
END RECORD | |
%************************************************************ | |
% FUNCTION PROTOTYPES | |
%************************************************************ | |
DECLARE EXTENSION FUNCTION Open(OUT handle: MVI69Handle): Number | |
DECLARE EXTENSION FUNCTION OpenNB(OUT handle: MVI69Handle): Number | |
DECLARE EXTENSION FUNCTION Close(handle: MVI69Handle): Number | |
DECLARE EXTENSION FUNCTION GetVersionInfo(handle: MVI69Handle, OUT pVersion: MVI69VersionInfo): Number | |
DECLARE EXTENSION FUNCTION SetLED(handle: MVI69Handle, which_led, led_state: Number): Number | |
DECLARE EXTENSION FUNCTION GetSetupJumper(handle: MVI69Handle, OUT mode: Number): Number | |
DECLARE EXTENSION FUNCTION GetModuleInfo(handle: MVI69Handle, OUT pIdObj: MVI69ModuleInfo): Number | |
DECLARE EXTENSION FUNCTION SetModuleInfo(handle: MVI69Handle, INOUT pIdObj: MVI69ModuleInfo): Number | |
DECLARE EXTENSION FUNCTION GetSerialConfig(handle: MVI69Handle, OUT spconfig: MVI69SPConfig): Number | |
DECLARE EXTENSION FUNCTION SetSerialConfig(handle: MVI69Handle, INOUT spconfig: MVI69SPConfig): Number | |
DECLARE EXTENSION FUNCTION GetScanCounter(handle: MVI69Handle, INOUT count: Number): Number | |
DECLARE EXTENSION FUNCTION GetScanMode(handle: MVI69Handle, INOUT mode: Number): Number | |
DECLARE EXTENSION FUNCTION GetIOConfig(handle: MVI69Handle, OUT iocfg: MVI69IOConfig): Number | |
DECLARE EXTENSION FUNCTION SetIOConfig(handle: MVI69Handle, INOUT piocfg: MVI69IOConfig): Number | |
DECLARE EXTENSION FUNCTION ReadOutputImage(handle: MVI69Handle, offset, len: Number, OUT data: Bytes): Number | |
DECLARE EXTENSION FUNCTION WriteInputImage(handle: MVI69Handle, offset, len: Number, INOUT pdata: Bytes): Number | |
DECLARE EXTENSION FUNCTION WaitForInputScan(handle: MVI69Handle, timeout: Number): Number | |
DECLARE EXTENSION FUNCTION WaitForOutputScan(handle: MVI69Handle, timeout: Number): Number | |
DECLARE EXTENSION FUNCTION GetMsgRequestFromBp(handle: MVI69Handle, OUT pBuffer: Bytes, INOUT pLength: Number, timeout: Number): Number | |
DECLARE EXTENSION FUNCTION SendMsgResponseToBp(handle: MVI69Handle, pBuffer: Bytes, Length: Number): Number |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment