|
|
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, iob5, cmd_done; ! 8: extern struct tpb tpb; ! 9: extern struct ccb ccblk; ! 10: struct tpblk *tblk; ! 11: ! 12: long tm_ex1er,tm_ex2er,tm_ex3er,tm_bsiz; ! 13: short erase, unit; ! 14: tm_ex() ! 15: { ! 16: writes("\n\n\t** Tape Test **\n\n"); ! 17: tm_ex1er=tm_ex2er=tm_ex3er=0; ! 18: if ( !(tm_bsiz = tape_op(CONFIG,0,0))) return; ! 19: writes("Tape master internal buffer size "); ! 20: writed(tm_bsiz); writes(" bytes\n"); ! 21: gunit: writes("\nEnter tape unit number [0 - 3]: "); unit = gethex(); ! 22: if (unit > 3) { ! 23: writes(" invalid unit number"); ! 24: goto gunit; } ! 25: if (unit == 0x01 || unit == 0x02) unit = ~unit & 0x03; ! 26: writes("\n\n\tErase Records test \n"); /* output subtest header */ ! 27: tm_ex1(&iob0); ! 28: writes("\n\n\tWrite/Read/Compare test\n"); /* output subtest header */ ! 29: tm_ex2(&iob5); ! 30: writes("\n\n\tMemory Contention test\n"); /* output subtest header */ ! 31: tblk = (struct tpblk *)&tpb; ! 32: tm_ex3(&iob0, &iob2, &iob4); ! 33: if (!tm_ex1er && !tm_ex2er && !tm_ex3er) writes("\nTape passed..\n"); ! 34: else writes("\nTape failed..\n"); ! 35: } ! 36: /* ! 37: (1) rewind tape ! 38: (2) erase records test ! 39: (3) rewind tape ! 40: (4) attempt to read 1 block of data, should get hard error 0x87 ; ! 41: blank tape where data expected error ! 42: */ ! 43: tm_ex1(dumbuf) ! 44: char *dumbuf; ! 45: { int rtn_cnt; ! 46: tm_rew(); /* rewind tape */ ! 47: tm_erase(); /* erase 1024 records */ ! 48: tm_rew(); /* rewind tape */ ! 49: erase = 1; ! 50: writes("\nChecking for blank tape..."); ! 51: if(rtn_cnt=tape_op(READ_BU,dumbuf,1024)== -1) { ! 52: writes("...TM1 exercise read error"); } ! 53: else { ! 54: writes("error...tape was not blank"); ! 55: tm_ex1er = 1; } ! 56: erase = 0; ! 57: } ! 58: /* ! 59: (1) write 1 block of data ! 60: (2) repeat for each data pattern ! 61: (3) rewind tape ! 62: (4) read 1 block of data ! 63: (5) check against pattern ! 64: (6) repeat step (4), (5) 9 more times ! 65: */ ! 66: tm_ex2(Sysbuf) ! 67: char *Sysbuf; ! 68: { register long ix, iy, rtn_cnt; ! 69: unsigned char pattern; ! 70: static unsigned testcase[] = { 0x00, ! 71: 0xff, ! 72: 0xa5, ! 73: 0x5a, ! 74: 0x55, ! 75: 0xaa, ! 76: 0x0f, ! 77: 0xf0, ! 78: 0x33, ! 79: 0xcc }; ! 80: ! 81: tm_rew(); /* rewind tape */ ! 82: /* ! 83: Write 10 blocks of data ! 84: */ ! 85: for(ix=0; ix<10; ix++) { ! 86: pattern = testcase[ix]; ! 87: writes("\nWriting block "); writeh(ix); ! 88: writes(", data pattern is "); writeh(pattern); ! 89: for (iy=0;iy<tm_bsiz;iy++) Sysbuf[iy] = pattern; ! 90: if ((rtn_cnt=tape_op(WRIT_BU,Sysbuf,tm_bsiz)) == -1) ! 91: { tm_ex2er = 1; ! 92: ex_err("...TM2 exercise write error"); } ! 93: if (rtn_cnt != tm_bsiz) { tm_ex2er = 1; tm_cerr(rtn_cnt); } ! 94: } ! 95: tm_rew(); /* rewind tape */ ! 96: /* ! 97: Read and compare 10 blocks of data ! 98: */ ! 99: for(ix=0; ix<10; ix++) { ! 100: pattern = testcase[ix]; ! 101: writes("\nRead and Compare block "); writeh(ix); ! 102: writes(", data pattern is "); writeh(pattern); ! 103: for (iy=0;iy<tm_bsiz;iy++) Sysbuf[iy] = 0; /* clear buffer */ ! 104: if ((rtn_cnt=tape_op(READ_BU,Sysbuf,tm_bsiz)) == -1) ! 105: { tm_ex2er = 1; ! 106: writes("...TM2 exercise read error"); } ! 107: else { ! 108: if (rtn_cnt != tm_bsiz) { tm_ex2er=1;tm_cerr(rtn_cnt);} ! 109: for (iy=0;iy<tm_bsiz;iy++) { ! 110: if (Sysbuf[iy] != pattern) { ! 111: writes("\n...Block "); writeh(ix); ! 112: writes(" compare error, expected "); ! 113: writeh(pattern); writes(" , actual "); ! 114: writeh(Sysbuf[iy]); ! 115: tm_ex2er = 1; ! 116: break; } ! 117: } ! 118: } ! 119: } ! 120: } ! 121: /* ! 122: This test tries to create memory contention between Tahoe ! 123: and the tape master by the following actions : ! 124: (1) Sent a command to Tape master to move 2 blocks ! 125: of data in Tahoe memory to buffer X, X+1 ! 126: (2) use movblk instruction to move the same 2 blocks ! 127: to buffer Y, Y+1 and keep doing this until cmd_done ! 128: (indicate tape master done with command) ! 129: (3) compare buffer X, X+1 with Y, Y+1. ! 130: */ ! 131: tm_ex3(srcbuf, tdest, sdest) ! 132: char *srcbuf, *tdest, *sdest; ! 133: { register long ix, *lptr; ! 134: ! 135: tm_ex3er= 0; ! 136: lptr = (long *)srcbuf; /* Write pattern to source buffers */ ! 137: for (ix=0; ix<((NBPG*2)/4); ix++) *lptr++ = ix; ! 138: lptr = (long *)tdest; ! 139: for (ix=0; ix<((NBPG*4)/4); ix++) *lptr++ = 0; /* Clear destination */ ! 140: ! 141: tblk_mv(srcbuf,tdest,NBPG*2); /* Set up Tpb to move 2 blocks */ ! 142: memcon(srcbuf,sdest); ! 143: ! 144: for (ix=0; ix<(NBPG*2); ix++) { ! 145: if (srcbuf[ix] != tdest[ix]) { ! 146: writes("\nBlockmv tape error, expected "); ! 147: writeh(srcbuf[ix]&0xff); ! 148: writes(" , actual "); writeh(tdest[ix]&0xff); ! 149: writes(" , address "); writeh(&tdest[ix]); ! 150: tm_ex3er = 1; ! 151: } ! 152: if (srcbuf[ix] != sdest[ix]) { ! 153: writes("\nBlockmv system error, expected "); ! 154: writeh(srcbuf[ix]&0xff); ! 155: writes(" , actual "); writeh(sdest[ix]&0xff); ! 156: writes(" , address "); writeh(&sdest[ix]); ! 157: tm_ex3er = 1; ! 158: } ! 159: } ! 160: } ! 161: /* ! 162: Routine to set up Tape parameter ! 163: block for move block operation. ! 164: */ ! 165: tblk_mv(src,dest,bcnt) ! 166: char *src, *dest; ! 167: long bcnt; ! 168: { char *cptr; ! 169: ! 170: tblk->cmd = BLOCK_M; /* Command */ ! 171: tblk->control[1] = 0; ! 172: tblk->control[0] = 0x2a; /* src=dst=16 bits,completion interrupt */ ! 173: cptr = (char *)&tblk->count; /* Set byte count */ ! 174: *cptr++ = (char)(bcnt & 0xff); ! 175: *cptr = (char)((bcnt & 0xff00)>>8); ! 176: ! 177: /* Set source and destination buffer address */ ! 178: set_pointer(src,(char *)tblk->source); ! 179: set_pointer(dest,(char *)tblk->dest); ! 180: ! 181: tblk->mask = 0; /* Clear mask/stat */ ! 182: tblk->intr[0] = tblk->intr[1] = 0; ! 183: tblk->table[0] = tblk->table[1] = 0; ! 184: tblk->throttle = 0; ! 185: } ! 186: ex_err(msg) ! 187: char *msg; ! 188: { ! 189: writes(msg); ! 190: } ! 191: ! 192: tm_cerr(cnt) ! 193: long cnt; ! 194: { ! 195: writes("\n...Cy return count error "); writeh(cnt); writec('\n'); ! 196: } ! 197: /* ! 198: Routine to create memory contention ! 199: return -1 if error ! 200: */ ! 201: memcon(src,sdest) ! 202: char *src, *sdest; ! 203: { register long *r12, cntr, rtn_cnt, ix; ! 204: ! 205: while (g_open()==0) /* Is gate open ? */ ! 206: { tm_init(); ! 207: error("\n...sent_tm gate closed"); ! 208: return(-1); ! 209: } ! 210: cmd_done = 0; ! 211: ccblk.gate = (char)GATE_CLOSED; /* Close gate */ ! 212: cy_attn(); /* Execute command */ ! 213: cntr = RETRY; ! 214: while (!cmd_done) { /* Wait for tape to complete */ ! 215: asm("movl 4(fp),r0"); /* Source */ ! 216: asm("movl 8(fp),r1"); /* Destination */ ! 217: asm("movl $NBPG*2,r2"); /* Count */ ! 218: asm("movblk"); /* Move it */ ! 219: } ! 220: if (cmd_done == 2) return(-1); /* Command has error */ ! 221: return(0); ! 222: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.