OSHW-DEIMOS/SOFTWARE/A64-TERES/sunxi-pack-tools/update_uboot/spare_head.h
Dimitar Gamishev d867a2260d more stuff
2017-10-13 14:08:52 +03:00

106 lines
4.0 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* (C) Copyright 2012
* wangflord@allwinnertech.com
*
*
* 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;
*
*/
#ifndef __spare_head_h__
#define __spare_head_h__
/* work mode */
#define WORK_MODE_PRODUCT (1<<4)
#define WORK_MODE_UPDATE (1<<5)
#define WORK_MODE_BOOT 0x00 //正常启动
#define WORK_MODE_USB_PRODUCT 0x10 //用于USB量产
#define WORK_MODE_CARD_PRODUCT 0x11 //用于卡量产
#define WORK_MODE_USB_UPDATE 0x20 //用于USB升级
#define WORK_MODE_OUTER_UPDATE 0x21 //用于外部盘升级
#define UBOOT_MAGIC "uboot"
#define STAMP_VALUE 0x5F0A6C39
#define ALIGN_SIZE 8 * 1024
typedef struct _normal_gpio_cfg
{
char port; //端口号
char port_num; //端口内编号
char mul_sel; //功能编号
char pull; //电阻状态
char drv_level; //驱动驱动能力
char data; //输出电平
char reserved[2]; //保留位,保证对齐
}
normal_gpio_cfg;
//SD卡相关数据结构
typedef struct sdcard_spare_info_t
{
int card_no[4]; //当前启动的卡控制器编号
int speed_mode[4]; //卡的速度模式0低速其它高速
int line_sel[4]; //卡的线制0: 1线其它4线
int line_count[4]; //卡使用线的个数
}
sdcard_spare_info;
/******************************************************************************/
/* the control information stored in file head */
/******************************************************************************/
struct spare_boot_ctrl_head
{
unsigned int jump_instruction; // one intruction jumping to real code
unsigned char magic[8]; // ="u-boot"
unsigned int check_sum; // generated by PC
unsigned int align_size; // align size in byte
unsigned int length; // the size of all file
unsigned int uboot_length; // the size of uboot
unsigned char version[8]; // uboot version
unsigned char platform[8]; // platform information
int reserved[1]; //stamp space, 16bytes align
};
/******************************************************************************/
/* the data stored in file head */
/******************************************************************************/
struct spare_boot_data_head
{
unsigned int dram_para[32];
int run_clock; // Mhz
int run_core_vol; // mV
int uart_port; // UART控制器编号
normal_gpio_cfg uart_gpio[2]; // UART控制器(调试打印口)GPIO信息
int twi_port; // TWI控制器编号
normal_gpio_cfg twi_gpio[2]; // TWI控制器GPIO信息用于控制TWI
int work_mode; // 工作模式
int storage_type; // 存储介质类型 0nand 1sdcard 2: spinor
normal_gpio_cfg nand_gpio[32]; // nand GPIO信息
char nand_spare_data[256]; // nand 额外信息
normal_gpio_cfg sdcard_gpio[32]; // sdcard GPIO信息
char sdcard_spare_data[256]; // sdcard 额外信息
int reserved[6]; // 保留数据位, 16bytes align
};
struct spare_boot_head_t
{
struct spare_boot_ctrl_head boot_head;
struct spare_boot_data_head boot_data;
};
#endif