Difference between revisions of "SW Service/API/SUSI4.0 USER MANUAL"

From ESS-WIKI
Jump to: navigation, search
Line 625: Line 625:
  
 
|}
 
|}
 
  
  
Line 663: Line 662:
  
 
|}
 
|}
 
 
  
 
== 3.2 Information Functions ==
 
== 3.2 Information Functions ==

Revision as of 10:21, 14 November 2016

[edit]

SUSI – A Bridge to Simplify & Enhance H/W & Application Implementation Efficiency

When developers want to write an application that involves hardware access, they have to study the specifications to write the drivers. This is a time-consuming job and requires lots of expertise.

Advantech has done all the hard work for our customers with the release of a suite of Software APIs (Application Programming Interfaces), called Secured & Unified Smart Interface (SUSI).

SUSI provides not only the underlying drivers required but also a rich set of user-friendly, intelligent and integrated interfaces, which speeds development, enhances security and offers add-on value for Advantech platforms. SUSI plays the role of catalyst between developer and solution, and makes Advantech embedded platforms easier and simpler to adopt and operate with customer applications.


1.1 Functions

1.1.1 GPIO

1.1.1 GPIO.png

General Purpose Input/Output is a flexible parallel interface that allows a variety of custom connections. It supports various Digital I/O devices – input devices like buttons, switches; output devices such as cash drawers, LED lights…etc. And, allows users to monitor the level of signal input or set the output status to switch on/off the device. Our APIs also provided Programmable GPIO and allows developers to dynamically set the GPIO input or output status.


1.1.2 SMBus

1.1.2 SMBus.png

SMBus is the System Management Bus defined by Intel® Corporation in 1995. It is used in personal computers and servers for low-speed system management communications. Today, SMBus is used in all types of embedded systems. The SMBus APIs allows a developer to interface a platform to a downstream embedded system environment and transfer serial messages using the SMBus protocols, allowing multiple simultaneous device control.

1.1.3 I2C

1.1.3 i2c.png

I2C is a bi-directional two wire bus that was developed by Philips for use in their televisions in the 1980s. Today, I2C is used in all types of embedded systems. The I2C API allows a developer to interface a platform to a downstream embedded system environment and transfer serial messages using the I2C protocols, allowing multiple simultaneous device control.


1.1.4 Watchdog

1.1.4 watchdog.png

A watchdog timer (WDT) is a device or electronic card that performs a specific operation after a certain period of time if something goes wrong with an electronic system and the system does not recover on its own.

A watchdog timer can be programmed to perform a warm boot (restarting the system) after a certain number of seconds during which a program or computer fails to respond following the most recent mouse click or keyboard action.


1.1.5 Hardware Monitor

1.1.5 HardwareMonitor 1.png   1.1.5 HardwareMonitor 2.png

The Hardware Monitor (HWM) APIs is a system health supervision API that inspects certain condition indexes, such as smart fan, fan speed, temperature, current, case open and voltage.


1.1.6 Backlight Control

1.1.6 Backlight 1.png   1.1.6 Backlight 2.png

The Backlight Control APIs allows a developer to interface platform to easily control brightness through PWM and backlight on/off.


1.1.7 Storage

1.1.7 Storage.png

Storage is a non-volatile storage, the storage APIs allows a developer to access storage information, read/write data to storage and lock/unlock data area (same like write protection) by a key.


1.1.8 Thermal Protection

1.1.8 Thermal 1.png   1.1.8 Thermal 2.png

Thermal Protection can select a thermal source to monitor. When source temperature reach the limit, SUSI can act protect function to protect system.


1.2 Benefits

  • Faster Time to Market
SUSI's unified API helps developers write applications to control the hardware without knowing the hardware specs of the chipsets and driver architecture.


  • Reduced Project Effort
When customers have their own devices connected to the onboard bus, they can either: study the data sheet and write the driver & API from scratch, or they can use SUSI to start the integration with a 50% head start. Developers can reference the sample program on the CD to see and learn more about the software development environment.


  • Enhances Hardware Platform Reliability
SUSI provides a trusted custom ready solution which combines chipset and library function support, controlling application development through SUSI enhances reliability and brings peace of mind.::::


  • Flexible Upgrade Possibilities
SUSI supports an easy upgrade solution for customers. Customers just need to install the new version SUSI that supports the new functions.


  • Backward compatibility
Support SUSI 3.0, iManager 2.0 and EAPI 1.0 interface. Customers don’t need to change any APIs in their applications.


1.3 Environment Requirements

1.3.1Operating Systems

Windows XP Embedded
Windows XP 32-bit
Windows 7 (x86 / x64)
WES7 (x86 / x64)
Windows 8 Desktop (x86 / x64)
Windows CE 5 / 6 / 7
Linux (Project based, request from your local FAE)
Android (Project based, request from your local FAE)
QNX (Project based, request from your local FAE)
VxWorks (Project based, request from your local FAE)

 

Susi4.h file includes the API declaration, constants and flags that are required for programming.

2.1 Status Codes

All SUSI API functions immediately return a status code from a common list of possible errors. Any function may return any of the defined status codes. See the Appendix for more detailed information.

 

#define SUSI_STATUS_NOT_INITIALIZED					    0xFFFFFFFF
Description
The SUSI API library is not yet or unsuccessfully initialized. SusiLibInitialize needs to be called prior to the first access of any other SUSI API functions.
Actions
Call SusiLibInitialize.


#define SUSI_STATUS_INITIALIZED						    0xFFFFFFFE
Description
Library is initialized.
Actions
None.


#define SUSI_STATUS_ALLOC_ERROR						    0xFFFFFFFD
Description
Memory Allocation Error.
Actions
Free memory and try again.


#define SUSI_STATUS_DRIVER_TIMEOUT						0xFFFFFFFC
Description
Time out in driver. This is Normally caused by hardware/software semaphore timeout.
Actions
Retry.


#define SUSI_STATUS_INVALID_PARAMETER					0xFFFFFEFF
Description
One or more of the SUSI API functions call parameters are out of defined range.
Actions
Verify Function Parameters.


#define SUSI_STATUS_INVALID_BLOCK_ALIGNMENT			0xFFFFFEFE
Description
The Block Alignment is incorrect.
Actions
Use Inputs and Outputs to correctly select input and outputs.


#define SUSI_STATUS_INVALID_BLOCK_LENGTH				0xFFFFFEFD
Description
This means that the Block length is too long.
Actions
Use Alignment Capabilities information to correctly align write access.


#define SUSI_STATUS_INVALID_DIRECTION					0xFFFFFEFC
Description
The current Direction Argument attempts to set GPIOs to a unsupported direction. I.E. Setting GPI to Output.
Actions
Use Inputs and Outputs to correctly select input and outputs.


#define SUSI_STATUS_INVALID_BITMASK					0xFFFFFEFB
Description
The Bitmask Selects bits/GPIOs which are not supported for the current ID.
Actions
Use Inputs and Outputs to probe supported bits.


#define SUSI_STATUS_RUNNING							0xFFFFFEFA
Description
Watchdog timer already started.
Actions
Call SusiWDogStop before retrying.


#define SUSI_STATUS_UNSUPPORTED						0xFFFFFCFF
Description
This function or ID is not supported at the actual hardware environment.
Actions
None.
#define SUSI_STATUS_NOT_FOUND							0xFFFFFBFF
Description
Selected device was not found
Actions
None.


#define SUSI_STATUS_TIMEOUT							0xFFFFFBFE
Description
Device has no response.
Actions
None.


#define SUSI_STATUS_BUSY_COLLISION						0xFFFFFBFD
Description
The selected device or ID is busy or a data collision is detected.
Actions
Retry.


#define SUSI_STATUS_READ_ERROR							0xFFFFFAFF
Description
An error is detected during a read operation.
Actions
Retry.


#define SUSI_STATUS_WRITE_ERROR						0xFFFFFAFE
Description
An error is detected during a write operation.
Actions
Retry.


#define SUSI_STATUS_MORE_DATA							0xFFFFF9FF
Description
The amount of available data exceeds the buffer size. Storage buffer overflow was prevented. Read count was larger than the defined buffer length.
Actions
Either increase the buffer size or reduce the block length.


#define SUSI_STATUS_ERROR								0xFFFFF0FF
Description
Generic error message. No further error details are available.
Actions
None.


#define SUSI_STATUS_SUCCESS					0
Description
The operation is successful.
Actions
None.

2.2 ID

#define SUSI_ID_UNKNOWN					0xFFFFFFFF
Description
Undefined/Unknown ID
#define SUSI_ID_BOARD_MANUFACTURER_STR				0
#define SUSI_ID_BOARD_NAME_STR					1
#define SUSI_ID_BOARD_REVISION_STR				2
#define SUSI_ID_BOARD_SERIAL_STR				3
#define SUSI_ID_BOARD_BIOS_REVISION_STR			4
#define SUSI_ID_BOARD_HW_REVISION_STR				5
#define SUSI_ID_BOARD_PLATFORM_TYPE_STR			6
Description
Board information string ID, use in SusiBoardGetStringA.
#define SUSI_ID_GET_SPEC_VERSION&nbsp				0x00000000
#define SUSI_ID_BOARD_BOOT_COUNTER_VAL				0x00000001
#define SUSI_ID_BOARD_RUNNING_TIME_METER_VAL			0x00000002
#define SUSI_ID_BOARD_PNPID_VAL				0x00000003
#define SUSI_ID_BOARD_PLATFORM_REV_VAL				0x00000004
#define SUSI_ID_BOARD_DRIVER_VERSION_VAL			0x00010000
#define SUSI_ID_BOARD_LIB_VERSION_VAL				0x00010001
#define SUSI_ID_BOARD_FIRMWARE_VERSION_VAL			0x00010002
Description
Board information value ID, use in SusiBoardGetValue.
#define SUSI_ID_HWM_TEMP_CPU					0x00020000
#define SUSI_ID_HWM_TEMP_CHIPSET				0x00020001
#define SUSI_ID_HWM_TEMP_SYSTEM				0x00020002
#define SUSI_ID_HWM_TEMP_CPU2					0x00020003
#define SUSI_ID_HWM_TEMP_OEM0					0x00020004
#define SUSI_ID_HWM_TEMP_OEM1					0x00020005
#define SUSI_ID_HWM_TEMP_OEM2					0x00020006
#define SUSI_ID_HWM_TEMP_OEM3					0x00020007
#define SUSI_ID_HWM_TEMP_OEM4					0x00020008 
#define SUSI_ID_HWM_TEMP_OEM5					0x00020009
Description
Board temperature value ID, use in SusiBoardGetValue.
#define SUSI_ID_HWM_VOLTAGE_VCORE					0x00021000
#define SUSI_ID_HWM_VOLTAGE_VCORE2					0x00021001
#define SUSI_ID_HWM_VOLTAGE_2V5					0x00021002
#define SUSI_ID_HWM_VOLTAGE_3V3					0x00021003
#define SUSI_ID_HWM_VOLTAGE_5V					0x00021004
#define SUSI_ID_HWM_VOLTAGE_12V					0x00021005
#define SUSI_ID_HWM_VOLTAGE_5VSB					0x00021006
#define SUSI_ID_HWM_VOLTAGE_3VSB					0x00021007
#define SUSI_ID_HWM_VOLTAGE_VBAT					0x00021008
#define SUSI_ID_HWM_VOLTAGE_5NV					0x00021009
#define SUSI_ID_HWM_VOLTAGE_12NV					0x0002100A
#define SUSI_ID_HWM_VOLTAGE_VTT					0x0002100B
#define SUSI_ID_HWM_VOLTAGE_24V					0x0002100C
#define SUSI_ID_HWM_VOLTAGE_DC					0x0002100D
#define SUSI_ID_HWM_VOLTAGE_DCSTBY					0x0002100E
#define SUSI_ID_HWM_VOLTAGE_OEM3					0x0002100F
#define SUSI_ID_HWM_VOLTAGE_OEM0					0x00021010
#define SUSI_ID_HWM_VOLTAGE_OEM1					0x00021011
#define SUSI_ID_HWM_VOLTAGE_OEM2					0x00021012
#define SUSI_ID_HWM_VOLTAGE_OEM3					0x00021013
#define SUSI_ID_HWM_VOLTAGE_1V05					0x00021014
#define SUSI_ID_HWM_VOLTAGE_1V5					0x00021015
#define SUSI_ID_HWM_VOLTAGE_1V8					0x00021016
Description
Board voltage value ID, use in SusiBoardGetValue.
#define SUSI_ID_HWM_FAN_CPU					0x00022000
#define SUSI_ID_HWM_FAN_SYSTEM					0x00022001
#define SUSI_ID_HWM_FAN_CPU2					0x00022002
#define SUSI_ID_HWM_FAN_OEM0					0x00022003
#define SUSI_ID_HWM_FAN_OEM1					0x00022004
#define SUSI_ID_HWM_FAN_OEM2					0x00022005
#define SUSI_ID_HWM_FAN_OEM3					0x00022006
#define SUSI_ID_HWM_FAN_OEM4					0x00022007
#define SUSI_ID_HWM_FAN_OEM5					0x00022008
#define SUSI_ID_HWM_FAN_OEM6					0x00022009
Description
Board fan speed value ID, use in SusiBoardGetValue and Smart Fan Functions.
#define SUSI_ID_HWM_CURRENT_OEM0					0x00023000
#define SUSI_ID_HWM_CURRENT_OEM1					0x00023001
#define SUSI_ID_HWM_CURRENT_OEM2					0x00023002
Description
Board current value ID, use in SusiBoardGetValue.
#define SUSI_ID_SMBUS_SUPPORTED					0x00030000
#define SUSI_ID_I2C_SUPPORTED					0x00030100
Description
Board supported information value ID, use in SusiBoardGetValue.
#define SUSI_ID_SMBUS_EXTERNAL					0
#define SUSI_ID_SMBUS_OEM0					1
#define SUSI_ID_SMBUS_OEM1					2
#define SUSI_ID_SMBUS_OEM2					3
#define SUSI_ID_SMBUS_OEM3					4
Description
SMBus device ID, use in SMBus Functions.
#define SUSI_ID_I2C_EXTERNAL					0
#define SUSI_ID_I2C_OEM0					1
#define SUSI_ID_I2C_OEM1					2
#define SUSI_ID_I2C_OEM2					3
Description
I2C device ID, use in I2C Functions.
#define SUSI_ID_GPIO(GPIO_NUM)					(GPIO_NUM)
#define SUSI_ID_GPIO_BANK(BANK_NUM)					(0x00010000 + BANK_NUM)
Description
GPIO device ID, use in GPIO Functions.
#define SUSI_ID_BACKLIGHT_1					0
#define SUSI_ID_BACKLIGHT_2					1
#define SUSI_ID_BACKLIGHT_3					2
Description
Backlight device ID, use in Backlight Functions.
#define SUSI_ID_STORAGE_STD					0x00000000
#define SUSI_ID_STORAGE_OEM0					0x00000001
#define SUSI_ID_STORAGE_OEM1					0x00000002
Description
Storage device ID, use in Storage Functions.
#define SUSI_ID_THERMAL_PROTECT_1					0
#define SUSI_ID_THERMAL_PROTECT_2					1
#define SUSI_ID_THERMAL_PROTECT_3					2
#define SUSI_ID_THERMAL_PROTECT_4					3
Description
Thermal protection device ID, use in Thermal Protection Functions
#define SUSI_ID_WATCHDOG_1					0
#define SUSI_ID_WATCHDOG_2					1
#define SUSI_ID_WATCHDOG_3					2
Description
Watchdog device ID, use in Watchdog Functions.

2.3 Item ID

#define SUSI_ID_I2C_MAXIMUM_BLOCK_LENGTH			0x00000000
Description
Watchdog capabilities item ID, use in SusiI2CGetCaps.
#define SUSI_ID_GPIO_INPUT_SUPPORT				0x00000000
#define SUSI_ID_GPIO_OUTPUT_SUPPORT				0x00000001
Description
GPIO capabilities item ID, use in SusiGPIOGetCaps.
#define SUSI_ID_VGA_BRIGHTNESS_MAXIMUM				0x00010000
#define SUSI_ID_VGA_BRIGHTNESS_MINIMUM				0x00010001
Description
VGA capabilities item ID, use in SusiVgaGetCaps.
#define SUSI_ID_STORAGE_TOTAL_SIZE				0x00000000
#define SUSI_ID_STORAGE_BLOCK_SIZE				0x00000001
#define SUSI_ID_STORAGE_LOCK_STATUS				0x00010000
#define SUSI_ID_STORAGE_PSW_MAX_LEN				0x00010000
Description
Storage capabilities item ID, use in SusiStorageGetCaps.
#define SUSI_ID_WDT_SUPPORT_FLAGS				0x00000000
#define SUSI_ID_WDT_DELAY_MAXIMUM				0x00000001
#define SUSI_ID_WDT_DELAY_MINIMUM				0x00000002
#define SUSI_ID_WDT_EVENT_MAXIMUM				0x00000003
#define SUSI_ID_WDT_EVENT_MINIMUM				0x00000004
#define SUSI_ID_WDT_RESET_MAXIMUM				0x00000005
#define SUSI_ID_WDT_RESET_MINIMUM				0x00000006
#define SUSI_ID_WDT_UNIT_MINIMUM				0x0000000F
#define SUSI_ID_WDT_DELAY_TIME					0x00010001
#define SUSI_ID_WDT_EVENT_TIME					0x00010002
#define SUSI_ID_WDT_RESET_TIME					0x00010003
#define SUSI_ID_WDT_EVENT_TYPE					0x00010004
Description
Watchdog capabilities item ID, use in SusiWDogGetCaps.
#define SUSI_ID_FC_CONTROL_SUPPORT_FLAGS			0x00000000
#define SUSI_ID_FC_AUTO_SUPPORT_FLAGS				0x00000001
Description
Fan control capabilities item ID, use in SusiFanControlGetCaps.
#define SUSI_ID_TP_EVENT_SUPPORT_FLAGS				0x00000000
#define SUSI_ID_TP_EVENT_TRIGGER_MAXIMUM			0x00000001
#define SUSI_ID_TP_EVENT_TRIGGER_MINIMUM			0x00000002
#define SUSI_ID_TP_EVENT_CLEAR_MAXIMUM				0x00000003
#define SUSI_ID_TP_EVENT_CLEAR_MINIMUM				0x00000004
Description
Thermal protection capabilities item ID, use in SusiThermalProtectionGetCaps.

The SUSI APIs provide functions to control ADVANTECH platforms. SUSI API functions are based on a dynamic library. SUSI API can be implemented in various other programming languages.

3.1 Initialization Functions

3.1.1 SusiLibInitialize

uint32_t SUSI_API SusiLibInitialize(void)
Description:
General initialization of the SUSI API. Prior to calling any SUSI API functions, the library needs to be initialized by calling this function. The status code for all SUSI API function will be SUSI_STATUS_NOT_INITIALIZED unless this function is called.
Parameters:
None
Return Status Code:

Condition

Return Value

Library initialized

SUSI_STATUS_INITIALIZED

Fail

SUSI_STATUS_NOT_INITIALIZED

Success

SUSI_STATUS_SUCCESS


3.1.2 SusiLibUninitialize

uint32_t SUSI_API SusiLibUninitialize(void)
Description:
General function to uninitialize the SUSI API library that should be called before program exit. In a dynamic library environment this function is not expected to replace the native uninitialized routines. It is expected that in this environments this function has no functionality.
Parameters:
None
Return Status Code:

Condition

Return Value

Library uninitialized

SUSI_STATUS_NOT_INITIALIZED

Success

SUSI_STATUS_SUCCESS

3.2 Information Functions

3.2.1 SusiBoardGetValue

uint32_t SUSI_API SusiBoardGetValue(uint32_t Id, uint32_t *pValue)
Description:
Getting information about the hardware platform in value format.
Parameters:
Id
Selects target value. See Table 1 to Table 5.
pValue
Pointer to a buffer that receives the value's data.
Return Status Code:

Condition

Return Value

Library uninitialized

SUSI_STATUS_NOT_INITIALIZED

pValue==NULL

SUSI _STATUS_INVALID_PARAMETER

Unknown Id

SUSI _STATUS_UNSUPPORTED

Device unsupported

SUSI _STATUS_UNSUPPORTED

Success

SUSI_STATUS_SUCCESS

Table1 Board information value ID

Id

Description

Unit

SUSI_ID_GET_SPEC_VERSION

API Specification Version

 

SUSI_ID_BOARD_BOOT_COUNTER_VAL

Boot Counter

boot

SUSI_ID_BOARD_RUNNING_TIME_METER_VAL

Running Time Meter

hour

SUSI_ID_BOARD_PNPID_VAL

Board Vendor PNPID

 

SUSI_ID_BOARD_PLATFORM_REV_VAL

Platform revision

 

SUSI_ID_BOARD_DRIVER_VERSION_VAL

Driver version

 

SUSI_ID_BOARD_LIB_VERSION_VAL

Library version

 

SUSI_ID_BOARD_FIRMWARE_VERSION_VAL

Firmware version

 

Table2 Board voltage value ID

Id

Description

Unit

SUSI_ID_HWM_VOLTAGE_VCORE

CPU Core voltage

millivolt

SUSI_ID_HWM_VOLTAGE_VCORE2 

Second CPU Core voltage

millivolt

SUSI_ID_HWM_VOLTAGE_2V5

2.5V

millivolt

SUSI_ID_HWM_VOLTAGE_3V3

3.3V

millivolt

SUSI_ID_HWM_VOLTAGE_5V

5V

millivolt

SUSI_ID_HWM_VOLTAGE_12V

12V

millivolt

SUSI_ID_HWM_VOLTAGE_5VSB      

5V Standby

millivolt

SUSI_ID_HWM_VOLTAGE_3VSB

3V Standby

millivolt

SUSI_ID_HWM_VOLTAGE_VBAT

CMOS Battery voltage

millivolt

SUSI_ID_HWM_VOLTAGE_5NV

-5V

millivolt

SUSI_ID_HWM_VOLTAGE_12NV

-12V

millivolt

SUSI_ID_HWM_VOLTAGE_VTT

DIMM voltage

millivolt

SUSI_ID_HWM_VOLTAGE_24V

24V

millivolt

SUSI_ID_HWM_VOLTAGE_OEM0~3

Other voltages

millivolt


Table3 Board temperature value ID

Id

Description

Unit

SUSI_ID_HWM_TEMP_CPU

CPU temperature

0.1 Kelvin

SUSI_ID_HWM_TEMP_CHIPSET

Chipset temperature

0.1 Kelvin

SUSI_ID_HWM_TEMP_SYSTEM

System temperature

0.1 Kelvin

SUSI_ID_HWM_TEMP_CPU2

CPU2 temperature

0.1 Kelvin

SUSI_ID_HWM_TEMP_OEM0~5

Other temperatures

0.1 Kelvin


Table4 Board fan speed value ID

Id

Description

Unit

SUSI_ID_HWM_FAN_CPU

CPU fan speed

RPM

SUSI_ID_HWM_FAN_SYSTEM

System fan speed

RPM

SUSI_ID_HWM_FAN_CPU2

Second CPU fan speed

RPM

SUSI_ID_HWM_FAN_OEM0~6

Other fans

RPM


Table5 Board support information value ID

Id

Description

SUSI_ID_SMBUS_SUPPORTED

Mask flags:

SUSI_SMBUS_EXTERNAL_SUPPORTED

SUSI_SMBUS_OEM0_SUPPORTED

SUSI_SMBUS_OEM1_SUPPORTED

SUSI_SMBUS_OEM2_SUPPORTED

SUSI_SMBUS_OEM3_SUPPORTED

SUSI_ID_I2C_SUPPORTED

Mask flags:

SUSI_ I2C_EXTERNAL_SUPPORTED

SUSI_ I2C_OEM0_SUPPORTED

SUSI_ I2C_OEM1_SUPPORTED

SUSI_ I2C_OEM2_SUPPORTED