Changeset 1278


Ignore:
Timestamp:
01/18/10 11:14:45 (11 years ago)
Author:
dingo35
Message:

Cleanup ICC_Async: atr, baudrate, timings, convention

Location:
trunk/csctapi
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/csctapi/config.h

    r1161 r1278  
    9191/* #undef ICC_TYPE_SYNC */
    9292
    93 /* Smartcard with direct convention */
    94 /* #undef IFD_TOWITOKO_CONVENTION_DIRECT */
    95 
    96 /* Smartcard with inverse convention */
    97 /* #undef IFD_TOWITOKO_CONVENTION_INVERSE */
    98 
    9993/* ATR for asynchronous cards is cheked */
    10094#define IFD_TOWITOKO_STRICT_ATR_CHECK 1
  • trunk/csctapi/config.h.dbg

    r497 r1278  
    9191/* #undef ICC_TYPE_SYNC */
    9292
    93 /* Smartcard with direct convention */
    94 /* #undef IFD_TOWITOKO_CONVENTION_DIRECT */
    95 
    96 /* Smartcard with inverse convention */
    97 /* #undef IFD_TOWITOKO_CONVENTION_INVERSE */
    98 
    9993/* ATR for asynchronous cards is cheked */
    10094#define IFD_TOWITOKO_STRICT_ATR_CHECK 1
  • trunk/csctapi/config.h.std

    r497 r1278  
    9191/* #undef ICC_TYPE_SYNC */
    9292
    93 /* Smartcard with direct convention */
    94 /* #undef IFD_TOWITOKO_CONVENTION_DIRECT */
    95 
    96 /* Smartcard with inverse convention */
    97 /* #undef IFD_TOWITOKO_CONVENTION_INVERSE */
    98 
    9993/* ATR for asynchronous cards is cheked */
    10094#define IFD_TOWITOKO_STRICT_ATR_CHECK 1
  • trunk/csctapi/ct_slot.c

    r1266 r1278  
    290290{
    291291    if (slot->icc_type == CT_SLOT_ICC_ASYNC)
    292         return ((void *) ICC_Async_GetAtr((ICC_Async *) slot->icc));
     292        return ((void *) atr );
     293        //return ((void *) ICC_Async_GetAtr((ICC_Async *) slot->icc));
    293294   
    294295    return NULL;
  • trunk/csctapi/icc_async.c

    r1266 r1278  
    211211    /* Reset ICC */
    212212    if (reader[ridx].typ == R_INTERNAL) {
    213         if (!Sci_Reset(&(icc->atr)))
    214         {
    215             icc->atr = NULL;
     213        if (!Sci_Reset(&(atr)))
     214        {
     215            atr = NULL;
    216216            return ICC_ASYNC_IFD_ERROR;
    217217        }
     
    221221#ifdef COOL
    222222    if (reader[ridx].typ == R_INTERNAL) {
    223         if (!Cool_Reset(&(icc->atr)))
    224         {
    225             icc->atr = NULL;
    226             return ICC_ASYNC_IFD_ERROR;
    227         }
    228     }
    229     else
    230 #endif
    231     if (!Phoenix_Reset(&(icc->atr)))
    232     {
    233         icc->atr = NULL;
     223        if (!Cool_Reset(&(atr)))
     224        {
     225            atr = NULL;
     226            return ICC_ASYNC_IFD_ERROR;
     227        }
     228    }
     229    else
     230#endif
     231    if (!Phoenix_Reset(&(atr)))
     232    {
     233        atr = NULL;
    234234        return ICC_ASYNC_IFD_ERROR;
    235235    }
    236236    /* Get ICC convention */
    237     if (ATR_GetConvention (icc->atr, &(icc->convention)) != ATR_OK)
    238     {
    239         ATR_Delete (icc->atr);
    240         icc->atr = NULL;
    241         icc->convention = 0;
     237    if (ATR_GetConvention (atr, &(convention)) != ATR_OK)
     238    {
     239        ATR_Delete (atr);
     240        atr = NULL;
     241        convention = 0;
    242242       
    243243        return ICC_ASYNC_ATR_ERROR;
    244244    }
    245245   
    246     icc->protocol_type = ATR_PROTOCOL_TYPE_T0;
    247    
    248     ATR_GetNumberOfProtocols (icc->atr, &np);
     246    protocol_type = ATR_PROTOCOL_TYPE_T0;
     247   
     248    ATR_GetNumberOfProtocols (atr, &np);
    249249   
    250250    /*
     
    253253    */
    254254/*  if (np>1)
    255         ATR_GetProtocolType (icc->atr, 1, &(icc->protocol_type));
     255        ATR_GetProtocolType (atr, 1, &(protocol_type));
    256256   
    257257#ifdef DEBUG_ICC
    258     printf("ICC: Detected %s convention processor card T=%d\n",(icc->convention == ATR_CONVENTION_DIRECT ? "direct" : "inverse"), icc->protocol_type);
     258    printf("ICC: Detected %s convention processor card T=%d\n",(convention == ATR_CONVENTION_DIRECT ? "direct" : "inverse"), protocol_type);
    259259#endif
    260260    *///really should let PPS handle this
    261261   
    262262    /* Initialize member variables */
    263     icc->baudrate = ICC_ASYNC_BAUDRATE;
    264    
    265     if (icc->convention == ATR_CONVENTION_INVERSE)
     263    if (convention == ATR_CONVENTION_INVERSE)
    266264    {
    267265        if (!IO_Serial_SetParity (PARITY_ODD))
    268266            return ICC_ASYNC_IFD_ERROR;
    269267    }
    270     else if(icc->protocol_type == ATR_PROTOCOL_TYPE_T14)
     268    else if(protocol_type == ATR_PROTOCOL_TYPE_T14)
    271269    {
    272270        if (!IO_Serial_SetParity (PARITY_NONE))
     
    288286}
    289287
    290 int ICC_Async_SetTimings (ICC_Async * icc, ICC_Async_Timings * timings)
    291 {
    292     icc->timings.block_delay = timings->block_delay;
    293     icc->timings.char_delay = timings->char_delay;
    294     icc->timings.block_timeout = timings->block_timeout;
    295     icc->timings.char_timeout = timings->char_timeout;
    296 /*  if (icc->protocol_type == ATR_PROTOCOL_TYPE_T1)
     288int ICC_Async_SetTimings ()
     289{
     290/*  if (protocol_type == ATR_PROTOCOL_TYPE_T1)
    297291        cs_debug("SetTimings: T1: chardelay %d, chartimeout CWT %d, blockdelay BGT??? %d, blocktimeout BWT %d",timings->char_delay,timings->char_timeout, timings->block_delay, timings->block_timeout);
    298292    else
     
    307301        if (ioctl(reader[ridx].handle, IOCTL_GET_PARAMETERS, &params) < 0 )
    308302            return ICC_ASYNC_IFD_ERROR;
    309         switch (icc->protocol_type) {
     303        switch (protocol_type) {
    310304            case ATR_PROTOCOL_TYPE_T1:
    311                 params.BWT = icc->timings.block_timeout;
    312                 params.CWT = icc->timings.char_timeout;
    313                 //params.BGT = icc->timings.block_delay; load into params.EGT??
     305                params.BWT = icc_timings.block_timeout;
     306                params.CWT = icc_timings.char_timeout;
     307                //params.BGT = icc_timings.block_delay; load into params.EGT??
    314308                break;
    315309            case ATR_PROTOCOL_TYPE_T0:
    316310            case ATR_PROTOCOL_TYPE_T14:
    317311            default:
    318             params.WWT = icc->timings.char_timeout;
     312            params.WWT = icc_timings.char_timeout;
    319313                break;
    320314        }
     
    328322}
    329323
    330 int ICC_Async_GetTimings (ICC_Async * icc, ICC_Async_Timings * timings)
    331 {
    332     timings->block_delay = icc->timings.block_delay;
    333     timings->char_delay = icc->timings.char_delay;
    334     timings->block_timeout = icc->timings.block_timeout;
    335     timings->char_timeout = icc->timings.char_timeout;
    336    
    337     return ICC_ASYNC_OK;
    338 }
    339 
    340324int ICC_Async_SetBaudrate (ICC_Async * icc, unsigned long baudrate)
    341325{
    342     icc->baudrate = baudrate;
    343326    if (!Phoenix_SetBaudrate (baudrate))
    344327      return ICC_ASYNC_IFD_ERROR;
     
    349332int ICC_Async_GetBaudrate (ICC_Async * icc, unsigned long * baudrate)
    350333{
    351     (*baudrate) = icc->baudrate;
     334    (*baudrate) = reader[ridx].baudrate;
    352335    return ICC_ASYNC_OK; 
    353336}
    354337
    355 int ICC_Async_Transmit (ICC_Async * icc, unsigned size, BYTE * data)
     338int ICC_Async_Transmit (unsigned size, BYTE * data)
    356339{
    357340    BYTE *buffer = NULL, *sent;
    358341    IFD_Timings timings;
    359342   
    360     if (icc->convention == ATR_CONVENTION_INVERSE && reader[ridx].typ != R_INTERNAL)
     343    if (convention == ATR_CONVENTION_INVERSE && reader[ridx].typ != R_INTERNAL)
    361344    {
    362345        buffer = (BYTE *) calloc(sizeof (BYTE), size);
     
    370353    }
    371354   
    372     timings.block_delay = icc->timings.block_delay;
    373     timings.char_delay = icc->timings.char_delay;
     355    timings.block_delay = icc_timings.block_delay;
     356    timings.char_delay = icc_timings.char_delay;
    374357   
    375358#ifdef COOL
     
    383366        return ICC_ASYNC_IFD_ERROR;
    384367   
    385     if (icc->convention == ATR_CONVENTION_INVERSE)
     368    if (convention == ATR_CONVENTION_INVERSE)
    386369        free (buffer);
    387370   
     
    389372}
    390373
    391 int ICC_Async_Receive (ICC_Async * icc, unsigned size, BYTE * data)
     374int ICC_Async_Receive (unsigned size, BYTE * data)
    392375{
    393376    IFD_Timings timings;
    394377   
    395     timings.block_timeout = icc->timings.block_timeout;
    396     timings.char_timeout = icc->timings.char_timeout;
     378    timings.block_timeout = icc_timings.block_timeout;
     379    timings.char_timeout = icc_timings.char_timeout;
    397380   
    398381#ifdef COOL
     
    407390#endif
    408391   
    409     if (icc->convention == ATR_CONVENTION_INVERSE && reader[ridx].typ != R_INTERNAL)
     392    if (convention == ATR_CONVENTION_INVERSE && reader[ridx].typ != R_INTERNAL)
    410393        ICC_Async_InvertBuffer (size, data);
    411394   
    412395    return ICC_ASYNC_OK;
    413 }
    414 
    415 ATR * ICC_Async_GetAtr (ICC_Async * icc)
    416 {
    417     return icc->atr;
    418396}
    419397
     
    427405   
    428406    /* Delete atr */
    429     ATR_Delete (icc->atr);
     407    ATR_Delete (atr);
    430408   
    431409    ICC_Async_Clear (icc);
     
    466444static void ICC_Async_Clear (ICC_Async * icc)
    467445{
    468     icc->atr = NULL;
    469     icc->baudrate = 0L;
    470     icc->convention = 0;
    471     icc->protocol_type = -1;
    472     icc->timings.block_delay = 0;
    473     icc->timings.char_delay = 0;
    474     icc->timings.block_timeout = 0;
    475     icc->timings.char_timeout = 0;
    476 }
     446    atr = NULL;
     447    convention = 0;
     448    protocol_type = -1;
     449    icc_timings.block_delay = 0;
     450    icc_timings.char_delay = 0;
     451    icc_timings.block_timeout = 0;
     452    icc_timings.char_timeout = 0;
     453}
  • trunk/csctapi/icc_async.h

    r1266 r1278  
    6161typedef struct
    6262{
    63   ATR *atr;                     /* Answer to reset of this ICC */
    64   int convention;               /* Convention of this ICC */
    65   unsigned long baudrate;   /* Current baudrate (bps) for transmiting to this ICC */
    66   ICC_Async_Timings timings;    /* Current timings for transmiting to this ICC */
    67   BYTE protocol_type;       /* Type of protocol */
    6863}
    6964ICC_Async;
     65
     66ATR *atr;                     /* Answer to reset of this ICC */
     67int convention;               /* Convention of this ICC */
     68BYTE protocol_type;     /* Type of protocol */
     69ICC_Async_Timings icc_timings;    /* Current timings for transmiting to this ICC */
    7070
    7171/*
     
    8282
    8383/* Attributes */
    84 extern int ICC_Async_SetTimings (ICC_Async * icc, ICC_Async_Timings * timings);
    85 extern int ICC_Async_GetTimings (ICC_Async * icc, ICC_Async_Timings * timings);
     84extern int ICC_Async_SetTimings ();
    8685extern int ICC_Async_SetBaudrate (ICC_Async * icc, unsigned long baudrate);
    8786extern int ICC_Async_GetBaudrate (ICC_Async * icc, unsigned long * baudrate);
    88 extern ATR *ICC_Async_GetAtr (ICC_Async * icc);
    8987extern unsigned long ICC_Async_GetClockRate ();
    9088
    9189/* Operations */
    92 extern int ICC_Async_Transmit (ICC_Async * icc, unsigned size, BYTE * buffer);
    93 extern int ICC_Async_Receive (ICC_Async * icc, unsigned size, BYTE * buffer);
     90extern int ICC_Async_Transmit (unsigned size, BYTE * buffer);
     91extern int ICC_Async_Receive (unsigned size, BYTE * buffer);
    9492
    9593#endif /* _ICC_ASYNC_ */
  • trunk/csctapi/ifd_phoenix.c

    r1266 r1278  
    283283int Phoenix_SetBaudrate (unsigned long baudrate)
    284284{
    285     if(reader[ridx].typ == R_INTERNAL)
    286         return OK;
    287 
    288285#ifdef DEBUG_IFD
    289286    printf ("IFD: Setting baudrate to %lu\n", baudrate);
    290287#endif
    291     if (reader[ridx].baudrate   == baudrate)
    292         return OK;
    293 
    294     /* Get current settings */
    295     struct termios tio;
    296     if (tcgetattr (reader[ridx].handle, &tio) != 0)
    297         return ERROR;
    298    
    299     //write baudrate here!
    300     if (!IO_Serial_SetBitrate (baudrate, &tio))
    301         return ERROR;
    302    
    303     if (!IO_Serial_SetProperties(tio))
    304         return ERROR;
    305    
     288    if ((reader[ridx].typ != R_INTERNAL) && (reader[ridx].baudrate  != baudrate))
     289    {
     290        /* Get current settings */
     291        struct termios tio;
     292        if (tcgetattr (reader[ridx].handle, &tio) != 0)
     293            return ERROR;
     294   
     295        //write baudrate here!
     296        if (!IO_Serial_SetBitrate (baudrate, &tio))
     297            return ERROR;
     298   
     299        if (!IO_Serial_SetProperties(tio))
     300            return ERROR;
     301    }
    306302    reader[ridx].baudrate = baudrate;
    307    
    308303    return OK;
    309304}
  • trunk/csctapi/pps.c

    r1235 r1278  
    100100    //also from FI -> F is easy, other way around not
    101101   
    102     ATR *atr;
    103102    int ret;
    104103    bool PPS_success;
     
    136135    PPS_success = PPS_OK;
    137136    int protocol_selected = 0; //stores which TAi,TBi etc. bytes must be used 0 means not set
    138     atr = ICC_Async_GetAtr (pps->icc);
    139137    if ((*length) <= 0 || !PPS_success) // If not by command, or PPS Exchange by command failed: Try PPS Exchange by ATR or Get parameters from ATR
    140138    {
     
    275273    }
    276274
    277     pps->icc->protocol_type = pps->parameters.t;
     275    protocol_type = pps->parameters.t;
    278276   
    279277#ifdef DEBUG_PROTOCOL
     
    363361        return PPS_HANDSAKE_ERROR;
    364362#else
    365     if (ICC_Async_Transmit (pps->icc, len_request, params) != ICC_ASYNC_OK)
     363    if (ICC_Async_Transmit (len_request, params) != ICC_ASYNC_OK)
    366364        return PPS_ICC_ERROR;
    367365   
    368366    /* Get PPS confirm */
    369     if (ICC_Async_Receive (pps->icc, 2, confirm) != ICC_ASYNC_OK)
     367    if (ICC_Async_Receive (2, confirm) != ICC_ASYNC_OK)
    370368        return PPS_ICC_ERROR;
    371369   
    372370    len_confirm = PPS_GetLength (confirm);
    373371   
    374     if (ICC_Async_Receive (pps->icc, len_confirm - 2, confirm + 2) != ICC_ASYNC_OK)
     372    if (ICC_Async_Receive (len_confirm - 2, confirm + 2) != ICC_ASYNC_OK)
    375373        return PPS_ICC_ERROR;
    376374   
     
    439437        if (ioctl(reader[ridx].handle, IOCTL_GET_PARAMETERS, &params) < 0 )
    440438            return PPS_ICC_ERROR;
    441 
    442         ATR *atr = ICC_Async_GetAtr (pps->icc);
    443439
    444440        params.T = pps->parameters.t;
  • trunk/csctapi/protocol_t0.c

    r1235 r1278  
    104104int Protocol_T0_Init (Protocol_T0 * t0, ICC_Async * icc, PPS_ProtocolParameters * params, int selected_protocol)
    105105{
    106     ICC_Async_Timings timings;
    107106    BYTE wi;
    108 #ifndef PROTOCOL_T0_USE_DEFAULT_TIMINGS
    109     ATR *atr = ICC_Async_GetAtr (icc);
    110 #endif
    111107   
    112108    /* Set ICC */
     
    124120   
    125121    /* Set timings */
    126     ICC_Async_GetTimings (t0->icc, &timings);
    127    
    128     timings.block_timeout = t0->wwt;
    129     timings.char_timeout = t0->wwt;
    130    
    131     ICC_Async_SetTimings (t0->icc, &timings);
     122    icc_timings.block_timeout = t0->wwt;
     123    icc_timings.char_timeout = t0->wwt;
     124    ICC_Async_SetTimings ();
    132125   
    133126#ifdef DEBUG_PROTOCOL
     
    140133int Protocol_T14_Init (Protocol_T14 * t14, ICC_Async * icc, PPS_ProtocolParameters * params, int selected_protocol)
    141134{
    142     ICC_Async_Timings timings;
    143135    BYTE wi;
    144 #ifndef PROTOCOL_T14_USE_DEFAULT_TIMINGS
    145     ATR *atr = ICC_Async_GetAtr (icc);
    146 #endif
    147136   
    148137    /* Set ICC */
     
    161150   
    162151    /* Set timings */
    163     ICC_Async_GetTimings (t14->icc, &timings);
    164    
    165     timings.block_timeout = t14->wwt;
    166     timings.char_timeout = t14->wwt;
    167    
    168     ICC_Async_SetTimings (t14->icc, &timings);
    169    
     152    icc_timings.block_timeout = t14->wwt;
     153    icc_timings.char_timeout = t14->wwt;
     154    ICC_Async_SetTimings ();
     155
    170156#ifdef DEBUG_PROTOCOL
    171157    printf ("Protocol: T=14: WWT=%d\n", (int)(t14->wwt));
     
    828814   
    829815    /* Send header bytes */
    830     if (ICC_Async_Transmit (t0->icc, 5, APDU_Cmd_Header (cmd)) != ICC_ASYNC_OK)
     816    if (ICC_Async_Transmit (5, APDU_Cmd_Header (cmd)) != ICC_ASYNC_OK)
    831817    {
    832818        (*rsp) = NULL;
     
    848834    {
    849835        /* Read one procedure byte */
    850         if (ICC_Async_Receive (t0->icc, 1, buffer + recv) != ICC_ASYNC_OK)
     836        if (ICC_Async_Receive (1, buffer + recv) != ICC_ASYNC_OK)
    851837        {
    852838            ret = PROTOCOL_T0_ICC_ERROR;
     
    876862           
    877863            /* Read SW2 byte */
    878             if (ICC_Async_Receive (t0->icc, 1, buffer + recv) != ICC_ASYNC_OK)
     864            if (ICC_Async_Receive (1, buffer + recv) != ICC_ASYNC_OK)
    879865            {
    880866                ret = PROTOCOL_T0_ICC_ERROR;
     
    898884                    return PROTOCOL_T0_ERROR;
    899885                               
    900                 if (ICC_Async_Transmit(t0->icc, MAX (Lc - sent, 0), data + sent) != ICC_ASYNC_OK) /* Send remaining data bytes */
     886                if (ICC_Async_Transmit(MAX (Lc - sent, 0), data + sent) != ICC_ASYNC_OK) /* Send remaining data bytes */
    901887                {
    902888                    ret = PROTOCOL_T0_ICC_ERROR;
     
    917903               
    918904                /* Read remaining data bytes */
    919                 if (ICC_Async_Receive(t0->icc, MAX (Le - recv, 0), buffer + recv) != ICC_ASYNC_OK)
     905                if (ICC_Async_Receive(MAX (Le - recv, 0), buffer + recv) != ICC_ASYNC_OK)
    920906                {//printf("error %d\n", (int)Le);
    921907                    ret = PROTOCOL_T0_ICC_ERROR;
     
    939925                               
    940926                /* Send next data byte */
    941                 if (ICC_Async_Transmit (t0->icc, 1, data + sent) !=ICC_ASYNC_OK)
     927                if (ICC_Async_Transmit (1, data + sent) !=ICC_ASYNC_OK)
    942928                {
    943929                    ret = PROTOCOL_T0_ICC_ERROR;
     
    954940               
    955941                /* Read next data byte */
    956                 if (ICC_Async_Receive (t0->icc, 1, buffer + recv) != ICC_ASYNC_OK)
     942                if (ICC_Async_Receive (1, buffer + recv) != ICC_ASYNC_OK)
    957943                {
    958944                    ret = PROTOCOL_T0_ICC_ERROR;
     
    1004990    {
    1005991        /* Send 0x01 byte */
    1006         if (ICC_Async_Transmit (t14->icc, 1, &b1) != ICC_ASYNC_OK)
     992        if (ICC_Async_Transmit (1, &b1) != ICC_ASYNC_OK)
    1007993        {
    1008994            (*rsp) = NULL;
     
    1011997       
    1012998        /* Send apdu */
    1013         if (ICC_Async_Transmit (t14->icc, cmd_len, cmd_raw) != ICC_ASYNC_OK)
     999        if (ICC_Async_Transmit (cmd_len, cmd_raw) != ICC_ASYNC_OK)
    10141000        {
    10151001            (*rsp) = NULL;
     
    10181004       
    10191005        /* Send xor byte */
    1020         if (ICC_Async_Transmit (t14->icc, 1, &ixor) != ICC_ASYNC_OK)
     1006        if (ICC_Async_Transmit (1, &ixor) != ICC_ASYNC_OK)
    10211007        {
    10221008            (*rsp) = NULL;
     
    10311017       
    10321018        /* Send apdu */
    1033         if (ICC_Async_Transmit (t14->icc, cmd_len+2, buffer) != ICC_ASYNC_OK)
     1019        if (ICC_Async_Transmit (cmd_len+2, buffer) != ICC_ASYNC_OK)
    10341020        {
    10351021            (*rsp) = NULL;
     
    10681054        }
    10691055        /* Read one procedure byte */
    1070         if (ICC_Async_Receive (t14->icc, 8, buffer) != ICC_ASYNC_OK)
     1056        if (ICC_Async_Receive (8, buffer) != ICC_ASYNC_OK)
    10711057        {
    10721058            ret = PROTOCOL_T14_ICC_ERROR;
     
    10791065            if(recv)
    10801066            {
    1081                 if (ICC_Async_Receive (t14->icc, recv, buffer + 8) != ICC_ASYNC_OK)
     1067                if (ICC_Async_Receive (recv, buffer + 8) != ICC_ASYNC_OK)
    10821068                {
    10831069                    ret = PROTOCOL_T14_ICC_ERROR;
     
    10861072            }
    10871073           
    1088             if (ICC_Async_Receive (t14->icc, 1, &ixor) != ICC_ASYNC_OK)
     1074            if (ICC_Async_Receive (1, &ixor) != ICC_ASYNC_OK)
    10891075            {
    10901076                ret = PROTOCOL_T14_ICC_ERROR;
  • trunk/csctapi/protocol_t1.c

    r1219 r1278  
    7777Protocol_T1_Init (Protocol_T1 * t1, ICC_Async * icc, int selected_protocol)
    7878{
    79   ICC_Async_Timings timings;
    8079  BYTE ta, tb, tc, cwi, bwi;
    8180  unsigned long baudrate;
    8281  double work_etu;
    83   ATR *atr;
    8482  int i;
    8583
    8684  /* Set ICC */
    8785  t1->icc = icc;
    88 
    89   /* Get ATR of the card */
    90   atr = ICC_Async_GetAtr (t1->icc);
    9186
    9287  /* Set IFSC */
     
    152147 
    153148  /* Set timings */
    154   ICC_Async_GetTimings (t1->icc, &timings);
    155 
    156   timings.block_timeout = t1->bwt;
    157   timings.char_timeout = t1->cwt;
    158   timings.block_delay = t1->bgt;
    159 
    160   ICC_Async_SetTimings (t1->icc, &timings);
     149  icc_timings.block_timeout = t1->bwt;
     150  icc_timings.char_timeout = t1->cwt;
     151  icc_timings.block_delay = t1->bgt;
     152    ICC_Async_SetTimings ();
    161153
    162154#ifdef DEBUG_PROTOCOL
     
    423415      length = T1_Block_RawLen (block);
    424416
    425       if (ICC_Async_Transmit (t1->icc, length, buffer) != ICC_ASYNC_OK)
     417      if (ICC_Async_Transmit (length, buffer) != ICC_ASYNC_OK)
    426418        {
    427419          ret = PROTOCOL_T1_ICC_ERROR;
     
    442434
    443435  /* Receive four mandatory bytes */
    444   if (ICC_Async_Receive (t1->icc, 4, buffer) != ICC_ASYNC_OK)
     436  if (ICC_Async_Receive (4, buffer) != ICC_ASYNC_OK)
    445437    {
    446438      ret = PROTOCOL_T1_ICC_ERROR;
     
    456448
    457449          /* Receive remaining bytes */
    458           if (ICC_Async_Receive (t1->icc, buffer[2], buffer + 4) !=
     450          if (ICC_Async_Receive (buffer[2], buffer + 4) !=
    459451              ICC_ASYNC_OK)
    460452            {
     
    498490Protocol_T1_UpdateBWT (Protocol_T1 * t1, unsigned short bwt)
    499491{
    500   ICC_Async_Timings timings;
    501  
    502   ICC_Async_GetTimings (t1->icc, &timings);
    503 
    504   timings.block_timeout = bwt;
    505 
    506   ICC_Async_SetTimings (t1->icc, &timings);
     492  icc_timings.block_timeout = bwt;
     493    ICC_Async_SetTimings ();
    507494
    508495  return PROTOCOL_T1_OK;
Note: See TracChangeset for help on using the changeset viewer.