Software specification for Kontron EAPI Version 1.21 Author: Martin Kroul Last change date: 26.4.
Software specification for Kontron EAPI Contents CONTENTS 2 1 5 INTRODUCTION 1.1 Purpose of this document 5 1.2 KEAPI overview 5 1.3 Architectural overview 5 1.4 Operating systems 6 2 FUNCTION DOCUMENTATION 6 2.1 Return values 2.1.1 Functional errors 2.1.2 Remote connection errors 6 6 6 2.2 Initialization 2.2.1 KEApiLibInitialize 2.2.2 KEApiLibUnInitialize 7 7 7 2.3 General information 2.3.1 KEApiGetBoardInfo 2.3.2 KEApiGetBootCounter 2.3.3 KEApiSystemUpTime 2.3.
Software specification for Kontron EAPI 2.7.2 2.7.3 KEApiGetBatteryInfo KEApiGetBatteryState 15 16 2.8 Temperature sensors 2.8.1 KEApiGetTempSensorCount 2.8.2 KEApiGetTempSensorList 2.8.3 KEApiGetTempSensorValue 2.8.4 KEApiGetCpuTemp 2.8.5 KEApiGetChipsetTemp 2.8.6 KEApiGetSystemTemp 17 17 17 17 18 18 18 2.9 Voltage sensors 2.9.1 KEApiGetVoltageSensorCount 2.9.2 KEApiGetVoltageSensorList 2.9.3 KEApiGetVoltageSensorValue 19 19 19 19 2.10 Fan Control 2.10.1 KEApiGetFanCount 2.10.2 KEApiGetFanList 2.
Software specification for Kontron EAPI 2.15.7 KEApiSmbusWriteWord 2.15.8 KEApiSmbusReadWord 2.15.9 KEApiSmbusWriteBlock 2.15.10 KEApiSmbusReadBlock 31 32 32 32 2.16 GPIO 2.16.1 KEApiGpioGetCount 2.16.2 KEApiGpioGetDirectionCaps 2.16.3 KEApiGpioGetDirection 2.16.4 KEApiGpioSetDirection 2.16.5 KEApiGpioGetLevel 2.16.6 KEApiGpioSetLevel 33 33 33 34 34 34 35 2.17 Watchdog 2.17.1 KEApiWatchdogEnable 2.17.2 KEApiWatchdogTrigger 2.17.
Software specification for Kontron EAPI 1 Introduction 1.1 Purpose of this document This document describes Kontron Embedded API – a software library that enables programmers to easily create their applications for monitoring and control hardware resources of Kontron boards, modules, systems and platforms. 1.
Software specification for Kontron EAPI 1.4 Operating systems This document describes KEAPI interface for Linux, Windows XP, Windows Vista - 32/64, Windows 7 - 32/64, VxWorks. 2 Function Documentation Main part of Kontron EAPI is dynamic-linked library with API functions. Before using any of these functions, KEAPI has to be initialized and connection to the board has to be established by calling the KEApiLibInitialize() function.
Software specification for Kontron EAPI 2.2 Initialization 2.2.1 KEApiLibInitialize KEAPI_CALLTYPE KEAPI_UINT32 KEApiLibInitialize ( KEAPI_PCHAR pHostIp, KEAPI_UINT32 port, KEAPI_PUINT32 pBoardHandle, KEAPI_UINT32 logLevel, KEAPI_PCHAR pLogFile ); Description: Initialization of Kontron EAPI. Parameters: in/out in Parameter name pHostIp in out port pBoardHandle In logLevel in pLogFile Description IP address of a remote computer.
Software specification for Kontron EAPI Description: Provides information about Kontron motherboard.
Software specification for Kontron EAPI 2.3.4 KEApiGetSystemStateAmt KEAPI_CALLTYPE KEAPI_UINT32 KEApiGetSystemStateAmt ( KEAPI_PCHAR pHostIp, KEAPI_PCHAR pUser, KEAPI_PCHAR pPassword, KEAPI_PINT32 pSystemState ); Description: Uses Intel AMT to get information about state of remote board (turned on, turned off or hibernated). The remote board must support Intel AMT and enable it in BIOS.
Software specification for Kontron EAPI Parameters: in/out in in Parameter name boardHandle systemState Description Handle of the selected board Desired system state SYSTEM_STATE_TURN_OFF, 1 SYSTEM_STATE_HIBERNATE, 2 SYSTEM_STATE_RESTART, 3 2.3.7 KEApiGetIntruderStatus KEAPI_CALLTYPE KEAPI_UINT32 KEApiGetIntruderStatus ( KEAPI_UINT32 boardHandle, KEAPI_PINT32 pIntruderStatus ); Description: Provides actual information whether computer case was opened or not.
Software specification for Kontron EAPI Parameters: in/out in in Parameter name boardHandle freqType out frequency Description Handle of the selected board Type of frequency (minimal (CPU_FREQUENCY_MIN, 0), maximal (CPU_FREQUENCY_MAX, 1), current (CPU_FREQUENCY_CURRENT, 2)) Frequency of the CPU, in kHz 2.4.2 KEApiGetCpuInfo KEAPI_CALLTYPE KEAPI_UINT32 KEApiGetCpuInfo ( KEAPI_UINT32 boardHandle, PCPU_INFO pCpuInfo ); Description: Provides information about processors.
Software specification for Kontron EAPI Parameters: in/out in out Parameter name boardHandle pPerformanceType out pPerformancePercentage Description Handle of the selected board Pointer to the type of current CPU performance. The type is given by a number (0 – 3 where: 0 - high performance 1 - power save mode 2 - on demand mode 3 - conservative mode ). Supported only on Linux Pointer to current CPU performance in percentage. Supported only on Windows 2.4.
Software specification for Kontron EAPI Structure used: typedef struct Memory_Info { KEAPI_INT32 memTotal; // Total physical memory size in MB KEAPI_INT32 memFree; // Free memory in MB KEAPI_INT32 memSpeed; // Memory speed in MHz KEAPI_CHAR memType[MAX_STR]; // Type of memory (DDR, DDR2, etc. } MEMORY_INFO, *PMEMORY_INFO; 2.5.
Software specification for Kontron EAPI 2.6 Hard disks and partitions 2.6.1 KEApiGetDiskDriveCount KEAPI_CALLTYPE KEAPI_UINT32 KEApiGetDiskDriveCount ( KEAPI_UINT32 boardHandle, KEAPI_PINT32 pDiskDriveCount ); Description: Provides number of installed disk drives. Parameters: in/out in out Parameter name boardHandle pDiskDriveCount Description Handle of the selected board Number of installed disk drives 2.6.
Software specification for Kontron EAPI Parameters: in/out in out Parameter name boardHandle pDiskPartitionCount Description Handle of the selected board Number of partitions 2.6.4 KEApiGetDiskDrivePartitionList KEAPI_CALLTYPE KEAPI_UINT32 KEApiGetDiskDrivePartitionList ( KEAPI_UINT32 boardHandle, PDISK_PARTITION pDiskPartitionData, KEAPI_UINT32 diskPartitionCount ); Description: Provides list of disk partitions.
Software specification for Kontron EAPI Description: Provides information about selected battery. Parameters: in/out in in out Parameter name boardHandle batteryNr pBatteryInfo Description Handle of the selected board Requested battery's number. Numbers start with zero.
Software specification for Kontron EAPI KEAPI_INT32 chargeState; // Battery charge state in percentage } BATTERY_STATE, *PBATTERY_STATE; 2.8 Temperature sensors 2.8.1 KEApiGetTempSensorCount KEAPI_CALLTYPE KEAPI_UINT32 KEApiGetTempSensorCount ( KEAPI_UINT32 boardHandle, KEAPI_PINT32 pTempSensorCount ); Description: Provides number of temperature sensors.
Software specification for Kontron EAPI Parameters: in/out in in Parameter name boardHandle tempSensorNr out pTempSensorValue Description Handle of the selected board Number (index) of a temperature sensor. Numbers start with 0 Pointer to the value of a given temperature sensor 2.8.4 KEApiGetCpuTemp KEAPI_CALLTYPE KEAPI_UINT32 KEApiGetCpuTemp ( KEAPI_UINT32 boardHandle, KEAPI_INT32 cpuNr, KEAPI_PINT32 pCpuTemp ); Description: Provides information about actual temperature of the selected CPU.
Software specification for Kontron EAPI 2.9 Voltage sensors 2.9.1 KEApiGetVoltageSensorCount KEAPI_CALLTYPE KEAPI_UINT32 KEApiGetVoltageSensorCount ( KEAPI_UINT32 boardHandle, KEAPI_PINT32 pVoltageSensorCount ); Description: Provides number of voltage sensors. Parameters: in/out in out Parameter name boardHandle pVoltageSensorCount Description Handle of the selected board Pointer to the voltage sensors count 2.9.
Software specification for Kontron EAPI Parameters: in/out in in out Parameter name boardHandle voltageSensorNr pVoltageSensorValue Description Handle of the selected board Number (index) of a voltage. Numbers start with 0 Pointer to the value of the selected sensor, in millivolts 2.10 Fan Control 2.10.1 KEApiGetFanCount KEAPI_CALLTYPE KEAPI_UINT32 KEApiGetFanCount ( KEAPI_UINT32 boardHandle, KEAPI_PINT32 pFanCount ); Description: Provides number of fans.
Software specification for Kontron EAPI 2.10.3 KEApiGetFanSpeed KEAPI_CALLTYPE KEAPI_UINT32 KEApiGetFanSpeed ( KEAPI_UINT32 boardHandle, KEAPI_INT32 fanNr, KEAPI_PUINT8 pwm, KEAPI_PINT32 rpm ); Description: Provides information about fan speed. Parameters: in/out in in Parameter name boardHandle fanNr out pwm out rpm Description Handle of the selected board Number (index) of a fan you are interested in. Fan numbers start with 0 Fan speed modulation pwm. Can be set to NULL if not wanted.
Software specification for Kontron EAPI Parameters: in/out in in in Parameter name boardHandle fanNr targetPwm Description Handle of the selected board Number (index) of a fan. Fan numbers start with 0. Required fan speed modulation pwm in a range of 0 (min) 255 (full speed) 2.10.
Software specification for Kontron EAPI Parameters: in/out in in Parameter name boardHandle cpuFanSpeedPwm Description Handle of the selected board Required CPU fan speed pwm 0 (min) - 255 (max. speed) 2.10.9 KEApiGetSystemFanSpeed KEAPI_CALLTYPE KEAPI_UINT32 KEApiGetSystemFanSpeed ( KEAPI_UINT32 boardHandle, KEAPI_PINT32 pSystemFanRpm ); Description: Provides system fan speed (revolutions per minute). Parameters: in/out in out 2.10.
Software specification for Kontron EAPI 2.11.2 KEApiGetBacklightValue KEAPI_CALLTYPE KEAPI_UINT32 KEApiGetBacklightValue ( KEAPI_UINT32 boardHandle, KEAPI_INT32 displayNr, KEAPI_PINT32 pBacklight ); Description: Provides information about current backlight intensity of the selected display. Parameters: in/out in in out Parameter name boardHandle displayNr pBacklight Description Handle of the selected board Requested display's number.
Software specification for Kontron EAPI 2.12.2 KEApiGetNetworkDeviceList KEAPI_CALLTYPE KEAPI_UINT32 KEApiGetNetworkDeviceList ( KEAPI_UINT32 boardHandle, PNETWORK_DEVICE pNetworkDevices, KEAPI_INT32 networkDeviceCount ); Description: Provides information about installed network devices. Parameters: in/out in in out Parameter name boardHandle networkDeviceCount pNetworkDevices Description Handle of the selected board Number of network devices Pointer to array of NETWORK_DEVICE structures.
Software specification for Kontron EAPI Parameters: in/out in in out Parameter name boardHandle pciDeviceCount pPciDevices Description Handle of the selected board Number of installed PCI devices Returned array of PCI_DEVICE structures Structure used: typedef struct Pci_Device { KEAPI_INT32 domain; KEAPI_INT32 bus; KEAPI_INT32 slot; KEAPI_INT32 funct; KEAPI_INT32 deviceId; KEAPI_INT32 vendorId; KEAPI_INT32 classId; KEAPI_CHAR deviceName[MAX_STR]; KEAPI_CHAR vendorName[MAX_STR]; KEAPI_CHAR className[MAX_
Software specification for Kontron EAPI 2.13.3 KEApiStorageRead KEAPI_CALLTYPE KEAPI_UINT32 KEApiStorageRead ( KEAPI_UINT32 boardHandle, KEAPI_INT32 storageNr, KEAPI_INT32 offset, KEAPI_PUINT8 pData, KEAPI_INT32 dataLength ); Description: Reads block of bytes from selected EEPROM. Parameters: in/out in in Parameter name boardHandle storageNr in out in offset pData dataLength Description Handle of the selected board EEPROM storage number (starts from 0).
Software specification for Kontron EAPI Parameters: in/out in out Parameter name boardHandle pI2cBusCount Description Handle of the selected board. Pointer to the variable where the I2C bus count is saved 2.14.2 KEApiI2cWrite KEAPI_CALLTYPE KEAPI_UINT32 KEApiI2cWrite ( KEAPI_UINT32 boardHandle, KEAPI_UCHAR i2cNr, KEAPI_UCHAR i2cAddress, KEAPI_UCHAR memoryAddress, KEAPI_PUCHAR pData, KEAPI_UINT32 dataLength ); Description: This function writes data to the slave I2C device connected to the I2C bus.
Software specification for Kontron EAPI in/ out pDataLength Also an "out" parameter. When the function finishes, this parameter contains a real value of the read data length. 2.15 SMBus 2.15.1 KEApiGetSmbusCount KEAPI_CALLTYPE KEAPI_UINT32 KEApiGetSmbusCount ( KEAPI_UINT32 boardHandle, KEAPI_PUCHAR pSmbusCount ); Description: Function for getting number of active SMBuses.
Software specification for Kontron EAPI Description: A simple device may accept up to 256 possible encoded commands in a form of a byte. For additional information, refer to the System Management Bus (SMBus) Specification Version 2.0, which is available at http://smbus.org/specs/smbus20.pdf. Parameters: in/out in in Parameter name boardHandle smbusNr in in smbusAddress byte Description Handle of the selected board. Number of SMBus. From 0 to (SmbusCount - 1) returned by KEApiGetSmbusCount.
Software specification for Kontron EAPI in in command byte Command code. Depends on device Data 2.15.6 KEApiSmbusReadByte KEAPI_CALLTYPE KEAPI_UINT32 KEApiSmbusReadByte ( KEAPI_UINT32 boardHandle, KEAPI_UCHAR smbusNr, KEAPI_UCHAR smbusAddress, KEAPI_UCHAR command, KEAPI_PUCHAR pByte ); Description: This function reads data of size of byte from a device. For additional information, refer to the System Management Bus (SMBus) Specification Version 2.0, which is available at http://smbus.org/specs/smbus20.
Software specification for Kontron EAPI 2.15.8 KEApiSmbusReadWord KEAPI_CALLTYPE KEAPI_UINT32 KEApiSmbusReadWord ( KEAPI_UINT32 boardHandle, KEAPI_UCHAR smbusNr, KEAPI_UCHAR smbusAddress, KEAPI_UCHAR command, KEAPI_PUINT16 pWord ); Description: This function reads data of size of word from a device. For additional information, refer to the System Management Bus (SMBus) Specification Version 2.0, which is available at http://smbus.org/specs/smbus20.pdf.
Software specification for Kontron EAPI KEAPI_PUCHAR pData, KEAPI_PUCHAR pDataLength ); Description: This function reads up to 32 byte from the device. For additional information, refer to the System Management Bus (SMBus) Specification Version 2.0, which is available at http://smbus.org/specs/smbus20.pdf. Parameters: in/out in in Parameter name boardHandle smbusNr in in out in/ out smbusAddress command pData pDataLength Description Handle of the selected board. Number of SMBus.
Software specification for Kontron EAPI out out pIsInput pIsOutput by KEApiGpioGetCount. If TRUE then pin can be input If TRUE then pin can be output 2.16.3 KEApiGpioGetDirection KEAPI_CALLTYPE KEAPI_UINT32 KEApiGpioGetDirection ( KEAPI_UINT32 boardHandle, KEAPI_UINT32 gpioNr, KEAPI_PUCHAR pDirection ); Description: Function for getting current direction of selected GPIO pin. Parameters: in/out in in Parameter name boardHandle gpioNr out pDirection Description Handle of the selected board.
Software specification for Kontron EAPI in gpioNr out pLevel Number of an input GPIO. From 0 to (GpioCount - 1) returned by KEApiGpioGetCount. Pointer to a variable where the GPIO level (0 – low, 1- high) is saved 2.16.6 KEApiGpioSetLevel KEAPI_CALLTYPE KEAPI_UINT32 KEApiGpioSetLevel ( KEAPI_UINT32 boardHandle, KEAPI_UINT32 gpioNr, KEAPI_UCHAR level ); Description: Function for setting level of selected GPIO pin.
Software specification for Kontron EAPI 2.17.3 KEApiWatchdogDisable KEAPI_CALLTYPE KEAPI_UINT32 KEApiWatchdogDisable ( KEAPI_UINT32 boardHandle ); Description: Disables the watchdog.
Software specification for Kontron EAPI 3 About Kontron Kontron, the global leader of embedded computing technology, designs and manufactures embedded and communications standards-based, rugged COTS and custom solutions for OEMs, systems integrators, and application providers in a variety of markets.