📄 tclfsm.c
字号:
/* ============================================================================ Project Name : jayaCard Module Name : proto/bios/tcl/tclfsm.c Version : $Id: tclfsm.c,v 1.20 2004/01/11 09:56:31 dgil Exp $ Description: Finite State Machine of the TCL protocol 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 the basic architecture of the FSM ============================================================================*/#include "precomp.h"/* ============================================================================ Imports ========================================================================= */extern jbyte tcl_ffsm_start(void);extern jbyte tcl_ffsm_receive(void);extern jbyte tcl_ffsm_send_wtx(void);extern jbyte tcl_ffsm_retransmit(void);extern jbyte tcl_ffsm_send_iblock(void);extern jbyte tcl_ffsm_application(void);extern jbyte tcl_ffsm_receive_iblock(void);extern jbyte tcl_ffsm_receive_wtx(void);extern jbyte tcl_ffsm_send_deselect(void);extern jbyte tcl_ffsm_send_ack(void);extern jbyte tcl_ffsm_receive_nak(void);extern jbyte tcl_ffsm_receive_ack(void);/* ============================================================================ fn_fsm[] ========================================================================= */typedef jbyte (*FN_FFSM)(void);FN_FFSM code fn_fsm[] = { tcl_ffsm_start, /* TCL_FSM_START */ tcl_ffsm_receive, /* TCL_FSM_RECEIVE */ tcl_ffsm_send_wtx, /* TCL_FSM_SEND_WTX */ tcl_ffsm_retransmit, /* TCL_FSM_RETRANSMIT */ tcl_ffsm_send_iblock, /* TCL_FSM_SEND_IBLOCK */ tcl_ffsm_application, /* TCL_FSM_APPLICATION */ tcl_ffsm_receive_iblock, /* TCL_FSM_RECEIVE_IBLOCK */ tcl_ffsm_receive_wtx, /* TCL_FSM_RECEIVE_WTX */ tcl_ffsm_send_deselect, /* TCL_FSM_SEND_DESELECT */ tcl_ffsm_send_ack, /* TCL_FSM_SEND_ACK */ tcl_ffsm_receive_nak, /* TCL_FSM_RECEIVE_NAK */ tcl_ffsm_receive_ack, /* TCL_FSM_RECEIVE_ACK */ };/* ============================================================================ __bios_tcl_fsm() ========================================================================= */void __bios_tcl_fsm(void){ do { LOG1("TCL","__bios_tcl_fsm() : state=%d",tcl_state); /* opcode for TCLFSM */ if (BIOS_CALL_OPCODE(OPCODE_TCLFSM)==JSEC_OK) return; /* jump table */ if (tcl_state>=(sizeof(fn_fsm)/sizeof(fn_fsm[0]))) { /* invalid state number */ LOG1("TCL","__bios_tcl_fsm() : state=%d INVALID STATE NUMBER",tcl_state); HAL_HALT(); } else { tcl_state = fn_fsm[tcl_state](); } } while (tcl_state!=TCL_FSM_HALT); cos_deselect();}/* ========================================================================= That's all folks ! ========================================================================= */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -