/*===========================================================================
FILE: 
   GobiImageMgmtAPI.h

DESCRIPTION:
   QUALCOMM Image Management API for Gobi 3000

Copyright (C) 2011 QUALCOMM Incorporated. All rights reserved.
                   QUALCOMM Proprietary/GTDR

All data and information contained in or disclosed by this document is
confidential and proprietary information of QUALCOMM Incorporated and all
rights therein are expressly reserved.  By accepting this material the
recipient agrees that this material and the information contained therein
is held in confidence and in trust and will not be used, copied, reproduced
in whole or in part, nor its contents revealed in any manner to others
without the express written permission of QUALCOMM Incorporated.
==========================================================================*/

/*=========================================================================*/
// Pragmas
/*=========================================================================*/
#pragma once

//---------------------------------------------------------------------------
// Definitions
//---------------------------------------------------------------------- -----

// The actual Gobi IM API functions are tagged/exported with this
#ifndef IMPORTGOBI
#define IMPORTGOBI extern "C" __declspec( dllimport ) 
#endif

// Calling convention for API
#define GOBIAPI __cdecl

#ifdef __cplusplus
   extern "C" {
#endif

#define UNIQUE_ID_LEN           16
#define MAX_BUILDID_LEN         255
#define MAX_NO_OF_FW			5

typedef struct
{
   BYTE 	imageType;
   CHAR 	uniqueID[UNIQUE_ID_LEN];
   BYTE		buildIDLen;
   CHAR		buildID[MAX_BUILDID_LEN];
} curFwImageList;

typedef struct
{
    BYTE      		numInstances;
    curFwImageList 	fwImage[MAX_NO_OF_FW];
} arrFwImageList;



#ifdef __cplusplus
   };
#endif

/*=========================================================================*/
// Prototypes
/*=========================================================================*/

/*===========================================================================
METHOD:
   GetImagesPreference

DESCRIPTION:
   This function gets the current images preference

PARAMETERS:
   pImageListSize [I/O] - Upon input the size in BYTEs of the image list 
                          array.  Upon success the actual number of BYTEs 
                          copied to the image list array
   pImageList     [ O ] - The image info list array 
  
RETURN VALUE:
   ULONG - Return code
===========================================================================*/
IMPORTGOBI ULONG GOBIAPI GetImagesPreference( 
   ULONG *                    pImageListSize, 
   BYTE *                     pImageList );

/*===========================================================================
METHOD:
   SetImagesPreference

DESCRIPTION:
   This function sets the current images preference

PARAMETERS:
   imageListSize     [ I ] - The size in BYTEs of the image list array
   pImageList        [ I ] - The image list array
   bForceDownload    [ I ] - Force device to download images from host?
   modemIndex        [ I ] - Desired storage index for downloaded modem image
   pImageTypesSize   [I/O] - Upon input the maximum number of elements that 
                             the download image types array can contain.  
                             Upon successful output the actual number of 
                             elements in the download image types array 
   pImageTypes       [ O ] - The download image types array 

RETURN VALUE:
   ULONG - Return code
===========================================================================*/
IMPORTGOBI ULONG GOBIAPI SetImagesPreference( 
   ULONG                      imageListSize, 
   BYTE *                     pImageList,
   ULONG                      bForceDownload,
   BYTE                       modemIndex,
   ULONG *                    pImageTypesSize, 
   BYTE *                     pImageTypes );

/*===========================================================================
METHOD:
   GetBARMode

DESCRIPTION:
   This function returns the boot and recovery image download mode

PARAMETERS:
   pBARMode    [ O ] - Boot and recovery image download mode

RETURN VALUE:
   ULONG - Return code
===========================================================================*/
IMPORTGOBI ULONG GOBIAPI GetBARMode( ULONG * pBARMode );

/*===========================================================================
METHOD:
   SetBARMode

DESCRIPTION:
   This function requests the device enter boot and recovery image download
   mode after the next reset

RETURN VALUE:
   ULONG - Return code
===========================================================================*/
IMPORTGOBI ULONG GOBIAPI SetBARMode();

/*===========================================================================
METHOD:
   GetStoredImages

DESCRIPTION:
   This function gets the list of images stored on the device

PARAMETERS:
   pImageListSize [I/O] - Upon input the size in BYTEs of the image list 
                          array.  Upon success the actual number of BYTEs 
                          copied to the image list array
   pImageList     [ O ] - The image info list array 
  
RETURN VALUE:
   ULONG - Return code
===========================================================================*/
IMPORTGOBI ULONG GOBIAPI GetStoredImages( 
   ULONG *                    pImageListSize, 
   BYTE *                     pImageList );

/*===========================================================================
METHOD:
   GetStoredImageInfo

DESCRIPTION:
   This function returns info about the specified image from the device

PARAMETERS:
   imageInfoSize  [ I ] - The size in BYTEs of the image info array
   pImageInfo     [ I ] - The image info array
   pMajorVersion  [ O ] - Major version of compatible boot downloader
   pMinorVersion  [ O ] - Minor version of compatible boot downloader
   pVersionID     [ O ] - Image version ID
   pInfo          [ O ] - Image info string
   pLockID        [ O ] - Image OEM lock ID

RETURN VALUE:
   ULONG - Return code
===========================================================================*/
IMPORTGOBI ULONG GOBIAPI GetStoredImageInfo( 
   ULONG                      imageInfoSize, 
   BYTE *                     pImageInfo,
   ULONG *                    pMajorVersion, 
   ULONG *                    pMinorVersion,
   ULONG *                    pVersionID,
   CHAR *                     pInfo,
   ULONG *                    pLockID );

/*===========================================================================
METHOD:
   DeleteStoredImage

DESCRIPTION:
   This function deletes the specified image from the device

PARAMETERS:
   imageInfoSize  [ I ] - The size in BYTEs of the image info array
   pImageInfo     [ I ] - The image info array

RETURN VALUE:
   ULONG - Return code
===========================================================================*/
IMPORTGOBI ULONG GOBIAPI DeleteStoredImage( 
   ULONG                      imageInfoSize, 
   BYTE *                     pImageInfo );

/*===========================================================================
METHOD:
   ResetDevice

DESCRIPTION:
   This function resets the device

RETURN VALUE:
   ULONG - Return code
===========================================================================*/
IMPORTGOBI ULONG GOBIAPI ResetDevice();

IMPORTGOBI ULONG GOBIAPI SwiGetFwCurImage(
	arrFwImageList* pImageList);

