开发源代码的CPU卡的COS源程序。

源代码在线查看: ats.c

软件大小: 1436 K
上传用户: xufengping716
关键词: CPU COS 源代码 源程序
下载地址: 免注册下载 普通下载 VIP

相关代码

				/* ============================================================================				   Project Name : jayaCard				   Module Name  : proto/bios/init/ats.c				   Version : $Id: ats.c,v 1.15 2004/01/11 09:56:31 dgil Exp $									Description: ATS								    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 - today we have an entry point !				   ============================================================================				*/								#include "precomp.h"								/* =========================================================================					__bios_ats()									algo:						if opcode ATS				 			execute it						else							if ATS in EEPROM								send it							else								build the default one calling cos_historical_bytes()							endif						endif				   ========================================================================= */								void __bios_ats(void)				{					LOCAL(jbyte,i);				    LOCAL(jbyte,bitratecap);									// opcode for ATS ?					if (BIOS_CALL_OPCODE(OPCODE_ATS)==JSEC_OK) return;									// valid ATS in EEPROM ?					HAL_EEPROM_READ(&u.bBlock[JAYA_BCRYPTO_INPUT0+0],ADDR_EEPROM_ATS,EEPROM_SIZEOF_ATS);					if ((u.bBlock[JAYA_BCRYPTO_INPUT0+0]!=0) && (u.bBlock[JAYA_BCRYPTO_INPUT0+0]						HAL_CRC_INIT();						for (i=1;i						if ( (HAL_CRC_LO()==u.bBlock[JAYA_BCRYPTO_INPUT0+EEPROM_SIZEOF_ATS-2]) && (HAL_CRC_HI()==u.bBlock[JAYA_BCRYPTO_INPUT0+EEPROM_SIZEOF_ATS-1]) ) {							goto send_hist;						}					}								    if ((cfg_config_flag1&CONFIG_FLAG1_CONFIG_BITRATECAP)==CONFIG_FLAG1_CONFIG_BITRATECAP) {				        bitratecap = HAL_EEPROM_READ_BYTE(ADDR_CONFIG_BITRATECAP);				    } else {				        bitratecap = 0x80 | (JAYACFG_BITRATECAP&0x07) | ((JAYACFG_BITRATECAP&0x07)				    }									// send our ATS with the user historical bytes					u.bBlock[JAYA_BCRYPTO_INPUT0+0] = cos_historical_bytes(&u.bBlock[JAYA_BCRYPTO_INPUT0+1]);					HAL_TCL_INITSEND(u.bBlock[JAYA_BCRYPTO_INPUT0+0]+5);									// send other mandatory part					HAL_TCL_SEND(0x70+(cfg_fsci&0x0F));	/* T0 = TC(1) TB(1) TA(1) FSCI_TYPEA */				    HAL_TCL_SEND(bitratecap);           /* TA = bit rate capabilities */					HAL_TCL_SEND(((cfg_fwi&0x0F) 					HAL_TCL_SEND(0x03);		/* TC = support NAD, support CID */									// then send historical bytes				send_hist:					for (i=1;i					HAL_TCL_SENDGO(jfalse);				}								/* =========================================================================					That's all folks !				   ========================================================================= */							

相关资源