Software Drivers

xversion.h File Reference


Detailed Description

This file contains the interface for the XVersion component. This component represents a version ID. It is encapsulated within a component so that it's type and implementation can change without affecting users of it.

The version is formatted as X.YYZ where X = 0 - 9, Y = 00 - 99, Z = a - z X is the major revision, YY is the minor revision, and Z is the compatability revision.

Packed versions are also utilized for the configuration ROM such that memory is minimized. A packed version consumes only 16 bits and is formatted as follows.

 Revision                  Range       Bit Positions

 Major Revision            0 - 9       Bits 15 - 12
 Minor Revision            0 - 99      Bits 11 - 5
 Compatability Revision    a - z       Bits 4 - 0

 MODIFICATION HISTORY:

 Ver   Who    Date   Changes
 ----- ---- -------- -------------------------------------------------------
 1.00a xd   11/03/04 Improved support for doxygen.
 


Functions

void XVersion_UnPack (XVersion *InstancePtr, u16 PackedVersion)
int XVersion_Pack (XVersion *InstancePtr, u16 *PackedVersion)
int XVersion_IsEqual (XVersion *InstancePtr, XVersion *VersionPtr)
void XVersion_ToString (XVersion *InstancePtr, char *StringPtr)
int XVersion_FromString (XVersion *InstancePtr, char *StringPtr)
void XVersion_Copy (XVersion *InstancePtr, XVersion *VersionPtr)


Function Documentation

void XVersion_Copy ( XVersion *  InstancePtr,
XVersion *  VersionPtr 
)

Copies the contents of a version to another version.

Parameters:
InstancePtr points to the version which is the source of data for the copy operation.
VersionPtr points to another version which is the destination of the copy operation.
Returns:
None.

Note:
None.

int XVersion_FromString ( XVersion *  InstancePtr,
char *  StringPtr 
)

Initializes a version from a null terminated string. Since the string may not be a format which is compatible with the version, an error could occur.

Parameters:
InstancePtr points to the version which is to be initialized.
StringPtr points to a null terminated string which will be converted to a version. The format of the string must match the version string format which is X.YYX where X = 0 - 9, YY = 00 - 99, Z = a - z.
Returns:
A status, XST_SUCCESS, indicating the conversion was accomplished successfully, or XST_INVALID_VERSION indicating the version string format was not valid.

Note:
None.

int XVersion_IsEqual ( XVersion *  InstancePtr,
XVersion *  VersionPtr 
)

Determines if two versions are equal.

Parameters:
InstancePtr points to the first version to be compared.
VersionPtr points to a second version to be compared.
Returns:
TRUE if the versions are equal, FALSE otherwise.

Note:
None.

int XVersion_Pack ( XVersion *  InstancePtr,
u16 *  PackedVersionPtr 
)

Packs a version into the specified packed version. Versions are packed into the configuration ROM to reduce the amount storage.

Parameters:
InstancePtr points to the version to pack.
PackedVersionPtr points to the packed version which will receive the new packed version.
Returns:
A status, XST_SUCCESS, indicating the packing was accomplished successfully, or an error, XST_INVALID_VERSION, indicating the specified input version was not valid such that the pack did not occur

The packed version pointed to by PackedVersionPtr is modified with the new packed version if the status indicates success.

Note:
None.

void XVersion_ToString ( XVersion *  InstancePtr,
char *  StringPtr 
)

Converts a version to a null terminated string.

Parameters:
InstancePtr points to the version to convert.
StringPtr points to the string which will be the result of the conversion. This does not need to point to a null terminated string as an input, but must point to storage which is an adequate amount to hold the result string.
Returns:
The null terminated string is inserted at the location pointed to by StringPtr if the status indicates success.

Note:
It is necessary for the caller to have already allocated the storage to contain the string. The amount of memory necessary for the string is specified in the version header file.

void XVersion_UnPack ( XVersion *  InstancePtr,
u16  PackedVersion 
)

Unpacks a packed version into the specified version. Versions are packed into the configuration ROM to reduce the amount storage. A packed version is a binary format as oppossed to a non-packed version which is implemented as a string.

Parameters:
InstancePtr points to the version to unpack the packed version into.
PackedVersion contains the packed version to unpack.
Returns:
None.
Note:
None.