📄 opfile.c
字号:
{ case 0: temp = "none"; break; case 1: temp = "odd"; break; case 2: temp = "even"; break; default: temp = "none"; } (void)fprintf(opt_fp," parity:%s", temp); switch (((int)tests[i]->data & 0xf00000) >> 20) { case 0: temp = "xonoff"; break; case 1: temp = "rtscts"; break; case 2: temp = "both"; break; default: temp = "rtscts"; } (void)fprintf(opt_fp," flow_control:%s", temp); switch (((int)tests[i]->data & 0xf000000) >> 24) { case 0: (void)sprintf(temp, "%d", (int)tests[i]->unit); break; case 1: (void)sprintf(temp, "%d", (int)tests[i]->unit + 1); break; case 2: (void)sprintf(temp, "%d", (int)tests[i]->unit + 2); break; case 3: (void)sprintf(temp, "%d", (int)tests[i]->unit + 3); break; case 4: (void)sprintf(temp, "%d", (int)tests[i]->unit + 4); break; case 5: (void)sprintf(temp, "%d", (int)tests[i]->unit + 5); break; case 6: (void)sprintf(temp, "%d", (int)tests[i]->unit + 6); break; case 7: (void)sprintf(temp, "%d", (int)tests[i]->unit + 7); break; case 8: (void)sprintf(temp, "all"); break; default: temp = "0"; } if (strcmp(temp, "all") == 0) (void)fprintf(opt_fp," serial_port:all"); else (void)fprintf(opt_fp," serial_port:/dev/ttyz%s", temp); switch (((int)tests[i]->data & 0xf0000000) >> 28) { case 0: temp = "0x55"; break; case 1: temp = "0xaa"; break; case 2: temp = "random"; break; default: temp = "0x55"; } (void)fprintf(opt_fp," data_type:%s", temp); switch (((int)tests[i]->data & 64) >> 6) { case 0: (void)fprintf(opt_fp, " parallel_port:disable \n"); break; case 1: (void)fprintf(opt_fp, " parallel_port:enable: \n"); break; } break; default: (void)fprintf(opt_fp, "\n"); } } }/****************************************************************************** * load_test_options(), load the individual test options from the specified * * file. * * Input: param, parsed option tokens. * * Output: none. * ******************************************************************************/load_test_options(param)char *param[];{ int test_id, temp, i, processor_num; int onoff=1; int index=4; /* to keep track of where the options start(default to 4) */ char *temp1[10]; /* go through all existing devices */ for (test_id=0; test_id != exist_tests; ++test_id) if (strcmp(param[0], tests[test_id]->devname) == 0 && strcmp(param[1], tests[test_id]->testname) == 0) break; if (test_id == exist_tests) /* unknown test, format error(ignored) */ return; if (strcmp(param[2], "off") == 0) tests[test_id]->enable = 0; else if (strcmp(param[2], "on") == 0) tests[test_id]->enable = 1; else { onoff = 0; /* device/test enable/disable were not specified */ index = 2; /* options start from 3rd argument */ } if (onoff && (param[3] != NULL)) /* device dis/enable was specified */ { if (strcmp(param[3], "off") == 0) tests[test_id]->dev_enable = 0; else if (strcmp(param[3], "on") == 0) tests[test_id]->dev_enable = 1; else index = 3; /* options start from 4th argument */ } switch (tests[test_id]->id) /* depend on which test it is */ { case VMEM: while (param[index] != NULL) /* still more to be checked */ { if (strcmp(param[index], "wait_time") == 0) { if (param[++index] != NULL) for (i=0; i<=7; i++) { if(!strcmp(param[index], vmem_waittime[i])) { (int)tests[test_id]->data = i; break; } } else break; } else if (strcmp(param[index], "reserve") == 0) { if (param[++index] != NULL) (int)tests[test_id]->special = atoi(param[index]); else break; } ++index; } break; case AUDIO: if (tests[test_id]->conf->uval.devinfo.status == 0) { while (param[index] != NULL) /* still more to be checked */ { if ( param[index+1] == NULL ) break; if (strcmp(param[index], "audio_output") == 0) { if (param[++index] != NULL) { if (strcmp(param[index], "speaker") == 0) tests[test_id]->data = (caddr_t)0; else if (strcmp(param[index], "jack") == 0) tests[test_id]->data = (caddr_t)1; } else break; } else if (strcmp(param[index], "volume") == 0) { if (param[++index] != NULL) tests[test_id]->special = (caddr_t)(atoi(param[index])); else break; } ++index; } } else { while (param[index] != NULL) /* still more to be checked */ { if ( param[index+1] == NULL ) break; if (strcmp(param[index], "audbri_loopback") == 0) { ++index; if (strcmp(param[index], disable) == 0) tests[test_id]->data = (caddr_t)((int)tests[test_id]->data & ~4); else if (strcmp(param[index], enable) == 0) tests[test_id]->data = (caddr_t)((int)tests[test_id]->data | 4); } else if (strcmp(param[index], "audbri_calib") == 0) { ++index; if (strcmp(param[index], disable) == 0) tests[test_id]->data = (caddr_t)((int)tests[test_id]->data & ~8); else if (strcmp(param[index], enable) == 0) tests[test_id]->data = (caddr_t)((int)tests[test_id]->data | 8); } else if (strcmp(param[index], "audbri_crystal") == 0) { ++index; if (strcmp(param[index], disable) == 0) tests[test_id]->data = (caddr_t)((int)tests[test_id]->data & ~0x10); else if (strcmp(param[index], enable) == 0) tests[test_id]->data = (caddr_t)((int)tests[test_id]->data | 0x10); } else if (strcmp(param[index], "audbri_controls") == 0) { ++index; if (strcmp(param[index], disable) == 0) tests[test_id]->data = (caddr_t)((int)tests[test_id]->data & ~0x20); else if (strcmp(param[index], enable) == 0) tests[test_id]->data = (caddr_t)((int)tests[test_id]->data | 0x20); } else if (strcmp(param[index], "audbri_audio") == 0) { ++index; if (strcmp(param[index], disable) == 0) tests[test_id]->data = (caddr_t)((int)tests[test_id]->data & ~0x40); else if (strcmp(param[index], enable) == 0) tests[test_id]->data = (caddr_t)((int)tests[test_id]->data | 0x40); } else if (strcmp(param[index], "audbri_type") == 0) { ++index; temp = atoi(param[index]); tests[test_id]->data = (caddr_t)((int)tests[test_id]->data & ~0x01); tests[test_id]->data = (caddr_t)((int)tests[test_id]->data | temp); } else if (strcmp(param[index], "audbri_ref_file") == 0) { ++index; if (param[index] == NULL ) break; strcpy(audbri_ref_file, param[index]); tests[test_id]->special = (char *)audbri_ref_file; } ++index; }/* end of while */ } break; case ENET0: case ENET1: case ENET2: case OMNI_NET: case FDDI: case TRNET: while (param[index] != NULL) /* still more to be checked */ { if (param[index+1] == NULL) break; if (strcmp(param[index], "spray") == 0) { ++index; if (strcmp(param[index] , enable) == 0) (int)tests[test_id]->data |= 1; else if (strcmp(param[index] , disable) == 0) (int)tests[test_id]->data &= ~1; } else if (strcmp(param[index], "delay") == 0) { ++index; (int)tests[test_id]->special = atoi(param[index]); } else if (strcmp(param[index], "warning") == 0) { ++index; if (strcmp(param[index] , enable) == 0) (int)tests[test_id]->data |= 2; else if (strcmp(param[index] , disable) == 0) (int)tests[test_id]->data &= ~2; } ++index; } break; case CPU_SP: while (param[index] != NULL) /* still more to be checked */ { if (strcmp(param[index], "loopback") == 0) if (param[++index] != NULL) { if (strcmp(param[index], "a") == 0) temp = 0; else if (strcmp(param[index], "b") == 0) temp = 1; else if (strcmp(param[index], "ab") == 0) temp = 2; else if (strcmp(param[index], "a-b") == 0) temp = 3; else temp = (int)tests[test_id]->data; (int)tests[test_id]->data = temp; } else break; ++index; } break; case CPU_SP1: while (param[index] != NULL) /* still more to be checked */ { if (strcmp(param[index], "loopback") == 0) if (param[++index] != NULL) { if (strcmp(param[index], "c") == 0) temp = 0; else if (strcmp(param[index], "d") == 0) temp = 1; else if (strcmp(param[index], "cd") == 0) temp = 2; else if (strcmp(param[index], "c-d") == 0) temp = 3; else temp = (int)tests[test_id]->data; (int)tests[test_id]->data = temp; } else break; ++index; } break; case CDROM: while (param[index] != NULL) /* still more to be checked */ { if (param[index+1] == NULL) break; if (strcmp(param[index], "cdtype") == 0) { ++index; if (strcmp(param[index], "cdassist") == 0) temp = 0; else if (strcmp(param[index], "sony2") == 0) temp = 1; else if (strcmp(param[index], "hitachi4") == 0) temp = 2; else if (strcmp(param[index], "pdo") == 0) temp = 3; else if (strcmp(param[index], "other") == 0) temp = 4; else temp = (int)tests[test_id]->data; (int)tests[test_id]->data = ((int)tests[test_id]->data&~7)|temp; } else if (strcmp(param[index], "data1") == 0) { ++index; if (strcmp(param[index], disable) == 0) (int)tests[test_id]->data |= 8; else if (strcmp(param[index], enable) == 0) (int)tests[test_id]->data &= ~8; } else if (strcmp(param[index], "data2") == 0) { ++index; if (strcmp(param[index], disable) == 0) (int)tests[test_id]->data |= 0x40; else if (strcmp(param[index], enable) == 0) (int)tests[test_id]->data &= ~0x40; } else if (strcmp(param[index], "audiotest") == 0) { ++index; if (strcmp(param[index], disable) == 0) (int)tests[test_id]->data |= 0x10; else if (strcmp(param[index], enable) == 0) (int)tests[test_id]->data &= ~0x10; } else if (strcmp(param[index], "volume") == 0) { ++index; (int)tests[test_id]->special = atoi(param[index]); } else if (strcmp(param[index], "datatrack") == 0) { ++index; (int)tests[test_id]->data = ((int)tests[test_id]->data&~0xFF00) | atoi(param[index]) << 8; } else if (strcmp(param[index], "readmode") == 0) { ++index; if (strcmp(param[index], "sequential") == 0) (int)tests[test_id]->data |= 0x20; else if (strcmp(param[index], "random") == 0) (int)tests[test_id]->data &= ~0x20; } ++index; } break; case SCSIDISK1: case XYDISK1: case XDDISK1: case IPIDISK1: case IDDISK1: case SFDISK1: case OBFDISK1: while (param[index] != NULL) /* still more to be checked */ { if (strcmp(param[index], "rawtest_mode") == 0) { if (param[++index] != NULL) { if (strcmp(param[index], "readonly") == 0) { (int)tests[test_id]->data &= ~0x8; /* reset the mode bit */ } else if (strcmp(param[index], "write_read") == 0) { (int)tests[test_id]->data |= 0x8; /* set the mode bit */ } } else break; } else if (strcmp(param[index], "rawtest_part") == 0) { ++index; if (strcmp(param[index], "a") == 0) temp = 0; else if (strcmp(param[index], "b") == 0) temp = 1; else if (strcmp(param[index], "c") == 0) temp = 2; else if (strcmp(param[index], "d") == 0) temp = 3; else if (strcmp(param[index], "e") == 0) temp = 4; else if (strcmp(param[index], "f") == 0) temp = 5; else if (strcmp(param[index], "g") == 0) temp = 6; else if (strcmp(param[index], "h") == 0) temp = 7; (int)tests[test_id]->data &= ~0x7; (int)tests[test_id]->data |= temp;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -