146 lines
4.5 KiB
C
146 lines
4.5 KiB
C
|
/*
|
|||
|
* (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 __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 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define WORK_MODE_USB_PRODUCT 0x10 //<2F><><EFBFBD><EFBFBD>USB<53><42><EFBFBD><EFBFBD>
|
|||
|
#define WORK_MODE_CARD_PRODUCT 0x11 //<2F><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define WORK_MODE_USB_DEBUG 0x12 //<2F><><EFBFBD><EFBFBD>usb<73><62><EFBFBD><EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD><EFBFBD>ɵIJ<C9B5><C4B2><EFBFBD>
|
|||
|
#define WORK_MODE_SPRITE_RECOVERY 0x13 //һ<><D2BB><EFBFBD>ָ<EFBFBD>
|
|||
|
#define WORK_MODE_CARD_UPDATE 0x14 //update firmware from sdcard
|
|||
|
#define WORK_MODE_USB_UPDATE 0x15 //<2F><><EFBFBD><EFBFBD>USB<53><42><EFBFBD><EFBFBD>
|
|||
|
#define WORK_MODE_CMD_UPDATE 0x16 //for cmd need to update flash, eg:savecfg
|
|||
|
#define WORK_MODE_OUTER_UPDATE 0x21 //<2F><><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD><E2B2BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
#define WORK_MODE_USB_TOOL_PRODUCT 0x04 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define WORK_MODE_USB_TOOL_UPDATE 0x08 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define WORK_MODE_ERASE_KEY 0x20 //<2F><><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>key
|
|||
|
|
|||
|
#define UBOOT_MAGIC "uboot"
|
|||
|
#define STAMP_VALUE 0x5F0A6C39
|
|||
|
#define ALIGN_SIZE 16 * 1024
|
|||
|
#define MAGIC_SIZE 8
|
|||
|
#define STORAGE_BUFFER_SIZE (256)
|
|||
|
|
|||
|
#define SUNXI_UPDATE_NEXT_ACTION_NORMAL (1)
|
|||
|
#define SUNXI_UPDATE_NEXT_ACTION_REBOOT (2)
|
|||
|
#define SUNXI_UPDATE_NEXT_ACTION_SHUTDOWN (3)
|
|||
|
#define SUNXI_UPDATE_NEXT_ACTION_REUPDATE (4)
|
|||
|
#define SUNXI_UPDATE_NEXT_ACTION_BOOT (5)
|
|||
|
#define SUNXI_UPDATA_NEXT_ACTION_SPRITE_TEST (6)
|
|||
|
|
|||
|
#define SUNXI_UDDISK_SPRITE_OVER_FLAG (0x59)
|
|||
|
|
|||
|
#define SUNXI_VBUS_UNKNOWN (0)
|
|||
|
#define SUNXI_VBUS_EXIST (1)
|
|||
|
#define SUNXI_VBUS_NOT_EXIST (2)
|
|||
|
|
|||
|
#define BOOT0_SDMMC_START_ADDR (16)
|
|||
|
#ifndef CONFIG_SUNXI_SECURE_SYSTEM
|
|||
|
#define UBOOT_START_SECTOR_IN_SDMMC (38192)
|
|||
|
#else
|
|||
|
#define UBOOT_START_SECTOR_IN_SDMMC (32800)
|
|||
|
#define UBOOT_START_SECTOR_PRE_IN_SDMMC (38192)
|
|||
|
#endif
|
|||
|
|
|||
|
#define SUNXI_NORMAL_MODE 0
|
|||
|
#define SUNXI_SECURE_MODE_WITH_SECUREOS 1
|
|||
|
#define SUNXI_SECURE_MODE_NO_SECUREOS 2
|
|||
|
|
|||
|
#define BOOT_FROM_SD0 0
|
|||
|
#define BOOT_FROM_SD2 2
|
|||
|
#define BOOT_FROM_NFC 1
|
|||
|
#define BOOT_FROM_SPI 3
|
|||
|
|
|||
|
#define TOC_MAIN_INFO_STATUS_ENCRYP_NOT_USED 0x00
|
|||
|
#define TOC_MAIN_INFO_STATUS_ENCRYP_SSK 0x01
|
|||
|
#define TOC_MAIN_INFO_STATUS_ENCRYP_BSSK 0x02
|
|||
|
|
|||
|
#define TOC_ITEM_ENTRY_STATUS_ENCRYP_NOT_USED 0x00
|
|||
|
#define TOC_ITEM_ENTRY_STATUS_ENCRYP_USED 0x01
|
|||
|
|
|||
|
#define TOC_ITEM_ENTRY_TYPE_NULL 0x00
|
|||
|
#define TOC_ITEM_ENTRY_TYPE_KEY_CERTIF 0x01
|
|||
|
#define TOC_ITEM_ENTRY_TYPE_BIN_CERTIF 0x02
|
|||
|
#define TOC_ITEM_ENTRY_TYPE_BIN 0x03
|
|||
|
|
|||
|
typedef struct _normal_gpio_cfg
|
|||
|
{
|
|||
|
char port; //<2F>˿ں<CBBF>
|
|||
|
char port_num; //<2F>˿<EFBFBD><CBBF>ڱ<EFBFBD><DAB1><EFBFBD>
|
|||
|
char mul_sel; //<2F><><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>
|
|||
|
char pull; //<2F><><EFBFBD><EFBFBD>״̬
|
|||
|
char drv_level; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
char data; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ
|
|||
|
char reserved[2]; //<2F><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
normal_gpio_cfg;
|
|||
|
|
|||
|
typedef struct _special_gpio_cfg
|
|||
|
{
|
|||
|
unsigned char port; //<2F>˿ں<CBBF>
|
|||
|
unsigned char port_num; //<2F>˿<EFBFBD><CBBF>ڱ<EFBFBD><DAB1><EFBFBD>
|
|||
|
char mul_sel; //<2F><><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>
|
|||
|
char data; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ
|
|||
|
}special_gpio_cfg;
|
|||
|
|
|||
|
typedef struct _simple_gpio_cfg
|
|||
|
{
|
|||
|
char port;
|
|||
|
char port_num;
|
|||
|
}
|
|||
|
simple_gpio_cfg;
|
|||
|
|
|||
|
|
|||
|
//SD<53><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽṹ
|
|||
|
typedef struct sdcard_spare_info_t
|
|||
|
{
|
|||
|
int card_no[4]; //<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
int speed_mode[4]; //<2F><><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>ģʽ<C4A3><CABD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD>٣<EFBFBD><D9A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
int line_sel[4]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>0: 1<>ߣ<EFBFBD><DFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34>
|
|||
|
int line_count[4]; //<2F><>ʹ<EFBFBD><CAB9><EFBFBD>ߵĸ<DFB5><C4B8><EFBFBD>
|
|||
|
}
|
|||
|
sdcard_spare_info;
|
|||
|
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
STORAGE_NAND =0,
|
|||
|
STORAGE_SD,
|
|||
|
STORAGE_EMMC,
|
|||
|
STORAGE_NOR,
|
|||
|
STORAGE_EMMC3,
|
|||
|
STORAGE_SPI_NAND,
|
|||
|
}SUNXI_BOOT_STORAGE;
|
|||
|
|
|||
|
|
|||
|
#endif
|
|||
|
|
|||
|
|