
- •Functional Specification
- •Interface for direct calls to external drivers from RealtimePlc-Runtime
- •Windows nt
- •1.Which modules are linked ?
- •1.1.The basic procedure to retrieve the functionpointers.
- •1.2.Creating io-Drivers with the rtioDrv_Toolkit.
- •2.„Description of io-driver functions“
- •2.1.Drv_fct_init
- •2.2.Drv_fct_exit
- •2.4.Drv_fct _get_flags
- •2.5.Drv_fct _get_iorange
- •2.6. Drv_fct_start_configure_ionet
- •2.7.Drv_fct_done_configure_ionet
- •2.8.Drv_fct_configure_module
- •2.9.Drv_fct _configure_device
- •2.10.Drv_fct _start_write_outputs
- •2.11.Drv_fct_write_outputs
- •2.12.Drv_fct _done_write_outputs
- •2.13.Start_read_input, read_input, done_read_input
- •2.14.Drv_fct_plc_status_changes
- •2.15.Drv_fct_enter_nmi_routine
- •2.16.Drv_fct_leave_nmi_routine
- •2.17.Drv_fct_start_interrupt
- •2.18.Drv_fct_stop_interrupt
- •2.19.Drv_fct_retain_save
- •2.20.Drv_fct_retain_restore
- •2.21.Drv_fct_cyclic_call
- •2.22.Drv_get_extreftable
- •2.23.Drv_fct_busdiag_getbusstate
- •2.24.Drv_fct_precompute_service
- •2.25.Drv_fct_postcompute_service
- •2.26.Drv_fct_srv_browsercmd
- •2.27.Drv_fct_add_browserhelp
- •2.28.Drv_fct_cst_processhook
- •2.29.Drv_fct_gettargetids
- •3.1.The passing of the functionpointertable
- •3.12.Api_fct_delete_task
- •3.13.Api_fct_wait_for_object
- •3.19.Api_fct_closefile
- •3.20.Api_fct_readfile
- •3.21.Api_fct_writefile
- •3.22.Api_fct_prgreset
- •3.23.Api_fct_datamanipulation
- •3.24.Api_fct_getprojectinfo
- •4.Anhang
3.12.Api_fct_delete_task
A created task is deleted and no more scheduled from now on.
Prototype:
typedef int (*PFRTSDELETETASK)(int iPriority);
To identify the task, which should be deleted now, pass the task’s priority as parameter.
The returnvalue is negative in case of an error, 1 otherwise.
3.13.Api_fct_wait_for_object
By a call to IODrvWaitForObject() the calling task is inaktiv, until another task sets the object, or the maximum waittime is over.
This means for the calling task, the function returns if another task sets the object or a timeout occurs.
Prototype:
typedef int (*PFRTSWAITFOROBJECT)(int iWaitObjectNr, unsigned long ulMaxTime);
iWaitObjectNr identifies the object to wait for. iWaitObjectNr must have values between 0 and 31.
ulMaxTime is the maximum time to wait for the object. If timeout should not occur, pass WAIT_INFINITE (defined in IODrvInterface.h).
The returnvalue is negative in case of error, then the function returns immediately, or 0, if the return occurred due to a set object. If the function returned due to a timeout, the returnvalue is 1.
3.14.API_FCT_SET_OBJECT
With IODrvSetObject() an object can be set, to reactivate a task, waiting for the object.
Prototype:
typedef int (*PFRTSSETOBJECT)(int iWaitObjectNr);
The returnvalue is negativ in case of an error, 1 otherwise.
3.15.API_FCT_SLEEP
This function returns after ulSleepTime ms.
Prototype:
typedef int (*PFRTSSLEEP)(unsigned long ulSleepTime);
The returnvalue is negativ in case of an error, 1 otherwise.
3.16.API_FCT_RESUME
With IODrvResume() a task, which is sleeping or suspended, can be reactivated. This function is the direct opposite of IODrvSuspend, and has been extended, to end the sleep-state of a task before the sleeptime is over.
Prototype:
typedef int (*PFRTSRESUME)(int iPriority);
iPriority identifies the task to activate.
The returnvalue is negativ in case of an error, 1 otherwise.
3.17.API_FCT_SUSPEND
With IODrvSuspend() any task can be suspended. The task is not scheduled any more.
Prototype:
typedef int (*PFRTSSUSPEND)(int iPriority);
The task to suspend is identified by iPriority.
The returnvalue is negativ in case of an error, 1 otherwise.
3.18.API_FCT_OPENFILE
The filefunctions are asynchronuous functions, that means, they must be called cyclic, until the returnvalue is higher or equal as „Done“. Possible retrunvalues are
typedef enum _FCTJOB_ResultCode
{
NoResult = 0,
NotRegistered,
Processing,
Done,
DoneWithError1,
DoneWithError2,
DoneWithError3
}FCTJOB_ResultCode;
as defined in IODrvInterface.h. All these functions must be asynchronuous, as realtimetsks cann’t call function of the operating system.
The synchronuous versions of these function are IODrvSynchOpenFile, IODrvSynchCloseFile and so on. Here the asynchronuous functions are used. They are called in a loop (which calls IODrvSleep, too) which is left when the result is polled.
Prototype:
typedef int (*PFASYNCHFILEOPEN)(void** pHandle,unsigned long ulAttributes,char* pszName);
pHandle points to a variable of type HANDLE, (defined by NTDDK as void*), which receives the result of the function.
ulAttributes can get the following values:
/*File-access from realtimetasks (asynchronuous)*/
#define OF_ATTRIB_READ 0x1UL
#define OF_ATTRIB_WRITE 0x2UL
#define OF_ATTRIB_APPEND 0x4UL
as defined in IODrvInterface.h.
A file can be opened with read-only access, write-access and appending data to the end of the file. When opening a file with write-access, an existing file is overwritten.