?? system.h
字號:
#ifndef __System_H__
#define __System_H__
#define USER_CNT_System 47
System : CLASS
Server0 : SVRCHCMD_DINT;
FUNCTION System
VAR_OUTPUT
ret_code : CONFSTATES;
END_VAR;
//This method is called to install an IRQ Service Function.
//The function is passed the number of the IRQ to trap and a pointer to a function
//to service the IRQ.
//The server function must be a global function and have the following prototype:
// Void IRQ_Server(void);
//
//The server function must service and acknowledge the interrupt and then return.
//No special return is required.
FUNCTION __CDECL VIRTUAL GLOBAL InstallIRQ
VAR_INPUT
IRQNumber0 : UINT;
IRQFunction0 : pVoid;
END_VAR
VAR_OUTPUT
ret0 : DINT;
END_VAR;
//This method is called to install an object to service an IRQ.
//The function is passed the number of the IRQ to trap and the this pointer
//of the Lasal class object.
//The class RtWork() method is called to service the interrupt.
//The RtWork() method must service and acknowledge the interrupt and then return.
//No special return is required.
FUNCTION __CDECL VIRTUAL GLOBAL InstallIRQObject
VAR_INPUT
IRQNumber0 : UINT;
thisPointer0 : pVoid;
END_VAR
VAR_OUTPUT
ret0 : DINT;
END_VAR;
//This method is called to create a Mailbox.
//A Mailbox is used for inter-task communications.
//A task creates a mailbox and then calls functions to monitor the mailbox.
//Another task can put a message into the mailbox.
//The monitoring task will be indicated that a new message is available and can then
//read that data. Mailbox communication is one-way (two mailboxes would be needed
//for bi-directional communication).
//Note that any number of tasks can put messages into a mailbox
//but only one task should retrieve the messages.
//
//This function will create an empty mailbox.
//The function is passed a name of the mailbox, the size of the message data structure,
//and the number of mail slots (maximum number waiting messages) to create.
//If the mailbox is created a handle for it is returned.
//This handle is used by all tasks to access the mailbox.
//In an error is detected -1 is returned and the mailbox IS NOT created or available.
FUNCTION __CDECL VIRTUAL GLOBAL CreateMailbox
VAR_INPUT
MailboxName0 : ^CHAR;
MailboxDataLen0 : UDINT;
MailboxSlots0 : UDINT;
END_VAR
VAR_OUTPUT
ret0 : pVoid;
END_VAR;
//This method is called to put a message into a mailbox.
//If the mailbox is full and cannot accept any new messages then FALSE is returned
//(the call will not block the calling thread).
//Otherwise the passed message data is stored in the mailbox and the method
//returns TRUE.
FUNCTION __CDECL VIRTUAL GLOBAL MailboxGetMsg
VAR_INPUT
Mailbox0 : pVoid;
pMailboxData0 : pVoid;
END_VAR
VAR_OUTPUT
ret0 : DINT;
END_VAR;
//This method is called to get a message from a mailbox.
//If the mailbox is empty FALSE is returned (the call will not block the calling thread).
//Otherwise the next available message data is copied into the passed buffer
//and the method returns TRUE.
FUNCTION __CDECL VIRTUAL GLOBAL MailboxPutMsg
VAR_INPUT
Mailbox0 : pVoid;
pMailboxData0 : pVoid;
END_VAR
VAR_OUTPUT
ret0 : DINT;
END_VAR;
//This method is called to destroy a mailbox.
//The mailbox handle becomes invalid and unusable after the mailbox is destroyed.
FUNCTION __CDECL VIRTUAL GLOBAL DeleteMailbox
VAR_INPUT
Mailbox0 : pVoid;
END_VAR
VAR_OUTPUT
ret0 : DINT;
END_VAR;
//This method is called to create a semaphore.
//i.e: A BINARY semaphore is a synchronization object that allows two tasks to synchronize with each other.
//Synchronization in multi-tasking systems can be required for many reasons
//such as exclusive access to a shared memory area or function or
//to signal a waiting task of an event.
//
//This function will create a semaphore of the specified type in SemType0.
//The function is passed a name string to assign to the semaphore.
//A handle is returned if the semaphore is successfully created.
//This handle is then used to access the semaphore.
//NIL is returned if an error is detected.
FUNCTION __CDECL VIRTUAL GLOBAL CreateSemaphore
VAR_INPUT
SemName0 : ^CHAR;
SemType0 : UINT;
END_VAR
VAR_OUTPUT
ret0 : pVoid;
END_VAR;
//This method is called to signal a semaphore.
// For BINARY semaphores, all tasks waiting on this signal will be released
//(the highest priority task will be executed).
FUNCTION __CDECL VIRTUAL GLOBAL SignalSemaphore
VAR_INPUT
Semaphore0 : pVoid;
END_VAR
VAR_OUTPUT
ret0 : DINT;
END_VAR;
//This method is called to pulse a semaphore.
// This function must not be called for binary semaphores or an exception will be raised.
FUNCTION __CDECL VIRTUAL GLOBAL PulseSemaphore
VAR_INPUT
Semaphore0 : pVoid;
END_VAR
VAR_OUTPUT
ret0 : DINT;
END_VAR;
//This method is called to wait on a semaphore.
//For BINARY semaphores, if the semaphore is available, it will be taken
//and 0 is returned. If the semaphore is already taken, then the task will block
//until the semaphore is released (signaled) by the owning task.
//Great care must be taken when calling this function to avoid deadlocks.
//signal a semaphore.
//For BINARY semaphores, all tasks waiting on this signal will be released
//(the highest priority task will be executed).
FUNCTION __CDECL VIRTUAL GLOBAL WaitSemaphore
VAR_INPUT
Semaphore0 : pVoid;
END_VAR
VAR_OUTPUT
ret0 : DINT;
END_VAR;
//This method is called to wait on a semaphore.
//For BINARY semaphores, if the semaphore is available, it will be taken
//and 1 is returned.
//If the semaphore is already taken, then 0 is returned.
//This method is a task-safe method in that it can never block the calling task.
//If 1 is returned the semaphore will now be owned by the caller until released.
//
FUNCTION __CDECL VIRTUAL GLOBAL WaitCondSemaphore
VAR_INPUT
Semaphore0 : pVoid;
END_VAR
VAR_OUTPUT
ret0 : DINT;
END_VAR;
//This method is called to delete a semaphore.
//The semaphore will be destroyed and the handle is invalidated and unusable.
//Note that no tasks must be waiting on the semaphore when this method is called
//or a fatal exception will occur.
FUNCTION __CDECL VIRTUAL GLOBAL DeleteSemaphore
VAR_INPUT
Semaphore0 : pVoid;
END_VAR
VAR_OUTPUT
ret0 : DINT;
END_VAR;
//This method is called to output a WORD value to a CPU port.
FUNCTION __CDECL VIRTUAL GLOBAL OutW
VAR_INPUT
PortNumber0 : UINT;
Value0 : UINT;
END_VAR
;
//This method is called to output a BYTE value to a CPU port.
// The lower 8 bits of the passed WORD are written to the port.
FUNCTION __CDECL VIRTUAL GLOBAL OutB
VAR_INPUT
PortNumber0 : UINT;
Value0 : UINT;
END_VAR
;
//This method is called to input a WORD value from a port.
FUNCTION __CDECL VIRTUAL GLOBAL InpW
VAR_INPUT
PortNumber0 : UINT;
END_VAR
VAR_OUTPUT
ret0 : UINT;
END_VAR;
//This method is called to input a BYTE value from a port.
//The value is returned in the lower 8 bits of the return value.
FUNCTION __CDECL VIRTUAL GLOBAL InpB
VAR_INPUT
PortNumber0 : UINT;
END_VAR
VAR_OUTPUT
ret0 : UINT;
END_VAR;
//This method is called to map an area of memory for read/write access.
//The method is passed the absolute address of the memory area to unlock.
//Great case must be taken with this function
//to avoid writing into operating system memory areas
//or unpredictable program execution and fatal exceptions can occur.
FUNCTION __CDECL VIRTUAL GLOBAL MemoryAccess
VAR_INPUT
Addr0 : UDINT;
Length0 : UDINT;
END_VAR
VAR_OUTPUT
ret0 : DINT;
END_VAR;
//This method is called to send a CAN message.
// Further discussion of this function is beyond the scope of this document.
FUNCTION __CDECL VIRTUAL GLOBAL CanTxObj
VAR_INPUT
cannr0 : USINT;
objnr0 : DINT;
length0 : USINT;
data0 : PVOID;
END_VAR
VAR_OUTPUT
ret0 : INT;
END_VAR;
//This method is called to register a CAN message.
//Further discussion of this function is beyond the scope of this document.
FUNCTION __CDECL VIRTUAL GLOBAL AddCanObj
VAR_INPUT
cannr0 : USINT;
objnr0 : DINT;
length0 : USINT;
mode0 : USINT;
actionptr0 : PVOID;
thisptr0 : PVOID;
END_VAR
VAR_OUTPUT
ret0 : DINT;
END_VAR;
//This method is called to allocate memory from the system heap.
//The Lasal RTOS dynamic memory functions are provided for the application
//to allocate memory.
//The memory will be automatically reclaimed at reset
//
//This function will allocate a block of memory for the specified number of bytes.
//If successful a pointer to the allocated memory is returned,
//otherwise a NIL pointer is returned.
FUNCTION __CDECL VIRTUAL GLOBAL Malloc
VAR_INPUT
size0 : UDINT;
END_VAR
VAR_OUTPUT
ret0 : PVOID;
END_VAR;
//This method is called to free a memory block previously allocated
//via a call to System.Malloc().
//The allocated memory will be returned to the free memory heap.
//
FUNCTION __CDECL VIRTUAL GLOBAL Free
VAR_INPUT
ptr0 : PVOID;
END_VAR
;
//This method is called to set the system clock with the passed time value.
//The SYSTIME structure is define in the LSL_ST_IFSSR.H file in the Lasal directory.
FUNCTION __CDECL VIRTUAL GLOBAL SetSysTime
VAR_INPUT
time0 : ^SYSTIME;
END_VAR
;
//This method is called to set the system clock with the passed date value.
//The SYSDATE structure is define in the LSL_ST_IFSSR.H file in the Lasal directory.
FUNCTION __CDECL VIRTUAL GLOBAL SetSysDate
VAR_INPUT
date0 : ^SYSDATE;
END_VAR
;
//This method is called to get the system clock time and store itin the assed buffer.
//The SYSTIME structure is define in the LSL_ST_IFSSR.H file in the Lasal directory.
FUNCTION __CDECL VIRTUAL GLOBAL GetSysTime
VAR_INPUT
time0 : ^SYSTIME;
END_VAR
;
//This method is called to get the system clock date and store it in the passed buffer.
//The SYSDATE structure is define in the LSL_ST_IFSSR.H file in the Lasal directory.
FUNCTION __CDECL VIRTUAL GLOBAL GetSysDate
VAR_INPUT
date0 : ^SYSDATE;
END_VAR
;
//This method is called to reallocate memory previously allocated
//from a call to System.Malloc or System.ReAlloc.
//The method will attempt to re-allocate the memory.
//If successful a pointer to the reallocated memory is returned,
//otherwise a NIL pointer is returned.
FUNCTION __CDECL VIRTUAL GLOBAL ReAlloc
VAR_INPUT
ptr0 : PVOID;
size0 : UDINT;
END_VAR
VAR_OUTPUT
ret0 : PVOID;
END_VAR;
FUNCTION __CDECL VIRTUAL GLOBAL InstallIRQLASAL
VAR_INPUT
IRQNumber0 : UINT;
IRQFunction0 : pVoid;
thispointer0 : pVoid;
END_VAR
VAR_OUTPUT
ret0 : DINT;
END_VAR;
//This method is called to copy memory from the source buffer
//to the destination buffer for the specified number of bytes.
FUNCTION __CDECL VIRTUAL GLOBAL MemMove
VAR_INPUT
dest : PVOID;
source : PVOID;
size : _UDWORD;
END_VAR
VAR_OUTPUT
retcode : PVOID;
END_VAR;
//This method is called to copy memory from the source buffer
//to the destination buffer for the specified number of bytes.
FUNCTION __CDECL VIRTUAL GLOBAL MemCpy
VAR_INPUT
dest : PVOID;
source : PVOID;
size : _UDWORD;
END_VAR
VAR_OUTPUT
retcode : PVOID;
END_VAR;
//This method is called to set the specified memory buffer
//with the specified BYTE data value for the specified number of bytes.
FUNCTION __CDECL VIRTUAL GLOBAL MemSet
VAR_INPUT
pMemptr : PVOID;
fill : _UBYTE;
size : _UDWORD;
END_VAR
VAR_OUTPUT
retcode : PVOID;
END_VAR;
//This method is called to compare two memory buffer.
FUNCTION __CDECL VIRTUAL GLOBAL MemCmp
VAR_INPUT
pDestptr : PVOID;
pSourceptr : PVOID;
size : _UDWORD;
END_VAR
VAR_OUTPUT
retcode : _UBYTE;
END_VAR;
//Further discussion of this function is beyond the scope of this document.
//
FUNCTION __CDECL VIRTUAL GLOBAL LoginIntoCANNew
VAR_INPUT
cannr0 : USINT;
canstation0 : USINT;
txobjnr0 : UINT;
END_VAR
VAR_OUTPUT
ret0 : UINT;
END_VAR;
FUNCTION __CDECL VIRTUAL GLOBAL GetObjectInfo
VAR_INPUT
thisobj0 : ^void;
tasktype0 : UDINT;
objinfo : ^LSLOBJ_INFO;
END_VAR
VAR_OUTPUT
retval : UDINT;
END_VAR;
FUNCTION VIRTUAL GLOBAL _Reserved_Space_2;
FUNCTION VIRTUAL GLOBAL _Reserved_Space_3;
FUNCTION VIRTUAL GLOBAL _Reserved_Space_4;
FUNCTION VIRTUAL GLOBAL _Reserved_Space_5;
//This method is called to called to delay the calling task
//for the specified number of milliseconds.
//The task is guaranteed to delay at least the specified amount of time, possible longer.
//Great care must be taken with this method as it will delay the calling task.
FUNCTION __CDECL VIRTUAL GLOBAL OS_Delay
VAR_INPUT
msecs0 : UDINT;
END_VAR
;
FUNCTION __CDECL VIRTUAL GLOBAL InstallDiasHandler
VAR_INPUT
INTfunction0 : ^void;
param0 : ^void;
END_VAR
;
FUNCTION VIRTUAL GLOBAL _Reserved_Space_6;
FUNCTION VIRTUAL GLOBAL _Reserved_Space_7;
FUNCTION VIRTUAL GLOBAL _Reserved_Space_8;
FUNCTION __CDECL VIRTUAL GLOBAL EEPROM_Read
VAR_INPUT
addr0 : UINT;
data0 : ^UINT;
END_VAR
VAR_OUTPUT
retval : UDINT;
END_VAR;
FUNCTION __CDECL VIRTUAL GLOBAL EEPROM_Write
VAR_INPUT
addr0 : UINT;
data0 : UINT;
END_VAR
VAR_OUTPUT
retval : UDINT;
END_VAR;
FUNCTION __CDECL VIRTUAL GLOBAL ButtonPressed
VAR_OUTPUT
state : UDINT;
END_VAR;
//ATTENTION!
//This function is used to set the value of the OS's Task-Scheduler,
//and should only be used by advanced Users!
FUNCTION __CDECL VIRTUAL GLOBAL SetTimerIntVal
VAR_INPUT
ClockTicks0 : UDINT;
END_VAR
VAR_OUTPUT
retval : UDINT;
END_VAR;
//This function returns the current value of the OS's Task-Scheduler.
FUNCTION __CDECL VIRTUAL GLOBAL GetTimerIntVal
VAR_OUTPUT
retval : UDINT;
END_VAR;
FUNCTION GLOBAL TAB @CT_0001;
END_CLASS;
#endif//__System_H__
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -