Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

t0.c File Reference

T=0 functions. More...

#include <config.h>
#include <sw.h>
#include <commands.h>
#include <hal.h>
#include <t0.h>
#include <types.h>
#include <string.h>

Defines

#define SW   sw

Functions

void t0_init (void)
 Initialize T=0 data. More...

void t0_recBlock (iu8 *dst, iu16 len)
 Receive multiple bytes. More...

void t0_wtx (void)
 Send a WTX. More...

bool t0_dir (bool in)
 Set IN/OUT direction if command. More...

void t0_exchApdu (void)
 Exchanged APDUs with IFD. More...

void t0_getResponse (void)
 Get Response command. More...

bool t0_testP1P2 (iu16 p1p2)
 Test P1P2 for correct content. More...

bool t0_testP3 (iu8 p3)
 Test P3 for correct content. More...


Variables

bool iosend
bool ioin
iu8 ioheader [5]
iu8 iodata [sizeof(iodata)]
iu16 iodatalen


Detailed Description

T=0 functions.

Id:
t0.c,v 1.14 2003/05/10 17:26:58 m Exp


Define Documentation

#define SW   sw
 


Function Documentation

bool t0_dir bool    in
 

Set IN/OUT direction if command.

This should be called by each command to set the command case. With IN commands the command data is only available after this function has been called.

Only in an error case, where only a status word is to be returned this command doesn't have to be called.

Parameters:
in  Boolean value signaling direction.
Return values:
TRUE  on success.
FALSE  on failure. Error code given in sw.

void t0_exchApdu void   
 

Exchanged APDUs with IFD.

This function handles also the Get Response case.

void t0_getResponse void   
 

Get Response command.

Is called from t0_exchApdu.

void t0_init void   
 

Initialize T=0 data.

Must be called before the first t0_exchApdu.

void t0_recBlock iu8   dst,
iu16    len
 

Receive multiple bytes.

Receive len bytes and write them to dst.

Parameters:
dst  Pointer to destination area in RAM.
len  Data bytes to receive.

bool t0_testP1P2 iu16    p1p2
 

Test P1P2 for correct content.

Compares the values of P1 and P2 in header to p1p2. If they differ, sw is set to SW_WRONG_P1P2 and FALSE is returned.

Parameters:
p1p2  Target value of P1P2.
Return values:
TRUE  on success.
FALSE  on failure. Error code given in sw.

bool t0_testP3 iu8    p3
 

Test P3 for correct content.

Compares the value of P3 in header to p3. If they differ, sw is set to SW_WRONG_P1P2 and FALSE is returned.

Parameters:
p3  Target value of P3.
Return values:
TRUE  on success.
FALSE  on failure. Error code given in sw.

void t0_wtx void   
 

Send a WTX.


Variable Documentation

iu8 iodata[sizeof(iodata)]
 

iu16 iodatalen
 

iu8 ioheader[5]
 

bool ioin
 

bool iosend [static]
 


Copyright 2002 by Matthias Bruestle. This is licensed under the GNU General Public License.