📄 halt0.c
字号:
/* ============================================================================ Project Name : jayaCard Module Name : proto/hal/simu/halt0.c Version : $Id: halt0.c,v 1.16 2004/03/07 10:43:23 dgil Exp $ Description: T=0 send/receive byte 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 011903 dgil wrote it from scratch ============================================================================*/#include "precomp.h"/* ========================================================================= __hal_t0_send(byte) Send a byte on the T=0 interface, except the first byte which will be sent using __hal_t0_firstsend because of the required timing to reverse the communication side (receive to send) ========================================================================= */void __hal_t0_send(jbyte by){ PSIMUMSG msg; jresult res; msg = new_simumsg(SIMUMSG_T0_CHAR,by); if (msg==NULL) { fprintf(stderr,"__hal_t0_send(0x%x) - can't create simumsg !\n",by); throw THROW_RECONNECT; } res = send_simumsg(socketCard,msg); if (res!=JY_OK) { fprintf(stderr,"__hal_t0_send(0x%x) - can't send simumsg !\n",by); throw THROW_RECONNECT; } LOG1("T0","<%.2X>",by); free_simumsg(msg);}/* ========================================================================= __hal_t0_receive() For a byte on the T=0 interface ========================================================================= */jbyte __hal_t0_receive(void){ PSIMUMSG msg; jbyte by; jresult res;loop: res = receive_simumsg(socketCard,&msg); if (res!=JY_OK) { fprintf(stderr,"__hal_t0_receive() - can't receive simumsg !\n"); throw THROW_RECONNECT; } if (msg->h.kindof!=SIMUMSG_T0_CHAR) { __simu_dispatch(msg); goto loop; } by = (jbyte) msg->h.param; LOG1("T0",">%.2X<",by); free_simumsg(msg); return by;}/* ========================================================================= That's all folks ! ========================================================================= */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -