//This file was generated by the LASAL2 CodeGenerator  -- 
//Please, do not edit this file (it might be overwritten by the next generator run)
//{{LSL_DECLARATION
#include "..\..\Class\HwControl\HwControl.h"

(*!
<Class
	Name               = "VaranManager_Base"
	Revision           = "1.26"
	GUID               = "{C7469E6D-58D6-464D-8C08-61D9F18730FD}"
	RealtimeTask       = "false"
	CyclicTask         = "false"
	BackgroundTask     = "false"
	Sigmatek           = "true"
	OSInterface        = "false"
	HighPriority       = "false"
	Automatic          = "false"
	UpdateMode         = "Prescan"
	IconPath           = ".\Class\Tool.ico"
	SharedCommandTable = "true"
	Objectsize         = "(284,120)"
	Comment            = "baseclass of varan master">
	<Channels>
		<Server Name="Control" GUID="{217B6364-B62D-4D4A-A8F6-84A5BF141EC1}" Visualized="true" Initialize="false" WriteProtected="true" Retentive="false"/>
		<Client Name="To_FileSys" Required="false" Internal="false"/>
		<Client Name="To_OSKernel" Required="false" Internal="false"/>
		<Client Name="To_StdLib" Required="false" Internal="false" Comment="is connected automatically to OS-Class"/>
	</Channels>
	<Dependencies>
		<Files>
			<File Path=".\Class\VaranManager_Base\VaranManager_Base.h" Include="false"/>
			<File Path=".\Class\HwControl\HwControl.h" Include="true"/>
			<File Path=".\Source\interfaces\lsl_st_varan.h" Include="false"/>
		</Files>
	</Dependencies>
	<RevDoku>
		<Owner Company="Sigmatek" Author="renste"/>
		<Dokumentation Revision="1.26" Date="03.08.2023" Author="EisMic" Company="Sigmatek" Description="Added newinst commands in headerfile VaranManager_Base.h."/>
		<Dokumentation Revision="1.25" Date="12.11.2019" Author="RamAnd" Company="Sigmatek" Description="Detached the logging functionality from HwControl into a new class HwcLogging, therefore the dependency at this class has been changed to HwcLogging."/>
		<Dokumentation Revision="1.24" Date="06.03.2018" Author="EisMic" Company="Sigmatek" Description="Attached header files no longer point to the installation directory of LASAL but instead now point to the the source/interfaces folder."/>
		<Dokumentation Revision="1.23" Date="23.01.2018" Author="RamAnd" Company="Sigmatek" Description="Log messages have been standardized for easier maintenance, easier use in any class and to allow spam filtering. Code for the logging functions is now only located in HwControl."/>
		<Dokumentation Revision="1.22" Date="04.04.2017" Author="EisMic" Company="Sigmatek" Description="Added define to identify the version for the support of new INTERFACE_MULTIVARANMANAGER properties."/>
		<Dokumentation Revision="1.21" Date="21.05.2014" Author="LanSte" Company="Sigmatek" Description="Added Define to idnetify the verision for support of INTERFACE_MULTIVARANMANAGER dol timing Methods."/>
		<Dokumentation Revision="1.20" Date="06.12.2013" Author="LanSte" Company="Sigmatek" Description="Added define for DMA/Payload RTOS Version. "/>
		<Dokumentation Revision="1.14" Date="27.06.2011" Author="RamAnd" Company="Sigmatek" Description="Support of sorting VARAN commands by priority added (needed for communication between safety-modules)."/>
		<Dokumentation Revision="1.13" Date="14.10.2010" Author="RamAnd" Company="Sigmatek" Description="Added method AddMovDO for the move command in the VM."/>
		<Dokumentation Revision="1.12" Date="19.07.2010" Author="RamAnd" Company="Sigmatek" Description="Added new method GetNsTimeBPLLTicks for easier internal time measurements"/>
		<Dokumentation Revision="1.11" Date="31.05.2010" Author="BleErn" Company="Sigmatek" Description="Added Support for RtPostScan"/>
		<Dokumentation Revision="1.10" Date="02.09.2009" Author="RamAnd" Company="Sigmatek" Description="Added functions for safety and hardwaretree."/>
		<Dokumentation Revision="1.9" Date="05.08.2009" Author="ObeChr" Company="Sigmatek" Description="Added method: AllowRequiredError&#13;&#10;Added client to OSKernel"/>
		<Dokumentation Revision="1.8" Date="16.07.2009" Author="ObeChr" Company="Sigmatek" Description="Added method: UseVaranRtPostScan&#13;&#10;Added type in VaranManager_Base.h"/>
		<Dokumentation Revision="1.7" Date="16.04.2009" Author="RamAnd" Company="Sigmatek" Description="Added 2 new methods: GetDocumentation and GetSerialNo"/>
	</RevDoku>
</Class>
*)
VaranManager_Base : CLASS
	TYPE
	  RequiredReferenceToHWCLogging : ^HwcLogging;
	END_TYPE
  //Servers:
	Control 	: SvrChCmd_DINT;
  //Clients:
	To_StdLib 	: CltChCmd__StdLib;
	To_FileSys 	: CltChCmd__FileSys;
	To_OSKernel 	: CltChCmd__OSKernel;
  //Variables:
  //Functions:
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;VaranManager_Base Constructor&#13;&#10;=================================================================================================&#13;&#10;" Name="VaranManager_Base"/>
	FUNCTION VaranManager_Base
		VAR_OUTPUT
			ret_code 	: ConfStates;
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Init for VaranManager_Base&#13;&#10;=================================================================================================&#13;&#10;" Name="Init"/>
	FUNCTION VIRTUAL GLOBAL Init;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;This function is called by PostScan from VaranManager_BasePostScan&#13;&#10;=================================================================================================&#13;&#10;" Name="CyWork"/>
	FUNCTION AWL VIRTUAL GLOBAL CyWork
		VAR_INPUT
			EAX 	: UDINT := EAX;
		END_VAR
		VAR_OUTPUT
			state (EAX) 	: UDINT;
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Normal Rt - Funktion for VaranManager_Base&#13;&#10;=================================================================================================&#13;&#10;" Name="RtWork"/>
	FUNCTION AWL VIRTUAL GLOBAL RtWork
		VAR_INPUT
			EAX 	: UDINT := EAX;
		END_VAR
		VAR_OUTPUT
			state (EAX) 	: UDINT;
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Function to add a realtime or cyclic task to Varanmanager&#13;&#10;=================================================================================================&#13;&#10;" Name="AddVaranTask"/>
	FUNCTION AWL VIRTUAL GLOBAL AddVaranTask
		VAR_INPUT
			ud_dol_type 	: UDINT;			//! <Variable Comment=" Type of DOL (see lsl_st_varan.h)" Name="AddVaranTask.ud_dol_type"/>
			p_this 	: ^void;			//! <Variable Comment=" Thispointer of connected varan class" Name="AddVaranTask.p_this"/>
			callOptions 	: USINT := CALL_OPTION_RT_PRESCAN;
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Function to add a read data object to varan manager and install a varan task&#13;&#10;=================================================================================================&#13;&#10;" Name="AddRdDO"/>
	FUNCTION AWL VIRTUAL GLOBAL AddRdDO
		VAR_INPUT
			p_us_position_info 	: ^USINT;			//! <Variable Comment="path of varan" Name="AddRdDO.p_us_position_info"/>
			ud_dol_type 	: UDINT;
			p_ud_handle 	: ^UDINT;			//! <Variable Comment=" pointer to variable to set right handle" Name="AddRdDO.p_ud_handle"/>
			ud_address 	: UDINT;			//! <Variable Comment="address to write" Name="AddRdDO.ud_address"/>
			ud_length 	: UDINT;			//! <Variable Comment="length of data (max. 128Byte)" Name="AddRdDO.ud_length"/>
			p_ud_data 	: ^UDINT;			//! <Variable Comment="pointer to data should be written" Name="AddRdDO.p_ud_data"/>
			ud_type 	: UDINT;			//! <Variable Comment="0=control area, 1=memory area" Name="AddRdDO.ud_type"/>
		END_VAR
		VAR_OUTPUT
			sd_retval 	: DINT;			//! <Variable Comment=" 0=OK, negative=error (look lsl_st_varan.h)" Name="AddRdDO.sd_retval"/>
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Function to add a write data object to varan manager and install a varan task&#13;&#10;=================================================================================================&#13;&#10;" Name="AddWrDO"/>
	FUNCTION AWL VIRTUAL GLOBAL AddWrDO
		VAR_INPUT
			p_us_position_info 	: ^USINT;
			ud_dol_type 	: UDINT;
			p_ud_handle 	: ^UDINT;
			ud_address 	: UDINT;
			ud_length 	: UDINT;
			p_ud_data 	: ^UDINT;
			ud_type 	: UDINT;
		END_VAR
		VAR_OUTPUT
			sd_retval 	: DINT;
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Function to add a read/write data object to varan manager and install a varan task&#13;&#10;=================================================================================================&#13;&#10;" Name="AddRdWrDO"/>
	FUNCTION AWL VIRTUAL GLOBAL AddRdWrDO
		VAR_INPUT
			p_us_position_info 	: ^USINT;
			ud_dol_type 	: UDINT;
			p_ud_handle 	: ^UDINT;
			ud_address_read 	: UDINT;			//! <Variable Comment=" Address of read data object" Name="AddRdWrDO.ud_address_read"/>
			ud_length_read 	: UDINT;			//! <Variable Comment=" Length of read data object" Name="AddRdWrDO.ud_length_read"/>
			p_ud_data_read 	: ^UDINT;			//! <Variable Comment=" pointer to variable to get pointer to data" Name="AddRdWrDO.p_ud_data_read"/>
			ud_address_write 	: UDINT;			//! <Variable Comment=" Address of write data object" Name="AddRdWrDO.ud_address_write"/>
			ud_length_write 	: UDINT;			//! <Variable Comment=" Length of write data object" Name="AddRdWrDO.ud_length_write"/>
			p_ud_data_write 	: ^UDINT;			//! <Variable Comment=" pointer to variable to get pointer to data" Name="AddRdWrDO.p_ud_data_write"/>
			ud_type 	: UDINT;
		END_VAR
		VAR_OUTPUT
			sd_retval 	: DINT;
		END_VAR;
	
	FUNCTION AWL VIRTUAL GLOBAL AddMovDO
		VAR_INPUT
			ud_dol_type 	: UDINT;
			p_ud_handle 	: ^UDINT;
			p_ud_MovSettings 	: ^UDINT;
			ud_type 	: UDINT := 0;			//! <Variable Comment="access type is always memory, but we may want to have some priority for this access" Name="AddMovDO.ud_type"/>
		END_VAR
		VAR_OUTPUT
			sd_retval 	: DINT;
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Function executes a data object list of VaranManager&#13;&#10;=================================================================================================&#13;&#10;" Name="ExecuteDOL"/>
	FUNCTION AWL VIRTUAL GLOBAL ExecuteDOL
		VAR_INPUT
			ud_dol_type 	: UDINT;
		END_VAR
		VAR_OUTPUT
			sd_retval 	: DINT;
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Function clears a data object list of VaranManager&#13;&#10;=================================================================================================&#13;&#10;" Name="ClearDOL"/>
	FUNCTION AWL VIRTUAL GLOBAL ClearDOL
		VAR_INPUT
			ud_dol_type 	: UDINT;
		END_VAR
		VAR_OUTPUT
			sd_retval 	: DINT;
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Function to read a direct access data object&#13;&#10;=================================================================================================&#13;&#10;" Name="RdDO"/>
	FUNCTION AWL VIRTUAL GLOBAL RdDO
		VAR_INPUT
			p_us_position_info 	: ^USINT;
			ud_address 	: UDINT;
			ud_length 	: UDINT;
			p_ud_data 	: ^UDINT;
			ud_type 	: UDINT;
		END_VAR
		VAR_OUTPUT
			sd_retval 	: DINT;
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Function to write a direct access data object&#13;&#10;=================================================================================================&#13;&#10;" Name="WrDO"/>
	FUNCTION AWL VIRTUAL GLOBAL WrDO
		VAR_INPUT
			p_us_position_info 	: ^USINT;
			ud_address 	: UDINT;
			ud_length 	: UDINT;
			p_ud_data 	: ^UDINT;
			ud_type 	: UDINT;
		END_VAR
		VAR_OUTPUT
			sd_retval 	: DINT;
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Function to get Pll - Time of Varanmanager&#13;&#10;=================================================================================================&#13;&#10;" Name="GetVaranTime"/>
	FUNCTION AWL VIRTUAL GLOBAL GetVaranTime
		VAR_INPUT
			p_ud_IsoStartPoint 	: ^UDINT := NIL;
		END_VAR
		VAR_OUTPUT
			ud_varan_time 	: UDINT;			//! <Variable Comment=" Varantime in ns" Name="GetVaranTime.ud_varan_time"/>
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Function to get Varan class position in a string&#13;&#10;=================================================================================================&#13;&#10;" Name="GetVaranPosition"/>
	FUNCTION AWL VIRTUAL GLOBAL GetVaranPosition
		VAR_INPUT
			p_us_info 	: ^USINT;			//! <Variable Comment=" pointer to save position info (first byte is length)" Name="GetVaranPosition.p_us_info"/>
		END_VAR
		VAR_OUTPUT
			sd_retval 	: DINT;
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Function to install callback function for hot plug and play&#13;&#10;=================================================================================================&#13;&#10;" Name="SetObjectCallback"/>
	FUNCTION AWL VIRTUAL GLOBAL SetObjectCallback
		VAR_INPUT
			p_us_position_info 	: ^USINT;
			ud_action_ptr 	: UDINT;			//! <Variable Comment="pointer to function" Name="SetObjectCallback.ud_action_ptr"/>
			ud_thisp 	: UDINT;			//! <Variable Comment="thispointer" Name="SetObjectCallback.ud_thisp"/>
			sd_required 	: DINT;			//! <Variable Comment="is class required" Name="SetObjectCallback.sd_required"/>
		END_VAR
		VAR_OUTPUT
			sd_retval 	: DINT;
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Function sets manager off&#13;&#10;=================================================================================================&#13;&#10;" Name="SetManagerOff"/>
	FUNCTION AWL VIRTUAL GLOBAL SetManagerOff
		VAR_INPUT
			e_error 	: t_e_VaranErrors;			//! <Variable Comment="reason why varan manager is set off" Name="SetManagerOff.e_error"/>
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Function produces a Varan Error&#13;&#10;=================================================================================================&#13;&#10;" Name="SetVaranError"/>
	FUNCTION AWL VIRTUAL GLOBAL SetVaranError
		VAR_INPUT
			p_Node 	: ^USINT;			//! <Variable Comment="pointer to Node string" Name="SetVaranError.p_Node"/>
		END_VAR;
				//! <Function Comment="Function returns a nano second counter value of Varanmanager&#13;&#10;" Name="GetNsTime"/>
	FUNCTION AWL VIRTUAL GLOBAL GetNsTime
		VAR_OUTPUT
			ud_ns_counter 	: UDINT;			//! <Variable Comment="nano second counter value" Name="GetNsTime.ud_ns_counter"/>
		END_VAR;
				//! <Function Comment="Functions returns the nano second counter value of VaranManager between the PLL ticks (time since last tick)" Name="GetNsTimeBPLLTicks"/>
	FUNCTION AWL VIRTUAL GLOBAL GetNsTimeBPLLTicks
		VAR_OUTPUT
			ud_ns_counter 	: UDINT;			//! <Variable Comment="time since last tick" Name="GetNsTimeBPLLTicks.ud_ns_counter"/>
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Function to get pointer to node information&#13;&#10;=================================================================================================&#13;&#10;" Name="GetNodeInfo"/>
	FUNCTION AWL VIRTUAL GLOBAL GetNodeInfo
		VAR_INPUT
			p_us_position_info 	: ^USINT;
			p_node_info 	: ^PLSL_VARANNODEINFO;			//! <Variable Comment="pointer to node info" Name="GetNodeInfo.p_node_info"/>
		END_VAR
		VAR_OUTPUT
			sd_retval 	: DINT;
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Function to get Varan Master number&#13;&#10;=================================================================================================&#13;&#10;" Name="GetManagerNumber"/>
	FUNCTION AWL VIRTUAL GLOBAL GetManagerNumber
		VAR_INPUT
			p_varan 	: ^pVoid;			//! <Variable Comment="address of pointer to varan" Name="GetManagerNumber.p_varan"/>
		END_VAR
		VAR_OUTPUT
			ud_manager_number 	: UDINT;			//! <Variable Comment="number of varan master" Name="GetManagerNumber.ud_manager_number"/>
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Function returns state of Varan manger class&#13;&#10;=================================================================================================&#13;&#10;" Name="GetManagerState"/>
	FUNCTION AWL VIRTUAL GLOBAL GetManagerState
		VAR_OUTPUT
			e_state 	: t_e_VaranErrors;			//! <Variable Comment="error of varan manager" Name="GetManagerState.e_state"/>
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Function to read SPI data&#13;&#10;=================================================================================================&#13;&#10;" Name="ReadSPIData"/>
	FUNCTION AWL VIRTUAL GLOBAL ReadSPIData
		VAR_INPUT
			p_us_position_info 	: ^USINT;			//! <Variable Comment="nodestring of varan client" Name="ReadSPIData.p_us_position_info"/>
			ud_offset 	: UDINT;			//! <Variable Comment="offset in SPI flash" Name="ReadSPIData.ud_offset"/>
			ud_length 	: UDINT;			//! <Variable Comment="length of data to read (if MSB is set, access is done on the last page in SPI)" Name="ReadSPIData.ud_length"/>
			p_data 	: ^USINT;			//! <Variable Comment="pointer to allocated memory for read data" Name="ReadSPIData.p_data"/>
		END_VAR
		VAR_OUTPUT
			sd_retval 	: DINT;			//! <Variable Comment="0...success&#13;&#10;or else negative errorcode is returned" Name="ReadSPIData.sd_retval"/>
		END_VAR;
				//! <Function Comment="[#ENGLISH]&#13;&#10;=================================================================================================&#13;&#10;Function to get sync frame counter&#13;&#10;=================================================================================================&#13;&#10;" Name="GetSyncFrameCounter"/>
	FUNCTION AWL VIRTUAL GLOBAL GetSyncFrameCounter
		VAR_OUTPUT
			us_frame_counter 	: USINT;			//! <Variable Comment=" sync frame counter" Name="GetSyncFrameCounter.us_frame_counter"/>
		END_VAR;
	
	FUNCTION VIRTUAL GLOBAL LogMessage
		VAR_INPUT
			p_message 	: ^CHAR;
			us_nr 	: USINT;
			sd_var1 	: DINT;
			sd_var2 	: DINT;
			sd_var3 	: DINT;
		END_VAR;
				//! <Function Comment="[#DEUTSCH]&#13;&#10;=================================================================================================&#13;&#10;Function to disable device in cyclic&#13;&#10;=================================================================================================&#13;&#10;" Name="SetDisableDevice"/>
	FUNCTION AWL VIRTUAL GLOBAL SetDisableDevice
		VAR_INPUT
			p_us_position_info 	: ^USINT;
		END_VAR
		VAR_OUTPUT
			sd_retval 	: DINT;
		END_VAR;
	
	FUNCTION AWL VIRTUAL GLOBAL GetDocumentation
		VAR_INPUT
			p_us_position_info 	: ^USINT;
			p_dpne 	: ^CHAR;
		END_VAR
		VAR_OUTPUT
			sd_retval 	: DINT;
		END_VAR;
	
	FUNCTION AWL VIRTUAL GLOBAL GetSerialNo
		VAR_INPUT
			p_us_position_info 	: ^USINT;
			p_SerialNo 	: ^CHAR;
		END_VAR
		VAR_OUTPUT
			sd_retval 	: DINT;
		END_VAR;
	
	FUNCTION AWL VIRTUAL GLOBAL AllowRequiredError
		VAR_OUTPUT
			sd_retval 	: DINT;
		END_VAR;
	
	FUNCTION AWL VIRTUAL GLOBAL SetObjectThisp
		VAR_INPUT
			p_us_ObjectPath 	: ^USINT;
			ud_thisp 	: UDINT;
		END_VAR
		VAR_OUTPUT
			sd_retval 	: DINT;
		END_VAR;
	
	FUNCTION AWL VIRTUAL GLOBAL GetObjectThisp
		VAR_INPUT
			p_us_ObjectPath 	: ^USINT;
		END_VAR
		VAR_OUTPUT
			ud_thisp 	: UDINT;
		END_VAR;
  //Tables:
	FUNCTION @STD
		VAR_OUTPUT
			ret_code	: CONFSTATES;
		END_VAR;
	FUNCTION GLOBAL TAB @CT_;
END_CLASS;

#pragma usingLtd _FileSys
#pragma usingLtd _OSKernel
#pragma usingLtd _StdLib


//}}LSL_DECLARATION


FUNCTION GLOBAL TAB VaranManager_Base::@CT_
0$UINT,
2#0100000000000000$UINT, //TY_VARANMANAGER_BASE
1$UINT, 26$UINT, (SIZEOF(::VaranManager_Base))$UINT, 
1$UINT, 3$UINT, 0$UINT, 
TO_UDINT(4035182347), "VaranManager_Base", //Class
TO_UDINT(0), 0, 0$UINT, 0$UINT, //Baseclass
//Servers:
(::VaranManager_Base.Control.pMeth)$UINT, _CH_CMD$UINT, 2#0000000000000000$UINT, TO_UDINT(3533623889), "Control", 
//Clients:
(::VaranManager_Base.To_StdLib.pCh)$UINT, _CH_CLT_OBJ$UINT, 2#0000000000000000$UINT, TO_UDINT(2139173287), "To_StdLib", TO_UDINT(3689364044), "_StdLib", 2$UINT, 0$UINT, 
(::VaranManager_Base.To_FileSys.pCh)$UINT, _CH_CLT_OBJ$UINT, 2#0000000000000000$UINT, TO_UDINT(402396130), "To_FileSys", TO_UDINT(545279513), "_FileSys", 1$UINT, 20$UINT, 
(::VaranManager_Base.To_OSKernel.pCh)$UINT, _CH_CLT_OBJ$UINT, 2#0000000000000000$UINT, TO_UDINT(2681344549), "To_OSKernel", TO_UDINT(3045737964), "_OSKernel", 0$UINT, 5$UINT, 
END_FUNCTION


#define USER_CNT_VaranManager_Base 28

TYPE
	_LSL_STD_VMETH	: STRUCT
			CmdTable	: CMDMETH;
			UserFcts	: ARRAY[0..USER_CNT_VaranManager_Base] OF ^Void;
	END_STRUCT;
END_TYPE

FUNCTION VaranManager_Base::@STD
	VAR_OUTPUT
		ret_code	: CONFSTATES;
	END_VAR
	VAR
		vmt	: _LSL_STD_VMETH;
	END_VAR

	//Command Methods
	InitCmdTable (nCmd := nSTDCMD + USER_CNT_VaranManager_Base, pCmd := #vmt.CmdTable);
	vmt.CmdTable.Init		:= #Init();
	vmt.CmdTable.CyWork		:= #CyWork();
	vmt.CmdTable.RtWork		:= #RtWork();
#pragma warning (disable : 74)
	vmt.UserFcts[0]		:= #AddVaranTask();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[1]		:= #AddRdDO();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[2]		:= #AddWrDO();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[3]		:= #AddRdWrDO();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[4]		:= #AddMovDO();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[5]		:= #ExecuteDOL();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[6]		:= #ClearDOL();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[7]		:= #RdDO();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[8]		:= #WrDO();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[9]		:= #GetVaranTime();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[10]		:= #GetVaranPosition();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[11]		:= #SetObjectCallback();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[12]		:= #SetManagerOff();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[13]		:= #SetVaranError();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[14]		:= #GetNsTime();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[15]		:= #GetNsTimeBPLLTicks();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[16]		:= #GetNodeInfo();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[17]		:= #GetManagerNumber();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[18]		:= #GetManagerState();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[19]		:= #ReadSPIData();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[20]		:= #GetSyncFrameCounter();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[21]		:= #LogMessage();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[22]		:= #SetDisableDevice();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[23]		:= #GetDocumentation();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[24]		:= #GetSerialNo();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[25]		:= #AllowRequiredError();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[26]		:= #SetObjectThisp();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[27]		:= #GetObjectThisp();

#pragma warning (default : 74)
	Control.pMeth		:= StoreCmd (pCmd := #vmt.CmdTable, SHARED);

	IF Control.pMeth THEN
		ret_code	:= C_OK;
	ELSE
		ret_code	:= C_OUTOF_NEAR;
		RETURN;
	END_IF;
	ret_code	:= VaranManager_Base();

END_FUNCTION

#pragma usingLtd HwcLogging

//{{LSL_IMPLEMENTATION

(************************************************************************************
*
*	Baseclass for varan managercontrolling
*	Created : Sigmatek	/	SR	/	March-April 2006
*	Changes : 
*
*
*     FOR NEWER CHANGES SEE REVISION DOCUMENTATION IN CLASS PROPERTIES
*
*
*   1.5 => 1.6	/	26.05.2008
*			- [DB 863]: - add function to disable device in cyclic
*   1.4 => 1.5  /  	18.04.2008
*			- [DB 852]: extend method GetVaranTime to get the IsoStartPoint
*		1.3 => 1.4	/	17.12.2007
*			- [DB 713]:	add function to log messages and log device error
*		1.2 => 1.3	/	03.10.2007
*			- add function to get "SyncFrame Counter" 
*		1.1 => 1.2	/ 	04.04.2007
*			- [DB 541]: insert function to read SPI data
*		1.0 => 1.1	/ 	28.11.2006
*			first library version
*		0.2 => 1.0	/	05.10.2006
*			initial version
*		0.1 => 0.2	/	13.06.2006
*			second testversion 
*		0.0	=> 0.1	/	10.04.2006
*			first testversion for fair in Hannover
*
************************************************************************************)


//[#ENGLISH]
//=================================================================================================
//VaranManager_Base Constructor
//=================================================================================================
FUNCTION  VaranManager_Base::VaranManager_Base
VAR_OUTPUT
	ret_code		: CONFSTATES;
END_VAR
	ret_code	:= C_OK;
END_FUNCTION //  VaranManager_Base::VaranManager_Base
//[#ENGLISH]
//=================================================================================================
//Init for VaranManager_Base
//=================================================================================================
FUNCTION VIRTUAL GLOBAL VaranManager_Base::Init
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::Init
//[#ENGLISH]
//=================================================================================================
//Normal Rt - Funktion for VaranManager_Base
//=================================================================================================
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::RtWork
VAR_INPUT
	EAX		: UDINT;
END_VAR
VAR_OUTPUT
	state		: UDINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::RtWork
//[#ENGLISH]
//=================================================================================================
//This function is called by PostScan from VaranManager_BasePostScan
//=================================================================================================
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::CyWork
VAR_INPUT
	EAX		: UDINT;
END_VAR
VAR_OUTPUT
	state		: UDINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::CyWork
//[#ENGLISH]
//=================================================================================================
//Function to add a realtime or cyclic task to Varanmanager
//=================================================================================================
//[>ud_dol_type] type of DOL list( Realtime = 3, cyclic = 4 )
//[>p_this] Thispointer of connected varan class
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::AddVaranTask
	VAR_INPUT
		ud_dol_type 	: UDINT;
		p_this 	: ^void;
		callOptions 	: USINT;
	END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::AddVaranTask
//[#ENGLISH]
//=================================================================================================
//Function to add a read data object to varan manager and install a varan task
//=================================================================================================
//[>p_us_position_info]pointer to position info( first byte is length)
//[>ud_dol_type] type of DOL list( 1=direct access, 2=IRQ, 3=realtime, 4=cyclic )
//[>p_ud_handle]pointer to variable to set right handle
//[>ud_address] Address of data object
//[>ud_length] Length of data object
//[>p_ud_data] pointer to variable to get pointer to data
//[>ud_type]0=control area, 1=memory area
//[<sd_retval] 0=OK, negative=error (look lsl_st_varan.h)
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::AddRdDO
VAR_INPUT
	p_us_position_info	: ^USINT;
	ud_dol_type			: UDINT;
	p_ud_handle			: ^UDINT;
	ud_address			: UDINT;
	ud_length			: UDINT;
	p_ud_data			: ^UDINT;
	ud_type				: UDINT;
END_VAR
VAR_OUTPUT
	sd_retval		: DINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::AddRdDO
//[#ENGLISH]
//=================================================================================================
//Function to add a write data object to varan manager and install a varan task
//=================================================================================================
//[>p_us_position_info]pointer to position info( first byte is length)
//[>ud_dol_type] type of DOL list( 1=direct access, 2=IRQ, 3=realtime, 4=cyclic )
//[>p_ud_handle]pointer to variable to set right handle
//[>ud_address] Address of data object
//[>ud_length] Length of data object
//[>p_ud_data] pointer to variable to get pointer to data
//[>ud_type]0=control area, 1=memory area
//[<sd_retval] 0=OK, negative=error (look lsl_st_varan.h)
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::AddWrDO
VAR_INPUT
	p_us_position_info	: ^USINT;
	ud_dol_type			: UDINT;
	p_ud_handle			: ^UDINT;
	ud_address			: UDINT;
	ud_length			: UDINT;
	p_ud_data			: ^UDINT;
	ud_type				: UDINT;
END_VAR
VAR_OUTPUT
	sd_retval		: DINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::AddWrDO
//[#ENGLISH]
//=================================================================================================
//Function to add a read/write data object to varan manager and install a varan task
//=================================================================================================
//[>p_us_position_info]pointer to position info( first byte is length)
//[>ud_dol_type] type of DOL list( 1=direct access, 2=IRQ, 3=realtime, 4=cyclic )
//[>p_ud_handle] pointer to variable to set right handle
//[>ud_address_read] Address of read data object
//[>ud_length_read] Length of read data object
//[>p_ud_data_read] pointer to variable to get pointer to data
//[>ud_address_write] Address of write data object
//[>ud_length_write] Length of write data object
//[>p_ud_data_write] pointer to variable to get pointer to data
//[>ud_type]0=control area, 1=memory area
//[<sd_retval] 0=OK, negative=error (look lsl_st_varan.h)
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::AddRdWrDO
VAR_INPUT
	p_us_position_info	: ^USINT;
	ud_dol_type			: UDINT;
	p_ud_handle			: ^UDINT;
	ud_address_read		: UDINT;
	ud_length_read		: UDINT;
	p_ud_data_read		: ^UDINT;
	ud_address_write	: UDINT;
	ud_length_write		: UDINT;
	p_ud_data_write		: ^UDINT;
	ud_type				: UDINT;
END_VAR
VAR_OUTPUT
	sd_retval			: DINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::AddRdWrDO
//[#ENGLISH]
//=================================================================================================
//Function executes a data object list of VaranManager
//=================================================================================================
//[>ud_dol_type] type of DOL list( 1=direct access, 2=IRQ, 3=realtime, 4=cyclic )
//[<sd_retval] 0=OK, negative=error (look lsl_st_varan.h)
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::ExecuteDOL
VAR_INPUT
	ud_dol_type		: UDINT;
END_VAR
VAR_OUTPUT
	sd_retval		: DINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::ExecuteDOL
//[#ENGLISH]
//=================================================================================================
//Function clears a data object list of VaranManager
//=================================================================================================
//[>ud_dol_type] Type of DOL (see lsl_st_varan.h)
//[<sd_retval] 0=OK, negative=error (look lsl_st_varan.h)
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::ClearDOL
VAR_INPUT
	ud_dol_type		: UDINT;
END_VAR
VAR_OUTPUT
	sd_retval		: DINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::ClearDOL
//[#ENGLISH]
//=================================================================================================
//Function to read a direct access data object
//=================================================================================================
//[>p_us_position_info]pointer to position info( first byte is length)
//[>ud_address]address to read
//[>ud_length]length of data should read
//[>p_ud_data]variable to get pointer to readed data
//[>ud_type] 0=control area, 1=memory area
//[<sd_retval] 0=OK, negative=error (look lsl_st_varan.h)
FUNCTION AWL  VIRTUAL GLOBAL VaranManager_Base::RdDO
VAR_INPUT
	p_us_position_info	: ^USINT;
	ud_address			: UDINT;
	ud_length			: UDINT;
	p_ud_data			: ^UDINT;
	ud_type				: UDINT;
END_VAR
VAR_OUTPUT
	sd_retval			: DINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::RdDO
//[#ENGLISH]
//=================================================================================================
//Function to write a direct access data object
//=================================================================================================
//[>p_us_position_info]pointer to position info( first byte is length)
//[>ud_address]address to write
//[>ud_length]length of data should be written
//[>p_ud_data]pointer to data should be written
//[>ud_type]0=control area, 1=memory area
//[<sd_retval] 0=OK, negative=error (look lsl_st_varan.h)
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::WrDO
VAR_INPUT
	p_us_position_info	: ^USINT;
	ud_address			: UDINT;
	ud_length			: UDINT;
	p_ud_data			: ^UDINT;
	ud_type				: UDINT;
END_VAR
VAR_OUTPUT
	sd_retval		: DINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::WrDO
//[#ENGLISH]
//=================================================================================================
//Function to get Pll - Time of Varanmanager
//=================================================================================================
//[<ud_varan_time] Varantime in ns
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::GetVaranTime
VAR_INPUT
	p_ud_IsoStartPoint	: ^UDINT;
END_VAR
VAR_OUTPUT
	ud_varan_time		: UDINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::GetPllTime

//[#ENGLISH]
//=================================================================================================
//Function to get Varan class position in a string
//=================================================================================================
//[>p_us_info] pointer to save position info (first byte is length)
//[<sd_retval]0=OK, -1=to many hubs( max.15 )
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::GetVaranPosition
VAR_INPUT
	p_us_info		: ^USINT;
END_VAR
VAR_OUTPUT
	sd_retval		: DINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::GetVaranPosition
//[#ENGLISH]
//=================================================================================================
//Function to install callback function for hot plug and play
//=================================================================================================
//[>p_us_position_info]pointer to position info( first byte is length)
//[>ud_action_ptr]pointer to function
//[>ud_thisp]thispointer
//[>sd_required]is class required
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::SetObjectCallback
VAR_INPUT
	p_us_position_info	: ^USINT;
	ud_action_ptr		: UDINT;
	ud_thisp			: UDINT;
	sd_required			: DINT;
END_VAR
VAR_OUTPUT
	sd_retval		: DINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::SetObjectCallback
//[#ENGLISH]
//=================================================================================================
//Function sets manager off
//=================================================================================================
//[>e_error]reason why varan manager is set off
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::SetManagerOff
VAR_INPUT
	e_error		: t_e_VaranErrors;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::SetManagerOff
//[#ENGLISH]
//=================================================================================================
//Function produces a Varan Error
//=================================================================================================
//[>p_Node]pointer to Node string
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::SetVaranError
VAR_INPUT
	p_Node		: ^USINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::SetVaranError
//[#ENGLISH]
//=================================================================================================
//Function give back a nono second counter value of Varanmanager
//=================================================================================================
//[<ud_ns_counter]nano second counter value
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::GetNsTime
VAR_OUTPUT
	ud_ns_counter		: UDINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::GetNsTime
//[#ENGLISH]
//=================================================================================================
//Function to get pointer to node information
//=================================================================================================
//[>p_us_position_info]pointer to position info( first byte is length)
//[>p_node_info]pointer to node info
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::GetNodeInfo
VAR_INPUT
	p_us_position_info		: ^USINT;
	p_node_info				: ^PLSL_VARANNODEINFO;
END_VAR
VAR_OUTPUT
	sd_retval		: DINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::GetNodeInfo
//[#ENGLISH]
//=================================================================================================
//Function to get Varan Master number
//=================================================================================================
//[>p_varan]address of pointer to varan
//[<ud_manager_number]number of varan master
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::GetManagerNumber
VAR_INPUT
	p_varan				: ^pVoid;
END_VAR
VAR_OUTPUT
	ud_manager_number	: UDINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::GetManagerNumber
//[#ENGLISH]
//=================================================================================================
//Function returns state of Varan manger class
//=================================================================================================
//[<e_state]error of varan manager
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::GetManagerState
VAR_OUTPUT
	e_state		: t_e_VaranErrors;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::GetManagerState
//[#ENGLISH]
//=================================================================================================
//Function to read SPI data
//=================================================================================================
//[>p_us_position_info]pointer to position info( first byte is length)
//[>ud_offset]offset in SPI flash
//[>ud_length]length of data (max. 128Byte)
//[>p_data]pointer to allocated memory for read data
//[<sd_retval] 0=OK, negative=error (look lsl_st_varan.h)
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::ReadSPIData
VAR_INPUT
	p_us_position_info		: ^USINT;
	ud_offset		: UDINT;
	ud_length		: UDINT;
	p_data			: ^USINT;
END_VAR
VAR_OUTPUT
	sd_retval		: DINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::ReadSPIData

//=================================================================================================
//Function to get sync frame counter
//=================================================================================================
//[<us_frame_counter] sync frame counter
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::GetSyncFrameCounter
VAR_OUTPUT
	us_frame_counter		: USINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::GetSyncFrameCounter
#pragma warning(disable: 73);
//=================================================================================================
//Function to log message
//=================================================================================================
//[>p_message]pointer to char string
//[>us_nr]number of log variables
FUNCTION VIRTUAL GLOBAL VaranManager_Base::LogMessage
  VAR_INPUT
    p_message		: ^CHAR;
    us_nr		    : USINT;
    sd_var1		  : DINT;
    sd_var2		  : DINT;
    sd_var3		  : DINT;
  END_VAR

  TRACE("(VaranManager_Base::LogMessage) Old logging function call detected. Please update hardware class library to v01.01.070 or higher");

END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::LogMessage
#pragma warning(default: 73);
//=================================================================================================
//Function to disable device in cyclic
//=================================================================================================
//[>p_us_position_info]path of varan
FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::SetDisableDevice
VAR_INPUT
	p_us_position_info		: ^USINT;
END_VAR
VAR_OUTPUT
	sd_retval		: DINT;
END_VAR
END_FUNCTION //VIRTUAL GLOBAL VaranManager_Base::SetDisableDevice


FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::GetDocumentation
	VAR_INPUT
		p_us_position_info 	: ^USINT;
		p_dpne 	: ^CHAR;
	END_VAR
	VAR_OUTPUT
		sd_retval 	: DINT;
	END_VAR
END_FUNCTION


FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::GetSerialNo
	VAR_INPUT
		p_us_position_info 	: ^USINT;
		p_SerialNo 	: ^CHAR;
	END_VAR
	VAR_OUTPUT
		sd_retval 	: DINT;
	END_VAR
END_FUNCTION





FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::AllowRequiredError
	VAR_OUTPUT
		sd_retval 	: DINT;
	END_VAR

END_FUNCTION


FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::SetObjectThisp
	VAR_INPUT
		p_us_ObjectPath 	: ^USINT;
		ud_thisp 	: UDINT;
	END_VAR
	VAR_OUTPUT
		sd_retval 	: DINT;
	END_VAR

END_FUNCTION


FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::GetObjectThisp
	VAR_INPUT
		p_us_ObjectPath 	: ^USINT;
	END_VAR
	VAR_OUTPUT
		ud_thisp 	: UDINT;
	END_VAR

END_FUNCTION


FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::GetNsTimeBPLLTicks
	VAR_OUTPUT
		ud_ns_counter 	: UDINT;
	END_VAR

END_FUNCTION


FUNCTION AWL VIRTUAL GLOBAL VaranManager_Base::AddMovDO
	VAR_INPUT
		ud_dol_type 	: UDINT;
		p_ud_handle 	: ^UDINT;
		p_ud_MovSettings 	: ^UDINT;
		ud_type 	: UDINT;
	END_VAR
	VAR_OUTPUT
		sd_retval 	: DINT;
	END_VAR

END_FUNCTION

