[Pcsclite-cvs-commit] Drivers/ccid/src/protocol_t1 pps.c,1.1,1.2 protocol_t1.c,1.3,1.4 t1_block.c,1.1,1.2
rousseau@quantz.debian.org
rousseau@quantz.debian.org
Tue, 03 Feb 2004 16:42:26 +0100
Update of /cvsroot/pcsclite/Drivers/ccid/src/protocol_t1
In directory quantz:/tmp/cvs-serv15898/src/protocol_t1
Modified Files:
pps.c protocol_t1.c t1_block.c
Log Message:
use my own debug routines
Index: pps.c
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/protocol_t1/pps.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- pps.c 15 Jan 2004 14:34:21 -0000 1.1
+++ pps.c 3 Feb 2004 15:42:24 -0000 1.2
@@ -30,6 +30,7 @@
#include "commands.h"
#include "defs.h"
#include "ifdhandler.h"
+#include "debug.h"
/*
* Not exported constants definition
@@ -61,19 +62,11 @@
BYTE confirm[PPS_MAX_LENGTH];
unsigned len_request, len_confirm;
int ret;
-#ifdef DEBUG_PROTOCOL
- int i;
-#endif
len_request = PPS_GetLength (params);
params[len_request - 1] = PPS_GetPCK(params, len_request - 1);
-#ifdef DEBUG_PROTOCOL
- printf ("PPS: Sending request: ");
- for (i = 0; i < len_request; i++)
- printf ("%X ", params[i]);
- printf ("\n");
-#endif
+ DEBUG_XXD ("PPS: Sending request: ", params, len_request);
/* Send PPS request */
if (CCID_Transmit (t1->lun, len_request, params) != IFD_SUCCESS)
@@ -86,12 +79,7 @@
len_confirm = PPS_GetLength (confirm);
-#ifdef DEBUG_PROTOCOL
- printf ("PPS: Receivig confirm: ");
- for (i = 0; i < len_confirm; i++)
- printf ("%X ", confirm[i]);
- printf ("\n");
-#endif
+ DEBUG_XXD ("PPS: Receivig confirm: ", confirm, len_confirm);
if (!PPS_Match (params, len_request, confirm, len_confirm))
ret = PPS_HANDSAKE_ERROR;
Index: protocol_t1.c
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/protocol_t1/protocol_t1.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- protocol_t1.c 2 Feb 2004 15:45:14 -0000 1.3
+++ protocol_t1.c 3 Feb 2004 15:42:24 -0000 1.4
@@ -33,6 +33,7 @@
#include "ccid.h"
#include "commands.h"
#include "ifdhandler.h"
+#include "debug.h"
/*
* Not exported constants definition
@@ -45,8 +46,6 @@
#define PROTOCOL_T1_EDC_LRC 0
#define PROTOCOL_T1_EDC_CRC 1
-/* #define DEBUG_PROTOCOL */
-
/*
* Not exported functions declaration
*/
@@ -100,10 +99,8 @@
/* Set initial send sequence (NS) */
t1->ns = 1;
-#ifdef DEBUG_PROTOCOL
- printf ("Protocol: T=1: IFSC=%d, IFSD=%d, EDC=%s\n",
+ DEBUG_COMM4 ("T=1: IFSC=%d, IFSD=%d, EDC=%s\n",
t1->ifsc, t1->ifsd, (t1->edc == PROTOCOL_T1_EDC_LRC) ? "LRC" : "CRC");
-#endif
return PROTOCOL_T1_OK;
}
@@ -130,9 +127,7 @@
/* Create an I-Block */
block = T1_Block_NewIBlock (bytes, cmd->command, t1->ns, more);
-#ifdef DEBUG_PROTOCOL
- printf ("Sending block I(%d,%d)\n", t1->ns, more);
-#endif
+ DEBUG_COMM3 ("Sending block I(%d,%d)\n", t1->ns, more);
/* Send a block */
ret = Protocol_T1_SendBlock (t1, block);
@@ -152,9 +147,7 @@
/* Positive ACK R-Block received */
if (rsp_type == T1_BLOCK_R_OK)
{
-#ifdef DEBUG_PROTOCOL
- printf ("Protocol: Received block R(%d)\n", T1_Block_GetNR (block));
-#endif
+ DEBUG_COMM2 ("Received block R(%d)\n", T1_Block_GetNR (block));
/* Delete block */
T1_Block_Delete (block);
@@ -172,9 +165,7 @@
block =
T1_Block_NewIBlock (bytes, cmd->command + counter,
t1->ns, more);
-#ifdef DEBUG_PROTOCOL
- printf ("Protocol: Sending block I(%d,%d)\n", t1->ns, more);
-#endif
+ DEBUG_COMM3 ("Sending block I(%d,%d)\n", t1->ns, more);
/* Send a block */
ret = Protocol_T1_SendBlock (t1, block);
@@ -214,10 +205,9 @@
if (rsp_type == T1_BLOCK_I)
{
-#ifdef DEBUG_PROTOCOL
- printf ("Protocol: Received block I(%d,%d)\n",
+ DEBUG_COMM3 ("Received block I(%d,%d)\n",
T1_Block_GetNS(block), T1_Block_GetMore (block));
-#endif
+
/* Calculate nr */
nr = (T1_Block_GetNS (block) + 1) % 2;
@@ -237,9 +227,8 @@
{
/* Create an R-Block */
block = T1_Block_NewRBlock (T1_BLOCK_R_OK, nr);
-#ifdef DEBUG_PROTOCOL
- printf ("Protocol: Sending block R(%d)\n", nr);
-#endif
+ DEBUG_COMM2 ("Sending block R(%d)\n", nr);
+
/* Send R-Block */
ret = Protocol_T1_SendBlock (t1, block);
@@ -253,17 +242,15 @@
{
/* Get wtx multiplier */
wtx = (*T1_Block_GetInf (block));
-#ifdef DEBUG_PROTOCOL
- printf ("Protocol: Received block S(WTX request, %d)\n", wtx);
-#endif
+ DEBUG_COMM2 ("Received block S(WTX request, %d)\n", wtx);
+
/* Delete block */
T1_Block_Delete (block);
/* Create an WTX response S-Block */
block = T1_Block_NewSBlock (T1_BLOCK_S_WTX_RES, 1, &wtx);
-#ifdef DEBUG_PROTOCOL
- printf ("Protocol: Sending block S(WTX response, %d)\n", wtx);
-#endif
+ DEBUG_COMM2 ("Sending block S(WTX response, %d)\n", wtx);
+
/* Send WTX response */
ret = Protocol_T1_SendBlock (t1, block);
Index: t1_block.c
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/protocol_t1/t1_block.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- t1_block.c 15 Jan 2004 14:34:21 -0000 1.1
+++ t1_block.c 3 Feb 2004 15:42:24 -0000 1.2
@@ -24,13 +24,6 @@
#include <stdlib.h>
#include <string.h>
-/* #define DEBUG_PROTOCOL */
-
-#ifdef DEBUG_PROTOCOL
-#include <stdio.h>
-#include "debug.h"
-#endif
-
/*
* Not exported constants definition
*/