The Smart Card Detective (SCD)
Defines | Functions | Variables
scd.h File Reference

scd.h Header file More...

Go to the source code of this file.

Defines

#define WARM_RESET_VALUE   0xAA
 This is a magic value that may be used in detecting a warm reset.
#define MAX_EXCHANGES   50
 Maximum number of command-response pairs recorded when logging.
#define EEPROM_WARM_RESET   0x0
 EEPROM address for byte used on warm reset.
#define EEPROM_TIMER_T2   0x4
 EEPROM address for counter value from T2 - 4 bytes little endian.
#define EEPROM_TEMP_1   0x8
 Temporary space 1 - use this for any purpose, 4 bytes.
#define EEPROM_TEMP_2   0x12
 Temporary space 2 - use this for any purpose, 4 bytes.
#define EEPROM_APPLICATION   0x32
 EEPROM address for selected application.
#define EEPROM_COUNTER   0x40
 EEPROM address for transaction counter.
#define EEPROM_TLOG_POINTER_HI   0x48
 EEPROM address for log high address pointer.
#define EEPROM_TLOG_POINTER_LO   0x49
 EEPROM address for log low address pointer.
#define EEPROM_TLOG_DATA   0x80
 EEPROM address for transaction log data.
#define EEPROM_MAX_ADDRESS   0xFE0
 EEPROM maximum allowed address.

Functions

int main (void)
 Main function.
void InitSCD ()
 Initializes the SCD.
uint8_t SelectApplication ()
 Show menu and select application.
void BootloaderJumpCheck (void) __attribute__((naked
 Jump to bootloader if required.
void section (".init3")))
void TestSCDTerminal ()
 Tests the SCD-Terminal communication.
void TestSCDICC ()
 Tests the SCD-ICC communication.
void SwitchLeds ()
 Simple application to switch some LEDs on and off.
void TestHardware ()
 Tests the hardware (LEDs, LCD and buttons)

Variables

char * appStrings []

Detailed Description

scd.h Header file

Contains definitions of functions used by the Smart Card Detective

Copyright (C) 2012 Omar Choudary (omar.choudary@cl.cam.ac.uk)

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file scd.h.


Define Documentation

#define EEPROM_APPLICATION   0x32

EEPROM address for selected application.

Definition at line 57 of file scd.h.

#define EEPROM_COUNTER   0x40

EEPROM address for transaction counter.

Definition at line 60 of file scd.h.

#define EEPROM_MAX_ADDRESS   0xFE0

EEPROM maximum allowed address.

Definition at line 72 of file scd.h.

#define EEPROM_TEMP_1   0x8

Temporary space 1 - use this for any purpose, 4 bytes.

Definition at line 51 of file scd.h.

#define EEPROM_TEMP_2   0x12

Temporary space 2 - use this for any purpose, 4 bytes.

Definition at line 54 of file scd.h.

#define EEPROM_TIMER_T2   0x4

EEPROM address for counter value from T2 - 4 bytes little endian.

Definition at line 48 of file scd.h.

#define EEPROM_TLOG_DATA   0x80

EEPROM address for transaction log data.

Definition at line 69 of file scd.h.

#define EEPROM_TLOG_POINTER_HI   0x48

EEPROM address for log high address pointer.

Definition at line 63 of file scd.h.

#define EEPROM_TLOG_POINTER_LO   0x49

EEPROM address for log low address pointer.

Definition at line 66 of file scd.h.

#define EEPROM_WARM_RESET   0x0

EEPROM address for byte used on warm reset.

Definition at line 45 of file scd.h.

#define MAX_EXCHANGES   50

Maximum number of command-response pairs recorded when logging.

Definition at line 42 of file scd.h.

#define WARM_RESET_VALUE   0xAA

This is a magic value that may be used in detecting a warm reset.

Definition at line 39 of file scd.h.


Function Documentation

void BootloaderJumpCheck ( void  )

Jump to bootloader if required.

void InitSCD ( )

Initializes the SCD.

This method should be called before any other operation. It sets the I/O ports to a correct state and it also recovers any necessary data from EEPROM.

Definition at line 252 of file scd.c.

int main ( void  )

Main function.

Main program

Definition at line 109 of file scd.c.

void section ( ".init3"  )
uint8_t SelectApplication ( )

Show menu and select application.

This function shows a menu with the existing applications and allows the user to select one of them.

The different applications are shown on the LCD and the user can use the buttons to scroll between the list and to select the desired application.

Returns:
a number representing the selected application. The relation between numbers and applications is done by the define directives (APP_STORE_PIN, etc.). If any error occurs, this method will return 0 (i.e. no application selected).

Definition at line 201 of file scd.c.

void SwitchLeds ( )

Simple application to switch some LEDs on and off.

This function is used just to switch leds on and off

Definition at line 769 of file scd.c.

void TestHardware ( )

Tests the hardware (LEDs, LCD and buttons)

This function performs a test of the hardware.

Definition at line 487 of file scd.c.

void TestSCDICC ( )

Tests the SCD-ICC communication.

void TestSCDTerminal ( )

Tests the SCD-Terminal communication.

Self Test methods

This function implements an infinite communication loop between the SCD and my terminal emulator, by continuously replying to the SELECT command for "1PAY.SYS.DDF01"

The main role of this function is to test the correct transfer of bytes between the terminal and the SCD

Definition at line 542 of file scd.c.


Variable Documentation

char* appStrings[]
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines