/*** dtest.c * * DTEST.TTP -- Disk/DMA test program * gcc {-DVERBOSE} -o dtest.ttp dtest.c -liio * * 910315 JWTittsler originally a wrapper for TT DMA test program * 910325 jwt make the GetBPB() call only if given the -B switch * show only first 10 errors/cycle, unless given -E switch * 910326 jwt make clearing the buffers optional, setable fill value * -L sets limit from base record; if set then -I specifies * increment from one cycle to next, if I==0 then random * blocks */ #define VERSION " Version of May 07 15:46:00 PST 1991" #define OPTIONS "bBc:C:d:D:eEfFi:I:l:L:o:O:p:P:r:R:s:S:Zz" #define RECORDSIZE (512L) #define SLOP (8L) /* space between buffers (in bytes) */ #define SHOWABLEERRORS (10L) /* default number of errors to show per pass */ /* BIOS Definitions */ /* Bconxx() handles */ #define CONSOLE 2 /* Rwabs() flags */ #define READ (0) #define WRITE (1) #define PHYSICAL (8) #define PHYSREAD (READ+PHYSICAL) #define PHYSWRITE (WRITE+PHYSICAL) #include #include #include #include #include #include extern int opterr,optind; extern char *optarg; long lErrors=0L; int bAllErrors=0; int bGenerateFill=0; void Usage(void){ puts("DTEST -B -E -F -Z -G -C nnnn -D nn -I nnnn \ -L nnnn -O n -P nnn -R nnnn"); puts(" where:"); puts(" -B do getbpb() call"); puts(" -E show all errors {first 10/cycle}"); puts(" -F put buffer in Fast RAM"); puts(" -Z don't preset read buffers"); puts(" -G generate fill pattern {0s}"); puts(" -C nnnn record count {3072}"); puts(" -D nn TOS physical device number {0}"); puts(" -W nnnn number of writes before each read/compare {100}"); puts(" -I nnnn increment {0, random if limit specified}"); puts(" -L nnnn limit to be added to base record number {0}"); puts(" -O n offset from long alignment {0}"); puts(" -P nnn read buffer preset value {0}"); puts(" -R nnnn base starting record number {274000}"); } int GetNumArg(char *string){ return(atoi(string)); /* someday this will handle hex and decimal */ } /* yeah, sure */ long GetLongArg(char *string){ return(atol(string)); /* someday this will handle hex and decimal */ } /* yeah, sure */ char *Myalloc(long size, short type){ int nTOSVersion, nTemp; nTemp = Sversion(); nTOSVersion = (nTemp>>8) | ((nTemp&0xFF)<<8); /* byte swap */ if (nTOSVersion >= 0x0019) return (char *)Mxalloc(size, type); else if (type) return NULL; /* old TOS only has one kind of RAM */ else return (char *)Malloc(size); } void SetBuffer(unsigned char *pB, long lBufferSize, int nPass) { register int i; register unsigned char bVal; register unsigned long bLval; unsigned long *lB; register long j; if (bGenerateFill) { bVal = (unsigned char) nPass; for(i=0; i> 2; lB = (unsigned long *)pB; for(i=0; i (nBaseRecord+nLimit)) nRecord = nBaseRecord; } else { /* a random distance up to limit away */ nRecord = nBaseRecord + (Random()%(long)nLimit); } } } (void)Cconin(); /* swallow up character */ }