====== x86 EAPI Windows ====== Please note that the EAPI Windows package is only available on request: [[Support@tq-group.com?subject=[EAPI Request] Windows|Request EAPI]] ===== Preface ===== EAPI is intended to be installed on Windows 7 64-bit and Windows 10 64-bit. On Windows 7 KB3033929 update must be installed on the system to support SHA-2 Code Signing Certificate.\\ More information about it is available at:\\ https://technet.microsoft.com/en-us/library/security/3033929.aspx ===== Installation ===== ==== EAPI installation ==== - Decompress the EAPI archive onto an USB drive. - Plugin the USB drive to the Starterkit - Run the Windows command prompt as administrator and navigate into the TqWin64EAPI_R01.0x folder on the USB drive - Execute **install.bat** from the command prompt The installation may fail if windows is configured to prohibit the installation of unsigned drivers. Please see [[.:eapi_windows#disable_windows_driver_signature_verification|Disable Windows driver signature verification]] for more information. ==== EAPI uninstallation ==== - Open Windows Device Manager - Find System Devices->Tq driver. - Select Uninstall and check "Delete the driver software for this device" \\ ==== EAPI verifying installation ==== - Right click on TqDrv.sys file from this package and choose Properties->Details to locate file version. - Make sure that TqDrv.sys file version and driver version in Device Manager are identical. - Make sure that TqDrv.sys file from C:\Windows\System32\drivers is identical to one from this package. ---- ===== EAPI Functions ===== For detailed functions description please refer to PICMG EAPI specification: [[https://www.picmg.org/wp-content/uploads/COM_EAPI_R1_0.pdf|COM_EAPI_R1_0.pdf]]\\ All examples are using the sample application **TqApp.exe**.\\ The TqApp is available in sources and is provided as a part of the EAPI package. ==== EAPI Initialisation ==== The ''EApiLibInitialize'' function has to be called at the beginning of every application.\\ An error will be returned if TQ driver is not installed on the system.\\ \\ The ''EApiLibUnInitialize'' function has to be called at the end of every application. \\ ---- ==== EAPI Information Functions ==== === EApiBoardGetStringA === Supported EAPI ID values: * EAPI_ID_BOARD_MANUFACTURER_STR * EAPI_ID_BOARD_NAME_STR * EAPI_ID_BOARD_REVISION_STR * EAPI_ID_BOARD_SERIAL_STR * EAPI_ID_BOARD_BIOS_REVISION_STR * EAPI_ID_BOARD_HW_REVISION_STR * EAPI_ID_BOARD_PLATFORM_TYPE_STR ++++ Example | **EApiBoardGetStringA ** > TqApp.exe EApiBoardGetStringA 0 Board Manufacturer Name = TQ-Group | ''0'' | Board Manufacturer Name | | ''1'' | Board Name | | ''2'' | Board Revision | | ''3'' | Serial Number | | ''4'' | Board BIOS Revision | | ''5'' | Board HW Revision | | ''6'' | Platform ID | ++++ ---- === EApiBoardGetValue === Supported EAPI ID values: * EAPI_ID_GET_EAPI_SPEC_VERSION * EAPI_ID_BOARD_RUNNING_TIME_METER_VAL * EAPI_ID_BOARD_DRIVER_VERSION_VAL * EAPI_ID_BOARD_LIB_VERSION_VAL * EAPI_ID_HWMON_CPU_TEMP * EAPI_ID_HWMON_SYSTEM_TEMP * EAPI_ID_HWMON_VOLTAGE_3V3 * EAPI_ID_HWMON_VOLTAGE_VBAT * EAPI_ID_HWMON_VOLTAGE_5VSB * EAPI_ID_HWMON_VOLTAGE_12V * EAPI_ID_HWMON_FAN_CPU * EAPI_ID_HWMON_FAN_SYSTEM ++++ Supported Values for EApiBoardGetValue function | | ''0'' | EAPI Specification Version | | ''1'' | Boot Counter | | ''2'' | Running Time Meter | | ''3'' | Board vendor PNPID | | ''4'' | Platform Specification Version | | ''5'' | Vendor Specific Driver Version | | ''6'' | Vendor Specific Library Version | | ''7'' | CPU Temperature in °C | | ''8'' | Chipset Temperature in °C | | ''9'' | System Temperature in °C | | ''10'' | CPU Core Voltage | | ''11'' | 2.5V Voltage | | ''12'' | 3.3V Voltage | | ''13'' | Battery Voltage | | ''14'' | 5V Voltage | | ''15'' | 5V Standby Voltage | | ''16'' | 12V Voltage | | ''17'' | CPU Fan in RPM | | ''18'' | System Fan in RPM | ++++ ++++ Example | **EApiBoardGetValue **\\ TqApp converts temperature to Celsius for better perception. > TqApp.exe EApiBoardGetValue 7 CPU Temperature = 30.5 ++++ \\ * Temperature sensors values are in 0.1 Kelvin. * Voltage sensors values are in millivolts. * Fan speed values are in RPM. Some EApiBoardGetValue functions are not yet supported on certain modules. ++++ Table of supported functions | • = Supported function ^ ^ TQMx110EB ^ TQMxE40M ^ TQMxE40C1 ^ TQMxE40C2 ^ TQMxE40S | ^0 = EAPI Specification Version | **•** | **•** | **•** | **•** | **•** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ^1 = Boot Counter | ** ** | ** ** | ** ** | ** ** | ** ** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ^2 = Running Time Meter | **•** | **•** | **•** | **•** | **•** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ^3 = Board Vendor PNPID | ** ** | ** ** | ** ** | ** ** | ** ** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ^4 = Platform Specification Version | ** ** | ** ** | ** ** | ** ** | ** ** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ^5 = Vendor Specific Driver Version | **•** | **•** | **•** | **•** | **•** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ^6 = Vendor Specific Library Version | **•** | **•** | **•** | **•** | **•** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ^7 = CPU Temperature | **•** | **•** | **•** | **•** | ** ** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ^8 = Chipset Temperature | ** ** | ** ** | ** ** | ** ** | ** ** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ^9 = System Temperature | **•** | ** ** | ** ** | ** ** | ** ** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ^10 = CPU Core Voltage | ** ** | ** ** | ** ** | ** ** | ** ** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ^11 = 2.5V Voltage | ** ** | ** ** | ** ** | ** ** | ** ** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ^12 = 3.3V Voltage | **•** | ** ** | ** ** | ** ** | ** ** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ^13 = Battery Voltage | **•** | ** ** | ** ** | ** ** | ** ** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ^14 = 5V Voltage | ** ** | ** ** | ** ** | ** ** | ** ** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ^15 = 5V Standby Voltage | **•** | ** ** | ** ** | ** ** | ** ** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ^16 = 12V Voltage | **•** | ** ** | ** ** | ** ** | ** ** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ^17 = CPU Fan | **•** | ** ** | ** ** | ** ** | ** ** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ^18 = System Fan | **•** | ** ** | ** ** | ** ** | ** ** | ^ ::: | ::: | ::: | ::: | ::: | ::: | ++++ ---- ==== EAPI Display Backlight ==== Backlight Functions are only available if a suitable display is connected.\\ Latest Intel(R) HD Graphics driver has be installed on the system.\\ Backlight can only be enabled/disabled via BIOS. Supported Functions | **EApiVgaGetBacklightEnable** | Returns current Backlight Enable state | | **EApiVgaGetBacklightBrightness** | Get Backlight Brightness Value (0-255) | | **EApiVgaSetBacklightBrightness** | Set Backlight Brightness Value (0-255) | \\ ---- ==== EAPI Storage Functions ==== === EEPROM === There are 2 available EEPROMs available on the TQ x86 Starterkits * 0 - Module EEPROM (0xA0 address on I2C bus) * 1 - Carrier EEPROM (0xAE address on I2C bus) ==EApiStorageCap== Function returns Storage Size and Block Length value, needed to calculate write block alignment and size for EApiStorageAreaWrite function. ==EApiStorageAreaRead== ^ EApiStorageAreaRead ^ ID ^ Offset ^ Bytecnt ^ ^ Datatype ^ dec ^ hex ^ dec ^ ++++ Example: | TqApp.exe EApiStorageAreaRead 0 0 32 EApiStorageAreaRead() successfully read data: | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F -----|----------------------------------------------- 0000 | 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ................ 0010 | 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f ................ ++++ ==EApiStorageAreaWrite== Offset and ByteCnt parameters must be a multiple of Block Length value that is returned by EApiStorageCap function. ^ EApiStorageAreaWrite ^ ID ^ Offset ^ Data ^ ^ Datatype ^ dec ^ hex ^ hex .... hex ^ ++++ Example: | > EApiStorageAreaWrite 0 0x20 " 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31" > TqApp.exe EApiStorageAreaWrite 0 0x20 "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31" ++++ ---- ==== EAPI I2C Bus Functions ==== The current frequency is defined in Windows registry:\\ **HKLM\SYSTEM\CurrentControlSet\Services\TqDrv\Parameters\I2cBusSpeed**\\ 100KHz are set as default frequency, the following frequencies are available for the primary CPLD I2C Bus: * 50KHz * 100KHz * 400KHz After changing I2C frequency in Windows registry, Tq driver must be reset in Windows Device Manager: - Open Windows Device Manager -> System Devices -> TqDriver - Right Click on TqDriver and select "Disable" - Right click on TqDriver and select "Enable ==EApiI2CWriteReadRawr== ^ EApiI2CWriteReadRaw ^ bus_id ^ i2c_addr ^ string_to_write ^ bytes_to_read ^ ^ Datatype ^ dec ^ hex ^ hex ... hex ^ dec ^ To ignore write operation: = ""\\ To ignore read operation: = 0 ++++ Example: | Write 2 bytes: 0x00 0x00; Read 10 bytes > TqApp.exe EApiI2CWriteReadRaw 0 AE "0 0" 10 EApiI2CWriteReadRaw() completed successfully WriteData: | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F -----|----------------------------------------------- 0000 | 00 00 .. ReadData: | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F -----|----------------------------------------------- 0000 | 00 01 02 03 04 05 06 07 08 09 .......... Read 5 bytes: > TqApp EApiI2CWriteReadRaw 0 AE "" 5 EApiI2CWriteReadRaw() completed successfully ReadData: | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F -----|----------------------------------------------- 0000 | 0a 0b 0c 0d 0e ..... Write 6 bytes: 0x00 0x03 0x45 0xA7 0xB8 0x12 > TqApp.exe EApiI2CWriteReadRaw 0 AE "0 3 45 A7 B8 12" 0 EApiI2CWriteReadRaw() completed successfully WriteData: | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F -----|----------------------------------------------- 0000 | 00 03 45 a7 b8 12 ..Eº+. ++++ ==EApiI2CReadTransfer | EApiI2CWriteTransfer== ^ EApiI2CReadTransfer ^ bus_id ^ i2c_addr ^ cmd ^ type ^ bytes_to_read ^ ^ EApiI2CWriteTransfer ^ bus_id ^ i2c_addr ^ cmd ^ type ^ bytes_to_write ^ ^ Datatype ^ dec ^ hex ^ hex ^ hex ^ dec ^ where 'type' = 0/1/2 (No Command/ Standard Command/ Extended Command) ++++ Examples | Read 12 bytes with No Command > TqApp.exe EApiI2CReadTransfer 0 AE 0 0 12 EApiI2CReadTransfer() completed successfully ReadData: | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F -----|----------------------------------------------- 0000 | 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 ............ Read 3 bytes with Extended Command = 0x10F3 > TqApp.exe EApiI2CReadTransfer 0 AE 1B2 2 3 EApiI2CReadTransfer() completed successfully ReadData: | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F -----|----------------------------------------------- 0000 | f3 f4 f5 =() Write 1 byte 0x17 with No Command > TqApp.exe EApiI2CWriteTransfer 0 AE 0 2 "A B C D E" EApiI2CWriteTransfer(): completed successfully WriteData: | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F -----|----------------------------------------------- 0000 | 0a 0b 0c 0d 0e ..... ++++ ---- ==== EAPI Watchdog Functions ==== ==EApiWDogStart== Delay mode is not supported. Event mode and Reset mode are supported. ++++ List of possible Watchdog timeout values | * 0.125s * 0.250s * 0.500s * 1s * 2s * 4s * 8s * 16s * 32s * 64s * 128s * 256s * 512s * 1024s * 2048s * 4096s ++++ If timeout falls between these values, the closest top value will be used: For Example:\\ For 10 seconds - 16 secnds will be used.\\ For 683 seconds - 1024 seconds will be used. == Event Mode == Event timeout must be defined, other Timeout values must be 0.\\ 2 interrupt lines are supported: 10 and 11.\\ Default line is 11.\\ Interrupt number must be defined in 2 places: * Windows registry: HKLM\SYSTEM\CurrentControlSet\Services\TqDrv\Parameters\WdtInterrupt * TQ driver resources in Device Manager To change IRQ line you need to change it in 2 places. After that you need to reset Tq driver in Windows Device Manager: * Open Windows Device Manager and find System Devices/ TqDriver * Right Click on TqDriver and choose "Disable", then reenable it == Reset mode == Reset timeout must be defined, other Timeout values must be 0.\\ Following reset modes are supported:\\ 1 = watchdog reset output triggers hard reset signal\\ 0 = watchdog reset output triggers power-on button\\ Reset mode is definded in Windows Registry, default value is 1. HKLM\SYSTEM\CurrentControlSet\Services\TqDrv\Parameters\WdtReset == Dual-Stage Mode == In dual-stage mode (Event + Reset) Event timeout will be used for both stages. Event timeout must be defined, reset timeout must not equal zero.\\ EApiWDogStart \\ Time must be specified in ms.\\ Example: EApiWDogStart 0 15200 1000 ---- ==== GPIO ==== The number of GPIOs depends on the used module! \\ The EAPI library defines two different mechanisms to address GPIO: pin addressing and bank addressing.\\ Function **EAPI_GPIO_BANK_ID(GPIO_NUM)** is used to define the GPIO bank. == EApiGPIOGetDirection == TqApp function **EApiGPIOGetDirection**uses bank addressing. ++++ Example: | TqApp.exe EApiGPIOGetDirection -h EApiGPIOGetDirection , Bank is a group of 32 pins addressed simultaneously. \\ TqApp.exe EApiGPIOGetDirection 0 Bank 0: DIRECTION = 0xff ++++ == EApiGPIOSetDirection == EApiGPIOSetDirection uses pin addressing. ^ GPIO Direction ^ Value ^ | Output | 0 | | Input | 1 | Example:\\ Setting pin 2 to output > TqApp.exe EApiGPIOSetDirection 2 0 == EApiGPIOSetLevel == EApiGPIOSetLevel uses bank addressing, where is a group of 32 pins addressed simultaneously. Example: > TqApp.exe EApiGPIOsetLevel 4 1 == EApiGPIOGetLevel == EApiGPIOGetLevel uses bank addressing, where is a group of 32 pins addressed simultaneously. Example: > TqApp.exe EApiGPIOGetLevel 0 Bank 0: LEVEL = 0xfb ---- ==== TQ Library Functions ==== == TqWdtWaitForInterrupt == This function detects Watchdog interrupts, there is a standalone application for TqWdtWaitForInterrupt because it’s not part of EAPI. ++++ Examples | CMD1: > WdtWaitForInterrupt.exe CMD2: > TqApp.exe EApiWDogStart 0 10000 0 After 16 seconds CMD1 will output "Watchdog interrupt was caught" ++++ \\ \\ ===== Known Issues ===== === EEPROM === * I2C EEPROM may be unstable if I2C bus speed is set to 400KHz. Recommended I2C bus speed is 100KHz. * EEPROM access is unstable, e.g. when some data is written to I2C EERPOM it may get written to wrong offset. Usually it happens after large number (thousands) of successive write operations to the EEPROM, or while reading EEPROM in big chunks. Most likely it is a h/w issue of particular model of EEPROM. \\ === Disable Windows Driver Signature Verification === 1. Open Windows Command Promt with Admin rights \\ 2. Enable "Test Mode": bcdedit /set testsigning on 3. Restart your System \\ 4. After restarting, "Test Mode" should be displayed at the bottom right of the desktop. Now the TQ EAPI can be installed as described under [[.:eapi_windows#eapi_installation|EAPI installation]]. \\ 5. After the installation the "Test Mode" can be terminated again: bcdedit /set testsigning off 6. Reboot the system to apply the configuration