/************************GET_UDDS_BUFFERS
***********************************
This module will transfer eight 320 byte DS310 frames into memory
provided
the DIO-32F is
configured as follows:
1)
All ports mode 0
(NON LATCHED).
2)
PORT A for read. (samples DS310 8 bit data).
3)
PORT C for write. (used to control DS310 transport).
4)
PORT D for read. (used to sense DS310 transport status).
A DB25 male to 50-pin female edge connector cable with the following
pin outs
is attached:
DS310
TO DIO-32F INTERFACE CABLE
DS310 DIO-32F
SIGNAL PIN # SIGNAL PIN #
READ 17 OUT1 1
SR 02 OUT2 22
BUSY 03 IN1 29
DR 01 ACK1 27
D1 04 DIOA0 37
D2 05 DIOA1 39
D3 06 DIOA2 38
D4 07 DIOA3 40
D5 08 DIOA4 35
D6 09 DIOA5 42
D7 10 DIOA6 36
D8 14 DIOA7 41
ON
LINE 18 DIOD0 04
DATA
VALID 16 DIOD1 01
STOP
CMD 22 DIOC0 14
START
CMD 23 DIOC1 12
REWIND
CMD 21 DIOC2 13
The transfer sequence follows:
1) Start a buffer
a) pulse READ
2) Perform the following 320 times to empty DS310 buffer:
a) pulse SR
b) wait for BUSY to drop
b1) if busy doesn't drop within approx 5 usecs,
then check to see if its
because UDDS DATA VALID
is clear indicating EOD,
else an error of some kind has occurred.
c) if BUSY dropped then pulse DR
d) shift 1 word into "buffer"
e) repeat from step 2a 320 times.
3) repeat from step 1 eight times.
Note: This module does not
check to see if the UDDS panel is online
before initiating the handshake. While offline, the UDDS panel
is in "MAINTENANCE MODE" and will
provide data while disregarding
any handshake sequence. Online checking is performed in the main
routine and was omitted here so that this
module could be used to
develop diagnostic procedures.
This module including handshake timing, sequence and software
implementation
was developed
by J. Martin, ATK.
*****************************************************************************/
GET_UDDS_BUFFERS() {
int buf_pointer = 40; /* reset buffer pointer */
/* Assemble eight 320 byte UDDS frames into mbufer */
for (frame=1; frame<=8; ++frame)
{
/* Start a buffer (pulse READ) */
outpw(cfg1, 0x0001);
outpw(cfg1, 0x0000);
for (counter=1; counter<=320; ++counter) { /* perform SR-BUSY-DR sequence */
/* 320 times */
timeout = 250000; /* typically on a 386dx/33, busy
will drop after sr before
timeout decrements 10 times.
has a large value to
allow udds buffer to empty
just after EOD */
while ((DIO32_STATUS() & 0x0800)) { /* whle BUSY is set... */
outpw(cfg2, 0x0001); /* pulse SR until BUSY is clear */
outpw(cfg2, 0x0000);
timeout--; /* should see BUSY drop < 5 usecs */
if (timeout <=0
&& !DATA_VALID()) /* if not, is UDDS out of data? */
{ printf("\x1B[%d;%df",13,20);
printf(" END
OF DATA detected.
");
return(0); } /* END OF DATA detected*/
else if
(timeout <=0) /* UDDS has data but still no BUSY */
/* continue pulsing SR forever or */
/* until BUSY goes low. (program */
/* can hang here, power down UDDS */
/* panel to force busy low
*/
{ timeout = 250000;
printf("\x1B[%d;%df",13,20);
printf("UDDS not answering request for data.%s\r",TAB);}
}
/* BUSY went low */
outpw(cfg1,
0x0002); /* pulse DR */
outpw(cfg1,
0x0000);
mbufer[buf_pointer] = inp(porta); /* shift 1 byte into mbufer */
++buf_pointer; /* increment buffer pointer */
} /* end 320 byte frame */
} /* end 8 frame record */
return(1); /* END OF DATA not detected */
}/*********************** END OF GET_UDDS_BUFFER
***************************/