Table of Contents

x86 EApi

Windows version

Installation

First you have to open command prompt as dmin and navigate to the folder containing the installation files. Then start the 'install.batch' from the command prompt.

Before reinstalling you have to uninstall 'TqDriver' from within the Device manager!

Initialisation

EApiLibInitialize Function must be called at the beginning of every application. It will return Error if TQ driver is not installed.
EApiLibUnInitialize Function must be called at the end of every application.

Information

EApiBoardGetStringA <string id>

Example

EApiBoardGetValue <value id>

Example

Backlight

Backlight Functions are available only if suitable display is connected. Latest Intel(R) HD Graphics driver must be installed on the system.

EApiVgaBacklightEnable
EApiVgaGetBacklightBrightness Backlight Brightness Intervall 0 - 255.
EApiVgaSetBacklightBrightness Backlight Brightness Intervall 0 - 255.

Storage

There are 2 available EEPROMs:

EApiStorageCap
EApiStorageAreaRead
EApiStorageAreaRead ID Offset Bytecnt
Datatype dec hex dec

Example:

EApiStorageAreaWrite
EApiStorageAreaWrite ID Offset Data
Datatype dec hex hex …. hex

Example:

I2C

The current frequency is defined in Windows registry:

HKLM\SYSTEM\CurrentControlSet\Services\TqDrv\Parameters\I2cBusSpeed

Default Frequency is 100KHz, the following frequencies are available on the primary CPLD I2C Bus:

After changing I2C frequency in Windows registry, you need to reset Tq driver in Windows Device Manager:

EApiI2CWriteReadRawr
EApiI2CWriteReadRaw bus_id i2c_addr string_to_write bytes_to_read
Datatype dec hex hex … hex dec

To ignore write operation: <string_to_write> = “”
To ignore read operation: <bytes_to_read> = 0

Example:

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

Watchdog Functions

EApiWDogStart

Delay mode is not supported. Event mode and Reset mode are supported.

List of possible Watchdog timeout values

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:

To change IRQ line you need to change it in 2 places. After that you need to reset Tq driver in Windows Device Manager:

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 <Delay> <EventTimeout> <ResetTimeout>
Time must be specified in ms.
Example:

EApiWDogStart 0 15200 1000

GPIO

ON TQ Boards, 8 GPIO's are available, all of which can be input or output. The EApi library defines two different mechanisms to address GPIO: pin addressing and bank addressing. EAPI_GPIO_BANK_ID(GPIO_NUM) is used to define the GPIO bank.

EApiGPIOGetDirection

EApiGPIOGetDirection <bank> uses bank addressing, where <bank> is a group of 32 pins addressed simultaneously. Example:

> TqApp.exe EApiGPIOGetDirection 0
Bank 0: DIRECTION = 0xff
EApiGPIOSetDirection

EApiGPIOSetDirection <Pin> <Direction> uses pin addressing. <Direction> == 0 means Output, otherwise Input
Example:
Setting pin 2 to output

> TqApp.exe EApiGPIOSetDirection 2 0
EApiGPIOSetLevel

EApiGPIOSetLevel <bank> uses bank addressing, where <bank> is a group of 32 pins addressed simultaneously. Example:

> TqApp.exe EApiGPIOsetLevel 4 1
EApiGPIOGetLevel

EApiGPIOGetLevel <bank> uses bank addressing, where <bank> 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

Known Issues

Windows