# SEMA® EAPI Guide

(Applicable to SEMA Linux Version ≥ 4.4.0 and SEMA Windows Version ≥ 4.2.15)

February 17, 2026

![SEMA](.sema-eapi-guide/a10ca58e62613558c1010ccb7f4b6fd679e35b97c2ae4f3493dcdb0da692f5d5.jpg)

Leading EDGE COMPUTING

# Copyright 2026 ADLINK Technology, Inc.

# Disclaimer

The information in this document is subject to change without prior notice in order to improve reliability, design, and function and does not represent a commitment on the part of the manufacturer. In no event will the manufacturer be liable for direct, indirect, special, incidental, or consequential damages arising out of the use or inability to use the product or documentation, even if advised of the possibility of such damages. This document contains proprietary information protected by copyright.

All rights are reserved. No part of this manual may be reproduced by any mechanical, electronic, or other means in any form without prior written permission of ADLINK Technology, Inc.

# Trademark Information

Product names mentioned herein are used for identification purposes only and may be trademarks and/or registered trademarks of their respective companies.

Revision History

<table><tr><td>Revision</td><td>Release Date</td><td>Description of Changes</td></tr><tr><td>1.0</td><td>17/02/2026</td><td>Initial version of User manual for SEMA Windows and Linux</td></tr></table>

# Contents

# Revision History... .3

1. Acronyms / Definitions..
2. Overview .. .11

2.1. For Linux Platform.. .11
2.2. For Windows Platform..... 12

3. Type Definitions .. . 13
4. Status Codes .. . 14
5. For Linux Platforms ...... .16

5.1 Initialization Functions . . 16

5.1.1 EApiLibInitialize . .. 16
5.1.2 EApiLibUnInitialize . .. 16

5.2 Board Information Functions... .17

5.2.1 EApiBoardGetStringA . . 17

5.3 Board Values.. .19
5.3.1 EApiBoardGetValue.. . 19
5.4 Watchdog Control .. .22

5.4.1 EApiWDogGetCap.. . 22
5.4.2 EApiWDogStart . .. 23
5.4.3 EApiWDogTrigger .. . 24
5.4.4 EApiWDogStop... . 24
5.4.5 EApiPwrUpWDogStart.. . 25
5.4.6 EApiPwrUpWDogStop.... . 25

5.5 Storage Access .. ..26

5.5.1 EApiStorageCap .. .. 26
5.5.2 EApiStorageAreaRead . 27
5.5.3 EApiStorageAreaWrite. .. 28
5.5.4 EApiStorageHexRead.. .. 29
5.5.5 EApiStorageHexWrite . .. 30
5.5.6 EApiStorageUnLock . . 31
5.5.7 EApiStorageLock . . 32

5.6 Voltage Monitor.. ..34

5.6.1 EApiBoardGetVoltageCap.. .. 34

5.7 GPIO . .36

5.7.1 EApiGPIOGetDirectionCaps ... .. 36
5.7.2 EApiGPIOGetDirection.... . 37
5.7.3 EApiGPIOSetDirection . . 38
5.7.4 EApiGPIOGetLevel. .. 39
5.7.5 EApiGPIOSetLevel . .. 40

5.8. Generic I2C Access.. .41

5.8.1 EApiI2CGetBusCap. .. 41
5.8.2 EApiI2CGetBusSts. .. 42
5.8.3 EApiI2CProbeDevice .. .. 43
5.8.4 EApiI2CReadTransfer .. 44
5.8.5 EApiI2CWriteTransfer... . 45
5.8.6 EApiI2CWriteReadRaw.... .. 46

5.9. Error Log Description.. .47

5.9.1 EApiBoardGetErrorLog .. .. 47
5.9.2 EApiBoardGetCurPosErrorLog .. . 48
5.9.3 EApiBoardGetErrorNumDesc.. . 50

5.10. BIOS Source. ..51

5.10.1 EApiGetBiosSource . . 51
5.10.2 EApiSetBiosSource... . 51
5.10.3 EApiGetBiosStatus... . 52

5.11. Smart Fan .. ..53

5.11.1. EApiSmartFanSetTempSetpoints.. . 54
5.11.2. EApiSmartFanGetTempSetpoints. . 55
5.11.3. EApiSmartFanSetPWMSetpoints.. . 56
5.11.4. EApiSmartFanGetPwmSetpoints .. 57
5.11.5. EApiSmartFanSetMode.. 58
5.11.6. EApiSmartFanGetMode. . 59
5.11.7. EApiSmartFanSetTempSrc.. .. 60
5.11.8. EApiSmartFanGetTempSrc . .. 61

5.12 Backlight . ..62

5.12.1 EApiVgaSetBacklightEnable.. .. 62
5.12.2 EApiVgaGetBacklightEnable . . 63
5.12.3 EApiVgaSetBacklightBrightness .. .. 64
5.12.4 EApiVgaGetBacklightBrightness. .. 65

5.13. Exception Description.. .. 66

5.13.1. EApiBoardGetExcepDesc. .. 66

5.14. SMBus Slave Device Access .. .67

5.14.1. EApiSMBReadTrans.. .. 67
5.14.2. EApiSMBWriteTrans . .. 68

6. For Windows Platforms .. ..69

6.1 Initialization Functions . ..69

6.1.1 SemaEApiLibInitialize.. . 69
6.1.2 SemaEApiUnInitialize.. . 69

6.2 Board Information ... .. 70
6.2.1 SemaEApiBoardGetStringA. .. 70
6.3 Board Values.. ..72
6.3.1 SemaEApiBoardGetValue. . 72

6.4. Watchdog Control . .. 75

6.4.1. SemaEApiWDogGetCap ...... . 75
6.4.2. SemaEApiWDogStart. .. 76
6.4.3. SemaEApiWDogTrigger..... 77
6.4.4. SemaEApiWDogStop .. . 77
6.4.5. SemaEApiPwrUpWDogStart . .. 78
6.4.6. SemaEApiPwrUpWDogStop..... . 78

6.5. Storage Access .. .. 79

6.5.1. SemaEApiStorageCap.. 79
6.5.2. SemaEApiStorageAreaRead.. .. 80
6.5.3. SemaEApiStorageAreaWrite .. . 81
6.5.4. SemaEApiStorageHexRead .. . 82
6.5.5. SemaEApiStorageHexWrite.. .. 83
6.5.6. SemaEApiStorageUnlock.. . 84
6.5.7. SemaEApiStorageLock.. 85

6.6. Voltage Monitor .. .87

6.6.1. SemaEApiBoardGetVoltageMonitor .... .. 87

6.7. GPIO Control . .88

6.7.1. SemaEApiGPIOGetDirectionCaps... .. 88

6.7.2. SemaEApiGPIOGetDirection .. .. 89

6.7.3. SemaEApiGPIOSetDirection.... . 90

6.7.4. SemaEApiGPIOGetLevel . . 91

6.7.5. SemaEApiGPIOSetLevel.. . 92

6.8. Generic I2C Access.. .93

6.8.1. SemaEApiI2CGetBusCap.. .. 93

6.8.2. SemaEApiI2CGetBusSts . . 94

6.8.3. SemaEApiI2CProbeDevice.. .. 95

6.8.4. SemaEApiI2CReadTransfer... .. 96

6.8.5. SemaEApiI2CWriteTransfer ... . 97

6.8.6. SemaEApiI2CWriteReadRaw .... .. 98

6.9. Error Log Description.. .99

6.9.1. SemaEApiBoardGetErrorLog...... . 99

6.9.2. SemaEApiBoardGetCurErrorLog.. . 100

6.9.3. SemaEApiBoardGetErrorNumberDescription .. .. 102

6.10. BIOS Information .. .103

6.10.1. SemaEApiGetBIOSSource.. . 103

6.10.2. SemaEApiSetBIOSSource . .. 104

6.10.3. SemaEApiGetBiosSourceSts.. . 105

6.11. Fan Control .. .106

6.11.1. SemaEApiSmartFanSetTempSetpoints.. .. 107

6.11.2. SemaEApiSmartFanGetTempSetpoints . .. 108

6.11.3. SemaEApiSmartFanSetPWMSetpoints .... .. 109

6.11.4. SemaEApiSmartFanGetPWMSetpoints.... .. 110

6.11.5. SemaEApiSmartFanSetMode... . 111

6.11.6. SemaEApiSmartFanGetMode . .. 112

6.11.7. SemaEApiSmartFanSetTempSrc.. .. 113

6.11.8. SemaEApiSmartFanGetTempSrc .. . 114

6.12. Backlight . .115

6.12.1. SemaEApiVgaSetBacklightEnable .. .. 115
6.12.2. SemaEApiVgaGetBacklightEnable.. . 116
6.12.3. SemaEApiVgaSetBacklightBrightness.. . 117
6.12.4. SemaEApiVgaGetBacklightBrightness .. . 118

6.13 Exception Description . .119

6.13.1 SemaEApiBoardGetExcepDesc . .. 119

6.14. SMBus Slave Device Access .. .120

6.14.1. SemaEApiSMBReadTrans .. . 120

6.14.2. SemaEApiSMBWriteTrans . . 121

7. Data Interpretation ... ..122

7.1. Specification Version . .122
7.2. General Version . .122

8. Annexure.. ..123

8.1. Restart Event.. .123
8.2. Firmware Capability .. .124
8.3. Extended Firmware Capability.. .125
8.4. EC/BMC Flags . .125
8.5. Sample Code . .126

8.5.1. To retrieve Board name.. . 126
8.5.2. To demonstrate I2C read and write using transfer functions (Linux) ........ 127
8.5.3. To retrieve running time meter value... .. 128

9. Appendix.. .129

9.1. Temperature Conversion.. .129
9.2. Error Codes .. .129

10. FAQs & Troubleshooting. .130

# 1. Acronyms / Definitions

<table><tr><td>Abbreviation</td><td>Description</td></tr><tr><td>EC</td><td>Embedded Controller</td></tr><tr><td>ACPI</td><td>Advanced Configuration Power Interface – standard to implement power saving modes in PC-AT systems</td></tr><tr><td>EAPI</td><td>Embedded Application Programming Interface</td></tr><tr><td>SEMA</td><td>Smart Embedded Management Agent</td></tr><tr><td>BIOS</td><td>Basic Input Output System</td></tr><tr><td>Boot Counter</td><td>Boot Counter is incremented after a HW or SW reset or after a successful power-up. A lifetime system count of the number of times the EFI/BIOS's Post is completed. Post completion is defined as being just prior to processor control being passed to the first boot vector.</td></tr><tr><td>Carrier Board</td><td>An application specific circuit board that accepts a COM Express Module</td></tr><tr><td>COM Express</td><td>PICMG definition for Computer-On-Modules</td></tr><tr><td>EEPROM</td><td>Electrically Erasable Programmable Read-Only Memory</td></tr><tr><td>EFI</td><td>Extensible Firmware Interface</td></tr><tr><td>GPIO</td><td>General Purpose Input Output</td></tr><tr><td>GPI</td><td>General Purpose Input</td></tr><tr><td>GPO</td><td>General Purpose Output</td></tr><tr><td>I2C</td><td>Inter Integrated Circuit - 2 wire (clock and data) signalling scheme allowing communication between integrated circuits, primarily used to read and load register values.</td></tr><tr><td>LAN</td><td>Local Area Network</td></tr><tr><td>LVDS</td><td>Low Voltage Differential Signalling – widely used as a physical interface for TFT flat panels. LVDS can be used for many high-speed signalling applications. In this document, it refers only to TFT flat-panel applications.</td></tr><tr><td>OEM/ODM</td><td>Original Equipment/Design Manufacturer</td></tr><tr><td>OS</td><td>Operating System</td></tr><tr><td>PCI</td><td>Peripheral Component Interface</td></tr><tr><td>PCIE</td><td>PCI Express– next-generation high speed Serialized I/O bus</td></tr><tr><td>PNP</td><td>Plug and Play</td></tr><tr><td>Power-up Watchdog</td><td>Used to handle system reset or boot failures. The reset cycle is repeated until the system successfully boots and the application services the watchdog.</td></tr><tr><td>ROM</td><td>Read Only Memory – a legacy term – often the device referred to as a ROM can actually be written to, in a special mode. Such writable ROMs are sometimes called Flash ROMs. BIOS is stored in ROM or Flash ROM</td></tr><tr><td>RTC</td><td>Real Time Clock – battery backed circuit in PC-AT systems that keeps system time and date as well as certain system setup parameters</td></tr><tr><td>Run-time watchdog</td><td>Used to recover from operating system hangs, application software hangs, or other system malfunctions. When the runtime watchdog timer expires, the EC/BMC triggers a system reset and automatically stops the runtime watchdog.</td></tr><tr><td>Running Time Meter</td><td>A lifetime system counts of the number of whole minutes that the system reset has been inactive.</td></tr><tr><td>S0, S3, S4, S5</td><td>System states describing the power and activity levelS0 – Full power, all devices poweredS3 – Suspend to RAM system- Context stored in RAM; RAM is in standbyS4 – Suspend to Disk system- Context stored on diskS5 – Soft Off – Main power rail off, only standby rail present</td></tr><tr><td>SMBus</td><td>System Management Bus</td></tr><tr><td>SPI</td><td>Serial Peripheral Interface</td></tr><tr><td>VGA</td><td>Video Graphics Adapter</td></tr><tr><td>Watchdog</td><td>A hardware or software count-down timer that must be repeatedly reset or triggered at regular intervals by an operating program to prevent time-out. If the timer is not reset in time (meaning the operating program has stalled or has failed in some way), the timer times-out and alerts the system and/or operator of the failure.</td></tr><tr><td>Watchdog Trigger</td><td>The process or technique or resting the Watchdog counter, preventing a Watchdog timeout event.</td></tr><tr><td>WDT</td><td>Watchdog Timer</td></tr></table>

# 2. Overview

# 2.1. For Linux Platform

![The flowchart depicts a software stack divided into three vertical sections: **User Space**, **Kernel Space**, and **Board Controller**.\n\n**Blocks:**\n\n*   **User Space:**\n    *   'Your Program'\n    *   'ADLINK SEMA UTILITY (command line)'\n    *   'SEMA EAPI Library' (which contains a sub-block labeled 'User-Space Mutex Protection')\n*   **Kernel Space:**\n    *   'Sysfs/IOCTL interface for User Space'\n    *   A rounded box containing: 'Board Info Driver', 'WDT Driver', '..........' , 'I2C Driver', and a red bar labeled 'Kernel Space Mutex Protection'\n*   **Board Controller:**\n    *   'Unified SEMA' (labeled above the bottom section)\n    *   'EC Controller'\n    *   'Tiva BMC Controller'\n\n**Connections:**\n\n*   'Your Program' connects via a red double-headed arrow to 'SEMA EAPI Library'.\n*   'ADLINK SEMA UTILITY (command line)' connects via a red double-headed arrow to 'SEMA EAPI Library'.\n*   'SEMA EAPI Library' connects via a red double-headed arrow to 'Sysfs/IOCTL interface for User Space'.\n*   'Sysfs/IOCTL interface for User Space' connects via a red double-headed arrow to 'Unified SEMA'.](.sema-eapi-guide/08087a54a670cacbfc53ab735d245724fba1382f86a8178cda607d2d0589edb9.jpg)

# • User Space Layer:

User applications and the ADLINK SEMA utility access hardware services through the SEMA EAPI library. User-space mutex protection ensures safe multi-threaded access before requests are forwarded to the kernel.

# Kernel Space Layer:

Hardware drivers (Board Info, WDT, I²C, etc.) receive requests via the Sysfs/IOCTL interface. Kernel-level mutex protection synchronizes driver operations and prevents race conditions during hardware access.

# Board Controller Layer:

The Unified SEMA interface communicates with embedded controllers such as the EC and Tiva BMC. This layer executes low-level control and monitoring functions for reliable board management.

# 2.2. For Windows Platform

![The diagram depicts a three-layer system architecture labeled on the left side:\n\n**1. User mode**\n*   **Blocks:** Two white blocks on a red background labeled 'Your Program' and 'ADLINK SEMA UTILITY (command line)'.\n*   **Connections:** Vertical double-headed arrows point downward from both blocks to the 'SEMA EAPI Library'.\n\n**2. Middle Layer (Unlabeled section between modes)**\n*   **Block:** A dark grey block labeled 'SEMA EAPI Library'.\n*   **Connections:** A vertical double-headed arrow points downward from this block across a dashed line to the 'Kernel Mode' section.\n\n**3. Kernel Mode**\n*   **Blocks:** Enclosed in a rounded rectangle, there is a dark grey block labeled 'SEMA Driver' and a red block beneath it labeled 'Kernel Space Mutex Protection'.\n*   **Connections:** A vertical double-headed arrow points downward from the 'Kernel Space Mutex Protection' area across a dashed line to the 'Board Controller' section.\n\n**4. Board Controller**\n*   **Blocks:** A large red block labeled 'Unified SEMA' containing two smaller dark grey blocks: 'EC Controller' and 'Tiva BMC Controller'.](.sema-eapi-guide/cd2d4f91b1a546e58aa18d7b7206139b71d06dd4b7d52793fb809b2ed85f8aa3.jpg)

# User Mode:

User applications and the ADLINK SEMA command-line utility access hardware services through the SEMA EAPI Library. This layer provides a unified API interface for board management and monitoring operations.

# • Kernel Mode:

The SEMA Driver receives requests from user space and acts as the main communication bridge between applications and the hardware controllers. It handles command routing and low-level device coordination.

# Board Controller Layer:

The EC Controller and Tiva BMC Controller execute hardware control and monitoring functions through the Unified SEMA interface. This layer directly manages board-level sensors, power, and system features.

# 3. Type Definitions

\_IN

<table><tr><td>Parameter Type</td><td>Characteristics</td></tr><tr><td>Immediate value</td><td>Input value that must be specified and is essential.</td></tr><tr><td>Pointer</td><td>Valid pointer to an initialized buffer/variable.</td></tr></table>

\_\_OUT

<table><tr><td>Parameter Type</td><td>Characteristics</td></tr><tr><td>Pointer</td><td>Valid pointer to a destination buffer/variable.</td></tr></table>

\_\_INOPT

<table><tr><td>Parameter Type</td><td>Characteristics</td></tr><tr><td>Pointer</td><td>Valid pointer to an initialized buffer/variable or NULL pointer.Note: Refer to function specification for specifics.</td></tr></table>

\_\_OUTOPT

<table><tr><td>Parameter Type</td><td>Characteristics</td></tr><tr><td>Pointer</td><td>Valid pointer to a destination buffer/variable or NULL pointer.Note: Refer to function specification for specifics.</td></tr></table>

\_\_INOUT

<table><tr><td>Parameter Type</td><td>Characteristics</td></tr><tr><td>Pointer</td><td>Valid pointer to an initialized buffer/variable.Contents of buffer/variable updated before return.</td></tr></table>

# 4. Status Codes

Refer section 9.1 Error Codes for macros and their values.

<table><tr><td>Status Code</td><td>Description</td><td>Action</td></tr><tr><td>EAPI_STATUS_NOT_INITIALIZED</td><td>The EAPI library is not yet or unsuccessfully initialized</td><td>EApiLibInitialize needs to be called prior to the first access of any other EAPI function</td></tr><tr><td>EAPI_STATUS_INITIALIZED</td><td>The EAPI Library is successfully initialized</td><td>None</td></tr><tr><td>EAPI_STATUS_ALLOC_ERROR</td><td>Memory Allocation Error</td><td>Free memory and try again</td></tr><tr><td>EAPI_STATUS_INVALID_PARAMETER</td><td>One or more of the EAPI function call parameters are out of the defined range</td><td>Verify Function Parameters</td></tr><tr><td>EAPI_STATUS_INVALID_BLOCK_LENGTH</td><td>This means that the Block length is too long</td><td>Use relevant Capabilities information to correct select block lengths</td></tr><tr><td>EAPI_STATUS_INVALID_BLOCK_ALIGNMENT</td><td>The Block Alignment is incorrect.</td><td>Use Alignment Capabilities information to correctly align write access</td></tr><tr><td>EAPI_STATUS_INVALID_DIRECTION</td><td>The current Direction Argument attempts to set GPIOs to an unsupported direction I.E. Setting GPI to Output</td><td>Use pInputs and pOutputs to correctly select input and outputs</td></tr><tr><td>EAPI_STATUS_INVALID_BITMAP</td><td>The Bitmask Selects bits/GPIOs which are not supported for the current ID</td><td>Use pInputs and pOutputs to probe supported bits</td></tr><tr><td>EAPI_STATUS_INVALID_BITMAP</td><td>This function or ID is not supported at the actual hardware environment</td><td>None</td></tr><tr><td>EAPI_STATUS_NOT_FOUND</td><td>Selected device was not found.Eg: The I2C device address is not Acknowledged, device is not present or inactive</td><td>None</td></tr><tr><td>EAPI_STATUS_BUSY_COLLISION</td><td>The selected device or ID is busy or a data collision was detected.Eg:• The addressed I2C bus is busy or there is a bus collision.• The I2C bus is in use.• Either CLK or DAT are low.• Arbitration loss or bus Collision, data remains low when writing a 1</td><td>Retry</td></tr><tr><td>EAPI_STATUS_RUNNING</td><td>Watchdog timer already started.</td><td>Call EApiWDogStop, before retrying.</td></tr><tr><td>EAPI_STATUS_TIMEOUT</td><td>Function call timed out. Eg: I2C operation lasted too long.</td><td>Retry</td></tr><tr><td>EAPI_STATUS_READ_ERROR</td><td>An error was detected during a read operation. Eg: I2C Read function was not successful</td><td>Retry</td></tr><tr><td>EAPI_STATUS_WRITE_ERROR</td><td>An error was detected during a write operation.Eg:• I2C Write function was not successful.• No Acknowledge was received after writing any byte after the first address byte.• Can be caused by unsupported device command/index.• 10Bit Address Device Not Present• Storage Write Error</td><td>Retry</td></tr><tr><td>EAPI_STATUS_MORE_DATA</td><td>The amount of available data exceeds the buffer size.Storage buffer overflow was prevented. Read count was larger than the defined buffer length.</td><td>Either increase the buffer size or reduce the block length</td></tr><tr><td>EAPI_STATUS_ERROR</td><td>Generic error message. No further error details are available.</td><td>None</td></tr><tr><td>EAPI_STATUS_SUCCESS</td><td>The operation was successful. The value for this status code is defined as 0.</td><td>None</td></tr></table>

# 5. For Linux Platforms

# 5.1 Initialization Functions

The Initialization functions prepare the underlying communication layer, allocate required resources, and establish access to the board controller (EC/BMC).

# 5.1.1 EApiLibInitialize

Function Definition
```txt
uint32_t
EAPI_CALLTYPE
EApiLibInitialize(void);
```

# Description

General initialization of the EAPI. Prior to calling any EAPI function, the library needs to be initialized by calling this function.

# Parameters

None.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Initialization Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Initialization Failure</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr></table>

# 5.1.2 EApiLibUnInitialize

Function Definition
```txt
uint32_t
EAPI CALLTYPE
EApiLibUnInitialize(void);
```

# Description

General function to uninitialize the EAPI library. Should be called before program exit.

# Parameters

None.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.2 Board Information Functions

SEMA EAPI functions provide an interface to control or get board’s information, including

• Static board and manufacturer information (e.g. BIOS version, Manufacturer name)
Failure forensics (e.g. restart event)

# 5.2.1 EApiBoardGetStringA

Function definition
```txt
uint32_t
EAPI CALLTYPE
EApiBoardGetStringA(
    __IN uint32_t Id,    /* Name Id */
    __OUT char *pBuffer,    /* Destination pBuffer */
    __INOUT uint32_t *pBufLen    /* pBuffer Length */
);
```

# Description

Text information about the system and manufacturer details for diagnostic and inventory purposes.

# Parameters

Id

IN Selects the EAPI Id corresponding to the data. All the data retrieved is in string format.

<table><tr><td>Id</td><td>Description</td></tr><tr><td>EAPI_ID_BOARD_MANUFACTURER_STR</td><td>Board Manufacturer Name</td></tr><tr><td>EAPI_ID_BOARD_NAME_STR</td><td>Board Name</td></tr><tr><td>EAPI_ID_BOARD_SERIAL_STR</td><td>Board Serial Number</td></tr><tr><td>EAPI_ID_BOARD_BIOS_REVISION_STR</td><td>Board BIOS Revision</td></tr><tr><td>EAPI_ID_BOARD_HW_REVISION_STR</td><td>Hardware Revision</td></tr><tr><td>EAPI_ID_BOARD_PLATFORM_TYPE_STR</td><td>Board Platform Type</td></tr><tr><td>EAPI_SEMA_ID_BOARD_BOOT_VERSION_STR</td><td>Bootloader Revision (Only for BMC boards)</td></tr><tr><td>EAPI_SEMA_ID_BOARD_APPLICATION_VERSION_STR</td><td>Firmware Revision</td></tr><tr><td>EAPI_SEMA_ID_BOARD_RESTART_EVENT_STR</td><td>Board Restart Event</td></tr><tr><td>EAPI_SEMA_ID_BOARD_REPAIR_DATE_STR</td><td>Board Repair Date</td></tr><tr><td>EAPI_SEMA_ID_BOARD_MANUFACTURE_DATE_STR</td><td>Board Manufacturing Date</td></tr><tr><td>EAPI_SEMA_ID_BOARD_MAC_1_STRING</td><td>Board MAC Address 1</td></tr><tr><td>EAPI_SEMA_ID_BOARD_MAC_2_STRING</td><td>Board MAC Address 2</td></tr><tr><td>EAPI_SEMA_ID_BOARD_2ND_HW_REVISION_STR</td><td>Board Secondary Hardware Revision</td></tr><tr><td>EAPI_SEMA_ID_BOARD_2ND_SERIAL_STR</td><td>Board Secondary Serial Number</td></tr></table>

# \*pBuffer

OUT Pointer to a buffer that receives the value's data. This parameter can be NULL if the data is not required

# \*pBufLen

\_INOUT Pointer to a variable that specifies the size, in bytes, of the buffer pointed to by the pBuffer parameter. When the function returns, this variable contains the size of the data copied to pBuffer including the terminating null character.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>pBufLen==NULL or pData==NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Unsupported EAPI Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Failed</td><td>EAPI_STATUS_READ_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.3 Board Values

• Allows access to board-specific parameters such as temperature limits, thresholds, or configuration values.
• These values are typically used for monitoring, diagnostics, and system control logic.

# 5.3.1 EApiBoardGetValue

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiBoardGetValue(
    __IN uint32_t Id    , /* Value Id */
    __OUT uint32_t *pValue    /* Return Value */
);
```

# Description

Information about the hardware platform in value format

# Parameters

Id

IN Selects the Get Value Sub Function Id

<table><tr><td>Id</td><td>Description</td><td>Units/Format</td></tr><tr><td>EAPI_ID_GET_EAPI_SPEC_VERSION</td><td>EAPI Specification Version used to implement API</td><td>Refer Specification Version Number Format</td></tr><tr><td>EAPI_ID_BOARD_BOOT_COUNTER_VAL</td><td>Boot Counter</td><td>boots</td></tr><tr><td>EAPI_ID_BOARD_RUNNING_TIME_METER_VAL</td><td>Running Time Meter</td><td>minutes</td></tr><tr><td>EAPI_ID_BOARD_LIB_VERSION_VAL</td><td>Vendor Specific Library Version</td><td>Refer General Version number Format</td></tr><tr><td>EAPI_ID_HWMON_CPU_TEMP</td><td>CPU Temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_ID_HWMON_BOARD_TEMP</td><td>Board Temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_ID_HWMON_VOLTAGE_VCORE</td><td>CPU Core Voltage</td><td>millivolts</td></tr><tr><td>EAPI_ID_HWMON_VOLTAGE_2V5</td><td>2.5V Voltage</td><td>millivolts</td></tr><tr><td>EAPI_ID_HWMON_VOLTAGE_3V3</td><td>3.3V Voltage</td><td>millivolts</td></tr><tr><td>EAPI_ID_HWMON_VOLTAGE_VBAT</td><td>Battery Voltage</td><td>millivolts</td></tr><tr><td>EAPI_ID_HWMON_VOLTAGE_5V</td><td>5V Voltage</td><td>millivolts</td></tr><tr><td>EAPI_ID_HWMON_VOLTAGE_5VSB</td><td>5V Standby Voltage</td><td>millivolts</td></tr><tr><td>EAPI_ID_HWMON_VOLTAGE_12V</td><td>12V Voltage</td><td>millivolts</td></tr><tr><td>EAPI_ID_HWMON_FAN_CPU</td><td>CPU Fan speed</td><td>RPM</td></tr><tr><td>EAPI_ID_HWMON_FAN_SYSTEM</td><td>System Fan speed</td><td>RPM</td></tr><tr><td>EAPI_SEMA_ID_BOARD_POWER_UP_TIME</td><td>Get the operating time after power up</td><td>seconds</td></tr><tr><td>EAPI_SEMA_ID_BOARD_RESTART_EVENT</td><td>Get the restart event</td><td>Refer Restart Event</td></tr><tr><td>EAPI_SEMA_ID_BOARD_CAPABILITIES</td><td>Get the capabilities of this board or system</td><td>Refer Firmware Capability</td></tr><tr><td>EAPI_SEMA_ID_BOARD_CAPABILITIES_EX</td><td>Get the extended EC capabilities</td><td>Refer Extended Firmware Capability</td></tr><tr><td>EAPI_SEMA_ID_BOARD_MIN_TEMP</td><td>Board minimum temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_MAX_TEMP</td><td>Board maximum temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_STARTUP_TEMP</td><td>Board startup temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_CPU_MIN_TEMP</td><td>CPU minimum temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_CPU_MAX_TEMP</td><td>CPU maximum temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_CPU_STARTUP_TEMP</td><td>CPU startup temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_MAIN_CURRENT</td><td>Get main power current</td><td>Unit: mA, Resolution=1/10 mA</td></tr><tr><td>EAPI_SEMA_ID_HWMON_VOLTAGE_GFX_VCORE</td><td>GFX voltage</td><td>millivolts</td></tr><tr><td>EAPI_SEMA_ID_HWMON_VOLTAGE_1V05</td><td>1.05V voltage</td><td>millivolts</td></tr><tr><td>EAPI_SEMA_ID_HWMON_VOLTAGE_1V5</td><td>1.5V voltage</td><td>millivolts</td></tr><tr><td>EAPI_SEMA_ID_HWMON_VOLTAGE_VIN</td><td>Vin voltage</td><td>millivolts</td></tr><tr><td>EAPI_SEMA_ID_HWMON_FAN_SYSTEM_2</td><td> $2^{nd}$  system fan</td><td>RPM</td></tr><tr><td>EAPI_SEMA_ID_HWMON_FAN_SYSTEM_3</td><td> $3^{rd}$  system fan</td><td>RPM</td></tr><tr><td>EAPI_SEMA_ID_BOARD_2ND_SYSTEM_TEMP</td><td> $2^{nd}$  Board temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_2ND_SYSTEM_MIN_TEMP</td><td> $2^{nd}$  Board minimum temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_2ND_SYSTEM_MAX_TEMP</td><td> $2^{nd}$  Board maximum temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_2ND_SYSTEM_STARTUP_TEMP</td><td> $2^{nd}$  Board startup temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_POWER_CYCLE</td><td>Power cycle counter</td><td>cycles</td></tr><tr><td>EAPI_SEMA_ID_BOARD_BMC_FLAG</td><td>Status of the EC</td><td>Refer EC/BMC Flags</td></tr><tr><td>EAPI_SEMA_ID_BOARD_BMC_STATUS</td><td>Status of the EC (not supported for EC boards)</td><td>Information for problem analysis</td></tr><tr><td>EAPI_SEMA_ID_IO_CURRENT</td><td>IO current</td><td>mA</td></tr><tr><td>EAPI_SEMA_ID_HWMON_SYSTEM_TEMP</td><td>System Temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_HWMON_SYSTEM_MIN_TEMP</td><td>System minimum temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_HWMON_SYSTEM_MAX_TEMP</td><td>System maximum temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_HWMON_SYSTEM_STARTUP_TEMP</td><td>System startup temperature</td><td>0.1 Kelvins</td></tr></table>

# \*pValue

OUT Pointer to a buffer that receives the value.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>pValue==NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Hardware monitor device handle access failed</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Unsupported EAPI Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Failed</td><td>EAPI_STATUS_READ_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.4 Watchdog Control

The Runtime Watchdog is used to recover from operating system hangs, application software hangs, or other system malfunctions. When the runtime watchdog timer expires, the EC/BMC triggers a system reset and automatically stops the runtime watchdog.

The Powerup Watchdog is used to handle system reset or boot failures. The reset cycle is repeated until the system successfully boots and the application services the watchdog.

# 5.4.1 EApiWDogGetCap

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiWDogGetCap (
__OUTOPT uint32_t *pMaxDelay, /* Max. supported delay in sec */
__OUTOPT uint32_t *pMaxEventTimeout, /* Max. supported Event Timeout in sec */
__OUTOPT uint32_t *pMaxResetTimeout /* Max. supported Reset Timeout in sec */
);
```

# Description

Get the supported maximum delay, event timeout and reset value of the Runtime Watchdog timer.

# Parameters

# \*pMaxDelay

\_OUTOPT Pointer to a buffer that receives maximum supported initial delay time of the watchdog timer in seconds.

# \*pMaxEventTimeout

\_OUTOPT Pointer to a buffer that receives maximum supported event timeout of the watchdog timer in seconds.

# \*pMaxResetTimeout

\_OUTOPT Pointer to a buffer that receives maximum supported reset timeout of the watchdog timer in seconds.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>pMaxDelay==NULL &amp;&amp; pMaxEventTimeout==NULL &amp;&amp; pMaxResetTimeout==NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Read capabilities fail</td><td>EAPI_STATUS_READ_ERROR</td></tr></table>

# 5.4.2 EApiWDogStart

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiWDogStart (
    __IN uint32_t Delay,    /* Delay in sec */
    __IN uint32_t EventTimeout,    /* Event Timeout in sec */
    __IN uint32_t ResetTimeout    /* Reset Timeout in sec */
);
```

# Description

Start the runtime watchdog timer and set the parameters.

# Parameters

# delay

\_\_IN Initial delay for the watchdog timer in seconds. (currently not supported by SEMA EAPI, set it as 0)

# EventTimeout

\_\_IN Watchdog timeout interval in seconds to trigger an event. (currently not supported by SEMA EAPI, set it as 0)

# ResetTimeout

\_\_IN Watchdog timeout interval in seconds to trigger a reset. (Supported range 1-65535 seconds)

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>ResetTimeout not within the supported range</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Watchdog device handle access fail</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Watchdog timer already active/running</td><td>EAPI_STATUS_RUNNING</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Watchdog start timer failed</td><td>EAPI_STATUS_WRITE_ERROR</td></tr></table>

# 5.4.3 EApiWDogTrigger

# Function definition

```txt
uint32_t
EAPI_CALLTYPE
EApiWDogTrigger(void);
```

# Description

Trigger the Runtime watchdog timer to previously set timeout value.

# Parameter

None.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Watchdog device handle access fail</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Watchdog timer not active/running</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Watchdog trigger failed</td><td>EAPI_STATUS_WRITE_ERROR</td></tr></table>

# 5.4.4 EApiWDogStop

# Function definition

```txt
uint32_t
EAPI_CALLTYPE
EApiWDogStop(void);
```

# Description

Stops the operation of the runtime watchdog timer.

# Parameter

None.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Watchdog device handle access fail</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Watchdog stop failed</td><td>EAPI_STATUS_WRITE_ERROR</td></tr></table>

# 5.4.5 EApiPwrUpWDogStart

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiPwrUpWDogStart (
    __IN uint32_t Timeout /* Timeout in sec */
);
```

# Description

Start the Powerup watchdog timer and set the parameters.

# Parameter

# ResetTime

\_\_IN Powerup watchdog timeout interval in seconds to trigger a reset. (Supported Range 60-65535).

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Timeout not within the supported range</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Watchdog device handle access fail</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Powerup watchdog start failure</td><td>EAPI_STATUS_WRITE_ERROR</td></tr></table>

# 5.4.6 EApiPwrUpWDogStop

Function definition
```txt
uint32_t
EAPI_CALLTYPE
EApiPwrUpWDogStop(void);
```

# Description

Stops the operation of the powerup watchdog timer

# Parameter

None

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Watchdog device handle access fail</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Powerup watchdog stop failure</td><td>EAPI_STATUS_WRITE_ERROR</td></tr></table>

# 5.5 Storage Access

Provides read and write access to non-volatile storage such as on-board EEPROM storage

(Eg: EEPROM type: Microchip AT25256B) connected to the EC/BMC.

Storage Id

<table><tr><td>Id</td><td>Description</td></tr><tr><td>EAPI_ID_STORAGE_STD</td><td>User Region</td></tr><tr><td>EAPI_ID_STORAGE_SCR</td><td>Secure Region (Unsupported for BMC boards)</td></tr><tr><td>EAPI_ID_STORAGE_ODM</td><td>ODM Region (Unsupported for BMC boards)</td></tr></table>

<table><tr><td>Region</td><td>Address range</td><td>Base address</td><td>Valid Address to Read/Write</td><td>Block size</td></tr><tr><td>1-User</td><td>0x0000 to 0x03FF (1KB)</td><td>0x0000</td><td>0 to 1020</td><td>4</td></tr><tr><td>2-Secure</td><td>0x6000 to 0x67FF (2KB)</td><td>0x6000</td><td>0 to 2044</td><td>4</td></tr><tr><td>3-ODM</td><td>0x0C00 to 0x0FFF (1KB)</td><td>0x0C00</td><td>0 to 1020</td><td>4</td></tr></table>

# 5.5.1 EApiStorageCap

Function definition
```txt
uint32_t
EAPI_CALLTYPE
EApiStorageCap (
    _IN uint32_t Id, /* Storage Area Id*/
    _OUT uint32_t *pStorageSize, /* Max. Storage Size */
    _OUT uint32_t *pBlockLength /* Max. block length */
);
```

# Description

Get the maximum storage size and block length of the selected storage area.

# Parameters

Id

\_\_IN Refer Storage Id.

\*pStorageSize

\_\_OUT Pointer to a buffer that receives storage area size.

\*pBlockLength

\_\_OUT Pointer to a buffer that receives the storage area alignment/block size.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Unsupported Storage Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>pStorageSize == NULL &amp;&amp; pBlockLength == NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Sysfs file Read Error</td><td>EAPI_STATUS_READ_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.5.2 EApiStorageAreaRead

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiStorageAreaRead(
    _IN uint32_t Id,    /* Storage Area Id*/
    _IN uint32_t Offset,    /* Byte Offset */
    _OUT void *pBuffer, /* Pointer to Data pBuffer */
    _IN uint32_t BufLen,    /* Data pBuffer Size in bytes */
    _IN uint32_t ByteCnt    /* Number of bytes to read*/
```

# Description

Reads string data from the selected storage area.

# Parameters

Id

\_\_IN Refer Storage Id.

# Offset

\_\_IN Storage area start address offset in bytes.

# \*pBuffer

\_\_OUT Pointer to a buffer that receives the read data.

# BufLen

\_\_IN Size, in bytes, of the buffer pointed to by the pBuffer parameter.

# ByteCnt

\_\_IN Size, in bytes, of the information read to the buffer pointed to by the pBuffer parameter.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Unsupported Storage Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Storage access library not initialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>pBuffer == NULL || ByteCnt == 0 || BufLen == 0</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>ByteCnt &gt; BufLen</td><td>EAPI_STATUS_MORE_DATA</td></tr><tr><td>Offset + ByteCnt &gt; StorageSize</td><td>EAPI_STATUS_INVALID_BLOCK_LENGTH</td></tr><tr><td>Storage area device handle access failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Storage area data read failed</td><td>EAPI_STATUS_READ_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.5.3 EApiStorageAreaWrite

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiStorageAreaWrite (
    _IN uint32_t Id,    /* Storage Area Id*/
    _IN uint32_t Offset,    /* Byte Offset */
    _IN void *pBuffer,    /* Pointer to Data pBuffer */
    _IN uint32_t ByteCnt    /* Data pBuffer Size in bytes */
);
```

# Description

Writes string data to the selected storage area.

# Parameters

Id

\_\_IN Refer Storage Id.

Offset

\_\_IN Storage area start address offset in bytes.

\*pBuffer

\_\_IN Pointer to a buffer containing the data to be stored.

ByteCnt

\_\_IN Size, in bytes, of the information pointed to by the pBuffer parameter.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Unsupported Storage Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Storage access library not initialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>ByteCnt == 0 || pBuffer == NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Offset + ByteCnt &gt; StorageSize</td><td>EAPI_STATUS_INVALID_BLOCK_LENGTH</td></tr><tr><td>(Offset % pBlockLength) != 0</td><td>EAPI_STATUS_INVALID_BLOCK_ALIGNMENT</td></tr><tr><td>Storage area device handle access failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Storage area data write failed</td><td>EAPI_STATUS_WRITE_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.5.4 EApiStorageHexRead

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiStorageHexRead(
    __IN uint32_t Id, /* Storage Area Id */
    __IN uint32_t Offset, /* Byte Offset */
    __OUT void *pBuffer, /* Pointer to Data pBuffer */
    __IN uint32_t BufLen, /* Data buffer size in bytes*/
    __IN uint32_t Bytecnt, /*Number of bytes to count */
);
```

# Description

Reads data in hexadecimal from the selected storage area.

# Parameters

Id

\_\_IN Refer Storage Id.

Offset

\_\_IN Storage area start address offset in bytes.

\*pBuffer

\_\_OUT Pointer to a buffer that receives the read data in hexadecimal.

BufLen

\_\_IN Size, in bytes, of the buffer pointed to by the pBuffer parameter.

Bytecnt

\_\_IN Size, in bytes, of the information read to the buffer pointed to by the pBuffer.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Unsupported Storage Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Storage access library not initialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>pBuffer == NULL || ByteCnt == 0 || BufLen == 0</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>ByteCnt &gt; BufLen</td><td>EAPI_STATUS_MORE_DATA</td></tr><tr><td>Offset + ByteCnt &gt; StorageSize</td><td>EAPI_STATUS_INVALID_BLOCK_LENGTH</td></tr><tr><td>Storage area device handle access failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Storage area data read failed</td><td>EAPI_STATUS_READ_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.5.5 EApiStorageHexWrite

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiStorageHexWrite(
    __IN uint32_t Id, /* Storage Area Id */
    __IN uint32_t Offset, /* Byte Offset */
    __IN void *pBuffer, /* Pointer to Data pBuffer */
    __IN uint32_t ByteCnt /* Data buffer size in bytes*/
);
```

# Description

Writes data in hexadecimal to the selected storage area.

# Parameters

Id

\_\_IN Refer Storage Id.

Offset

\_\_IN Storage area start address offset in bytes.

\*pBuffer

\_\_OUT Pointer to a buffer that receives the read data in hexadecimal.

BufLen

\_\_IN Size, in bytes, of the buffer pointed to by the pBuffer parameter.

ByteCnt

\_\_IN Size, in bytes, of the information pointed to by the pBuffer.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Unsupported Storage Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Storage access library not initialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>ByteCnt == 0 || pBuffer == NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Offset + ByteCnt &gt; StorageSize</td><td>EAPI_STATUS_INVALID_BLOCK_LENGTH</td></tr><tr><td>(Offset % pBlockLength) != 0</td><td>EAPI_STATUS_INVALID_BLOCK_ALIGNMENT</td></tr><tr><td>Storage area device handle access failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Storage area data write failed</td><td>EAPI_STATUS_WRITE_ERROR</td></tr></table>

# 5.5.6 EApiStorageUnLock

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiStorageUnLock(
    __IN uint32_t Id, /* Storage Area Id */
    __IN uint32_t Permission, /* Storage Area Permission */
    __IN char *passcode /* Storage Area Passcode */
);
```

# Description

Unlock the Secure or ODM storage region to access data.

# Parameters

Id

\_\_\_IN Only Secure or ODM regions. Refer Storage Id.

# Permission

\_\_IN Supports 2 permissions.

<table><tr><td>Id</td><td>Description</td></tr><tr><td>1</td><td>Read only</td></tr><tr><td>2</td><td>Read / Write</td></tr></table>

# \*passcode

\_\_IN Pointer to a buffer containing passcode to unlock the selected region.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library Uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Invalid Storage Id</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Unsupported functionality</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Failed</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 5.5.7 EApiStorageLock

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiStorageLock(
    __IN uint32_t Id    /* Storage Area Id */
);
```

# Description

To lock the Secure or ODM storage region.

# Parameters

Id

\_\_IN Only Secure or ODM Storage Id. Refer Storage Id.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library Uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Invalid Storage Id</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Unsupported functionality</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Failed</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 5.5.8 EApiGUIDWrite

Function definition
```txt
uint32_t
EAPI_CALLTYPE
EApiGUIDWrite(
    __IN uint32_t Id,    /* Storage Area Id */
    __IN uint32_t Offset,    /* Byte Offset */
    __IN void *pBuffer,    /* Pointer to Data pBuffer */
    __IN uint32_t ByteCnt    /* Data buffer size in bytes*/
);
```

# Description

Writes type 4 - UUID in hexadecimal to the selected storage area. The GUID can be read using EApiStorageHexRead.

# Parameters

Id

\_\_IN Only ODM Storage Id. Refer Storage Id.

Offset

\_\_IN Offset 0x100 of ODM region is used for storing GUID.

\*pBuffer

\_\_IN Pointer to a buffer array of 16 elements containing the GUID [in hexadecimal] to be stored.

ByteCnt

\_\_IN Size, in bytes, of the information pointed to by the pBuffer. [ByteCnt=16]

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Unsupported Storage Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Storage access library not initialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Offset + ByteCnt &gt; StorageSize</td><td>EAPI_STATUS_INVALID_BLOCK_LENGTH</td></tr><tr><td>Storage area device handle access failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Failed</td><td>EAPI_STATUS_WRITE_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.6 Voltage Monitor

• Allows monitoring of system and component voltage levels in real time.
• Helps detect power irregularities and ensures operation within safe voltage ranges.

# 5.6.1 EApiBoardGetVoltageCap

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiBoardGetVoltageCap(
    __OUTOPT uint32_t *value,    /* buffer */
);
```

# Description

To display the capabilities of voltage monitor.

# Parameters

\*value

\_\_OUTOPT Pointer to buffer that receives the voltage capability value.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Voltage cap read failed</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 5.6.2 EApiBoardGetVoltageMonitor

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiBoardGetVoltageMonitor(
    __IN uint32_t id, /* Channel Id */
    __OUT uint32_t *mVolts, /* Value buffer */
    __OUT char *pBuf /* Description Buffer */
    __OUT uint32_t size /* size of buffer */
);
```

# Description

To get the voltage values and its description.

# Parameters

channel

\_\_IN Select the channel ID [channel range 0 -15].

\*mVolts

\_\_OUT Pointer to buffer that receives the voltage value.

\*pBuf

\_\_OUT Pointer to buffer that receives the voltage description string.

size

\_\_IN Size of pBuf in bytes.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Invalid buffers</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Unsupported voltage channel Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Voltage read failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.7 GPIO

SEMA helps control general purpose I/O pins connected to the board controller (EC/BMC).

# 5.7.1 EApiGPIOGetDirectionCaps

Function definition
```txt
uint32_t
EAPI_CALLTYPE
EApiGPIOGetDirectionCaps(
    __IN uint32_t Id,    /* GPIO Id*/
    __OUTOPT uint32_t *pInputs,    /* Supported GPIO Output Bit Mask */
    __OUTOPT uint32_t *pOutputs    /* Supported GPIO Output Bit Mask */
);
```

# Description

Reads the capabilities of the current GPIO implementation from the selected GPIO interface. The ports where both input and output bit masks are 1 are GPIOs.

# Parameters

Id

\_\_IN GPIO Id (currently Id= 0 only is supported by SEMA EAPI).

\*pInputs

\_\_OUTOPT Pointer to a buffer that receives the bit mask of the supported inputs.

\*pOutputs

\_\_OUTOPT Pointer to a buffer that receives the bit mask of the supported outputs.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Unsupported GPIO Functionality / Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Bitmask==NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.7.2 EApiGPIOGetDirection

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiGPIOGetDirection(
    __IN uint32_t Id, /* GPIO Id*/
    __IN uint32_t Bitmask, /* Bitmask of affected bits */
    __OUT uint32_t *pDirection /* Current Direction */
);
```

# Description

Reads the current configuration of the selected GPIO pins.

# Parameters

Id

\_\_IN GPIO Id. (currently Id= 0 only is supported by SEMA EAPI).

# Bitmask

\_\_IN Bitmask Only selected bits are returned. Unselected bits return 0.

# \*pDirection

\_OUT Pointer to a buffer that receives the direction of the supported GPIO ports. Bits with the value 1 are inputs, bits with 0 are outputs.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>GPIO library not initialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported GPIO Functionality / Bitmask</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Bitmask==NULL / pDirection==NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.7.3 EApiGPIOSetDirection

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiGPIOSetDirection(
    __IN uint32_t Id, /* GPIO Id*/
    __IN uint32_t Bitmask, /* Bitmask of affected bits */
    __IN uint32_t Direction /* Direction */
);
```

# Description

Sets the configuration of the selected GPIO pins.

# Parameters

Id

\_\_IN GPIO Id (currently Id= 0 only is supported by SEMA EAPI).

# Bitmask

\_IN Bitmask. The bits for which the direction is to be changed are set to 1 and other bits are set to 0.

# Direction

\_\_IN Sets the direction of the selected GPIO ports. Bits with the value 1 are inputs, bits with 0 are outputs.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>GPIO library not initialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported GPIO Functionality</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Bitmask==NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>GPIO device handle access failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>GPIO direction write failed</td><td>EAPI_STATUS_WRITE_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.7.4 EApiGPIOGetLevel

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiGPIOGetLevel(
    __IN uint32_t Id, /* GPIO Id*/
    __IN uint32_t Bitmask, /* Bitmask of affected bits*/
    __OUT uint32_t *pLevel /* Current Level */
);
```

# Description

Reads level from the GPIO pins.

# Parameters

Id

\_\_IN GPIO Id (currently Id= 0 only is supported by SEMA EAPI).

# Bitmask

\_\_IN Bitmask. Only selected bits are returned. Unselected bits return 0.

# \*pLevel

\_OUT Pointer to a buffer that receives the GPIO level. Results can be read on a bit level. Bits with the value 1 are high, bits with 0 are low.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>GPIO library not initialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported GPIO Functionality</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Bitmask==NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.7.5 EApiGPIOSetLevel

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiGPIOSetLevel(
    __IN uint32_t Id, /* GPIO Id*/
    __IN uint32_t Bitmask, /* Bitmask of affected bits */
    __OUT uint32_t Level /* Current Level */
);
```

# Description

Write to GPIO ports. Only level of the GPO pin can be changed.

# Parameters

Id

\_\_IN GPIO Id (currently Id= 0 only is supported by SEMA EAPI).

# Bitmask

\_\_IN Value for a bit mask. Only selected bits are changed. Unselected bits remain unchanged.

Level

\_IN Input level of the selected GPIO port. Output for single ports is on a bit level. Bits with the value 1 are high, bits with 0 are low.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>GPIO library not initialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported GPIO Functionality</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Bitmask==NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>GPIO device handle access failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Failed</td><td>EAPI_STATUS_WRITE_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.8. Generic I2C Access

Supported only for EC boards. The SEMA I2C functions Provides low-level I2C read and write access to devices connected on the I2C bus.

I2C Bus Id

<table><tr><td>Id</td><td>Description</td></tr><tr><td>SEMA_EXT_IIC_BUS_1</td><td>Extended I2C bus 1</td></tr><tr><td>SEMA_EXT_IIC_BUS_2</td><td>Extended I2C bus 2</td></tr><tr><td>SEMA_EXT_IIC_BUS_3</td><td>Extended I2C bus 3</td></tr><tr><td>SEMA_EXT_IIC_BUS_4</td><td>Extended I2C bus 4</td></tr></table>

I2C Cmd Type

<table><tr><td>CmdType</td><td>Description</td><td>Encoding Condition</td></tr><tr><td>EAPI_I2C_NO_CMD</td><td>No command/index</td><td>Bit 30 of Cmd must be 1</td></tr><tr><td>EAPI_I2C_ENC_STD_CMD</td><td>Extended standard 8 bits CMD</td><td>Original 32 bit Cmd</td></tr><tr><td>EAPI_I2C_ENC_EXT_CMD</td><td>Extended standard 10 bits CMD</td><td>Bit 31 of Cmd must be 1</td></tr></table>

# 5.8.1 EApiI2CGetBusCap

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiI2CGetBusCap(
    __IN uint32_t Id, /* I2C Bus Id*/
    __OUT uint32_t *pMaxBlkLen /* I2C Bus Status */
);
```

# Description

Returns maximum block length if the selected I2C bus is supported.

# Parameters

Id

\_\_IN Refer I2C Bus Id.

# pMaxBlkLen

\_OUT size in bytes. Pointer to a buffer that receives the maximum transfer block length for the given interface.

Note: Maximum length of data byte to write is 29 bytes and to read is 32 bytes.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>pMaxBlkLen == NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Unsupported I2C functionality / I2C bus Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Failed</td><td>EAPI_STATUS_READ_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.8.2 EApiI2CGetBusSts

Function definition
```txt
uint32_t
EAPI_CALLTYPE
EApiI2CGetBusSts(
    __IN uint32_t Id    , /* I2C Bus Id*/
    __OUT uint8_t *Bus_Sts    /* I2C Bus Status */
);
```

# Description

Reflects the I2C status of the most recently used I2C transaction

# Parameters

Id

\_\_IN Refer I2C Bus Id.

\*Bus\_Sts

\_\_OUT Pointer to a buffer that receives the data.

<table><tr><td>Id</td><td>Bit 7</td></tr><tr><td>Transaction cannot complete normallyEg:- The device does not respond ACK- Pull down in the bus- Any other error</td><td>0</td></tr><tr><td>Transaction complete normallyEg:- Transfer complete- The device respond ACK</td><td>1</td></tr></table>

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Bus_sts==NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Unsupported I2C functionality / I2C bus Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.8.3 EApiI2CProbeDevice

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiI2CProbeDevice(
    __IN uint32_t Id,    /* I2C Bus Id*/
    __IN uint32_t Addr    /* 8-bit I2C Device Address */
);
```

# Description

Returns EAPI\_STATUS\_SUCCESS if the device with selected I2C address is present on the specified I2C bus.

# Parameters

Id

\_\_IN Refer I2C Bus Id.

Addr

IN 8-bit I2C slave device address.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Unsupported I2C functionality / I2C bus Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Failed</td><td>EAPI_STATUS_READ_ERROR</td></tr></table>

# 5.8.4 EApiI2CReadTransfer

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiI2CReadTransfer(
    IN uint32_t Id, /* I2C Bus Id*/
    IN uint32_t Addr, /* 8-Bit I2C Device Address */
    IN uint32_t Cmd, /* No of Bytes to write*/
    OUT void *pBuffer, /* Read Data pBuffer */
    IN uint32_t BufLen, /* Data pBuffer Length */
    IN uint32_t ByteCnt, /* Number of Bytes to Read */
);
```

# Description

Reads a specific register in the selected I2C device.

# Parameters

Id

\_\_IN Refer I2C Bus Id.

Addr

\_\_IN 8-bit I2C device address.

Cmd

\_\_IN Encoded I2C device command / index. Refer I2C Cmd Type for command encoding.

\*pBuffer

OUT Pointer to a buffer that receives the read data.

BufLen

\_\_IN Size (in bytes), of the information pointed to by the pBuffer parameter.

ByteCnt

\_\_IN Size (in bytes), of the information read to the buffer pointed by the pBuffer parameter.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Unsupported I2C functionality / I2C bus Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>I2C device handle access failed</td><td>EAPI_STATUS_READ_ERROR</td></tr><tr><td>pBuffer == NULL || ByteCnt == 0 || BufLen == 0 || ByteCnt &gt; MAX_BLOCK || ByteCnt &gt; BufLen</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 5.8.5 EApiI2CWriteTransfer

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiI2CWriteTransfer(
    __IN uint32_t Id,    /* I2C Bus Id*/
    __IN uint32_t Addr,    /* 8 Bit I2C Device Address */
    __IN unit32_t Cmd,    /* I2C Command/Offset */
    __IN void    *pBuffer,    /* Data pBuffer */
    __IN uint32_t ByteCnt    /* Byte Count to write */
);
```

# Description

Write to a specific register in the selected I2C device.

Writes to an I2C device at the I2C address (Addr) the number of bytes (ByteCnt) from the buffer (\*pBuffer) while using the device specific command (Cmd).

Depending on the addressed I2C device command (Cmd) can be a specific command or a byte offset.

# Parameters

Id

\_\_IN Refer I2C Bus Id.

Addr

\_\_IN 8-bit I2C device address.

Cmd

\_\_IN Encoded I2C device command / index. Refer I2C Cmd Type for command encoding.

\*pBuffer

\_\_IN Pointer to a buffer containing the data to be transferred.

ByteCnt

\_\_IN Size (in bytes), of the information pointed to by the pBuffer parameter.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Unsupported I2C functionality</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>I2C device handle access failed</td><td>EAPI_STATUS_READ_ERROR</td></tr><tr><td>pBuffer == NULL || ByteCnt == 0</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>ByteCnt &gt; MAX_BLOCK</td><td>EAPI_STATUS_INVALID_BLOCK_LENGTH</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.8.6 EApiI2CWriteReadRaw

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiI2CWriteReadRaw(
    IN uint32_t Id,    /* I2C Bus Id*/
    IN uint8_t Addr,    /* 8Bit I2C Device Address */
    INOPT void *pWBuffer,    /* Write Data pWBuffer*/
    IN uint32_t WriteBCnt,    /* Number of Bytes to write*/
    OUTOPT void *pRBuffer,    /* Read Data pRBuffer */
    IN uint32_t RBufLen,    /* Data pRBuffer Length*/
    IN uint32_t ReadBCnt    /* Number of Bytes to Read */
);
```

# Description

Universal function used for combined write/read transactions (I2C repeat start feature).

# Parameters

Id \_\_IN Refer I2C Bus Id.

Addr

\_\_IN 8-bit I2C slave device address.

\*pWBuffer

\_\_INOPT Pointer to a buffer containing the data to be transferred. This parameter can be NULL if the data is not required. 0th index of pWBuffer holds the encoded Cmd.

WriteBCnt

\_\_IN Size, in bytes, of the information pointed to by the pWBuffer parameter.

\*pRBuffer

OUTOPT Pointer to a buffer that receives the read data.

RBufLen

\_\_IN Size, in bytes, of the buffer pointed to by the pRBuffer parameter.

ReadBCnt

\_\_IN Size (in bytes), specifying the number of bytes to read.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Unsupported I2C functionality</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Invalid ReadBCnt, RBufLen or WriteBCnt</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>WriteBCnt / ReadBCnt greater than MaxBlockLen</td><td>EAPI_STATUS_INVALID_BLOCK_LENGTH</td></tr><tr><td>Write Failure</td><td>EAPI_STATUS_WRITE_ERROR</td></tr><tr><td>Read Failure</td><td>EAPI_STATUS_READ_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.9. Error Log Description

• Retrieves hardware and firmware error logs recorded by the system.
• Useful for post-failure analysis, debugging, and reliability assessment.

# 5.9.1 EApiBoardGetErrorLog

Function definition
```txt
uint32_t
EAPI_CALLTYPE
EApiBoardGetErrorLog(
    __IN uint32_t position, /* Exception code */
    __OUT uint32_t *ErrorNumber,
    __OUT uint8_t *Flags,
    __OUT uint8_t *RestartEvent,
    __OUT uint32_t *PwrCycles,
    __OUT uint32_t *Bootcount,
    __OUT uint32_t *Time,
    __OUT uint8_t *Status,
    __OUT signed char *CPUtemp,
    __OUT signed char *Boardtemp
    __OUT uint32_t *TotalOnTime,
    __OUT uint8_t *BiosSel
);
```

# Description

Get error number history of selected ports from the EC/BMC. The error log buffer stores the power sequence issues, information about the actual state and counters for better tracking of the issues.

The latest entry in the error log buffer is always found on position 0. The previous entry is found on position 1 and so on.

# Parameters

# position

\_\_IN Position points to the log to be read.

# \*ErrorNumber

\_\_OUT Pointer to buffer that stores the Error number. To get the detailed description, use EApiGetErrorNumberDescription.

# \*Flags

Exception Code, selected BIOS and Power Mode.

# \*RestartEvent

\_\_OUT Pointer to buffer that stores the system restart event.

# \*PwrCycles

\_\_OUT Pointer to buffer that stores the value of power cycles counter.

# \*Bootcount

\_\_OUT Pointer to buffer that stores the value of boot counter.

# \*Time

\_\_OUT Pointer to buffer that stores the value of ontime counter in seconds.

# \*Status

\_\_OUT Pointer to buffer that stores the value of BMC status information.

# \*CPUtemp

\_\_OUT Pointer to buffer that stores the value of current CPU temperature in celsius.

# \*Boardtemp

\_\_OUT Pointer to buffer that stores the value of current board temperature in celsius.

# \*TotalOnTime

\_\_OUT Pointer to buffer that stores the value of total on time in minutes.

# \*BiosSel

\_\_OUT Pointer to buffer that stores the value of BIOS Selected.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>If Buffers are NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Write position failed</td><td>EAPI_STATUS_WRITE_ERROR</td></tr><tr><td>Read Error log failed</td><td>EAPI_STATUS_READ_ERROR</td></tr></table>

# 5.9.2 EApiBoardGetCurPosErrorLog

Function definition
```sql
uint32_t
EAPI_CALLTYPE
EApiBoardGetCurPosErrorLog (
__OUT uint32_t *ErrorNumber,
__OUT uint8_t *Flags,
__OUT uint8_t *RestartEvent,
__OUT uint32_t *PwrCycles,
__OUT uint32_t *Bootcount,
__OUT uint32_t *Time,
__OUT uint8_t *Status,
__OUT signed char *CPUtemp,
__OUT signed char *Boardtemp
__OUT uint32_t *TotalOnTime,
__OUT uint8_t *BiosSel
);
```

# Description

Get latest error number history from EC/BMC. The error log buffer stores the power sequence issues, information about the actual state and counters for better tracking of the issues.

# Parameters

# \*ErrorNumber

\_OUT Pointer to buffer that stores the Error number. To get the detailed description, please use EApiGetErrorNumberDescription.

# \*Flags

Exception Code, selected BIOS and Power Mode

# \*RestartEvent

\_\_OUT Pointer to buffer that stores the system restart event.

# \*PwrCycles

\_\_OUT Pointer to buffer that stores the value of power cycles counter.

# \*Bootcount

\_\_OUT Pointer to buffer that stores the value of boot counter.

# \*Time

\_\_OUT Pointer to buffer that stores the value of ontime counter in seconds.

# \*Status

\_\_OUT Pointer to buffer that stores the value of status information from BMC status command.

# \*CPUtemp

\_\_OUT Pointer to buffer that stores the value of current CPU temperature in Celsius.

# \*Boardtemp

\_\_OUT Pointer to buffer that stores the value of current board temperature in Celsius.

# \*TotalOnTime

\_\_OUT Pointer to buffer that stores the value of total on time in minutes.

# \*BiosSel

\_\_OUT Pointer to buffer that stores the value of BIOS Selected.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>If buffers are NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Read Error log failed</td><td>EAPI_STATUS_READ_ERROR</td></tr></table>

# 5.9.3 EApiBoardGetErrorNumDesc

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiBoardGetErrorNumDesc(
    __IN uint32_t Pos, /* Pos */
    __OUT char *pBuf /* Buffer */
    __OUT uint32_t size /* Buffer size */
);
```

# Description

To get the description of the given error number.

# Parameters

Pos

\_\_IN Position number of the log to be read.

\*pBuf

\_\_OUT Pointer to buffer that receives the description string.

size

\_\_OUT Size of pBuf in bytes.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Invalid buffer</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Position write failed</td><td>EAPI_STATUS_WRITE_ERROR</td></tr><tr><td>Read Error log failed</td><td>EAPI_STATUS_READ_ERROR</td></tr></table>

# 5.10. BIOS Source

Allows configuring the BIOS source mode such as External BIOS, Standard BIOS, or Fail-Safe BIOS.

# 5.10.1 EApiGetBiosSource

Function definition
```txt
uint32_t
EAPI_CALLTYPE
EApiGetBiosSource(
    __OUT uint8_t *data    /* Buffer */
);
```

# Description

To get the BIOS Source.

# Parameters

\*data

\_\_OUT Pointer to buffer that receives the data.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Invalid data buffer</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>BIOS source read failed</td><td>EAPI_STATUS_READ_ERROR</td></tr></table>

# 5.10.2 EApiSetBiosSource

Function definition
```txt
uint32_t
EAPI_CALLTYPE
EApiSetBiosSource(
    __IN uint8_t data,    /* Buffer */
);
```

# Description

Set the BIOS Source.

# Parameters

data

\_\_IN Pointer to buffer that stores the data.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Failed</td><td>EAPI_STATUS_WRITE_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.10.3 EApiGetBiosStatus

Function definition
```txt
uint32_t
EAPI_CALLTYPE
EApiGetBiosStatus(
    __OUT uint8_t *data /* Buffer */
);
```

# Description

Displays the BIOS status.

# Parameters

\*data

\_\_OUT Pointer to buffer that receives the data.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Invalid data buffer</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>BIOS source read failed</td><td>EAPI_STATUS_READ_ERROR</td></tr></table>

# 5.11. Smart Fan

• Allows monitoring and control of fan speed based on temperature or predefined policies.
• Helps optimize cooling performance while reducing noise and power consumption.

Fan Id

<table><tr><td>Fan Id</td><td>Description</td></tr><tr><td>0</td><td>CPU Fan</td></tr><tr><td>1</td><td>System fan 1</td></tr><tr><td>2</td><td>System fan 2 (Unsupported for EC boards)</td></tr><tr><td>3</td><td>System fan 3 (Unsupported for EC boards)</td></tr></table>

Fan Mode

<table><tr><td>Fan Mode</td><td>Description</td></tr><tr><td>0</td><td>Auto</td></tr><tr><td>1</td><td>Off</td></tr><tr><td>2</td><td>On</td></tr><tr><td>3</td><td>Soft</td></tr></table>

Fan Temperature Source

<table><tr><td>TempSrc</td><td>Description</td></tr><tr><td>0</td><td>CPU Sensor</td></tr><tr><td>1</td><td>Board Sensor</td></tr></table>

For System fan 1 of COM-HPC boards,

<table><tr><td>TempSrc</td><td>Description</td></tr><tr><td>0</td><td>CPU Sensor</td></tr><tr><td>1</td><td>Carrier Sensor</td></tr></table>

# 5.11.1. EApiSmartFanSetTempSetpoints

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiSmartFanSetTempSetpoints(
    __IN int id, /* Fan Id */
    __IN int Level1, /* Buffer */
    __IN int Level2, /* Buffer */
    __IN int Level3, /* Buffer */
    __IN int Level4 /* Buffer */
```

# Description

To set temperature setpoints. The valid temp level range is from -128 to 128.

# Parameters

id

\_\_IN Refer Fan Id.

Level1

\_\_IN Pointer to buffer that stores the temperature level 1 setpoint.

Level2

\_\_IN Pointer to buffer that stores the temperature level 2 setpoint.

Level3

\_\_IN Pointer to buffer that stores the temperature level 3 setpoint.

Level4

\_\_IN Pointer to buffer that stores the temperature level 4 setpoint.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Invalid Fan Id or Temperature setpoint level out of range</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>adl-bmc-hwmon driver not loaded successfully / Fan functionality unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Temperature points write failed</td><td>EAPI_STATUS_WRITE_ERROR</td></tr></table>

# 5.11.2. EApiSmartFanGetTempSetpoints

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiSmartFanSetTempSetpoints(
    __IN int id, /* Fan Id */
    __OUT int *pLevel1, /* Buffer */
    __OUT int *pLevel2, /* Buffer */
    __OUT int *pLevel3, /* Buffer */
    __OUT int *pLevel4 /* Buffer */
);
```

# Description

To get temperature set points.

# Parameters

id

\_\_IN Refer Fan Id.

\*pLevel1

\_\_IN Pointer to buffer that receives the temperature level 1.

\*pLevel2

\_\_IN Pointer to buffer that receives the temperature level 2.

\*pLevel3

\_\_IN Pointer to buffer that receives the temperature level 3.

\*pLevel4

\_\_IN Pointer to buffer that receives the temperature level 4.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>adl-bmc-hwmon driver not loaded successfully / Fan Id unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Sysfs access error</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Failed</td><td>EAPI_STATUS_READ_ERROR</td></tr></table>

# 5.11.3. EApiSmartFanSetPWMSetpoints

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiSmartFanSetPWMSetpoints (
    __IN int id, /* Fan Id */
    __IN int pwm_Level1, /* Buffer */
    __IN int pwm_Level2, /* Buffer */
    __IN int pwm_Level3, /* Buffer */
    __IN int pwm_Level4 /* Buffer */
```

# Description

To set PWM setpoints. The valid PWM range is from 0 to 100.

# Parameters

id

\_\_IN Refer Fan Id.

\*pwm\_Level1

\_\_IN Pointer to buffer that receives the PWM level 1.

\*pwm\_Level2

\_\_IN Pointer to buffer that receives the PWM level 2.

\*pwm\_Level3

\_\_IN Pointer to buffer that receives the PWM level 3.

\*pwm\_Level4

\_\_IN Pointer to buffer that receives the PWM level 4.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Invalid Fan Id or PWM setpoint out of range</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>adl-bmc-hwmon driver not loaded successfully /Fan functionality unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Failed</td><td>EAPI_STATUS_WRITE_ERROR</td></tr></table>

# 5.11.4. EApiSmartFanGetPwmSetpoints

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiSmartFanGetPwmSetpoints (
    __IN int id, /* Id */
    __OUT int *pwm_Level1, /* Buffer */
    __OUT int *pwm_Level2, /* Buffer */
    __OUT int *pwm_Level3, /* Buffer */
    __OUT int *pwm_Level4 /* Buffer */
);
```

# Description

To get PWM setpoints.

# Parameters

id

\_\_IN Refer Fan Id.

\*pLevel1

\_\_IN Pointer to buffer that receives the PWM level 1.

\*pLevel2

\_\_IN Pointer to buffer that receives the PWM level 2.

\*pLevel3

\_\_IN Pointer to buffer that receives the PWM level 3.

\*pLevel4

\_\_IN Pointer to buffer that receives the PWM level 4.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Invalid Fan Id / Invalid PWM level buffers</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>adl-bmc-hwmon driver not loaded successfully /Fan functionality unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Failed</td><td>EAPI_STATUS_READ_ERROR</td></tr></table>

# 5.11.5. EApiSmartFanSetMode

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiSmartFanSetMode (
    __IN int id,    /* Fan Id */
    __IN int fan_mode    /* Buffer */
);
```

# Description

To set fan mode

# Parameters

id

\_\_IN Refer Fan Id.

fan\_mode

\_\_IN Refer Fan Mode.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>id == NULL || fan_mode == NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>adl-bmc-hwmon driver not loaded successfully / Fan functionality unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Failed</td><td>EAPI_STATUS_WRITE_ERROR</td></tr></table>

# 5.11.6. EApiSmartFanGetMode

Function definition
```txt
uint32_t
EAPI_CALLTYPE
EApiSmartFanGetMode (
    __IN int id,    /* Fan Id */
    __OUT int *fan_mode    /* Buffer */
);
```

# Description

To get fan mode.

# Parameters

id

\_\_IN Refer Fan Id.

\*fan\_mode

\_\_IN Refer Fan Mode.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>id == NULL || fan_mode == NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>adl-bmc-hwmon driver not loaded successfully / Fan functionality unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Failed</td><td>EAPI_STATUS_READ_ERROR</td></tr></table>

# 5.11.7. EApiSmartFanSetTempSrc

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiSmartFanSetTempSrc(
    __IN int id,    /* Fan Id */
    __IN int TempSrc    /* Buffer */
);
```

# Description

To set Temperature source of specific fan id.

# Parameters

id

\_\_IN Refer Fan Id.

# TempSrc

\_\_IN Refer Fan Temperature Source.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Unsupported Fan ID or TempSrc</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Fan Driver not loaded or Unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Failed</td><td>EAPI_STATUS_WRITE_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.11.8. EApiSmartFanGetTempSrc

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiSmartFanSetMode(
    __IN int id,    /* Id */
    __OUT int *pTempSrc    /* Buffer */
);
```

# Description

To get Temperature source of specific fan id

# Parameters

id

\_\_IN Refer Fan Id.

# \*pTempSrc

\_\_IN Refer Fan Temperature Source.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Invalid Fan Id / Invalid temperature source buffer</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>adl-bmc-hwmon driver not loaded successfully / Fan functionality unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Fan mode read failed</td><td>EAPI_STATUS_READ_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.12 Backlight

Enables control of display backlight brightness levels.
• Used to adjust visibility and reduce power consumption in embedded displays.

Backlight Id

<table><tr><td>Id</td><td>Description</td></tr><tr><td>EAPI_ID_BACKLIGHT_1</td><td>Backlight Local Flat Panel 1</td></tr></table>

PWM Level

<table><tr><td>Backlight Enable values</td><td>Description</td></tr><tr><td>1</td><td>Requests/Signifies that the Backlight be Enabled</td></tr><tr><td>0</td><td>Requests/Signifies that the Backlight be Disabled</td></tr></table>

# 5.12.1 EApiVgaSetBacklightEnable

Function definition
```txt
uint32_t
EAPI_CALLTYPE
EApiVgaSetBacklightEnable (
    __IN uint32_t Id    , /* Backlight Id */
    __IN uint32_t Enable    /* Backlight Enable */
);
```

# Description

Enables the backlight of the selected flat panel display and set brightness level 200 by default.

# Parameters

Id

\_\_IN Backlight Id.

Enable

\_\_IN Refer PWM Level Pointer to a buffer that stores the backlight enable state.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Unsupported Backlight Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Enable == NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Write Failure</td><td>EAPI_STATUS_WRITE_ERROR</td></tr></table>

# 5.12.2 EApiVgaGetBacklightEnable

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiVgaGetBacklightEnable (
    __IN uint32_t Id    , /* Backlight Id */
    __OUT uint32_t *pEnable    /* Backlight Enable */
);
```

# Description

Get the backlight enable status of the selected flat panel display.

# Parameters

Id

\_\_IN Refer Backlight Id.

\*pEnable

\_\_IN Refer PWM Level Pointer to a buffer that receives the backlight enable state.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Unsupported Backlight Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>pEnable == NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Read Failure</td><td>EAPI_STATUS_READ_ERROR</td></tr></table>

# 5.12.3 EApiVgaSetBacklightBrightness

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiVgaSetBacklightBrightness (
    __IN uint32_t Id , /* Backlight Id */
    __IN uint32_t Bright /* Backlight Brightness */
);
```

# Description

Sets the brightness of the selected flat panel display.

# Parameters

Id

\_\_IN Refer Backlight Id.

# Bright

\_\_IN Backlight brightness level. The range of PWM Level is from 0 to 255.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Unsupported Backlight Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Bright == NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Backlight sysfs file read failed</td><td>EAPI_STATUS_READ_ERROR</td></tr><tr><td>Write Failure</td><td>EAPI_STATUS_WRITE_ERROR</td></tr><tr><td>Backlight disabled</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.12.4 EApiVgaGetBacklightBrightness

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiVgaGetBacklightBrightness (
    __IN uint32_t Id , /* Backlight Id */
    __OUT uint32_t *pBright /* Backlight Brightness */
);
```

# Description

Reads the current brightness of the selected flat panel display

# Parameters

Id

\_\_IN Refer Backlight Id.

\*pBright

\_\_OUT Pointer to a buffer that receives the current backlight brightness level.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Unsupported Backlight Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>pBright == NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Backlight brightness read failed</td><td>EAPI_STATUS_READ_ERROR</td></tr><tr><td>Backlight disabled</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.13. Exception Description

• Provides detailed descriptions of error and exception codes returned by APIs.
• Helps developers quickly diagnose failures and understand error conditions.

# 5.13.1. EApiBoardGetExcepDesc

Function definition
```c
uint32_t
EAPI_CALLTYPE
EApiBoardGetExcepDesc(
    __IN uint32_t Exceptioncode, /* Exception code */
    __OUT char *pBuf /* Buffer */
    __INOUT uint32_t size /* size in bytes */
);
```

# Description

To get text information of the Exception code.

# Parameters

# Exceptioncode

\_\_IN The Error number (Exception Code).

\*pBuf

\_\_OUT Pointer to buffer that receives Error number.

size

\_\_INOUT Size of pBuf in bytes.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Invalid buffer</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Exception code write failed</td><td>EAPI_STATUS_WRITE_ERROR</td></tr><tr><td>Read exception description failed</td><td>EAPI_STATUS_READ_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.14. SMBus Slave Device Access

• Provides access to SMBus devices for reading and writing data.

Commonly used to communicate with power management devices, sensors, and controllers.

# 5.14.1. EApiSMBReadTrans

Function Definition
```c
uint32_t
EAPI_CALLTYPE
EApiSMBReadTrans (
    __IN uint32_t Addr , /* 7-bit SMBus Device Address */
    __IN uint32_t Cmd , /* SMBus Device command */
    __OUT void *pBuffer , /* Read Data pBuffer */
    __IN uint32_t nByteCnt /* Number of Bytes to Read*/
);
```

# Description

Reads from a specific register in the selected SMBus device.

Reads from SMBus device at the SMBus address (Addr) and stores in the buffer pBuffer while using the device specific command Cmd.

# Parameters

# Addr

\_\_ IN Encoded 7-bit SMBus Slave device address.

# Cmd

\_\_IN SMBus Device Command / Index.

# \*pBuffer

\_\_OUT Pointer to a buffer that receives the read data.

# nByteCnt

\_\_IN Size (in bytes), of the information read to the buffer pointed to by pBuffer.

nByteCnt is 2 for ReadWord operation.

nByteCnt is 1 for ReadByte operation.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Invalid pbuffer or nByteCnt</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Sysfs access failed / adl-bmc-i2c driver not loaded successfully</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>SMBus Read failed</td><td>EAPI_STATUS_READ_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 5.14.2. EApiSMBWriteTrans

Function Definition
```c
uint32_t
EAPI_CALLTYPE
EApiSMBWriteTrans (
    __IN uint32_t Addr , /* 7-bit SMBUS Device Address */
    __IN uint32_t Cmd , /* I2C Command/Offset */
    __IN void *pBuffer, /* Data buffer */
    __IN uint32_t nByteCnt /* Bytes Count to Write */
);
```

# Description

Writes to a specific register in the selected SMBus device.

# Parameters

# Addr

\_\_ IN Encoded 7-bit SMBus Slave device address.

# Cmd

\_\_IN SMBus Device Command / Index.

# \*pBuffer

\_\_IN Pointer to a buffer that stores the data to be read.

# nByteCnt

\_\_IN Size (in bytes), of the buffer pointed to by the pBuffer parameter.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Invalid pbuffer or nByteCnt</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>nByteCnt greater than maximum supported block length</td><td>EAPI_STATUS_INVALID_BLOCK_LENGTH</td></tr><tr><td>Sysfs access failed / adl-bmc-i2c driver not loaded successfully</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>SMBus Write failed</td><td>EAPI_STATUS_WRITE_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6. For Windows Platforms

# 6.1 Initialization Functions

# 6.1.1 SemaEApiLibInitialize

Function Definition
```txt
uint32_t
SEMAEAPI_API
SemaEApiLibInitialize (void);
```

# Description

General initialization of the EAPI. Prior to calling any EAPI function the library needs to be initialized by calling this function.

The status code for all EAPI function will be EAPI\_STATUS\_NOT\_INITIALIZED unless this function is called.

# Parameters

None.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Mutex Creation failed</td><td>EAPI_STATUS_ALLOC_ERROR</td></tr><tr><td>Mutex timeout</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>EC/BMC chip not detected</td><td>EAPI_STATUS_NOT_FOUND</td></tr><tr><td>Initialization failed</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Initialization success</td><td>EAPI_STATUS_INITIALIZED</td></tr></table>

# 6.1.2 SemaEApiUnInitialize

Function Definition
```txt
uint32_t
SEMAEAPI_API
SemaEApiUnInitialize (void);
```

# Description

General function to uninitialize the EAPI library. Should be called before program exit. Closes the driver handles and releases OS resources (file descriptors, mutexes, threads, etc).

# Parameters

None.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.2 Board Information

SEMA EAPI functions provide an interface to control or get board’s information, including

• Static board and manufacturer information (e.g. BIOS version, Manufacturer name)
Failure forensics (e.g. restart event)

# 6.2.1 SemaEApiBoardGetStringA

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiBoardGetStringA (
    __IN uint32_t Id, /* EAPI ID */
    __OUT uint8_t *pData, /* Data buffer */
    __INOUT uint32_t *pBufLen /* Buffer Length */
);
```

# Description

Text information about the system and manufacturer details for diagnostic and inventory purposes.

# Parameters

Id

\_IN Selects the EAPI Id corresponding to the data. All the data retrieved is in string format.

<table><tr><td>Id</td><td>Description</td></tr><tr><td>EAPI_ID_BOARD_MANUFACTURER_STR</td><td>Board Manufacturer Name</td></tr><tr><td>EAPI_ID_BOARD_NAME_STR</td><td>Board Name</td></tr><tr><td>EAPI_ID_BOARD_SERIAL_STR</td><td>Board Serial Number</td></tr><tr><td>EAPI_ID_BOARD_BIOS_REVISION_STR</td><td>Board BIOS Revision</td></tr><tr><td>EAPI_ID_BOARD_HW_REVISION_STR</td><td>Hardware Revision</td></tr><tr><td>EAPI_ID_BOARD_PLATFORM_TYPE_STR</td><td>Board Platform Type</td></tr><tr><td>EAPI_SEMA_ID_BOARD_BOOT_VERSION_STR</td><td>Bootloader Revision (Only for BMC boards)</td></tr><tr><td>EAPI_SEMA_ID_BOARD_APPLICATION_VERSION_STR</td><td>Firmware Revision</td></tr><tr><td>EAPI_SEMA_ID_BOARD_RESTART_EVENT_STR</td><td>Board Restart Event</td></tr><tr><td>EAPI_SEMA_ID_BOARD_REPAIR_DATE_STR</td><td>Board Repair Date</td></tr><tr><td>EAPI_SEMA_ID_BOARD_MANUFACTURE_DATE_STR</td><td>Board Manufacturing Date</td></tr><tr><td>EAPI_SEMA_ID_BOARD_MAC_1_STRING</td><td>Board MAC Address 1</td></tr><tr><td>EAPI_SEMA_ID_BOARD_MAC_2_STRING</td><td>Board MAC Address 2</td></tr><tr><td>EAPI_SEMA_ID_BOARD_2ND_HW_REVISION_STR</td><td>Board Secondary Hardware Revision</td></tr><tr><td>EAPI_SEMA_ID_BOARD_2ND_SERIAL_STR</td><td>Board Secondary Serial Number</td></tr></table>

# \*pData

\_\_OUT Pointer to a buffer that receives the data.

# \*pBufLen

\_INOUT Pointer to a variable that specifies the size, in bytes, of the buffer pointed to by the pBuffer parameter.

When the function returns, this variable contains the size of the data copied to pBuffer including the terminating null character.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library not initialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>pBufLen == NULL || pBufLen == 0 || pData == NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>pBufLen is less than data retrieved</td><td>EAPI_STATUS_MORE_DATA</td></tr><tr><td>Unsupported EAPI Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.3 Board Values

• Allows access to real-time system and hardware parameters [corresponds to a specific sensor reading or board metric such as temperature, Voltage, etc].
• These values are typically used for monitoring and diagnostics.

# 6.3.1 SemaEApiBoardGetValue

Function Definition
```txt
uint32_t
SEMAEAPI_API
SemaEApiBoardGetValue (
    __IN uint32_t Id, /* EAPI ID */
    __OUT uint32_t *pData /* Value buffer */
);
```

# Description

Read the real-time system and hardware parameters [corresponds to a specific sensor reading or board metric].

# Parameters

Id

\_\_IN Selects the EAPI Id corresponding to the data.

<table><tr><td>Id</td><td>Description</td><td>Units/Format</td></tr><tr><td>EAPI_ID_GET_EAPI_SPEC_VERSION</td><td>EAPI Specification Version used to implement API</td><td>Refer Specification Version Number Format</td></tr><tr><td>EAPI_ID_BOARD_BOOT_COUNTER_VAL</td><td>Boot Counter</td><td>boots</td></tr><tr><td>EAPI_ID_BOARD_RUNNING_TIME_METER_VAL</td><td>Running Time Meter</td><td>minutes</td></tr><tr><td>EAPI_ID_BOARD_LIB_VERSION_VAL</td><td>Vendor Specific Library Version</td><td>Refer General Version number Format</td></tr><tr><td>EAPI_ID_HWMON_CPU_TEMP</td><td>CPU Temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_ID_HWMON_BOARD_TEMP</td><td>Board Temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_ID_HWMON_VOLTAGE_VCORE</td><td>CPU Core Voltage</td><td>millivolts</td></tr><tr><td>EAPI_ID_HWMON_VOLTAGE_2V5</td><td>2.5V Voltage</td><td>millivolts</td></tr><tr><td>EAPI_ID_HWMON_VOLTAGE_3V3</td><td>3.3V Voltage</td><td>millivolts</td></tr><tr><td>EAPI_ID_HWMON_VOLTAGE_VBAT</td><td>Battery Voltage</td><td>millivolts</td></tr><tr><td>EAPI_ID_HWMON_VOLTAGE_5V</td><td>5V Voltage</td><td>millivolts</td></tr><tr><td>EAPI_ID_HWMON_VOLTAGE_5VSB</td><td>5V Standby Voltage</td><td>millivolts</td></tr><tr><td>EAPI_ID_HWMON_VOLTAGE_12V</td><td>12V Voltage</td><td>millivolts</td></tr><tr><td>EAPI_ID_HWMON_FAN_CPU</td><td>CPU Fan speed</td><td>RPM</td></tr><tr><td>EAPI_ID_HWMON_FAN_SYSTEM</td><td>System Fan speed</td><td>RPM</td></tr><tr><td>EAPI_SEMA_ID_BOARD_POWER_UP_TIME</td><td>Get the operating time after power up</td><td>seconds</td></tr><tr><td>EAPI_SEMA_ID_BOARD_RESTART_EVENT</td><td>Get the restart event</td><td>Refer Restart Event</td></tr><tr><td>EAPI_SEMA_ID_BOARD_CAPABILITIES</td><td>Get the capabilities of this board or system</td><td>Refer Firmware Capability</td></tr><tr><td>EAPI_SEMA_ID_BOARD_CAPABILITIES_EX</td><td>Get the extended EC capabilities</td><td>Refer Extended Firmware Capability</td></tr><tr><td>EAPI_SEMA_ID_BOARD_MIN_TEMP</td><td>Board minimum temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_MAX_TEMP</td><td>Board maximum temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_STARTUP_TEMP</td><td>Board startup temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_CPU_MIN_TEMP</td><td>CPU minimum temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_CPU_MAX_TEMP</td><td>CPU maximum temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_CPU_STARTUP_TEMP</td><td>CPU startup temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_MAIN_CURRENT</td><td>Get main power current</td><td>Unit: mA, Resolution=1/10 mA</td></tr><tr><td>EAPI_SEMA_ID_HWMON_VOLTAGE_GFX_VCORE</td><td>GFX voltage</td><td>millivolts</td></tr><tr><td>EAPI_SEMA_ID_HWMON_VOLTAGE_1V05</td><td>1.05V voltage</td><td>millivolts</td></tr><tr><td>EAPI_SEMA_ID_HWMON_VOLTAGE_1V5</td><td>1.5V voltage</td><td>millivolts</td></tr><tr><td>EAPI_SEMA_ID_HWMON_VOLTAGE_VIN</td><td>Vin voltage</td><td>millivolts</td></tr><tr><td>EAPI_SEMA_ID_HWMON_FAN_SYSTEM_2</td><td> $2^{nd}$  system fan</td><td>RPM</td></tr><tr><td>EAPI_SEMA_ID_HWMON_FAN_SYSTEM_3</td><td> $3^{rd}$  system fan</td><td>RPM</td></tr><tr><td>EAPI_SEMA_ID_BOARD_2ND_SYSTEM_TEMP</td><td> $2^{nd}$  Board temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_2ND_SYSTEM_MIN_TEMP</td><td> $2^{nd}$  Board minimum temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_2ND_SYSTEM_MAX_TEMP</td><td> $2^{nd}$  Board maximum temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_2ND_SYSTEM_STARTUP_TEMP</td><td> $2^{nd}$  Board startup temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_BOARD_POWER_CYCLE</td><td>Power cycle counter</td><td>cycles</td></tr><tr><td>EAPI_SEMA_ID_BOARD_BMC_FLAG</td><td>Status of the EC</td><td>Refer EC/BMC Flags</td></tr><tr><td>EAPI_SEMA_ID_BOARD_BMC_STATUS</td><td>Status of the EC (not supported for EC boards)</td><td>Information for problem analysis</td></tr><tr><td>EAPI_SEMA_ID_IO_CURRENT</td><td>IO current</td><td>mA</td></tr><tr><td>EAPI_SEMA_ID_HWMON_SYSTEM_TEMP</td><td>System Temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_HWMON_SYSTEM_MIN_TEMP</td><td>System minimum temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_HWMON_SYSTEM_MAX_TEMP</td><td>System maximum temperature</td><td>0.1 Kelvins</td></tr><tr><td>EAPI_SEMA_ID_HWMON_SYSTEM_STARTUP_TEMP</td><td>System startup temperature</td><td>0.1 Kelvins</td></tr></table>

# \*pData

\_\_OUT Pointer to a buffer that receives the data.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library not initialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>pData == NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Unsupported EAPI Id / Functionality</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Mutex Failure / Read Value Failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.4. Watchdog Control

The Runtime Watchdog is used to recover from operating system hangs, application software hangs, or other system malfunctions. When the runtime watchdog timer expires, the EC/BMC triggers a system reset and automatically stops the runtime watchdog.

The Powerup Watchdog is used to handle system reset or boot failures. The reset cycle is repeated until the system successfully boots and the application services the watchdog.

# 6.4.1. SemaEApiWDogGetCap

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiWDogGetCap (
__OUTOPT uint32_t *pMaxDelay, /* Max. supported delay in sec */
__OUTOPT uint32_t *pMaxEventTimeout, /* Max. supported Event Timeout in sec */
__OUTOPT uint32_t *Resetvalue /* Max. supported Reset Timeout in sec */
```

# Description

Get the supported maximum delay, event timeout and reset value of the Runtime Watchdog timer.

# Parameters

# \*pMaxDelay

\_OUTOPT Pointer to a buffer that receives maximum supported initial delay time of the watchdog timer in seconds.

# \*pMaxEventTimeout

\_\_OUTOPT Pointer to a buffer that receives maximum supported event timeout of the watchdog timer in seconds.

# \*Resetvalue

\_\_OUTOPT Pointer to a buffer that receives maximum supported reset timeout of the watchdog timer in seconds.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>pMaxDelay==NULL &amp;&amp; pMaxEventTimeout==NULL &amp;&amp; Resetvalue==NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Runtime watchdog unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr></table>

# 6.4.2. SemaEApiWDogStart

Function Definition
```txt
uint32_t
SEMAEAPI_API
SemaEApiWDogStart (
    __IN uint32_t delay,    /* Delay in sec */
    __IN uint32_t EventTimeout,    /* Event Timeout in sec */
    __IN uint32_t ResetTime    /* Reset Timeout in sec */
);
```

# Description

Start the runtime watchdog timer and set the parameters.

# Parameters

# delay

\_\_IN Initial delay for the watchdog timer in seconds. (currently not supported by SEMA EAPI, set it as 0).

# EventTimeout

\_\_IN Watchdog timeout interval in seconds to trigger an event. (currently not supported by SEMA EAPI, set it as 0).

# ResetTime

\_\_IN Watchdog timeout interval in seconds to trigger a reset. (Supported range 1- 65535 seconds)

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library Uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Runtime watchdog unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Invalid delay or EventTimeout</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>ResetTime not within the supported range</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Watchdog timer already active/running</td><td>EAPI_STATUS_RUNNING</td></tr><tr><td>Mutex failure / Watchdog Start Failure</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.4.3. SemaEApiWDogTrigger

# Function Definition

```txt
uint32_t
SEMAEAPI_API
SemaEApiWDogTrigger (void);
```

# Description

Trigger the Runtime watchdog timer to previously set timeout value.

# Parameters

None.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library Uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Runtime watchdog unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Mutex failure / Watchdog timer not started / Watchdog Trigger failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.4.4. SemaEApiWDogStop

# Function Definition

```txt
uint32_t
SEMAEAPI_API
SemaEApiWDogStop (void);
```

# Description

Stops the operation of the Runtime watchdog timer.

# Parameters

None.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library Uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Runtime watchdog unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Mutex failure / Watchdog timer not started / Watchdog Trigger failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.4.5. SemaEApiPwrUpWDogStart

Function Definition
```txt
uint32_t
SEMAEAPI_API
SemaEApiPwrUpWDogStart (
    __IN uint32_t ResetTime /* Timeout in sec */
);
```

# Description

Start the Powerup watchdog timer and set the parameters.

# Parameters

# ResetTime

\_\_IN Powerup Watchdog timeout interval in seconds to trigger a reset.

(Supported Range 60-65535).

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library Uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Powerup watchdog unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>ResetTime not within the supported range</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Mutex failure / Watchdog Start Failure</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.4.6. SemaEApiPwrUpWDogStop

Function Definition
```txt
uint32_t
SEMAEAPI_API
SemaEApiPwrUpWDogStop (void);
```

# Description

Stops the operation of the Powerup watchdog timer.

# Parameters

None.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library Uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Runtime watchdog unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Watchdog timer not started</td><td>EAPI_STATUS_WRITE_ERROR</td></tr><tr><td>Mutex failure / Watchdog Trigger failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.5. Storage Access

Provides read and write access to non-volatile storage such as on-board EEPROM storage

(Eg: EEPROM type: Microchip AT25256B) connected to the EC/BMC.

Storage Id

<table><tr><td>Id</td><td>Description</td></tr><tr><td>EAPI_ID_STORAGE_STD</td><td>User Region</td></tr><tr><td>EAPI_ID_STORAGE_SCR</td><td>Secure region (Unsupported for BMC Boards)</td></tr><tr><td>EAPI_ID_STORAGE_ODM</td><td>ODM Region (Unsupported for BMC Boards)</td></tr></table>

<table><tr><td>Region</td><td>Address range</td><td>Base address</td><td>Valid Address to Read/Write</td><td>Block size</td></tr><tr><td>1-User</td><td>0x0000 to 0x03FF (1KB)</td><td>0x0000</td><td>0 to 1020</td><td>4</td></tr><tr><td>2-Secure</td><td>0x6000 to 0x67FF (2KB)</td><td>0x6000</td><td>0 to 2044</td><td>4</td></tr><tr><td>3-ODM</td><td>0x0C00 to 0x0FFF (1KB)</td><td>0x0C00</td><td>0 to 1020</td><td>4</td></tr></table>

# 6.5.1. SemaEApiStorageCap

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiStorageCap (
__IN uint32_t Id, /* Channel Id */
__OUT uint32_t *pStorageSize, /* Value buffer */
__OUT uint32_t *pBlockLength); /* Total write block length & alignment*/
```

# Description

Get the maximum supported storage size and block length of the selected storage area.

# Parameters

Id

\_\_IN Refer Storage Id.

\*pStorageSize

\_\_OUT Pointer to a buffer that receives storage area size.

\*pBlockLength

\_\_OUT Pointer to a buffer that receives the storage area alignment/block size.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported Storage Id or Invalid buffers</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Unsupported Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.5.2. SemaEApiStorageAreaRead

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiStorageAreaRead(
    __IN uint32_t Id,    /* Storage Area Id*/
    __IN uint32_t Offset,    /* Byte Offset */
    __OUT void *pBuffer,    /* Pointer to Data pBuffer */
    __IN uint32_t nBufLen,    /* pBuffer size in bytes */
    __IN uint32_t nByteCnt    /* Number of bytes to read */
);
```

# Description

Reads string data from the selected storage area.

# Parameters

Id

\_\_IN Refer Storage Id.

Offset

\_\_IN Storage area start address offset in bytes.

\*pBuffer

\_\_OUT Pointer to a buffer that receives the read data.

nBufLen

\_\_IN Size, in bytes, of the buffer pointed to by the pBuffer parameter

nByteCnt

\_\_IN Size, in bytes, of the information read to the buffer pointed to by the pBuffer parameter.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported Storage area Id or (pBuffer == NULL || nBufLen &lt; nByteCnt || ByteCnt &lt; 0)</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>(nByteCnt % BlockLength) != 0</td><td>EAPI_STATUS_INVALID_BLOCK_LENGTH</td></tr><tr><td>(nByteCnt + nOffset) &gt; StorageSize</td><td>EAPI_STATUS_MORE_DATA</td></tr><tr><td>Mutex Failure / Read failure</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.5.3. SemaEApiStorageAreaWrite

Function Definition
```txt
uint32_t
SEMAEAPI_API
SemaEApiStorageAreaWrite(
    __IN uint32_t Id,    /* Storage Area Id*/
    __IN uint32_t nOffset,    /* Byte Offset */
    __IN    void *pBuffer,    /* Pointer to Data pBuffer */
    __IN uint32_t nByteCnt    /* Number of bytes to read */
);
```

# Description

Writes string data to the selected storage area.

# Parameters

Id

\_\_IN Refer Storage Id.

nOffset

\_\_IN Storage area start address offset in bytes.

\*pBuffer

\_\_IN Pointer to a buffer containing the data to be stored.

nByteCnt

\_\_IN Size, in bytes, of the information pointed to by the pBuffer parameter.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Storage Access Unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Invalid Storage area Id or (pBuffer == NULL || nByteCnt &lt; 0)</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>nOffset != 0 &amp;&amp; (nOffset % BlockLength) != 0</td><td>EAPI_STATUS_INVALID_BLOCK_ALIGNMENT</td></tr><tr><td>nByteCnt % BlockLength != 0</td><td>EAPI_STATUS_INVALID_BLOCK_LENGTH</td></tr><tr><td>(nByteCnt + nOffset) &gt; StorageSize</td><td>EAPI_STATUS_MORE_DATA</td></tr><tr><td>Mutex Failure / Write failure</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.5.4. SemaEApiStorageHexRead

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiStorageHexRead(
    __IN uint32_t Id,    /* Storage Area Id*/
    __IN uint32_t Offset,    /* Byte Offset */
    __OUT void *pBuffer,    /* Pointer to Data pBuffer */
    __IN uint32_t nBufLen,    /* Data pBuffer Size in bytes */
    __IN uint32_t nByteCnt    /* Number of bytes to read */
);
```

# Description

Reads data in hexadecimal from the selected storage area.

# Parameters

Id

\_\_IN Refer Storage Id.

Offset

\_\_IN Storage area start address offset in bytes.

\*pBuffer

\_\_OUT Pointer to a buffer that receives the read data in hexadecimal.

BufLen

\_\_IN Size, in bytes, of the buffer pointed to by the pBuffer parameter.

ByteCnt

\_\_IN Size, in bytes, of the information read to the buffer pointed to by the pBuffer parameter.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported Storage area Id or (pBuffer == NULL || nBufLen &lt; nByteCnt || ByteCnt &lt; 0)</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>(nByteCnt % BlockLength) != 0</td><td>EAPI_STATUS_INVALID_BLOCK_LENGTH</td></tr><tr><td>(nByteCnt + nOffset) &gt; StorageSize</td><td>EAPI_STATUS_MORE_DATA</td></tr><tr><td>Mutex Failure / Read failure</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.5.5. SemaEApiStorageHexWrite

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiStorageHexWrite(
    __IN uint32_t Id,    /* Storage Area Id*/
    __IN uint32_t nOffset,    /* Byte Offset */
    __IN char *pBuffer, /* Pointer to Data pBuffer */
    __IN uint32_t nByteCnt    /* Number of bytes to read */
);
```

# Description

Writes data in hexadecimal to the selected storage area.

# Parameters

Id

\_\_IN Refer Storage Id.

nOffset

\_\_IN Storage area start address offset in bytes.

\*pBuffer

\_\_IN Pointer to a buffer that stores the data to be written.

nByteCnt

\_\_IN Size, in bytes, of the information pointed to by the pBuffer parameter.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Storage Access Unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Invalid Storage area Id or (pBuffer == NULL || nByteCnt &lt; 0)</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>nOffset != 0 &amp;&amp; (nOffset % BlockLength) != 0</td><td>EAPI_STATUS_INVALID_BLOCK_ALIGNMENT</td></tr><tr><td>nByteCnt % BlockLength != 0</td><td>EAPI_STATUS_INVALID_BLOCK_LENGTH</td></tr><tr><td>(nByteCnt + nOffset) &gt; StorageSize</td><td>EAPI_STATUS_MORE_DATA</td></tr><tr><td>Mutex Failure / Write failure</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.5.6. SemaEApiStorageUnlock

Function definition
```txt
uint32_t
SEMAEAPI_API
SemaEApiStorageUnlock(
    __IN uint32_t Id, /* Storage Area Id */
    __IN uint32_t Permission, /* Storage Area Permission */
    __IN char *Password /* Storage Area Passcode */
);
```

# Description

Unlock the Secure or ODM storage region to access data. (Currently supported only for EC boards)

# Parameters

Id

\_\_IN Only Secure or ODM regions. Refer Storage Id.

# Permission

\_\_IN Supports 2 permissions.

<table><tr><td>Id</td><td>Description</td></tr><tr><td>1</td><td>Read only</td></tr><tr><td>2</td><td>Read / Write</td></tr></table>

# \*Password

\_\_IN Pointer to a buffer containing passcode to unlock the selected region

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library Uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Invalid Storage Id</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Unsupported functionality / Permission</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Invalid Password</td><td>EAPI_STATUS_WRITE_ERROR</td></tr><tr><td>EC is busy</td><td>EAPI_STATUS_TIMEOUT</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex failure / Unlock failed</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.5.7. SemaEApiStorageLock

Function definition
```txt
uint32_t
SEMAEAPI_API
SemaEApiStorageLock(
    __IN uint32_t Id /* Storage Area Id */
);
```

# Description

Lock the Secure or ODM storage region to protect data access. (Currently supported only for EC boards)

# Parameters

Id

\_\_IN Only Secure or ODM regions. Refer Storage Id.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library Uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Invalid Storage Id</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Unsupported functionality / Permission</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>EC is busy</td><td>EAPI_STATUS_TIMEOUT</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Lock failed</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.5.8. EApiGUIDWrite

Function definition
```c
uint32_t
SEMAEAPI_API
EApiGUIDWrite(
    __IN uint32_t Id, /* Storage Area Id */
    __IN uint32_t nOffset, /* Byte Offset */
    __IN void *pBuffer, /* Pointer to Data pBuffer */
    __IN uint32_t nByteCnt /* Data buffer size in bytes */
);
```

# Description

Writes UUID type 4 in hexadecimal to the selected storage area. The GUID can be read using SemaEApiStorageHexRead.

NOTE: The ODM region should be unlocked before calling this function

# Parameters

Id

\_\_IN Refer ODM region in Storage Id.

nOffset

\_\_IN Offset 0x100 of ODM region is used for storing GUID.

\*pBuffer

\_\_IN Pointer to a buffer array of 16 elements containing the GUID [in hexadecimal] to be stored.

nByteCnt

\_\_IN Size, in bytes, of the information pointed to by the pBuffer parameter [nByteCnt=16]

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported Storage area Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>(nByteCnt + nOffset) &gt; StorageSize</td><td>EAPI_STATUS_MORE_DATA</td></tr><tr><td>Mutex Failure / Write failure</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.6. Voltage Monitor

• Allows monitoring of system and component voltage levels in real time.
• Helps detect power irregularities and ensures operation within safe voltage ranges.

# 6.6.1. SemaEApiBoardGetVoltageMonitor

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiBoardGetVoltageMonitor (
    __IN uint32_t channel, /* Channel Id */
    __OUT uint32_t *pValue, /* Value buffer */
    __OUT char *pBuffer /* Description Buffer */
);
```

# Description

Get the Voltage description and values of the selected channel.

# Parameters

channel

\_\_IN Select the channel ID [channel range 0 -15].

\*pValue

\_\_OUT Pointer to a buffer that receives the voltage value.

\*pBuffer

\_\_OUT Pointer to a buffer that receives the voltage description string.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>pValue == NULL || pBuffer == NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Unsupported Channel</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Read voltage failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.7. GPIO Control

SEMA helps control general purpose I/O pins connected to the board controller (EC/BMC).

# 6.7.1. SemaEApiGPIOGetDirectionCaps

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiGPIOGetDirectionCaps(
    __IN uint8_t GpioId, /* GPIO Id*/
    __OUTOPT uint32_t *pnCapsIn, /* Supported GPIO Output Bit Mask */
    __OUTOPT uint32_t *pnCapsOut, /* Supported GPIO Output Bit Mask */
```

# Description

Reads the capabilities of the current GPIO implementation from the selected GPIO interface. The ports where both input and output bit masks are 1 are GPIOs.

# Parameters

# GpioId

\_\_IN GPIO Id. Currently EAPI\_ID\_GPIO\_BANK00 only is supported by SEMA EAPI.

# \*pnCapsIn

\_\_OUTOPT Pointer to a buffer that receives the bit mask of the supported inputs.

# \*pnCapsOut

\_\_OUTOPT Pointer to a buffer that receives the bit mask of the supported outputs.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>(pnCapsOut == NULL) || (pnCapsIn == NULL)</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>GPIO unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr></table>

# 6.7.2. SemaEApiGPIOGetDirection

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiGPIOGetDirection(
    __IN uint8_t GpioId, /* GPIO Id*/
    __IN uint32_t Bitmask, /* Bitmap of affected bits */
    __OUT uint32_t *pDirection /* Direction */
);
```

# Description

Reads the current configuration of the selected GPIO pins.

# Parameters

# GpioId

\_\_IN GPIO Id. Currently EAPI\_ID\_GPIO\_BANK00 only is supported by SEMA EAPI.

# Bitmask

\_\_IN Only selected bits are returned. Unselected bits return 0.

# \*pDirection

\_OUT Pointer to a buffer that receives the direction of the supported GPIO ports. Bits with the value 1 are inputs and bits with value 0 are outputs.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Invalid pDirection or Bitmask</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Bitmask validation failed</td><td>EAPI_STATUS_INVALID_BITMAP</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Read direction failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr></table>

# 6.7.3. SemaEApiGPIOSetDirection

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiGPIOSetDirection(
    __IN uint8_t GpioId, /* GPIO Id*/
    __IN uint32_t Bitmask, /* Bitmask of affected bits */
    __IN uint32_t pDirection /* Direction buffer */
);
```

# Description

Sets the configuration of the selected GPIO pins.

# Parameters

# GpioId

\_\_IN GPIO Id. Currently EAPI\_ID\_GPIO\_BANK00 only is supported by SEMA EAPI.

# Bitmask

\_\_IN The bits for which the direction is to be changed are set to 1 and other bits are set to 0.

# pDirection

\_\_IN Sets the direction of the selected GPIO ports. Bits with the value 1 are inputs, bits with 0 are outputs.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Invalid Bitmask</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Bitmask validation failed</td><td>EAPI_STATUS_INVALID_BITMAP</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Set direction failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr></table>

# 6.7.4. SemaEApiGPIOGetLevel

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiGPIOGetLevel(
    __IN uint8_t GpioId, /* GPIO Id*/
    __IN uint32_t Bitmask, /* Bitmask of affected bits */
    __OUT uint32_t *plevel, /* Level */
);
```

# Description

Reads the current level of the selected GPIO pins.

# Parameters

# GpioId

\_\_IN GPIO Id. Currently EAPI\_ID\_GPIO\_BANK00 only is supported by SEMA EAPI.

# Bitmask

\_\_IN Only selected bits are returned. Unselected bits return 0.

# \*plevel

\_OUT Pointer to a buffer that receives the GPIO level. Results can be read on a bit level. Bits with the value 1 are high, bits with 0 are low.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Invalid Bitmask</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Bitmask validation failed</td><td>EAPI_STATUS_INVALID_BITMAP</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Read level failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr></table>

# 6.7.5. SemaEApiGPIOSetLevel

Function Definition
```txt
uint32_t
SEMAEAPI_API
SemaEApiGPIOSetLevel(
    __IN uint8_t GpioId, /* GPIO Id*/
    __IN uint32_t Bitmask, /* Bitmask of affected bits */
    __IN uint32_t plevel /* Level buffer */
);
```

# Description

Write to GPIO ports. Depending on the hardware implementation writing multiple GPIO ports with the bit mask option does not guarantee a time synchronous change of the output levels. Only level of the GPO pin can be changed.

# Parameters

# GpioId

\_\_IN GPIO Id. Currently EAPI\_ID\_GPIO\_BANK00 only is supported by SEMA EAPI.

# Bitmask

\_\_IN The bits for which the direction is to be changed are set to 1 and other bits are set to 0.

# plevel

\_\_IN Input level of the selected GPIO port. Only level of the Output pins can be changed.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Invalid Bitmask</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Bitmask validation failed</td><td>EAPI_STATUS_INVALID_BITMAP</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Set level failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr></table>

# 6.8. Generic I2C Access

The SEMA I2C functions Provides low-level I2C read and write access to devices connected on the I2C bus.

I2C Bus Id

<table><tr><td>Id</td><td>Description</td></tr><tr><td>SEMA_EXT_IIC_BUS_1</td><td>Extended I2C bus 1</td></tr><tr><td>SEMA_EXT_IIC_BUS_2</td><td>Extended I2C bus 2</td></tr><tr><td>SEMA_EXT_IIC_BUS_3</td><td>Extended I2C bus 3</td></tr><tr><td>SEMA_EXT_IIC_BUS_4</td><td>Extended I2C bus 4</td></tr></table>

I2C Cmd Type

<table><tr><td>CmdType</td><td>Description</td><td>Encoding Condition</td></tr><tr><td>EAPI_I2C_NO_CMD</td><td>No command/index</td><td>Bit 30 of Cmd must be 1</td></tr><tr><td>EAPI_I2C_ENC_STD_CMD</td><td>Extended standard 8 bits CMD</td><td>Original 32 bit Cmd</td></tr><tr><td>EAPI_I2C_ENC_EXT_CMD</td><td>Extended standard 10 bits CMD</td><td>Bit 31 of Cmd must be 1</td></tr></table>

# 6.8.1. SemaEApiI2CGetBusCap

Function Definition
```txt
uint32_t
SEMAEAPI_API
SemaEApiI2CGetBusCap (
    __IN uint32_t Id, /* I2C Bus Id */
    __OUT uint32_t *pMaxBlkLen /* Max BlockLength */
);
```

# Description

Returns maximum block length if the selected I2C bus is supported.

# Parameters

Id

\_\_IN Refer I2C Bus Ids.

# \*pMaxBlkLen

\_\_OUT size in bytes. Pointer to a buffer that receives the maximum transfer block length for the given interface.

Note: Max length of data byte to write is 29 Bytes and to read is 32 Bytes.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>pMaxBlkLen ==NULL</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Mutex Failure</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success or I2C Bus Id supported</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>I2C Bus Id unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr></table>

# 6.8.2. SemaEApiI2CGetBusSts

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiI2CGetBusSts (
    __IN uint32_t Id , /* I2C Bus Id */
    __OUT uint32_t *pStatus /* I2C Bus Status */
);
```

# Description

Reflects the I2C status of the most recently used I2C transaction.

# Parameters

Id

\_\_IN Refer I2C Bus Ids.

\*pStatus

\_\_OUT Pointer to a buffer that receives the data.

<table><tr><td>Id</td><td>Bit 7</td></tr><tr><td>Transaction cannot complete normallyEg:- The device does not respond ACK- Pull down in the bus- Any other error</td><td>0</td></tr><tr><td>Transaction complete normallyEg:- Transfer complete- The device respond ACK</td><td>1</td></tr></table>

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Invalid pStatus buffer / Unsupported I2C Bus Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Mutex Failure / Get bus status fail</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.8.3. SemaEApiI2CProbeDevice

Function Definition
```txt
uint32_t
SEMAEAPI_API
SemaEApiI2CProbeDevice (
    __IN uint8_t Id,    /* I2C Bus Id */
    __IN uint32_t Addr    /* Encoded 7/10 Bit I2C Device Address */
);
```

# Description

Returns EAPI\_STATUS\_SUCCESS if the device with selected I2C address is present on the specified I2C bus.

# Parameters

Id

\_\_IN I2C Bus Ids.

Addr

\_\_IN Encoded 7/10-bit I2C device Address.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported I2C Bus Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>I2C busy</td><td>EAPI_STATUS_BUSY_COLLISION</td></tr><tr><td>Mutex Failure / I2C communication failed via EC/BMC</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Device not present in I2C bus</td><td>EAPI_STATUS_NOT_FOUND</td></tr></table>

# 6.8.4. SemaEApiI2CReadTransfer

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiI2CReadTransfer (
    __IN uint32_t Id , /* I2C Bus Id*/
    __IN uint16_t Addr , /* Encoded 7Bit I2C Device Address */
    __IN uint32_t Cmd , /* No of Bytes to write*/
    __OUT void *pBuffer , /* Read Data pBuffer */
    __IN uint32_t BufLen , /* Data pBuffer Length */
    __IN uint32_t ByteCnt /* Number of Bytes to read */
);
```

# Description

Reads a specific register from the selected I2C device.

# Parameters

Id

\_\_IN Refer I2C Bus Ids.

Addr

\_\_IN Encoded 7/10-bit I2C device Address.

Cmd

\_\_IN Encoded I2C device command / index. Refer I2C Cmd Type for command encoding.

\*pBuffer

\_\_OUT Pointer to a buffer that receives the read data.

BufLen

\_\_IN Size (in bytes), of the information pointed to by the pBuffer parameter.

ByteCnt

\_\_IN Size (in bytes), of the information read to the buffer pointed to by the pBuffer parameter.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported I2C Bus Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Invalid pBuffer, ByteCnt or BufLen</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>If ByteCnt is greater than maximum block length</td><td>EAPI_STATUS_INVALID_BLOCK_LENGTH</td></tr><tr><td>Buffer length smaller than ByteCnt</td><td>EAPI_STATUS_MORE_DATA</td></tr><tr><td>Mutex Failure / I2C communication failed via EC/BMC</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>I2C Read Failed</td><td>EAPI_STATUS_READ_ERROR</td></tr></table>

# 6.8.5. SemaEApiI2CWriteTransfer

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiI2CWriteTransfer (
    __IN uint32_t Id, /* I2C Bus Id*/
    __IN uint32_t Addr, /* Encoded 7Bit I2C Device Address */
    __IN uint32_t Cmd, /* No of Bytes to write*/
    __IN void *pBuffer, /* Data pBuffer */
    __IN uint32_t ByteCnt /* Number of Bytes to write*/
```

# Description

Writes to a specific register in the selected I2C device.

# Parameters

Id

\_\_IN I2C Bus Ids.

Addr

\_\_IN Encoded 7/10-bit I2C device Address.

Cmd

\_\_IN Encoded I2C device command / index. Refer I2C Cmd Type for command encoding.

\*pBuffer

IN Pointer to a buffer that stores the write data.

ByteCnt

\_\_IN Size (in bytes), of the pBuffer.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported I2C Bus Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Invalid pBuffer or ByteCnt</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>If ByteCnt is greater than maximum block length</td><td>EAPI_STATUS_INVALID_BLOCK_LENGTH</td></tr><tr><td>Error while allocating write buffer internally</td><td>EAPI_STATUS_ALLOC_ERROR</td></tr><tr><td>Mutex Failure / I2C communication failed via EC/BMC</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>I2C write Failed</td><td>EAPI_STATUS_WRITE_ERROR</td></tr></table>

# 6.8.6. SemaEApiI2CWriteReadRaw

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiI2CWriteReadRaw (
    IN uint32_t Id , /* I2C Bus Id*/
    IN uint32_t Addr , /* Encoded 7Bit I2C *Device Address */
    INOPT void *pWBuffer , /* Write Data pWBuffer*/
    IN uint32_t WriteBCnt , /* Number of Bytes to *write */
    OUTOPT void *pRBuffer , /* Read Data pRBuffer */
    IN uint32_t RBufLen , /* Data pRBuffer Length*/
    IN uint32_t ReadBCnt /* Number of Bytes to * Read */
);
```

# Description

Universal function for Combined I2C read and write transaction. (I2C repeat start feature).

# Parameters

Id \_\_IN Refer I2C Bus Ids.

Addr \_\_IN Encoded 7/10-bit I2C device Address.

# \*pWBuffer

\_INOPT Pointer to a buffer containing the data to be transferred. This parameter can be NULL if the data is not required. 0th index of pWBuffer holds the encoded Cmd.

# WriteBCnt

\_\_IN Size, in bytes, of the information pointed to by the pWBuffer parameter.

# \*pRBuffer

OUTOPT Pointer to a buffer that receives the read data.

# RBufLen

\_\_IN Size, in bytes, of the buffer pointed to by the pRBuffer parameter.

# ReadBCnt

\_\_IN Size (in bytes), specifying the number of bytes to read.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported I2C Bus Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Invalid buffers or other parameters</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>If ByteCnt is greater than maximum block length</td><td>EAPI_STATUS_INVALID_BLOCK_LENGTH</td></tr><tr><td>Mutex Failure / I2C communication failed via EC</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>I2C Read Failed</td><td>EAPI_STATUS_READ_ERROR</td></tr></table>

# 6.9. Error Log Description

• Retrieves hardware and firmware error logs recorded by the system.
• Useful for post-failure analysis, debugging, and reliability assessment.

# 6.9.1. SemaEApiBoardGetErrorLog

Function Definition
```txt
uint32_t
SEMAEAPI_API
SemaEApiBoardGetErrorLog(
    __IN uint32_t position, /* Exception code */
    __OUT uint32_t *ErrorNumber,
    __OUT uint8_t *Flags,
    __OUT uint8_t *RestartEvent,
    __OUT uint32_t *PwrCycles,
    __OUT uint32_t *Bootcount,
    __OUT uint32_t *Time,
    __OUT uint32_t *TotalOnTime,
    __OUT uint8_t *BIOSSel,
    __OUT uint16_t *Status,
    __OUT signed char *CPUtemp,
    __OUT signed char *Boardtemp
);
```

# Description

Get error number history of selected ports from the EC/BMC. The error log buffer stores the power sequence issues, information about the actual state and counters for better tracking of the issues.

The latest entry in the error log buffer is always found on position 0. The previous entry is found on position 1 and so on.

# Parameters

# position

\_\_IN Position points to the log to be read

# \*ErrorNumber

\_OUT Pointer to buffer that stores the Error number. To get the detailed description, use SemaEApiGetErrorNumberDescription.

# \*Flags

Exception Code, selected BIOS and Power Mode.

# \*RestartEvent

\_\_OUT Pointer to buffer that stores the system restart event.

# \*PwrCycles

\_\_OUT Pointer to buffer that stores the value of power cycles counter.

# \*Bootcount

\_\_OUT Pointer to buffer that stores the value of boot counter.

# \*Time

\_\_OUT Pointer to buffer that stores the value of ontime counter in seconds.

# \*TotalOnTime

\_\_OUT Pointer to buffer that stores the value of total on time in minutes.

# \*BIOSSel

\_\_OUT Pointer to buffer that stores the value of BIOS Selected.

# \*Status

\_\_OUT Pointer to buffer that stores the value of status information from BMC status command.

# \*CPUtemp

\_\_OUT Pointer to buffer that stores the value of current CPU temperature.

# \*Boardtemp

\_\_OUT Pointer to buffer that stores the value of current board temperature.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Error log functionality unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Invalid buffers</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Mutex Failure / Read error log failure</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.9.2. SemaEApiBoardGetCurErrorLog

Function Definition
```sql
uint32_t
SEMAEAPI_API
SemaEApiBoardGetCurErrorLog(
__OUT uint32_t *ErrorNumber,
__OUT uint8_t *Flags,
__OUT uint8_t *RestartEvent,
__OUT uint32_t *PwrCycles,
__OUT uint32_t *Bootcount,
__OUT uint32_t *Time,
__OUT uint32_t *TotalOnTime,
__OUT uint8_t *BIOSSel,
__OUT uint16_t *Status,
__OUT signed char *CPUtemp,
__OUT signed char *Boardtemp
);
```

# Description

Get latest error number history from EC/BMC. The error log buffer stores the power sequence issues, information about the actual state and counters for better tracking of the issues.

# Parameters

# \*ErrorNumber

\_\_OUT Pointer to buffer that stores the Error number. To get the detailed description, use SemaEApiGetErrorNumberDescription.

# \*Flags

Exception Code, selected BIOS and Power Mode.

# \*RestartEvent

\_\_OUT Pointer to buffer that stores the system restart event.

# \*PwrCycles

\_\_OUT Pointer to buffer that stores the value of power cycles counter.

# \*Bootcount

\_\_OUT Pointer to buffer that stores the value of boot counter.

# \*Time

\_\_OUT Pointer to buffer that stores the value of ontime counter in seconds.

# \*TotalOnTime

\_\_OUT Pointer to buffer that stores the value of total on time in minutes.

# \*BIOSSel

\_\_OUT Pointer to buffer that stores the value of BIOS Selected.

# \*Status

\_\_OUT Pointer to buffer that stores the value of status information from BMC status command.

# \*CPUtemp

\_\_OUT Pointer to buffer that stores the value of current CPU temperature.

# \*Boardtemp

\_\_OUT Pointer to buffer that stores the value of current board temperature.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Error log functionality unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Invalid buffers</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Mutex Failure / Read error log failure</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.9.3. SemaEApiBoardGetErrorNumberDescription

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiBoardGetErrorNumberDescription(
    __IN uint32_t ErrorNum, /* Pos */
    __OUT uint8_t *pBuffer /* Buffer */
```

# Description

Returns the Exception code string corresponding to the error number.

# Parameters

Id

\_\_IN Valid Error Number. This should be taken from the

SemaEApiBoardGetErrorLog.

\*pBuffer

\_\_OUT Pointer to a buffer that receives Error number description.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Error log functionality unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Invalid buffer or Error number less than 1</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Mutex Failure / Read error number description failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.10. BIOS Information

• Allows configuring the BIOS source mode such as External BIOS, Standard BIOS, or Fail-Safe BIOS.
• Used to control system boot behaviour and enable recovery or redundancy mechanisms.

# 6.10.1. SemaEApiGetBIOSSource

Function Definition
```txt
uint32_t
SEMAEAPI_API
SemaEApiGetBIOSSource (
__OUT uint8_t *bit0,    /* Buffer */
__OUT uint8_t *bit1    /* Buffer */
);
```

# Description

To get the BIOS Source.

# Parameters

\*bit0

\_\_OUT Pointer to buffer that receives the data of Bit 0.

\*bit1

\_\_OUT Pointer to buffer that receives the data of Bit 1.

<table><tr><td>bit 1</td><td>bit 0</td><td>Description</td></tr><tr><td>0</td><td>0</td><td>BIOS selected by hardware configuration</td></tr><tr><td>0</td><td>1</td><td>Switch to Fail-safe BIOS</td></tr><tr><td>1</td><td>0</td><td>Switch to External BIOS (SPI0 on carrier)</td></tr><tr><td>1</td><td>1</td><td>Switch to Internal BIOS (SPI0 on Module)</td></tr></table>

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Invalid buffers</td><td>EAPI_STATUS_MORE_DATA</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Read Failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.10.2. SemaEApiSetBIOSSource

Function Definition
```txt
uint32_t
SEMAEAPI_API
SemaEApiSetBIOSSource (
    __IN uint8_t bit0, /* Buffer */
    __IN uint8_t bit1 /* Buffer * );
```

# Description

To set the BIOS Source.

# Parameters

bit0

\_\_IN Pointer to buffer that receives the data of Bit 0.

bit1

\_\_IN Pointer to buffer that receives the data of Bit 1.

<table><tr><td>bit 1</td><td>bit 0</td><td>Description</td></tr><tr><td>0</td><td>0</td><td>BIOS selected by hardware configuration</td></tr><tr><td>0</td><td>1</td><td>Switch to Fail-safe BIOS</td></tr><tr><td>1</td><td>0</td><td>Switch to External BIOS (SPI0 on carrier)</td></tr><tr><td>1</td><td>1</td><td>Switch to Internal BIOS (SPI0 on Module)</td></tr></table>

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Invalid bits</td><td>EAPI_STATUS_MORE_DATA</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Read Failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.10.3. SemaEApiGetBiosSourceSts

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiGetBiosSourceSts (
__OUT uint8_t *bit0,    /* Buffer */
__OUT uint8_t *bit1    /* Buffer */
__OUT uint8_t *bit2    /* Buffer */
```

# Description

To get the BIOS status. [Supported only for EC boards]

# Parameters

\*bit0

\_\_OUT Pointer to buffer that receives the data of Bit 0.

\*bit1

\_\_OUT Pointer to buffer that receives the data of Bit 1.

\*bit2

\_\_OUT Pointer to buffer that receives the data of Bit 2.

<table><tr><td>bit 2</td><td>bit 1</td><td>bit 0</td><td>Description</td><td>BIOS type</td></tr><tr><td>0</td><td>0</td><td>0</td><td>*M0 Module SPI0 / C1 Carrier SPI1 (Standard BIOS)</td><td rowspan="4">PICMG BIOS selected</td></tr><tr><td>0</td><td>0</td><td>1</td><td>*C0 Carrier SPI0 / M1 Module SPI1 (Fail-Safe BIOS)</td></tr><tr><td>0</td><td>1</td><td>0</td><td>Not PICMG Mode / Unknown</td></tr><tr><td>0</td><td>1</td><td>1</td><td>*M0/M1 (Standard BIOS</td></tr><tr><td>1</td><td>0</td><td>0</td><td>Not Dual BIOS Mode / Unknown</td><td rowspan="4">Dual BIOS selected</td></tr><tr><td>1</td><td>0</td><td>1</td><td>Switch to Fail-safe BIOS</td></tr><tr><td>1</td><td>1</td><td>0</td><td>Switch to External BIOS (SPI0 on carrier)</td></tr><tr><td>1</td><td>1</td><td>1</td><td>Switch to Internal BIOS (SPI0 on Module)</td></tr></table>

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported functionality</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Invalid buffers</td><td>EAPI_STATUS_MORE_DATA</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Read Failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.11. Fan Control

• This functionality allows to monitor and control the fan connected to the CPU or system.
Each fan controller supports 4 temperature trigger levels, each associated with a corresponding PWM value. Whenever a temperature trigger level is crossed, the fan speed is adjusted based on the configured PWM value for that level.
• Helps optimize cooling performance while reducing noise and power consumption.

Fan Id

<table><tr><td>Id</td><td>Description</td></tr><tr><td>SEMA_FAN_CPU</td><td>CPU Fan</td></tr><tr><td>SEMA_FAN_SYSTEM_1</td><td>System Fan</td></tr><tr><td>SEMA_FAN_SYSTEM_2</td><td>System fan 2 (Unsupported for EC boards)</td></tr><tr><td>SEMA_FAN_SYSTEM_3</td><td>System fan 3 (Unsupported for EC boards)</td></tr></table>

Fan Mode

<table><tr><td>FanMode</td><td>Description</td></tr><tr><td>SEMA_FAN_MODE_AUTO</td><td>AUTO (Smart fan)</td></tr><tr><td>SEMA_FAN_MODE_OFF</td><td>OFF</td></tr><tr><td>SEMA_FAN_MODE_ON</td><td>ON</td></tr><tr><td>SEMA_FAN_MODE_SOFT_FAN</td><td>Soft Fan (Smart Fan with Interpolation)</td></tr></table>

Fan Temperature Source

<table><tr><td>TempSrc</td><td>Description</td></tr><tr><td>SEMA_FAN_TEMP_CPU</td><td>CPU Sensor</td></tr><tr><td>SEMA_FAN_TEMP_SYS</td><td>Board Sensor</td></tr></table>

For System fan 1 of COM-HPC boards,

<table><tr><td>TempSrc</td><td>Description</td></tr><tr><td>SEMA_FAN_TEMP_CPU</td><td>CPU Sensor</td></tr><tr><td>SEMA_FAN_TEMP_SYS</td><td>Carrier Sensor</td></tr></table>

# 6.11.1. SemaEApiSmartFanSetTempSetpoints

Func@on Defini@on
```c
uint32_t
SEMAEAPI_API
SemaEApiSmartFanSetTempSetpoints(
    __IN uint32_t FanID, /* Id */
    __IN uint32_t Level1, /* Buffer */
    __IN uint32_t Level2, /* Buffer */
    __IN uint32_t Level3, /* Buffer */
    __IN uint32_t Level4 /* Buffer */
```

# Description

To set temperature setpoints.

# Parameters

# FanID

\_\_IN Refer Fan Id.

# Level1

\_\_IN Pointer to buffer that stores the temperature level 1 setpoint.

# Level2

\_\_IN Pointer to buffer that stores the temperature level 2 setpoint.

# Level3

\_\_IN Pointer to buffer that stores the temperature level 3 setpoint.

# Level4

\_\_IN Pointer to buffer that stores the temperature level 4 setpoint.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported Fan Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Write Failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.11.2. SemaEApiSmartFanGetTempSetpoints

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiSmartFanGetTempSetpoints(
    __IN uint32_t FanID, /* Id */
    __OUT uint32_t *Level1, /* Buffer */
    __OUT uint32_t *Level2, /* Buffer */
    __OUT uint32_t *Level3, /* Buffer */
    __OUT uint32_t *Level4 /* Buffer */
```

# Description

To set temperature setpoints.

# Parameters

FanID

\_\_IN Refer Fan Id.

\*Level1

\_\_IN Pointer to buffer that receives the temperature level 1 setpoint

\*Level2

\_\_IN Pointer to buffer that receives the temperature level 2 setpoint

\*Level3

\_\_IN Pointer to buffer that receives the temperature level 3 setpoint

\*Level4

\_\_IN Pointer to buffer that receives the temperature level 4 setpoint

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported Fan Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Invalid buffers</td><td>EAPI_STATUS_INVAID_PARAMETER</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Read Failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.11.3. SemaEApiSmartFanSetPWMSetpoints

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiSmartFanSetPWMSetpoints(
    __IN uint32_t FanID, /* Id */
    __IN uint32_t Level1, /* Buffer */
    __IN uint32_t Level2, /* Buffer */
    __IN uint32_t Level3, /* Buffer */
    __IN uint32_t Level4 /* Buffer */
```

# Description

To set PWM level triggers corresponding to the Temperature Level setpoints.

# Parameters

FanID

\_\_IN Refer Fan Id.

Level1

\_\_IN Pointer to buffer that stores the PWM level 1 trigger.

Level2

\_\_IN Pointer to buffer that stores the PWM level 2 trigger.

Level3

\_\_IN Pointer to buffer that stores the PWM level 3 trigger.

Level4

\_\_IN Pointer to buffer that stores the PWM level 4 trigger.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported Fan Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Write Failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.11.4. SemaEApiSmartFanGetPWMSetpoints

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiSmartFanGetPWMSetpoints(
    __IN uint32_t FanID, /* Id */
    __OUT uint32_t *pLevel1, /* Buffer */
    __OUT uint32_t *pLevel2, /* Buffer */
    __OUT uint32_t *pLevel3, /* Buffer */
    __OUT uint32_t *pLevel4 /* Buffer */
```

# Description

Returns the PWM level triggers corresponding to the Temperature Level setpoints.

# Parameters

FanID

\_\_IN Refer Fan Id.

\*pLevel1

\_\_IN Pointer to buffer that receives the PWM level 1 trigger.

\*pLevel2

\_\_IN Pointer to buffer that receives the PWM level 2 trigger.

\*pLevel3

\_\_IN Pointer to buffer that receives the PWM level 3 trigger.

\*pLevel4

\_\_IN Pointer to buffer that receives the PWM level 4 trigger.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported Fan Id</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Invalid buffers</td><td>EAPI_STATUS_INVAID_PARAMETER</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Read Failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.11.5. SemaEApiSmartFanSetMode

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiSmartFanSetMode(
    __IN uint32_t FanID, /* Id */
    __IN uint32_t pFanMode /* Buffer */
```

# Description

To set fan mode.

# Parameters

FanID

\_\_IN Refer Fan Id.

# pFanMode

\_\_IN Refer Fan Mode.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported Fan Id / Fan mode</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Write Failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.11.6. SemaEApiSmartFanGetMode

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiSmartFanGetMode(
    __IN uint32_t FanID, /* Id */
    __OUT uint32_t *pFanMode /* Buffer */
```

# Description

To get fan mode.

# Parameters

FanID

\_\_IN Refer Fan Id.

# pFanMode

\_\_OUT Refer Fan Mode.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported Fan Id / Fan mode</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Read Failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.11.7. SemaEApiSmartFanSetTempSrc

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiSmartFanSetTempSrc(
    __IN uint32_t FanID, /* Id */
    __IN uint32_t pTempSrc /* Buffer */
```

# Description

To set temperature source of the specific fan Id.

# Parameters

FanID

\_\_IN Refer Fan Id.

# pTempSrc

\_IN Pointer to buffet that stores the temperature source. Refer Fan Temperature Source.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported Fan Id / Fan mode</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Write Failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.11.8. SemaEApiSmartFanGetTempSrc

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiSmartFanGetTempSrc(
    __IN uint32_t FanID, /* Id */
    __OUT uint32_t *pTempSrc /* Buffer */
```

# Description

To get fan mode.

# Parameters

FanID

\_\_IN Refer Fan Id.

# \*pTempSrc

\_\_OUT Pointer to buffer that receives the temperature source. Refer Fan

Temperature Source.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported Fan Id / Fan mode</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Read Failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.12. Backlight

Enables control of display backlight brightness levels.
• Used to adjust visibility and reduce power consumption in embedded displays.

Backlight Id

<table><tr><td>Id</td><td>Description</td></tr><tr><td>EAPI_ID_BACKLIGHT_1</td><td>Backlight Local Flat Panel 1</td></tr></table>

PWM Level

<table><tr><td>Backlight Enable values</td><td>Description</td></tr><tr><td>1</td><td>Requests/Signifies that the Backlight be Enabled</td></tr><tr><td>0</td><td>Requests/Signifies that the Backlight be Disabled</td></tr></table>

# 6.12.1. SemaEApiVgaSetBacklightEnable

Function Definition
```txt
uint32_t
SEMAEAPI_API
SemaEApiVgaSetBacklightEnable (
    __IN uint32_t PanelId , /* Backlight Id */
    __IN uint8_t PWMLevel /* Backlight Enable */
);
```

# Description

Enables the backlight of the selected flat panel display and set brightness level 200 by default.

# Parameters

# PanelId

\_\_IN Refer Backlight Id.

# PWMLevel

\_\_IN Pointer to a buffer that stores the current backlight enable state. Refer PWM

Level.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported functionality</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Invalid buffers</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Write Failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.12.2. SemaEApiVgaGetBacklightEnable

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiVgaGetBacklightEnable (
    __IN uint32_t PanelId, /* Backlight Id */
    __OUT uint8_t *PWMLevel /* Backlight Enable */
);
```

# Description

Get the backlight enable status of the selected flat panel display.

# Parameters

# PanelId

\_\_IN Refer Backlight Id.

# PWMLevel

\_\_OUT Pointer to a buffer that receives the current backlight enable state. Refer PWM Level.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported functionality</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Invalid buffers</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Write Failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.12.3. SemaEApiVgaSetBacklightBrightness

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiVgaSetBacklightBrightness(
    __IN uint32_t PanelId, /* Backlight Id */
    __IN uint8_t PWMLevel /* Backlight Enable */
);
```

# Description

Sets the brightness of the selected flat panel display to desired level.

# Parameters

# PanelId

\_\_IN Refer Backlight Id.

# PWMLevel

\_\_IN Pointer to a buffer that stores the Backlight brightness level. The range of PWM Level is from 0 to 255.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported functionality</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Invalid buffers</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Write Failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.12.4. SemaEApiVgaGetBacklightBrightness

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiVgaGetBacklightBrightness(
    __IN uint32_t PanelId, /* Backlight Id */
    __OUT uint8_t *PWMLevel /* Backlight Enable */
);
```

# Description

Reads the current brightness of the selected flat panel display.

# Parameters

# PanelId

\_\_IN Refer Backlight Id.

# PWMLevel

\_\_OUT Pointer to a buffer that stores the Backlight brightness level. The range of PWM Level is from 0 to 255.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Unsupported functionality</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Invalid buffers</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Read Failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.13 Exception Description

• Provides detailed descriptions of error and exception codes returned by APIs.
• Helps developers quickly diagnose failures and understand error conditions.

# 6.13.1 SemaEApiBoardGetExcepDesc

Function definition
```c
uint32_t
EAPI_CALLTYPE
SemaEApiBoardGetExcepDesc(
    __IN uint32_t Exceptioncode, /* Exception code */
    __OUT char *pBuf /* Buffer */
    __INOUT uint32_t size /* size in bytes */
);
```

# Description

To get text information of the Exception code

# Parameters

# Exceptioncode

\_\_IN The Error number (Exception Code).

\*pBuf

\_\_OUT Pointer to buffer that receives Error number.

size

\_\_INOUT Size of pBuf in bytes.

Return Status Code

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Invalid buffer</td><td>EAPI_STATUS_INVALID_PARAMETER</td></tr><tr><td>Read exception description failed</td><td>EAPI_STATUS_ERROR</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr></table>

# 6.14. SMBus Slave Device Access

# 6.14.1. SemaEApiSMBReadTrans

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiSMBReadTrans (
    __IN uint32_t Id, /* Bus Id*/
    __IN uint16_t Addr, /* Encoded 7Bit SMBus Device Address */
    __IN uint32_t Cmd, /* SMBus Device command */
    __OUT void *pBuffer, /* Read Data pBuffer */
    __IN uint32_t BufLen, /* Data pBuffer Length */
    __IN uint32_t ByteCnt /* Number of Bytes to Read*/
```

# Description

Reads from a specific register in the selected SMBus device.

Reads from SMBus device at the SMBus address (Addr) and stores in the buffer

pBuffer while using the device specific command Cmd.

# Parameters

Id

\_\_IN For SMBus Transfer, Id=0.

Addr

\_\_ IN Encoded 7-bit SMBus device address. Refer hardware manual.

Cmd

\_\_IN Encoded SMBus Device Command / Index.

\*pBuffer

\_\_OUT Pointer to a buffer that receives the read data.

BufLen

\_\_IN BufLen is 2 for ReadWord.

BufLen is 32 for ReadBlock operation.

BufLen is 1 for ReadByte operation.

ByteCnt

\_\_IN Size (in bytes), of the information read to the buffer pointed to by pBuffer.

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Invalid buffers / SMBus functionality unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Read Failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 6.14.2. SemaEApiSMBWriteTrans

Function Definition
```c
uint32_t
SEMAEAPI_API
SemaEApiSMBWriteTrans (
    __IN uint32_t Id , /* Bus Id*/
    __IN uint32_t Addr , /* Encoded 7/10Bit I2C Device Address */
    __IN uint32_t Cmd , /* I2C Command/Offset */
    __IN void *pBuffer , /* Data buffer */
    __IN uint32_t BufLen , /* Buffer Length */
    __IN uint32_t ByteCnt /* Byte Count to write */
);
```

# Description

Writes to a specific register in the selected SMBus device.

Parameters
```txt
Id
_IN For SMBus Transfer, Id=0.
Addr
_IN Encoded 7-bit SMBus Slave device address.
```

```txt
Cmd
_IN Encoded SMBus Device Command / Index.
```

```txt
*pBuffer
_IN Pointer to a buffer that stores the data to be read.
```

```txt
BufLen
_IN BufLen is 2 for WriteWord.
BufLen is 1 for WriteByte operation.
```

```txt
ByteCnt
_IN Size (in bytes), of the buffer pointed to by the pBuffer parameter.
```

Return Status

<table><tr><td>Condition</td><td>Return Value</td></tr><tr><td>Library uninitialized</td><td>EAPI_STATUS_NOT_INITIALIZED</td></tr><tr><td>Invalid buffers / SMBus functionality unsupported</td><td>EAPI_STATUS_UNSUPPORTED</td></tr><tr><td>Success</td><td>EAPI_STATUS_SUCCESS</td></tr><tr><td>Mutex Failure / Read Failure</td><td>EAPI_STATUS_ERROR</td></tr></table>

# 7. Data Interpretation

# 7.1. Specification Version

Definition

<table><tr><td>Bits</td><td>Description</td></tr><tr><td>[31:24]</td><td>Version</td></tr><tr><td>[23:16]</td><td>Revision</td></tr><tr><td>[15:0]</td><td>0</td></tr></table>

Example

<table><tr><td>Hex</td><td>Interpreted</td></tr><tr><td>0x01000000</td><td>1.0.0</td></tr></table>

# 7.2. General Version

Definition

<table><tr><td>Bits</td><td>Description</td></tr><tr><td>[31:24]</td><td>Major Version</td></tr><tr><td>[23:16]</td><td>Minor Version</td></tr><tr><td>[15:0]</td><td>Build Number</td></tr></table>

Example

<table><tr><td>Hex</td><td>Interpreted</td></tr><tr><td>0x05000000</td><td>5.0.0</td></tr><tr><td>0x0402000C</td><td>4.2.12</td></tr></table>

# 8. Annexure

# 8.1. Restart Event

<table><tr><td>Code</td><td>Code name</td><td>Description</td></tr><tr><td>0x00</td><td>SEMA_SRE_UNKNOWN</td><td>Unknown reason of restart (shown only on first BMC power-up)</td></tr><tr><td>0x20</td><td>SEMA_SRE_SW_RESET</td><td>A reset by software caused the restart of the system</td></tr><tr><td>0x30</td><td>SEMA_SRE_HW_RESET</td><td>A reset by hardware caused the restart of the system (e.g.: Reset button)</td></tr><tr><td>0x40</td><td>SEMA_SRE_WATCHDOG</td><td>The watchdog has restarted the system</td></tr><tr><td>0x50</td><td>SEMA_SRE_BIOS_FAULT</td><td>Standard BIOS is corrupted -&gt; boot from Fail-Safe BIOS</td></tr><tr><td>0x60</td><td>SEMA_SRE_PWR_DOWN</td><td>The system was shut down (e.g. power button, ACPI shutdown)</td></tr><tr><td>0x70</td><td>SEMA_SRE_PWR_LOSS</td><td>The system was restarted after a power loss (e.g. external power supply instable or switched off while the system was running)</td></tr><tr><td>0x80</td><td>SEMA_SRE_PWR_CYCLE</td><td>The system is restarted after a power cycle (e.g. internal power supply has failed)</td></tr><tr><td>0x90</td><td>SEMA_SRE_VIN_DROP</td><td>The system is restarted after a voltage drop of the main input voltage</td></tr><tr><td>0xA0</td><td>SEMA_SRE_PWR_FAIL</td><td>The system is restarted after a power fail detection of an internal power supply circuit</td></tr><tr><td>0xB0</td><td>SEMA_SRE_CRIT_TEMP</td><td>The system was shut down by ACPI watchdog (CPU reached critical temperature)</td></tr><tr><td>0xC0</td><td>SEMA_SRE_WAKEUP</td><td>The system has received a wake event and resumes operation from a sleep</td></tr></table>

# 8.2. Firmware Capability

Firmware capabilities describe the functions that can be supported on the platform:

When bit value goes to 1, it indicates enabled
When bit value goes to 0, it indicates disabled

<table><tr><td>Bit</td><td>Description</td></tr><tr><td>Bit 0</td><td>Uptime &amp; power cycles counter</td></tr><tr><td>Bit 1</td><td>System restart event</td></tr><tr><td>Bit 2</td><td>User flash size (0=512 bytes, 1=1024 bytes)</td></tr><tr><td>Bit 3</td><td>Runtime Watchdog</td></tr><tr><td>Bit 4</td><td>Temperatures</td></tr><tr><td>Bit 5</td><td>Voltage monitor</td></tr><tr><td>Bit 6</td><td>Storage of failure reason (Old SEMA support)</td></tr><tr><td>Bit 7</td><td>Boot loader timeout programmable (Old SEMA support)</td></tr><tr><td>Bit 8</td><td>Display Backlight control</td></tr><tr><td>Bit 9</td><td>Power up watchdog</td></tr><tr><td>Bit 10</td><td>Power monitor (Current sense)</td></tr><tr><td>Bit 11</td><td>Boot counter</td></tr><tr><td>Bit [13:12]</td><td>Input-Voltage (00=5V, 01=12V, 10=3V, 11=reserved) [Not supported by EC]</td></tr><tr><td>Bit 14</td><td>Rsense of Power monitor (0=8 mR, 1=4 mR) [Not supported by EC]</td></tr><tr><td>Bit 15</td><td>Dual-BIOS</td></tr><tr><td>Bit 16</td><td>I2C bus 1</td></tr><tr><td>Bit 17</td><td>I2C bus 2</td></tr><tr><td>Bit 18</td><td>CPU Fan</td></tr><tr><td>Bit 19</td><td>System Fan 1</td></tr><tr><td>Bit 20</td><td>AT/ATX mode</td></tr><tr><td>Bit 21</td><td>ACPI Thermal trigger</td></tr><tr><td>Bit 22</td><td>Power-up to last state</td></tr><tr><td>Bit 23</td><td>Backlight restore</td></tr><tr><td>Bit 24</td><td>DTS Temperature [Not supported by EC]</td></tr><tr><td>Bit 25</td><td>DTS offset registers [Not supported by EC]</td></tr><tr><td>Bit 26</td><td>System fan 2 [Not supported by EC]</td></tr><tr><td>Bit 27</td><td>System fan 3 [Not supported by EC]</td></tr><tr><td>Bit 28</td><td>Ext GPIO</td></tr><tr><td>Bit 29</td><td>I2C bus 3</td></tr><tr><td>Bit 30</td><td>I2C bus 4</td></tr><tr><td>Bit 31</td><td>BMC is from TIVA type</td></tr></table>

# 8.3. Extended Firmware Capability

<table><tr><td>Bit</td><td>Description</td></tr><tr><td>Bit 32</td><td>Board2 Temperature</td></tr><tr><td>Bit 33</td><td>PEC protocol</td></tr><tr><td>Bit 34</td><td>reserved</td></tr><tr><td>Bit 35</td><td>Error log</td></tr><tr><td>Bit 36</td><td>1-wire bus</td></tr><tr><td>Bit 37</td><td>Wake-by-BMC</td></tr><tr><td>Bit 38</td><td>GPIO alternate function</td></tr><tr><td>Bit 39</td><td>Soft Fan</td></tr><tr><td>Bit 40</td><td>Parameter memory</td></tr><tr><td>Bit 41</td><td>Extended I2C registers for status and data</td></tr><tr><td>Bit 42</td><td>Ext GPIO Input Interrupt (Supported only for EC boards)</td></tr><tr><td>Bit 43</td><td>Hardware Monitor Input String (Supported only for EC boards)</td></tr><tr><td>Bit 44</td><td>Ext-GPIO Pins Count (Supported only for EC boards)</td></tr><tr><td>Bit 45</td><td>Power-up Watchdog / Runtime Watchdog support action setting (Supported only for EC boards)</td></tr><tr><td>Bit 46</td><td>Switch BIOS immediately (Supported only for EC boards)</td></tr></table>

# 8.4. EC/BMC Flags

<table><tr><td>Bit</td><td></td><td>Description</td></tr><tr><td rowspan="2">Bit 7</td><td>0</td><td>Standard BIOS is active</td></tr><tr><td>1</td><td>Fail-Safe BIOS is active</td></tr><tr><td rowspan="2">Bit 6</td><td>0</td><td>AT mode</td></tr><tr><td>1</td><td>ATX mode</td></tr><tr><td>Bit 0 - 4</td><td colspan="2">Exception Code. Refer EApiBoardGetExcepDesc.</td></tr></table>

# 8.5. Sample Code

# 8.5.1. To retrieve Board name

```c
// Test Application
#include &lt;string.h&gt;
#include &lt;stdio.h&gt;
#include "EApi.h"

int main (int argc, char* argv[])
{
    uint32_t eRet;
    unsigned char pData[100] = { 0 };
    unsigned int buflen = 100;

    // EAPI Library Initialization
    eRet = EApiLibInitialize();
    if (eRet != EAPI_STATUS_INITIALIZED)
    {
    printf("\nEapi Library not initialized\n");
    return -1;
    }

    // Read Board Name
    eRet = EApiBoardGetStringA (EAPI_ID_BOARD_NAME_STR, pData, &buflen);
    if (eRet == EAPI_STATUS_SUCCESS) {
    printf("\nBoard Name: %s\n ", pData);
    }
    else {
    printf("\nEApiBoardGetStringA failed with return code 0x%x ", eRet);
    return -1;
    }

    // To uninitialized the EAPI Library
    eRet = EApiUnInitialize();

    if (eRet == EAPI_STATUS_SUCCESS)
    {
    return 0;
    }
}
```

8.5.2. To demonstrate I2C read and write using transfer functions (Linux)
```c
// Test Application (Assuming EEPROM is connected in I2C Bus 4 and 7-bit address 0x50)
#include &lt;string.h&gt;
#include &lt;stdio.h&gt;
#include "EApi.h"
int main (int argc, char* argv[]) {
    uint32_t eRet, BusID= 4, cmd= 0x00, BufLen= 2, nByteCnt= 2;
    uint16_t Address = 0x50;
    unsigned char Rdbuffer[2] = {0x0,0x0}, pBuffer[2] = {0xb,0xc};

    // EAPI Library Initialization
    eRet = EApiLibInitialize();
    if (eRet != EAPI_STATUS_INITIALIZED) {
    printf("\nEapi Library not initialized\n");
    return -1;
    }

    // To write 2 bytes into EEPROM
    eRet = EApiI2CWriteTransfer (BusID - 1, Address, cmd, pBuffer, nByteCnt);
    if (eRet == EAPI_STATUS_SUCCESS) {
    printf("\nI2CWriteTransfer success at address 0x%02x", Address);
    } else {
    printf("\nI2CWriteTransfer failed; Return code 0x%x ", eRet);
    return -1;
    }

    // To read 2 bytes from EEPROM
    eRet = EApiI2CReadTransfer (BusID - 1, Address, cmd, \
    Rdbuffer, BufLen, nByteCnt);
    if (eRet == EAPI_STATUS_SUCCESS) {
    printf("\nEApiI2CReadTransfer at address 0x%02x is successful. \nRead data: 0x%02x 0x%02x", Address, Rdbuffer[0], Rdbuffer[1]);
    } else {
    printf("\nI2CReadTransfer failed; Return code 0x%x ", eRet);
    return -1;
    }
    // Uninitializing EAPI Library
    eRet = EApiUnInitialize();
    if (eRet == EAPI_STATUS_SUCCESS)
    return 0;
}
```

8.5.3. To retrieve running time meter value
```c
//Test Application
#include &lt;stdio.h&gt;
#include "eapi.h"

int main(int argc, char* argv[])
{
    uint32_t eRet;
    uint32_t runningTime = 0;

    // EAPI Library Initialization
    eRet = EApiLibInitialize();
    if (eRet != EAPI_STATUS_SUCCESS) {
    printf("EApiLibInitialize failed: 0x%x\n", eRet);
    return -1;
    }

    // Read Running Time Meter
    eRet = EApiBoardGetValue(EAPI_ID_BOARD_RUNNING_TIME_METER_VAL, &runningTime);

    if (eRet == EAPI_STATUS_SUCCESS) {
    printf("Running Time Meter: %u minutes\n", runningTime);
    } else {
    printf("EApiBoardGetValue failed: 0x%x\n", eRet);
    EApiLibUnInitialize();
    return -1;
    }

    // To uninitialized the EAPI Library
    eRet = EApiLibUnInitialize();
    if (eRet != EAPI_STATUS_SUCCESS) {
    printf("EApiLibUnInitialize failed: 0x%x\n", eRet);
    return -1;
    }
    return 0;
}
```

# 9. Appendix

# 9.1. Temperature Conversion

// To convert Celsius to Kelvin, use the below macro.

EAPI\_ENCODE\_CELCIUS(Celsius)

Note: Make sure the Celsius value is in integer data type

// To convert Kelvin to Celsius, use the below macro

EAPI\_DECODE\_CELCIUS(Kelvin)

Note: Make sure the Kelvin value is in integer data type

# 9.2. Error Codes

<table><tr><td>Error Code</td><td>Value</td></tr><tr><td>EAPI_STATUS_SUCCESS</td><td>0</td></tr><tr><td>EAPI_STATUS_ERROR</td><td>0xFFFF0FF</td></tr><tr><td>EAPI_STATUS_MORE_DATA</td><td>0xFFFF9FF</td></tr><tr><td>EAPI_STATUS_WRITE_ERROR</td><td>0xFFFFFAFE</td></tr><tr><td>EAPI_STATUS_READ_ERROR</td><td>0xFFFFFAff</td></tr><tr><td>EAPI_STATUS_BUSY_COLLISION</td><td>0xFFFFBFD</td></tr><tr><td>EAPI_STATUS_TIMEOUT</td><td>0xFFFFBFE</td></tr><tr><td>EAPI_STATUS_NOT_FOUND</td><td>0xFFFFBFF</td></tr><tr><td>EAPI_STATUS_UNSUPPORTED</td><td>0xFFFFFCFF</td></tr><tr><td>EAPI_STATUS_RUNNING</td><td>0xFFFFFEFA</td></tr><tr><td>EAPI_STATUS_INVALID_BITMAP</td><td>0xFFFFFEFB</td></tr><tr><td>EAPI_STATUS_INVALID_DIRECTION</td><td>0xFFFFFEFC</td></tr><tr><td>EAPI_STATUS_INVALID_BLOCK_LENGTH</td><td>0xFFFFFEFD</td></tr><tr><td>EAPI_STATUS_INVALID_BLOCK_ALIGNMENT</td><td>0xFFFFFEFE</td></tr><tr><td>EAPI_STATUS_INVALID_PARAMETER</td><td>0xFFFFFEFF</td></tr><tr><td>EAPI_STATUS_DRIVER_TIMEOUT</td><td>0xFFFFFFC</td></tr><tr><td>EAPI_STATUS_ALLOC_ERROR</td><td>0xFFFFFFFD</td></tr><tr><td>EAPI_STATUS_INITIALIZED</td><td>0xFFFFFFFFFE</td></tr><tr><td>EAPI_STATUS_NOT_INITIALIZED</td><td>0xFFFFFFFFF</td></tr></table>

# 10. FAQs & Troubleshooting

# 1. Do I need kernel drivers to use SEMA EAPI on Linux/Windows?

Yes. SEMA relies on kernel-level drivers (EC, LPC, or I²C related drivers depending on the platform). These drivers must be loaded successfully before running any user-space EAPI application.

# 2. Do the header files need to be present while compiling a SEMA Linux EAPI application?

Yes. During compilation, ensure that eapi.h and conv.h are present. For simplicity, place them in the same directory as the source file. Missing headers will cause compilation to fail.

# 3. Do the header files need to be present while compiling a SEMA Windows EAPI application?

Yes. During compilation, ensure that EApi.h and Error.h are present. For simplicity, place them in the same directory as the source file. Missing headers will cause compilation to fail.

# 4. How to compile and execute the sample code for Linux?

• Install SEMA Linux Unified using the steps mentioned in the Installation Guide.
• Copy the Sample code and name as sample.c. Then in the same folder add conv.h and eapi.h.
Compile the sample.c application using the command:

```txt
$ gcc sample.c -o sample -lsema
```

Run the sample code using the command:

```txt
$ ./sample
```

# 5. How to compile and execute the sample code for Windows?

• Install SEMA Windows using the steps mentioned in the Installation Guide.
Create a C++ desktop application project in Visual studio.
Copy the code and name as sample.c. Then in the same folder add EApi.h, Error.h, SemaEApi.dll and SemaEApi.lib.
• Link the SemaEApi.lib to sample.c using pragma comment or properties.

```lisp
#pragma comment (lib, "SemaEapi.lib")
```

Build the solution file in Release x64 mode.
Run the generated application (sample.exe).

# 6. What are common reasons for EApiLibInitialize() failure in Linux?

# Common causes include:

SEMA kernel driver not loaded
Unsupported or mismatched BIOS/EC/BMC firmware
• Insufficient permissions (Running without root access on Linux)

# 7. What EAPI can be used for I2C repeat start feature in Windows?

SemaEApiI2CWriteReadRaw can be used for I2C repeat start feature.

# 8. Explain the fan modes. What should be the setting of the fan if we require constant rpm value.

# Fan modes:

• Auto – the fan will be automatically controlled using the Trigger Settings described
Off – the fan is turned off completely
On – the fan runs at maximum RPM (PWM level 100%)
• Soft – Auto mode with PWM Level Interpolation (i.e.) The PWM level is not adapted stepwise, but continuously.

Fan mode changed to “On” to get the constant rpm value.