Search by Tags

Img Info Lib API

 

Article updated at 28 Oct 2017
Compare with Revision

Attention: this is a legacy library and thus not supported by Toradex anymore. We recommend that you use the new libraries for all Toradex modules. Please see the Toradex CE Libraries and Code Samples for up-to-date information.

Library to interact with Image Information.

Data Structures

struct  ROMHDRstruct  TOCentrystruct  FILESentrystruct  COPYentrystruct  VERSIONINFOstruct  BSPVER

Macros

#define  IMG_VER_MAJ  1
Library Version.
#define  IMG_VER_MIN  4
#define  IMG_VER_BUILD  0
#define  VI_MAGIC1  0x01234567
#define  VI_MAGIC2  0x89abcdef

Typedefs

typedef struct ROMHDR ROMHDR
typedef struct TOCentry TOCentry
typedef struct TOCentry LPTOCentry
typedef struct FILESentry FILESentry
typedef struct FILESentry LPFILESentry
typedef struct COPYentry COPYentry

Functions

BOOL  ImgInfoLibInit (void)
BOOL  ImgInfoLibDeInit (void)
BOOL  FindVersionInfo (BSPVER *pBspVer)
BOOL  FindVersionInfoEx (BSPVER *pBspVer, DWORD startAddr, DWORD length)
char *  FindVersionString (char *pStr)
BOOL  GetTOC (DWORD address, ROMHDR *pTOC, DWORD *pTOCOffset)
DWORD  GetIMAGESize (DWORD address)
BOOL  FindIMAGE (BOOL bImage, DWORD *pStart, DWORD *pLen)
BOOL  GetFlashBootloaderInfo (BSPVER *pBspVer, TCHAR *dateStr)
BOOL  GetFlashBootloaderInfoEx (BSPVER *pBspVer, TCHAR *dateStr, DWORD start, DWORD length)
void  GetCurrentImageInfo (BSPVER *pBspVer, TCHAR *dateStr)
void  IMGGetLibVersion (DWORD *pVerMaj, DWORD *pVerMin, DWORD *pBuild)

Macro Definition Documentation

#define IMG_VER_BUILD   0
#define IMG_VER_MAJ   1

Library Version.

#define IMG_VER_MIN   4
#define VI_MAGIC1   0x01234567
#define VI_MAGIC2   0x89abcdef

Typedef Documentation

typedef struct COPYentry COPYentry
typedef struct FILESentry FILESentry
typedef struct FILESentry * LPFILESentry
typedef struct TOCentry * LPTOCentry
typedef struct ROMHDR ROMHDR
typedef struct TOCentry TOCentry

Function Documentation

BOOL FindIMAGE ( BOOL  bImage,
DWORD *  pStart,
DWORD *  pLen
)

Find the image in the Flash

Parameters:
[in] bImage TRUE: Skip First Sector
[out] pStart Pointer to start of image
[out] pLen Pointer to length of image
Return values:
TRUE Success
FALSE Error
BOOL FindVersionInfo ( BSPVER pBspVer )

Finds the BSP Version starting from 0x00 for 256Kb

Parameters:
[out] pBspVer Pointer to BSP Version Structure
Return values:
TRUE Success
FALSE Error
BOOL FindVersionInfoEx ( BSPVER pBspVer,
DWORD  startAddr,
DWORD  length
)

Finds the BSP Version, use the supplied start address and length

Parameters:
[in] startAddr Start Address
[in] length Search length
[out] pBspVer Pointer to BSP Version Structure
Return values:
TRUE Success
FALSE Error
char* FindVersionString ( char *  pStr )

Finds the given string

Parameters:
[in] pStr Pointer to zero-terminated string to find
Return values:
>0 Pointer to last character of the string
NULL(0) String not found
void GetCurrentImageInfo ( BSPVER pBspVer,
TCHAR *  dateStr
)

Get the Current Imae Info

Parameters:
[in] pBspVer Pointer to BSP Version
[in] dateStr Date String
BOOL GetFlashBootloaderInfo ( BSPVER pBspVer,
TCHAR *  dateStr
)

Get the Bootloader info from the flash, search the whole of the flash

Parameters:
[in] pBspVer Pointer to BSP Version
[in] dateStr Date String
Return values:
TRUE Success
FALSE Error
BOOL GetFlashBootloaderInfoEx ( BSPVER pBspVer,
TCHAR *  dateStr,
DWORD  start,
DWORD  length
)

Get the Bootloader info from the flash

Parameters:
[in] pBspVer Pointer to BSP Version
[in] dateStr Date String
[in] start Start Address
[in] length Length
Return values:
TRUE Success
FALSE Error
DWORD GetIMAGESize ( DWORD  address )

Get the Image Size

Parameters:
[in] address Starting Address
Return values:
Image Size in bytes

Remarks: We also search at 32KB offset for romhdr (eboot offset
in eboot_formatted.bin)

BOOL GetTOC ( DWORD  address,
ROMHDR pTOC,
DWORD *  pTOCOffset
)

Get the Table of Contents Pointer

Parameters:
[in] address Starting address
[out] pTOC Pointer to TOC
[out] pTOCOffset Pointer to TOC Offset
Return values:
TRUE Success
FALSE Error
void IMGGetLibVersion ( DWORD *  pVerMaj,
DWORD *  pVerMin,
DWORD *  pBuild
)

Outputs library version

Parameters:
[out] verMaj Major version number. Set this parameter to NULL if not required
[out] verMin Minor version number. Set this parameter to NULL if not required
[out] build Build number. Set this parameter to NULL if not required
BOOL ImgInfoLibDeInit ( void  )

Frees the Image Information library

Return values:
TRUE Success
FALSE Error
BOOL ImgInfoLibInit ( void  )

Initialise the Image Information Library.

Return values:
TRUE Success
FALSE Error