unit usblismpi26;

{ USB LISM-PI26xx V2.0 Pascal import unit.

  Supported targets:
    - Windows 32-bit: usblismpi2632.dll
    - Windows 64-bit: usblismpi2664.dll
    - Linux 32-bit / ARM32: libusblismpi2632.so.2
    - Linux 64-bit / AArch64: libusblismpi2664.so.2

  The unit uses implicit dynamic linking. On Windows, place the matching DLL
  beside the executable or in the DLL search path. On Linux, install the
  matching SO and its SONAME link in the dynamic-loader path, or configure an
  application rpath / LD_LIBRARY_PATH accordingly.

  The legacy API is platform-specific for compatibility with earlier Windows
  and Linux/ARM releases. The handle-based *_ex API has one portable signature
  on every supported platform. }

interface

{$IFDEF FPC}
  {$MODE DELPHI}
  {$H+}
{$ENDIF}

{ Normalize 64-bit target detection for FPC and Delphi. }
{$IFDEF WIN64}{$DEFINE LS_TARGET_64}{$ENDIF}
{$IFDEF CPU64}{$DEFINE LS_TARGET_64}{$ENDIF}
{$IFDEF CPUX64}{$DEFINE LS_TARGET_64}{$ENDIF}
{$IFDEF CPUAARCH64}{$DEFINE LS_TARGET_64}{$ENDIF}
{$IFDEF CPUARM64}{$DEFINE LS_TARGET_64}{$ENDIF}

{$IFDEF MSWINDOWS}
  {$IFDEF LS_TARGET_64}
const
  DLLName = 'usblismpi2664.dll';
  {$ELSE}
const
  DLLName = 'usblismpi2632.dll';
  {$ENDIF}
{$ELSE}
  {$IFDEF LS_TARGET_64}
const
  DLLName = 'libusblismpi2664.so';
  {$ELSE}
const
  DLLName = 'libusblismpi2632.so';
  {$ENDIF}
{$ENDIF}

const
  _512    = 512;
  _1kB    = _512 * 2;
  _2kB    = _1kB * 2;
  _4kB    = _2kB * 2;
  _8kB    = _4kB * 2;
  _16kB   = _8kB * 2;
  _32kB   = _16kB * 2;
  _64kB   = _32kB * 2;
  _128kB  = _64kB * 2;
  _256kB  = _128kB * 2;
  _512kB  = _256kB * 2;
  _1MB    = _512kB * 2;
  _2MB    = _1MB * 2;
  _4MB    = _2MB * 2;
  _8MB    = _4MB * 2;
  _16MB   = _8MB * 2;
  _32MB   = _16MB * 2;
  _64MB   = _32MB * 2;
  _128MB  = _64MB * 2;
  _256MB  = _128MB * 2;

  _1ms = 1;
  _1s  = 1000 * _1ms;

  RET_OK      = 0;
  LC_I2C_ADDR = $FE;
  LS_INFINITE = UInt32($FFFFFFFF);
  LS_THREAD_PRIORITY_NORMAL       = Int32(0);
  LS_THREAD_PRIORITY_ABOVE_NORMAL = Int32(1);
  LS_THREAD_PRIORITY_HIGH         = Int32(2);

{ BEGIN GENERATED LS ERROR CODES }
{$IFDEF MSWINDOWS}
  LS_OK                                  = UInt32(0);
  LS_ERR_NO_DEVICES_ATTACHED             = UInt32($20000001);
  LS_ERR_DEVICE_INDEX_OUT_OF_RANGE       = UInt32($20000002);
  LS_ERR_SERIAL_NUM_NOT_FOUND            = UInt32($20000003);
  LS_ERR_INVALID_HANDLE                  = UInt32(6);
  LS_ERR_DEVICE_ACTIVE                   = UInt32($20000011);
  LS_ERR_CONTROL_TRANSFER                = UInt32($20000015);
  LS_ERR_TIMEOUT                         = UInt32(1460);
  LS_ERR_DEVICE_ALREADY_OPEN             = UInt32($20000013);
  LS_ERR_NOT_IMPLEMENTED                 = UInt32($20000014);
  LS_ERR_ALLOCATE_THREADPARAM_MEM        = UInt32($20000004);
  LS_ERR_PATH_INVALID_HANDLE             = UInt32($20000006);
  LS_ERR_INVALID_DATALEN                 = UInt32($21000001);
  LS_ERR_I2C_NACK                        = UInt32($21000004);
  LS_ERR_I2C_ERROR                       = UInt32($21000005);
  LS_ERR_I2C_UNKNOWN                     = UInt32($21000006);
  LS_ERR_I2C_MUX_DISABLED                = UInt32($21000007);
  LS_ERR_INVALID_PACKETLENGTH            = UInt32($21000002);
  LS_ERR_CMD_NOT_SUPPORTED               = UInt32($21000003);
  LS_ERR_PIPE_CANCELLED                  = UInt32(109);
  LS_ERR_INVALID_TIMEOUT                 = UInt32($21000008);
  LS_ERR_INVALID_THREAD_PRIORITY         = UInt32($21000009);
  LS_ERR_THREAD_PRIORITY_FAILED          = UInt32($2100000A);
{$ELSE}
  LS_OK                                  = Int32(0);
  LS_ERR_NO_DEVICES_ATTACHED             = Int32(-10001);
  LS_ERR_DEVICE_INDEX_OUT_OF_RANGE       = Int32(-10002);
  LS_ERR_SERIAL_NUM_NOT_FOUND            = Int32(-10003);
  LS_ERR_INVALID_HANDLE                  = Int32(-10004);
  LS_ERR_DEVICE_ACTIVE                   = Int32(-10005);
  LS_ERR_CONTROL_TRANSFER                = Int32(-10006);
  LS_ERR_TIMEOUT                         = Int32(-10007);
  LS_ERR_DEVICE_ALREADY_OPEN             = Int32(-10008);
  LS_ERR_NOT_IMPLEMENTED                 = Int32(-10009);
  LS_ERR_ALLOCATE_THREADPARAM_MEM        = Int32(-10010);
  LS_ERR_PATH_INVALID_HANDLE             = Int32(-10012);
  LS_ERR_INVALID_DATALEN                 = Int32(-10051);
  LS_ERR_I2C_NACK                        = Int32(-10052);
  LS_ERR_I2C_ERROR                       = Int32(-10053);
  LS_ERR_I2C_UNKNOWN                     = Int32(-10054);
  LS_ERR_I2C_MUX_DISABLED                = Int32(-10055);
  LS_ERR_INVALID_PACKETLENGTH            = Int32(-10056);
  LS_ERR_CMD_NOT_SUPPORTED               = Int32(-10057);
  LS_ERR_PIPE_CANCELLED                  = Int32(-10058);
  LS_ERR_INVALID_TIMEOUT                 = Int32(-10059);
  LS_ERR_INVALID_THREAD_PRIORITY         = Int32(-10060);
  LS_ERR_THREAD_PRIORITY_FAILED          = Int32(-10061);
{$ENDIF}
{ END GENERATED LS ERROR CODES }

type
  TLSHandle = Pointer;
{$IFDEF MSWINDOWS}
  TLSResult = UInt32;
{$ELSE}
  TLSResult = Int32;
{$ENDIF}

{$IFDEF MSWINDOWS}
{ Windows legacy API }
function ls_libversion: Word; stdcall; external DLLName name 'ls_libversion';
function ls_initialize(pipe_size: UInt32; packet_length: UInt32; thread_class: UInt32; thread_priority: Int32; message_id: PAnsiChar): UInt32; stdcall; external DLLName name 'ls_initialize';
function ls_enumdevices: Int32; stdcall; external DLLName name 'ls_enumdevices';
function ls_getfwversion(index: Int32): Word; stdcall; external DLLName name 'ls_getfwversion';
function ls_getvendorname(index: Int32): PAnsiChar; stdcall; external DLLName name 'ls_getvendorname';
function ls_getproductname(index: Int32): PAnsiChar; stdcall; external DLLName name 'ls_getproductname';
function ls_getserialnumber(index: Int32): PAnsiChar; stdcall; external DLLName name 'ls_getserialnumber';
function ls_devicecount: Byte; stdcall; external DLLName name 'ls_devicecount';
function ls_currentdeviceindex: Int32; stdcall; external DLLName name 'ls_currentdeviceindex';
function ls_opendevicebyindex(index: Int32): UInt32; stdcall; external DLLName name 'ls_opendevicebyindex';
function ls_opendevicebyserial(serial_num: PAnsiChar): UInt32; stdcall; external DLLName name 'ls_opendevicebyserial';
function ls_closedevice: UInt32; stdcall; external DLLName name 'ls_closedevice';
function ls_waitforpipe(timeout_ms: UInt32): UInt32; stdcall; external DLLName name 'ls_waitforpipe';
function ls_waitforpipecount(count: Int32; var available: Int32; timeout_ms: UInt32): UInt32; stdcall; external DLLName name 'ls_waitforpipecount';
function ls_getpipe(buffer: Pointer; to_read: UInt32; var read_count: UInt32): UInt32; stdcall; external DLLName name 'ls_getpipe';
function ls_setpacketlength(packet_length: UInt32): UInt32; stdcall; external DLLName name 'ls_setpacketlength';
function ls_seteptimeout(timeout_ms: UInt32): UInt32; stdcall; external DLLName name 'ls_seteptimeout';
function ls_geteptimeout: UInt32; stdcall; external DLLName name 'ls_geteptimeout';
function ls_getfps: UInt32; stdcall; external DLLName name 'ls_getfps';
function ls_geterrorstring(error_code: UInt32): PAnsiChar; stdcall; external DLLName name 'ls_geterrorstring';
function ls_customfirmware(var custom_firmware: UInt32): UInt32; stdcall; external DLLName name 'ls_customfirmware';
function ls_setcfg1(cfg1: Byte): UInt32; stdcall; external DLLName name 'ls_setcfg1';
function ls_getcfg1(var cfg1: Byte): UInt32; stdcall; external DLLName name 'ls_getcfg1';
function ls_getpacketlength(var packet_length: UInt32): UInt32; stdcall; external DLLName name 'ls_getpacketlength';
function ls_setmuxchannel(mux: Byte): UInt32; stdcall; external DLLName name 'ls_setmuxchannel';
function ls_getmuxchannel(var mux: ShortInt): UInt32; stdcall; external DLLName name 'ls_getmuxchannel';
function ls_readi2c_ext(i2c_address: Byte; buffer: Pointer; var length: Word): UInt32; stdcall; external DLLName name 'ls_readi2c_ext';
function ls_writei2c_ext(i2c_address: Byte; buffer: Pointer; length: Word): UInt32; stdcall; external DLLName name 'ls_writei2c_ext';
function ls_readi2c(i2c_address: Byte; buffer: Pointer; var length: Word): UInt32; stdcall; external DLLName name 'ls_readi2c';
function ls_writei2c(i2c_address: Byte; buffer: Pointer; length: Word): UInt32; stdcall; external DLLName name 'ls_writei2c';
function ls_i2cread1byte(i2c_address: Byte; i2c_register: Byte; var value: Byte): UInt32; stdcall; external DLLName name 'ls_i2cread1byte';
function ls_i2cread2bytes(i2c_address: Byte; i2c_register: Byte; var value: Word): UInt32; stdcall; external DLLName name 'ls_i2cread2bytes';
function ls_i2cread4bytes(i2c_address: Byte; i2c_register: Byte; var value: UInt32): UInt32; stdcall; external DLLName name 'ls_i2cread4bytes';
function ls_i2cwrite1byte(i2c_address: Byte; i2c_register: Byte; value: Byte): UInt32; stdcall; external DLLName name 'ls_i2cwrite1byte';
function ls_i2cwrite2bytes(i2c_address: Byte; i2c_register: Byte; value: Word): UInt32; stdcall; external DLLName name 'ls_i2cwrite2bytes';
function ls_i2cwrite4bytes(i2c_address: Byte; i2c_register: Byte; value: UInt32): UInt32; stdcall; external DLLName name 'ls_i2cwrite4bytes';
function ls_i2cwritecmd(i2c_address: Byte; i2c_command: Byte): UInt32; stdcall; external DLLName name 'ls_i2cwritecmd';
function ls_hw_reset(address: Byte): UInt32; stdcall; external DLLName name 'ls_hw_reset';
function ls_suspend(address: Byte): UInt32; stdcall; external DLLName name 'ls_suspend';
function ls_resume(address: Byte): UInt32; stdcall; external DLLName name 'ls_resume';
function ls_updateparam(address: Byte): UInt32; stdcall; external DLLName name 'ls_updateparam';
function ls_setstate(address: Byte; state: Byte): UInt32; stdcall; external DLLName name 'ls_setstate';
function ls_setmodeconfig(address: Byte; mode: Byte): UInt32; stdcall; external DLLName name 'ls_setmodeconfig';
function ls_setifconfig(address: Byte; config: Byte): UInt32; stdcall; external DLLName name 'ls_setifconfig';
function ls_setstpulse(address: Byte; high_value: UInt32; low_value: UInt32): UInt32; stdcall; external DLLName name 'ls_setstpulse';
function ls_setsthigh(address: Byte; high_value: UInt32): UInt32; stdcall; external DLLName name 'ls_setsthigh';
function ls_setstlow(address: Byte; low_value: UInt32): UInt32; stdcall; external DLLName name 'ls_setstlow';
function ls_setlinesperframe(address: Byte; lines: Word): UInt32; stdcall; external DLLName name 'ls_setlinesperframe';
function ls_setquadcount(address: Byte; count: UInt32): UInt32; stdcall; external DLLName name 'ls_setquadcount';
function ls_setsofttriggertime(address: Byte; time_value: UInt32): UInt32; stdcall; external DLLName name 'ls_setsofttriggertime';
function ls_settriggerdelay(address: Byte; delay_value: UInt32): UInt32; stdcall; external DLLName name 'ls_settriggerdelay';
function ls_settriggerwidth(address: Byte; width_value: UInt32): UInt32; stdcall; external DLLName name 'ls_settriggerwidth';
function ls_setpixelcount(address: Byte; pixel_count: Word): UInt32; stdcall; external DLLName name 'ls_setpixelcount';
function ls_setedgedelay(address: Byte; edge_delay: Byte): UInt32; stdcall; external DLLName name 'ls_setedgedelay';
function ls_setadcvref(address: Byte; vref: Byte): UInt32; stdcall; external DLLName name 'ls_setadcvref';
function ls_setadcgain(address: Byte; gain: Byte): UInt32; stdcall; external DLLName name 'ls_setadcgain';
function ls_setadcoffset(address: Byte; offset: Word): UInt32; stdcall; external DLLName name 'ls_setadcoffset';
function ls_setadcbias(address: Byte; bias: Word): UInt32; stdcall; external DLLName name 'ls_setadcbias';
function ls_setslaveaddress(address: Byte; new_address: Byte): UInt32; stdcall; external DLLName name 'ls_setslaveaddress';
function ls_saveslaveaddress(address: Byte): UInt32; stdcall; external DLLName name 'ls_saveslaveaddress';
function ls_savesettings(address: Byte): UInt32; stdcall; external DLLName name 'ls_savesettings';
function ls_reloadsettings(address: Byte): UInt32; stdcall; external DLLName name 'ls_reloadsettings';
function ls_resetsettings(address: Byte): UInt32; stdcall; external DLLName name 'ls_resetsettings';
function ls_getmcuversion(address: Byte; var version: Word): UInt32; stdcall; external DLLName name 'ls_getmcuversion';
function ls_getctgversion(address: Byte; var version: Word): UInt32; stdcall; external DLLName name 'ls_getctgversion';
function ls_getctgstate(address: Byte; var state: Byte): UInt32; stdcall; external DLLName name 'ls_getctgstate';
function ls_getstate(address: Byte; var state: Byte): UInt32; stdcall; external DLLName name 'ls_getstate';
function ls_getmodeconfig(address: Byte; var mode: Byte): UInt32; stdcall; external DLLName name 'ls_getmodeconfig';
function ls_getifconfig(address: Byte; var config: Byte): UInt32; stdcall; external DLLName name 'ls_getifconfig';
function ls_getstpulse(address: Byte; var high_value: UInt32; var low_value: UInt32): UInt32; stdcall; external DLLName name 'ls_getstpulse';
function ls_getsthigh(address: Byte; var high_value: UInt32): UInt32; stdcall; external DLLName name 'ls_getsthigh';
function ls_getstlow(address: Byte; var low_value: UInt32): UInt32; stdcall; external DLLName name 'ls_getstlow';
function ls_getlinesperframe(address: Byte; var lines: Word): UInt32; stdcall; external DLLName name 'ls_getlinesperframe';
function ls_getquadcount(address: Byte; var count: UInt32): UInt32; stdcall; external DLLName name 'ls_getquadcount';
function ls_getsofttriggertime(address: Byte; var time_value: UInt32): UInt32; stdcall; external DLLName name 'ls_getsofttriggertime';
function ls_gettriggerdelay(address: Byte; var delay_value: UInt32): UInt32; stdcall; external DLLName name 'ls_gettriggerdelay';
function ls_gettriggerwidth(address: Byte; var width_value: UInt32): UInt32; stdcall; external DLLName name 'ls_gettriggerwidth';
function ls_getpixelcount(address: Byte; var pixel_count: Word): UInt32; stdcall; external DLLName name 'ls_getpixelcount';
function ls_getedgedelay(address: Byte; var edge_delay: Byte): UInt32; stdcall; external DLLName name 'ls_getedgedelay';
function ls_getadcvref(address: Byte; var vref: Byte): UInt32; stdcall; external DLLName name 'ls_getadcvref';
function ls_getadcgain(address: Byte; var gain: Byte): UInt32; stdcall; external DLLName name 'ls_getadcgain';
function ls_getadcoffset(address: Byte; var offset: Word): UInt32; stdcall; external DLLName name 'ls_getadcoffset';
function ls_getadcbias(address: Byte; var bias: Word): UInt32; stdcall; external DLLName name 'ls_getadcbias';
function ls_getslaveaddress(address: Byte; var new_address: Byte): UInt32; stdcall; external DLLName name 'ls_getslaveaddress';
function ls_gethw1id(address: Byte; var hardware_id: Word): UInt32; stdcall; external DLLName name 'ls_gethw1id';
function ls_gethw1version(address: Byte; var version: Word): UInt32; stdcall; external DLLName name 'ls_gethw1version';
function ls_gethw2version(address: Byte; var version: Word): UInt32; stdcall; external DLLName name 'ls_gethw2version';
function ls_getgainmult(address: Byte; var multiplier: Word): UInt32; stdcall; external DLLName name 'ls_getgainmult';
function ls_getgaindiv(address: Byte; var divisor: Word): UInt32; stdcall; external DLLName name 'ls_getgaindiv';
function ls_getinitstatus(address: Byte; var status: Byte): UInt32; stdcall; external DLLName name 'ls_getinitstatus';
function ls_getcomresult(address: Byte; var result_value: Byte): UInt32; stdcall; external DLLName name 'ls_getcomresult';
function ls_shutdown: UInt32; stdcall; external DLLName name 'ls_shutdown';

{ Portable handle-based API }
function ls_seteptimeout_ex(handle: TLSHandle; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_seteptimeout_ex';
function ls_geteptimeout_ex(handle: TLSHandle; var timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_geteptimeout_ex';
function ls_setthreadpriority_ex(handle: TLSHandle; priority: Int32): TLSResult; stdcall; external DLLName name 'ls_setthreadpriority_ex';
function ls_getthreadpriority_ex(handle: TLSHandle; var priority: Int32): TLSResult; stdcall; external DLLName name 'ls_getthreadpriority_ex';
function ls_opendevicebyindex_ex(index: Int32; pipe_size: UInt32; packet_length: UInt32; var handle: TLSHandle): TLSResult; stdcall; external DLLName name 'ls_opendevicebyindex_ex';
function ls_opendevicebyserial_ex(serial_num: PAnsiChar; pipe_size: UInt32; packet_length: UInt32; var handle: TLSHandle): TLSResult; stdcall; external DLLName name 'ls_opendevicebyserial_ex';
function ls_closedevice_ex(handle: TLSHandle): TLSResult; stdcall; external DLLName name 'ls_closedevice_ex';
function ls_getpipe_ex(handle: TLSHandle; buffer: Pointer; to_read: UInt32; var read_count: UInt32): TLSResult; stdcall; external DLLName name 'ls_getpipe_ex';
function ls_waitforpipe_ex(handle: TLSHandle; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_waitforpipe_ex';
function ls_waitforpipecount_ex(handle: TLSHandle; count: Int32; var available: Int32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_waitforpipecount_ex';
function ls_getfps_ex(handle: TLSHandle): UInt32; stdcall; external DLLName name 'ls_getfps_ex';
function ls_getpacketlength_ex(handle: TLSHandle; var packet_length: UInt32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getpacketlength_ex';
function ls_customfirmware_ex(handle: TLSHandle; var custom_firmware: UInt32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_customfirmware_ex';
function ls_setcfg1_ex(handle: TLSHandle; cfg1: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_setcfg1_ex';
function ls_getcfg1_ex(handle: TLSHandle; var cfg1: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getcfg1_ex';
function ls_setslaveaddress_ex(handle: TLSHandle; address: Byte; new_address: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_setslaveaddress_ex';
function ls_getslaveaddress_ex(handle: TLSHandle; address: Byte; var new_address: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getslaveaddress_ex';
function ls_saveslaveaddress_ex(handle: TLSHandle; address: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_saveslaveaddress_ex';
function ls_setmuxchannel_ex(handle: TLSHandle; mux: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_setmuxchannel_ex';
function ls_getmuxchannel_ex(handle: TLSHandle; var mux: ShortInt; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getmuxchannel_ex';
function ls_readi2c_ex(handle: TLSHandle; i2c_address: Byte; buffer: Pointer; var length: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_readi2c_ex';
function ls_writei2c_ex(handle: TLSHandle; i2c_address: Byte; buffer: Pointer; length: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_writei2c_ex';
function ls_readi2c_ext_ex(handle: TLSHandle; i2c_address: Byte; buffer: Pointer; var length: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_readi2c_ext_ex';
function ls_writei2c_ext_ex(handle: TLSHandle; i2c_address: Byte; buffer: Pointer; length: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_writei2c_ext_ex';
function ls_i2cread1byte_ex(handle: TLSHandle; i2c_address: Byte; i2c_register: Byte; var value: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_i2cread1byte_ex';
function ls_i2cread2bytes_ex(handle: TLSHandle; i2c_address: Byte; i2c_register: Byte; var value: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_i2cread2bytes_ex';
function ls_i2cread4bytes_ex(handle: TLSHandle; i2c_address: Byte; i2c_register: Byte; var value: UInt32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_i2cread4bytes_ex';
function ls_i2cwrite1byte_ex(handle: TLSHandle; i2c_address: Byte; i2c_register: Byte; value: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_i2cwrite1byte_ex';
function ls_i2cwrite2bytes_ex(handle: TLSHandle; i2c_address: Byte; i2c_register: Byte; value: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_i2cwrite2bytes_ex';
function ls_i2cwrite4bytes_ex(handle: TLSHandle; i2c_address: Byte; i2c_register: Byte; value: UInt32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_i2cwrite4bytes_ex';
function ls_i2cwritecmd_ex(handle: TLSHandle; i2c_address: Byte; i2c_command: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_i2cwritecmd_ex';
function ls_hw_reset_ex(handle: TLSHandle; address: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_hw_reset_ex';
function ls_resume_ex(handle: TLSHandle; address: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_resume_ex';
function ls_suspend_ex(handle: TLSHandle; address: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_suspend_ex';
function ls_updateparam_ex(handle: TLSHandle; address: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_updateparam_ex';
function ls_setstate_ex(handle: TLSHandle; address: Byte; state: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_setstate_ex';
function ls_setmodeconfig_ex(handle: TLSHandle; address: Byte; mode: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_setmodeconfig_ex';
function ls_setifconfig_ex(handle: TLSHandle; address: Byte; config: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_setifconfig_ex';
function ls_setsthigh_ex(handle: TLSHandle; address: Byte; high_value: UInt32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_setsthigh_ex';
function ls_setstlow_ex(handle: TLSHandle; address: Byte; low_value: UInt32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_setstlow_ex';
function ls_setstpulse_ex(handle: TLSHandle; address: Byte; high_value: UInt32; low_value: UInt32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_setstpulse_ex';
function ls_setlinesperframe_ex(handle: TLSHandle; address: Byte; lines: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_setlinesperframe_ex';
function ls_setquadcount_ex(handle: TLSHandle; address: Byte; count: UInt32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_setquadcount_ex';
function ls_setsofttriggertime_ex(handle: TLSHandle; address: Byte; time_value: UInt32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_setsofttriggertime_ex';
function ls_settriggerdelay_ex(handle: TLSHandle; address: Byte; delay_value: UInt32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_settriggerdelay_ex';
function ls_settriggerwidth_ex(handle: TLSHandle; address: Byte; width_value: UInt32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_settriggerwidth_ex';
function ls_setpixelcount_ex(handle: TLSHandle; address: Byte; pixel_count: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_setpixelcount_ex';
function ls_setedgedelay_ex(handle: TLSHandle; address: Byte; edge_delay: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_setedgedelay_ex';
function ls_setadcvref_ex(handle: TLSHandle; address: Byte; vref: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_setadcvref_ex';
function ls_setadcgain_ex(handle: TLSHandle; address: Byte; gain: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_setadcgain_ex';
function ls_setadcoffset_ex(handle: TLSHandle; address: Byte; offset: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_setadcoffset_ex';
function ls_setadcbias_ex(handle: TLSHandle; address: Byte; bias: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_setadcbias_ex';
function ls_getctgstate_ex(handle: TLSHandle; address: Byte; var state: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getctgstate_ex';
function ls_getstate_ex(handle: TLSHandle; address: Byte; var state: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getstate_ex';
function ls_getmodeconfig_ex(handle: TLSHandle; address: Byte; var mode: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getmodeconfig_ex';
function ls_getifconfig_ex(handle: TLSHandle; address: Byte; var config: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getifconfig_ex';
function ls_getsthigh_ex(handle: TLSHandle; address: Byte; var high_value: UInt32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getsthigh_ex';
function ls_getstlow_ex(handle: TLSHandle; address: Byte; var low_value: UInt32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getstlow_ex';
function ls_getstpulse_ex(handle: TLSHandle; address: Byte; var high_value: UInt32; var low_value: UInt32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getstpulse_ex';
function ls_getlinesperframe_ex(handle: TLSHandle; address: Byte; var lines: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getlinesperframe_ex';
function ls_getquadcount_ex(handle: TLSHandle; address: Byte; var count: UInt32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getquadcount_ex';
function ls_getsofttriggertime_ex(handle: TLSHandle; address: Byte; var time_value: UInt32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getsofttriggertime_ex';
function ls_gettriggerdelay_ex(handle: TLSHandle; address: Byte; var delay_value: UInt32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_gettriggerdelay_ex';
function ls_gettriggerwidth_ex(handle: TLSHandle; address: Byte; var width_value: UInt32; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_gettriggerwidth_ex';
function ls_getpixelcount_ex(handle: TLSHandle; address: Byte; var pixel_count: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getpixelcount_ex';
function ls_getedgedelay_ex(handle: TLSHandle; address: Byte; var edge_delay: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getedgedelay_ex';
function ls_getadcvref_ex(handle: TLSHandle; address: Byte; var vref: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getadcvref_ex';
function ls_getadcgain_ex(handle: TLSHandle; address: Byte; var gain: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getadcgain_ex';
function ls_getgainmult_ex(handle: TLSHandle; address: Byte; var multiplier: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getgainmult_ex';
function ls_getgaindiv_ex(handle: TLSHandle; address: Byte; var divisor: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getgaindiv_ex';
function ls_getadcoffset_ex(handle: TLSHandle; address: Byte; var offset: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getadcoffset_ex';
function ls_getadcbias_ex(handle: TLSHandle; address: Byte; var bias: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getadcbias_ex';
function ls_savesettings_ex(handle: TLSHandle; address: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_savesettings_ex';
function ls_reloadsettings_ex(handle: TLSHandle; address: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_reloadsettings_ex';
function ls_resetsettings_ex(handle: TLSHandle; address: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_resetsettings_ex';
function ls_getinitstatus_ex(handle: TLSHandle; address: Byte; var status: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getinitstatus_ex';
function ls_getcomresult_ex(handle: TLSHandle; address: Byte; var result_value: Byte; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getcomresult_ex';
function ls_getmcuversion_ex(handle: TLSHandle; address: Byte; var version: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getmcuversion_ex';
function ls_getctgversion_ex(handle: TLSHandle; address: Byte; var version: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_getctgversion_ex';
function ls_gethw1id_ex(handle: TLSHandle; address: Byte; var hardware_id: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_gethw1id_ex';
function ls_gethw1version_ex(handle: TLSHandle; address: Byte; var version: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_gethw1version_ex';
function ls_gethw2version_ex(handle: TLSHandle; address: Byte; var version: Word; timeout_ms: UInt32): TLSResult; stdcall; external DLLName name 'ls_gethw2version_ex';
{$ELSE}
{ Linux legacy API }
function ls_libversion: Word; cdecl; external DLLName name 'ls_libversion';
procedure ls_initialize(pipe_size: Int32; packet_length: Int32); cdecl; external DLLName name 'ls_initialize';
function ls_enumdevices: Int32; cdecl; external DLLName name 'ls_enumdevices';
function ls_getfwversion(index: Int32): Word; cdecl; external DLLName name 'ls_getfwversion';
function ls_getvendorname(index: Int32): PAnsiChar; cdecl; external DLLName name 'ls_getvendorname';
function ls_getproductname(index: Int32): PAnsiChar; cdecl; external DLLName name 'ls_getproductname';
function ls_getserialnumber(index: Int32): PAnsiChar; cdecl; external DLLName name 'ls_getserialnumber';
function ls_devicecount: Byte; cdecl; external DLLName name 'ls_devicecount';
function ls_currentdeviceindex: Int32; cdecl; external DLLName name 'ls_currentdeviceindex';
function ls_closedevice: Int32; cdecl; external DLLName name 'ls_closedevice';
function ls_opendevicebyindex(index: Int32): Int32; cdecl; external DLLName name 'ls_opendevicebyindex';
function ls_opendevicebyserial(serial_num: PAnsiChar): Int32; cdecl; external DLLName name 'ls_opendevicebyserial';
function ls_getpipe(buffer: Pointer; to_read: UInt32): Int32; cdecl; external DLLName name 'ls_getpipe';
function ls_waitforpipe(timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_waitforpipe';
function ls_waitforpipecount(count: Int32; var available: Int32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_waitforpipecount';
function ls_setpacketlength(packet_length: Int32): Int32; cdecl; external DLLName name 'ls_setpacketlength';
function ls_seteptimeout(timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_seteptimeout';
function ls_geteptimeout: UInt32; cdecl; external DLLName name 'ls_geteptimeout';
function ls_getfps: UInt32; cdecl; external DLLName name 'ls_getfps';
function ls_geterrorstring(error_code: Int32): PAnsiChar; cdecl; external DLLName name 'ls_geterrorstring';
function ls_setmuxchannel(mux: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_setmuxchannel';
function ls_getmuxchannel(var mux: ShortInt; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getmuxchannel';
function ls_readi2c_ext(i2c_address: Byte; buffer: Pointer; var length: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_readi2c_ext';
function ls_writei2c_ext(i2c_address: Byte; buffer: Pointer; length: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_writei2c_ext';
function ls_readi2c(i2c_address: Byte; buffer: Pointer; var length: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_readi2c';
function ls_writei2c(i2c_address: Byte; buffer: Pointer; length: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_writei2c';
function ls_i2cread1byte(i2c_address: Byte; i2c_register: Byte; var value: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_i2cread1byte';
function ls_i2cread2bytes(i2c_address: Byte; i2c_register: Byte; var value: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_i2cread2bytes';
function ls_i2cread4bytes(i2c_address: Byte; i2c_register: Byte; var value: UInt32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_i2cread4bytes';
function ls_i2cwrite1byte(i2c_address: Byte; i2c_register: Byte; value: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_i2cwrite1byte';
function ls_i2cwrite2bytes(i2c_address: Byte; i2c_register: Byte; value: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_i2cwrite2bytes';
function ls_i2cwrite4bytes(i2c_address: Byte; i2c_register: Byte; value: UInt32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_i2cwrite4bytes';
function ls_i2cwritecmd(i2c_address: Byte; i2c_command: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_i2cwritecmd';
function ls_setadcbias(address: Byte; bias: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_setadcbias';
function ls_getadcbias(address: Byte; var bias: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getadcbias';
function ls_getadcvref(address: Byte; var vref: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getadcvref';
function ls_getadcgain(address: Byte; var gain: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getadcgain';
function ls_getadcoffset(address: Byte; var offset: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getadcoffset';
function ls_setadcvref(address: Byte; vref: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_setadcvref';
function ls_setadcgain(address: Byte; gain: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_setadcgain';
function ls_setadcoffset(address: Byte; offset: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_setadcoffset';
function ls_gethw1id(address: Byte; var hardware_id: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_gethw1id';
function ls_gethw1version(address: Byte; var version: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_gethw1version';
function ls_gethw2version(address: Byte; var version: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_gethw2version';
function ls_getgainmult(address: Byte; var multiplier: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getgainmult';
function ls_getgaindiv(address: Byte; var divisor: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getgaindiv';
function ls_hw_reset(address: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_hw_reset';
function ls_suspend(address: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_suspend';
function ls_resume(address: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_resume';
function ls_updateparam(address: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_updateparam';
function ls_setstate(address: Byte; state: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_setstate';
function ls_setmodeconfig(address: Byte; config: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_setmodeconfig';
function ls_setifconfig(address: Byte; config: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_setifconfig';
function ls_setstpulse(address: Byte; high_value: UInt32; low_value: UInt32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_setstpulse';
function ls_setsthigh(address: Byte; high_value: UInt32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_setsthigh';
function ls_setstlow(address: Byte; low_value: UInt32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_setstlow';
function ls_setlinesperframe(address: Byte; lines: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_setlinesperframe';
function ls_setquadcount(address: Byte; count: UInt32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_setquadcount';
function ls_setsofttriggertime(address: Byte; time_value: UInt32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_setsofttriggertime';
function ls_settriggerdelay(address: Byte; delay_value: UInt32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_settriggerdelay';
function ls_settriggerwidth(address: Byte; width_value: UInt32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_settriggerwidth';
function ls_setpixelcount(address: Byte; pixel_count: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_setpixelcount';
function ls_setedgedelay(address: Byte; edge_delay: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_setedgedelay';
function ls_setslaveaddress(address: Byte; new_address: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_setslaveaddress';
function ls_saveslaveaddress(address: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_saveslaveaddress';
function ls_savesettings(address: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_savesettings';
function ls_reloadsettings(address: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_reloadsettings';
function ls_resetsettings(address: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_resetsettings';
function ls_getctgversion(address: Byte; var version: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getctgversion';
function ls_getmcuversion(address: Byte; var version: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getmcuversion';
function ls_getctgstate(address: Byte; var state: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getctgstate';
function ls_getstate(address: Byte; var state: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getstate';
function ls_getmodeconfig(address: Byte; var config: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getmodeconfig';
function ls_getifconfig(address: Byte; var config: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getifconfig';
function ls_getstpulse(address: Byte; var high_value: UInt32; var low_value: UInt32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getstpulse';
function ls_getsthigh(address: Byte; var high_value: UInt32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getsthigh';
function ls_getstlow(address: Byte; var low_value: UInt32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getstlow';
function ls_getlinesperframe(address: Byte; var lines: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getlinesperframe';
function ls_getquadcount(address: Byte; var count: UInt32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getquadcount';
function ls_getsofttriggertime(address: Byte; var time_value: UInt32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getsofttriggertime';
function ls_gettriggerdelay(address: Byte; var delay_value: UInt32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_gettriggerdelay';
function ls_gettriggerwidth(address: Byte; var width_value: UInt32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_gettriggerwidth';
function ls_getpixelcount(address: Byte; var pixel_count: Word; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getpixelcount';
function ls_getedgedelay(address: Byte; var edge_delay: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getedgedelay';
function ls_getslaveaddress(address: Byte; var new_address: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getslaveaddress';
function ls_getinitstatus(address: Byte; var status: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getinitstatus';
function ls_getcomresult(address: Byte; var result_value: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getcomresult';
function ls_setcfg1(cfg1: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_setcfg1';
function ls_getcfg1(var cfg1: Byte; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getcfg1';
function ls_getpacketlength(var packet_length: Int32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_getpacketlength';
function ls_customfirmware(var custom_firmware: UInt32; timeout_ms: UInt32): Int32; cdecl; external DLLName name 'ls_customfirmware';
function ls_shutdown: Int32; cdecl; external DLLName name 'ls_shutdown';

{ Portable handle-based API }
function ls_seteptimeout_ex(handle: TLSHandle; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_seteptimeout_ex';
function ls_geteptimeout_ex(handle: TLSHandle; var timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_geteptimeout_ex';
function ls_setthreadpriority_ex(handle: TLSHandle; priority: Int32): TLSResult; cdecl; external DLLName name 'ls_setthreadpriority_ex';
function ls_getthreadpriority_ex(handle: TLSHandle; var priority: Int32): TLSResult; cdecl; external DLLName name 'ls_getthreadpriority_ex';
function ls_opendevicebyindex_ex(index: Int32; pipe_size: UInt32; packet_length: UInt32; var handle: TLSHandle): TLSResult; cdecl; external DLLName name 'ls_opendevicebyindex_ex';
function ls_opendevicebyserial_ex(serial_num: PAnsiChar; pipe_size: UInt32; packet_length: UInt32; var handle: TLSHandle): TLSResult; cdecl; external DLLName name 'ls_opendevicebyserial_ex';
function ls_closedevice_ex(handle: TLSHandle): TLSResult; cdecl; external DLLName name 'ls_closedevice_ex';
function ls_getpipe_ex(handle: TLSHandle; buffer: Pointer; to_read: UInt32; var read_count: UInt32): TLSResult; cdecl; external DLLName name 'ls_getpipe_ex';
function ls_waitforpipe_ex(handle: TLSHandle; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_waitforpipe_ex';
function ls_waitforpipecount_ex(handle: TLSHandle; count: Int32; var available: Int32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_waitforpipecount_ex';
function ls_getfps_ex(handle: TLSHandle): UInt32; cdecl; external DLLName name 'ls_getfps_ex';
function ls_getpacketlength_ex(handle: TLSHandle; var packet_length: UInt32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getpacketlength_ex';
function ls_customfirmware_ex(handle: TLSHandle; var custom_firmware: UInt32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_customfirmware_ex';
function ls_setcfg1_ex(handle: TLSHandle; cfg1: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_setcfg1_ex';
function ls_getcfg1_ex(handle: TLSHandle; var cfg1: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getcfg1_ex';
function ls_setslaveaddress_ex(handle: TLSHandle; address: Byte; new_address: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_setslaveaddress_ex';
function ls_getslaveaddress_ex(handle: TLSHandle; address: Byte; var new_address: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getslaveaddress_ex';
function ls_saveslaveaddress_ex(handle: TLSHandle; address: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_saveslaveaddress_ex';
function ls_setmuxchannel_ex(handle: TLSHandle; mux: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_setmuxchannel_ex';
function ls_getmuxchannel_ex(handle: TLSHandle; var mux: ShortInt; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getmuxchannel_ex';
function ls_readi2c_ex(handle: TLSHandle; i2c_address: Byte; buffer: Pointer; var length: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_readi2c_ex';
function ls_writei2c_ex(handle: TLSHandle; i2c_address: Byte; buffer: Pointer; length: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_writei2c_ex';
function ls_readi2c_ext_ex(handle: TLSHandle; i2c_address: Byte; buffer: Pointer; var length: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_readi2c_ext_ex';
function ls_writei2c_ext_ex(handle: TLSHandle; i2c_address: Byte; buffer: Pointer; length: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_writei2c_ext_ex';
function ls_i2cread1byte_ex(handle: TLSHandle; i2c_address: Byte; i2c_register: Byte; var value: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_i2cread1byte_ex';
function ls_i2cread2bytes_ex(handle: TLSHandle; i2c_address: Byte; i2c_register: Byte; var value: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_i2cread2bytes_ex';
function ls_i2cread4bytes_ex(handle: TLSHandle; i2c_address: Byte; i2c_register: Byte; var value: UInt32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_i2cread4bytes_ex';
function ls_i2cwrite1byte_ex(handle: TLSHandle; i2c_address: Byte; i2c_register: Byte; value: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_i2cwrite1byte_ex';
function ls_i2cwrite2bytes_ex(handle: TLSHandle; i2c_address: Byte; i2c_register: Byte; value: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_i2cwrite2bytes_ex';
function ls_i2cwrite4bytes_ex(handle: TLSHandle; i2c_address: Byte; i2c_register: Byte; value: UInt32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_i2cwrite4bytes_ex';
function ls_i2cwritecmd_ex(handle: TLSHandle; i2c_address: Byte; i2c_command: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_i2cwritecmd_ex';
function ls_hw_reset_ex(handle: TLSHandle; address: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_hw_reset_ex';
function ls_resume_ex(handle: TLSHandle; address: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_resume_ex';
function ls_suspend_ex(handle: TLSHandle; address: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_suspend_ex';
function ls_updateparam_ex(handle: TLSHandle; address: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_updateparam_ex';
function ls_setstate_ex(handle: TLSHandle; address: Byte; state: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_setstate_ex';
function ls_setmodeconfig_ex(handle: TLSHandle; address: Byte; mode: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_setmodeconfig_ex';
function ls_setifconfig_ex(handle: TLSHandle; address: Byte; config: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_setifconfig_ex';
function ls_setsthigh_ex(handle: TLSHandle; address: Byte; high_value: UInt32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_setsthigh_ex';
function ls_setstlow_ex(handle: TLSHandle; address: Byte; low_value: UInt32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_setstlow_ex';
function ls_setstpulse_ex(handle: TLSHandle; address: Byte; high_value: UInt32; low_value: UInt32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_setstpulse_ex';
function ls_setlinesperframe_ex(handle: TLSHandle; address: Byte; lines: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_setlinesperframe_ex';
function ls_setquadcount_ex(handle: TLSHandle; address: Byte; count: UInt32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_setquadcount_ex';
function ls_setsofttriggertime_ex(handle: TLSHandle; address: Byte; time_value: UInt32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_setsofttriggertime_ex';
function ls_settriggerdelay_ex(handle: TLSHandle; address: Byte; delay_value: UInt32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_settriggerdelay_ex';
function ls_settriggerwidth_ex(handle: TLSHandle; address: Byte; width_value: UInt32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_settriggerwidth_ex';
function ls_setpixelcount_ex(handle: TLSHandle; address: Byte; pixel_count: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_setpixelcount_ex';
function ls_setedgedelay_ex(handle: TLSHandle; address: Byte; edge_delay: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_setedgedelay_ex';
function ls_setadcvref_ex(handle: TLSHandle; address: Byte; vref: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_setadcvref_ex';
function ls_setadcgain_ex(handle: TLSHandle; address: Byte; gain: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_setadcgain_ex';
function ls_setadcoffset_ex(handle: TLSHandle; address: Byte; offset: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_setadcoffset_ex';
function ls_setadcbias_ex(handle: TLSHandle; address: Byte; bias: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_setadcbias_ex';
function ls_getctgstate_ex(handle: TLSHandle; address: Byte; var state: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getctgstate_ex';
function ls_getstate_ex(handle: TLSHandle; address: Byte; var state: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getstate_ex';
function ls_getmodeconfig_ex(handle: TLSHandle; address: Byte; var mode: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getmodeconfig_ex';
function ls_getifconfig_ex(handle: TLSHandle; address: Byte; var config: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getifconfig_ex';
function ls_getsthigh_ex(handle: TLSHandle; address: Byte; var high_value: UInt32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getsthigh_ex';
function ls_getstlow_ex(handle: TLSHandle; address: Byte; var low_value: UInt32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getstlow_ex';
function ls_getstpulse_ex(handle: TLSHandle; address: Byte; var high_value: UInt32; var low_value: UInt32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getstpulse_ex';
function ls_getlinesperframe_ex(handle: TLSHandle; address: Byte; var lines: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getlinesperframe_ex';
function ls_getquadcount_ex(handle: TLSHandle; address: Byte; var count: UInt32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getquadcount_ex';
function ls_getsofttriggertime_ex(handle: TLSHandle; address: Byte; var time_value: UInt32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getsofttriggertime_ex';
function ls_gettriggerdelay_ex(handle: TLSHandle; address: Byte; var delay_value: UInt32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_gettriggerdelay_ex';
function ls_gettriggerwidth_ex(handle: TLSHandle; address: Byte; var width_value: UInt32; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_gettriggerwidth_ex';
function ls_getpixelcount_ex(handle: TLSHandle; address: Byte; var pixel_count: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getpixelcount_ex';
function ls_getedgedelay_ex(handle: TLSHandle; address: Byte; var edge_delay: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getedgedelay_ex';
function ls_getadcvref_ex(handle: TLSHandle; address: Byte; var vref: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getadcvref_ex';
function ls_getadcgain_ex(handle: TLSHandle; address: Byte; var gain: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getadcgain_ex';
function ls_getgainmult_ex(handle: TLSHandle; address: Byte; var multiplier: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getgainmult_ex';
function ls_getgaindiv_ex(handle: TLSHandle; address: Byte; var divisor: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getgaindiv_ex';
function ls_getadcoffset_ex(handle: TLSHandle; address: Byte; var offset: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getadcoffset_ex';
function ls_getadcbias_ex(handle: TLSHandle; address: Byte; var bias: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getadcbias_ex';
function ls_savesettings_ex(handle: TLSHandle; address: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_savesettings_ex';
function ls_reloadsettings_ex(handle: TLSHandle; address: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_reloadsettings_ex';
function ls_resetsettings_ex(handle: TLSHandle; address: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_resetsettings_ex';
function ls_getinitstatus_ex(handle: TLSHandle; address: Byte; var status: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getinitstatus_ex';
function ls_getcomresult_ex(handle: TLSHandle; address: Byte; var result_value: Byte; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getcomresult_ex';
function ls_getmcuversion_ex(handle: TLSHandle; address: Byte; var version: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getmcuversion_ex';
function ls_getctgversion_ex(handle: TLSHandle; address: Byte; var version: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_getctgversion_ex';
function ls_gethw1id_ex(handle: TLSHandle; address: Byte; var hardware_id: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_gethw1id_ex';
function ls_gethw1version_ex(handle: TLSHandle; address: Byte; var version: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_gethw1version_ex';
function ls_gethw2version_ex(handle: TLSHandle; address: Byte; var version: Word; timeout_ms: UInt32): TLSResult; cdecl; external DLLName name 'ls_gethw2version_ex';
{$ENDIF}

implementation

end.
