SmartAudio/lichee/brandy/u-boot-2011.09/sprite/firmware/imagefile_new.h

130 lines
5.1 KiB
C
Raw Normal View History

2018-07-13 01:31:50 +00:00
/*
* (C) Copyright 2007-2013
* Allwinner Technology Co., Ltd. <www.allwinnertech.com>
* Jerry Wang <wangflord@allwinnertech.com>
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef __IMAGE_FORMAT__H__
#define __IMAGE_FORMAT__H__ 1
#include <config.h>
#include <common.h>
//#define IMAGE_VER 100
//------------------------------------------------------------------------------------------------------------
#define IMAGE_MAGIC "IMAGEWTY"
#define IMAGE_HEAD_VERSION 0x00000300
#define IMAGE_HEAD_SIZE 1024
#define IMAGE_ITEM_TABLE_SIZE 1024
//------------------------------------------------------------------------------------------------------------
///Image<67>ļ<EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>ݽṹ
//------------------------------------------------------------------------------------------------------------
#pragma pack(push, 1)
typedef struct tag_ImageHead
{
u8 magic[8]; //IMAGE_MAGIC
u32 version; //<2F><><EFBFBD><EFBFBD>İ汾<C4B0>ţ<EFBFBD>IMAGE_HEAD_VERSION
u32 size; //<2F><><EFBFBD><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>
u32 attr; //<2F><><EFBFBD><EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>version<6F><6E>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>
u32 imagever; //image<67>İ汾<C4B0><E6B1BE><EFBFBD>ɽű<C9BD>ָ<EFBFBD><D6B8>
u32 lenLo; //image<67>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD> <20><>λ
u32 lenHi; //image<67>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD> <20><>λ
u32 align; //<2F><><EFBFBD>ݵĶ<DDB5><C4B6><EFBFBD><EFBFBD>߽磬ȱʡ1024
u32 pid; //PID<49><44>Ϣ
u32 vid; //VID<49><44>Ϣ
u32 hardwareid; //Ӳ<><D3B2>ƽ̨ID
u32 firmwareid; //<2F><><EFBFBD><EFBFBD>ƽ̨ID
u32 itemattr; //item<65><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,"<22><><EFBFBD><EFBFBD>"
u32 itemsize; //item<65><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD>С
u32 itemcount; //item<65><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>
u32 itemoffset; //item<65><6D>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD>
u32 imageattr; //image<67>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
u32 appendsize; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵij<DDB5><C4B3><EFBFBD>
u32 appendoffsetLo; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD>
u32 appendoffsetHi; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD>
u8 reserve[980]; //Ԥ<><D4A4>
}ImageHead_t;
#pragma pack(pop)
//------------------------------------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------------------------------------
#define IMAGE_ALIGN_SIZE 0x400
#define HEAD_ATTR_NO_COMPRESS 0x4d //1001101
//------------------------------------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------------------------------------
#pragma pack(push, 1)
typedef struct tagImageHeadAttr{
u32 res : 12;
u32 len : 8;
u32 encode : 7; ///HEAD_ATTR_NO_COMPRESS
u32 compress: 5;
}ImageHeadAttr_t;
#pragma pack(pop)
//------------------------------------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------------------------------------
#define IMAGE_ITEM_VERSION 0x00000100
#define MAINTYPE_LEN 8
#define SUBTYPE_LEN 16
#define FILE_PATH 256
#define IMAGE_ITEM_RCSIZE 640 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>С
//------------------------------------------------------------------------------------------------------------
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽṹ
//------------------------------------------------------------------------------------------------------------
#pragma pack(push, 1)
typedef struct tag_ImageItem
{
u32 version; //<2F><><EFBFBD><EFBFBD>İ汾<C4B0><E6B1BE>IMAGE_ITEM_VERSION
u32 size; //<2F><><EFBFBD><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>
u8 mainType[MAINTYPE_LEN]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
u8 subType[SUBTYPE_LEN]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD>image<67><65><EFBFBD>ýű<C3BD>ָ<EFBFBD><D6B8>
u32 attr; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>version<6F><6E>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>
u8 name[FILE_PATH]; //<2F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD> 260
u32 datalenLo; //<2F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>image<67>ļ<EFBFBD><C4BC>еij<D0B5><C4B3><EFBFBD>
u32 datalenHi; //<2F><>λ <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>image<67>ļ<EFBFBD><C4BC>еij<D0B5><C4B3><EFBFBD>
u32 filelenLo; //<2F>ļ<EFBFBD><C4BC><EFBFBD>ʵ<EFBFBD>ʳ<EFBFBD><CAB3><EFBFBD>
u32 filelenHi; //<2F><>λ <20>ļ<EFBFBD><C4BC><EFBFBD>ʵ<EFBFBD>ʳ<EFBFBD><CAB3><EFBFBD>
u32 offsetLo; //<2F>ļ<EFBFBD><C4BC><EFBFBD>ʼλ<CABC><CEBB>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD>
u32 offsetHi; //<2F><>λ <20>ļ<EFBFBD><C4BC><EFBFBD>ʼλ<CABC><CEBB>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD>
u8 encryptID[64]; //<2F><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD>ID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>ֶ<EFBFBD>"\0"<22><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
u32 checksum; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD>
u8 res[IMAGE_ITEM_RCSIZE]; //<2F><><EFBFBD><EFBFBD>
}ImageItem_t;
#pragma pack(pop)
//------------------------------------------------------------------------------------------------------------
// THE END !
//------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------
// THE END !
//------------------------------------------------------------------------------------------------------------
#endif //__IMAGE_FORMAT__H__