Annotation of cci/d/pits/vddc_ex.c, revision 1.1

1.1     ! root        1: #include "vddc.h"
        !             2: 
        !             3: extern long Probe, iob0, iob1, iob2, iob3, iob4;
        !             4: extern struct DEVPAR devpar[];
        !             5: extern struct DA VDDCBASE [];
        !             6: extern int type, cont;
        !             7: long v_err;
        !             8: long format_flag = 0;
        !             9: 
        !            10: /*     Routine to exercise VDDC
        !            11: */
        !            12: vddc_ex()
        !            13: {      register long unit, last_blk, nodr;
        !            14:        format_flag = 0;
        !            15:        for (nodr=unit=0;devpar[unit+type*5].nocyl;unit++) {
        !            16:                if (devpar[unit+type*5].alive) {
        !            17:                        nodr++;
        !            18:                        if (format_flag) vddc_ctlr(FORMAT,unit);
        !            19:                        Probe = 1;
        !            20:                        last_blk = v_probe(unit);
        !            21:                        Probe = 0;
        !            22:                        if ( last_blk > 0) {
        !            23:                                writes("\n\tWrite_Compare/Read/Compare test\n");
        !            24:                                writes("\n");
        !            25:                                        v_ex1(1,unit,last_blk); 
        !            26:                                        v_ex1(2,unit,last_blk-1); 
        !            27:                                        v_ex1(3,unit,last_blk-2); }
        !            28:                        }
        !            29:                }
        !            30:        if (!nodr) {
        !            31:                writes("\n\n...No drive available");
        !            32:                return; }
        !            33:        if (!v_err) writes("\nVDDC passed..\n");
        !            34:                else  writes("\nVDDC failed..\n");
        !            35: }
        !            36: 
        !            37: v_ex1(factor,sdev,blk)
        !            38: long factor, blk;
        !            39: int sdev;
        !            40: {      register long ix, pat, *sptr, *dptr, loop;
        !            41:        unsigned short *s, *d;
        !            42: 
        !            43:        pat = 0xababab00;       /* Pattern */
        !            44:        sptr = &iob0;           /* Source buffer */
        !            45:        dptr = &iob3;           /* Destination buffer */
        !            46: 
        !            47:        writes("Exercising block "); writed(blk); writes("\n");
        !            48: for(v_err=loop=0;loop<200;loop++)
        !            49:        {
        !            50:        /* initialize pattern in source buffer */
        !            51:        for (ix=0; ix<(BLKSIZ/4)*factor; ix++) { 
        !            52:                sptr[ix] = pat + ix;    /* init. pattern in source buffer */
        !            53:                dptr[ix] = 0;           /* Clear destination buffer */
        !            54:                }
        !            55:        /* Write 1 block of data */
        !            56:        if (vddc_op(WR_COMP,sdev,blk,factor,&iob0)==0) {v_err=1;return(0);}
        !            57: 
        !            58:        /* Read 1 block of data */
        !            59:        if (vddc_op(RD_DATA,sdev,blk,factor,&iob3)==0) {v_err=1;return(0);}
        !            60:        s = (unsigned short *)&iob0;            /* Source buffer */
        !            61:        d = (unsigned short *)&iob3;            /* Destination buffer */
        !            62:        for (ix=0; ix<(BLKSIZ/2)*factor; ix++) {
        !            63:                if (s[ix] != d[ix]) {
        !            64:                        writes("\nCompare error: ");
        !            65:                        writes("expected ");
        !            66:                        writeh(s[ix] & 0xffff);
        !            67:                        writes(" , actual "); writeh(d[ix] & 0xffff);
        !            68:                        writes(", address "); writeh(&d[ix]);
        !            69:                        v_err = 1;
        !            70:                        }       
        !            71:                }
        !            72:        if (v_err) loop = 0;    /* If error then loop forever */
        !            73:        }
        !            74: }
        !            75: 
        !            76: 
        !            77: /*     routine to probe VDDC disk 
        !            78: */
        !            79: v_probe(sdev)
        !            80: int sdev;
        !            81: {      register long *dptr, blk, inc;
        !            82:        inc = 2000;
        !            83:        blk = 0;
        !            84:        writes("\n\n\tRead Block test\n");
        !            85:        while (inc != 0) {
        !            86:                for(blk += inc;;blk += inc) { /* Read 1 block of data */
        !            87:                        if (vddc_op(RD_DATA,sdev,blk,1,&iob0)==0) 
        !            88:                                { blk -= inc; break; }
        !            89:                        }
        !            90:                inc /= 2;
        !            91:                }
        !            92:        if (blk <= 0) {
        !            93:                writes("\n...Cannot probe "); writes(devpar[sdev+type*5].name);
        !            94:                writed(sdev);
        !            95:                v_err = 1;
        !            96:                return(0); }
        !            97:        writes("\n"); writes(devpar[sdev+type*5].name); 
        !            98:         writes(" unit "); writed(sdev); writes(" has ");
        !            99:        writed((blk*1024)/1000); writes(" Kbytes.\n");
        !           100:        return(blk);
        !           101: 
        !           102: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.