ncr/doc/RealPOS/7454/Technical_Manuals/7454_Re... - Alsys Data
ncr/doc/RealPOS/7454/Technical_Manuals/7454_Re... - Alsys Data
ncr/doc/RealPOS/7454/Technical_Manuals/7454_Re... - Alsys Data
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Technical</strong> Note<br />
NCR <strong>7454</strong> MSR Hardware Interfaces<br />
NCR Corporation<br />
<strong>Re</strong>tail Solutions Division<br />
Doc. Num: 497-0427389 <strong>Re</strong>vision: A<br />
Issue Date: August 2002<br />
DLC <strong>Re</strong>f:<br />
Doc. Type: <strong>Technical</strong> Note<br />
Prepared By:<br />
Diane Nowakowski<br />
Luis Garcia-Verona<br />
The electronic version of this <strong>doc</strong>ument is the revision-controlled copy.<br />
All printed copies are considered uncontrolled copies.<br />
NCR Corporation CONFIDENTIAL<br />
Copyright © 2002<br />
NCR Corporation<br />
Dayton, Ohio U. S. A.<br />
All Rights <strong>Re</strong>served<br />
Confidential, Unpublished<br />
Property of NCR Corporation
SCER ATL1120 Date August 2002 497-0427389<br />
<strong>Technical</strong> Note <strong>Re</strong>vision: A Page 2 of 16<br />
Please verify on-line that this is the latest revision<br />
Document Change Sheet 1 of 1<br />
<strong>Re</strong>vision Date Description of Change<br />
A August 2002 Initial <strong>Re</strong>lease
SCER ATL1120 Date August 2002 497-0427389<br />
<strong>Technical</strong> Note <strong>Re</strong>vision: A Page 3 of 16<br />
Please verify on-line that this is the latest revision<br />
Table of Contents<br />
1.0 OVERVIEW ........................................................................................................................................................... 4<br />
1.0 OVERVIEW ........................................................................................................................................................... 4<br />
2.0 MSR FIRMWARE/HARDWARE INTERFACES ............................................................................................. 4<br />
2.1 MEMORY AREA LAYOUT ................................................................................................................................ 4<br />
2.2 MSR TRACK DATA BUFFERS .......................................................................................................................... 5<br />
2.3 MSR TRACK DATA BYTE COUNTERS (0XF0, 0XF1, 0XF2)....................................................................... 6<br />
2.4 TRACK 2&3 F2F REGISTER (0XF3)................................................................................................................. 6<br />
2.5 ASIC OPERATIONAL MODE REGISTER (0XF4).......................................................................................... 6<br />
2.6 ASIC REV. REGISTER (0XF6) ........................................................................................................................... 7<br />
2.7 MSR COMMAND AND STATUS (C/S) REGISTER (0XF8) ........................................................................... 8<br />
2.7 MSR INTERRUPT RESET IRQ REGISTER (0XF9) ....................................................................................... 9<br />
2.8 ALTERNATE RAM CLEAR REGISTER (0XFA) ............................................................................................ 9<br />
3.0 FORMAT OF DATA ........................................................................................................................................... 10<br />
4.0 NCR <strong>7454</strong> MSR DRIVER (TAPS DRIVER) ..................................................................................................... 11
SCER ATL1120 Date August 2002 497-0427389<br />
<strong>Technical</strong> Note <strong>Re</strong>vision: A Page 4 of 16<br />
Please verify on-line that this is the latest revision<br />
1.0 Overview<br />
The MSR is a memory-mapped device. The address is specified in the BIOS. The addresses<br />
available are CC000, CE000, and D0000. By default IRQ 15 is used for the MSR. On early<br />
models of the <strong>7454</strong>/7401, this IRQ was not changeable.<br />
On the <strong>7454</strong>-22xx/35xx terminals the IRQ is also definable in the BIOS. The default is 15 but<br />
other settings allowed are 5, 6, 7, 10, 11, and 15.<br />
The MS-DOS MSR driver for the <strong>7454</strong>/7401 terminal, was written to have the user specify the<br />
MSR memory address (default is CC000). The IRQ was fixed at 15.<br />
NOTE: It is important that the BIOS setting and the address used by the software match.<br />
2.0 MSR Firmware/Hardware Interfaces<br />
The following interfaces were extracted from the firmware <strong>doc</strong>umentation for the 8051<br />
implementation of the Wedge/MSR hardware. This is the base for the ASIC implementation for<br />
the MSR hardware on the NCR 74XX terminal.<br />
2.1 Memory Area Layout<br />
The MSR software communicates via this memory-mapped area. A series of registers and data<br />
buffers are defined. The memory area is specified in the BIOS (CC000, CE000 or D0000). The<br />
layout of this area is:<br />
0x00<br />
Track 1 Buffer (length 96 bytes)<br />
Empty space<br />
0x80<br />
Track 2 Buffer (length 40 bytes)<br />
Empty space<br />
0xF0 Track 1 Byte counter<br />
0xF1 Track 2 Byte counter<br />
0xF2 Track 3 Byte Counter<br />
0xF3 Track 3 F2F / Track 2 F2F<br />
0xF4 ASIC Operation Mode<br />
Track 1 F2F /<br />
0xF5 Speaker Frequency
SCER ATL1120 Date August 2002 497-0427389<br />
<strong>Technical</strong> Note <strong>Re</strong>vision: A Page 5 of 16<br />
Please verify on-line that this is the latest revision<br />
0xF6<br />
0xF7<br />
0xF8<br />
0xF9<br />
0xFA<br />
0xFB<br />
-<br />
0xFF<br />
0x100<br />
ASIC <strong>Re</strong>v Level / Speaker Volume<br />
Not used<br />
Command/ Status <strong>Re</strong>gister<br />
<strong>Re</strong>set IRQ (Write Only)<br />
TrackRam Clear/ Spkr ON/ unused<br />
Not Used<br />
Track 3 data (length 104 bytes)<br />
2.2 MSR Track <strong>Data</strong> Buffers<br />
Each track has a separate block of RAM to serve as a buffer for the data read from the MSR<br />
device. These tracks are controlled independently. Track 1 is 96 bytes in length, track 2 is 40<br />
bytes long and track 3 is 104 bytes. The MSR firmware has read and write access to the ASIC<br />
RAM buffers unless the corresponding track has been enabled (Tk[123] bit in C/S register is set<br />
to 1) and the <strong>Data</strong> Present bit is zero, meaning a swipe has not yet been completed. Each<br />
buffer is independently enabled/disabled for access.<br />
Prior to issuing each track read command to the internal MSR support hardware of the ASIC<br />
device, the RAM buffers must be cleared to ensure the integrity of the data being stored in the<br />
buffers during the next card swipe.<br />
When a card swipe is in progress, the Track 1, Track 2, and Track 3 RAM Buffers are filled with<br />
data by the internal MSR support hardware, starting at the lowest RAM buffer address (00h for<br />
track 1, 80h for track 2, 100h for track 3). If more data is received from a track than there is<br />
room in the buffer, a buffer overflow condition will occur. The appropriate overflow bit in the<br />
corresponding <strong>Data</strong> Byte Counter is used to indicate whether or not a buffer overflow condition<br />
has occurred. Additional incoming data on this track will be ignored by the MSR interface<br />
hardware.<br />
When an MSR card is read, the bytes are written into the buffer, the count is written to the Byte<br />
Counter offset. The fill value bit (see ASIC Operational Mode <strong>Re</strong>gister) indicates completion of<br />
the read.
SCER ATL1120 Date August 2002 497-0427389<br />
<strong>Technical</strong> Note <strong>Re</strong>vision: A Page 6 of 16<br />
Please verify on-line that this is the latest revision<br />
2.3 MSR Track <strong>Data</strong> Byte Counters (0xF0, 0xF1, 0xF2)<br />
<strong>Re</strong>ad<br />
Overflow<br />
Unused<br />
in counter<br />
0xF1<br />
MSR Track <strong>Re</strong>ad <strong>Data</strong> Byte Counter (b0 - b6)<br />
b7<br />
b6<br />
MSR Track <strong>Data</strong> Byte Counters<br />
The MSR Track 1, Track 2, and Track 3 <strong>Data</strong> Byte Counters are used by the firmware to locate<br />
the last byte of data read from the MSR into the Track 1 , Track 2, and Track 3 RAM Buffers and<br />
to ascertain the number of bytes read on each track of the MSR device. The <strong>Data</strong> Byte<br />
Counters always contain the offset of the next location to be written by the reader. Thus, a value<br />
of zero indicates no data is present; a value of 01 indicates that 1 byte is present, and so forth.<br />
The high bit of each of the <strong>Data</strong> Byte Counters is an overflow flag. If more data bytes are read<br />
from the track than can fit in the buffer, the overflow flag bit is set, and the <strong>Data</strong> Byte Counter is<br />
set to its maximum value.<br />
The Track 2 <strong>Data</strong> Byte Counter is limited to 6 bits so for the counter at 0xF1 always has bit 6 set<br />
to zero.<br />
b0<br />
2.4 Track 2&3 F2F <strong>Re</strong>gister (0xF3)<br />
Track 3 Leading zeroes to ignore Unused Track 2 Leading zeroes to ignore Unused<br />
b7 b6 b5 b4 b3 b2 b1 b0<br />
Track 2&3 F2F <strong>Re</strong>gister<br />
The Track 2 and 3 F2F register is a tuning tool which sets the number of leading zeros to be<br />
ignored before data is accepted for an individual track. The default value is 62h. The track 1<br />
value is set in the ASIC Operational Mode <strong>Re</strong>gister, below.<br />
The default is used for the MS-DOS driver.<br />
2.5 ASIC Operational Mode <strong>Re</strong>gister (0xF4)<br />
Enable<br />
<strong>Re</strong>set Ram<br />
@<strong>Re</strong>g FA<br />
Enable<br />
<strong>Re</strong>set Ram<br />
@<strong>Re</strong>g F8<br />
Fill<br />
Value<br />
Track 1 Leading zeroes to ignore Auto-<br />
<strong>Re</strong>cover<br />
Unused<br />
b7 b6 b5 B4 b3 B2 b1 b0<br />
ASIC Operational Mode
SCER ATL1120 Date August 2002 497-0427389<br />
<strong>Technical</strong> Note <strong>Re</strong>vision: A Page 7 of 16<br />
Please verify on-line that this is the latest revision<br />
The ASIC Operational Mode register controls certain aspects of the ASIC MSR <strong>Re</strong>ad operations.<br />
Bits 5 to 7 contain the number of leading zero bits to ignore in the MSR bit stream. The value<br />
can range from 0 to 7. The hardware default is 3. This value provides a tuning parameter for<br />
more reliable reads, and is factory set by the firmware.<br />
The Auto-<strong>Re</strong>cover bit, b4, when set to 1, instructs the ASIC to re-enable itself if it detects<br />
CLOCK but never receives valid data. This could occur from a swipe, which begins with a cardinsertion,<br />
a pause, then a swipe. The clock appears during the insertion, but no data appears. If<br />
the Auto-<strong>Re</strong>cover bit is set to a one, then the ASIC will automatically re-enable itself during the<br />
pause. Otherwise, the ASIC will report a swipe complete with no data present, and the firmware<br />
must re-enable the ASIC.<br />
The Enable <strong>Re</strong>set Ram at <strong>Re</strong>gister FA bit, when set to 1, enables the circuitry which clears RAM<br />
when a zero is written to one (or more) of the Track Select bits in <strong>Re</strong>gister FA. When this bit is<br />
set to zero, Ram cannot be cleared through register FA.<br />
The Enable <strong>Re</strong>set Ram at <strong>Re</strong>gister F8 bit, when set to 1, enables the circuitry which clears RAM<br />
when a zero is written to one (or more) of the Track Select bits in <strong>Re</strong>gister F8. When this bit is<br />
set to zero, Ram cannot be cleared through register F8.<br />
The Fill Value bit contains the value to be used to fill any unused bits in the last byte of data read<br />
from each track. At the end of a card swipe, the last clocked bit of data may not exactly fill a<br />
byte. The last byte will be padded with the Fill Value contained in this <strong>Re</strong>gister. The bits read<br />
from the tracks are sequenced into memory in low-to-high bit order within bytes, so the fill bits<br />
will appear in the highest bits of the last byte.<br />
2.6 ASIC <strong>Re</strong>v. <strong>Re</strong>gister (0xF6)<br />
ASIC <strong>Re</strong>vision Level<br />
<strong>Re</strong>served<br />
b7<br />
b3<br />
b0<br />
ASIC <strong>Re</strong>vision <strong>Re</strong>gister<br />
The revision level of the ASIC part is available to be read on bits b4 thru b7 of this register.
SCER ATL1120 Date August 2002 497-0427389<br />
<strong>Technical</strong> Note <strong>Re</strong>vision: A Page 8 of 16<br />
Please verify on-line that this is the latest revision<br />
2.7 MSR Command and Status (C/S) <strong>Re</strong>gister (0xF8)<br />
The MSR support hardware of the ASIC device is controlled through the ASIC Operational Mode<br />
<strong>Re</strong>gister and the MSR C/S <strong>Re</strong>gister, mapped at data memory addresses 0xF4 and 0xF8,<br />
respectively. Through the C/S <strong>Re</strong>gister, the ASIC is able to monitor the status of the MSR<br />
hardware.<br />
The upper four bits of the MSR C/S <strong>Re</strong>gister are Command bits, used for sending a track read<br />
command to the MSR hardware, or masking an interrupt upon completion of a card swipe. The<br />
lower four bits are Status bits, used to monitor the presence or absence of the MSR hardware,<br />
the status of a requested track read command, and the status of the MSR RAM buffers.<br />
Bit Definitions of MSR C/S <strong>Re</strong>gister (R/W)<br />
b0<br />
Not Used<br />
b1<br />
b2<br />
b3<br />
b4<br />
b5<br />
b6<br />
b7<br />
Busy/Idle<br />
<strong>Re</strong>ad/<strong>Data</strong> Present<br />
Not Used<br />
Interrupt Mask<br />
Track 1 control<br />
Track 2 control<br />
Track 3 control<br />
0-Idle<br />
1-Stripe Clock present; <strong>Re</strong>ad In Progress<br />
0-<strong>Re</strong>ady<br />
1-<strong>Re</strong>ad Complete; <strong>Data</strong> Present<br />
0-Disable Interrupt on read complete<br />
1-Enable Interrupt on read complete<br />
0-<strong>Re</strong>set track registers<br />
1-Enable Track <strong>Re</strong>ad<br />
0-<strong>Re</strong>set track registers<br />
1-Enable Track <strong>Re</strong>ad<br />
0-<strong>Re</strong>set track registers<br />
1-Enable Track <strong>Re</strong>ad<br />
b5, b6, b7 set to 000 = <strong>Re</strong>set and Disable MSR<br />
Control/Status <strong>Re</strong>gister Contents<br />
Bits 5, 6 and 7 are used to control the data input to the device from the MSR hardware. The<br />
value of these bits is set by the host. These bits are cleared to 0 by device reset.<br />
Setting these bits to 0, resets the MSR Track data Byte Counters and the <strong>Re</strong>ad Complete<br />
indication (bit 2) in this register. [The three bits are independent. Setting any one bit resets the<br />
corresponding registers.] Furthermore, if the RAM_RESET bit of the ASIC Mode register is set,<br />
then setting these bits to zero also clears ASIC data ram.<br />
Bit 4 is used to prevent a "<strong>Re</strong>ad Complete" Interrupt from being issued. If this bit is clear, no<br />
interrupt will be issued at the conclusion of an MSR device read; in this case, the MSR C/S<br />
<strong>Re</strong>gister (bit 2) must be polled to determine when a card swipe has been completed. Bit 4 is<br />
cleared to 0 by device reset.
SCER ATL1120 Date August 2002 497-0427389<br />
<strong>Technical</strong> Note <strong>Re</strong>vision: A Page 9 of 16<br />
Please verify on-line that this is the latest revision<br />
Bits 1 and 2 are used to reflect the status of the card swipe or track read once it has been<br />
requested. Bit 1 is zero until the card clock is detected. Once the card clock is detected, this bit<br />
is set to 1. When the clock disappears, this bit becomes zero, and bit 2 is set on. The transition<br />
from zero to one of bit 2 causes an interrupt to be issued to indicate that a track read or card<br />
swipe has been completed (unless bit 4 masks this interrupt). As long as bit 2 remains set, data<br />
from subsequent card swipes will be ignored. Bit 2 can be reset by clearing bits 5, 6, and 7 of<br />
this register. (Note: Bit 2 must be cleared before another track read command can be issued.)<br />
Bits 1 and 2 are cleared to 0 by clearing the track control bits 5 to 7 of this register.<br />
2.7 MSR Interrupt <strong>Re</strong>set IRQ <strong>Re</strong>gister (0xF9)<br />
There is one interrupt that can be generated by the internal MSR support within the ASIC device.<br />
This is the <strong>Re</strong>ad Complete Interrupt, which is issued at the completion of a card swipe. This<br />
interrupt is cleared when the ASIC writes the MSR <strong>Re</strong>set-IRQ <strong>Re</strong>gister at address 0xF9 or by<br />
device reset. The <strong>Re</strong>ad Complete Interrupt can be masked by writing a 1 to bit 4 of the MSR<br />
C/S <strong>Re</strong>gister.<br />
Note: The <strong>Re</strong>ad Complete Interrupt is cleared by reading the <strong>Re</strong>set-IRQ <strong>Re</strong>gister; however,<br />
address 0xF9. However bit 2 of the MSR C/S <strong>Re</strong>gister, the <strong>Re</strong>ad Complete Flag, will not be<br />
cleared until bits 5, 6 and 7 of the MSR C/S <strong>Re</strong>gister are cleared by the ASIC. As long as bit 2<br />
of the MSR C/S <strong>Re</strong>gister remains set, data from subsequent card swipes will be ignored.<br />
NOTE: The MS-DOS driver does not use this register.<br />
2.8 Alternate RAM Clear <strong>Re</strong>gister (0xFA)<br />
Track 3<br />
Clear<br />
Track 2<br />
Clear<br />
Track 1<br />
Clear <strong>Re</strong>served Not Used<br />
b7 b6 b5 b4 b1 b0<br />
Alternate RAM Clear <strong>Re</strong>gister<br />
Bits 7, 6, and 5 of this <strong>Re</strong>gister provide an alternate method to clear ASIC RAM. If the ASIC<br />
Operational Mode <strong>Re</strong>gister bit 2, Alternate RAM Clear Enable, is set to 1, then a write of zeros to<br />
these bits will result in ASIC RAM being cleared. If the Alternate RAM Clear Enable bit is reset,<br />
then writing to these bits has no effect.
SCER ATL1120 Date August 2002 497-0427389<br />
<strong>Technical</strong> Note <strong>Re</strong>vision: A Page 10 of 16<br />
Please verify on-line that this is the latest revision<br />
3.0 Format of <strong>Data</strong><br />
The data returned from the MSR hardware is in raw format. It needs to be unpacked and<br />
formatted for use. The MS-DOS driver used by NCR provides unpack and formatting routines.<br />
The source of these routines in provided to assist in unpacking and formatting this data. The<br />
source code is also provided for this driver.<br />
ISO TRACK 1<br />
Start Sentinel (45h) 76 chars -7 bit with parity End Sentinel (1Fh) LRC<br />
JIS TRACK 1<br />
Start Sentinel (FFh)<br />
69 chars- 8 bit with parity<br />
End Sentinel (FFh)<br />
LRC<br />
ISO & JIS TRACK 2<br />
Start Sentinel (0Bh)<br />
37 chars-5 bit with parity<br />
End Sentinel (1Fh)<br />
LRC<br />
ISO & JIS TRACK 3<br />
Start Sentinel (0Bh) 104 chars-5 bit with parity<br />
End Sentinel (1Fh)<br />
LRC
SCER ATL1120 Date August 2002 497-0427389<br />
<strong>Technical</strong> Note <strong>Re</strong>vision: A Page 11 of 16<br />
Please verify on-line that this is the latest revision<br />
4.0 NCR <strong>7454</strong> MSR DRIVER (TAPS driver)<br />
The DOS driver for the <strong>7454</strong> MSR is provided as an example.<br />
For this driver, the MSR address (settable in the BIOS) must be specified. The IRQ is defaulted<br />
to 15. Later versions of the hardware allowed the MSR irq to be specified in the BIOS. The<br />
MSR configuration is also specified at boot time (command line parameter), values are ISO or<br />
JIS.<br />
The following modules are present in the DOS driver for the <strong>7454</strong> MSR in alphabetical order:<br />
Infm.c<br />
Infm_dos.c<br />
Infmappl.h<br />
Infmconst.hi<br />
Infdata.c<br />
Infmdos.c<br />
Infmextr.hi<br />
Infmfunc.hi<br />
Infminit.c<br />
Infmserv.c<br />
Infmstruc.h<br />
Infmtaps.c<br />
DOS interface functions in C<br />
DOS interfaces in asm<br />
Include file definitions<br />
Constants<br />
Global data<br />
C language of driver interfaces<br />
External declarations<br />
Function prototypes<br />
DOS initialization<br />
Service functions<br />
Structures<br />
Taps interfaces<br />
BOLD indicates modules useful for your development.<br />
The <strong>7454</strong> MSR initialization via the DOS driver is….<br />
Infminit.c (DOS initialization)<br />
The following steps occur:<br />
1) The command line is parsed to determine the MSR address:<br />
Valid addresses are: CC000, CE000, D0000<br />
(saved at msr_address)<br />
2) Check to determine if MSR is located at specified address.<br />
<strong>Re</strong>ads at msr_address + F4<br />
Set auto recover mode<br />
(0x10)<br />
Set reset by alternate reg mode (0x04)<br />
<strong>Re</strong>set reset by C&S reg<br />
(0x02)<br />
<strong>Re</strong>set test fill value (0x01)<br />
Save this value at msr_address + F4
SCER ATL1120 Date August 2002 497-0427389<br />
<strong>Technical</strong> Note <strong>Re</strong>vision: A Page 12 of 16<br />
Please verify on-line that this is the latest revision<br />
3) Clear Track buffer<br />
<strong>Re</strong>ad IO_ALTERNATE_RAM_CLEAR register<br />
Msr_address + FA<br />
Clear track 3 buffer<br />
Clear track 2 buffer<br />
Clear track 1 buffer<br />
(0x80)<br />
(0x40)<br />
(0x20)<br />
4) Check for Track 1, Track2, and Track 3 data to be 00.<br />
Track 1 data located at msr_address + 0x00 length of 96 bytes<br />
Track 2 data located at msr_address + 0x80 length of 40 bytes<br />
Track 3 data located at msr_address + 0x100 length of 104 bytes<br />
5) Verify msr_config is ISO or JIS. In the DOS driver this is defaulted or set via command line<br />
parameter.<br />
Infmserv.c Extended Driver Initialization<br />
During extended initialization, the following occurs:<br />
1) Save current IRQ 15 address, hook IRQ 15 (infm_interrupt_routine)<br />
Initialize various MSR registers…<br />
2) Set up ASIC Operational Mode register<br />
AT msr_address + F4 (IO_ASIC_OPERATIONAL_MODE)<br />
Set TEST_AUTO_RECOVER bit<br />
(0x10)<br />
Set TEST_RESET_BY_ALTERNATIVE bit (0x04)<br />
<strong>Re</strong>set TEST_RESET_BY_C_S_REGISTER bit (0x02)<br />
<strong>Re</strong>set TEST_FILL_VALUE bit<br />
(0x01)<br />
Save new value at msr_address + 0xF4<br />
3) <strong>Re</strong>set PIC and enable the IRQ<br />
Output to port 0x20 -> 0x20<br />
Output to port 0xA0 -> 0x20<br />
<strong>Re</strong>ad port (0xA1)<br />
Output to port 0xA1 -> value read & ~(1
SCER ATL1120 Date August 2002 497-0427389<br />
<strong>Technical</strong> Note <strong>Re</strong>vision: A Page 13 of 16<br />
Please verify on-line that this is the latest revision<br />
Enable interrupt (or with 0x10)<br />
Save new value at msr_address +0xF8<br />
5) Clear track buffer<br />
<strong>Re</strong>ad msr_address + 0xFA (IO_ALTERNATE_RAM_CLEAR)<br />
Clear track 3 or with 0x80<br />
Clear track 2 or with 0x40<br />
Clear track 1 or with 0x20<br />
Save new value at msr_address + 0xFA<br />
6) <strong>Re</strong>set interrupt once (don’t know why this is done)<br />
<strong>Re</strong>ad msr_address + 0xF8<br />
Disable track 3 read (and with 0x7f)<br />
Disable track 2 read (and with 0xbf)<br />
Disable track 1 read (and with 0xdf)<br />
Enable interrupt (or with 0x10)<br />
Save new value at msr_address + 0xF8<br />
INFM_INTERRUPT_ROUTINE Hardware Interrupt handling<br />
The DOS driver interrupt routines places the data in a structure with the following format…<br />
_CARD_DATA {<br />
unsigned long ulTrack1Bytes;<br />
unsigned char auchTrack1<strong>Data</strong>[LENGTH_TRACK_1_DATA];<br />
unsigned long ulTrack2Bytes;<br />
unsigned char auchTrack2<strong>Data</strong>[LENGTH_TRACK_2_DATA];<br />
unsigned long ulTrack3Bytes;<br />
unsigned char auchTrack3<strong>Data</strong>[LENGTH_TRACK_3_DATA];<br />
}<br />
// len track 1 data<br />
// track 1 data<br />
// len track 2data<br />
// track 2 data<br />
// len track 3 data<br />
// track 3 data
SCER ATL1120 Date August 2002 497-0427389<br />
<strong>Technical</strong> Note <strong>Re</strong>vision: A Page 14 of 16<br />
Please verify on-line that this is the latest revision<br />
When the interrupt is received the following steps occur:<br />
1) <strong>Re</strong>ad Status and command <strong>Re</strong>gister<br />
<strong>Re</strong>ad msr_address + 0xF8<br />
Test TEST_DATA_PRESENT bit (0x04)<br />
If present,<br />
Clear the TEST_INTERRUPT_MASK bit (0x10)<br />
Disable track 3 read (set TEST_TRACK_3_ENABLE bit) 0x80<br />
Disable track 2 read (set TEST_TRACK_2_ENABLE bit) 0x40<br />
Disable track 1 read (set TEST_TRACK_1_ENABLE bit) 0x20<br />
Write new value to msr_address + 0xF8<br />
2) <strong>Re</strong>ad msr_address + 0xF0 (IO_TRACK_1_DATA_COUNTER) to get number of track 1<br />
bytes read<br />
Check for overflow bit set , set ulTrack1Bytes to # of bytes or 0 (if overflow)<br />
3) <strong>Re</strong>ad msr_address + 0xF1 (IO_TRACK_2_DATA_COUNTER) to get number of track 2<br />
bytes read<br />
Check for overflow bit set , set ulTrack2Bytes to # of bytes or 0 (if overflow)<br />
4) <strong>Re</strong>ad msr_address + 0xF2 (IO_TRACK_3_DATA_COUNTER) to get number of track 3<br />
bytes read<br />
Check for overflow bit set , set ulTrack3Bytes to # of bytes or 0 (if overflow)<br />
5) Copy Track 1 data to above data structure..<br />
<strong>Re</strong>ad msr_address + 0x00 (OFFSET_TRACK_1_BUFFER)<br />
Copy bytes from memory-mapped I/O area to driver buffer<br />
6) Copy Track 2 data to above data structure..<br />
<strong>Re</strong>ad msr_address + 0x80 (OFFSET_TRACK_2_BUFFER)<br />
Copy bytes from memory-mapped I/O area to driver buffer<br />
7) Copy Track 3 data to above data structure..<br />
<strong>Re</strong>ad msr_address + 0x100 (OFFSET_TRACK_3_BUFFER)<br />
Copy bytes from memory-mapped I/O area to driver buffer<br />
Notify driver that MSR data is ready.<br />
8) <strong>Re</strong>set PIC and enable the proper IRQ<br />
Out 0x20 to port 0x20<br />
Out 0x20 to port 0xA0<br />
<strong>Re</strong>ad port 0xA1<br />
Out (value read & ~(1
SCER ATL1120 Date August 2002 497-0427389<br />
<strong>Technical</strong> Note <strong>Re</strong>vision: A Page 15 of 16<br />
Please verify on-line that this is the latest revision<br />
MSR <strong>Data</strong> Decode routines<br />
The MSR data decode routines unpack and format the MSR data. These routines are<br />
included in the msr driver. The source code for this driver is also included. The areas<br />
required are specifically in the MSRUPACK.C module. This module contains several<br />
subroutines used to decode the ‘raw msr data’ to the packed and formatted data the<br />
application would typically see. The remainder of the files are included for include<br />
references etc.<br />
When this driver was written, the variables used were global variables –<br />
msr_raw_data_buffer and msr_unpacked_buffer. These routines have been used by<br />
others as a base for decoding the msr data.<br />
The msr_raw_data_buffer will have the format:<br />
_CARD_DATA {<br />
unsigned long ulTrack1Bytes;<br />
unsigned char auchTrack1<strong>Data</strong>[LENGTH_TRACK_1_DATA];<br />
unsigned long ulTrack2Bytes;<br />
unsigned char auchTrack2<strong>Data</strong>[LENGTH_TRACK_2_DATA];<br />
unsigned long ulTrack3Bytes;<br />
unsigned char auchTrack3<strong>Data</strong>[LENGTH_TRACK_3_DATA];<br />
}<br />
// len track 1 data<br />
// track 1 data<br />
// len track 2data<br />
// track 2 data<br />
// len track 3 data<br />
// track 3 data<br />
<strong>Re</strong>turned <strong>Data</strong> Formats for Track <strong>Re</strong>ads (msr_unpacked_buffer)<br />
The formats for the track read data returned to applications are dependent upon the type of card<br />
being read and the type of reader attached to the system. As mentioned earlier, track 1 on a JIS<br />
card is the track on the front of the card. Track 2 on an ISO card and track 2 on a JIS card are<br />
physically in identical locations.<br />
Delimiters will be used when returning formatted data to separate the track data as well as<br />
indicate good or bad reads. The default delimiters may be modified if the track is re-configured<br />
(MSR_CONFIG_TRACK). The default tracks are as follows:<br />
Good<br />
BAD<br />
Track1 (ISO)- 0x61 0xF1<br />
Track2 (ISO)- 0x62 0xF2<br />
Track3 (ISO)- 0x63 0xF3<br />
Track1 (JIS)- 0xE1 0xF1<br />
Track2 (JIS)- 0xE2 0xF2<br />
Track3 (JIS)- 0xE3 0xF3<br />
The End of <strong>Data</strong> delimiter will always be a 0x6F for ISO cards and 0xEF for JIS cards.
SCER ATL1120 Date August 2002 497-0427389<br />
<strong>Technical</strong> Note <strong>Re</strong>vision: A Page 16 of 16<br />
Please verify on-line that this is the latest revision<br />
Track <strong>Re</strong>ad Error Codes<br />
On a track read, if the track delimiter indicates a bad read, the next byte will indicate the error<br />
cause as follows:<br />
TRK_START_SENT - Missing start sentinel character<br />
TRK_PARITY_ERR - Track character parity error<br />
TRK_END_SENT - Missing end sentinel character<br />
TRK_LRC_ERR - Longitudinal redundancy check error<br />
TRK_NO_DATA - No data present on track<br />
The following are examples of returned MSR data:<br />
TRACK 1 READ<br />
ISO Card Cases 0x61 track_data 0x6F ISO track 1 good read<br />
0xF1 exep_code 0x6F ISO card exception, or JIS II track<br />
where start sentinel not found<br />
JIS Card Cases 0xE1 track_data 0xEF JIS II track good read<br />
0xF1 excep_code 0xEF JIS card exception, at least the JIS II<br />
track start sentinel was read<br />
TRACK 2 READ<br />
Either Card 0x62 track_data 0x6F Track good read<br />
0xF2 excep_code 0x6F Track exception<br />
TRACK 1 & 2 READ<br />
ISO Card Cases 0x61 track1 0x62 track2 0x6F Good read<br />
0xF1 excep1 0x62 track2 0x6F<br />
Track 1 exception. Track 2 good read. Also<br />
returned for JIS card where JIS II track start<br />
sentinel not read.<br />
0x61 track1 0xF2 excep2 0x6F Track 1 good read. Track 2<br />
exception<br />
0xF1 excep1 0xF2 excep2 0x6F Track 1 and 2 exceptions. Also returned<br />
for JIS card where JIS II track start<br />
sentinel not read.<br />
JIS Card Cases 0xE1 track1 0xE2 track2 0xEF Good read<br />
0xF1 excep1 0xE2 track2 0xEF Track1 exception. Track 2 good read. At<br />
least the JIS II track start sentinel was<br />
read.<br />
0xE1 track1 0xF2 excep2 0xEF Track 1 good read. Track 2 exception<br />
0xF1 excep1 0xF2 excep2<br />
0xEF<br />
Track 1 and 2 exceptions. At least the<br />
JIS II track start sentinel was read.