initbios.c

来自「一个免费的SMART CARD OS系统。」· C语言 代码 · 共 122 行

C
122
字号
/* ============================================================================   Project Name : jayaCard   Module Name  : proto/bios/init/initbios.c   Version : $Id: initbios.c,v 1.24 2004/04/23 21:33:43 dgil Exp $	Description: BIOS initialization    The Original Code is jayaCard code.    The Initial Developer of the Original Code is Gilles Dumortier.	Portions created by the Initial Developer are Copyright (C) 2002-2004 the    Initial Developer. All Rights Reserved.    Contributor(s):    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; see http://www.gnu.org/licenses/gpl.html   History Rev	Description   012603 dgil	wrote it from scratch   ============================================================================*/#include "precomp.h"/* =========================================================================	__bios_read_config()	Read configuration from EEPROM and default values from build   ========================================================================= */void __bios_read_config(void){	LOG("BIOS","__bios_read_config() ...");	/* Read chip configuration */	cfg_config_flag1 = HAL_EEPROM_READ_BYTE(ADDR_CONFIG_FLAG1);	cfg_config_flag2 = HAL_EEPROM_READ_BYTE(ADDR_CONFIG_FLAG2);	cfg_config_flag3 = HAL_EEPROM_READ_BYTE(ADDR_CONFIG_FLAG3);	/* Update required settings */	if ((cfg_config_flag1&CONFIG_FLAG1_CONFIG_FWI)==CONFIG_FLAG1_CONFIG_FWI) {		cfg_fwi = HAL_EEPROM_READ_BYTE(ADDR_CONFIG_FWI);	} else {		cfg_fwi = JAYACFG_FWI;	}	if ((cfg_config_flag1&CONFIG_FLAG1_CONFIG_FSCI)==CONFIG_FLAG1_CONFIG_FSCI) {		cfg_fsci = HAL_EEPROM_READ_BYTE(ADDR_CONFIG_FSCI);	} else {		cfg_fsci = JAYACFG_FSCI;	}    #ifdef JAYA_TCL_WTX    if ((cfg_config_flag1&CONFIG_FLAG1_CONFIG_CHUNKEEP)==CONFIG_FLAG1_CONFIG_CHUNKEEP) {        cfg_chunkeep = HAL_EEPROM_READ_BYTE(ADDR_CONFIG_CHUNKEEP);    } else {        cfg_chunkeep = JAYACFG_CHUNK_EEPROM_WRITE_BEFORE_WTX_REQUIRED;    }    #endif	/* very first init because need CRC to communicate */	#ifdef TCL_TYPEAB	#ifdef XPCORE_SIMU	/* the simulator sets the type on the power on */	#else	/* the component need to read the configuration from a cell in EEPROM */	tcl_type = ((cfg_config_flag1&CONFIG_FLAG1_TYPEA)==CONFIG_FLAG1_TYPEA)?TCL_TYPEA:TCL_TYPEB;	#endif	#endif}/* =========================================================================	__bios_init()	This function must initialize the BIOS :		HAL initialisation		Read configuration		appliData generation		file system initialisation		tcl initialisation		crypto initialisation   ========================================================================= */void __bios_init(void){	LOG("BIOS","__bios_init() ...");	/* read configuration */	BIOS_READ_CONFIG();	/* HAL and low-level BIOS initialisation */	HAL_INIT();	BIOS_APPLIDATA();	BIOS_TCL_INIT();	/* default status for access */    gSeqVal = SEQVAL_NOPROCESS;     /* no process pending */    gSeqKeyPin = 0x00;              /* default key | default pin */	/* default SM */	#ifdef JAYA_BIOS_SM	#endif	/* default security context */	BIOS_RESET_CONTEXT(SUCCESS);}/* =========================================================================	That's all folks !   ========================================================================= */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?