SysDirAsyncFB.SysDirOpenAsync (METH) ¶ METHOD SysDirOpenAsync : RTS_IEC_HANDLE This method asynchronously opens a specified directory and returns a handle and the first directory entry. For details, see Description. InOut: Scope Name Type Comment Return SysDirOpenAsync RTS_IEC_HANDLE Handle of AsyncJob Input pParam POINTER TO tSysDirOpen pudState POINTER TO UDINT Current state of AsyncJob pResult POINTER TO RTS_IEC_RESULT Result of AsyncJob creation
SysDirAsyncFB.SysDirReadAsync (METH) ¶ METHOD SysDirReadAsync : RTS_IEC_HANDLE This method asynchronously reads the next directory entry. It writes the directory entry in szDirEntry. For details, see Description. InOut: Scope Name Type Comment Return SysDirReadAsync RTS_IEC_HANDLE Handle of AsyncJob Input pParam POINTER TO tSysDirRead pudState POINTER TO UDINT Current state of AsyncJob pResult POINTER TO RTS_IEC_RESULT Result of AsyncJob creation
SysCpuAtomicAdd (FUN) ¶ FUNCTION SysCpuAtomicAdd : DINT <description> Function to increment the content of the given pointer by nSum in one atomic operation (task safe). IMPLEMENTATION NOTE: - Add/Sub the value to the content of the pointer - Return the value after the Add/Sub operation Both things must be done atomic! </description> <result><p>RESULT: Returns the value after the increment operation in an atomic way! </p></result> <SIL2/> InOut: Scope Name Type Comment Return SysCpuAtomicAdd DINT Input piValue POINTER TO DINT <param name=”piValue” type=”INOUT”>Pointer to the value to increment</param> nSum DINT <param name=”nSum” type=”IN”>Summand for the operation. >0 to increment, <0 to decrement</param> pResult POINTER TO RTS_IEC_RESULT <param name=”pResult” type=”OUT”>Pointer to runtime system error code (see CmpErrors.library)</param>
SysCpuAtomicAdd64 (FUN) ¶ FUNCTION SysCpuAtomicAdd64 : LINT <description> Function to increment the content of the given pointer by nSum in one atomic operation (task safe). IMPLEMENTATION NOTE: - Add/Sub the value to the content of the pointer - Return the value after the Add/Sub operation Both things must be done atomic! </description> <result><p>RESULT: Returns the value after the increment operation in an atomic way! </p></result> <SIL2/> InOut: Scope Name Type Comment Return SysCpuAtomicAdd64 LINT Input piValue POINTER TO LINT <param name=”piValue” type=”INOUT”>Pointer to the value to increment</param> nSum LINT <param name=”nSum” type=”IN”>Summand for the operation. >0 to increment, <0 to decrement</param> pResult POINTER TO RTS_IEC_RESULT <param name=”pResult” type=”OUT”>Pointer to runtime system error code (see CmpErrors.library)</param>
SysCpuAtomicCompareAndSwap (FUN) ¶ FUNCTION SysCpuAtomicCompareAndSwap : RTS_IEC_RESULT <description> Function for compare-and-swap in one atomic operation (task safe). Supports only 32- and 64-bit types The function compares the pAddress value with the pCompareValue value. If the pAddress value is equal to the pCompareValue value, the pSwapValue value is stored in the address specified by pAddress. Otherwise, no operation is performed. The function was successful if the * pSwapValue value is stored in the address specified by pAddress. </description> <result><p>RESULT: Returns ERR_OK if the swap was successful (if the pSwapValue value is stored in the address specified by pAddress) </p></result> <SIL2/> InOut: Scope Name Type Comment Return SysCpuAtomicCompareAndSwap RTS_IEC_RESULT Input pAddress POINTER TO BYTE pointer to the value to test pSwapValue POINTER TO BYTE pointer to new valid pCompareValue POINTER TO BYTE pointer to compare value valueSize USINT size of the value
SysCpuCallIecFuncWithParams (FUN) ¶ FUNCTION SysCpuCallIecFuncWithParams : RTS_IEC_RESULT Call an IEC function from plain C code. Since different CPU’s/systems use different calling conventions, this function should be used as a wrapper. IEC functions or methods of function block use all the same calling convention: They have no return value and exactly one parameter, which is a pointer to a struct that contains all required IN and OUT parameters. NOTE: A call to the function SysCpuCallIecFuncWithParams with the parameter values <pointer (not equal to NULL)> in pParam and <0> in iSize has the same result as a call with the parameter values <NULL pointer> in pParam and <0> in iSize. Both result in a call without parameters of the function passed in parameter pfIECFunc. IN GENERAL: An IEC function must always be called with the parameters according to its definition. If an IEC function is called with parameters which do not correspond to the definition of the IEC function, the CODESYS Control runtime system may CRASH. RETURN: Returns the runtime system error code (see CmpErrors.library) <SIL2/> InOut: Scope Name Type Comment Return SysCpuCallIecFuncWithParams RTS_IEC_RESULT Input pfIECFunc POINTER TO BYTE Pointer to the IEC function that should be called pParam POINTER TO BYTE Pointer to the parameter struct that contains the function parameters. Can be 0 if not used. ulSize UDINT Size of the parameter structure to copy the content on stack. Can be 0.
SysCpuResetBit (FUN) ¶ FUNCTION SysCpuResetBit : RTS_IEC_RESULT <description> Reset a bit in an ULONG variable in one processor step. This operation is to provide a multitasking save operation. </description> <result><p>RESULT: Returns the runtime system error code (see CmpErrors.library).</p></result> InOut: Scope Name Type Comment Return SysCpuResetBit RTS_IEC_RESULT Input pulValue POINTER TO UDINT <param name=”pulValue” type=”IN”>Pointer to the unsigned value to reset a bit inside in one atomic processor step</param> ulBit UDINT <param name=”ulBit” type=”IN”>Bit number inside the variable to reset. 0=first bit, 31=last bit</param>
SysCpuResetBit2 (FUN) ¶ FUNCTION SysCpuResetBit2 : RTS_IEC_RESULT <description> Reset a bit in an BYTE variable in one processor step. This operation is to provide a multitasking save operation. </description> <result><p>RESULT: Returns the runtime system error code (see CmpErrors.library).</p></result> InOut: Scope Name Type Comment Return SysCpuResetBit2 RTS_IEC_RESULT Input pbyValue POINTER TO BYTE <param name=”pbyValue” type=”IN”>Pointer to the unsigned value to reset a bit inside in one atomic processor step</param> ulBit UDINT <param name=”ulBit” type=”IN”>Bit number inside the variable to reset. 0=first bit, 7=last bit</param>
SysCpuSetBit2 (FUN) ¶ FUNCTION SysCpuSetBit2 : RTS_IEC_RESULT <description> Set a bit in an BYTE variable in one processor step. This operation is to provide a multitasking save operation. </description> <result><p>RESULT: Returns the runtime system error code (see CmpErrors.library).</p></result> InOut: Scope Name Type Comment Return SysCpuSetBit2 RTS_IEC_RESULT Input pbyValue POINTER TO BYTE <param name=”pbyValue” type=”IN”>Pointer to the unsigned value to set a bit inside in one atomic processor step</param> ulBit UDINT <param name=”ulBit” type=”IN”>Bit number inside the variable to set. 0=first bit, 7=last bit</param>
SysCpuSetBit (FUN) ¶ FUNCTION SysCpuSetBit : RTS_IEC_RESULT <description> Set a bit in an ULONG variable in one processor step. This operation is to provide a multitasking save operation. </description> <result><p>RESULT: Returns the runtime system error code (see CmpErrors.library).</p></result> InOut: Scope Name Type Comment Return SysCpuSetBit RTS_IEC_RESULT Input pulValue POINTER TO UDINT <param name=”pulValue” type=”IN”>Pointer to the unsigned value to set a bit inside in one atomic processor step</param> ulBit UDINT <param name=”ulBit” type=”IN”>Bit number inside the variable to set. 0=first bit, 31=last bit</param>