📄 tests.c
字号:
case CDROM: /* CD-ROM test */ (void)sprintf(opt_code, "s D=/dev/r%s V=%d P=%d", tests[test_id]->devname, (int)tests[test_id]->special, (int)tests[test_id]->data >> 8); type = (int)tests[test_id]->data & 7; if (type == 1) strcat(opt_code, " T=sony2"); else if (type == 2) strcat(opt_code, " T=hitachi4"); else if (type == 3) strcat(opt_code, " T=pdo"); else if (type == 4) strcat(opt_code, " T=other"); else strcat(opt_code, " T=cdassist"); if ((int)tests[test_id]->data & 8) strcat(opt_code, " S=data1"); if ((int)tests[test_id]->data & 0x40) strcat(opt_code, " S=data2"); if ((int)tests[test_id]->data & 0x10) strcat(opt_code, " S=audio"); if ((int)tests[test_id]->data & 0x20) strcat(opt_code, " R=sequential"); break; case SCSIDISK1: /* standard format for device entry */ case XYDISK1: case XDDISK1: case IPIDISK1: case IDDISK1: /* Check for a Write/Read raw disk test */ case SFDISK1: case OBFDISK1: rawtest_part = (unsigned char)'a' + ((int)tests[test_id]->data & 0x7); /* NO.. this is wrong(Hai 1/30/92) type = ((int)tests[test_id]->data & 0x70); */ type = ((int)tests[test_id]->data & 0xf0) >> 4; if ( type == 8 ) /* 'Entire is choosed */ sprintf(opt_code, "s D=%s P=%c", tests[test_id]->devname, rawtest_part); else { sprintf( rawtest_size, "%d", type == 0 ? 100 : type*200); sprintf(opt_code, "s D=%s P=%c S=%s", tests[test_id]->devname, rawtest_part, rawtest_size); } if ((int)tests[test_id]->data & 0x8) strcat(opt_code, " W"); break; case SCSIDISK2:#ifdef sun386 (void)sprintf(opt_code, "s D=roota"); break;#endif case XYDISK2: case XDDISK2: case IPIDISK2: case IDDISK2: case SFDISK2: case OBFDISK2: (void)sprintf(opt_code, "s D=%s", tests[test_id]->devname); break; case VMEM: /* take care of vmem wait time here */ if (vmem_wait == 0 || /* first time around */ elapse_count - vmem_wait >= vmem_waitvar * 60) { srand(elapse_count); if(!strcmp( (vmem_waittime[(int)tests[test_id]->data]), "random") ) vmem_waitvar = (rand() >> 12) % 90; else vmem_waitvar = atoi(vmem_waittime[(int)tests[test_id]->data]); /* take care of margins here */ (void)sprintf(opt_code, "s R=%d M=%d", (int)tests[test_id]->special, (int)(tests[test_id]->pass+1)); if (gp2) /* gp2, cg2, cg12, and cg5 are exclusive */ (void)strcat(opt_code, " gp2"); else if (cg5) (void)strcat(opt_code, " cg5"); else if (cg2) (void)strcat(opt_code, " cg2"); else if (cg12) (void)strcat(opt_code, " cg12"); if (ibis) /* ibis and cg4 are exclusive */ (void)strcat(opt_code, " ibis"); else if (cg4) (void)strcat(opt_code, " cg4"); if (ipcs != 0) (void)sprintf(opt_code, "%s ipcs=%d", opt_code, ipcs); if (taac == 1) (void)strcat(opt_code, " taac"); if (zebra != 0) (void)sprintf(opt_code, "%s zebra=%d", opt_code, zebra); if (gttest == 1) (void)strcat(opt_code, " gt"); break; } else return(1); /* can't run it yet */ case AUDIO: if (tests[test_id]->conf->uval.devinfo.status == 0) { (void)sprintf(opt_code, "s O=%s V=%d", ((int)tests[test_id]->data&1)?"jack":"speaker", (int)tests[test_id]->special); } else { i = (int)tests[test_id]->data&0x1; (void)sprintf(opt_code, "s T=%d D=/dev/%s F=%s", i+1, (int)tests[test_id]->devname, (int)tests[test_id]->special); if ( (((int)tests[test_id]->data & 0x4) >> 2) != 0 ) strcat(opt_code, " L"); if ( (((int)tests[test_id]->data & 0x8) >> 3) != 0 ) strcat(opt_code, " C"); if ( (((int)tests[test_id]->data & 0x10) >> 4) != 0 ) strcat(opt_code, " X"); if ( (((int)tests[test_id]->data & 0x20) >> 5) != 0 ) strcat(opt_code, " S"); if ( (((int)tests[test_id]->data & 0x40) >> 6) != 0 ) strcat(opt_code, " M"); } break; case CPU_SP: /* ttya and ttyb */ switch ((int)tests[test_id]->data) { case 0: loopback = "/dev/ttya"; break; case 1: loopback = "/dev/ttyb"; break; case 2: loopback = "/dev/ttya,b"; break; case 3: default: loopback = "/dev/ttya /dev/ttyb"; break; } (void)sprintf(opt_code, "s D=%s %s", tests[test_id]->devname, loopback); break; case CPU_SP1: /* ttyc and ttyd */ switch ((int)tests[test_id]->data) { case 0: loopback = "/dev/ttyc"; break; case 1: loopback = "/dev/ttyd"; break; case 2: loopback = "/dev/ttyc,d"; break; case 3: default: loopback = "/dev/ttyc /dev/ttyd"; break; } (void)sprintf(opt_code, "s D=%s %s", tests[test_id]->devname, loopback); break; case ENET0: case ENET1: case ENET2: case OMNI_NET: case FDDI: case TRNET: if (net_flag == 0 && (next_net == 0 || next_net == test_id)) { net_flag = test_id; /* turn on the flag */ next_net = 0; (void)sprintf(opt_code, "s net_%s", tests[test_id]->devname); if (!((int)tests[test_id]->data & 1)) /* whether to run spray test */ (void)strcat(opt_code, " S"); (void)sprintf(opt_code, "%s D=%d", opt_code, (int)tests[test_id]->special); if ((int)tests[test_id]->data & 2) /* driver warning messages */ (void)strcat(opt_code, " W"); break; } if (next_net == 0) /* registered so it will be started next */ next_net = test_id; else if (!tests[next_net]->enable) next_net = 0; /* to prevent deadlock */ if (net_flag != 0) if (tests[net_flag]->pid == 0) /* to prevent deadlock */ net_flag = 0; return(1); /* can't run it yet */ case IPC: (void)sprintf(opt_code, "s ipc%d", tests[test_id]->unit); if ((int)tests[test_id]->data & 1) /* test floppy drive too */ (void)strcat(opt_code, " D"); if ((int)tests[test_id]->data & 2) /* test printer port too */ (void)strcat(opt_code, " P"); break; case BW2: (void)sprintf(opt_code, "s /dev/%s", tests[test_id]->devname); break; case COLOR3: (void)sprintf(opt_code, "s /dev/%s", tests[test_id]->devname); if (fb_delay != 0) return(1); break; case COLOR4: (void)strcat(opt_code, " /dev/cgfour0"); if (fb_delay != 0) return(1); break; case COLOR6: (void)sprintf(opt_code, "s D=/dev/%s", tests[test_id]->devname); case COLOR8: if (fb_delay != 0) return(1); break;#ifdef sun386 case COLOR5: (void)strcat(opt_code, " /dev/cgfive0");#else sun386 case COLOR2: (void)strcat(opt_code, " /dev/cgtwo0"); case COLOR5: case COLOR9: case GP2:#endif sun386 if (fb_inuse != 0) return(1); /* can't run it now */ if (fb_delay != 0 && fb_id == tests[test_id]->id) return(1); if (fb_delay > FB_WAIT/2 && fb_id > tests[test_id]->id) return(1); /* give other fb tests a chance to start */ ++fb_inuse; fb_id = tests[test_id]->id; /* keep track who is using it */ if (tests[test_id]->id == COLOR9) (void)strcat(opt_code, " 9"); break; case TV1: if ((int)tests[test_id]->data & 1) /* NTSC loopback mode */ (void)strcat(opt_code, " ntsc"); if ((int)tests[test_id]->data & 2) /* YC loopback mode */ (void)strcat(opt_code, " yc"); if ((int)tests[test_id]->data & 4) /* YUV loopback mode */ (void)strcat(opt_code, " yuv"); if ((int)tests[test_id]->data & 8) /* RGB loopback mode */ (void)strcat(opt_code, " rgb"); break; case GP: if ((int)tests[test_id]->data & 1) /* run the gb test too */ (void)strcat(opt_code, " gb"); break; case PRESTO: if ((int)tests[test_id]->data & 1) /* run the presto test too */ (void)strcat(opt_code, " e"); break; case MTI: case MCP: case SCSISP1: case SCSISP2: if (tests[test_id]->id == MCP) { if (mcp_flag[tests[test_id]->unit] != 0) return(1); /* can't run */ mcp_flag[tests[test_id]->unit] = 1; unit = (unsigned int)'h' + tests[test_id]->unit; } else if (tests[test_id]->id == MTI) unit = (unsigned int)'0' + tests[test_id]->unit; else if (tests[test_id]->id == SCSISP1) unit = 's'; /* first SCSI serial ports */ else unit = 't'; /* second SCSI serial ports */ (void)sprintf(opt_code, "s D=%s /dev/tty%c%s /dev/tty%c%s", tests[test_id]->devname, unit, ((struct loopback *)(tests[test_id]->data))->from, unit, ((struct loopback *)(tests[test_id]->data))->to); break; case SCP: case SCP2: if (tests[test_id]->id == SCP) { unit = (unsigned int)'a' + tests[test_id]->unit; (void)sprintf(dev_name, "dcp%c", unit); } else { if (mcp_flag[tests[test_id]->unit] != 0) return(1); /* can't run */ mcp_flag[tests[test_id]->unit] = 1; (void)strcpy(dev_name, "mcp"); } (void)sprintf(opt_code, "s %s%s %s%s", dev_name, ((struct loopback *)(tests[test_id]->data))->from, dev_name, ((struct loopback *)(tests[test_id]->data))->to); if (tests[test_id]->id == SCP && dcp_kernel[tests[test_id]->unit] == 0) (void)strcat(opt_code, " k"); /* load the dcp kernel too */ break; case SPIF: (void)sprintf(opt_code, "s "); if (type = (( (int)tests[test_id]->data & 0xf000000) >> 24) ) for (i = 0; i < 8; i++) { if (type == i) { if ( (int)tests[test_id]->unit < 2 ) { sprintf(tmp_buf, " D=/dev/ttyz0%x ", (int)tests[test_id]->unit * 8 + i); } else { sprintf(tmp_buf, " D=/dev/ttyz%x ", (int)tests[test_id]->unit * 8 + i); } } } if (type == 0) { if ( (int)tests[test_id]->unit < 2 ) { sprintf(tmp_buf, " D=/dev/ttyz0%x ", (int)tests[test_id]->unit * 8); } else { sprintf(tmp_buf, " D=/dev/ttyz%x ", (int)tests[test_id]->unit * 8); } } else if (type == 8) { sprintf(tmp_buf, " D=sb%d ", (int)tests[test_id]->unit + 1); } else { if (type = (( (int)tests[test_id]->data & 64) >> 6) ) sprintf(tmp_buf, "D=/dev/stclp%d ", (int)tests[test_id]->unit); } /* build in the device arguement */ strcat(opt_code, tmp_buf); /* Initialize T and Set the test selected */ T = 0 ; if (type = ((int)tests[test_id]->data & 1) ) T=1; if (type = (( (int)tests[test_id]->data & 2) >> 1) ) T += 2; if (type = (( (int)tests[test_id]->data & 4) >> 2 ) ) T += 4; if (type = (( (int)tests[test_id]->data & 8) >> 3) ) T += 8; if (type = (( (int)tests[test_id]->data & 0x10) >> 4) ) T += 16; if (T == 0) strcat(opt_code, " T=1 "); else { sprintf(tmp_buf, "T=%d ", T); strcat(opt_code, tmp_buf); } type = (( (int)tests[test_id]->data & 0xf00) >> 8); switch (type) { case 0: strcat(opt_code, " B=110"); break; case 1: strcat(opt_code, " B=300"); break; case 2: strcat(opt_code, " B=600"); break; case 3: strcat(opt_code, " B=1200"); break; case 4: strcat(opt_code, " B=2400"); break; case 5: strcat(opt_code, " B=4800"); break; case 6: strcat(opt_code, " B=9600"); break; case 7: strcat(opt_code, " B=19200"); break; case 8: strcat(opt_code, " B=38400"); break; default: strcat(opt_code, " B=9600"); break; } type = (( (int)tests[test_id]->data & 0xf000) >> 12); switch (type) { case 0: strcat(opt_code, " C=5"); break; case 1: strcat(opt_code, " C=6"); break; case 2: strcat(opt_code, " C=7"); break; case 3: strcat(opt_code, " C=8"); break; default: strcat(opt_code, " C=8"); break; } type = (( (int)tests[test_id]->data & 0x20) >> 5); /* stop bit */ switch (type) { case 0: strcat(opt_code, " S=1"); break; case 1: strcat(opt_code, " S=2"); break; default: strcat(opt_code, "S=1"); break; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -