- Timestamp:
- 01/18/10 12:28:06 (14 years ago)
- Location:
- trunk/csctapi
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/csctapi/ct_slot.c
r1278 r1279 121 121 unsigned buffer_len = 0; 122 122 123 /* Initiaice ICC */ 124 slot->icc = ICC_Async_New (); 125 126 if (slot->icc == NULL) 127 return ERR_MEMORY; 128 129 if (ICC_Async_Init (slot->icc) != ICC_ASYNC_OK) 130 { 131 ICC_Async_Delete (slot->icc); 132 133 slot->icc = NULL; 134 slot->icc_type = CT_SLOT_NULL; 123 if (ICC_Async_Init () != ICC_ASYNC_OK) 124 { 135 125 return ERR_TRANS; 136 126 … … 148 138 if (slot->icc_type == CT_SLOT_ICC_ASYNC) 149 139 { 150 pps = PPS_New( (ICC_Async *) slot->icc);140 pps = PPS_New(); 151 141 152 142 if (pps == NULL) 153 143 { 154 ICC_Async_Close ((ICC_Async *) slot->icc); 155 ICC_Async_Delete ((ICC_Async *) slot->icc); 144 ICC_Async_Close (); 156 145 157 146 slot->icc = NULL; … … 169 158 PPS_Delete (pps); 170 159 171 ICC_Async_Close ((ICC_Async *) slot->icc); 172 ICC_Async_Delete ((ICC_Async *) slot->icc); 160 ICC_Async_Close (); 173 161 174 162 slot->icc = NULL; … … 222 210 if (slot->icc_type == CT_SLOT_ICC_ASYNC) 223 211 { 224 if (ICC_Async_Close ((ICC_Async *) slot->icc) != ICC_ASYNC_OK) 225 ret = ERR_TRANS; 226 227 ICC_Async_Delete ((ICC_Async *) slot->icc); 212 if (ICC_Async_Close () != ICC_ASYNC_OK) 213 ret = ERR_TRANS; 228 214 } 229 215 … … 241 227 if (slot->protocol_type == CT_SLOT_PROTOCOL_T0) /* T=0 protocol ICC */ 242 228 { 243 if (Protocol_T0_Command ( (Protocol_T0 *) slot->protocol,cmd, rsp) != PROTOCOL_T0_OK)229 if (Protocol_T0_Command ( cmd, rsp) != PROTOCOL_T0_OK) 244 230 ret = ERR_TRANS; 245 231 else … … 255 241 else if (slot->protocol_type == CT_SLOT_PROTOCOL_T14) /* T=14 protocol ICC */ 256 242 { 257 if (Protocol_T14_Command ( (Protocol_T14 *) slot->protocol,cmd, rsp) != PROTOCOL_T14_OK)243 if (Protocol_T14_Command (cmd, rsp) != PROTOCOL_T14_OK) 258 244 ret = ERR_TRANS; 259 245 else … … 339 325 if (slot->icc_type == CT_SLOT_ICC_ASYNC) 340 326 { 341 if (ICC_Async_Close ((ICC_Async *) slot->icc) != ICC_ASYNC_OK) 342 ret = ERR_TRANS; 343 344 ICC_Async_Delete ((ICC_Async *) slot->icc); 327 if (ICC_Async_Close () != ICC_ASYNC_OK) 328 ret = ERR_TRANS; 345 329 } 346 330 -
trunk/csctapi/icc_async.c
r1278 r1279 43 43 44 44 static void ICC_Async_InvertBuffer (unsigned size, BYTE * buffer); 45 static void ICC_Async_Clear ( ICC_Async * icc);45 static void ICC_Async_Clear (); 46 46 47 47 int fdmc=(-1); … … 50 50 * Exported functions definition 51 51 */ 52 53 ICC_Async *ICC_Async_New (void)54 {55 ICC_Async *icc;56 57 /* Allocate memory */58 icc = (ICC_Async *) malloc (sizeof (ICC_Async));59 60 if (icc != NULL)61 ICC_Async_Clear (icc);62 63 return icc;64 }65 52 66 53 int ICC_Async_Device_Init () … … 196 183 } 197 184 198 int ICC_Async_Init ( ICC_Async * icc)185 int ICC_Async_Init () 199 186 { 200 187 #ifndef ICC_TYPE_SYNC … … 322 309 } 323 310 324 int ICC_Async_SetBaudrate ( ICC_Async * icc,unsigned long baudrate)311 int ICC_Async_SetBaudrate (unsigned long baudrate) 325 312 { 326 313 if (!Phoenix_SetBaudrate (baudrate)) … … 330 317 } 331 318 332 int ICC_Async_GetBaudrate ( ICC_Async * icc,unsigned long * baudrate)319 int ICC_Async_GetBaudrate (unsigned long * baudrate) 333 320 { 334 321 (*baudrate) = reader[ridx].baudrate; … … 396 383 } 397 384 398 int ICC_Async_Close ( ICC_Async * icc)385 int ICC_Async_Close () 399 386 { 400 387 #ifdef SCI_DEV … … 407 394 ATR_Delete (atr); 408 395 409 ICC_Async_Clear ( icc);396 ICC_Async_Clear (); 410 397 411 398 return ICC_ASYNC_OK; … … 425 412 } 426 413 427 void ICC_Async_Delete (ICC_Async * icc)428 {429 free (icc);430 }431 432 414 /* 433 415 * Not exported functions definition … … 442 424 } 443 425 444 static void ICC_Async_Clear ( ICC_Async * icc)426 static void ICC_Async_Clear () 445 427 { 446 428 atr = NULL; -
trunk/csctapi/icc_async.h
r1278 r1279 58 58 } 59 59 ICC_Async_Timings; 60 60 /* 61 61 typedef struct 62 62 { 63 63 } 64 64 ICC_Async; 65 65 */ 66 66 ATR *atr; /* Answer to reset of this ICC */ 67 67 int convention; /* Convention of this ICC */ … … 73 73 */ 74 74 75 /* Creation and Deletion */76 extern ICC_Async * ICC_Async_New (void);77 extern void ICC_Async_Delete (ICC_Async * icc);78 79 75 /* Initialization and Deactivation */ 80 extern int ICC_Async_Init ( ICC_Async * icc);81 extern int ICC_Async_Close ( ICC_Async * icc);76 extern int ICC_Async_Init (); 77 extern int ICC_Async_Close (); 82 78 83 79 /* Attributes */ 84 80 extern int ICC_Async_SetTimings (); 85 extern int ICC_Async_SetBaudrate ( ICC_Async * icc,unsigned long baudrate);86 extern int ICC_Async_GetBaudrate ( ICC_Async * icc,unsigned long * baudrate);81 extern int ICC_Async_SetBaudrate (unsigned long baudrate); 82 extern int ICC_Async_GetBaudrate (unsigned long * baudrate); 87 83 extern unsigned long ICC_Async_GetClockRate (); 88 84 -
trunk/csctapi/pps.c
r1278 r1279 51 51 */ 52 52 53 static int PPS_Exchange ( PPS * pps,BYTE * params, unsigned *length);53 static int PPS_Exchange (BYTE * params, unsigned *length); 54 54 55 55 static bool PPS_Match (BYTE * request, unsigned len_request, BYTE * reply, unsigned len_reply); … … 67 67 */ 68 68 69 PPS * PPS_New ( ICC_Async * icc)69 PPS * PPS_New () 70 70 { 71 71 PPS *pps; … … 75 75 if (pps != NULL) 76 76 { 77 pps->icc = icc;78 77 pps->protocol = NULL; 79 78 pps->parameters.t = PPS_DEFAULT_PROTOCOL; … … 106 105 if ((*length) > 0) 107 106 { 108 ret = PPS_Exchange (p ps, params, length);107 ret = PPS_Exchange (params, length); 109 108 110 109 /* Get parameters from PPS handsake */ … … 223 222 //req[3]=PPS_GetPCK(req,sizeof(req)-1); will be set by PPS_Exchange 224 223 unsigned int len = sizeof(req); 225 ret = PPS_Exchange ( pps,req, &len);224 ret = PPS_Exchange (req, &len); 226 225 if (ret == PPS_OK) { 227 226 pps->parameters.FI = req[2] >> 4; … … 317 316 */ 318 317 319 static int PPS_Exchange ( PPS * pps,BYTE * params, unsigned *length)318 static int PPS_Exchange (BYTE * params, unsigned *length) 320 319 { 321 320 BYTE confirm[PPS_MAX_LENGTH]; … … 485 484 486 485 487 if (ICC_Async_SetBaudrate ( pps->icc,baudrate) != ICC_ASYNC_OK)486 if (ICC_Async_SetBaudrate (baudrate) != ICC_ASYNC_OK) 488 487 return PPS_ICC_ERROR; 489 488 … … 502 501 if ((pps->protocol) != NULL) 503 502 { 504 ret = Protocol_T0_Init ((Protocol_T0 *) pps->protocol, (ICC_Async *) pps->icc,&(pps->parameters), selected_protocol);503 ret = Protocol_T0_Init ((Protocol_T0 *) pps->protocol, &(pps->parameters), selected_protocol); 505 504 506 505 if (ret != PROTOCOL_T0_OK) … … 520 519 if (pps->protocol != NULL) 521 520 { 522 ret = Protocol_T1_Init ((Protocol_T1 *) pps->protocol, (ICC_Async *) pps->icc,selected_protocol);521 ret = Protocol_T1_Init ((Protocol_T1 *) pps->protocol, selected_protocol); 523 522 524 523 if (ret != PROTOCOL_T1_OK) … … 538 537 if ((pps->protocol) != NULL) 539 538 { 540 ret = Protocol_T14_Init ((Protocol_T14 *) pps->protocol, (ICC_Async *) pps->icc,&(pps->parameters), selected_protocol);539 ret = Protocol_T14_Init ((Protocol_T14 *) pps->protocol, &(pps->parameters), selected_protocol); 541 540 542 541 if (ret != PROTOCOL_T14_OK) -
trunk/csctapi/pps.h
r833 r1279 53 53 typedef struct 54 54 { 55 ICC_Async *icc;56 55 void *protocol; 57 56 PPS_ProtocolParameters parameters; … … 64 63 65 64 /* Create PPS context */ 66 extern PPS *PPS_New ( ICC_Async * icc);65 extern PPS *PPS_New (); 67 66 68 67 /* Perform protcol type selection and return confirm */ -
trunk/csctapi/protocol_t0.c
r1278 r1279 55 55 static void Protocol_T14_Clear (Protocol_T14 * t14); 56 56 57 static int Protocol_T0_Case1 ( Protocol_T0 * t0,APDU_Cmd * cmd, APDU_Rsp ** rsp);58 59 static int Protocol_T0_Case2S ( Protocol_T0 * t0,APDU_Cmd * cmd, APDU_Rsp ** rsp);60 static int Protocol_T14_Case2S ( Protocol_T14 * t14,APDU_Cmd * cmd, APDU_Rsp ** rsp);61 62 static int Protocol_T0_Case3S ( Protocol_T0 * t0,APDU_Cmd * cmd, APDU_Rsp ** rsp);63 static int Protocol_T14_Case3S ( Protocol_T14 * t14,APDU_Cmd * cmd, APDU_Rsp ** rsp);64 65 static int Protocol_T0_Case4S ( Protocol_T0 * t0,APDU_Cmd * cmd, APDU_Rsp ** rsp);66 67 static int Protocol_T0_Case2E ( Protocol_T0 * t0,APDU_Cmd * cmd, APDU_Rsp ** rsp);68 69 static int Protocol_T0_Case3E ( Protocol_T0 * t0,APDU_Cmd * cmd, APDU_Rsp ** rsp);70 71 static int Protocol_T0_Case4E ( Protocol_T0 * t0,APDU_Cmd * cmd, APDU_Rsp ** rsp);72 73 static int Protocol_T0_ExchangeTPDU ( Protocol_T0 * t0,APDU_Cmd * cmd, APDU_Rsp ** rsp);74 static int Protocol_T14_ExchangeTPDU ( Protocol_T14 * t14,APDU_Cmd * cmd, APDU_Rsp ** rsp);57 static int Protocol_T0_Case1 (APDU_Cmd * cmd, APDU_Rsp ** rsp); 58 59 static int Protocol_T0_Case2S (APDU_Cmd * cmd, APDU_Rsp ** rsp); 60 static int Protocol_T14_Case2S (APDU_Cmd * cmd, APDU_Rsp ** rsp); 61 62 static int Protocol_T0_Case3S (APDU_Cmd * cmd, APDU_Rsp ** rsp); 63 static int Protocol_T14_Case3S (APDU_Cmd * cmd, APDU_Rsp ** rsp); 64 65 static int Protocol_T0_Case4S (APDU_Cmd * cmd, APDU_Rsp ** rsp); 66 67 static int Protocol_T0_Case2E (APDU_Cmd * cmd, APDU_Rsp ** rsp); 68 69 static int Protocol_T0_Case3E (APDU_Cmd * cmd, APDU_Rsp ** rsp); 70 71 static int Protocol_T0_Case4E (APDU_Cmd * cmd, APDU_Rsp ** rsp); 72 73 static int Protocol_T0_ExchangeTPDU (APDU_Cmd * cmd, APDU_Rsp ** rsp); 74 static int Protocol_T14_ExchangeTPDU (APDU_Cmd * cmd, APDU_Rsp ** rsp); 75 75 76 76 /* … … 102 102 } 103 103 104 int Protocol_T0_Init (Protocol_T0 * t0, ICC_Async * icc,PPS_ProtocolParameters * params, int selected_protocol)104 int Protocol_T0_Init (Protocol_T0 * t0, PPS_ProtocolParameters * params, int selected_protocol) 105 105 { 106 106 BYTE wi; 107 108 /* Set ICC */109 t0->icc = icc;110 107 111 108 /* Integer value WI = TC2, by default 10 */ … … 131 128 } 132 129 133 int Protocol_T14_Init (Protocol_T14 * t14, ICC_Async * icc,PPS_ProtocolParameters * params, int selected_protocol)130 int Protocol_T14_Init (Protocol_T14 * t14, PPS_ProtocolParameters * params, int selected_protocol) 134 131 { 135 132 BYTE wi; 136 137 /* Set ICC */138 t14->icc = icc;139 133 140 134 /* Integer value WI = TC2, by default 10 */ … … 161 155 } 162 156 163 int Protocol_T0_Command ( Protocol_T0 * t0,APDU_Cmd * cmd, APDU_Rsp ** rsp)157 int Protocol_T0_Command (APDU_Cmd * cmd, APDU_Rsp ** rsp) 164 158 { 165 159 int cmd_case, ret; … … 173 167 174 168 if (cmd_case == APDU_CASE_1) 175 ret = Protocol_T0_Case1 ( t0,cmd, rsp);169 ret = Protocol_T0_Case1 (cmd, rsp); 176 170 else if (cmd_case == APDU_CASE_2S) 177 ret = Protocol_T0_Case2S ( t0,cmd, rsp);171 ret = Protocol_T0_Case2S (cmd, rsp); 178 172 else if (cmd_case == APDU_CASE_3S) 179 ret = Protocol_T0_Case3S ( t0,cmd, rsp);173 ret = Protocol_T0_Case3S (cmd, rsp); 180 174 else if (cmd_case == APDU_CASE_4S) 181 ret = Protocol_T0_Case4S ( t0,cmd, rsp);175 ret = Protocol_T0_Case4S (cmd, rsp); 182 176 else if (cmd_case == APDU_CASE_2E) 183 ret = Protocol_T0_Case2E ( t0,cmd, rsp);177 ret = Protocol_T0_Case2E (cmd, rsp); 184 178 else if (cmd_case == APDU_CASE_3E) 185 ret = Protocol_T0_Case3E ( t0,cmd, rsp);179 ret = Protocol_T0_Case3E (cmd, rsp); 186 180 else if (cmd_case == APDU_CASE_4E) 187 ret = Protocol_T0_Case4E ( t0,cmd, rsp);181 ret = Protocol_T0_Case4E (cmd, rsp); 188 182 else 189 183 { … … 197 191 } 198 192 199 int Protocol_T14_Command ( Protocol_T14 * t14,APDU_Cmd * cmd, APDU_Rsp ** rsp)193 int Protocol_T14_Command (APDU_Cmd * cmd, APDU_Rsp ** rsp) 200 194 { 201 195 int cmd_case, ret; … … 210 204 if (cmd_case == APDU_CASE_2S) 211 205 { 212 ret = Protocol_T14_Case2S ( t14,cmd, rsp);206 ret = Protocol_T14_Case2S (cmd, rsp); 213 207 } 214 208 else if (cmd_case == APDU_CASE_3S) 215 209 { 216 ret = Protocol_T14_Case3S ( t14,cmd, rsp);210 ret = Protocol_T14_Case3S (cmd, rsp); 217 211 } 218 212 else … … 255 249 */ 256 250 257 static int Protocol_T0_Case1 ( Protocol_T0 * t0,APDU_Cmd * cmd, APDU_Rsp ** rsp)251 static int Protocol_T0_Case1 (APDU_Cmd * cmd, APDU_Rsp ** rsp) 258 252 { 259 253 int ret; … … 268 262 269 263 /* Send command TPDU */ 270 ret = Protocol_T0_ExchangeTPDU (t0,tpdu_cmd, rsp);264 ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, rsp); 271 265 272 266 /* Delete command TPDU */ … … 277 271 278 272 279 static int Protocol_T0_Case2S ( Protocol_T0 * t0,APDU_Cmd * cmd, APDU_Rsp ** rsp)273 static int Protocol_T0_Case2S (APDU_Cmd * cmd, APDU_Rsp ** rsp) 280 274 { 281 275 int ret; 282 276 283 277 /* Send command TPDU */ 284 ret = Protocol_T0_ExchangeTPDU (t0,cmd, rsp);278 ret = Protocol_T0_ExchangeTPDU(cmd, rsp); 285 279 286 280 return ret; 287 281 } 288 282 289 static int Protocol_T14_Case2S ( Protocol_T14 * t14,APDU_Cmd * cmd, APDU_Rsp ** rsp)283 static int Protocol_T14_Case2S (APDU_Cmd * cmd, APDU_Rsp ** rsp) 290 284 { 291 285 int ret; 292 286 293 287 /* Send command TPDU */ 294 ret = Protocol_T14_ExchangeTPDU (t14,cmd, rsp);288 ret = Protocol_T14_ExchangeTPDU(cmd, rsp); 295 289 296 290 return ret; 297 291 } 298 292 299 static int Protocol_T0_Case3S ( Protocol_T0 * t0,APDU_Cmd * cmd, APDU_Rsp ** rsp)293 static int Protocol_T0_Case3S (APDU_Cmd * cmd, APDU_Rsp ** rsp) 300 294 { 301 295 int ret; … … 307 301 308 302 /* Send command TPDU */ 309 ret = Protocol_T0_ExchangeTPDU (t0,cmd, (&tpdu_rsp));303 ret = Protocol_T0_ExchangeTPDU(cmd, (&tpdu_rsp)); 310 304 311 305 if (ret == PROTOCOL_T0_OK) … … 330 324 331 325 /* Re-issue command TPDU */ 332 ret = Protocol_T0_ExchangeTPDU (t0,tpdu_cmd, rsp);326 ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, rsp); 333 327 334 328 /* Delete command TPDU */ … … 361 355 tpdu_cmd = APDU_Cmd_New (buffer, 5); 362 356 363 ret = Protocol_T0_ExchangeTPDU (t0,tpdu_cmd, (&tpdu_rsp));357 ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, (&tpdu_rsp)); 364 358 365 359 /* Delete command TPDU */ … … 400 394 } 401 395 402 static int Protocol_T14_Case3S ( Protocol_T14 * t14,APDU_Cmd * cmd, APDU_Rsp ** rsp)396 static int Protocol_T14_Case3S (APDU_Cmd * cmd, APDU_Rsp ** rsp) 403 397 { 404 398 int ret; 405 399 406 400 /* Send command TPDU */ 407 ret = Protocol_T14_ExchangeTPDU (t14,cmd, rsp);401 ret = Protocol_T14_ExchangeTPDU(cmd, rsp); 408 402 409 403 return ret; 410 404 } 411 405 412 static int Protocol_T0_Case4S ( Protocol_T0 * t0,APDU_Cmd * cmd, APDU_Rsp ** rsp)406 static int Protocol_T0_Case4S (APDU_Cmd * cmd, APDU_Rsp ** rsp) 413 407 { 414 408 int ret; … … 423 417 424 418 /* Send command TPDU */ 425 ret = Protocol_T0_ExchangeTPDU (t0,tpdu_cmd, (&tpdu_rsp));419 ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, (&tpdu_rsp)); 426 420 427 421 /* Delete command TPDU */ … … 451 445 452 446 /* Issue Get Reponse command */ 453 ret = Protocol_T0_ExchangeTPDU (t0,tpdu_cmd, rsp);447 ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, rsp); 454 448 455 449 /* Delete command TPDU */ … … 490 484 491 485 492 static int Protocol_T0_Case2E ( Protocol_T0 * t0,APDU_Cmd * cmd, APDU_Rsp ** rsp)486 static int Protocol_T0_Case2E (APDU_Cmd * cmd, APDU_Rsp ** rsp) 493 487 { 494 488 int ret = PROTOCOL_T0_OK; … … 512 506 513 507 /* Send command TPDU */ 514 ret = Protocol_T0_ExchangeTPDU (t0,tpdu_cmd, rsp);508 ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, rsp); 515 509 516 510 /* Delete command TPDU */ … … 534 528 535 529 /* Send envelope command TPDU */ 536 ret = Protocol_T0_ExchangeTPDU (t0,tpdu_cmd, (&tpdu_rsp));530 ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, (&tpdu_rsp)); 537 531 538 532 /* Delete command TPDU */ … … 574 568 575 569 576 static int Protocol_T0_Case3E ( Protocol_T0 * t0,APDU_Cmd * cmd, APDU_Rsp ** rsp)570 static int Protocol_T0_Case3E (APDU_Cmd * cmd, APDU_Rsp ** rsp) 577 571 { 578 572 int ret; … … 594 588 595 589 /* Send command TPDU */ 596 ret = Protocol_T0_Case3S (t 0, tpdu_cmd, rsp);590 ret = Protocol_T0_Case3S (tpdu_cmd, rsp); 597 591 598 592 /* Delete command TPDU */ … … 611 605 612 606 /* Send command TPDU */ 613 ret = Protocol_T0_ExchangeTPDU (t0,tpdu_cmd, (&tpdu_rsp));607 ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, (&tpdu_rsp)); 614 608 615 609 /* Delete command TPDU */ … … 636 630 637 631 /* Re-issue command TPDU */ 638 ret = Protocol_T0_ExchangeTPDU (t0,tpdu_cmd, rsp);632 ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, rsp); 639 633 640 634 /* Delete command TPDU */ … … 662 656 663 657 /* Issue Get Response command TPDU */ 664 ret = Protocol_T0_ExchangeTPDU (t0,tpdu_cmd, (&tpdu_rsp));658 ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, (&tpdu_rsp)); 665 659 666 660 /* Delete command TPDU */ … … 700 694 701 695 702 static int Protocol_T0_Case4E ( Protocol_T0 * t0,APDU_Cmd * cmd, APDU_Rsp ** rsp)696 static int Protocol_T0_Case4E (APDU_Cmd * cmd, APDU_Rsp ** rsp) 703 697 { 704 698 int ret; … … 722 716 723 717 /* Send command TPDU */ 724 ret = Protocol_T0_ExchangeTPDU (t0,tpdu_cmd, (&tpdu_rsp));718 ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, (&tpdu_rsp)); 725 719 726 720 /* Delete command TPDU */ … … 729 723 else /* 4E2 */ 730 724 { 731 ret = Protocol_T0_Case2E ( t0,cmd, (&tpdu_rsp));725 ret = Protocol_T0_Case2E (cmd, (&tpdu_rsp)); 732 726 } 733 727 … … 759 753 760 754 /* Issue Case 3E get response command */ 761 ret = Protocol_T0_Case3E ( t0,gr_cmd, rsp);755 ret = Protocol_T0_Case3E (gr_cmd, rsp); 762 756 763 757 /* Delete Get Response command APDU */ … … 786 780 787 781 /* Issue Case 3E get response command */ 788 ret = Protocol_T0_Case3E ( t0,gr_cmd, rsp);782 ret = Protocol_T0_Case3E (gr_cmd, rsp); 789 783 790 784 /* Delete Get Response command APDU */ … … 796 790 797 791 798 static int Protocol_T0_ExchangeTPDU ( Protocol_T0 * t0,APDU_Cmd * cmd, APDU_Rsp ** rsp)792 static int Protocol_T0_ExchangeTPDU (APDU_Cmd * cmd, APDU_Rsp ** rsp) 799 793 { 800 794 BYTE buffer[PROTOCOL_T0_MAX_SHORT_RESPONSE]; … … 965 959 } 966 960 967 static int Protocol_T14_ExchangeTPDU ( Protocol_T14 * t14,APDU_Cmd * cmd, APDU_Rsp ** rsp)961 static int Protocol_T14_ExchangeTPDU (APDU_Cmd * cmd, APDU_Rsp ** rsp) 968 962 { 969 963 BYTE buffer[PROTOCOL_T14_MAX_SHORT_RESPONSE]; … … 1110 1104 static void Protocol_T0_Clear (Protocol_T0 * t0) 1111 1105 { 1112 t0->icc = NULL;1113 1106 t0->wwt = 0; 1114 1107 } … … 1116 1109 static void Protocol_T14_Clear (Protocol_T14 * t14) 1117 1110 { 1118 t14->icc = NULL;1119 1111 t14->wwt = 0; 1120 1112 } -
trunk/csctapi/protocol_t0.h
r833 r1279 56 56 typedef struct 57 57 { 58 ICC_Async *icc; /* Asynchrosous integrated cirtuit card */59 58 unsigned long wwt; /* Work waiting time (ms) */ 60 59 } … … 64 63 typedef struct 65 64 { 66 ICC_Async *icc; /* Asynchrosous integrated cirtuit card */67 65 unsigned long wwt; /* Work waiting time (ms) */ 68 66 } … … 82 80 83 81 /* Initialise a protocol handler */ 84 extern int Protocol_T0_Init (Protocol_T0 * t0, ICC_Async * icc,PPS_ProtocolParameters * params, int selected_protocol);85 extern int Protocol_T14_Init (Protocol_T14 * t14, ICC_Async * icc,PPS_ProtocolParameters * params, int selected_protocol);82 extern int Protocol_T0_Init (Protocol_T0 * t0, PPS_ProtocolParameters * params, int selected_protocol); 83 extern int Protocol_T14_Init (Protocol_T14 * t14, PPS_ProtocolParameters * params, int selected_protocol); 86 84 87 85 /* Send a command and return a response */ 88 extern int Protocol_T0_Command ( Protocol_T0 * t0,APDU_Cmd * cmd, APDU_Rsp ** rsp);89 extern int Protocol_T14_Command ( Protocol_T14 * t14,APDU_Cmd * cmd, APDU_Rsp ** rsp);86 extern int Protocol_T0_Command (APDU_Cmd * cmd, APDU_Rsp ** rsp); 87 extern int Protocol_T14_Command (APDU_Cmd * cmd, APDU_Rsp ** rsp); 90 88 91 89 /* Close a protocol handler */ -
trunk/csctapi/protocol_t1.c
r1278 r1279 49 49 50 50 static int 51 Protocol_T1_SendBlock ( Protocol_T1 * t1,T1_Block * block);51 Protocol_T1_SendBlock (T1_Block * block); 52 52 53 53 static int … … 55 55 56 56 static int 57 Protocol_T1_UpdateBWT ( Protocol_T1 * t1,unsigned short bwt);57 Protocol_T1_UpdateBWT (unsigned short bwt); 58 58 59 59 /* … … 75 75 76 76 int 77 Protocol_T1_Init (Protocol_T1 * t1, ICC_Async * icc,int selected_protocol)77 Protocol_T1_Init (Protocol_T1 * t1, int selected_protocol) 78 78 { 79 79 BYTE ta, tb, tc, cwi, bwi; … … 81 81 double work_etu; 82 82 int i; 83 84 /* Set ICC */85 t1->icc = icc;86 83 87 84 /* Set IFSC */ … … 116 113 117 114 /* Work etu = (1000 / baudrate) milliseconds */ 118 ICC_Async_GetBaudrate ( t1->icc,&baudrate);115 ICC_Async_GetBaudrate (&baudrate); 119 116 work_etu = 1000 / (double)baudrate; 120 117 … … 180 177 #endif 181 178 /* Send IFSD request */ 182 ret = Protocol_T1_SendBlock ( t1,block);179 ret = Protocol_T1_SendBlock (block); 183 180 184 181 /* Delete block */ … … 225 222 226 223 /* Send a block */ 227 ret = Protocol_T1_SendBlock ( t1,block);224 ret = Protocol_T1_SendBlock (block); 228 225 229 226 /* Delete I-block */ … … 266 263 #endif 267 264 /* Send a block */ 268 ret = Protocol_T1_SendBlock ( t1,block);265 ret = Protocol_T1_SendBlock (block); 269 266 270 267 /* Delete I-block */ … … 296 293 { 297 294 if (wtx > 1) 298 Protocol_T1_UpdateBWT ( t1,wtx * (t1->bwt));295 Protocol_T1_UpdateBWT (wtx * (t1->bwt)); 299 296 300 297 /* Receive a block */ … … 303 300 if (wtx > 1) 304 301 { 305 Protocol_T1_UpdateBWT (t1 , t1->bwt);302 Protocol_T1_UpdateBWT (t1->bwt); 306 303 wtx = 0; 307 304 } … … 340 337 #endif 341 338 /* Send R-Block */ 342 ret = Protocol_T1_SendBlock ( t1,block);339 ret = Protocol_T1_SendBlock (block); 343 340 344 341 /* Delete I-block */ … … 364 361 #endif 365 362 /* Send WTX response */ 366 ret = Protocol_T1_SendBlock ( t1,block);363 ret = Protocol_T1_SendBlock (block); 367 364 368 365 /* Delete block */ … … 405 402 406 403 static int 407 Protocol_T1_SendBlock ( Protocol_T1 * t1,T1_Block * block)404 Protocol_T1_SendBlock (T1_Block * block) 408 405 { 409 406 BYTE *buffer; … … 445 442 { 446 443 /* Set timings to read the remaining block */ 447 Protocol_T1_UpdateBWT (t1 , t1->cwt);444 Protocol_T1_UpdateBWT (t1->cwt); 448 445 449 446 /* Receive remaining bytes */ … … 462 459 463 460 /* Restore timings */ 464 Protocol_T1_UpdateBWT (t1 , t1->bwt);461 Protocol_T1_UpdateBWT (t1->bwt); 465 462 } 466 463 else … … 477 474 Protocol_T1_Clear (Protocol_T1 * t1) 478 475 { 479 t1->icc = NULL;480 476 t1->ifsc = 0; 481 477 t1->ifsd = 0; … … 488 484 489 485 static int 490 Protocol_T1_UpdateBWT ( Protocol_T1 * t1,unsigned short bwt)486 Protocol_T1_UpdateBWT (unsigned short bwt) 491 487 { 492 488 icc_timings.block_timeout = bwt; -
trunk/csctapi/protocol_t1.h
r1125 r1279 48 48 typedef struct 49 49 { 50 ICC_Async *icc; /* Asynchronous integrated cirtuit card */51 50 unsigned short ifsc; /* Information field size for the ICC */ 52 51 unsigned short ifsd; /* Information field size for the IFD */ … … 73 72 /* Initialise a protocol handler */ 74 73 extern int 75 Protocol_T1_Init (Protocol_T1 * t1, ICC_Async * icc,int selected_protocol);74 Protocol_T1_Init (Protocol_T1 * t1, int selected_protocol); 76 75 77 76 /* Send a command and return a response */
Note:
See TracChangeset
for help on using the changeset viewer.