General MDBEngine API programming reference.


Contents

Introduction

ResetTarget

DownloadTarget

EngineVersion

GetDeviceCount

GetDeviceID

SetDeviceID

Introduction

The function calls of this section apply to any device used with MDB engine. This function calls can be used at any time even if the target firmware is not downloaded yet.

If a function call returns FALSE you may use the Windows API call 'GetLastError()' to retrieve more information on the error.   

ResetTarget

Physical reset of the connected USB / MDB interface.

extern "C" BOOL WINAPI ResetTarget(DWORD dwDevice);

Parameters:

    dwDevice

        [IN] Device ID if more than one device is connected. Normally 0 for the first device.

Return value:

    TRUE on success.

DownloadTarget

Download the target firmware to the USB / MDB interface. After powerup or connection to the USB bus, the interface does not have a firmware. So the first step before any call to the MDBEngine, the firmware must be downloaded. 

extern "C" BOOL WINAPI DownloadTarget(DWORD dwDevice=DOWNLOAD_ALL, DWORD dwRetries=10);

Parameters:

    dwDevice

        [IN] Device ID if more than one device is connected. Normally 0 for the first device.

    dwRetries

        [IN] Number of retries to connect the device after download.

Return value:

    TRUE on success.

Notes:

DOWNLOAD_ALL specifies to download the firmware to all devices if there is more than one connected.

If just one is connected use the defined constant DOWNLOAD_DEFAULT.

EngineVersion

Retrieve the current version of the active MDBEngine.

extern "C" BOOL WINAPI EngineVersion(VERSION_INFO* pInfo);

Parameters:

    pInfo

        [OUT] Returns the version and options of the current loaded MDBEngine DLL.

Return value:

    TRUE on success.

Note:

Structure of version info:

typedef struct tag_VERSION_INFO
{
    DWORD dwVersion;
    DWORD dwOptions;
}
VERSION_INFO;

GetDeviceCount

Retrieve the number of connected devices.

extern "C" BOOL WINAPI GetDeviceCount(DWORD* pdwDevices);

Parameters:

    pdwDevices

        [OUT] Returns the number of current connected devices.

Return value:

    TRUE on success.

Note:

This function call is available for the SetID tool to enumerate the connected devices.

GetDeviceID

Retrieve the device ID of a connected device.

extern "C" BOOL WINAPI GetDeviceID(DWORD dwDevice, DWORD* pdwID);

Parameters:

    dwDevice

        [IN] Device number.

    pdwID

        [OUT] Returns the device ID of the specified device number.

Return value:

    TRUE on success.

Note:

This function call is available for the SetID tool.

SetDeviceID

Set the device ID of a connected device.

extern "C" BOOL WINAPI SetDeviceID(DWORD dwDevice, DWORD dwID);

Parameters:

    dwDevice

        [IN] Device number.

    dwID

        [IN] The new device ID for the specified device.

Return value:

    TRUE on success.

Note:

This function call is available for the SetID tool.

To use this function call, just one connected device is allowed.


[Home] - Copyright © 2002-2003  by BonusData AG, webmaster@bonusdata.net. Last update: 29.06.2003