|
|
1.1 root 1:
2: #include "cy.h"
3: #include "cyconf.h"
4: #define NBPG 1024
5: asm(".set NBPG,1024");
6:
7: extern long iob0, iob2, iob4, cmd_done;
8: extern struct tpb tpb;
9: extern struct ccb ccblk;
10: struct tpblk *tblk;
11:
12: long tm_err;
13:
14: tm_ex()
15: {
16: register long tm_bsiz;
17:
18: writes("\n\t** Tape test **\n");
19: tm_err = 0;
20: if ( !(tm_bsiz = tape_op(CONFIG,0,0))) return;
21: writes("Tape master internal buffer size ");
22: writed(tm_bsiz); writes(" bytes\n");
23:
24: tm_rew(); /* rewind tape */
25: tm_ex1(&iob0);
26:
27: tblk = (struct tpblk *)&tpb;
28: tm_ex2(&iob0, &iob2, &iob4);
29:
30: if (!tm_err) writes("\nTape passed..\n");
31: else writes("\nTape failed..\n");
32:
33: }
34:
35:
36: /* (1) write 1 block of data with pattern '1' : 1024 bytes
37: (2) repeat 5 times for '2' '3' '4' '5'
38: (3) rewind tape
39: (4) read 1 block of data : 1024 bytes
40: (5) check against pattern
41: (6) repeat step (4), (5) 5 times
42: */
43: tm_ex1(Sysbuf)
44: char *Sysbuf;
45: { register long ix, iy, rtn_cnt;
46: char pat;
47:
48: /* Write 5 block of data */
49: pat = '1';
50: writec('\n');
51: for(ix=0; ix<5; ix++, pat++) {
52: for (iy=0;iy<TM_BSIZE;iy++) Sysbuf[iy] = pat; /* Set pattern */
53: if ((rtn_cnt=tape_op(WRIT_TA,Sysbuf,TM_BSIZE)) == -1)
54: { tm_err = 1;
55: ex_err("TM1 exercise write error\n"); }
56:
57: if (rtn_cnt != TM_BSIZE) { tm_err = 1; tm_cerr(rtn_cnt); }
58: }
59:
60: tm_rew(); /* rewind tape */
61:
62: /* Read and check 5 block of data */
63: pat = '1';
64: for(ix=0; ix<5; ix++) {
65: for (iy=0;iy<TM_BSIZE;iy++) Sysbuf[iy] = 0; /* clear pattern */
66: if ((rtn_cnt=tape_op(READ_TA,Sysbuf,TM_BSIZE)) == -1)
67: { tm_err = 1;
68: writes("TM1 exercise read error\n"); }
69: else {
70: if (rtn_cnt != TM_BSIZE) { tm_err=1; tm_cerr(rtn_cnt);}
71: for (iy=0;iy<TM_BSIZE;iy++) {
72: if (Sysbuf[iy] != pat) {
73: writes("\nBlock "); writec(ix+'0');
74: writes(" compare error, expected ");
75: writec(pat); writes(" , actual ");
76: writec(Sysbuf[iy]);
77: tm_err = 1;
78: break; }
79: }
80: }
81: pat++;
82: }
83: }
84:
85:
86:
87: /* This test tries by create memory contention between Tahoe
88: and the tape master by the following actions :
89: (1) Sent a command to Tape master to move 2 blocks
90: of data in Tahoe memory to buffer X, X+1
91: (2) use movblk instruction to move the same 2 blocks
92: to buffer Y, Y+1 and keep doing this until cmd_done
93: (indicate tape master done with command)
94: (3) compare buffer X, X+1 with Y, Y+1.
95: */
96: tm_ex2(srcbuf, tdest, sdest)
97: char *srcbuf, *tdest, *sdest;
98: { register long ix, *lptr;
99:
100: tm_err = 0;
101: lptr = (long *)srcbuf; /* Write pattern to source buffers */
102: for (ix=0; ix<((NBPG*2)/4); ix++) *lptr++ = ix;
103: lptr = (long *)tdest;
104: for (ix=0; ix<((NBPG*4)/4); ix++) *lptr++ = 0; /* Clear destination */
105:
106: tblk_mv(srcbuf,tdest,NBPG*2); /* Set up Tpb to move 2 blocks */
107: memcon(srcbuf,sdest);
108:
109: for (ix=0; ix<(NBPG*2); ix++) {
110: if (srcbuf[ix] != tdest[ix]) {
111: writes("\nBlockmv tape error, expected ");
112: writeh(srcbuf[ix]&0xff);
113: writes(" , actual "); writeh(tdest[ix]&0xff);
114: writes(" , address "); writeh(&tdest[ix]);
115: tm_err = 1;
116: }
117: if (srcbuf[ix] != sdest[ix]) {
118: writes("\nBlockmv Tahoe error, expected ");
119: writeh(srcbuf[ix]&0xff);
120: writes(" , actual "); writeh(sdest[ix]&0xff);
121: writes(" , address "); writeh(&sdest[ix]);
122: tm_err = 1;
123: }
124: }
125: }
126:
127:
128:
129: /* Routine to set up Tape parameter block
130: for move block operation.
131: */
132: tblk_mv(src,dest,bcnt)
133: char *src, *dest;
134: long bcnt;
135: { char *cptr;
136:
137: tblk->cmd = BLOCK_M; /* Command */
138: tblk->control[1] = 0;
139: tblk->control[0] = 0x2a; /* src=dst=16 bits,completion interrupt */
140: cptr = (char *)&tblk->count; /* Set byte count */
141: *cptr++ = (char)(bcnt & 0xff);
142: *cptr = (char)((bcnt & 0xff00)>>8);
143:
144: /* Set source and destination buffer address */
145: set_pointer(src,(char *)tblk->source);
146: set_pointer(dest,(char *)tblk->dest);
147:
148: tblk->mask = 0; /* Clear mask/stat */
149: tblk->intr[0] = tblk->intr[1] = 0;
150: tblk->table[0] = tblk->table[1] = 0;
151: tblk->throttle = 0;
152: }
153:
154: ex_err(msg)
155: char *msg;
156: {
157: writes(msg);
158: }
159:
160: tm_cerr(cnt)
161: long cnt;
162: {
163: writes("Cy return count error "); writeh(cnt); writec('\n');
164: }
165:
166:
167: /* Routine to create memory contention
168: return -1 if error
169: */
170: memcon(src,sdest)
171: char *src, *sdest;
172: { register long *r12, cntr, rtn_cnt, ix;
173:
174: while (g_open()==0) /* Is gate open ? */
175: { tm_init();
176: error("sent_tm gate closed\n");
177: return(-1);
178: }
179: cmd_done = 0;
180: ccblk.gate = (char)GATE_CLOSED; /* Close gate */
181: cy_attn(); /* Execute command */
182: cntr = RETRY;
183: while (!cmd_done) { /* Wait for tape to complete */
184: asm("movl 4(fp),r0"); /* Source */
185: asm("movl 8(fp),r1"); /* Destination */
186: asm("movl $NBPG*2,r2"); /* Count */
187: asm("movblk"); /* Move it */
188: }
189: if (cmd_done == 2) return(-1); /* Command has error */
190: return(0);
191: }
192:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.