4 appendix, 1 hwapicommandrw from hwapihatteland.h, 1 c# example of hwapihatteland.dll import – Hatteland Display 13 inch - HD 13T21 MMC (Widescreen, Inte Ato CPU) User Manual

Page 13: 2 error codes implemented in hwapi.errcodes.h, 3 available commands implemented in hwapi.cmds.h, Hatteland display api

Advertising
background image

DOC101014-1_Hatteland Display API_AIPC.docx rev: 7

Created: 17.11.2011

Modified: 07.10.2013

13 of 27

Hatteland Display AS, Åmsosen, N-5578 Nedre Vats, Norway

Tel: (+47) 4814 2200 - [email protected] - www.hatteland-display.com

Hatteland Display API

All intellectual properties belongs to Hatteland Display AS

4 Appendix

When created, the API was specified to support user applications created in C#. When showing code

examples, this document will show C# implementations.

4.1 HWAPIcommandRW from hwapihatteland.h

UINT8 _stdcall HWAPIcommandRW(UINT32 CmdName, BOOL RW, UINT8 *InputData, UINT8 *OutputData, UINT8 *nbytes);

/**
Function which is responsible for writing commands to devices
\param [in] CmdName

One of the commands specified in "hwapi_cmds.h"

\param [in] RW

0 if command should be written, 1 if a read should be performed

\param [in] InputData

InputData (used for reads). Number of bytes which have been read are stored in nbytes

\param [in] OutputData

OutputData (used for writes if applicable). Number of bytes in nbytes should be defined

\param [in] nbytes

Number of bytes in which should be written or number of bytes read depending on RW

\return ERROR_NONE if the operation was successful, otherwise one of the defined errror codes.
*/

4.1.1 C# example of hwapihatteland.dll import

[

DllImport

(

"hwapihatteland.dll"

, CallingConvention =

CallingConvention

.StdCall)]

public

static

extern

byte

HWAPIcommandRW(

[

MarshalAs

(

UnmanagedType

.U4)]

UInt32

cmdName,

[

MarshalAs

(

UnmanagedType

.Bool)]

bool

RW,

[

MarshalAs

(

UnmanagedType

.LPArray)]

byte

[] inputData,

[

MarshalAs

(

UnmanagedType

.LPArray)]

byte

[] outputData,

[

MarshalAs

(

UnmanagedType

.U1)]

ref

byte

nbytes);

4.2 Error codes implemented in hwapi.errcodes.h

#ifndef _HATTELANDAPI_ERRORCODES_H_
#define _HATTELANDAPI_ERRORCODES_H_

#define ERROR_NONE

0x00

#define ERROR_INVALID_API_CALL

0x01


#define ERROR_SMBUS_WRITE_FAILED

0x02

#define ERROR_SMBUS_READ_FAILED

0x03


#define ERROR_COMMAND_READONLY

0x04

#define ERROR_COMMAND_WRITEONLY

0x05

#define ERROR_COMMAND_NOT_FOUND

0x06


#define ERROR_HWDRIVER_LOAD_FAILED

0x08

#define ERROR_HWDRIVER_CERTIFICATE_INVALID

0x09


#define ERROR_HW_NOT_COMPATIBLE

0x0A

#define ERROR_SMBUS_BUSY

0x0B


#endif //_HATTELANDAPI_ERRORCODES_H_

4.3 Available commands implemented in hwapi.cmds.h

#ifndef _HATTELANDAPI_COMMANDS_H_
#define _HATTELANDAPI_COMMANDS_H_

#define HW_PLATFORM_AIPC 0x00

#define HW_DEVICE_PCA9555

0x40

#define HW_DEVICE_WATCHDOG_PCB

0x90


// PCA 9555
#define AIPC_CFG0_W

0x06 + (HW_DEVICE_PCA9555 << 8) + 0x060000

#define AIPC_CFG1_W

0x07 + (HW_DEVICE_PCA9555 << 8) + 0x070000

#define AIPC_Read_GPI

0x00 + (HW_DEVICE_PCA9555 << 8) + 0x080000

Advertising
This manual is related to the following products: