Vous êtes sur la page 1sur 8

Library Meaning:

CoDeSys V3.x
SysInt.library

Document Version 1.0


tech_doc_e.doc / V1.2

3S - Smart Software Solutions GmbH Page 1 of 8


SysInt_V3x_E.doc
SysInt.library

CONTENT

1 OVERVIEW 3

2 LIBRARY MODULES 4
2.1 SysIntClose 4
2.2 SysIntDisable 4
2.3 SysIntDisableAll 4
2.4 SysIntEnable 4
2.5 SysIntEnableAll 5
2.6 SysIntLevel 5
2.7 SysIntOpen 5
2.8 SysIntOpenByName 5
2.9 SysIntRegister 6
2.10 SysIntUnregister 6
2.11 UNION BusSpecific 6
2.12 Structure IsaInterrupt 7
2.13 Structure PciInterrupt 7
2.14 Structure SYS_INT_MEANING 7

CHANGE HISTORY 8
tech_doc_e.doc / V1.2

3S - Smart Software Solutions GmbH Page 2 of 8


SysInt_V3x_E.doc
SysInt.library

1 Overview

Note: It depends on the target system, which system libraries can be used within the application.

This library contains functions for a short interruption of a program by a sequence of


commands to be processed by the CPU, the so-called Interrupt Service Routine (=ISR).

Note: The use of this library is intended for writing drivers and requires a profound knowledge!

If supported by the target system, the following library functions are available:

SysIntClose
SysIntDisable
SysIntDisableAll
SysIntEnable
SysIntEnableAll
SysIntLevel
SysIntOpen
SysIntOpenByName
SysIntRegister
SysIntUnregister

The library functions make use of the following structures, enumerations and interfaces:

BusSpecific
IsaInterrupt
PciInterrupt
SYS_INT_MEANING
tech_doc_e.doc / V1.2

3S - Smart Software Solutions GmbH Page 3 of 8


SysInt_V3x_E.doc
SysInt.library

2 Library Modules

2.1 SysIntClose
This functions registers the interrupt being identified by its handle at the runtime system.

The return of type UDINT is an error message indicating whether the operation has been
executed successfully or not.
Input Variable Data type Description

hInt UDINT Interrupt handle, return of SysIntOpen

2.2 SysIntDisable
By use of this function the interrupt specified by its handle gets deactivated (masked). An
interrupt call to a deactivated interrupt has no effect.

The return of type UDINT is an error message indicating whether the operation has been
executed successfully or not.
Input Variable Data type Description

hInt UDINT Interrupt handle, return of SysIntOpen

2.3 SysIntDisableAll
By use of this functions all interrupts are deactivated (masked). The function is implemented
only for operating systems that allow this kind of deactivation. A call of SysIntDisableAll has to
be succeeded by a call to SysIntEnableAll.

The return of type UDINT is an error message indicating whether the operation has been
executed successfully or not.
Input Variable Data type Description

pulParam POINTER State of each interrupt before deactivation. pulParam is the


TO UDINT input of function SysIntEnableAll, so that the original state
(before the call to SysIntDisableAll) can be restored.

2.4 SysIntEnable
By use of this function the specified interrupt having been opened with SysIntOpen gets
enabled.

The return of type UDINT is an error message indicating whether the operation has been
executed successfully or not.
Input Variable Data type Description

hInt UDINT Interrupt handle, return of SysIntOpen


tech_doc_e.doc / V1.2

3S - Smart Software Solutions GmbH Page 4 of 8


SysInt_V3x_E.doc
SysInt.library

2.5 SysIntEnableAll
A call to this function will be done after a call of function SysIntDisableAll and will restore the
situation preceding the execution of SysIntDisableAll. That means, all interrupts, having been
activated before the call to SysIntDisableAll are activated again, the others rest deactivated.

The return of type UDINT is an error message indicating whether the operation has been
executed successfully or not.
Input Variable Data type Description

pulParam POINTER TO Memorized state of each interrupt before executing


UDINT SysIntDisableAll; return of SysIntDisableAll.

2.6 SysIntLevel
This function checks if the processor is actually executing an ISR. This information is
necessary, as some functions of the operating system must not be called within the interrupt
mode.

The return of type UDINT is one of the following error messages:

ERR_FAILED if the processor is not in interrupt mode.


ERR_OK if the processor is engaged in the execution of an ISR.

2.7 SysIntOpen
By use of this function an interrupt is declared for the runtime system. Thereby, the interrupt is
identified by its number. An interrupt has to be declared before it can be registered
(SysIntRegister) and activated (SysIntEnable).

The return of type UDINT is a handle identifying the interrupt and used as input for other
library functions.
Input Variable Data type Description

ulInterrupt UDINT Interrupt number


pIntMeaning POINTER TO Pointer to optional interrupt description
SYS_INT_MEANING
pResult POINTER TO UDINT Pointer to error message; see document Runtime
Error Codes

2.8 SysIntOpenByName
By use of this function an interrupt is declared for the runtime system. Thereby, the interrupt is
identified by its name. An interrupt has to be declared before it can be registered
(SysIntRegister) and activated (SysIntEnable).

The return of type UDINT is a handle identifying the interrupt and used as input for other
library functions.
tech_doc_e.doc / V1.2

Input-Variable Data type Description

pszIntName REFERENCE TO Interrupt name (as defined in setting component)


STRING
pIntMeaning POINTER TO Pointer to optional interrupt description
SYS_INT_MEANING
3S - Smart Software Solutions GmbH Page 5 of 8
SysInt_V3x_E.doc
SysInt.library

Input-Variable Data type Description

pResult POINTER TO UDINT Pointer to error message; see document


Runtime Error Codes

2.9 SysIntRegister
By use of this function an interrupt handler (Interrupt Service Routine, ISR) for the interrupt
specified by its handle gets registered. During registration, the start address of the function to
be executed in case of the associated interrupt request is filled into the vector table.

The return of type UDINT is an error message indicating whether the operation has been
executed successfully or not.
Input Variable Data type Description

hInt UDINT Interrupt handle, return of SysIntOpen


pCallback POINTER TO Pointer to interrupt handler to be registered
UDINT
uIAdditionalInfo UDINT This variable is provided for the input of an additional
value, e.g. an input value of the interrupt handler

2.10 SysIntUnregister
This function deletes the interrupt handler corresponding to the interrupt specified by its
handle from the vector table.

The return of type UDINT is an error message indicating whether the operation has been
executed successfully or not.
Input Variable Data type Description

hInt UDINT Interrupt handle, return of SysIntOpen


pCallback UDINT Pointer to interrupt handler to be unregistered

2.11 UNION BusSpecific


The UNION BusSpecific constitutes one entry of the structure SYS_INT_MEANING.
BusSpecific contains the following components to specify the type of the employed bus:
Structure component Data type Meaning

pciInterrupt PciInterrupt see structure PciInterrupt


isaInterrupt IsaInterrupt see structure IsaInterrupt
tech_doc_e.doc / V1.2

3S - Smart Software Solutions GmbH Page 6 of 8


SysInt_V3x_E.doc
SysInt.library

2.12 Structure IsaInterrupt


This structure is referenced by UNION BusSpecific. It contains the following components to
define an interrupt within an ISA bus system:
Structure component Data type Meaning

ulBusNumber UDINT Bus number


ulDeviceNumber UDINT Device number
ulFunctionNumber UDINT Function number
ulIntLine UDINT Interrupt number

2.13 Structure PciInterrupt


This structure is referenced by UNION BusSpecific. It contains the following components to
define an interrupt within a PCI bus system:
Structure component Data type Meaning

ulBusNumber UDINT Bus number


ulDeviceNumber UDINT Device number
ulFunctionNumber UDINT Function number
ulIntLine UDINT Interrupt number

2.14 Structure SYS_INT_MEANING


This structure contain information on the bus system and the interrupt mode. It is used by the
function SysIntOpen.
Structure component Data type Meaning

BusType UDINT Type of bus system

Bus system Identification number


ISA 1
EISA 2
PCI 3
VME 4
PCMCIA 5
Processor internal 6
InterruptMode UDINT Level sensitive 0
Latched 1
busSpecific BusSpecific see UNION BusSpecific
tech_doc_e.doc / V1.2

3S - Smart Software Solutions GmbH Page 7 of 8


SysInt_V3x_E.doc
SysInt.library

Change History

Version Meaning Date


0.1 Creation acc. to German V1.0 18.02.2008
1.0 Release after formal review 20.02.2008
tech_doc_e.doc / V1.2

3S - Smart Software Solutions GmbH Page 8 of 8


SysInt_V3x_E.doc

Vous aimerez peut-être aussi