PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or...

30
s Contents Introduction 1 Hardware Requirements 2 Software Requirements 3 Installation 4 Application SafeCard On Motherboard 5 DLL Functions of the Som.dll 6 Developing Environment 7 Header Files 8 SIMATIC PC Monitoring SafeCard on Motherboard Manual Edition 02/2006 A5E00113525-02

Transcript of PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or...

Page 1: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

s Contents Introduction 1 Hardware Requirements 2 Software Requirements 3 Installation 4 Application SafeCard On Motherboard 5 DLL Functions of the Som.dll 6 Developing Environment 7 Header Files 8

SIMATIC

PC Monitoring SafeCard on Motherboard Manual

Edition 02/2006 A5E00113525-02

Page 2: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

Safety Guidelines

This manual contains notices intended to ensure personal safety, as well as to protect the products and connected equipment against damage. These notices are highlighted by the symbols shown below and graded according to severity by the following texts:

! Danger indicates that death, severe personal injury or substantial property damage will result if proper precautions are not taken.

! Warning indicates that death, severe personal injury or substantial property damage can result if proper precautions are not taken.

! Caution indicates that minor personal injury can result if proper precautions are not taken.

Caution

indicates that property damage can result if proper precautions are not taken.

Notice draws your attention to particularly important information on the product, handling the product, or to a particular part of the documentation.

Qualified Personnel Only qualified personnel should be allowed to install and work on this equipment. Qualified persons are defined as persons who are authorized to commission, to ground and to tag circuits, equipment, and systems in accordance with established safety practices and standards.

Correct Usage

Note the following:

! Warning This device and its components may only be used for the applications described in the catalog or the technical description, and only in connection with devices or components from other manufacturers which have been approved or recommended by Siemens. This product can only function correctly and safely if it is transported, stored, set up, and installed correctly, and operated and maintained as recommended.

Trademarks

SIMATIC®, SIMATIC HMI® and SIMATIC NET® are registered trademarks of SIEMENS AG.

Third parties using for their own purposes any other names in this document which refer to trademarks might infringe upon the rights of the trademark owners.

Copyright © Siemens AG 2006 All rights reserved The reproduction, transmission or use of this document or its contents is not permitted without express written authority. Offenders will be liable for damages. All rights, including rights created by patent grant or registration of a utility model or design, are reserved. Siemens AG Bereich Automatisierungs- und Antriebstechnik Geschaeftsgebiet Industrie-Automatisierungssysteme

Disclaimer of Liability We have checked the contents of this manual for agreement with the hardware and software described. Since deviations cannot be precluded entirely, we cannot guarantee full agreement. However, the data in this manual are reviewed regularly and any necessary corrections included in subsequent editions. Suggestions for improvement are welcomed. ©Siemens AG 2006 Technical data subject to change.

Postfach 4848, D- 90327 Nuernberg

Siemens Aktiengesellschaft A5E00113525

이 기기는 업무용(A급) 전자파 적합기기로서 판매자 또는 사용자는 이 점을 주의하시기 바라며 가정 외의 지역에서 사용하는 것을 목적으로 합니다.

Page 3: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

Contents

1 Introduction .................................................................................................................... 1-1

2 Hardware Requirements................................................................................................ 2-1

3 Software Requirements................................................................................................. 3-3

4 Installation ...................................................................................................................... 4-1 4.1 Windows NT 4.0 / Windows 2000 / Windows XP /

Windows XP Embedded / Windows Server 2003 ............................................ 4-1 4.2 Starting the Application..................................................................................... 4-2 4.3 Scope of Delivery.............................................................................................. 4-2

5 Application SOM ............................................................................................................ 5-1

5.1 Temperature Monitoring Section ............................................................... 5-2

5.2 Watchdog Section ...................................................................................... 5-3

5.3 Fan Section ............................................................................................. 5-3 5.4 Common Section .............................................................................................. 5-4

6 DLL Functions of the Som.dll ....................................................................................... 6-1 6.1 INT sfc_read_stat(HANDLE hdl, PUINT state);................................................ 6-1 6.2 INT sfc_reset_status (HANDLE hdl);................................................................ 6-3 6.3 INT temp_read_act_values (HANDLE hdl, PINT actCpuTemp, PINT

actBoard1Temp, PINT actBoard2Temp); ......................................................... 6-3 6.4 INT temp_read_limit (HANDLE hdl, INT multiplex, PINT cpuLowLimit,

PINT cpuHiLimit, PINT board1LowLimit, PINT board1HiLimit, PINT board2LowLimit, PINT board2HiLimit);............................................................. 6-3

6.5 INT temp_set_limit (HANDLE hdl, INT HiLimit, INT multiplex);....................... 6-4 6.6 INT wd_set_time (HANDLE hdl, UINT time);................................................... 6-4 6.7 INT wd_read_time (HANDLE hdl, PUINT time);............................................... 6-4 6.8 INT wd_start (HANDLE hdl); ............................................................................ 6-5 6.9 INT wd_stop (HANDLE hdl);............................................................................. 6-5 6.10 INT wd_enable_reset (HANDLE hdl, BOOL state);.......................................... 6-5 6.11 INT sw_reset (HANDLE hdl);............................................................................ 6-6 6.12 INT fan_read_rpm (HANDLE hdl, PUINT rpm0, PUINT rpm1, PUINT rpm2); . 6-6 6.13 INT fan_get_type (HANDLE hdl, PUINT channel, PUCHAR type); ................. 6-6 6.14 INT fan_regulate (HANDLE hdl, UCHAR PWM0, UCHAR PWM1,

UCHAR PWM2); ............................................................................................... 6-6 6.15 Error Codes ...................................................................................................... 6-7

7 Developing Environment............................................................................................... 7-1

8 Header Files.................................................................................................................... 8-1

PC Monitoring SafeCard on Motherboard A5E00113525-02 iii

Page 4: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

Contents

PC Monitoring SafeCard on Motherboard iv A5E00113525-02

Page 5: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

1 Introduction

Optional monitoring functions are implemented ready for use in the current basic SIMATIC PC units. In combination with the respective driver and application they facilitate functions for displaying, monitoring and controlling as follows:

• Temperature monitoring (excess/low temperature or cable break on a temperature sensor).

• Watchdog (keep-alive monitoring).

• Hardware reset of the computer in the event of a watchdog interrupt.

• Fan control and monitoring.

The parameters for watchdog times and response to temperature, watchdog and fan interrupts can be parameterized per software.

The driver utilizes system resources. The required resources are determined by the driver, or read out from the registry.

The development of user applications is supported with a driver (SOM.SYS) for Windows NT 4.0, Windows 2000, Windows XP, Windows XP Embedded and Windows Server 2003 and a jointly used dynamic library (SOM.DLL). This acts as an interface between the user program and the driver.

The monitoring application (SOM.EXE), including the source code, is included in the scope of delivery.

PC Monitoring SafeCard on Motherboard A5E00113525-02 1-1

Page 6: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

Introduction

PC Monitoring SafeCard on Motherboard 1-2 A5E00113525-02

Page 7: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

2 Hardware Requirements

Prerequisite is the following hardware:

• SIMATIC PC with on-board monitoring hardware (Watchdog timer, temperature sensors).

PC Monitoring SafeCard on Motherboard A5E00113525-02 2-1

Page 8: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

Hardware Requirements

PC Monitoring SafeCard on Motherboard 2-2 A5E00113525-02

Page 9: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

PC Monitoring SafeCard on Motherboard A5E00113525-02 3-3

3 Software Requirements

The monitoring software runs under the following operating systems:

• Windows NT 4.0 (only applicable for SIMATIC Box PC 620 V2, Box PC 840 V2, Rack PC 840 V2 and Panel PC 670/870).

• Windows 2000

• Windows XP

• Windows XP Embedded

• Windows Server 2003

Page 10: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

Software Requirements

PC Monitoring SafeCard on Motherboard 3-4 A5E00113525-02

Page 11: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

4 Installation

4.1 Windows NT 4.0 / Windows 2000 / Windows XP / Windows XP Embedded / Windows Server 2003

The driver installation is carried out with the help of the "Documentation and Drivers" CDROM. Run Start.exe from your CD. In the drivers and updates menu, select your SIMATIC PC, the installed operating system, the item "Siemens SafeCard On Motherboard (SOM)" and start "Extract and Install" by double-clicking the icon.

In case you have copied the SOM directory from the CD ROM to your hard disk drive, run the C:\Drivers\Som\Install.bat batch file to carry out the installation.

Then you must restart the system.

PC Monitoring SafeCard on Motherboard A5E00113525-02 4-1

Page 12: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

Installation

4.2 Starting the Application

The installation routine copies all application files to the folder C:\Som. In addition, the start menu item "SafeCard on Motherboard" is created under “Programs". The "SOM.EXE" application is executed automatically at each system start and appears as an icon in the Taskbar. You can close it in the Task Manager and restart it via the Taskbar under Start > Program > SafeCard On Motherboard > SafeCard On Motherboard.

4.3 Scope of Delivery

On the hard disk drive of your Simatic PC or on the "Documentation and Drivers" CDROM, the Drivers\Som directory contains several subdirectories, which contain the runtime version of the driver, DLL and application, as well as the source code of the application:

Som.exe Monitoring application

Som.dll DLL file (user interface)

Common

Som.dll DLL file (user interface) Dll

Som.lib Library of the DLL file

Driver_Disk Installation diskette for SOM

Include Include directory with header files

Kernel Kernel driver directory (windows NT 4.0)

Som Source code directory of the application Som.exe

Wdm Installation directory for Windows 2000 / XP / XP

Embedded / Server 2003

PC Monitoring SafeCard on Motherboard 4-2 A5E00113525-02

Page 13: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

5 Application SOM

This application is used to monitor the PC hardware (temperature, watchdog and fan) and to display actual measurement values. A GUI can be used to configure the application, as well as to actuate temperature and fan monitoring and the Watchdog function.

Your SIMATIC PC is equipped with up to three temperature sensors, which are automatically detected by the application.

View 5-1: SOM with 3 temperature sensors:

The GUI is organized in four sections:

Temperature section:

Shows the actual temperatures and limit values. You can toggle the temperature display mode between actual temperature and the minimum/maximum values measured since the start of the application.

Watchdog section:

Lets you configure the Watchdog function of the monitoring application. You can preset the Watchdog time, activate Reset PC and activate/deactivate the Watchdog.

Fan section:

In this section you can retrieve the actually measured rate of revolution of the built-in fans.

PC Monitoring SafeCard on Motherboard A5E00113525-02 5-1

Page 14: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

Application SOM

Common section: The Common section is used to customize settings, which are valid for the temperature/watchdog/fan section. Here you can switch the accoustic signal on and off and acknowledge interrupt messages.

5.1 Temperature Monitoring Section

Up to three sensors are mounted on your SIMATIC PCs mainboard. They measure the temperature in the SIMATIC PC.

The following sensors are displayed:

• CPU diode

A diode inside the CPU for measuring the x86 chip temperature. Temperature limits are not adjustable in this section; they are set permanently in the respective BIOS.

• Mainboard

An on-board digital temperature sensor measures internal housing temperature. The upper temperature limit can here be modified within the value range specified in the respective BIOS.

• I/O Diode

A diode in the I/O module, which can be used to measure the internal chip temperature. The upper temperature limit can here be modified within the value range specified in the respective BIOS.

Every sensor displays three temperature values: the upper is the maximum and the lower is the minimum limit value. The middle field of the respective sensor can display three different temperature values. You can select this display with a click on the spin box to the left of the displayed temperature curve.

Display options:

1. The maximum temperature measured since the start of the SIMATIC PC. Above the temperature curve, an arrow with the inscription “max" indicates that this display is active.

2. The actual temperature. No arrow is displayed in the temperature curve section.

3. The minimum temperature measured since the start of the SIMATIC PC. Below the temperature curve, an arrow with the inscription “min" indicates that this display is active.

The measured temperatures are updated in 2-s intervals.

Additionally, the green , red additionally indicate whether a temperature alarm is pending (condition red) for the CPU, the I/O module or for the motherboard.

If a temperature alarm has occurred the respective display stays red until the interrupt has been acknowledged.

PC Monitoring SafeCard on Motherboard 5-2 A5E00113525-02

Page 15: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

Application SOM

5.2 Watchdog Section

You can configure the Watchdog settings in the Watchdog section. You can input the Watchdog time in the field . This time must be preset within a range of 3 to 255 seconds. The newly set time is validated with the "Apply" button. The internal Watchdog counter operates with the seconds pulse from a freewheeling clock generator, thus providing an accuracy of –1 to +0 seconds. Since the operating systems Windows NT 4.0, Windows 2000, Windows XP, Windows XP Embedded, or Windows Server 2003 are no real-time systems, it cannot be ensured that the applications are serviced by the operating system within a precisely predefined period. Therefore, this requires relatively long Watchdog times. A minimum watchdog time of 3 seconds is appropriate for the monitoring application. The Watchdog time must be increased correspondingly in systems under heavy load or if certain applications prevent the operating system from swapping tasks over extended periods of time

The checkbox can be used to switch the Watchdog on/off.

When this checkbox is activated, the SIMATIC PC is restarted in the event of a watchdog overflow.

! Caution Use this function with care. In this case, a cold PC reset is carried out. Therefore, data loss.

The LED display indicates the watchdog status. If a watchdog interrupt has occurred the respective display stays red until the interrupt has been acknowledged.

5.3 Fan Section

This section supplies information about the actual fan status. The RPM of the CPU fan as well as that of the main fan(s). The fan speed follows linear within the control range, dependent on the actual temperatures and the set temperature limit values.

The LED displays indicate the status of the fan interrupts. If an interrupt has occurred the respective display stays red until the interrupt has been acknowledged.

PC Monitoring SafeCard on Motherboard A5E00113525-02 5-3

Page 16: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

Application SOM

5.4 Common Section

This section contains a message box , the button , the checkbox and the "OK" button.

The message box displays information about the last action taken and interrupt events.

The button resets the status display in the driver and in the application.

The checkbox is used to switch the generating of "Beeps", which are generated on pending temperature or Watchdog alarm on and off.

With a click on the "Ok“ button, the user’s changes are applied and the application is hidden. User input is first written to the driver.

PC Monitoring SafeCard on Motherboard 5-4 A5E00113525-02

Page 17: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

6 DLL Functions of the Som.dll

6.1 INT sfc_read_stat(HANDLE hdl, PUINT state);

sfc_read_stat supplies information regarding the actual status of the monitored computer hardware.

Hdl is the file handle supplied by sfc_open().

A value ≠ 0 is returned in case of error (see Section 6.15).

The following states are returned in the state variable:

FAN_INT_ACTIVE

Interrupt in the event of a fan alarm is deactivated (=0) / activated (=1).

TEMP_INT_ACTIVE

Interrupt in the event of a temperature alarm is deactivated (=0) / activated (=1).

WD_INT_ACTIVE

Interrupt in the event of a watchdog alarm is deactivated (=0) / activated (=1)..

FAN0_RPM_ALARM

CPU fan alarm. RPM too low.

FAN1_RPM_ALARM

Main1 fan alarm. RPM too low.

FAN2_RPM_ALARM

Main2 fan alarm. RPM too low.

TEMP_UIO_CRIT_ALARM The critical temperature of the sensor in the I/O chip was exceeded.

TEMP_UIO_HLIMIT_ALARM The temperature of the sensor in the I/O chip exceeds the set maximum temperature.

TEMP_UIO_LLIMIT_ALARM The board temperature is lower than the set minimum temperature.

TEMP_CPU_HLIMIT_ALARM The CPU temperature exceeds the permissible maximum temperature.

TEMP_CPU_LLIMIT_ALARM The CPU temperature is lower than the minimum permissible temperature.

PC Monitoring SafeCard on Motherboard A5E00113525-02 6-1

Page 18: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

DLL Functions of the Som.dll

TEMP_BOARD_HLIMIT_ALARM The temperature of the on-board sensor exceeds the permissible maximum temperature.

TEMP_BOARD_LLIMIT_ALARM The temperature of the on-board sensor is lower than the permissible minimum temperature.

TEMP_OPEN_CIRCUIT_ALARM The circuit for measuring the CPU temperature is interrupted.

WD_TIMEOUT_OCCURED The Watchdog time has been exceeded.

WD_ACTIVE The watchdog function is switched on.

The binary classification of the above mentioned states can be found in the header file Som_dll.h.

PC Monitoring SafeCard on Motherboard 6-2 A5E00113525-02

Page 19: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

DLL Functions of the Som.dll

6.2 INT sfc_reset_status (HANDLE hdl);

Scf_reset_status() resets the status bits, which are stored in the driver.

Hdl is the file handle returned by sfc_open().

In error case a value ≠ 0 is returned (refer to the section Error codes).

6.3 INT temp_read_act_values (HANDLE hdl, PINT actCpuTemp, PINT actBoard1Temp, PINT actBoard2Temp);

In the variables actCpuTemp, actBoard1Temp and actBoard2Temp, temp_read_act_values() returns the actual temperature values for the CPU, the mainboard and the I/O chip.

Hdl is the file handle returned by sfc_open().

In error case a value ≠ 0 is returned (refer to the section Error codes) and the values in actCpuTemp, actBoard1Temp and actBoard2Temp are invalid.

6.4 INT temp_read_limit (HANDLE hdl, INT multiplex, PINT cpuLowLimit, PINT cpuHiLimit, PINT board1LowLimit, PINT board1HiLimit, PINT board2LowLimit, PINT board2HiLimit);

In the variables cpuLowLimit ,cpuHiLimit, board1LowLimit, board1HiLimit, board2LowLimit and board2HiLimit, temp_read_limit() returns the temperature limit values for the CPU, the on-board sensor and for the I/O chip.

Hdl is the file handle returned by sfc_open().

In the variable multiplex, declare whether to return the actual set limit values (multiplex = 0) or the maximum adjustable limit values (multiplex = 1).

In error case a value ≠ 0 is returned (refer to the section Error codes) and the values in cpuLowLimit ,cpuHiLimit, board1LowLimit, board1HiLimit, board2LowLimit and board2HiLimit are invalid

PC Monitoring SafeCard on Motherboard A5E00113525-02 6-3

Page 20: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

DLL Functions of the Som.dll

6.5 INT temp_set_limit (HANDLE hdl, INT HiLimit, INT multiplex);

temp_set_limit () enables you to modify the upper temperature limit value for the on-board sensor or for the sensor in the I/O chip. You can declare the limit values in the variable multiplex (0 = mainboard, 1 = I/O chip). The absolute limits are specified in the BIOS. This input is automatically corrected if faulty parameters are passed.

Hdl is the file handle returned by sfc_open().

In error case a value ≠ 0 is returned (refer to the section Error codes).

6.6 INT wd_set_time (HANDLE hdl, UINT time);

wd_set_time() facilitates Watchdog timer adjustments. The input time must lie within a range of 3 to 255 seconds.

Hdl is the file handle returned by sfc_open().

In error case a value ≠ 0 is returned (refer to the section Error codes).

6.7 INT wd_read_time (HANDLE hdl, PUINT time);

wd_read_time returns the currently set Watchdog time in the variable time.

Hdl is the file handle returned by sfc_open().

In error case a value ≠ 0 is returned (refer to the section Error codes).

PC Monitoring SafeCard on Motherboard 6-4 A5E00113525-02

Page 21: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

DLL Functions of the Som.dll

6.8 INT wd_start (HANDLE hdl);

wd_start() starts the Watchdog timer. When the set Watchdog time has expired, provided a new call of wd_start() is not executed or the Watchdog functionality is not stopped (wd_stop(), a reset is triggered, an interrupt is generated and the WD_TIMEOUT_OCCURED status bit is set in correspondence with the parameterization of the driver.

Hdl is the file handle returned by sfc_open().

In error case a value ≠ 0 is returned (refer to the section Error codes).

6.9 INT wd_stop (HANDLE hdl);

Wd_stop() stops the Watchdog timer.

Hdl is the file handle returned by sfc_open().

In error case a value ≠ 0 is returned (refer to the section Error codes).

6.10 INT wd_enable_reset (HANDLE hdl, BOOL state);

wd_enable_reset enables to generate (variable State <> 0) or prevents (variable state = 0) a reset if the set Watchdog time is exceeded.

Hdl is the file handle returned by sfc_open().

In error case a value ≠ 0 is returned (refer to the section Error codes).

PC Monitoring SafeCard on Motherboard A5E00113525-02 6-5

Page 22: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

DLL Functions of the Som.dll

6.11 INT sw_reset (HANDLE hdl);

sw_reset triggers a hardware reset.

Hdl is the file handle returned by sfc_open().

In error case a value ≠ 0 is returned (refer to the section Error codes).

6.12 INT fan_read_rpm (HANDLE hdl, PUINT rpm0, PUINT rpm1, PUINT rpm2);

fan_read_rpm() fetches the actual fan RPM. The assignment here is as follows: rpm0 = CPU fan, rpm1 = Main1 fan, rpm2 = Main2 fan. Hdl is the file handle returned by sfc_open(). In error case, a value not equal to 0 is returned (refer to the section Error codes).

6.13 INT fan_get_type (HANDLE hdl, PUINT channel, PUCHAR type);

fan_get_type() determines the fan type of the fan channel selected with channel. The assignment here is as follows: 0 = CPU fan, 1 = Main1 fan, 2 = Main2 fan. Hdl is the file handle returned by sfc_open(). In error case, a value not equal to 0 is returned (refer to the section Error codes).

6.14 INT fan_regulate (HANDLE hdl, UCHAR PWM0, UCHAR PWM1,UCHAR PWM2); fan_regulate() sets the RPM of all three fans. Hdl is the file handle returned by sfc_open(). In error case, a value not equal to 0 is returned (refer to the section Error codes).

PC Monitoring SafeCard on Motherboard 6-6 A5E00113525-02

Page 23: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

DLL Functions of the Som.dll

6.15 Error Codes

All positive functions return the value 0 (SFC_OK). If incorrect parameters or driver errors are transferred, the error source is indicated with the help of one of the error codes listed below:

SFC DRV ERROR -1 // unknown driver error SFC WRONG PARAMETER 1 // invalid parameter SFC LIMIT TO LOW 2 // specified upper temperature limit <= lower limit SFC INVALID HANDLE 3 // no driver connection (sfc_open() not called ?)

SFC_LEN_ERROR 4 // variable buffer too small

SFC_CMD_NOT_ALLOWED 5 // unkown DLL call SFC NOT OPEN 6 // no driver connection SFC_TIME_TO_LOW 7 // Watchdog time too low (minimum 3 sec) SFC_TIME_TO_HIGH 8 // Watchdog time too high (maximum 255 sec)

PC Monitoring SafeCard on Motherboard A5E00113525-02 6-7

Page 24: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

DLL Functions of the Som.dll

PC Monitoring SafeCard on Motherboard 6-8 A5E00113525-02

Page 25: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

7 Developing Environment

The application SOM was developed with Microsoft Visual V++ 6.0.

Copy the files Som.lib and Som.dll to the project folder to enable the application to run the Som.dll under Microsoft Visual C++.

When you are compiling project files, take care to enter the appropriate settings, which let you compile the project.

Use the shortcut ALT + F7 to open a window in which you can set up your environment.

You should enter the Som.dll file (with the full path name) under Additional DLL in the DEBUG register.

In the Preprocessor section of the C/C++ register, enter the location of the file som_dll.h. Input can be absolute or relative (e.g. ..\include).

In the General and Input section of the Link register, respectively enter the file Som.lib and the path in the Object/Library Modules field. Relative and absolute input is possible.

PC Monitoring SafeCard on Motherboard A5E00113525-02 7-1

Page 26: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

Developing Environment

PC Monitoring SafeCard on Motherboard 7-2 A5E00113525-02

Page 27: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

8 Header Files /****************************************************************************/ /* Copyright (C) SIEMENS AG, 2001. All rights reserved. */ /****************************************************************************/ /* */ /* Project : PC Supervision for 87366 based hardware */ /* */ /* Component : Safecard On Motherboard (SOM) */ /* */ /* Module name : som_dll.h */ /* */ /* Version : 3.0 */ /* */ /* Date (DDMMYY) : 12.01.2001 */ /* */ /* Author : Joachim Rohde */ /* A&D AS E314 */ /* */ /* */ /* Content : prototypes and defines for the communication of the */ /* application with the DLL */ /* */ /* Changes : */ /* */ /****************************************************************************/ #ifndef SOM_DLL_H #define SOM_DLL_H // ++++++++++++++++++++++ types ++++++++++++++++++++ typedef unsigned long DWORD, *PDWORD; typedef unsigned long ULONG, *PULONG; typedef unsigned char BYTE, *PBYTE; typedef unsigned char UCHAR, *PUCHAR; typedef unsigned short WORD, *PWORD; typedef unsigned short USHORT, *PUSHORT; typedef unsigned int UINT, *PUINT; typedef int INT, *PINT; typedef long LONG, *PLONG; typedef char CHAR, *PCHAR, **PPCHAR; typedef unsigned char UBYTE, UINT_8; typedef unsigned short UWORD, UINT_16; typedef unsigned long UDWORD; typedef signed char SBYTE, SINT_8; typedef signed short SWORD, SINT_16; typedef signed long SDWORD; #define VOID void typedef int BOOL, *PBOOL;

PC Monitoring SafeCard on Motherboard A5E00113525-02 8-1

Page 28: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

Header Files

// ++++++++++++++++++++++ error codes ++++++++++++++++++++++++ #define SFC_DRV_ERROR -1 // unknown error within driver #define SFC_OK 0 // the world is OK #define SFC_WRONG_PARAMETER 1 // parameter outside of valid range (time, temp) #define SFC_LIMIT_TO_LOW 2 // actual value temperature high limit <= low limit #define SFC_INVALID_HANDLE 3 // no connection to the driver (not opened ?) #define SFC_LEN_ERROR 4 // buffer too small #define SFC_CMD_NOT_ALLOWED 5 // Unknown command #define SFC_NOT_OPEN 6 // no connection to driver ! #define SFC_TIME_TO_LOW 7 // minimum allowed 3 sec #define SFC_TIME_TO_HIGH 8 // maximum allowed 255 sec // temperature value to be passed to temp_set_limit() // if more than one temp can be set we can tell which temp // will not be changed with the following value (currently not supported) // +++++++++++++++++++ useful defines +++++++++++++++++++++++ #define WD_MIN_TIME 3 #define WD_MAX_TIME 255 #define WD_DEFAULT_TIME 16 #define SET_TEMP_FALSE -127 // the valid range for temperature is: #define MAX_CPU_TEMP_LIMIT 127 #define MIN_CPU_TEMP_LIMIT 0 #define MAX_BOARD1_TEMP_LIMIT 127 #define MIN_BOARD1_TEMP_LIMIT 0 #define MAX_BOARD2_TEMP_LIMIT 127 #define MIN_BOARD2_TEMP_LIMIT 0 #define SFC_ENABLE 1 #define SFC_DISABLE 0 #define SFC_ENABLED 1 #define SFC_DISABLED 0 #define SFC_SET 1 #define SFC_CLEAR 0 #define SFC_HLIMIT_BOARD1 0 #define SFC_HLIMIT_BOARD2 1 // meaning of bits returned from temp_read_stat(); #define FAN_INT_ACTIVE 0x8000 // FAN Interrupt is activated #define TEMP_INT_ACTIVE 0x4000 // TEMP Interrupt is activated #define WD_INT_ACTIVE 0x2000 // Watchdog Interrupt is activated #define FAN0_RPM_ALARM 0x1000 // FAN0 (CPU) is too slow #define FAN1_RPM_ALARM 0x0800 // FAN1 (Main1) is too slow #define FAN2_RPM_ALARM 0x0400 // FAN2 (Main2) is too slow #define TEMP_UIO_CRIT_ALARM 0x0200 // UIO OverTemp Limit Alarm => red #define TEMP_UIO_HLIMIT_ALARM 0x0100 // UIO HighTemp Limit Alarm => orange #define TEMP_UIO_LLIMIT_ALARM 0x0080 // UIO LowTemp Limit Alarm => red #define TEMP_BOARD_HLIMIT_ALARM 0x0040 // which alarm ist set #define TEMP_BOARD_LLIMIT_ALARM 0x0020 // Board HighTemp Limit Alarm => red #define TEMP_CPU_HLIMIT_ALARM 0x0010 // Board LowTemp Limit Alarm => red #define TEMP_CPU_LLIMIT_ALARM 0x0008 // Board HighTemp Limit Alarm => red #define TEMP_OPEN_CIRCUIT_ALARM 0x0004 // this will normally never occur #define WD_TIMEOUT_OCCURED 0x0002 // if we want to poll watchdog (no interrupt assigned) #define WD_ACTIVE 0x0001 // tell if watchdog ist activated

PC Monitoring SafeCard on Motherboard 8-2 A5E00113525-02

Page 29: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

Header Files

// this masks are for deleting the specific alarms #define TEMP_STAT_MASK (TEMP_BOARD_HLIMIT_ALARM | TEMP_BOARD_LLIMIT_ALARM |\ TEMP_UIO_CRIT_ALARM | TEMP_CPU_HLIMIT_ALARM |\ TEMP_CPU_LLIMIT_ALARM | TEMP_UIO_CRIT_ALARM |\ TEMP_UIO_LLIMIT_ALARM | TEMP_OPEN_CIRCUIT_ALARM ) #define FAN_STAT_MASK (FAN0_RPM_ALARM | FAN1_RPM_ALARM | FAN2_RPM_ALARM ) #define WD_STAT_MASK (WD_TIMEOUT_OCCURED | WD_ACTIVE ) #define INT_STAT_MASK (FAN_INT_ACTIVE | TEMP_INT_ACTIVE | WD_INT_ACTIVE) #define WD_CLEAR_MASK (TEMP_STAT_MASK | FAN_STAT_MASK | INT_STAT_MASK) // ++++++++++++++++++ prototypes for the DLL functions +++++++++++++++++ #if ! defined DLL_DECL #define DLL_DECL __declspec(dllimport) #endif #ifdef __cplusplus extern "C" { #endif typedef struct indEventHdl_s { HANDLE handle; VOID (*function)(VOID); VOID (*eventCreateErrFunc)(VOID); VOID (*logErrFunc)(VOID); INT evtHdlStat; } indEventHdl_t; DLL_DECL HANDLE sfc_open (indEventHdl_t *); DLL_DECL INT sfc_close (HANDLE hdl); DLL_DECL INT sfc_read_stat (HANDLE hdl, PUINT state); DLL_DECL INT temp_read_act_values (HANDLE hdl, PINT actCpuTemp, PINT actBoard1Temp, PINT actBoard2Temp); DLL_DECL INT temp_read_limit (HANDLE hdl, INT multiplex, PINT cpuLowLimit, PINT cpuHiLimit, PINT board1LowLimit, PINT board1HiLimit, PINT board2LowLimit, PINT board2HiLimit); DLL_DECL INT temp_set_limit (HANDLE hdl, INT HiLimit, INT multiplex);

PC Monitoring SafeCard on Motherboard A5E00113525-02 8-3

Page 30: PC Monitoring SafeCard On Motherboard · • Temperature monitoring (excess/low temperature or cable break on a temperature sensor). • Watchdog (keep-alive monitoring). • Hardware

Header Files

DLL_DECL INT temp_enable_interrupt (HANDLE hdl, BOOL state); DLL_DECL INT wd_set_time (HANDLE hdl, UINT time); DLL_DECL INT wd_read_time (HANDLE hdl, PUINT time); DLL_DECL INT wd_start (HANDLE hdl); DLL_DECL INT wd_stop (HANDLE hdl); DLL_DECL INT wd_enable_interrupt (HANDLE hdl, BOOL state); DLL_DECL INT wd_enable_reset (HANDLE hdl, BOOL state); DLL_DECL INT sw_reset (HANDLE hdl); DLL_DECL INT set_relais (HANDLE hdl, BOOL state); DLL_DECL INT sfc_reset_status (HANDLE hdl); DLL_DECL INT fan_enable_interrupt (HANDLE hdl, BOOL state); DLL_DECL INT fan_read_rpm (HANDLE hdl, PUINT rpm0, PUINT rpm1, PUINT rpm2); DLL_DECL INT fan_get_type (HANDLE hdl, PUINT channel, PUCHAR type); DLL_DECL INT fan_regulate (HANDLE hdl, UCHAR PWM0, UCHAR PWM1, UCHAR PWM2); #ifdef __cplusplus } #endif #endif

PC Monitoring SafeCard on Motherboard 8-4 A5E00113525-02