
/* Copyright (c) 2013-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 *
 * This software is available to you under a choice of one of two
 * licenses.  You may choose to be licensed under the terms of the GNU
 * General Public License (GPL) Version 2, available from the file
 * COPYING in the main directory of this source tree, or the
 * OpenIB.org BSD license below:
 *
 *     Redistribution and use in source and binary forms, with or
 *     without modification, are permitted provided that the following
 *     conditions are met:
 *
 *      - Redistributions of source code must retain the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer.
 *
 *      - Redistributions in binary form must reproduce the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer in the documentation and/or other materials
 *        provided with the distribution.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

 

/***
         *** This file was generated at "2023-03-07 14:03:35"
         *** by:
         ***    > [REDACTED]/adb2pack.py --input adb/image_layout/image_layout.adb --file-prefix image_layout --prefix image_layout_ --no-adb-utils
         ***/
#include "image_layout_layouts.h"

void image_layout_uint64_pack(const u_int64_t *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	adb2c_push_integer_to_buff(ptr_buff, offset, 8, *ptr_struct);
}

void image_layout_uint64_unpack(u_int64_t *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	*ptr_struct = adb2c_pop_integer_from_buff(ptr_buff, offset, 8);
}

void image_layout_uint64_print(const u_int64_t *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_uint64 ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "uint64               : " U64H_FMT "\n", (u_int64_t) *ptr_struct);
}

unsigned int image_layout_uint64_size(void)
{
	return IMAGE_LAYOUT_UINT64_SIZE;
}

void image_layout_uint64_dump(const u_int64_t *ptr_struct, FILE *fd)
{
	image_layout_uint64_print(ptr_struct, fd, 0);
}

void image_layout_component_authentication_configuration_pack(const struct image_layout_component_authentication_configuration *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 24;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->auth_type);
	offset = 6;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->c_r_token_en);
	offset = 5;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->btc_token_en);
	offset = 4;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->frc_en);
	offset = 3;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->mlnx_nvconfig_en);
	offset = 2;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->vendor_nvconfig_en);
	offset = 1;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->cs_token_en);
	offset = 0;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->fw_en);
}

void image_layout_component_authentication_configuration_unpack(struct image_layout_component_authentication_configuration *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 24;
	ptr_struct->auth_type = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 6;
	ptr_struct->c_r_token_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 5;
	ptr_struct->btc_token_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 4;
	ptr_struct->frc_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 3;
	ptr_struct->mlnx_nvconfig_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 2;
	ptr_struct->vendor_nvconfig_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 1;
	ptr_struct->cs_token_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 0;
	ptr_struct->fw_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
}

void image_layout_component_authentication_configuration_print(const struct image_layout_component_authentication_configuration *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_component_authentication_configuration ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "auth_type            : " UH_FMT "\n", ptr_struct->auth_type);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "c_r_token_en         : " UH_FMT "\n", ptr_struct->c_r_token_en);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "btc_token_en         : " UH_FMT "\n", ptr_struct->btc_token_en);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "frc_en               : " UH_FMT "\n", ptr_struct->frc_en);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "mlnx_nvconfig_en     : " UH_FMT "\n", ptr_struct->mlnx_nvconfig_en);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "vendor_nvconfig_en   : " UH_FMT "\n", ptr_struct->vendor_nvconfig_en);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "cs_token_en          : " UH_FMT "\n", ptr_struct->cs_token_en);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "fw_en                : " UH_FMT "\n", ptr_struct->fw_en);
}

unsigned int image_layout_component_authentication_configuration_size(void)
{
	return IMAGE_LAYOUT_COMPONENT_AUTHENTICATION_CONFIGURATION_SIZE;
}

void image_layout_component_authentication_configuration_dump(const struct image_layout_component_authentication_configuration *ptr_struct, FILE *fd)
{
	image_layout_component_authentication_configuration_print(ptr_struct, fd, 0);
}

void image_layout_htoc_entry_pack(const struct image_layout_htoc_entry *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 16;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->hash_offset);
	offset = 8;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->section_type);
}

void image_layout_htoc_entry_unpack(struct image_layout_htoc_entry *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 16;
	ptr_struct->hash_offset = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
	offset = 8;
	ptr_struct->section_type = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}

void image_layout_htoc_entry_print(const struct image_layout_htoc_entry *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_htoc_entry ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "hash_offset          : " UH_FMT "\n", ptr_struct->hash_offset);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "section_type         : " UH_FMT "\n", ptr_struct->section_type);
}

unsigned int image_layout_htoc_entry_size(void)
{
	return IMAGE_LAYOUT_HTOC_ENTRY_SIZE;
}

void image_layout_htoc_entry_dump(const struct image_layout_htoc_entry *ptr_struct, FILE *fd)
{
	image_layout_htoc_entry_print(ptr_struct, fd, 0);
}

void image_layout_htoc_header_pack(const struct image_layout_htoc_header *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->version);
	offset = 56;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->num_of_entries);
	offset = 48;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->hash_type);
	offset = 32;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->hash_size);
}

void image_layout_htoc_header_unpack(struct image_layout_htoc_header *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	ptr_struct->version = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	offset = 56;
	ptr_struct->num_of_entries = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 48;
	ptr_struct->hash_type = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 32;
	ptr_struct->hash_size = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
}

void image_layout_htoc_header_print(const struct image_layout_htoc_header *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_htoc_header ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "version              : " U32H_FMT "\n", ptr_struct->version);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "num_of_entries       : " UH_FMT "\n", ptr_struct->num_of_entries);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "hash_type            : " UH_FMT "\n", ptr_struct->hash_type);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "hash_size            : " UH_FMT "\n", ptr_struct->hash_size);
}

unsigned int image_layout_htoc_header_size(void)
{
	return IMAGE_LAYOUT_HTOC_HEADER_SIZE;
}

void image_layout_htoc_header_dump(const struct image_layout_htoc_header *ptr_struct, FILE *fd)
{
	image_layout_htoc_header_print(ptr_struct, fd, 0);
}

void image_layout_module_version_pack(const struct image_layout_module_version *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 24;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->branch);
	offset = 12;
	adb2c_push_bits_to_buff(ptr_buff, offset, 12, (u_int32_t)ptr_struct->minor);
	offset = 0;
	adb2c_push_bits_to_buff(ptr_buff, offset, 12, (u_int32_t)ptr_struct->major);
}

void image_layout_module_version_unpack(struct image_layout_module_version *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 24;
	ptr_struct->branch = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 12;
	ptr_struct->minor = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 12);
	offset = 0;
	ptr_struct->major = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 12);
}

void image_layout_module_version_print(const struct image_layout_module_version *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_module_version ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "branch               : " UH_FMT "\n", ptr_struct->branch);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "minor                : " UH_FMT "\n", ptr_struct->minor);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "major                : " UH_FMT "\n", ptr_struct->major);
}

unsigned int image_layout_module_version_size(void)
{
	return IMAGE_LAYOUT_MODULE_VERSION_SIZE;
}

void image_layout_module_version_dump(const struct image_layout_module_version *ptr_struct, FILE *fd)
{
	image_layout_module_version_print(ptr_struct, fd, 0);
}

void image_layout_reset_capabilities_pack(const struct image_layout_reset_capabilities *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 31;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->reset_ver_en);
	offset = 16;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->version_vector_ver);
}

void image_layout_reset_capabilities_unpack(struct image_layout_reset_capabilities *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 31;
	ptr_struct->reset_ver_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 16;
	ptr_struct->version_vector_ver = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}

void image_layout_reset_capabilities_print(const struct image_layout_reset_capabilities *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_reset_capabilities ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "reset_ver_en         : " UH_FMT "\n", ptr_struct->reset_ver_en);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "version_vector_ver   : " UH_FMT "\n", ptr_struct->version_vector_ver);
}

unsigned int image_layout_reset_capabilities_size(void)
{
	return IMAGE_LAYOUT_RESET_CAPABILITIES_SIZE;
}

void image_layout_reset_capabilities_dump(const struct image_layout_reset_capabilities *ptr_struct, FILE *fd)
{
	image_layout_reset_capabilities_print(ptr_struct, fd, 0);
}

void image_layout_reset_version_pack(const struct image_layout_reset_version *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 16;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->major);
	offset = 12;
	adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->branch);
	offset = 4;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->minor);
}

void image_layout_reset_version_unpack(struct image_layout_reset_version *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 16;
	ptr_struct->major = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
	offset = 12;
	ptr_struct->branch = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
	offset = 4;
	ptr_struct->minor = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}

void image_layout_reset_version_print(const struct image_layout_reset_version *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_reset_version ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "major                : " UH_FMT "\n", ptr_struct->major);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "branch               : " UH_FMT "\n", ptr_struct->branch);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "minor                : " UH_FMT "\n", ptr_struct->minor);
}

unsigned int image_layout_reset_version_size(void)
{
	return IMAGE_LAYOUT_RESET_VERSION_SIZE;
}

void image_layout_reset_version_dump(const struct image_layout_reset_version *ptr_struct, FILE *fd)
{
	image_layout_reset_version_print(ptr_struct, fd, 0);
}

void image_layout_uid_entry_pack(const struct image_layout_uid_entry *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 24;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->num_allocated);
	offset = 16;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->step);
	offset = 8;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->num_allocated_msb);
	offset = 64;
	adb2c_push_integer_to_buff(ptr_buff, offset, 8, ptr_struct->uid);
}

void image_layout_uid_entry_unpack(struct image_layout_uid_entry *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 24;
	ptr_struct->num_allocated = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 16;
	ptr_struct->step = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 8;
	ptr_struct->num_allocated_msb = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 64;
	ptr_struct->uid = adb2c_pop_integer_from_buff(ptr_buff, offset, 8);
}

void image_layout_uid_entry_print(const struct image_layout_uid_entry *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_uid_entry ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "num_allocated        : " UH_FMT "\n", ptr_struct->num_allocated);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "step                 : " UH_FMT "\n", ptr_struct->step);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "num_allocated_msb    : " UH_FMT "\n", ptr_struct->num_allocated_msb);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "uid                  : " U64H_FMT "\n", ptr_struct->uid);
}

unsigned int image_layout_uid_entry_size(void)
{
	return IMAGE_LAYOUT_UID_ENTRY_SIZE;
}

void image_layout_uid_entry_dump(const struct image_layout_uid_entry *ptr_struct, FILE *fd)
{
	image_layout_uid_entry_print(ptr_struct, fd, 0);
}

void image_layout_FW_VERSION_pack(const struct image_layout_FW_VERSION *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->MAJOR);
	offset = 48;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->SUBMINOR);
	offset = 32;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->MINOR);
	offset = 80;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->Hour);
	offset = 72;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->Minutes);
	offset = 64;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->Seconds);
	offset = 120;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->Day);
	offset = 112;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->Month);
	offset = 96;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->Year);
}

void image_layout_FW_VERSION_unpack(struct image_layout_FW_VERSION *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	ptr_struct->MAJOR = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
	offset = 48;
	ptr_struct->SUBMINOR = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
	offset = 32;
	ptr_struct->MINOR = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
	offset = 80;
	ptr_struct->Hour = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 72;
	ptr_struct->Minutes = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 64;
	ptr_struct->Seconds = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 120;
	ptr_struct->Day = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 112;
	ptr_struct->Month = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 96;
	ptr_struct->Year = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
}

void image_layout_FW_VERSION_print(const struct image_layout_FW_VERSION *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_FW_VERSION ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "MAJOR                : " UH_FMT "\n", ptr_struct->MAJOR);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "SUBMINOR             : " UH_FMT "\n", ptr_struct->SUBMINOR);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "MINOR                : " UH_FMT "\n", ptr_struct->MINOR);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "Hour                 : " UH_FMT "\n", ptr_struct->Hour);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "Minutes              : " UH_FMT "\n", ptr_struct->Minutes);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "Seconds              : " UH_FMT "\n", ptr_struct->Seconds);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "Day                  : " UH_FMT "\n", ptr_struct->Day);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "Month                : " UH_FMT "\n", ptr_struct->Month);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "Year                 : " UH_FMT "\n", ptr_struct->Year);
}

unsigned int image_layout_FW_VERSION_size(void)
{
	return IMAGE_LAYOUT_FW_VERSION_SIZE;
}

void image_layout_FW_VERSION_dump(const struct image_layout_FW_VERSION *ptr_struct, FILE *fd)
{
	image_layout_FW_VERSION_print(ptr_struct, fd, 0);
}

void image_layout_TRIPPLE_VERSION_pack(const struct image_layout_TRIPPLE_VERSION *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->MAJOR);
	offset = 48;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->SUBMINOR);
	offset = 32;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->MINOR);
}

void image_layout_TRIPPLE_VERSION_unpack(struct image_layout_TRIPPLE_VERSION *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	ptr_struct->MAJOR = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
	offset = 48;
	ptr_struct->SUBMINOR = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
	offset = 32;
	ptr_struct->MINOR = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
}

void image_layout_TRIPPLE_VERSION_print(const struct image_layout_TRIPPLE_VERSION *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_TRIPPLE_VERSION ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "MAJOR                : " UH_FMT "\n", ptr_struct->MAJOR);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "SUBMINOR             : " UH_FMT "\n", ptr_struct->SUBMINOR);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "MINOR                : " UH_FMT "\n", ptr_struct->MINOR);
}

unsigned int image_layout_TRIPPLE_VERSION_size(void)
{
	return IMAGE_LAYOUT_TRIPPLE_VERSION_SIZE;
}

void image_layout_TRIPPLE_VERSION_dump(const struct image_layout_TRIPPLE_VERSION *ptr_struct, FILE *fd)
{
	image_layout_TRIPPLE_VERSION_print(ptr_struct, fd, 0);
}

void image_layout_file_public_keys_pack(const struct image_layout_file_public_keys *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	offset = 0;
	image_layout_component_authentication_configuration_pack(&(ptr_struct->component_authentication_configuration), ptr_buff + offset / 8);
	offset = 96;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->keypair_exp);
	for (i = 0; i < 4; ++i) {
		offset = adb2c_calc_array_field_address(128, 32, i, 2304, 1);
		adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->keypair_uuid[i]);
	}
	for (i = 0; i < 64; ++i) {
		offset = adb2c_calc_array_field_address(256, 32, i, 2304, 1);
		adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->key[i]);
	}
}

void image_layout_file_public_keys_unpack(struct image_layout_file_public_keys *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	offset = 0;
	image_layout_component_authentication_configuration_unpack(&(ptr_struct->component_authentication_configuration), ptr_buff + offset / 8);
	offset = 96;
	ptr_struct->keypair_exp = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	for (i = 0; i < 4; ++i) {
		offset = adb2c_calc_array_field_address(128, 32, i, 2304, 1);
		ptr_struct->keypair_uuid[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	}
	for (i = 0; i < 64; ++i) {
		offset = adb2c_calc_array_field_address(256, 32, i, 2304, 1);
		ptr_struct->key[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	}
}

void image_layout_file_public_keys_print(const struct image_layout_file_public_keys *ptr_struct, FILE *fd, int indent_level)
{
	int i;

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_file_public_keys ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "component_authentication_configuration:\n");
	image_layout_component_authentication_configuration_print(&(ptr_struct->component_authentication_configuration), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "keypair_exp          : " U32H_FMT "\n", ptr_struct->keypair_exp);
	for (i = 0; i < 4; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "keypair_uuid_%03d    : " U32H_FMT "\n", i, ptr_struct->keypair_uuid[i]);
	}
	for (i = 0; i < 64; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "key_%03d             : " U32H_FMT "\n", i, ptr_struct->key[i]);
	}
}

unsigned int image_layout_file_public_keys_size(void)
{
	return IMAGE_LAYOUT_FILE_PUBLIC_KEYS_SIZE;
}

void image_layout_file_public_keys_dump(const struct image_layout_file_public_keys *ptr_struct, FILE *fd)
{
	image_layout_file_public_keys_print(ptr_struct, fd, 0);
}

void image_layout_file_public_keys_2_pack(const struct image_layout_file_public_keys_2 *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	offset = 0;
	image_layout_component_authentication_configuration_pack(&(ptr_struct->component_authentication_configuration), ptr_buff + offset / 8);
	offset = 96;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->keypair_exp);
	for (i = 0; i < 4; ++i) {
		offset = adb2c_calc_array_field_address(128, 32, i, 4352, 1);
		adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->keypair_uuid[i]);
	}
	for (i = 0; i < 128; ++i) {
		offset = adb2c_calc_array_field_address(256, 32, i, 4352, 1);
		adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->key[i]);
	}
}

void image_layout_file_public_keys_2_unpack(struct image_layout_file_public_keys_2 *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	offset = 0;
	image_layout_component_authentication_configuration_unpack(&(ptr_struct->component_authentication_configuration), ptr_buff + offset / 8);
	offset = 96;
	ptr_struct->keypair_exp = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	for (i = 0; i < 4; ++i) {
		offset = adb2c_calc_array_field_address(128, 32, i, 4352, 1);
		ptr_struct->keypair_uuid[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	}
	for (i = 0; i < 128; ++i) {
		offset = adb2c_calc_array_field_address(256, 32, i, 4352, 1);
		ptr_struct->key[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	}
}

void image_layout_file_public_keys_2_print(const struct image_layout_file_public_keys_2 *ptr_struct, FILE *fd, int indent_level)
{
	int i;

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_file_public_keys_2 ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "component_authentication_configuration:\n");
	image_layout_component_authentication_configuration_print(&(ptr_struct->component_authentication_configuration), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "keypair_exp          : " U32H_FMT "\n", ptr_struct->keypair_exp);
	for (i = 0; i < 4; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "keypair_uuid_%03d    : " U32H_FMT "\n", i, ptr_struct->keypair_uuid[i]);
	}
	for (i = 0; i < 128; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "key_%03d             : " U32H_FMT "\n", i, ptr_struct->key[i]);
	}
}

unsigned int image_layout_file_public_keys_2_size(void)
{
	return IMAGE_LAYOUT_FILE_PUBLIC_KEYS_2_SIZE;
}

void image_layout_file_public_keys_2_dump(const struct image_layout_file_public_keys_2 *ptr_struct, FILE *fd)
{
	image_layout_file_public_keys_2_print(ptr_struct, fd, 0);
}

void image_layout_file_public_keys_3_pack(const struct image_layout_file_public_keys_3 *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	offset = 0;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->keypair_exp);
	for (i = 0; i < 4; ++i) {
		offset = adb2c_calc_array_field_address(32, 32, i, 4352, 1);
		adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->keypair_uuid[i]);
	}
	for (i = 0; i < 128; ++i) {
		offset = adb2c_calc_array_field_address(160, 32, i, 4352, 1);
		adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->key[i]);
	}
	offset = 4256;
	image_layout_component_authentication_configuration_pack(&(ptr_struct->component_authentication_configuration), ptr_buff + offset / 8);
}

void image_layout_file_public_keys_3_unpack(struct image_layout_file_public_keys_3 *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	offset = 0;
	ptr_struct->keypair_exp = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	for (i = 0; i < 4; ++i) {
		offset = adb2c_calc_array_field_address(32, 32, i, 4352, 1);
		ptr_struct->keypair_uuid[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	}
	for (i = 0; i < 128; ++i) {
		offset = adb2c_calc_array_field_address(160, 32, i, 4352, 1);
		ptr_struct->key[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	}
	offset = 4256;
	image_layout_component_authentication_configuration_unpack(&(ptr_struct->component_authentication_configuration), ptr_buff + offset / 8);
}

void image_layout_file_public_keys_3_print(const struct image_layout_file_public_keys_3 *ptr_struct, FILE *fd, int indent_level)
{
	int i;

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_file_public_keys_3 ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "keypair_exp          : " U32H_FMT "\n", ptr_struct->keypair_exp);
	for (i = 0; i < 4; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "keypair_uuid_%03d    : " U32H_FMT "\n", i, ptr_struct->keypair_uuid[i]);
	}
	for (i = 0; i < 128; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "key_%03d             : " U32H_FMT "\n", i, ptr_struct->key[i]);
	}
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "component_authentication_configuration:\n");
	image_layout_component_authentication_configuration_print(&(ptr_struct->component_authentication_configuration), fd, indent_level + 1);
}

unsigned int image_layout_file_public_keys_3_size(void)
{
	return IMAGE_LAYOUT_FILE_PUBLIC_KEYS_3_SIZE;
}

void image_layout_file_public_keys_3_dump(const struct image_layout_file_public_keys_3 *ptr_struct, FILE *fd)
{
	image_layout_file_public_keys_3_print(ptr_struct, fd, 0);
}

void image_layout_guids_pack(const struct image_layout_guids *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	image_layout_uid_entry_pack(&(ptr_struct->guids), ptr_buff + offset / 8);
	offset = 128;
	image_layout_uid_entry_pack(&(ptr_struct->macs), ptr_buff + offset / 8);
}

void image_layout_guids_unpack(struct image_layout_guids *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	image_layout_uid_entry_unpack(&(ptr_struct->guids), ptr_buff + offset / 8);
	offset = 128;
	image_layout_uid_entry_unpack(&(ptr_struct->macs), ptr_buff + offset / 8);
}

void image_layout_guids_print(const struct image_layout_guids *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_guids ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "guids:\n");
	image_layout_uid_entry_print(&(ptr_struct->guids), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "macs:\n");
	image_layout_uid_entry_print(&(ptr_struct->macs), fd, indent_level + 1);
}

unsigned int image_layout_guids_size(void)
{
	return IMAGE_LAYOUT_GUIDS_SIZE;
}

void image_layout_guids_dump(const struct image_layout_guids *ptr_struct, FILE *fd)
{
	image_layout_guids_print(ptr_struct, fd, 0);
}

void image_layout_hashes_table_header_pack(const struct image_layout_hashes_table_header *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->load_address);
	offset = 32;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->dw_size);
	offset = 80;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->crc);
}

void image_layout_hashes_table_header_unpack(struct image_layout_hashes_table_header *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	ptr_struct->load_address = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	offset = 32;
	ptr_struct->dw_size = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	offset = 80;
	ptr_struct->crc = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
}

void image_layout_hashes_table_header_print(const struct image_layout_hashes_table_header *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_hashes_table_header ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "load_address         : " U32H_FMT "\n", ptr_struct->load_address);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "dw_size              : " U32H_FMT "\n", ptr_struct->dw_size);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "crc                  : " UH_FMT "\n", ptr_struct->crc);
}

unsigned int image_layout_hashes_table_header_size(void)
{
	return IMAGE_LAYOUT_HASHES_TABLE_HEADER_SIZE;
}

void image_layout_hashes_table_header_dump(const struct image_layout_hashes_table_header *ptr_struct, FILE *fd)
{
	image_layout_hashes_table_header_print(ptr_struct, fd, 0);
}

void image_layout_htoc_pack(const struct image_layout_htoc *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	offset = 0;
	image_layout_htoc_header_pack(&(ptr_struct->header), ptr_buff + offset / 8);
	for (i = 0; i < 28; ++i) {
		offset = adb2c_calc_array_field_address(128, 64, i, 1920, 1);
		image_layout_htoc_entry_pack(&(ptr_struct->entry[i]), ptr_buff + offset / 8);
	}
}

void image_layout_htoc_unpack(struct image_layout_htoc *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	offset = 0;
	image_layout_htoc_header_unpack(&(ptr_struct->header), ptr_buff + offset / 8);
	for (i = 0; i < 28; ++i) {
		offset = adb2c_calc_array_field_address(128, 64, i, 1920, 1);
		image_layout_htoc_entry_unpack(&(ptr_struct->entry[i]), ptr_buff + offset / 8);
	}
}

void image_layout_htoc_print(const struct image_layout_htoc *ptr_struct, FILE *fd, int indent_level)
{
	int i;

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_htoc ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "header:\n");
	image_layout_htoc_header_print(&(ptr_struct->header), fd, indent_level + 1);
	for (i = 0; i < 28; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "entry_%03d:\n", i);
		image_layout_htoc_entry_print(&(ptr_struct->entry[i]), fd, indent_level + 1);
	}
}

unsigned int image_layout_htoc_size(void)
{
	return IMAGE_LAYOUT_HTOC_SIZE;
}

void image_layout_htoc_dump(const struct image_layout_htoc *ptr_struct, FILE *fd)
{
	image_layout_htoc_print(ptr_struct, fd, 0);
}

void image_layout_htoc_hash_pack(const struct image_layout_htoc_hash *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	for (i = 0; i < 16; ++i) {
		offset = adb2c_calc_array_field_address(0, 32, i, 512, 1);
		adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->hash_val[i]);
	}
}

void image_layout_htoc_hash_unpack(struct image_layout_htoc_hash *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	for (i = 0; i < 16; ++i) {
		offset = adb2c_calc_array_field_address(0, 32, i, 512, 1);
		ptr_struct->hash_val[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	}
}

void image_layout_htoc_hash_print(const struct image_layout_htoc_hash *ptr_struct, FILE *fd, int indent_level)
{
	int i;

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_htoc_hash ========\n");

	for (i = 0; i < 16; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "hash_val_%03d        : " U32H_FMT "\n", i, ptr_struct->hash_val[i]);
	}
}

unsigned int image_layout_htoc_hash_size(void)
{
	return IMAGE_LAYOUT_HTOC_HASH_SIZE;
}

void image_layout_htoc_hash_dump(const struct image_layout_htoc_hash *ptr_struct, FILE *fd)
{
	image_layout_htoc_hash_print(ptr_struct, fd, 0);
}

void image_layout_hw_pointer_entry_pack(const struct image_layout_hw_pointer_entry *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->ptr);
	offset = 48;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->crc);
}

void image_layout_hw_pointer_entry_unpack(struct image_layout_hw_pointer_entry *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	ptr_struct->ptr = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	offset = 48;
	ptr_struct->crc = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
}

void image_layout_hw_pointer_entry_print(const struct image_layout_hw_pointer_entry *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_hw_pointer_entry ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "ptr                  : " U32H_FMT "\n", ptr_struct->ptr);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "crc                  : " UH_FMT "\n", ptr_struct->crc);
}

unsigned int image_layout_hw_pointer_entry_size(void)
{
	return IMAGE_LAYOUT_HW_POINTER_ENTRY_SIZE;
}

void image_layout_hw_pointer_entry_dump(const struct image_layout_hw_pointer_entry *ptr_struct, FILE *fd)
{
	image_layout_hw_pointer_entry_print(ptr_struct, fd, 0);
}

void image_layout_image_size_pack(const struct image_layout_image_size *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 24;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->log_step);
	offset = 0;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->run_from_any);
	offset = 32;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->max_size);
}

void image_layout_image_size_unpack(struct image_layout_image_size *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 24;
	ptr_struct->log_step = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 0;
	ptr_struct->run_from_any = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 32;
	ptr_struct->max_size = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
}

void image_layout_image_size_print(const struct image_layout_image_size *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_image_size ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "log_step             : " UH_FMT "\n", ptr_struct->log_step);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "run_from_any         : " UH_FMT "\n", ptr_struct->run_from_any);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "max_size             : " U32H_FMT "\n", ptr_struct->max_size);
}

unsigned int image_layout_image_size_size(void)
{
	return IMAGE_LAYOUT_IMAGE_SIZE_SIZE;
}

void image_layout_image_size_dump(const struct image_layout_image_size *ptr_struct, FILE *fd)
{
	image_layout_image_size_print(ptr_struct, fd, 0);
}

void image_layout_module_versions_pack(const struct image_layout_module_versions *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	image_layout_module_version_pack(&(ptr_struct->core), ptr_buff + offset / 8);
	offset = 32;
	image_layout_module_version_pack(&(ptr_struct->phy), ptr_buff + offset / 8);
	offset = 64;
	image_layout_module_version_pack(&(ptr_struct->kernel), ptr_buff + offset / 8);
	offset = 96;
	image_layout_module_version_pack(&(ptr_struct->iron_image), ptr_buff + offset / 8);
	offset = 128;
	image_layout_module_version_pack(&(ptr_struct->host_management), ptr_buff + offset / 8);
	offset = 160;
	image_layout_module_version_pack(&(ptr_struct->mad), ptr_buff + offset / 8);
}

void image_layout_module_versions_unpack(struct image_layout_module_versions *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	image_layout_module_version_unpack(&(ptr_struct->core), ptr_buff + offset / 8);
	offset = 32;
	image_layout_module_version_unpack(&(ptr_struct->phy), ptr_buff + offset / 8);
	offset = 64;
	image_layout_module_version_unpack(&(ptr_struct->kernel), ptr_buff + offset / 8);
	offset = 96;
	image_layout_module_version_unpack(&(ptr_struct->iron_image), ptr_buff + offset / 8);
	offset = 128;
	image_layout_module_version_unpack(&(ptr_struct->host_management), ptr_buff + offset / 8);
	offset = 160;
	image_layout_module_version_unpack(&(ptr_struct->mad), ptr_buff + offset / 8);
}

void image_layout_module_versions_print(const struct image_layout_module_versions *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_module_versions ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "core:\n");
	image_layout_module_version_print(&(ptr_struct->core), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "phy:\n");
	image_layout_module_version_print(&(ptr_struct->phy), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "kernel:\n");
	image_layout_module_version_print(&(ptr_struct->kernel), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "iron_image:\n");
	image_layout_module_version_print(&(ptr_struct->iron_image), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "host_management:\n");
	image_layout_module_version_print(&(ptr_struct->host_management), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "mad:\n");
	image_layout_module_version_print(&(ptr_struct->mad), fd, indent_level + 1);
}

unsigned int image_layout_module_versions_size(void)
{
	return IMAGE_LAYOUT_MODULE_VERSIONS_SIZE;
}

void image_layout_module_versions_dump(const struct image_layout_module_versions *ptr_struct, FILE *fd)
{
	image_layout_module_versions_print(ptr_struct, fd, 0);
}

void image_layout_operation_key_pack(const struct image_layout_operation_key *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 16;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->key_modifier);
	offset = 64;
	adb2c_push_integer_to_buff(ptr_buff, offset, 8, ptr_struct->key);
}

void image_layout_operation_key_unpack(struct image_layout_operation_key *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 16;
	ptr_struct->key_modifier = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
	offset = 64;
	ptr_struct->key = adb2c_pop_integer_from_buff(ptr_buff, offset, 8);
}

void image_layout_operation_key_print(const struct image_layout_operation_key *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_operation_key ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "key_modifier         : " UH_FMT "\n", ptr_struct->key_modifier);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "key                  : " U64H_FMT "\n", ptr_struct->key);
}

unsigned int image_layout_operation_key_size(void)
{
	return IMAGE_LAYOUT_OPERATION_KEY_SIZE;
}

void image_layout_operation_key_dump(const struct image_layout_operation_key *ptr_struct, FILE *fd)
{
	image_layout_operation_key_print(ptr_struct, fd, 0);
}

void image_layout_version_vector_pack(const struct image_layout_version_vector *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	image_layout_reset_capabilities_pack(&(ptr_struct->reset_capabilities), ptr_buff + offset / 8);
	offset = 32;
	image_layout_reset_version_pack(&(ptr_struct->scratchpad), ptr_buff + offset / 8);
	offset = 64;
	image_layout_reset_version_pack(&(ptr_struct->icm_context), ptr_buff + offset / 8);
	offset = 96;
	image_layout_reset_version_pack(&(ptr_struct->pci), ptr_buff + offset / 8);
	offset = 128;
	image_layout_reset_version_pack(&(ptr_struct->phy), ptr_buff + offset / 8);
	offset = 160;
	image_layout_reset_version_pack(&(ptr_struct->ini), ptr_buff + offset / 8);
	offset = 192;
	image_layout_reset_version_pack(&(ptr_struct->reserved1), ptr_buff + offset / 8);
	offset = 224;
	image_layout_reset_version_pack(&(ptr_struct->reserved2), ptr_buff + offset / 8);
	offset = 256;
	image_layout_reset_version_pack(&(ptr_struct->reserved3), ptr_buff + offset / 8);
	offset = 288;
	image_layout_reset_version_pack(&(ptr_struct->reserved4), ptr_buff + offset / 8);
	offset = 320;
	image_layout_reset_version_pack(&(ptr_struct->reserved5), ptr_buff + offset / 8);
	offset = 352;
	image_layout_reset_version_pack(&(ptr_struct->reserved6), ptr_buff + offset / 8);
}

void image_layout_version_vector_unpack(struct image_layout_version_vector *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	image_layout_reset_capabilities_unpack(&(ptr_struct->reset_capabilities), ptr_buff + offset / 8);
	offset = 32;
	image_layout_reset_version_unpack(&(ptr_struct->scratchpad), ptr_buff + offset / 8);
	offset = 64;
	image_layout_reset_version_unpack(&(ptr_struct->icm_context), ptr_buff + offset / 8);
	offset = 96;
	image_layout_reset_version_unpack(&(ptr_struct->pci), ptr_buff + offset / 8);
	offset = 128;
	image_layout_reset_version_unpack(&(ptr_struct->phy), ptr_buff + offset / 8);
	offset = 160;
	image_layout_reset_version_unpack(&(ptr_struct->ini), ptr_buff + offset / 8);
	offset = 192;
	image_layout_reset_version_unpack(&(ptr_struct->reserved1), ptr_buff + offset / 8);
	offset = 224;
	image_layout_reset_version_unpack(&(ptr_struct->reserved2), ptr_buff + offset / 8);
	offset = 256;
	image_layout_reset_version_unpack(&(ptr_struct->reserved3), ptr_buff + offset / 8);
	offset = 288;
	image_layout_reset_version_unpack(&(ptr_struct->reserved4), ptr_buff + offset / 8);
	offset = 320;
	image_layout_reset_version_unpack(&(ptr_struct->reserved5), ptr_buff + offset / 8);
	offset = 352;
	image_layout_reset_version_unpack(&(ptr_struct->reserved6), ptr_buff + offset / 8);
}

void image_layout_version_vector_print(const struct image_layout_version_vector *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_version_vector ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "reset_capabilities:\n");
	image_layout_reset_capabilities_print(&(ptr_struct->reset_capabilities), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "scratchpad:\n");
	image_layout_reset_version_print(&(ptr_struct->scratchpad), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "icm_context:\n");
	image_layout_reset_version_print(&(ptr_struct->icm_context), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "pci:\n");
	image_layout_reset_version_print(&(ptr_struct->pci), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "phy:\n");
	image_layout_reset_version_print(&(ptr_struct->phy), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "ini:\n");
	image_layout_reset_version_print(&(ptr_struct->ini), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "reserved1:\n");
	image_layout_reset_version_print(&(ptr_struct->reserved1), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "reserved2:\n");
	image_layout_reset_version_print(&(ptr_struct->reserved2), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "reserved3:\n");
	image_layout_reset_version_print(&(ptr_struct->reserved3), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "reserved4:\n");
	image_layout_reset_version_print(&(ptr_struct->reserved4), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "reserved5:\n");
	image_layout_reset_version_print(&(ptr_struct->reserved5), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "reserved6:\n");
	image_layout_reset_version_print(&(ptr_struct->reserved6), fd, indent_level + 1);
}

unsigned int image_layout_version_vector_size(void)
{
	return IMAGE_LAYOUT_VERSION_VECTOR_SIZE;
}

void image_layout_version_vector_dump(const struct image_layout_version_vector *ptr_struct, FILE *fd)
{
	image_layout_version_vector_print(ptr_struct, fd, 0);
}

void image_layout_boot_version_pack(const struct image_layout_boot_version *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 24;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->minor_version);
	offset = 16;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->major_version);
	offset = 0;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->image_format_version);
}

void image_layout_boot_version_unpack(struct image_layout_boot_version *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 24;
	ptr_struct->minor_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 16;
	ptr_struct->major_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 0;
	ptr_struct->image_format_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}

void image_layout_boot_version_print(const struct image_layout_boot_version *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_boot_version ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "minor_version        : " UH_FMT "\n", ptr_struct->minor_version);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "major_version        : " UH_FMT "\n", ptr_struct->major_version);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "image_format_version : " UH_FMT "\n", ptr_struct->image_format_version);
}

unsigned int image_layout_boot_version_size(void)
{
	return IMAGE_LAYOUT_BOOT_VERSION_SIZE;
}

void image_layout_boot_version_dump(const struct image_layout_boot_version *ptr_struct, FILE *fd)
{
	image_layout_boot_version_print(ptr_struct, fd, 0);
}

void image_layout_device_info_pack(const struct image_layout_device_info *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	offset = 0;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->signature0);
	offset = 32;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->signature1);
	offset = 64;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->signature2);
	offset = 96;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->signature3);
	offset = 152;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->minor_version);
	offset = 143;
	adb2c_push_bits_to_buff(ptr_buff, offset, 9, (u_int32_t)ptr_struct->major_version);
	offset = 256;
	image_layout_guids_pack(&(ptr_struct->guids), ptr_buff + offset / 8);
	offset = 880;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->vsd_vendor_id);
	for (i = 0; i < 208; ++i) {
		offset = adb2c_calc_array_field_address(920, 8, i, 4096, 1);
		adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->vsd[i]);
	}
	for (i = 0; i < 4; ++i) {
		offset = adb2c_calc_array_field_address(2816, 128, i, 4096, 1);
		image_layout_operation_key_pack(&(ptr_struct->keys[i]), ptr_buff + offset / 8);
	}
	offset = 4080;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->crc);
}

void image_layout_device_info_unpack(struct image_layout_device_info *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	offset = 0;
	ptr_struct->signature0 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	offset = 32;
	ptr_struct->signature1 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	offset = 64;
	ptr_struct->signature2 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	offset = 96;
	ptr_struct->signature3 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	offset = 152;
	ptr_struct->minor_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 143;
	ptr_struct->major_version = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 9);
	offset = 256;
	image_layout_guids_unpack(&(ptr_struct->guids), ptr_buff + offset / 8);
	offset = 880;
	ptr_struct->vsd_vendor_id = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
	for (i = 0; i < 208; ++i) {
		offset = adb2c_calc_array_field_address(920, 8, i, 4096, 1);
		ptr_struct->vsd[i] = (char)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	}
		ptr_struct->vsd[208] = '\0';
	for (i = 0; i < 4; ++i) {
		offset = adb2c_calc_array_field_address(2816, 128, i, 4096, 1);
		image_layout_operation_key_unpack(&(ptr_struct->keys[i]), ptr_buff + offset / 8);
	}
	offset = 4080;
	ptr_struct->crc = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
}

void image_layout_device_info_print(const struct image_layout_device_info *ptr_struct, FILE *fd, int indent_level)
{
	int i;

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_device_info ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "signature0           : " U32H_FMT "\n", ptr_struct->signature0);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "signature1           : " U32H_FMT "\n", ptr_struct->signature1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "signature2           : " U32H_FMT "\n", ptr_struct->signature2);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "signature3           : " U32H_FMT "\n", ptr_struct->signature3);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "minor_version        : " UH_FMT "\n", ptr_struct->minor_version);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "major_version        : " UH_FMT "\n", ptr_struct->major_version);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "guids:\n");
	image_layout_guids_print(&(ptr_struct->guids), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "vsd_vendor_id        : " UH_FMT "\n", ptr_struct->vsd_vendor_id);
		fprintf(fd, "vsd                  : \"%s\"\n", ptr_struct->vsd);
	for (i = 0; i < 4; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "keys_%03d:\n", i);
		image_layout_operation_key_print(&(ptr_struct->keys[i]), fd, indent_level + 1);
	}
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "crc                  : " UH_FMT "\n", ptr_struct->crc);
}

unsigned int image_layout_device_info_size(void)
{
	return IMAGE_LAYOUT_DEVICE_INFO_SIZE;
}

void image_layout_device_info_dump(const struct image_layout_device_info *ptr_struct, FILE *fd)
{
	image_layout_device_info_print(ptr_struct, fd, 0);
}

void image_layout_hashes_table_pack(const struct image_layout_hashes_table *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	offset = 0;
	image_layout_hashes_table_header_pack(&(ptr_struct->header), ptr_buff + offset / 8);
	offset = 96;
	image_layout_htoc_pack(&(ptr_struct->htoc), ptr_buff + offset / 8);
	for (i = 0; i < 28; ++i) {
		offset = adb2c_calc_array_field_address(2016, 512, i, 16416, 1);
		image_layout_htoc_hash_pack(&(ptr_struct->hash[i]), ptr_buff + offset / 8);
	}
	offset = 16400;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->crc);
}

void image_layout_hashes_table_unpack(struct image_layout_hashes_table *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	offset = 0;
	image_layout_hashes_table_header_unpack(&(ptr_struct->header), ptr_buff + offset / 8);
	offset = 96;
	image_layout_htoc_unpack(&(ptr_struct->htoc), ptr_buff + offset / 8);
	for (i = 0; i < 28; ++i) {
		offset = adb2c_calc_array_field_address(2016, 512, i, 16416, 1);
		image_layout_htoc_hash_unpack(&(ptr_struct->hash[i]), ptr_buff + offset / 8);
	}
	offset = 16400;
	ptr_struct->crc = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
}

void image_layout_hashes_table_print(const struct image_layout_hashes_table *ptr_struct, FILE *fd, int indent_level)
{
	int i;

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_hashes_table ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "header:\n");
	image_layout_hashes_table_header_print(&(ptr_struct->header), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "htoc:\n");
	image_layout_htoc_print(&(ptr_struct->htoc), fd, indent_level + 1);
	for (i = 0; i < 28; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "hash_%03d:\n", i);
		image_layout_htoc_hash_print(&(ptr_struct->hash[i]), fd, indent_level + 1);
	}
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "crc                  : " UH_FMT "\n", ptr_struct->crc);
}

unsigned int image_layout_hashes_table_size(void)
{
	return IMAGE_LAYOUT_HASHES_TABLE_SIZE;
}

void image_layout_hashes_table_dump(const struct image_layout_hashes_table *ptr_struct, FILE *fd)
{
	image_layout_hashes_table_print(ptr_struct, fd, 0);
}

void image_layout_hw_pointers_carmel_pack(const struct image_layout_hw_pointers_carmel *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	image_layout_hw_pointer_entry_pack(&(ptr_struct->boot_record_ptr), ptr_buff + offset / 8);
	offset = 64;
	image_layout_hw_pointer_entry_pack(&(ptr_struct->boot2_ptr), ptr_buff + offset / 8);
	offset = 128;
	image_layout_hw_pointer_entry_pack(&(ptr_struct->toc_ptr), ptr_buff + offset / 8);
	offset = 192;
	image_layout_hw_pointer_entry_pack(&(ptr_struct->tools_ptr), ptr_buff + offset / 8);
	offset = 256;
	image_layout_hw_pointer_entry_pack(&(ptr_struct->authentication_start_pointer), ptr_buff + offset / 8);
	offset = 320;
	image_layout_hw_pointer_entry_pack(&(ptr_struct->authentication_end_pointer), ptr_buff + offset / 8);
	offset = 384;
	image_layout_hw_pointer_entry_pack(&(ptr_struct->digest_pointer), ptr_buff + offset / 8);
	offset = 448;
	image_layout_hw_pointer_entry_pack(&(ptr_struct->digest_recovery_key_pointer), ptr_buff + offset / 8);
	offset = 512;
	image_layout_hw_pointer_entry_pack(&(ptr_struct->fw_window_start_pointer), ptr_buff + offset / 8);
	offset = 576;
	image_layout_hw_pointer_entry_pack(&(ptr_struct->fw_window_end_pointer), ptr_buff + offset / 8);
	offset = 640;
	image_layout_hw_pointer_entry_pack(&(ptr_struct->image_info_section_pointer), ptr_buff + offset / 8);
	offset = 704;
	image_layout_hw_pointer_entry_pack(&(ptr_struct->image_signature_pointer), ptr_buff + offset / 8);
	offset = 768;
	image_layout_hw_pointer_entry_pack(&(ptr_struct->public_key_pointer), ptr_buff + offset / 8);
	offset = 832;
	image_layout_hw_pointer_entry_pack(&(ptr_struct->fw_security_version_pointer), ptr_buff + offset / 8);
	offset = 896;
	image_layout_hw_pointer_entry_pack(&(ptr_struct->gcm_iv_delta_pointer), ptr_buff + offset / 8);
	offset = 960;
	image_layout_hw_pointer_entry_pack(&(ptr_struct->hashes_table_pointer), ptr_buff + offset / 8);
}

void image_layout_hw_pointers_carmel_unpack(struct image_layout_hw_pointers_carmel *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	image_layout_hw_pointer_entry_unpack(&(ptr_struct->boot_record_ptr), ptr_buff + offset / 8);
	offset = 64;
	image_layout_hw_pointer_entry_unpack(&(ptr_struct->boot2_ptr), ptr_buff + offset / 8);
	offset = 128;
	image_layout_hw_pointer_entry_unpack(&(ptr_struct->toc_ptr), ptr_buff + offset / 8);
	offset = 192;
	image_layout_hw_pointer_entry_unpack(&(ptr_struct->tools_ptr), ptr_buff + offset / 8);
	offset = 256;
	image_layout_hw_pointer_entry_unpack(&(ptr_struct->authentication_start_pointer), ptr_buff + offset / 8);
	offset = 320;
	image_layout_hw_pointer_entry_unpack(&(ptr_struct->authentication_end_pointer), ptr_buff + offset / 8);
	offset = 384;
	image_layout_hw_pointer_entry_unpack(&(ptr_struct->digest_pointer), ptr_buff + offset / 8);
	offset = 448;
	image_layout_hw_pointer_entry_unpack(&(ptr_struct->digest_recovery_key_pointer), ptr_buff + offset / 8);
	offset = 512;
	image_layout_hw_pointer_entry_unpack(&(ptr_struct->fw_window_start_pointer), ptr_buff + offset / 8);
	offset = 576;
	image_layout_hw_pointer_entry_unpack(&(ptr_struct->fw_window_end_pointer), ptr_buff + offset / 8);
	offset = 640;
	image_layout_hw_pointer_entry_unpack(&(ptr_struct->image_info_section_pointer), ptr_buff + offset / 8);
	offset = 704;
	image_layout_hw_pointer_entry_unpack(&(ptr_struct->image_signature_pointer), ptr_buff + offset / 8);
	offset = 768;
	image_layout_hw_pointer_entry_unpack(&(ptr_struct->public_key_pointer), ptr_buff + offset / 8);
	offset = 832;
	image_layout_hw_pointer_entry_unpack(&(ptr_struct->fw_security_version_pointer), ptr_buff + offset / 8);
	offset = 896;
	image_layout_hw_pointer_entry_unpack(&(ptr_struct->gcm_iv_delta_pointer), ptr_buff + offset / 8);
	offset = 960;
	image_layout_hw_pointer_entry_unpack(&(ptr_struct->hashes_table_pointer), ptr_buff + offset / 8);
}

void image_layout_hw_pointers_carmel_print(const struct image_layout_hw_pointers_carmel *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_hw_pointers_carmel ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "boot_record_ptr:\n");
	image_layout_hw_pointer_entry_print(&(ptr_struct->boot_record_ptr), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "boot2_ptr:\n");
	image_layout_hw_pointer_entry_print(&(ptr_struct->boot2_ptr), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "toc_ptr:\n");
	image_layout_hw_pointer_entry_print(&(ptr_struct->toc_ptr), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "tools_ptr:\n");
	image_layout_hw_pointer_entry_print(&(ptr_struct->tools_ptr), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "authentication_start_pointer:\n");
	image_layout_hw_pointer_entry_print(&(ptr_struct->authentication_start_pointer), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "authentication_end_pointer:\n");
	image_layout_hw_pointer_entry_print(&(ptr_struct->authentication_end_pointer), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "digest_pointer:\n");
	image_layout_hw_pointer_entry_print(&(ptr_struct->digest_pointer), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "digest_recovery_key_pointer:\n");
	image_layout_hw_pointer_entry_print(&(ptr_struct->digest_recovery_key_pointer), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "fw_window_start_pointer:\n");
	image_layout_hw_pointer_entry_print(&(ptr_struct->fw_window_start_pointer), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "fw_window_end_pointer:\n");
	image_layout_hw_pointer_entry_print(&(ptr_struct->fw_window_end_pointer), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "image_info_section_pointer:\n");
	image_layout_hw_pointer_entry_print(&(ptr_struct->image_info_section_pointer), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "image_signature_pointer:\n");
	image_layout_hw_pointer_entry_print(&(ptr_struct->image_signature_pointer), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "public_key_pointer:\n");
	image_layout_hw_pointer_entry_print(&(ptr_struct->public_key_pointer), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "fw_security_version_pointer:\n");
	image_layout_hw_pointer_entry_print(&(ptr_struct->fw_security_version_pointer), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "gcm_iv_delta_pointer:\n");
	image_layout_hw_pointer_entry_print(&(ptr_struct->gcm_iv_delta_pointer), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "hashes_table_pointer:\n");
	image_layout_hw_pointer_entry_print(&(ptr_struct->hashes_table_pointer), fd, indent_level + 1);
}

unsigned int image_layout_hw_pointers_carmel_size(void)
{
	return IMAGE_LAYOUT_HW_POINTERS_CARMEL_SIZE;
}

void image_layout_hw_pointers_carmel_dump(const struct image_layout_hw_pointers_carmel *ptr_struct, FILE *fd)
{
	image_layout_hw_pointers_carmel_print(ptr_struct, fd, 0);
}

void image_layout_image_info_pack(const struct image_layout_image_info *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	offset = 30;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->toc_header_duplication);
	offset = 29;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->secure_boot);
	offset = 27;
	adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->encrypted_fw);
	offset = 26;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->windbond_flash_support);
	offset = 25;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->long_keys);
	offset = 24;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->debug_fw_tokens_supported);
	offset = 23;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->mcc_en);
	offset = 22;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->signed_vendor_nvconfig_files);
	offset = 21;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->signed_mlnx_nvconfig_files);
	offset = 20;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->frc_supported);
	offset = 19;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->cs_tokens_supported);
	offset = 18;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->debug_fw);
	offset = 17;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->signed_fw);
	offset = 16;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->secure_fw);
	offset = 8;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->minor_version);
	offset = 0;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->major_version);
	offset = 32;
	image_layout_FW_VERSION_pack(&(ptr_struct->FW_VERSION), ptr_buff + offset / 8);
	offset = 160;
	image_layout_TRIPPLE_VERSION_pack(&(ptr_struct->mic_version), ptr_buff + offset / 8);
	offset = 240;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->pci_vendor_id);
	offset = 224;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->pci_device_id);
	offset = 272;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->pci_sub_vendor_id);
	offset = 256;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->pci_subsystem_id);
	for (i = 0; i < 16; ++i) {
		offset = adb2c_calc_array_field_address(312, 8, i, 8192, 1);
		adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->psid[i]);
	}
	offset = 432;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->vsd_vendor_id);
	for (i = 0; i < 208; ++i) {
		offset = adb2c_calc_array_field_address(472, 8, i, 8192, 1);
		adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->vsd[i]);
	}
	offset = 2112;
	image_layout_image_size_pack(&(ptr_struct->image_size), ptr_buff + offset / 8);
	offset = 2200;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->synced_reset_downtime);
	offset = 2192;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->dtoc_offset);
	offset = 2176;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->toc_copy_ofst);
	for (i = 0; i < 4; ++i) {
		offset = adb2c_calc_array_field_address(2240, 32, i, 8192, 1);
		adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->supported_hw_id[i]);
	}
	offset = 2368;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->ini_file_num);
	offset = 2400;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->burn_image_size);
	offset = 3200;
	image_layout_version_vector_pack(&(ptr_struct->version_vector), ptr_buff + offset / 8);
	for (i = 0; i < 16; ++i) {
		offset = adb2c_calc_array_field_address(3608, 8, i, 8192, 1);
		adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->prod_ver[i]);
	}
	for (i = 0; i < 256; ++i) {
		offset = adb2c_calc_array_field_address(3736, 8, i, 8192, 1);
		adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->description[i]);
	}
	offset = 6144;
	image_layout_module_versions_pack(&(ptr_struct->module_versions), ptr_buff + offset / 8);
	for (i = 0; i < 64; ++i) {
		offset = adb2c_calc_array_field_address(6680, 8, i, 8192, 1);
		adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->name[i]);
	}
	for (i = 0; i < 128; ++i) {
		offset = adb2c_calc_array_field_address(7192, 8, i, 8192, 1);
		adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->prs_name[i]);
	}
}

void image_layout_image_info_unpack(struct image_layout_image_info *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	offset = 30;
	ptr_struct->toc_header_duplication = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 29;
	ptr_struct->secure_boot = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 27;
	ptr_struct->encrypted_fw = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
	offset = 26;
	ptr_struct->windbond_flash_support = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 25;
	ptr_struct->long_keys = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 24;
	ptr_struct->debug_fw_tokens_supported = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 23;
	ptr_struct->mcc_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 22;
	ptr_struct->signed_vendor_nvconfig_files = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 21;
	ptr_struct->signed_mlnx_nvconfig_files = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 20;
	ptr_struct->frc_supported = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 19;
	ptr_struct->cs_tokens_supported = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 18;
	ptr_struct->debug_fw = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 17;
	ptr_struct->signed_fw = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 16;
	ptr_struct->secure_fw = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 8;
	ptr_struct->minor_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 0;
	ptr_struct->major_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 32;
	image_layout_FW_VERSION_unpack(&(ptr_struct->FW_VERSION), ptr_buff + offset / 8);
	offset = 160;
	image_layout_TRIPPLE_VERSION_unpack(&(ptr_struct->mic_version), ptr_buff + offset / 8);
	offset = 240;
	ptr_struct->pci_vendor_id = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
	offset = 224;
	ptr_struct->pci_device_id = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
	offset = 272;
	ptr_struct->pci_sub_vendor_id = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
	offset = 256;
	ptr_struct->pci_subsystem_id = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
	for (i = 0; i < 16; ++i) {
		offset = adb2c_calc_array_field_address(312, 8, i, 8192, 1);
		ptr_struct->psid[i] = (char)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	}
		ptr_struct->psid[16] = '\0';
	offset = 432;
	ptr_struct->vsd_vendor_id = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
	for (i = 0; i < 208; ++i) {
		offset = adb2c_calc_array_field_address(472, 8, i, 8192, 1);
		ptr_struct->vsd[i] = (char)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	}
		ptr_struct->vsd[208] = '\0';
	offset = 2112;
	image_layout_image_size_unpack(&(ptr_struct->image_size), ptr_buff + offset / 8);
	offset = 2200;
	ptr_struct->synced_reset_downtime = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 2192;
	ptr_struct->dtoc_offset = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 2176;
	ptr_struct->toc_copy_ofst = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
	for (i = 0; i < 4; ++i) {
		offset = adb2c_calc_array_field_address(2240, 32, i, 8192, 1);
		ptr_struct->supported_hw_id[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	}
	offset = 2368;
	ptr_struct->ini_file_num = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	offset = 2400;
	ptr_struct->burn_image_size = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	offset = 3200;
	image_layout_version_vector_unpack(&(ptr_struct->version_vector), ptr_buff + offset / 8);
	for (i = 0; i < 16; ++i) {
		offset = adb2c_calc_array_field_address(3608, 8, i, 8192, 1);
		ptr_struct->prod_ver[i] = (char)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	}
		ptr_struct->prod_ver[16] = '\0';
	for (i = 0; i < 256; ++i) {
		offset = adb2c_calc_array_field_address(3736, 8, i, 8192, 1);
		ptr_struct->description[i] = (char)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	}
		ptr_struct->description[256] = '\0';
	offset = 6144;
	image_layout_module_versions_unpack(&(ptr_struct->module_versions), ptr_buff + offset / 8);
	for (i = 0; i < 64; ++i) {
		offset = adb2c_calc_array_field_address(6680, 8, i, 8192, 1);
		ptr_struct->name[i] = (char)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	}
		ptr_struct->name[64] = '\0';
	for (i = 0; i < 128; ++i) {
		offset = adb2c_calc_array_field_address(7192, 8, i, 8192, 1);
		ptr_struct->prs_name[i] = (char)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	}
		ptr_struct->prs_name[128] = '\0';
}

void image_layout_image_info_print(const struct image_layout_image_info *ptr_struct, FILE *fd, int indent_level)
{
	int i;

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_image_info ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "toc_header_duplication : " UH_FMT "\n", ptr_struct->toc_header_duplication);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "secure_boot          : " UH_FMT "\n", ptr_struct->secure_boot);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "encrypted_fw         : " UH_FMT "\n", ptr_struct->encrypted_fw);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "windbond_flash_support : " UH_FMT "\n", ptr_struct->windbond_flash_support);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "long_keys            : " UH_FMT "\n", ptr_struct->long_keys);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "debug_fw_tokens_supported : " UH_FMT "\n", ptr_struct->debug_fw_tokens_supported);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "mcc_en               : " UH_FMT "\n", ptr_struct->mcc_en);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "signed_vendor_nvconfig_files : " UH_FMT "\n", ptr_struct->signed_vendor_nvconfig_files);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "signed_mlnx_nvconfig_files : " UH_FMT "\n", ptr_struct->signed_mlnx_nvconfig_files);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "frc_supported        : " UH_FMT "\n", ptr_struct->frc_supported);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "cs_tokens_supported  : " UH_FMT "\n", ptr_struct->cs_tokens_supported);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "debug_fw             : " UH_FMT "\n", ptr_struct->debug_fw);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "signed_fw            : " UH_FMT "\n", ptr_struct->signed_fw);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "secure_fw            : " UH_FMT "\n", ptr_struct->secure_fw);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "minor_version        : " UH_FMT "\n", ptr_struct->minor_version);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "major_version        : " UH_FMT "\n", ptr_struct->major_version);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "FW_VERSION:\n");
	image_layout_FW_VERSION_print(&(ptr_struct->FW_VERSION), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "mic_version:\n");
	image_layout_TRIPPLE_VERSION_print(&(ptr_struct->mic_version), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "pci_vendor_id        : " UH_FMT "\n", ptr_struct->pci_vendor_id);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "pci_device_id        : " UH_FMT "\n", ptr_struct->pci_device_id);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "pci_sub_vendor_id    : " UH_FMT "\n", ptr_struct->pci_sub_vendor_id);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "pci_subsystem_id     : " UH_FMT "\n", ptr_struct->pci_subsystem_id);
		fprintf(fd, "psid                 : \"%s\"\n", ptr_struct->psid);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "vsd_vendor_id        : " UH_FMT "\n", ptr_struct->vsd_vendor_id);
		fprintf(fd, "vsd                  : \"%s\"\n", ptr_struct->vsd);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "image_size:\n");
	image_layout_image_size_print(&(ptr_struct->image_size), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "synced_reset_downtime : " UH_FMT "\n", ptr_struct->synced_reset_downtime);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "dtoc_offset         : " UH_FMT "\n", ptr_struct->dtoc_offset);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "toc_copy_ofst        : " UH_FMT "\n", ptr_struct->toc_copy_ofst);
	for (i = 0; i < 4; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "supported_hw_id_%03d : " U32H_FMT "\n", i, ptr_struct->supported_hw_id[i]);
	}
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "ini_file_num         : " U32H_FMT "\n", ptr_struct->ini_file_num);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "burn_image_size      : " U32H_FMT "\n", ptr_struct->burn_image_size);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "version_vector:\n");
	image_layout_version_vector_print(&(ptr_struct->version_vector), fd, indent_level + 1);
		fprintf(fd, "prod_ver             : \"%s\"\n", ptr_struct->prod_ver);
		fprintf(fd, "description          : \"%s\"\n", ptr_struct->description);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "module_versions:\n");
	image_layout_module_versions_print(&(ptr_struct->module_versions), fd, indent_level + 1);
		fprintf(fd, "name                 : \"%s\"\n", ptr_struct->name);
		fprintf(fd, "prs_name             : \"%s\"\n", ptr_struct->prs_name);
}

unsigned int image_layout_image_info_size(void)
{
	return IMAGE_LAYOUT_IMAGE_INFO_SIZE;
}

void image_layout_image_info_dump(const struct image_layout_image_info *ptr_struct, FILE *fd)
{
	image_layout_image_info_print(ptr_struct, fd, 0);
}

void image_layout_image_signature_pack(const struct image_layout_image_signature *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	for (i = 0; i < 4; ++i) {
		offset = adb2c_calc_array_field_address(0, 32, i, 2560, 1);
		adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->signature_uuid[i]);
	}
	for (i = 0; i < 4; ++i) {
		offset = adb2c_calc_array_field_address(128, 32, i, 2560, 1);
		adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->keypair_uuid[i]);
	}
	for (i = 0; i < 64; ++i) {
		offset = adb2c_calc_array_field_address(256, 32, i, 2560, 1);
		adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->signature[i]);
	}
}

void image_layout_image_signature_unpack(struct image_layout_image_signature *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	for (i = 0; i < 4; ++i) {
		offset = adb2c_calc_array_field_address(0, 32, i, 2560, 1);
		ptr_struct->signature_uuid[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	}
	for (i = 0; i < 4; ++i) {
		offset = adb2c_calc_array_field_address(128, 32, i, 2560, 1);
		ptr_struct->keypair_uuid[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	}
	for (i = 0; i < 64; ++i) {
		offset = adb2c_calc_array_field_address(256, 32, i, 2560, 1);
		ptr_struct->signature[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	}
}

void image_layout_image_signature_print(const struct image_layout_image_signature *ptr_struct, FILE *fd, int indent_level)
{
	int i;

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_image_signature ========\n");

	for (i = 0; i < 4; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "signature_uuid_%03d  : " U32H_FMT "\n", i, ptr_struct->signature_uuid[i]);
	}
	for (i = 0; i < 4; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "keypair_uuid_%03d    : " U32H_FMT "\n", i, ptr_struct->keypair_uuid[i]);
	}
	for (i = 0; i < 64; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "signature_%03d       : " U32H_FMT "\n", i, ptr_struct->signature[i]);
	}
}

unsigned int image_layout_image_signature_size(void)
{
	return IMAGE_LAYOUT_IMAGE_SIGNATURE_SIZE;
}

void image_layout_image_signature_dump(const struct image_layout_image_signature *ptr_struct, FILE *fd)
{
	image_layout_image_signature_print(ptr_struct, fd, 0);
}

void image_layout_image_signature_2_pack(const struct image_layout_image_signature_2 *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	for (i = 0; i < 4; ++i) {
		offset = adb2c_calc_array_field_address(0, 32, i, 4608, 1);
		adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->signature_uuid[i]);
	}
	for (i = 0; i < 4; ++i) {
		offset = adb2c_calc_array_field_address(128, 32, i, 4608, 1);
		adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->keypair_uuid[i]);
	}
	for (i = 0; i < 128; ++i) {
		offset = adb2c_calc_array_field_address(256, 32, i, 4608, 1);
		adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->signature[i]);
	}
}

void image_layout_image_signature_2_unpack(struct image_layout_image_signature_2 *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	for (i = 0; i < 4; ++i) {
		offset = adb2c_calc_array_field_address(0, 32, i, 4608, 1);
		ptr_struct->signature_uuid[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	}
	for (i = 0; i < 4; ++i) {
		offset = adb2c_calc_array_field_address(128, 32, i, 4608, 1);
		ptr_struct->keypair_uuid[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	}
	for (i = 0; i < 128; ++i) {
		offset = adb2c_calc_array_field_address(256, 32, i, 4608, 1);
		ptr_struct->signature[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	}
}

void image_layout_image_signature_2_print(const struct image_layout_image_signature_2 *ptr_struct, FILE *fd, int indent_level)
{
	int i;

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_image_signature_2 ========\n");

	for (i = 0; i < 4; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "signature_uuid_%03d  : " U32H_FMT "\n", i, ptr_struct->signature_uuid[i]);
	}
	for (i = 0; i < 4; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "keypair_uuid_%03d    : " U32H_FMT "\n", i, ptr_struct->keypair_uuid[i]);
	}
	for (i = 0; i < 128; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "signature_%03d       : " U32H_FMT "\n", i, ptr_struct->signature[i]);
	}
}

unsigned int image_layout_image_signature_2_size(void)
{
	return IMAGE_LAYOUT_IMAGE_SIGNATURE_2_SIZE;
}

void image_layout_image_signature_2_dump(const struct image_layout_image_signature_2 *ptr_struct, FILE *fd)
{
	image_layout_image_signature_2_print(ptr_struct, fd, 0);
}

void image_layout_itoc_entry_pack(const struct image_layout_itoc_entry *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 8;
	adb2c_push_bits_to_buff(ptr_buff, offset, 22, (u_int32_t)ptr_struct->size);
	offset = 0;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->type);
	offset = 34;
	adb2c_push_bits_to_buff(ptr_buff, offset, 30, (u_int32_t)ptr_struct->param0);
	offset = 33;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->cache_line_crc);
	offset = 32;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->zipped_image);
	offset = 64;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->param1);
	offset = 144;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->version);
	offset = 161;
	adb2c_push_bits_to_buff(ptr_buff, offset, 29, (u_int32_t)ptr_struct->flash_addr);
	offset = 208;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->section_crc);
	offset = 205;
	adb2c_push_bits_to_buff(ptr_buff, offset, 3, (u_int32_t)ptr_struct->crc);
	offset = 192;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->encrypted_section);
	offset = 240;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->itoc_entry_crc);
}

void image_layout_itoc_entry_unpack(struct image_layout_itoc_entry *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 8;
	ptr_struct->size = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 22);
	offset = 0;
	ptr_struct->type = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 34;
	ptr_struct->param0 = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 30);
	offset = 33;
	ptr_struct->cache_line_crc = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 32;
	ptr_struct->zipped_image = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 64;
	ptr_struct->param1 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	offset = 144;
	ptr_struct->version = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
	offset = 161;
	ptr_struct->flash_addr = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 29);
	offset = 208;
	ptr_struct->section_crc = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
	offset = 205;
	ptr_struct->crc = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 3);
	offset = 192;
	ptr_struct->encrypted_section = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 240;
	ptr_struct->itoc_entry_crc = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
}

void image_layout_itoc_entry_print(const struct image_layout_itoc_entry *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_itoc_entry ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "size                 : " UH_FMT "\n", ptr_struct->size);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "type                 : " UH_FMT "\n", ptr_struct->type);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "param0               : " UH_FMT "\n", ptr_struct->param0);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "cache_line_crc       : " UH_FMT "\n", ptr_struct->cache_line_crc);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "zipped_image         : " UH_FMT "\n", ptr_struct->zipped_image);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "param1               : " U32H_FMT "\n", ptr_struct->param1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "version              : " UH_FMT "\n", ptr_struct->version);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "flash_addr           : " UH_FMT "\n", ptr_struct->flash_addr);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "section_crc          : " UH_FMT "\n", ptr_struct->section_crc);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "crc                  : " UH_FMT "\n", ptr_struct->crc);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "encrypted_section    : " UH_FMT "\n", ptr_struct->encrypted_section);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "itoc_entry_crc       : " UH_FMT "\n", ptr_struct->itoc_entry_crc);
}

unsigned int image_layout_itoc_entry_size(void)
{
	return IMAGE_LAYOUT_ITOC_ENTRY_SIZE;
}

void image_layout_itoc_entry_dump(const struct image_layout_itoc_entry *ptr_struct, FILE *fd)
{
	image_layout_itoc_entry_print(ptr_struct, fd, 0);
}

void image_layout_itoc_header_pack(const struct image_layout_itoc_header *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->signature0);
	offset = 32;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->signature1);
	offset = 64;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->signature2);
	offset = 96;
	adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->signature3);
	offset = 152;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->version);
	offset = 128;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->flash_layout_version);
	offset = 184;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->num_of_entries);
	offset = 240;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->itoc_entry_crc);
}

void image_layout_itoc_header_unpack(struct image_layout_itoc_header *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 0;
	ptr_struct->signature0 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	offset = 32;
	ptr_struct->signature1 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	offset = 64;
	ptr_struct->signature2 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	offset = 96;
	ptr_struct->signature3 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	offset = 152;
	ptr_struct->version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 128;
	ptr_struct->flash_layout_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 184;
	ptr_struct->num_of_entries = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 240;
	ptr_struct->itoc_entry_crc = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
}

void image_layout_itoc_header_print(const struct image_layout_itoc_header *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_itoc_header ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "signature0           : " U32H_FMT "\n", ptr_struct->signature0);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "signature1           : " U32H_FMT "\n", ptr_struct->signature1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "signature2           : " U32H_FMT "\n", ptr_struct->signature2);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "signature3           : " U32H_FMT "\n", ptr_struct->signature3);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "version              : " UH_FMT "\n", ptr_struct->version);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "flash_layout_version : " UH_FMT "\n", ptr_struct->flash_layout_version);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "num_of_entries       : " UH_FMT "\n", ptr_struct->num_of_entries);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "itoc_entry_crc       : " UH_FMT "\n", ptr_struct->itoc_entry_crc);
}

unsigned int image_layout_itoc_header_size(void)
{
	return IMAGE_LAYOUT_ITOC_HEADER_SIZE;
}

void image_layout_itoc_header_dump(const struct image_layout_itoc_header *ptr_struct, FILE *fd)
{
	image_layout_itoc_header_print(ptr_struct, fd, 0);
}

void image_layout_mfg_info_pack(const struct image_layout_mfg_info *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	for (i = 0; i < 16; ++i) {
		offset = adb2c_calc_array_field_address(24, 8, i, 2560, 1);
		adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->psid[i]);
	}
	offset = 255;
	adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->guids_override_en);
	offset = 232;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->minor_version);
	offset = 224;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->major_version);
	offset = 256;
	image_layout_guids_pack(&(ptr_struct->guids), ptr_buff + offset / 8);
}

void image_layout_mfg_info_unpack(struct image_layout_mfg_info *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	for (i = 0; i < 16; ++i) {
		offset = adb2c_calc_array_field_address(24, 8, i, 2560, 1);
		ptr_struct->psid[i] = (char)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	}
		ptr_struct->psid[16] = '\0';
	offset = 255;
	ptr_struct->guids_override_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
	offset = 232;
	ptr_struct->minor_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 224;
	ptr_struct->major_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 256;
	image_layout_guids_unpack(&(ptr_struct->guids), ptr_buff + offset / 8);
}

void image_layout_mfg_info_print(const struct image_layout_mfg_info *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_mfg_info ========\n");

		fprintf(fd, "psid                 : \"%s\"\n", ptr_struct->psid);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "guids_override_en    : " UH_FMT "\n", ptr_struct->guids_override_en);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "minor_version        : " UH_FMT "\n", ptr_struct->minor_version);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "major_version        : " UH_FMT "\n", ptr_struct->major_version);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "guids:\n");
	image_layout_guids_print(&(ptr_struct->guids), fd, indent_level + 1);
}

unsigned int image_layout_mfg_info_size(void)
{
	return IMAGE_LAYOUT_MFG_INFO_SIZE;
}

void image_layout_mfg_info_dump(const struct image_layout_mfg_info *ptr_struct, FILE *fd)
{
	image_layout_mfg_info_print(ptr_struct, fd, 0);
}

void image_layout_public_keys_pack(const struct image_layout_public_keys *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	for (i = 0; i < 8; ++i) {
		offset = adb2c_calc_array_field_address(0, 2304, i, 18432, 1);
		image_layout_file_public_keys_pack(&(ptr_struct->file_public_keys[i]), ptr_buff + offset / 8);
	}
}

void image_layout_public_keys_unpack(struct image_layout_public_keys *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	for (i = 0; i < 8; ++i) {
		offset = adb2c_calc_array_field_address(0, 2304, i, 18432, 1);
		image_layout_file_public_keys_unpack(&(ptr_struct->file_public_keys[i]), ptr_buff + offset / 8);
	}
}

void image_layout_public_keys_print(const struct image_layout_public_keys *ptr_struct, FILE *fd, int indent_level)
{
	int i;

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_public_keys ========\n");

	for (i = 0; i < 8; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "file_public_keys_%03d:\n", i);
		image_layout_file_public_keys_print(&(ptr_struct->file_public_keys[i]), fd, indent_level + 1);
	}
}

unsigned int image_layout_public_keys_size(void)
{
	return IMAGE_LAYOUT_PUBLIC_KEYS_SIZE;
}

void image_layout_public_keys_dump(const struct image_layout_public_keys *ptr_struct, FILE *fd)
{
	image_layout_public_keys_print(ptr_struct, fd, 0);
}

void image_layout_public_keys_2_pack(const struct image_layout_public_keys_2 *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	for (i = 0; i < 8; ++i) {
		offset = adb2c_calc_array_field_address(0, 4352, i, 34816, 1);
		image_layout_file_public_keys_2_pack(&(ptr_struct->file_public_keys_2[i]), ptr_buff + offset / 8);
	}
}

void image_layout_public_keys_2_unpack(struct image_layout_public_keys_2 *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	for (i = 0; i < 8; ++i) {
		offset = adb2c_calc_array_field_address(0, 4352, i, 34816, 1);
		image_layout_file_public_keys_2_unpack(&(ptr_struct->file_public_keys_2[i]), ptr_buff + offset / 8);
	}
}

void image_layout_public_keys_2_print(const struct image_layout_public_keys_2 *ptr_struct, FILE *fd, int indent_level)
{
	int i;

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_public_keys_2 ========\n");

	for (i = 0; i < 8; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "file_public_keys_2_%03d:\n", i);
		image_layout_file_public_keys_2_print(&(ptr_struct->file_public_keys_2[i]), fd, indent_level + 1);
	}
}

unsigned int image_layout_public_keys_2_size(void)
{
	return IMAGE_LAYOUT_PUBLIC_KEYS_2_SIZE;
}

void image_layout_public_keys_2_dump(const struct image_layout_public_keys_2 *ptr_struct, FILE *fd)
{
	image_layout_public_keys_2_print(ptr_struct, fd, 0);
}

void image_layout_public_keys_3_pack(const struct image_layout_public_keys_3 *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	for (i = 0; i < 8; ++i) {
		offset = adb2c_calc_array_field_address(0, 4352, i, 34816, 1);
		image_layout_file_public_keys_3_pack(&(ptr_struct->file_public_keys_3[i]), ptr_buff + offset / 8);
	}
}

void image_layout_public_keys_3_unpack(struct image_layout_public_keys_3 *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	for (i = 0; i < 8; ++i) {
		offset = adb2c_calc_array_field_address(0, 4352, i, 34816, 1);
		image_layout_file_public_keys_3_unpack(&(ptr_struct->file_public_keys_3[i]), ptr_buff + offset / 8);
	}
}

void image_layout_public_keys_3_print(const struct image_layout_public_keys_3 *ptr_struct, FILE *fd, int indent_level)
{
	int i;

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_public_keys_3 ========\n");

	for (i = 0; i < 8; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "file_public_keys_3_%03d:\n", i);
		image_layout_file_public_keys_3_print(&(ptr_struct->file_public_keys_3[i]), fd, indent_level + 1);
	}
}

unsigned int image_layout_public_keys_3_size(void)
{
	return IMAGE_LAYOUT_PUBLIC_KEYS_3_SIZE;
}

void image_layout_public_keys_3_dump(const struct image_layout_public_keys_3 *ptr_struct, FILE *fd)
{
	image_layout_public_keys_3_print(ptr_struct, fd, 0);
}

void image_layout_secure_boot_signatures_pack(const struct image_layout_secure_boot_signatures *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	for (i = 0; i < 128; ++i) {
		offset = adb2c_calc_array_field_address(0, 32, i, 12288, 1);
		adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->boot_signature[i]);
	}
	for (i = 0; i < 128; ++i) {
		offset = adb2c_calc_array_field_address(4096, 32, i, 12288, 1);
		adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->critical_signature[i]);
	}
	for (i = 0; i < 128; ++i) {
		offset = adb2c_calc_array_field_address(8192, 32, i, 12288, 1);
		adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->non_critical_signature[i]);
	}
}

void image_layout_secure_boot_signatures_unpack(struct image_layout_secure_boot_signatures *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;
	int i;

	for (i = 0; i < 128; ++i) {
		offset = adb2c_calc_array_field_address(0, 32, i, 12288, 1);
		ptr_struct->boot_signature[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	}
	for (i = 0; i < 128; ++i) {
		offset = adb2c_calc_array_field_address(4096, 32, i, 12288, 1);
		ptr_struct->critical_signature[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	}
	for (i = 0; i < 128; ++i) {
		offset = adb2c_calc_array_field_address(8192, 32, i, 12288, 1);
		ptr_struct->non_critical_signature[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
	}
}

void image_layout_secure_boot_signatures_print(const struct image_layout_secure_boot_signatures *ptr_struct, FILE *fd, int indent_level)
{
	int i;

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_secure_boot_signatures ========\n");

	for (i = 0; i < 128; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "boot_signature_%03d  : " U32H_FMT "\n", i, ptr_struct->boot_signature[i]);
	}
	for (i = 0; i < 128; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "critical_signature_%03d : " U32H_FMT "\n", i, ptr_struct->critical_signature[i]);
	}
	for (i = 0; i < 128; ++i) {
		adb2c_add_indentation(fd, indent_level);
		fprintf(fd, "non_critical_signature_%03d : " U32H_FMT "\n", i, ptr_struct->non_critical_signature[i]);
	}
}

unsigned int image_layout_secure_boot_signatures_size(void)
{
	return IMAGE_LAYOUT_SECURE_BOOT_SIGNATURES_SIZE;
}

void image_layout_secure_boot_signatures_dump(const struct image_layout_secure_boot_signatures *ptr_struct, FILE *fd)
{
	image_layout_secure_boot_signatures_print(ptr_struct, fd, 0);
}

void image_layout_tools_area_pack(const struct image_layout_tools_area *ptr_struct, u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 24;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->minor);
	offset = 16;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->major);
	offset = 56;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->bin_ver_minor);
	offset = 48;
	adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->bin_ver_major);
	offset = 32;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->log2_img_slot_size);
	offset = 496;
	adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->crc);
}

void image_layout_tools_area_unpack(struct image_layout_tools_area *ptr_struct, const u_int8_t *ptr_buff)
{
	u_int32_t offset;

	offset = 24;
	ptr_struct->minor = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 16;
	ptr_struct->major = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 56;
	ptr_struct->bin_ver_minor = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 48;
	ptr_struct->bin_ver_major = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
	offset = 32;
	ptr_struct->log2_img_slot_size = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
	offset = 496;
	ptr_struct->crc = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
}

void image_layout_tools_area_print(const struct image_layout_tools_area *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_tools_area ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "minor                : " UH_FMT "\n", ptr_struct->minor);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "major                : " UH_FMT "\n", ptr_struct->major);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "bin_ver_minor        : " UH_FMT "\n", ptr_struct->bin_ver_minor);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "bin_ver_major        : " UH_FMT "\n", ptr_struct->bin_ver_major);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "log2_img_slot_size   : " UH_FMT "\n", ptr_struct->log2_img_slot_size);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "crc                  : " UH_FMT "\n", ptr_struct->crc);
}

unsigned int image_layout_tools_area_size(void)
{
	return IMAGE_LAYOUT_TOOLS_AREA_SIZE;
}

void image_layout_tools_area_dump(const struct image_layout_tools_area *ptr_struct, FILE *fd)
{
	image_layout_tools_area_print(ptr_struct, fd, 0);
}

void image_layout_image_layout_Nodes_pack(const union image_layout_image_layout_Nodes *ptr_struct, u_int8_t *ptr_buff)
{
	image_layout_public_keys_3_pack(&(ptr_struct->public_keys_3), ptr_buff);
}

void image_layout_image_layout_Nodes_unpack(union image_layout_image_layout_Nodes *ptr_struct, const u_int8_t *ptr_buff)
{
	image_layout_public_keys_3_unpack(&(ptr_struct->public_keys_3), ptr_buff);
}

void image_layout_image_layout_Nodes_print(const union image_layout_image_layout_Nodes *ptr_struct, FILE *fd, int indent_level)
{
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "======== image_layout_image_layout_Nodes ========\n");

	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "image_signature_2:\n");
	image_layout_image_signature_2_print(&(ptr_struct->image_signature_2), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "secure_boot_signatures:\n");
	image_layout_secure_boot_signatures_print(&(ptr_struct->secure_boot_signatures), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "itoc_header:\n");
	image_layout_itoc_header_print(&(ptr_struct->itoc_header), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "device_info:\n");
	image_layout_device_info_print(&(ptr_struct->device_info), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "public_keys_3:\n");
	image_layout_public_keys_3_print(&(ptr_struct->public_keys_3), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "boot_version:\n");
	image_layout_boot_version_print(&(ptr_struct->boot_version), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "image_signature:\n");
	image_layout_image_signature_print(&(ptr_struct->image_signature), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "hashes_table:\n");
	image_layout_hashes_table_print(&(ptr_struct->hashes_table), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "public_keys:\n");
	image_layout_public_keys_print(&(ptr_struct->public_keys), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "image_info:\n");
	image_layout_image_info_print(&(ptr_struct->image_info), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "hw_pointers_carmel:\n");
	image_layout_hw_pointers_carmel_print(&(ptr_struct->hw_pointers_carmel), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "tools_area:\n");
	image_layout_tools_area_print(&(ptr_struct->tools_area), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "public_keys_2:\n");
	image_layout_public_keys_2_print(&(ptr_struct->public_keys_2), fd, indent_level + 1);
	adb2c_add_indentation(fd, indent_level);
	fprintf(fd, "itoc_entry:\n");
	image_layout_itoc_entry_print(&(ptr_struct->itoc_entry), fd, indent_level + 1);
}

unsigned int image_layout_image_layout_Nodes_size(void)
{
	return IMAGE_LAYOUT_IMAGE_LAYOUT_NODES_SIZE;
}

void image_layout_image_layout_Nodes_dump(const union image_layout_image_layout_Nodes *ptr_struct, FILE *fd)
{
	image_layout_image_layout_Nodes_print(ptr_struct, fd, 0);
}

