elftosb::version_t Struct Reference

Same version struct used for 3600 boot image. More...

`#include <Version.h>`

## Public Member Functions

| version_t (uint16_t maj, uint16_t min, uint16_t rev)
| version_t (const std::string &versionString)
void | set (const std::string &versionString)
| Sets the version by parsing a string. More...
void | fixByteOrder ()
| Converts host endian BCD version values to the equivalent big-endian BCD values. More...

## Public Attributes

uint16_t | m_major
uint16_t | m_pad0
uint16_t | m_minor
uint16_t | m_pad1
uint16_t | m_revision
uint16_t | m_pad2

## Detailed Description

Same version struct used for 3600 boot image.

## Member Function Documentation

void version_t::fixByteOrder | ( |  | ) |

Converts host endian BCD version values to the equivalent big-endian BCD values.

The output is a half-word. And BCD is inherently big-endian, or byte ordered, if you prefer to think of it that way. So for little endian systems, we need to convert the output half-word in reverse byte order. When it is written to disk or a buffer it will come out big endian.

For example:

- The input is BCD in host endian format, so 0x1234. Written to a file, this would come out as 0x34 0x12, reverse of what we want.
- The desired BCD output is the two bytes 0x12 0x34.
- So the function's uint16_t result must be 0x3412 on a little-endian host.

On big endian hosts, we don't have to worry about byte swapping.

void version_t::set | ( | const std::string & | versionString | ) |

Sets the version by parsing a string.

Parses a string in the form "xxx.xxx.xxx" (where x is a digit) into three version fields for major, minor, and revision. The output is right aligned BCD in host-natural byte order.

Parameters

  versionString | String containing the version.

The documentation for this struct was generated from the following files:

- Version.h
- Version.cpp