Major changes in functionality according to conf. call
30.6.2010
1.1
Martin Kroul
28.1.2011
First official release of KEAPI for Windows and Linux
- restructuralization of function names, parameters and types
- no changes in functionality
1.2
Martin Kroul
26.4.2011
VxWorks added to list of supported operating systems
1.21
2.15.7KEApiSmbusWriteWord 31
2.15.8KEApiSmbusReadWord 32
2.15.9KEApiSmbusWriteBlock 32
2.15.10KEApiSmbusReadBlock 32
2.16 GPIO 33
2.16.1KEApiGpioGetCount 33
2.16.2KEApiGpioGetDirectionCaps 33
2.16.3KEApiGpioGetDirection 34
2.16.4KEApiGpioSetDirection 34
2.16.5KEApiGpioGetLevel 34
2.16.6KEApiGpioSetLevel 35
2.17 Watchdog 35
2.17.1KEApiWatchdogEnable 35
2.17.2KEApiWatchdogTrigger 35
2.17.3KEApiWatchdogDisable 36
3 ABOUT KONTRON 37
Revision history
Legal notice:
All data is for information purposes only and not guaranteed for legal purposes. Subject to change
without notice. Information in this datasheet has been carefully checked and is
believed to be accurate; however, no responsibility is assumed for inaccuracies. All brand or product
names are trademarks or registered trademarks of their respective owners.
4
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.2 KEAPI overview
KEAPI is written in C language and distributed as a dynamic-linked library so it can be used by
arbitrary application developed in C, C++ or higher programming languages simply by linking to the
project.
KEAPI library provides a set of functions for
Obtaining basic information about the system
CPU performance control
Temperature and voltage sensors monitoring
Monitoring and control of fans
Display backlight control
Access to EEPROM user storage area
I2C and SMBus communication
GPIO control
Watchdog
All KEAPI functions can be called remotely from another computer over network (TCP/IP).
KEAPI is compatible with PICMG EAPI specification (http://www.picmg.org/pdf/COM_EAPI_R1_0.pdf).
This means that it implements all functions defined by this specification. However, these functions
offer just a small part of KEAPI functionalities and don’t allow remote connection.
1.3 Architectural overview
Kontron EAPI is a layer between Kontron hardware and user application. KEAPI functions either use
hardware drivers and operating system calls to perform requested operation on local board or
connects to KEAPI server that is installed on remote board somewhere on the internet. The KEAPI
server application listens on a predefined port (default is 7890) and waits for incoming request. When
the request comes, it uses KEAPI library to perform the operation and sends result back to the client.
Fig.1. – Kontron EAPI Architecture
5
Software specification for Kontron EAPI
KEAPI_RET_ERROR
General Error
KEAPI_RET_PARAM_ERROR
Wrong parameter value
KEAPI_RET_PARAM_NULL
Parameter is NULL (memory not pre-allocated)
KEAPI_RET_WD_TIMEOUT_NOT_SUPPORTED
WD timeout not supported
KEAPI_RET_BUFFER_OVERFLOW
Buffer overflow (probably configuration error)
KEAPI_RET_SETTING_ERROR
Error while setting value or feature (enable, disable)
KEAPI_RET_RETRIEVAL_ERROR
Error while retrieving information
KEAPI_RET_WRITE_ERROR
Cannot write to file
KEAPI_RET_READ_ERROR
Cannot read file
KEAPI_RET_MALLOC_ERROR
Memory allocation failed
KEAPI_RET_LIBRARY_ERROR
Exported function could not be loaded from library
KEAPI_RET_WMI_ERROR
Problems while reading from WMI
KEAPI_RET_NOT_INITIALIZED
KEAPI library is not initialized
KEAPI_RET_PARTIAL_SUCCESS
Part of requested information couldn’t be retrieved.
Returned information isn’t complete.
KEAPI_RET_FUNCTION_NOT_SUPPORTED
Function is not supported on current platform/HW
KEAPI_RET_FUNCTION_NOT_IMPLEMENTED
Function is not yet implemented
KEAPI_RET_INVALID_IP
IP address is not in a valid format
KEAPI_RET_RMT_CON_ERROR
Remote connection failed
KEAPI_RET_RPC_ERR_MAX_CONN_COUNT_EXCEEDED
Connection limit on the client side was
reached
KEAPI_RET_RPC_ERR_SOCKET_ERROR
Error with socket manipulation
KEAPI_RET_RPC_ERR_CONNECTION_NOT_FOUND
Connection for given board handle does not
exist
KEAPI_RET_RPC_ERR_NOT_IMPLEMENTED
Remote function call is not implemented
KEAPI_RET_RPC_ERR_SOCKET_TIMEOUT
Time limit for select() function expired
KEAPI_RET_RPC_ERR_PACKET_ERROR
Wrong format of KEAPI packet
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. This function returns a board handle (unique four-byte number) that will
other KEAPI functions take as their first parameter. The KEApiLibInitialize() function may be called
several times for simultaneous connection to several boards. When KEAPI is no longer needed, the
KEApiLibUnInitialize() function should be called.
Memory for structures and variables that will be used by KEAPI functions to store information must be
pre-allocated by the user application. KEAPI by itself doesn’t allocate memory for output parameters.
2.1 Return values
If everything goes well, all KEAPI functions return KEAPI_RET_SUCCESS. If some error occurs, the
returned error message differs for various functions. Error messages can be basically divided into two
groups: Functionality errors and Connection errors.
2.1.1 Functional errors
2.1.2 Remote connection errors
6
Software specification for Kontron EAPI
in/out
Parameter name
Description
in
pHostIp
IP address of a remote computer. If it is set to NULL or
“localhost” then localhost is considered to be the target
machine (no KEAPI server running on the machine is
needed). If it is set to “127.0.0.1”, then it connects to KEAPI
server running on the local machine (can be used for testing
KEAPI server application locally)
in
port
Port number where KEAPI server is listening, default is 7890.
out
pBoardHandle
Returned pointer to the handle of selected board.
BoardHandle == 0 means localhost.
Pointer to a variable that receives system running time in
seconds
Description:
Provides information about Kontron motherboard.
Parameters:
Structure used:
typedef structBoard_Info
{
KEAPI_CHAR boardManufacturer[MAX_STR]; // Board manufacturer KEAPI_CHAR boardName[MAX_STR]; // Board name KEAPI_CHAR boardVersion[MAX_STR]; // Board version KEAPI_CHAR boardSerialNumber[MAX_STR]; // Board serial number KEAPI_CHAR biosVersion[MAX_STR]; // Bios version KEAPI_CHAR biosDate[MAX_STR]; // BIOS date in format
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. AMT functionality can be tested via
web browser (fill in address http:// “remote board’s IP”:16992 and AMT web page should appear).
Uses Intel AMT to turn on, turn off or restart remote board. If the remote board doesn’t support Intel
AMT, then the KEApiSetSystemState() function using OS call can be used instead.
Uses operating system’s command to turn on, turn off or restart remote board. There is no guarantee
that the command was performed correctly i.e. if the system hangs.
KEAPI_UINT32 boardHandle,
KEAPI_INT8 freqType,
KEAPI_PINT32 frequency
);
Description:
Provides information about CPU frequency
minimal supported CPU frequency: CPU_FREQUENCY_MIN, 0
maximal supported CPU frequency: CPU_FREQUENCY_MAX, 1
current CPU frequency: CPU_FREQUENCY_CURRENT, 2.
10
Software specification for Kontron EAPI
in/out
Parameter name
Description
in
boardHandle
Handle of the selected board
in
freqType
Type of frequency (minimal (CPU_FREQUENCY_MIN, 0),
maximal (CPU_FREQUENCY_MAX, 1), current
(CPU_FREQUENCY_CURRENT, 2))
out
frequency
Frequency of the CPU, in kHz
in/out
Parameter name
Description
in
boardHandle
Handle of the selected board
out
pCpuInfo
Returned CPU_INFO structure
Parameters:
2.4.2 KEApiGetCpuInfo
KEAPI_CALLTYPEKEAPI_UINT32 KEApiGetCpuInfo (
KEAPI_UINT32 boardHandle,
PCPU_INFO pCpuInfo
);
Description:
Provides information about processors.
Parameters:
Structure used:
typedef structCpu_Info
{
KEAPI_CHAR cpuName[MAX_STR]; // CPU name KEAPI_INT32 cpuCount; // Number of CPUs KEAPI_INT32 cpuCoreCount; // Number of cores of each CPU KEAPI_INT32 cpuThreadCount; // Number of CPU threads KEAPI_FLOAT cpuMaxCoreSpeed; // Designed core speed in MHz KEAPI_INT32 fsbSpeed; // FSB speed in MHz KEAPI_INT32 l1Cache; // L1 cache size in kB KEAPI_INT32 l2Cache; // L2 cache size in kB KEAPI_INT32 l3Cache; // L3 cache size in kB
Provides information about selected memory module.
Parameters:
Structure used:
typedef structMemoryModule
{
KEAPI_INT32 moduleSize; // Module capacity in MB
KEAPI_CHARmanufacturer[MAX_STR]; // Memory module manufacturer
KEAPI_CHARpartNumber[MAX_STR]; // Memory module part number
KEAPI_CHARserialNumber[MAX_STR]; // Memory module serial number
} MEMORY_MODULE, *PMEMORY_MODULE;
13
Software specification for Kontron EAPI
in/out
Parameter name
Description
in
boardHandle
Handle of the selected board
out
pDiskDriveCount
Number of installed disk drives
in/out
Parameter name
Description
in
boardHandle
Handle of the selected board
in
diskDriveCount
Number of disks
out
pDiskDrives
Returned array of DISK_DRIVE structures. The array must be
allocated as DiskDriveCount * sizeof(DISK_DRIVE),
where DiskDriveCount is obtained from calling
Provides list of disk drives and their properties.
Parameters:
Structure used:
typedef struct Disk_Drive
{
KEAPI_CHAR name[MAX_STR]; // HDD name KEAPI_CHAR model[MAX_STR]; // Model KEAPI_CHAR diskSerialNumber[MAX_STR]; // Serial number KEAPI_UINT32 size; // Size in MB
KEAPI_CHAR name[MAX_STR]; // Partition name KEAPI_CHAR fsType[MAX_STR]; // Filesystem type KEAPI_UINT32 partitionSize; // Size in MB KEAPI_UINT32 freeSpace; // Free space in MB
KEAPI_CHAR deviceName[MAX_STR]; // Device name KEAPI_CHAR type[MAX_STR]; // LION, NiCd, NiMH…KEAPI_CHAR serialNumber[MAX_STR]; // Serial number KEAPI_INT32 designedVoltage; // Designed voltage in mV KEAPI_INT32 designedCapacity; // Designed capacity of fully
charged battery in mAh
KEAPI_INT32 fullyChargedCapacity; // Real capacity of fully charged
battery in mAh
KEAPI_INT32 cycleCount; // Number of charge/discharge cycles
experienced during lifetime
} BATTERY_INFO, *PBATTERY_INFO;
KEAPI_INT32 powerState; // Current power state - charging = 0,
charged = 1, discharging = 2
KEAPI_INT32 fullBatteryRemainingTime; // Remaining time in seconds
when battery is full and AC power unplugged
KEAPI_INT32 remainingTime; // Remaining time in seconds KEAPI_INT32 remainingCapacity; // Remaining capacity in mAh KEAPI_INT32 currentVoltage; // Current voltage in mV KEAPI_INT32 rate; // Current charging/discharging rate in mA
16
Software specification for Kontron EAPI
in/out
Parameter name
Description
in
boardHandle
Handle of the selected board
out
pTempSensorCount
Pointer to number of installed temperature sensors
in/out
Parameter name
Description
in
boardHandle
Handle of the selected board
in
tempSensorCount
Number of temperature sensors
out
pTempSensors
Pointer to the temperature sensors structure
KEAPI_INT32 chargeState; // Battery charge state in percentage
KEAPI_CHAR name[MAX_STR]; // Fan name KEAPI_UINT32 rpm; // Revolutions per minute KEAPI_UINT8 pwm; // Pulse width modulation fan control KEAPI_UINT8 powerMode; // Fan speed control mode 0 = DC, 1 = PWM KEAPI_UINT8 method; // Method of control - Maximal speed,
manual control or thermal cruise
} FAN, *PFAN;
20
Software specification for Kontron EAPI
in/out
Parameter name
Description
in
boardHandle
Handle of the selected board
in
fanNr
Number (index) of a fan you are interested in. Fan numbers
start with 0
out
pwm
Fan speed modulation pwm. Can be set to NULL if not
wanted.
out
rpm
Returned fan speed in rpm. Can be set to NULL if not
wanted.
in/out
Parameter name
Description
in
boardHandle
Handle of the selected board
in
fanNr
Number (index) of a fan. Fan numbers start with 0.
out
fanMode
Current fan mode (max speed, manual control, thermal
cruise).
Number (index) of a fan. Fan numbers start with 0.
in
targetPwm
Required fan speed modulation pwm in a range of 0 (min) 255 (full speed)
in/out
Parameter name
Description
in
boardHandle
Handle of the selected board
in
fanNr
Number (index) of a fan you are interested in. Fan numbers
start with 0.
in
targetTemp
What temperature should not be exceeded, in millidegrees
Celsius
in
toleranceTemp
Tolerance of the target temperature. The controlled
temperature should fluctuate around the target temperature
within given tolerance, i.e. If the target temperature is 30
degrees Celsius, and the tolerance is set to 2 degrees, then
the temperature is kept in the range of 28 - 32 degrees.
Pointer to array of NETWORK_DEVICE structures. The array
must be preallocated as NetworkDev iceCount * sizeof(NETWORK_DEVICE), where
NetworkDeviceCount is obtained from calling
Provides information about installed network devices.
Parameters:
Structure used:
typedef structNetwork_Device
{
KEAPI_CHAR ip[MAX_STR]; // IP address
KEAPI_CHAR mac[MAX_STR]; // MAC address in format XX-XX-XX-XX-XX-XX
KEAPI_INT32 speed; // Connection speed
KEAPI_CHAR deviceName[MAX_STR]; // Name of the network device
} NETWORK_DEVICE, *PNETWORK_DEVICE;
Number of the storage area. Number of storage areas can be
obtained from the KEApiGetStorageCount function
out
pStorageSize
Pointer to variable that receives size of the selected storage
area.
Parameters:
Structure used:
typedef structPci_Device
{
KEAPI_INT32 domain; // Domain number
KEAPI_INT32 bus; // Bus number
KEAPI_INT32 slot; // Slot number
KEAPI_INT32 funct; // Function number
KEAPI_INT32 deviceId; // Device ID
KEAPI_INT32 vendorId; // Vendor ID
KEAPI_INT32 classId; // Class ID
KEAPI_CHAR deviceName[MAX_STR]; // Name of the device
KEAPI_CHAR vendorName[MAX_STR]; // Name of the vendor
KEAPI_CHAR className[MAX_STR]; // Name of the class
} PCI_DEVICE, *PPCI_DEVICE;
Quick command read/write may be used to simply turn a device on/off or to enable/disable low-power
standby mode etc. There is no data received. For additional information, refer to the System
Management Bus(SMBus) Specification Version 2.0, which is available at
http://smbus.org/specs/smbus20.pdf.
Number of SMBus. From 0 to (SmbusCount - 1) returned by
KEApiGetSmbusCount.
in
smbusAddress
Address of SMBus slave device
in
byte
Command. Depends on device
in/out
Parameter name
Description
in
boardHandle
Handle of the selected board.
in
smbusNr
Number of SMBus. From 0 to (SmbusCount - 1) returned by
KEApiGetSmbusCount.
in
smbusAddress
Address of SMBus slave device
out
pByte
Device information byte. Depends on device
in/out
Parameter name
Description
in
boardHandle
Handle of the selected board.
in
smbusNr
Number of SMBus. From 0 to (SmbusCount - 1) returned by
KEApiGetSmbusCount.
in
smbusAddress
Address of SMBus slave device
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.
A simple device may have information that the host needs. It can do so with Receive byte protocol. For
additional information, refer to the System Management Bus (SMBus) Specification Version 2.0, which
is available at http://smbus.org/specs/smbus20.pdf.
This function writes data of size of byte to 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.
Parameters:
30
Software specification for Kontron EAPI
in
command
Command code. Depends on device
in
byte
Data
in/out
Parameter name
Description
in
boardHandle
Handle of the selected board.
in
smbusNr
Number of SMBus. From 0 to (SmbusCount - 1) returned by
KEApiGetSmbusCount.
in
smbusAddress
Address of SMBus slave device
in
command
Command code. Depends on device
out
pByte
Pointer to the data value
in/out
Parameter name
Description
in
boardHandle
Handle of the selected board.
in
smbusNr
Number of SMBus. From 0 to (SmbusCount - 1) returned by
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.pdf.
This function writes data of size of word to 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.
Parameters:
31
Software specification for Kontron EAPI
in/out
Parameter name
Description
in
boardHandle
Handle of the selected board.
in
smbusNr
Number of SMBus. From 0 to (SmbusCount - 1) returned by
KEApiGetSmbusCount.
in
smbusAddress
Address of SMBus slave device
in
command
Command code. Depends on device
out
pWord
Pointer to the data value
in/out
Parameter name
Description
in
boardHandle
Handle of the selected board.
in
smbusNr
Number of SMBus. From 0 to (SmbusCount - 1) returned by
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.
This function writes up to 32 bytes to 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.
Number of SMBus. From 0 to (SmbusCount - 1) returned by
KEApiGetSmbusCount.
in
smbusAddress
Address of SMBus slave device
in
command
Command code. Depends on device
out
pData
Pointer to a data block of size up to 32 bytes
in/ out
pDataLength
This is also the "out" parameter. It is a pointer to the length of
data to read. After completing the function, this parameter
contains real value of the data length.
in/out
Parameter name
Description
in
boardHandle
Handle of the selected board.
out
pGpioCount
Pointer to a variable where the GPIO count is saved
in/out
Parameter name
Description
in
boardHandle
Handle of the selected board.
in
gpioNr
Number of a GPIO port. From 0 to (GpioCount - 1) returned
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.
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. Kontron engineering and manufacturing
facilities, located throughout Europe, North America, and Asia-Pacific, work together with streamlined
global sales and support services to help customers reduce their time-to-market and gain a
competitive advantage. Kontron’s diverse product portfolio includes: boards & mezzanines, Computeron-Modules, HMIs & displays, systems & platforms, and rugged & custom capabilities.
Kontron is a Premier member of the Intel® Embedded and Communications Alliance and has been a
VDC Platinum Vendor for Embedded Computer Boards 5 years running.
Kontron is listed on the German TecDAX stock exchange under the symbol "KBC". For more
information, please visit: www.kontron.com
37
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.