/* ============================================================================ Project Name : jayaCard Module Name : proto/bios/init/ats.c Version : $Id: ats.c,v 1.16 2004/04/23 20:29:15 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); // 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; } } // 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(tcl_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 ! ========================================================================= */