📄 paypass_tcl.lst
字号:
ARM COMPILER V2.40e, Paypass_TCL 12/12/07 14:35:11 PAGE 1
ARM COMPILER V2.40e, COMPILATION OF MODULE Paypass_TCL
OBJECT MODULE PLACED IN .\Paypass_TCL.obj
COMPILER INVOKED BY: C:\DEV\Tools\Keil\ARM\BIN\CA.exe ..\..\..\..\LIB\PayPass\sources\Paypass_TCL.c THUMB DEBUG PRINT(.\
-LISTING\PAYPASS_TCL.LST) TABS(4) PREPRINT(.\LISTING\PAYPASS_TCL.I) OBJECT(.\Paypass_TCL.obj)
stmt level source
1 //=============================================================================
2 // Copyright (C) INSIDE Contactless 1998-2005
3 //
4 // INSIDE Contactless reserves the right to make changes, without notice,
5 // to any product (including application note) herein to improve
6 // reliability, functionality, or design. INSIDE Contactless advises its
7 // customers to obtain the latest version of device data sheets to verify,
8 // before placing orders, that the information being relied upon by the
9 // customer is current.
10 //
11 // INSIDE Contactless makes no warranty that the use will not infringe any
12 // third party patent, copyright or trademark.
13 //
14 // Information furnished by INSIDE Contactless is believed to be accurate
15 // and reliable. However, INSIDE Contactless does not assume any liability
16 // resulting from the application or use of any product described within.
17 //
18 // All rights are reserved. Reproduction in whole or in part is prohibited
19 // without the written consent of the copyright owner.
20 //
21 // Bat 11a,
22 // Parc Club du Golf,
23 // Z.A.C. du Pichaury Tel : +33 (0)4.42.39.33.00
24 // 13856 Aix-en-Provence Cedex 3 Fax : +33 (0)4.42.39.63.19
25 // FRANCE Email : info@insidefr.com
26 //
27 //-----------------------------------------------------------------------------
28 // Project Code : PAYPASS LIBRARY
29 // Project Name : PAYPASS LIBRARY
30 // Module Name : PAYPASS_TCL.c
31 // Platform dev : Keil 礦ision 3 (IDE ) + Keil ARM Compiler
32 // Target : LPC2103 (ARM7TDMI Core)
33 // Language : C ANSI
34 // Revision : 1.0
35 // Description : PayPass TCL commands
36 //=============================================================================
37 // When Who Ver What
38 // 06-04-24 MCY 1.1 restructuration
39 // 06-05-12 FPK 1.2 corrections
40 //=============================================================================
41
42 #include "Paypass_Main_Defines.h"
*** ERROR C318 IN LINE 42 OF ..\..\..\..\LIB\PayPass\sources\Paypass_TCL.c: can't open file 'Paypass_Main_Defines.h'
43
44 #include "Paypass_TCL.h"
*** ERROR C318 IN LINE 44 OF ..\..\..\..\LIB\PayPass\sources\Paypass_TCL.c: can't open file 'Paypass_TCL.h'
45
46
47 #if ((defined PAYPASS) || (defined FULL))
TTCLConfiguration g_TCLCard;
//-----------------------------------------------------------------------------
// Function name : v_fnTCLFrameBuild
//-----------------------------------------------------------------------------
// Description : This function creates the TCL object and initialize its parameters
// CID and NAD are not used in PayPass specifications
ARM COMPILER V2.40e, Paypass_TCL 12/12/07 14:35:11 PAGE 2
//
// IN : p_ePCBType Type of frame to send
// p_pabCommand T=CL command
// p_pabDataIn Data to send
// p_iDataInLength Size of data to send
//
// OUT : p_pabTCLFrameIn Frame to send
// p_piTCLFrameInLength Size of frame to send
// p_piTCLFrameOutLength Size of frame which will be received
//
// RETURN : - none -
//
// Notes : - none -
//-----------------------------------------------------------------------------
void v_fnTCLFrameBuild ( unsigned char p_ePCBType,
unsigned char *p_pabCommand,
unsigned char *p_pabDataIn,
unsigned char p_iDataInLength,
unsigned char *p_pabTCLFrameIn,
unsigned short *p_piTCLFrameInLength,
unsigned short *p_piTCLFrameOutLength)
{
// INIT TCL FRAME IN LENGTH
p_piTCLFrameInLength[0] =0x0;
// CHECK IF COMMAND
if (p_pabCommand != NULL)
{
// COPY COMMAND IN OUTPUT BUFFER
memcpy(p_pabTCLFrameIn, p_pabCommand, 5);
// SET TCL FRAME IN LENGTH
p_piTCLFrameInLength[0] = 5 ;
}
// CHECK IF DATA IN
if (p_pabDataIn != NULL)
{
// ADD DATA IN
memcpy(&p_pabTCLFrameIn[p_piTCLFrameInLength[0]], p_pabDataIn, p_iDataInLength);
// INIT OUT BUFFER LENGTH WITH IN BUFFER LENGTH + COMMAND LENGTH
p_piTCLFrameInLength[0] += p_iDataInLength;
}
// SHIFT OF 1 BYTE TO ADD PCB
memmove(&p_pabTCLFrameIn[1], p_pabTCLFrameIn, p_piTCLFrameInLength[0]);
// INC IN AND OUT TCL FRAME LENGTH
p_piTCLFrameInLength[0]++;
p_piTCLFrameOutLength[0]++;
// ADD PCB
switch (p_ePCBType)
{
case CST_pcbtINoChaining:
p_pabTCLFrameIn[0] = (unsigned char)(PCB_I | (g_TCLCard.f_iBlockNumber & 0x01));
break;
ARM COMPILER V2.40e, Paypass_TCL 12/12/07 14:35:11 PAGE 3
case CST_pcbtIWithChaining:
p_pabTCLFrameIn[0] = (unsigned char)(PCB_I | PCB_I_WITH_CHAINING | (g_TCLCard.f_iBlockNumber & 0x01));
break;
case CST_pcbtRACK:
p_pabTCLFrameIn[0] = (unsigned char)(PCB_R | PCB_R_WITH_ACK | (g_TCLCard.f_iBlockNumber & 0x01));
break;
case CST_pcbtRNACK:
p_pabTCLFrameIn[0] = (unsigned char)(PCB_R | PCB_R_WITH_NACK | (g_TCLCard.f_iBlockNumber & 0x01));
break;
case CST_pcbtSWTX:
p_pabTCLFrameIn[0] = (unsigned char)(PCB_S | PCB_S_WITH_WTX);
break;
case CST_pcbtDESELECT:
p_pabTCLFrameIn[0] = (unsigned char)(PCB_S | PCB_S_WITH_DESELECT);
break;
}
// ADD STATUS BYTES
p_piTCLFrameOutLength[0] += 2;
}
//-----------------------------------------------------------------------------
// Function name : b_fnTCLFrameExtract
//-----------------------------------------------------------------------------
// Description : This function extracts the data from a TCL frame and returns its type.
//
// IN : p_piTCLFrameLength Length of TCL frame received
// p_pabTCLFrame TCL frame received
// p_pwStatus Status from the ReceiveBuffer
//
// OUT : p_pabData Data extracted of the TCL frame
// p_pwStatus Status word
//
// RETURN : type of TCL frame
//
// Notes : - none -
//-----------------------------------------------------------------------------
unsigned char b_fnTCLFrameExtract( unsigned short *p_piTCLFrameLength,
unsigned char *p_pabTCLFrame,
unsigned char *p_pabData,
unsigned short *p_pwStatus)
{
unsigned char l_bPCB;
// SAVE PCB
l_bPCB = p_pabTCLFrame[0];
// PROTOCOL ERROR (Requirements 10.2)
if ( (l_bPCB == 0x02) || (l_bPCB == 0x03) || (l_bPCB == 0x12) || (l_bPCB == 0x13) || (l_bPCB == 0xA2) ||
- (l_bPCB == 0xA3) || (l_bPCB == 0xB2) || (l_bPCB == 0xB3) || (l_bPCB == 0xF2) || (l_bPCB == 0xC2) )
{
// IF ( BLOCK NUMBER != PCD BLOCK NUMBER ) (Requirements 10.9)
/*Debug 11/12/06*/
// No block number with S-Block
if ( ((l_bPCB & 0xC0)!= 0xC0) && ( (l_bPCB & 0x01) != (g_TCLCard.f_iBlockNumber & 0x01)) )
{
#ifdef MODE_DEBUG_TCL
printf("Block num error\n");
#endif
return CST_pcbPROTOCOL_ERROR;
}
// I BLOCK
if ((l_bPCB & 0xE2) == PCB_I)
{
ARM COMPILER V2.40e, Paypass_TCL 12/12/07 14:35:11 PAGE 4
// REMOVE PCB
memcpy(p_pabTCLFrame, p_pabTCLFrame + 1, --p_piTCLFrameLength[0]);
// CHECK IF CHAINING
if ((l_bPCB & 0x10) == 0x10)
{
// TRANSFERT DATA
memcpy(p_pabData, p_pabTCLFrame, p_piTCLFrameLength[0]);
// RESULT
return CST_pcbtIWithChaining ;
}
else
{
// TRANSFERT DATA
memcpy(p_pabData, p_pabTCLFrame, p_piTCLFrameLength[0] - 2);
//GET STATUS
p_pwStatus[0] = (p_pabTCLFrame[p_piTCLFrameLength[0] - 2] << 8) | p_pabTCLFrame[p_piTCLFrameLength[0]
- - 1];
// DATA LENGTH WITHOUT STATUS WORD AND PCB
p_piTCLFrameLength[0] -= 2;
// RESULT
return CST_pcbtINoChaining ;
}
}
// R BLOCK
if ((l_bPCB & 0xE2) == PCB_R)
{
//CHECK IF ACK OR NACK
if ((l_bPCB & 0x10) == 0x10)
{
#ifdef MODE_DEBUG_TCL
printf("Extract NACK\n");
#endif
// R(NAK) RECEIVED CONSIDERED AS PROTOCOL ERROR (Requirements 10.9)
return CST_pcbPROTOCOL_ERROR;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -