00001
00011 #include "edtinc.h"
00012 #include "initcam.h"
00013 #include <string.h>
00014
00015 #define COMPARE(str1, str2) (strcasecmp(str1, str2) == 0)
00016
00017
00018 u_char *xilinx;
00019 int nser = 0;
00020
00021 void clear_dependent(Dependent * dd_p);
00022 int check_method_param(char *s, Dependent * dd_p, Edtinfo * ei_p, const char *cfgfile);
00023 int check_other_param(char *s, Dependent * dd_p, Edtinfo *ei_p, const char *cfgfile);
00024 int check_xilinx_param(char *s, Dependent * dd_p, const char *cfgfile);
00025 int check_cls_param(char *s, Dependent * dd_p, const char *cfgfile);
00026 int is_method(char *method_type, char *name);
00027 void strip_ctrlm(char *s);
00028 void strip_extra_whitespace(char *s);
00029 int resolve_cameratype(Dependent *dd_p);
00030 void add_serial_init_node(Edtinfo *ei_p, enum serial_tag tag, char *serial_init);
00031
00032
00033
00034 char *
00035 get_next_string(int nofs_cfg, FILE *cfg_fp, char *ss, char *ds)
00036 {
00037 #ifdef NO_FS
00038 char *dp = ds;
00039 char *sp ;
00040 if (nofs_cfg)
00041 {
00042 sp = ss;
00043 if (!*sp)
00044 return 0;
00045
00046 while(*sp)
00047 {
00048 if ((*sp == '\\') && (*(sp+1) == '\"'))
00049 ++sp;
00050 *dp++ = *sp++;
00051 }
00052 *dp = '\0';
00053
00054 return (char *)ds;
00055 }
00056 else
00057 #endif
00058
00059 return fgets(ds, MAXINIT, cfg_fp);
00060 }
00061
00062
00063 #ifdef NO_FS
00064
00065
00066
00067 #include "nofs_config.h"
00068 #endif
00069
00070
00071 char *dmy_cfg[] = {""};
00072
00073 void
00074 pdv_dep_set_default(PdvDependent * dd_p)
00075
00076 {
00077 int i;
00078
00079
00080
00081
00082 clear_dependent(dd_p);
00083 dd_p->rbtfile[0] = '\0';
00084 dd_p->cameratype[0] = '\0';
00085 dd_p->shutter_speed = NOT_SET;
00086 dd_p->default_shutter_speed = NOT_SET;
00087 dd_p->default_gain = NOT_SET;
00088 dd_p->default_offset = NOT_SET;
00089 dd_p->default_aperture = NOT_SET;
00090 dd_p->binx = 1;
00091 dd_p->biny = 1;
00092 dd_p->byteswap = NOT_SET;
00093 dd_p->serial_timeout = 1000;
00094 dd_p->serial_response[0] = '\r';
00095 dd_p->xilinx_rev = NOT_SET;
00096 dd_p->timeout = NOT_SET;
00097 dd_p->user_timeout = NOT_SET;
00098 dd_p->mode_cntl_norm = NOT_SET;
00099 dd_p->mc4 = 0;
00100 dd_p->pulnix = 0;
00101 dd_p->dbl_trig = 0;
00102 dd_p->shift = NOT_SET;
00103 dd_p->mask = 0xffff;
00104 dd_p->mode16 = NOT_SET;
00105 dd_p->serial_baud = 9600;
00106 dd_p->serial_waitc = NOT_SET ;
00107 dd_p->serial_format = SERIAL_ASCII;
00108 strcpy(dd_p->serial_term, "\r");
00109
00110 dd_p->kbs_red_row_first = 1;
00111 dd_p->kbs_green_pixel_first = 0;
00112
00113
00114 dd_p->htaps = NOT_SET;
00115 dd_p->vtaps = NOT_SET;
00116
00117 dd_p->cameralink = 0;
00118
00119 dd_p->start_delay = 0;
00120 dd_p->frame_period = NOT_SET;
00121 dd_p->frame_timing = NOT_SET;
00122
00123 dd_p->strobe_enabled = NOT_SET;
00124 dd_p->register_wrap = 0;
00125 dd_p->startup_delay = 0;
00126
00127 dd_p->irig_offset = 2;
00128
00129 dd_p->cls.pixel_clock = 20.0;
00130
00131
00132
00133
00134
00135 for (i=0; i<32; i++)
00136 dd_p->xilinx_flag[i] = 0xff;
00137
00138 }
00139
00140 int
00141 readcfg(const char *cfgfile, Dependent * dd_p, Edtinfo * ei_p, int nofs_cfg)
00142 {
00143
00144
00145 int ret;
00146 char **vx_p = dmy_cfg;
00147 FILE *cfg_fp;
00148 char s[MAXINIT];
00149 char *sp;
00150 int lineno = 0;
00151 Edtinfo ei;
00152 #ifdef NO_FS
00153 char *cf;
00154 #endif
00155
00156 edt_msg(DEBUG2, "Reading/processing config file %s:\n\n", cfgfile);
00157
00158 if (ei_p == NULL)
00159 ei_p = &ei;
00160
00161 if (!nofs_cfg)
00162 {
00163
00164
00165
00166 if ((cfg_fp = fopen(cfgfile, "r")) == NULL)
00167 {
00168 perror(cfgfile);
00169 return -1;
00170 }
00171 }
00172
00173 pdv_dep_set_default(dd_p);
00174
00175 ei_p->startdma = NOT_SET;
00176 ei_p->enddma = NOT_SET;
00177 ei_p->flushdma = NOT_SET;
00178 ei_p->serial_init = NULL;
00179 ei_p->serial_init_delay = NOT_SET;
00180 ei_p->cl_mgtspeed = NOT_SET;
00181
00182
00183 dd_p->startdma = NOT_SET;
00184 dd_p->enddma = NOT_SET;
00185 dd_p->flushdma = NOT_SET;
00186
00187
00188 strncpy(dd_p->cfgname, cfgfile, sizeof(dd_p->cfgname) - 1);
00189
00190 #ifdef NO_FS
00191 if (nofs_cfg)
00192 {
00193 char *p;
00194
00195 if ((cf = strrchr(cfgfile, '/')) != NULL)
00196 ++cf;
00197 else cf = cfgfile;
00198 p = cf;
00199
00200 if ((strlen(cf) > 4) && (strcasecmp(&cf[strlen(cf)-4], ".cfg") == 0))
00201 cf[strlen(cf)-4] = '\0';
00202
00203
00204
00205
00206 do
00207 {
00208 if (*p == '-')
00209 (*p = '_');
00210 } while(*(++p));
00211 MAPCONFIG(cf, vx_p);
00212
00213 if (vx_p == NULL)
00214 {
00215 printf("embedded specified, but no header file for '%s' included in source (nofs_config.h)\n", cf);
00216 exit(1);
00217 }
00218 }
00219 #endif
00220
00221 while (get_next_string(nofs_cfg, cfg_fp, *vx_p, s))
00222 {
00223 char tmpstr[MAXINIT];
00224 if (nofs_cfg)
00225 ++vx_p;
00226
00227 lineno++;
00228
00229
00230 if (s[strlen(s)-1] == '\n')
00231 strcpy(tmpstr, s);
00232 else sprintf(tmpstr, "%s\n", s);
00233 edt_msg(DEBUG2, tmpstr);
00234
00235 if (*s == '#' || *s == '\n' || *s == '\r')
00236 continue;
00237
00238 strip_ctrlm(s);
00239 strip_extra_whitespace(s);
00240
00241 if (*s == '#' || *s == '\n' || *s == '\r')
00242 continue;
00243
00244 if ((ret = check_method_param(s, dd_p, ei_p, cfgfile)) < 0)
00245 return -1;
00246 if (ret == 1)
00247 continue;
00248
00249 if ((ret = check_xilinx_param(s, dd_p, cfgfile)) < 0)
00250 return -1;
00251 if (ret == 1)
00252 continue;
00253
00254 if ((ret = check_other_param(s, dd_p, ei_p, cfgfile)) < 0)
00255 return -1;
00256
00257 if (ret == 1)
00258 continue;
00259
00260 if ((ret = check_cls_param(s, dd_p, cfgfile)) < 0)
00261 return -1;
00262
00263 if (ret == 1)
00264 continue;
00265
00266 {
00267 char kw[MAXINIT];
00268
00269 sscanf(s, "%s", kw);
00270 edt_msg(DEBUG0, "WARNING: unrecognized argument \"%s\" line %d (ignored)\n", kw, lineno);
00271 }
00272 }
00273
00274 #ifndef NO_FS
00275 fclose(cfg_fp);
00276 #endif
00277
00278
00279
00280
00281
00282 resolve_cameratype(dd_p);
00283
00284
00285
00286 if (dd_p->cl_data_path && dd_p->cls.taps == 0)
00287 dd_p->cls.taps = ((dd_p->cl_data_path >> 4) & 0xf) + 1;
00288
00289
00290
00291
00292
00293 if (dd_p->rbtfile[0])
00294 {
00295 if ((sp = strrchr(dd_p->rbtfile, '.')) == NULL)
00296 sp = strchr(dd_p->rbtfile, '\0');
00297 if ((sp != NULL) && ((strcmp(sp, ".rbt") == 0) || (*sp == '\0')))
00298 sprintf(sp, ".bit");
00299 }
00300
00301 return 0;
00302 }
00303
00319 int
00320 pdv_readcfg(const char *cfgfile, Dependent * dd_p, Edtinfo *ei_p)
00321 {
00322 return readcfg(cfgfile, dd_p, ei_p, 0);
00323 }
00324
00325 int
00326 pdv_readcfg_emb(char *cfgfile, Dependent * dd_p, Edtinfo *ei_p)
00327 {
00328 return readcfg(cfgfile, dd_p, ei_p, 1);
00329 }
00330
00331
00332 int
00333 translate_method_arg(char *method_arg, int *method_number)
00334 {
00335
00336 if (COMPARE(method_arg, "AIA_MCL_100US"))
00337 *method_number = AIA_MCL_100US;
00338 else if (COMPARE(method_arg, "AIA_MCL"))
00339 *method_number = AIA_MCL;
00340 else if (COMPARE(method_arg, "AIA_TRIG"))
00341 *method_number = AIA_TRIG;
00342 else if (COMPARE(method_arg, "KODAK_AIA_MCL"))
00343 *method_number = KODAK_AIA_MCL;
00344 else if (COMPARE(method_arg, "AIA_MC4"))
00345 *method_number = AIA_MC4;
00346 else if (COMPARE(method_arg, "HAMAMATSU_4880_8X"))
00347 *method_number = HAM_4880_8X;
00348 else if (COMPARE(method_arg, "HAMAMATSU_4880_SER"))
00349 *method_number = HAM_4880_SER;
00350 else if (COMPARE(method_arg, "SU320_SERIAL"))
00351 *method_number = SU320_SERIAL;
00352 else if (COMPARE(method_arg, "BASLER202K_SERIAL"))
00353 *method_number = BASLER202K_SERIAL;
00354 else if (COMPARE(method_arg, "ADIMEC_SERIAL"))
00355 *method_number = ADIMEC_SERIAL;
00356 else if (COMPARE(method_arg, "TIMC1001_SERIAL"))
00357 *method_number = TIMC1001_SERIAL;
00358 else if (COMPARE(method_arg, "PTM6710_SERIAL"))
00359 *method_number = PTM6710_SERIAL;
00360 else if (COMPARE(method_arg, "PTM1020_SERIAL"))
00361 *method_number = PTM1020_SERIAL;
00362 else if (COMPARE(method_arg, "PULNIX_TM1000"))
00363 *method_number = PULNIX_TM1000;
00364 else if (COMPARE(method_arg, "PULNIX_TM9700"))
00365 *method_number = PULNIX_TM9700;
00366 else if (COMPARE(method_arg, "IRC_160"))
00367 *method_number = IRC_160;
00368 else if (COMPARE(method_arg, "KODAK_AIA_SER_CTRL"))
00369 *method_number = KODAK_AIA_SER_CTRL;
00370 else if (COMPARE(method_arg, "AIA_SER_CTRL"))
00371 *method_number = AIA_SER_CTRL;
00372 else if (COMPARE(method_arg, "KODAK_AIA_SER"))
00373 *method_number = KODAK_AIA_SER;
00374 else if (COMPARE(method_arg, "SMD_SERIAL"))
00375 *method_number = SMD_SERIAL;
00376 else if (COMPARE(method_arg, "AIA_SER_ES40"))
00377 *method_number = AIA_SERIAL_ES40;
00378 else if (COMPARE(method_arg, "AIA_SER"))
00379 *method_number = AIA_SERIAL;
00380 else if (COMPARE(method_arg, "KODAK_SER_14I"))
00381 *method_number = KODAK_SER_14I;
00382 else if (COMPARE(method_arg, "SER_14I"))
00383 *method_number = KODAK_SER_14I;
00384 else if (COMPARE(method_arg, "SPECINST_SERIAL"))
00385 *method_number = SPECINST_SERIAL;
00386 else if (COMPARE(method_arg, "KODAK_XHF_INTLC"))
00387 *method_number = PDV_BYTE_INTLV;
00388 else if (COMPARE(method_arg, "BYTE_INTLV"))
00389 *method_number = PDV_BYTE_INTLV;
00390 else if (COMPARE(method_arg, "FIELD_INTLC"))
00391 *method_number = PDV_FIELD_INTLC;
00392 else if (COMPARE(method_arg, "BYTE_TEST1"))
00393 *method_number = PDV_BYTE_TEST1;
00394 else if (COMPARE(method_arg, "BYTE_TEST2"))
00395 *method_number = PDV_BYTE_TEST2;
00396 else if (COMPARE(method_arg, "BYTE_TEST3"))
00397 *method_number = PDV_BYTE_TEST3;
00398 else if (COMPARE(method_arg, "BYTE_INTLV_MIDTOP_LINE"))
00399 *method_number = PDV_BYTE_INTLV_MIDTOP_LINE;
00400 else if (COMPARE(method_arg, "WORD_INTLV_MIDTOP_LINE"))
00401 *method_number = PDV_WORD_INTLV_MIDTOP_LINE;
00402 else if (COMPARE(method_arg, "WORD_INTLV_TOPMID_LINE"))
00403 *method_number = PDV_WORD_INTLV_TOPMID_LINE;
00404 else if (COMPARE(method_arg, "WORD_INTLV_HILO_LINE"))
00405 *method_number = PDV_WORD_INTLV_HILO_LINE;
00406 else if (COMPARE(method_arg, "WORD_INTLV_HILO"))
00407 *method_number = PDV_WORD_INTLV_HILO;
00408 else if (COMPARE(method_arg, "WORD_INTLV_TOPBOTTOM"))
00409 *method_number = PDV_WORD_INTLV_TOPBOTTOM;
00410 else if (COMPARE(method_arg, "BYTE_INTLV_INOUT"))
00411 *method_number = PDV_BYTE_INTLV_INOUT;
00412 else if (COMPARE(method_arg, "WORD_INTLV_INOUT"))
00413 *method_number = PDV_WORD_INTLV_INOUT;
00414 else if (COMPARE(method_arg, "WORD_INTLV_ODD"))
00415 *method_number = PDV_WORD_INTLV_ODD;
00416 else if (COMPARE(method_arg, "ES10_WORD_INTLC"))
00417 *method_number = PDV_WORD_INTLV;
00418 else if (COMPARE(method_arg, "WORD_INTLV"))
00419 *method_number = PDV_WORD_INTLV;
00420 else if (COMPARE(method_arg, "DALSA_4CH_INTLV"))
00421 *method_number = PDV_DALSA_4CH_INTLV;
00422 else if (COMPARE(method_arg, "DALSA_LS_4CH_INTLV"))
00423 *method_number = PDV_DALSA_LS_4CH_INTLV;
00424 else if (COMPARE(method_arg, "PIRANHA_4CH_INTLV"))
00425 *method_number = PDV_PIRANHA_4CH_INTLV;
00426 else if (COMPARE(method_arg, "PIRANHA_4CH_HWINTLV"))
00427 *method_number = PDV_PIRANHA_4CH_HWINTLV;
00428 else if (COMPARE(method_arg, "SPECINST_4PORT_INTLV"))
00429 *method_number = PDV_SPECINST_4PORT_INTLV;
00430 else if (COMPARE(method_arg, "ILLUNIS_INTLV"))
00431 *method_number = PDV_ILLUNIS_INTLV;
00432 else if (COMPARE(method_arg, "ES10_BGGR_INTLV"))
00433 *method_number = PDV_ES10_BGGR;
00434 else if (COMPARE(method_arg, "ES10_WORD_BGGR_INTLV"))
00435 *method_number = PDV_ES10_WORD_BGGR;
00436 else if (COMPARE(method_arg, "ES10_WORD_ODD_BGGR_INTLV"))
00437 *method_number = PDV_ES10_WORD_ODD_BGGR;
00438 else if (COMPARE(method_arg, "ILLUNIS_BGGR"))
00439 *method_number = PDV_ILLUNIS_BGGR;
00440 else if (COMPARE(method_arg, "QUADRANT_INTLV"))
00441 *method_number = PDV_QUADRANT_INTLV;
00442 else if (COMPARE(method_arg, "QUADRANT2_INTLV"))
00443 *method_number = PDV_QUADRANT2_INTLV;
00444 else if (COMPARE(method_arg, "QUADRANT3_INTLV"))
00445 *method_number = PDV_QUADRANT3_INTLV;
00446 else if (COMPARE(method_arg, "DALSA_2CH_INTLV"))
00447 *method_number = PDV_DALSA_2CH_INTLV;
00448 else if (COMPARE(method_arg, "INVERT_RIGHT_INTLV_24_12"))
00449 *method_number = PDV_INV_RT_INTLV_24_12;
00450 else if (COMPARE(method_arg, "INTLV_24_12"))
00451 *method_number = PDV_INTLV_24_12;
00452 else if (COMPARE(method_arg, "INTLV_1_8_MSB7"))
00453 *method_number = PDV_INTLV_1_8_MSB7;
00454 else if (COMPARE(method_arg, "INTLV_1_8_MSB0"))
00455 *method_number = PDV_INTLV_1_8_MSB0;
00456 else if (COMPARE(method_arg, "INVERT_RIGHT_INTLV"))
00457 *method_number = PDV_INVERT_RIGHT_INTLV;
00458 else if (COMPARE(method_arg, "INVERT_RIGHT_BGGR_INTLV"))
00459 *method_number = PDV_INVERT_RIGHT_BGGR_INTLV;
00460 else if (COMPARE(method_arg, "DALSA_2M30_INTLV"))
00461 *method_number = PDV_DALSA_2M30_INTLV;
00462 else if (COMPARE(method_arg, "EVEN_RIGHT_INTLV"))
00463 *method_number = PDV_EVEN_RIGHT_INTLV;
00464 else if (COMPARE(method_arg, "LINE_INTLV_P3_8X4"))
00465 *method_number = PDV_LINE_INTLV_P3_8X4;
00466 else if (COMPARE(method_arg, "INTLV_10BIT_8TAP_PACKED"))
00467 *method_number = PDV_INTLV_10BIT_8TAP_PACKED;
00468 else if (COMPARE(method_arg, "INTLV_10BIT_8TAP_TO_8BIT"))
00469 *method_number = PDV_INTLV_10BIT_8TAP_TO_8BIT;
00470 else if (COMPARE(method_arg, "INTLV_20BAND"))
00471 *method_number = PDV_INTLV_20BAND;
00472 else if (COMPARE(method_arg, "INTLV_21BAND"))
00473 *method_number = PDV_INTLV_21BAND;
00474 else if (COMPARE(method_arg, "BGGR_DUAL"))
00475 *method_number = PDV_BGGR_DUAL;
00476 else if (COMPARE(method_arg, "BGGR_WORD"))
00477 *method_number = PDV_BGGR_WORD;
00478 else if (COMPARE(method_arg, "BGGR"))
00479 *method_number = PDV_BGGR;
00480 else if (COMPARE(method_arg, "BGR_2_RGB"))
00481 *method_number = PDV_INTLV_BGR_2_RGB;
00482 else if (COMPARE(method_arg, "KODAK_XHF_SKIP"))
00483 *method_number = PDV_BYTE_INTLV_SKIP;
00484 else if (COMPARE(method_arg, "BYTE_INTLV_SKIP"))
00485 *method_number = PDV_BYTE_INTLV_SKIP;
00486 else if (COMPARE(method_arg, "HW_ONLY"))
00487 *method_number = HW_ONLY;
00488 else if (COMPARE(method_arg, "FMRATE_ENABLE"))
00489 *method_number = PDV_FMRATE_ENABLE;
00490 else if (COMPARE(method_arg, "FVAL_ADJUST"))
00491 *method_number = PDV_FVAL_ADJUST;
00492 else if (COMPARE(method_arg, "BASLER_202K"))
00493 *method_number = BASLER_202K;
00494 else if (COMPARE(method_arg, "DUNCAN_2131"))
00495 *method_number = DUNCAN_2131;
00496
00497 else if (COMPARE(method_arg, "FOI_REMOTE_AIA"))
00498 *method_number = FOI_REMOTE_AIA;
00499
00500 else if (COMPARE(method_arg, "DALSA_CONTINUOUS"))
00501 *method_number = DALSA_CONTINUOUS;
00502
00503 else if (COMPARE(method_arg, "EDT_ACT_NEVER"))
00504 *method_number = EDT_ACT_NEVER;
00505 else if (COMPARE(method_arg, "EDT_ACT_ONCE"))
00506 *method_number = EDT_ACT_ONCE;
00507 else if (COMPARE(method_arg, "EDT_ACT_ALWAYS"))
00508 *method_number = EDT_ACT_ALWAYS;
00509 else if (COMPARE(method_arg, "EDT_ACT_ONELEFT"))
00510 *method_number = EDT_ACT_ONELEFT;
00511 else if (COMPARE(method_arg, "EDT_ACT_CYCLE"))
00512 *method_number = EDT_ACT_CYCLE;
00513 else if (COMPARE(method_arg, "EDT_ACT_KBS"))
00514 *method_number = EDT_ACT_KBS;
00515
00516 else if (COMPARE(method_arg, "BINARY"))
00517 *method_number = SERIAL_BINARY;
00518 else if (COMPARE(method_arg, "ASCII_HEX"))
00519 *method_number = SERIAL_ASCII_HEX;
00520 else if (COMPARE(method_arg, "TOSHIBA_SERIAL"))
00521 *method_number = TOSHIBA_SERIAL;
00522 else if (COMPARE(method_arg, "COHU_SERIAL"))
00523 *method_number = COHU_SERIAL;
00524 else if (COMPARE(method_arg, "ASCII_NOSPACE"))
00525 *method_number = SERIAL_ASCII_NOSPACE;
00526 else if (COMPARE(method_arg, "ASCII"))
00527 *method_number = SERIAL_ASCII;
00528 else if (COMPARE(method_arg, "PULNIX_1010"))
00529 *method_number = SERIAL_PULNIX_1010;
00530 else if (COMPARE(method_arg, "DALSA_LS"))
00531 *method_number = PDV_DALSA_LS;
00532 else if (COMPARE(method_arg, "HEADER_BEFORE"))
00533 *method_number = HeaderBefore;
00534 else if (COMPARE(method_arg, "HEADER_AFTER"))
00535 *method_number = HeaderAfter;
00536 else if (COMPARE(method_arg, "HEADER_WITHIN"))
00537 *method_number = HeaderBegin;
00538 else if (COMPARE(method_arg, "HEADER_BEGIN"))
00539 *method_number = HeaderBegin;
00540 else if (COMPARE(method_arg, "HEADER_MIDDLE"))
00541 *method_number = HeaderMiddle;
00542 else if (COMPARE(method_arg, "HEADER_END"))
00543 *method_number = HeaderEnd;
00544 else if (COMPARE(method_arg, "DDCAM"))
00545 *method_number = PDV_DDCAM;
00546 else if (COMPARE(method_arg, "RS232"))
00547 *method_number = PDV_SERIAL_RS232;
00548 else if (COMPARE(method_arg, "BASLER_FRAMING"))
00549 *method_number = SERIAL_BASLER_FRAMING;
00550 else if (COMPARE(method_arg, "DUNCAN_FRAMING"))
00551 *method_number = SERIAL_DUNCAN_FRAMING;
00552 else if (COMPARE(method_arg, "IRIG1"))
00553 *method_number = HDR_TYPE_IRIG1;
00554 else if (COMPARE(method_arg, "FRAMECNT"))
00555 *method_number = HDR_TYPE_FRAMECNT;
00556 else if (COMPARE(method_arg, "IRIG2"))
00557 *method_number = HDR_TYPE_IRIG2;
00558 else if (COMPARE(method_arg, "FRAMESYNC_OFF"))
00559 *method_number = PDV_FRAMESYNC_OFF;
00560 else if (COMPARE(method_arg, "FRAMESYNC_ON"))
00561 *method_number = PDV_FRAMESYNC_ON;
00562 else if (COMPARE(method_arg, "EMULATE_TIMEOUT"))
00563 *method_number = PDV_FRAMESYNC_EMULATE_TIMEOUT;
00564 else
00565 return 0;
00566
00567 return 1;
00568 }
00569
00570 int
00571 check_label(char *str, char *label)
00572 {
00573 char tmplabel[64];
00574
00575 sprintf(tmplabel, "%s:", label);
00576 if (strncmp(str, tmplabel, strlen(tmplabel)) == 0)
00577 return 1;
00578 return 0;
00579 }
00580
00581 int
00582 set_method(Dependent * dd_p, Edtinfo * ei_p, char *method_type, int method_number)
00583 {
00584
00585 if (is_method(method_type, "camera_shutter_speed"))
00586 dd_p->camera_shutter_speed = method_number;
00587
00588
00589 else if (is_method(method_type, "shutter_speed"))
00590 dd_p->camera_shutter_timing = method_number;
00591
00592 else if (is_method(method_type, "camera_shutter_timing"))
00593 dd_p->camera_shutter_timing = method_number;
00594
00595 else if (is_method(method_type, "lock_shutter"))
00596 dd_p->lock_shutter = method_number;
00597
00598 else if (is_method(method_type, "camera_continuous"))
00599 dd_p->camera_continuous = method_number;
00600
00601 else if (is_method(method_type, "camera_binning"))
00602 dd_p->camera_binning = method_number;
00603
00604 else if (is_method(method_type, "camera_data_rate"))
00605 dd_p->camera_data_rate = method_number;
00606
00607 else if (is_method(method_type, "pixelclock_speed"))
00608 dd_p->camera_data_rate = method_number;
00609
00610 else if (is_method(method_type, "camera_download"))
00611 dd_p->camera_download = method_number;
00612
00613 else if (is_method(method_type, "get_gain"))
00614 dd_p->get_gain = method_number;
00615
00616 else if (is_method(method_type, "get_offset"))
00617 dd_p->get_offset = method_number;
00618
00619 else if (is_method(method_type, "set_gain"))
00620 dd_p->set_gain = method_number;
00621
00622 else if (is_method(method_type, "set_offset"))
00623 dd_p->set_offset = method_number;
00624
00625 else if (is_method(method_type, "first_open"))
00626 dd_p->first_open = method_number;
00627
00628 else if (is_method(method_type, "last_close"))
00629 dd_p->last_close = method_number;
00630
00631 else if (is_method(method_type, "interlace"))
00632 {
00633 if (method_number == PDV_PIRANHA_4CH_HWINTLV)
00634 dd_p->hwinterlace = method_number;
00635 else dd_p->swinterlace = method_number;
00636 }
00637 else if (is_method(method_type, "pingpong_varsize"))
00638 dd_p->pingpong_varsize = method_number;
00639
00640 else if (is_method(method_type, "serial_format"))
00641 dd_p->serial_format = method_number;
00642
00643 else if (is_method(method_type, "serial_mode"))
00644 dd_p->serial_mode = method_number;
00645
00646 else if (is_method(method_type, "frame_timing"))
00647 dd_p->frame_timing = method_number;
00648
00649 else if (is_method(method_type, "startdma"))
00650 {
00651 ei_p->startdma = method_number;
00652 dd_p->startdma = method_number;
00653 }
00654 else if (is_method(method_type, "enddma"))
00655 {
00656 ei_p->enddma = method_number;
00657 dd_p->enddma = method_number;
00658 }
00659
00660 else if (is_method(method_type, "flushdma"))
00661 {
00662 ei_p->flushdma = method_number;
00663 dd_p->flushdma = method_number;
00664 }
00665
00666 else if (is_method(method_type, "header_position"))
00667 dd_p->header_position = method_number;
00668
00669 else if (is_method(method_type, "header_type"))
00670 dd_p->header_type = method_number;
00671
00672 else if (is_method(method_type, "framesync"))
00673 dd_p->framesync_mode = method_number;
00674
00675 else
00676 {
00677 edt_msg(DEBUG0, "WARNING: unknown method direcive \"%s\" (ignored)\n", method_type);
00678 return 0;
00679 }
00680 return 1;
00681 }
00682
00683 int
00684 is_method(char *method_type, char *name)
00685 {
00686 char method_name[64];
00687
00688 sprintf(method_name, "method_%s", name);
00689 if (COMPARE(method_name, method_type))
00690 return 1;
00691 return 0;
00692 }
00693
00694
00695
00696
00697 void
00698 clear_dependent(Dependent * dd_p)
00699 {
00700 memset(dd_p, 0, sizeof(Dependent));
00701 }
00702
00703
00704
00705
00706
00707
00708 int
00709 check_int_method(char *line, char *label, int *arg, const char *cfgfile)
00710 {
00711 char format[32];
00712 int ret = 0;
00713 int n;
00714
00715 if (check_label(line, label))
00716 {
00717 sprintf(format, "%s: %%d", label);
00718 if ((n = sscanf(line, format, arg)) != 1)
00719 {
00720 edt_msg(DEBUG2,
00721 "Error in parsing %s.\nExpected:\n\n\t%s: <parameter>\n",
00722 cfgfile, label);
00723 edt_msg(DEBUG2, "\nGot:\n\n\t%s\n", line);
00724 ret = -1;
00725 }
00726 else
00727 ret = 1;
00728 }
00729
00730 return ret;
00731 }
00732
00733 int
00734 check_ulong_method(char *line, char *label, u_long * arg, const char *cfgfile)
00735 {
00736 char format[32];
00737 int ret = 0;
00738 int n;
00739
00740 if (check_label(line, label))
00741 {
00742 sprintf(format, "%s: %%lu", label);
00743 if ((n = sscanf(line, format, arg)) != 1)
00744 {
00745 edt_msg(DEBUG2,
00746 "Error in parsing %s.\nExpected:\n\n\t%s: <parameter>\n",
00747 cfgfile, label);
00748 edt_msg(DEBUG2, "\nGot:\n\n\t%s\n", line);
00749 ret = -1;
00750 }
00751 else
00752 ret = 1;
00753 }
00754
00755 return ret;
00756 }
00757
00758 int
00759 check_float_method(char *line, char *label, float * arg, const char *cfgfile)
00760 {
00761 char format[32];
00762 int ret = 0;
00763 int n;
00764
00765 if (check_label(line, label))
00766 {
00767 sprintf(format, "%s: %%f", label);
00768 if ((n = sscanf(line, format, arg)) != 1)
00769 {
00770 edt_msg(DEBUG2,
00771 "Error in parsing %s.\nExpected:\n\n\t%s: <parameter>\n",
00772 cfgfile, label);
00773 edt_msg(DEBUG2, "\nGot:\n\n\t%s\n", line);
00774 ret = -1;
00775 }
00776 else
00777 ret = 1;
00778 }
00779
00780 return ret;
00781 }
00782
00783 int
00784 check_ushort_method(char *line, char *label, u_short * arg, const char *cfgfile)
00785 {
00786 char format[32];
00787 int ret = 0;
00788 int n;
00789 int v;
00790
00791 if (check_label(line, label))
00792 {
00793 sprintf(format, "%s: %%u", label);
00794 if ((n = sscanf(line, format, &v)) != 1)
00795 {
00796 edt_msg(DEBUG2,
00797 "Error in parsing %s.\nExpected:\n\n\t%s: <parameter>\n",
00798 cfgfile, label);
00799 edt_msg(DEBUG2, "\nGot:\n\n\t%s\n", line);
00800 ret = -1;
00801 }
00802 else
00803 {
00804 *arg = v;
00805 ret = 1;
00806 }
00807 }
00808
00809 return ret;
00810 }
00811
00812 int
00813 check_byte_method(char *line, char *label, u_char * arg, const char *cfgfile)
00814 {
00815 char format[32];
00816 int ret = 0;
00817 int n;
00818 int v;
00819
00820 if (check_label(line, label))
00821 {
00822 sprintf(format, "%s: %%u", label);
00823 if ((n = sscanf(line, format, &v)) != 1)
00824 {
00825 edt_msg(DEBUG2,
00826 "Error in parsing %s.\nExpected:\n\n\t%s: <parameter>\n",
00827 cfgfile, label);
00828 edt_msg(DEBUG2, "\nGot:\n\n\t%s\n", line);
00829 ret = -1;
00830 }
00831 else
00832 {
00833 *arg = v;
00834 ret = 1;
00835 }
00836 }
00837
00838 return ret;
00839 }
00840
00841
00842
00843
00844
00845 int
00846 parse_hex_str(char *str, char *buf)
00847 {
00848 int i = 0;
00849 u_int ibyte;
00850 char *sp = str;
00851
00852 while ((*(sp+2) == ' ') || (*(sp+2) == '\0'))
00853 {
00854 sscanf(sp, "%02x ", &ibyte);
00855 buf[i++] = (char)ibyte;
00856 if (*(sp+2) == '\0')
00857 break;
00858 sp += 3;
00859 }
00860 buf[i] = '\0';
00861 return 1;
00862 }
00863
00864
00865
00866
00867 int
00868 check_str_method(char *line, char *label, char *arg, int max, const char *cfgfile)
00869 {
00870 int ret = 1;
00871 char *p = NULL;
00872 char *sp = NULL;
00873 char *ep;
00874 char endchar;
00875 char tmp_arg[MAXINIT+2];
00876
00877 p = strchr(line, ':');
00878 if (!p)
00879 return (0);
00880
00881 if ((sp = strchr(p, '"')) != NULL)
00882 endchar = '"';
00883 else if ((sp = strchr(p, '<')) != NULL)
00884 endchar = '>';
00885 else return 0;
00886
00887 ep = strrchr(sp, endchar);
00888
00889 if (!check_label(line, label))
00890 return 0;
00891
00892 if ((int) strlen(sp) > max)
00893 {
00894 edt_msg(DEBUG0,
00895 "WARNING parsing %s: '%s' arg exceeds %d char max (truncating)\n",
00896 cfgfile, label, max - 3);
00897 }
00898
00899 if ((p == NULL)
00900 || (sp == NULL)
00901 || (ep == NULL)
00902 || (ep == p))
00903
00904 {
00905 edt_msg(DEBUG2,
00906 "Error in parsing %s.\nExpected:\n\n\t%s: \"command\" (up to %d chars);\n",
00907 cfgfile, label, max - 2);
00908 if (sp)
00909 edt_msg(DEBUG2, "\nGot:\n\n\t%s, %d chars\n", sp, strlen(sp));
00910 else
00911 edt_msg(DEBUG2, "\nGot: Nothing\n");
00912 return 0;
00913 }
00914
00915 strcpy(tmp_arg, ++sp);
00916 if ((int) strlen(sp) > max)
00917 tmp_arg[max-1] = '\0';
00918
00919
00920
00921
00922 if ((ep = strrchr(tmp_arg, endchar)) != NULL)
00923 *ep = '\0';
00924
00925 if (endchar == '>')
00926 ret = parse_hex_str(tmp_arg, arg);
00927 else strncpy(arg, tmp_arg, max);
00928
00929 return ret;
00930 }
00931
00932
00933 int
00934 check_path_method(char *line, char *label, char *arg, const char *cfgfile)
00935 {
00936 int ret = 0;
00937 int n;
00938 char format[32];
00939
00940 if (check_label(line, label))
00941 {
00942 sprintf(format, "%s: %%s", label);
00943 if ((n = sscanf(line, format, arg)) != 1)
00944 {
00945 edt_msg(DEBUG2,
00946 "Error in parsing %s.\nExpected:\n\n\t%s: <parameter>\n",
00947 cfgfile, label);
00948 edt_msg(DEBUG2, "\nGot:\n\n\t%s\n", line);
00949 ret = -1;
00950 }
00951 else
00952 ret = 1;
00953 }
00954
00955 return ret;
00956 }
00957
00958
00959
00960 int
00961 check_serial_init_method(char *line, char *label, char *cmd, const char *cfgfile)
00962 {
00963 char *p = NULL;
00964 char *sp = NULL;
00965 char *ep;
00966 char tmp_arg[MAXINIT+2];
00967
00968 p = strchr(line, ':');
00969 if (!p)
00970 return 0;
00971 sp = strchr(p, '"');
00972 if (!sp)
00973 return 0;
00974 if (!check_label(line, label))
00975 return 0;
00976
00977 if ((p == NULL)
00978 || (*(p + 1) == '\0')
00979 || (sp == NULL)
00980 || (strlen(sp) >= (MAXINIT - 2))
00981 || ((ep = strrchr(sp, '"')) == NULL))
00982
00983 {
00984 edt_msg(DEBUG2,
00985 "Error in parsing %s.\nExpected:\n\n\t%s: \"command\" (up to %d chars);\n",
00986 cfgfile, label, MAXINIT - 2);
00987 if (sp)
00988 edt_msg(DEBUG2, "\nGot:\n\n\t%s, %d chars\n", sp, strlen(sp));
00989 else edt_msg(DEBUG2, "\nGot: Nothing\n");
00990 return 0;
00991 }
00992
00993 strcpy(tmp_arg, ++sp);
00994
00995
00996
00997 ep = strrchr(tmp_arg, '"');
00998 if ((*(ep - 1) != ':') || (*(ep - 2) == '\\'))
00999 *ep++ = ':';
01000 *ep = '\0';
01001
01002 strncpy(cmd, tmp_arg, MAXINIT);
01003 return 1;
01004 }
01005
01006
01007
01008
01009 int
01010 check_hex_method(char *line, char *label, u_int * method, const char *cfgfile)
01011 {
01012 char format[32];
01013 char hexstr[32];
01014
01015 if (!check_label(line, label))
01016 return 0;
01017
01018 sprintf(format, "%s: %%s", label);
01019 if (sscanf(line, format, hexstr) != 1)
01020 {
01021 edt_msg(DEBUG2, "Error in parsing %s. Expected:\n\n\t%s: <hex_parameter>\n", cfgfile, label);
01022 edt_msg(DEBUG2, "\nGot:\n\n\t%s\n", line);
01023 return 0;
01024 }
01025 *method = strtol(hexstr, NULL, 16);
01026 return 1;
01027 }
01028
01029
01030
01031
01032
01033
01034 int
01035 check_other_param(char *s, Dependent * dd_p, Edtinfo *ei_p, const char *cfgfile)
01036 {
01037 int ret;
01038 int tr;
01039 char tmpserial[MAXINIT+2];
01040
01041
01042
01043
01044
01045 if ((ret = check_int_method(s, "width", &dd_p->width, cfgfile)))
01046 return ret;
01047 if ((ret = check_int_method(s, "height", &dd_p->height, cfgfile)))
01048 return ret;
01049 if ((ret = check_int_method(s, "cam_width", &dd_p->cam_width, cfgfile)))
01050 return ret;
01051 if ((ret = check_int_method(s, "cam_height", &dd_p->cam_height, cfgfile)))
01052 return ret;
01053 if ((ret = check_int_method(s, "depth", &dd_p->depth, cfgfile)))
01054 return ret;
01055 if ((ret = check_int_method(s, "extdepth", &dd_p->extdepth, cfgfile)))
01056 return ret;
01057 if ((ret = check_int_method(s, "slop", &dd_p->slop, cfgfile)))
01058 return ret;
01059 if ((ret = check_int_method(s, "hwpad", &dd_p->hwpad, cfgfile)))
01060 return ret;
01061 if ((ret = check_int_method(s, "rgb30", &dd_p->rgb30, cfgfile)))
01062 return ret;
01063 if ((ret = check_int_method(s, "irris_strip", &dd_p->hwpad, cfgfile)))
01064 return ret;
01065 if ((ret = check_int_method(s, "byteswap", &dd_p->byteswap, cfgfile)))
01066 return ret;
01067 if ((ret = check_int_method(s, "shortswap", &dd_p->shortswap, cfgfile)))
01068 return ret;
01069 if ((ret = check_int_method(s, "skip", &dd_p->skip, cfgfile)))
01070 return ret;
01071 if ((ret = check_int_method(s, "gendata", &dd_p->gendata, cfgfile)))
01072 return ret;
01073 if ((ret = check_int_method(s, "skipfrm", &dd_p->gendata, cfgfile)))
01074 return ret;
01075 if ((ret = check_int_method(s, "fixedlen", &dd_p->fixedlen, cfgfile)))
01076 return ret;
01077 if ((ret = check_int_method(s, "interlace", &dd_p->interlace, cfgfile)))
01078 return ret;
01079 if ((ret = check_int_method(s, "simulator_speed", &dd_p->sim_speed, cfgfile)))
01080 return ret;
01081 if ((ret = check_int_method(s, "cameratest", &dd_p->cameratest, cfgfile)))
01082 return ret;
01083 if ((ret = check_int_method(s, "genericsim", &dd_p->genericsim, cfgfile)))
01084 return ret;
01085 if ((ret = check_int_method(s, "disable_mdout", &dd_p->disable_mdout, cfgfile)))
01086 return ret;
01087 if ((ret = check_int_method(s, "sim_width", &dd_p->sim_width, cfgfile)))
01088 return ret;
01089 if ((ret = check_int_method(s, "sim_height", &dd_p->sim_height, cfgfile)))
01090 return ret;
01091 if ((ret = check_int_method(s, "sim_ctl", (int *) (&dd_p->sim_ctl), cfgfile)))
01092 return ret;
01093 if ((ret = check_int_method(s, "line_delay", &dd_p->line_delay, cfgfile)))
01094 return ret;
01095 if ((ret = check_int_method(s, "frame_delay", &dd_p->frame_delay, cfgfile)))
01096 return ret;
01097 if ((ret = check_int_method(s, "frame_height", &dd_p->frame_height, cfgfile)))
01098 return ret;
01099 if ((ret = check_int_method(s, "fv_once", &dd_p->fv_once, cfgfile)))
01100 return ret;
01101 if ((ret = check_int_method(s, "fval_once", &dd_p->fv_once, cfgfile)))
01102 return ret;
01103 if ((ret = check_int_method(s, "fval_done", &dd_p->fval_done, cfgfile)))
01104 return ret;
01105 if ((ret = check_int_method(s, "fv_done", &dd_p->fval_done, cfgfile)))
01106 return ret;
01107 if ((ret = check_int_method(s, "pingpong_varsize", &dd_p->pingpong_varsize, cfgfile)))
01108 return ret;
01109 if ((ret = check_int_method(s, "continuous", &dd_p->continuous, cfgfile)))
01110 return ret;
01111 if ((ret = check_int_method(s, "cnt_continuous", (int *) (&dd_p->cnt_continuous), cfgfile)))
01112 return ret;
01113
01114 if ((ret = check_int_method(s, "shutter_speed_frontp", &dd_p->shutter_speed_frontp, cfgfile)))
01115 return ret;
01116 if ((ret = check_int_method(s, "shutter_speed", &dd_p->shutter_speed, cfgfile)))
01117 return ret;
01118
01119 if ((ret = check_int_method(s, "shutter_speed_min", &dd_p->shutter_speed_min, cfgfile)))
01120 return ret;
01121 if ((ret = check_int_method(s, "shutter_speed_max", &dd_p->shutter_speed_max, cfgfile)))
01122 return ret;
01123
01124 if ((ret = check_int_method(s, "exposure_min", &dd_p->shutter_speed_min, cfgfile)))
01125 return ret;
01126 if ((ret = check_int_method(s, "exposure_max", &dd_p->shutter_speed_max, cfgfile)))
01127 return ret;
01128
01129 if ((ret = check_int_method(s, "aperture_min", &dd_p->aperture_min, cfgfile)))
01130 return ret;
01131 if ((ret = check_int_method(s, "aperture_max", &dd_p->aperture_max, cfgfile)))
01132 return ret;
01133 if ((ret = check_int_method(s, "default_shutter_speed", &dd_p->default_shutter_speed, cfgfile)))
01134 return ret;
01135
01136 if ((ret = check_int_method(s, "default_exposure", &dd_p->default_shutter_speed, cfgfile)))
01137 return ret;
01138 if ((ret = check_int_method(s, "default_aperture", &dd_p->default_aperture, cfgfile)))
01139 return ret;
01140
01141 if ((ret = check_int_method(s, "gain_min", &dd_p->gain_min, cfgfile)))
01142 return ret;
01143 if ((ret = check_int_method(s, "gain_max", &dd_p->gain_max, cfgfile)))
01144 return ret;
01145 if ((ret = check_int_method(s, "default_gain", &dd_p->default_gain, cfgfile)))
01146 return ret;
01147 if ((ret = check_int_method(s, "gain_frontp", &dd_p->gain_frontp, cfgfile)))
01148 return ret;
01149
01150 if ((ret = check_int_method(s, "offset_min", &dd_p->offset_min, cfgfile)))
01151 return ret;
01152 if ((ret = check_int_method(s, "offset_max", &dd_p->offset_max, cfgfile)))
01153 return ret;
01154 if ((ret = check_int_method(s, "offset_frontp", &dd_p->offset_frontp, cfgfile)))
01155 return ret;
01156 if ((ret = check_int_method(s, "default_offset", &dd_p->default_offset, cfgfile)))
01157 return ret;
01158 if ((ret = check_int_method(s, "serial_baud", &dd_p->serial_baud, cfgfile)))
01159 return ret;
01160 if ((ret = check_int_method(s, "DUAL_CHANNEL", &dd_p->dual_channel, cfgfile)))
01161 return ret;
01162 if ((ret = check_int_method(s, "DOUBLE_RATE", &dd_p->double_rate, cfgfile)))
01163 return ret;
01164 if ((ret = check_int_method(s, "ENABLE_DALSA", &dd_p->enable_dalsa, cfgfile)))
01165 return ret;
01166 if ((ret = check_int_method(s, "INV_SHUTTER", &dd_p->inv_shutter, cfgfile)))
01167 return ret;
01168 if ((ret = check_int_method(s, "INV_PTRIG", &dd_p->inv_ptrig, cfgfile)))
01169 return ret;
01170
01171 if ((ret = check_int_method(s, "INV_LVALID", &dd_p->inv_ptrig, cfgfile)))
01172 return ret;
01173
01174 if ((ret = check_int_method(s, "INV_FVALID", &dd_p->inv_fvalid, cfgfile)))
01175 return ret;
01176 if ((ret = check_int_method(s, "TRIG_PULSE", &dd_p->trig_pulse, cfgfile)))
01177 return ret;
01178 if ((ret = check_int_method(s, "DIS_SHUTTER", &dd_p->dis_shutter, cfgfile)))
01179 return ret;
01180
01181 if ((ret = check_int_method(s, "image_offset", &dd_p->image_offset, cfgfile)))
01182 return ret;
01183
01184 if ((ret = check_int_method(s, "markras", &dd_p->markras, cfgfile)))
01185 return ret;
01186 if ((ret = check_int_method(s, "markbin", &dd_p->markbin, cfgfile)))
01187 return ret;
01188 if ((ret = check_int_method(s, "markrx", &dd_p->markrasx, cfgfile)))
01189 return ret;
01190 if ((ret = check_int_method(s, "markry", &dd_p->markrasy, cfgfile)))
01191 return ret;
01192 if ((ret = check_int_method(s, "xilinx_rev", &dd_p->xilinx_rev, cfgfile)))
01193 return ret;
01194 if ((ret = check_int_method(s, "timeout_multiplier", &dd_p->timeout_multiplier, cfgfile)))
01195 return ret;
01196 if ((ret = check_int_method(s, "user_timeout", &dd_p->user_timeout, cfgfile)))
01197 return ret;
01198 if ((ret = check_int_method(s, "timeout", &dd_p->timeout, cfgfile)))
01199 return ret;
01200 if ((ret = check_int_method(s, "linerate", &dd_p->linerate, cfgfile)))
01201 return ret;
01202 if ((ret = check_int_method(s, "header_size", &dd_p->header_size, cfgfile)))
01203 return ret;
01204 if ((ret = check_int_method(s, "photo_trig", &dd_p->photo_trig, cfgfile)))
01205 return ret;
01206 if ((ret = check_int_method(s, "fieldid_trig", &dd_p->fieldid_trig, cfgfile)))
01207 return ret;
01208 if ((ret = check_int_method(s, "slaved_trig", &tr, cfgfile)))
01209 {
01210 dd_p->photo_trig = 1;
01211 dd_p->fieldid_trig = 1;
01212 return ret;
01213 }
01214 if ((ret = check_int_method(s, "acquire_mult", &dd_p->acquire_mult, cfgfile)))
01215 return ret;
01216 if ((ret = check_int_method(s, "sim_enable", &dd_p->sim_enable, cfgfile)))
01217 return ret;
01218 if ((ret = check_int_method(s, "startup_delay", &dd_p->startup_delay, cfgfile)))
01219 return ret;
01220 if ((ret = check_int_method(s, "serial_timeout", &dd_p->serial_timeout, cfgfile)))
01221 return ret;
01222 if ((ret = check_int_method(s, "strobe_count", &dd_p->strobe_count, cfgfile)))
01223 return ret;
01224 if ((ret = check_int_method(s, "strobe_interval", &dd_p->strobe_interval, cfgfile)))
01225 return ret;
01226 if ((ret = check_int_method(s, "mc4", &dd_p->mc4, cfgfile)))
01227 return ret;
01228 if ((ret = check_int_method(s, "expexsync", &dd_p->mc4, cfgfile)))
01229 return ret;
01230 if ((ret = check_int_method(s, "sel_mc4", &dd_p->sel_mc4, cfgfile)))
01231 return ret;
01232 if ((ret = check_int_method(s, "dbl_trig", &dd_p->dbl_trig, cfgfile)))
01233 return ret;
01234 if ((ret = check_int_method(s, "pulnix", &dd_p->pulnix, cfgfile)))
01235 return ret;
01236 if ((ret = check_int_method(s, "interlace", &dd_p->interlace, cfgfile)))
01237 return ret;
01238 if ((ret = check_int_method(s, "image_offset", &dd_p->image_offset, cfgfile)))
01239 return ret;
01240 if ((ret = check_int_method(s, "hskip", &dd_p->hskip, cfgfile)))
01241 return ret;
01242 if ((ret = check_int_method(s, "hactv", &dd_p->hactv, cfgfile)))
01243 return ret;
01244 if ((ret = check_int_method(s, "vskip", &dd_p->vskip, cfgfile)))
01245 return ret;
01246 if ((ret = check_int_method(s, "vactv", &dd_p->vactv, cfgfile)))
01247 return ret;
01248 if ((ret = check_int_method(s, "cameralink", &dd_p->cameralink, cfgfile)))
01249 return ret;
01250 if ((ret = check_int_method(s, "start_delay", &dd_p->start_delay, cfgfile)))
01251 return ret;
01252 if ((ret = check_int_method(s, "pclock_speed", &dd_p->pclock_speed, cfgfile)))
01253 {
01254 dd_p->cls.pixel_clock = (float)dd_p->pclock_speed;
01255 return ret;
01256 }
01257 if ((ret = check_int_method(s, "frame_period", &dd_p->frame_period, cfgfile)))
01258 return ret;
01259
01260
01261 if ((ret = check_int_method(s, "kbs_red_row_first", &dd_p->kbs_red_row_first, cfgfile)))
01262 return ret;
01263 if ((ret = check_int_method(s, "kbs_green_pixel_first", &dd_p->kbs_green_pixel_first, cfgfile)))
01264 return ret;
01265
01266 if ((ret = check_int_method(s, "force_single", &dd_p->force_single, cfgfile)))
01267 return ret;
01268 if ((ret = check_int_method(s, "pause_for_serial", &dd_p->pause_for_serial, cfgfile)))
01269 return ret;
01270 if ((ret = check_int_method(s, "variable_size", &dd_p->variable_size, cfgfile)))
01271 return ret;
01272 if ((ret = check_int_method(s, "header_dma", &dd_p->header_dma, cfgfile)))
01273 return ret;
01274 if ((ret = check_int_method(s, "header_offset", &dd_p->header_offset, cfgfile)))
01275 return ret;
01276
01277 if ((ret = check_int_method(s, "htaps", &dd_p->htaps, cfgfile)))
01278 return ret;
01279 if ((ret = check_int_method(s, "vtaps", &dd_p->vtaps, cfgfile)))
01280 return ret;
01281
01282 if ((ret = check_int_method(s, "serial_init_delay", &ei_p->serial_init_delay, cfgfile)))
01283 return ret;
01284
01285 if ((ret = check_int_method(s, "mode16", &dd_p->mode16, cfgfile)))
01286 return ret;
01287
01288 if ((ret = check_byte_method(s, "irig_raw", &dd_p->irig_raw, cfgfile)))
01289 return ret;
01290 if ((ret = check_byte_method(s, "irig_offset", &dd_p->irig_offset, cfgfile)))
01291 return ret;
01292 if ((ret = check_byte_method(s, "irig_slave", &dd_p->irig_slave, cfgfile)))
01293 return ret;
01294
01295
01296
01297
01298 if ((ret = check_hex_method(s, "DIRECTION", (u_int *) &dd_p->direction, cfgfile)))
01299 return ret;
01300 if ((ret = check_hex_method(s, "MODE_CNTL_NORM", (u_int *) &dd_p->mode_cntl_norm, cfgfile)))
01301 return ret;
01302
01303 if ((ret = check_hex_method(s, "CL_DATA_PATH_NORM", (u_int *) &dd_p->cl_data_path, cfgfile)))
01304 {
01305 dd_p->cameralink = 1;
01306 return ret;
01307 }
01308 if ((ret = check_hex_method(s, "CL_CFG_NORM", (u_int *) &dd_p->cl_cfg, cfgfile)))
01309 {
01310 dd_p->cameralink = 1;
01311 return ret;
01312 }
01313 if ((ret = check_hex_method(s, "CL_CFG2_NORM", (u_int *) &dd_p->cl_cfg2, cfgfile)))
01314 {
01315 dd_p->cameralink = 1;
01316 return ret;
01317 }
01318 if ((ret = check_hex_method(s, "CL_HMAX_NORM", (u_int *) &dd_p->cl_hmax, cfgfile)))
01319 {
01320 dd_p->cameralink = 1;
01321 return ret;
01322 }
01323 if ((ret = check_hex_method(s, "CL_MGTSPEED_NORM", (u_int *) &ei_p->cl_mgtspeed, cfgfile)))
01324 {
01325 dd_p->cameralink = 1;
01326 return ret;
01327 }
01328
01329 if ((ret = check_hex_method(s, "trigdiv", (u_int *) &dd_p->trigdiv, cfgfile)))
01330 return ret;
01331 if ((ret = check_hex_method(s, "maxdmasize", (u_int *) &dd_p->maxdmasize, cfgfile)))
01332 return ret;
01333 if ((ret = check_hex_method(s, "util2", (u_int *) &dd_p->util2, cfgfile)))
01334 return ret;
01335 if ((ret = check_hex_method(s, "shift", (u_int *) &dd_p->shift, cfgfile)))
01336 return ret;
01337 if ((ret = check_hex_method(s, "UTIL24", (u_int *) &dd_p->shift, cfgfile)))
01338 return ret;
01339 if ((ret = check_hex_method(s, "mask", (u_int *) &dd_p->mask, cfgfile)))
01340 return ret;
01341
01342
01343 if ((ret = check_hex_method(s, "serial_waitc", &dd_p->serial_waitc, cfgfile)))
01344 return ret;
01345
01346
01347 if ((ret = check_hex_method(s, "serial_waitchar", &dd_p->serial_waitc, cfgfile)))
01348 return ret;
01349
01350
01351
01352
01353 if ((ret = check_path_method(s, "rbtfile", dd_p->rbtfile, cfgfile)))
01354 return ret;
01355
01356 if ((ret = check_path_method(s, "interlace_module", dd_p->interlace_module, cfgfile)))
01357 {
01358 dd_p->swinterlace = PDV_INTLV_USER;
01359 return ret;
01360 }
01361
01362 if ((ret = check_path_method(s, "camera_download_file", dd_p->camera_download_file, cfgfile)))
01363 return ret;
01364
01365 if ((ret = check_path_method(s, "camera_command_file", dd_p->camera_command_file, cfgfile)))
01366 return ret;
01367
01368
01369
01370
01371 if ((ret = check_serial_init_method(s, "serial_init", tmpserial, cfgfile)))
01372 {
01373 if (strlen(tmpserial) >= MAXINIT)
01374 {
01375 edt_msg(DEBUG0, "Error in parsing %s.\nSerial init exceeds max of %s chars\n", s, MAXINIT-1);
01376 return 0;
01377 }
01378
01379 add_serial_init_node(ei_p, serial_tag_ascii, tmpserial);
01380 return ret;
01381 }
01382
01383
01384 if ((ret = check_str_method(s, "serial_binit", tmpserial, MAXINIT+1, cfgfile)))
01385 {
01386 if (strlen(tmpserial) >= MAXINIT)
01387 {
01388 edt_msg(DEBUG0, "Error in parsing %s.\nSerial init exceeds max of %s chars\n", s, MAXINIT-1);
01389 return 0;
01390 }
01391
01392 add_serial_init_node(ei_p, serial_tag_binary, tmpserial);
01393 return ret;
01394 }
01395
01396 if ((ret = check_str_method(s, "serial_init_baslerf", tmpserial, MAXINIT+1, cfgfile)))
01397 {
01398 if (strlen(tmpserial) >= MAXINIT)
01399 {
01400 edt_msg(DEBUG0, "Error in parsing %s.\nSerial init exceeds max of %s chars\n", s, MAXINIT-1);
01401 return 0;
01402 }
01403
01404 add_serial_init_node(ei_p, serial_tag_baslerf, tmpserial);
01405 return ret;
01406 }
01407
01408 if ((ret = check_str_method(s, "serial_init_duncanf", tmpserial, MAXINIT+1, cfgfile)))
01409 {
01410 if (strlen(tmpserial) >= MAXINIT)
01411 {
01412 edt_msg(DEBUG0, "Error in parsing %s.\nSerial init exceeds max of %s chars\n", s, MAXINIT-1);
01413 return 0;
01414 }
01415
01416 add_serial_init_node(ei_p, serial_tag_duncanf, tmpserial);
01417 return ret;
01418 }
01419
01420 if ((ret = check_serial_init_method(s, "xilinx_init", dd_p->xilinx_init, cfgfile)))
01421 return ret;
01422
01423 if ((ret = check_str_method(s, "cameratype", dd_p->cameratype, CAMNAMELEN, cfgfile)))
01424 return ret;
01425 if ((ret = check_str_method(s, "camera_class", dd_p->camera_class, CAMCLASSLEN, cfgfile)))
01426 return ret;
01427 if ((ret = check_str_method(s, "camera_model", dd_p->camera_model, MAXSER, cfgfile)))
01428 return ret;
01429 if ((ret = check_str_method(s, "camera_info", dd_p->camera_info, MAXSER*2, cfgfile)))
01430 return ret;
01431 if ((ret = check_str_method(s, "serial_gain", dd_p->serial_gain, MAXSER, cfgfile)))
01432 return ret;
01433 if ((ret = check_str_method(s, "serial_offset", dd_p->serial_offset, MAXSER, cfgfile)))
01434 return ret;
01435 if ((ret = check_str_method(s, "serial_exposure", dd_p->serial_exposure, MAXSER, cfgfile)))
01436 return ret;
01437 if ((ret = check_str_method(s, "serial_prefix", dd_p->serial_prefix, MAXSER, cfgfile)))
01438 return ret;
01439 if ((ret = check_str_method(s, "serial_binning", dd_p->serial_binning, MAXSER, cfgfile)))
01440 return ret;
01441 if ((ret = check_str_method(s, "serial_term", dd_p->serial_term, MAXSER, cfgfile)))
01442 return ret;
01443 if ((ret = check_str_method(s, "serial_response", dd_p->serial_response, MAXSER, cfgfile)))
01444 return ret;
01445 if ((ret = check_str_method(s, "serial_trigger", dd_p->serial_trigger, MAXSER, cfgfile)))
01446 return ret;
01447 {
01448 char line_interleave[81];
01449 if ((ret = check_str_method(s, "line_interleave", line_interleave, 80, cfgfile)))
01450 {
01451
01452 int i;
01453 char *tok = strtok(line_interleave, " \t");
01454 dd_p->n_intlv_taps = atoi(tok);
01455 for (i=0;i<dd_p->n_intlv_taps;i++)
01456 {
01457 char *tok1 = strtok(NULL," \t");
01458 char *tok2 = strtok(NULL," \t");
01459
01460 if (tok1 == NULL || tok2 == NULL)
01461 {
01462 edt_msg(DEBUG2,
01463 "Error in parsing interleave in %s.\nNot Enough arguments for %d channels\n",
01464 cfgfile, dd_p->n_intlv_taps);
01465 return -1;
01466 }
01467 else
01468 {
01469 dd_p->intlv_taps[i].startx = atoi(tok1);
01470 dd_p->intlv_taps[i].dx = atoi(tok2);
01471 }
01472 }
01473
01474 dd_p->swinterlace = PDV_LINE_INTLV;
01475
01476 return ret;
01477 }
01478 }
01479
01480 return 0;
01481 }
01482
01483 int
01484 check_cls_param(char *s, PdvDependent *dd_p, const char *cfgfile)
01485
01486 {
01487 int ret;
01488
01489 int val;
01490
01491 if ((ret = check_int_method(s, "cls_linescan", &val, cfgfile)))
01492 {
01493 dd_p->cls.flags.Cfg.linescan = val;
01494 return ret;
01495 }
01496 if ((ret = check_int_method(s, "cls_lvcont", &val, cfgfile)))
01497 {
01498 dd_p->cls.flags.Cfg.lvcont = val;
01499 return ret;
01500 }
01501 if ((ret = check_int_method(s, "cls_rven", &val, cfgfile)))
01502 {
01503 dd_p->cls.flags.Cfg.rven = val;
01504 return ret;
01505 }
01506 if ((ret = check_int_method(s, "cls_uartloop", &val, cfgfile)))
01507 {
01508 dd_p->cls.flags.Cfg.uartloop = val;
01509 return ret;
01510 }
01511 if ((ret = check_int_method(s, "cls_smallok", &val, cfgfile)))
01512 {
01513 dd_p->cls.flags.Cfg.smallok = val;
01514 return ret;
01515 }
01516 if ((ret = check_int_method(s, "cls_intlven", &val, cfgfile)))
01517 {
01518 dd_p->cls.flags.Cfg.intlven = val;
01519 return ret;
01520 }
01521 if ((ret = check_int_method(s, "cls_firstfc", &val, cfgfile)))
01522 {
01523 dd_p->cls.flags.Cfg.firstfc = val;
01524 return ret;
01525 }
01526 if ((ret = check_int_method(s, "cls_datacnt", &val, cfgfile)))
01527 {
01528 dd_p->cls.flags.Cfg.datacnt = val;
01529 return ret;
01530 }
01531
01532 if ((ret = check_int_method(s, "cls_dvskip", &val, cfgfile)))
01533 {
01534 dd_p->cls.flags.Cfg.dvskip = val;
01535 return ret;
01536 }
01537
01538 if ((ret = check_int_method(s, "cls_dvmode", &val, cfgfile)))
01539 {
01540 dd_p->cls.flags.Cfg.dvmode = val;
01541 return ret;
01542 }
01543 if ((ret = check_int_method(s, "cls_led", &val, cfgfile)))
01544 {
01545 dd_p->cls.flags.Cfg.led = val;
01546 return ret;
01547 }
01548 if ((ret = check_int_method(s, "cls_trigsrc", &val, cfgfile)))
01549 {
01550 dd_p->cls.flags.Cfg.trigsrc = val;
01551 return ret;
01552 }
01553 if ((ret = check_int_method(s, "cls_trigpol", &val, cfgfile)))
01554 {
01555 dd_p->cls.flags.Cfg.trigpol = val;
01556 return ret;
01557 }
01558 if ((ret = check_int_method(s, "cls_taps", &val, cfgfile)))
01559 {
01560 dd_p->cls.taps = val;
01561 return ret;
01562 }
01563 if ((ret = check_int_method(s, "cls_trigframe", &val, cfgfile)))
01564 {
01565 dd_p->cls.flags.Cfg.trigframe = val;
01566 return ret;
01567 }
01568
01569 if ((ret = check_int_method(s, "cls_trigline", (int *) &val, cfgfile)))
01570 {
01571 dd_p->cls.flags.Cfg.trigline = val;
01572 return ret;
01573 }
01574
01575 if ((ret = check_hex_method(s, "cls_filla", (u_int *)&val, cfgfile)))
01576 {
01577 dd_p->cls.FillA = val;
01578 return ret;
01579 }
01580
01581 if ((ret = check_hex_method(s, "cls_fillb", (u_int *)&val, cfgfile)))
01582 {
01583 dd_p->cls.FillB = val;
01584 return ret;
01585 }
01586
01587 if ((ret = check_ushort_method(s, "cls_hgap", &dd_p->cls.hblank, cfgfile)))
01588 return ret;
01589 if ((ret = check_ushort_method(s, "cls_hcntmax",
01590 &dd_p->cls.Hcntmax, cfgfile)))
01591 return ret;
01592
01593 if ((ret = check_ulong_method(s, "cls_vgap", (u_long *)&dd_p->cls.vblank, cfgfile)))
01594 return ret;
01595 if ((ret = check_ulong_method(s, "cls_vcntmax", (u_long *)&dd_p->cls.Vcntmax, cfgfile)))
01596 return ret;
01597
01598 if ((ret = check_ushort_method(s, "cls_hfvstart", &dd_p->cls.Hfvstart, cfgfile)))
01599 return ret;
01600 if ((ret = check_ushort_method(s, "cls_hfvend", &dd_p->cls.Hfvend, cfgfile)))
01601 return ret;
01602
01603 if ((ret = check_ushort_method(s, "cls_hlvstart", &dd_p->cls.Hlvstart, cfgfile)))
01604 return ret;
01605 if ((ret = check_ushort_method(s, "cls_hlvend", &dd_p->cls.Hlvend, cfgfile)))
01606 return ret;
01607
01608 if ((ret = check_ushort_method(s, "cls_hrvstart", &dd_p->cls.Hrvstart, cfgfile)))
01609 return ret;
01610 if ((ret = check_ushort_method(s, "cls_hrvend", &dd_p->cls.Hrvend, cfgfile)))
01611 return ret;
01612
01613 if ((ret = check_float_method(s, "cls_pixel_clock", &dd_p->cls.pixel_clock, cfgfile)))
01614 {
01615 dd_p->pclock_speed = (int)(dd_p->cls.pixel_clock + 0.5);
01616 return ret;
01617 }
01618
01619
01620 return 0;
01621 }
01622
01623 int
01624 check_xilinx_param(char *s, Dependent * dd_p, const char *cfgfile)
01625 {
01626 int index = 0;
01627 u_int reg = 0;
01628 u_int value = 0;
01629 char hexstr[64];
01630
01631 if (strncmp(s, "xregwrite_", 10) == 0)
01632 {
01633 if (sscanf(s, "xregwrite_0x%x: %s", ®, hexstr) != 2)
01634 {
01635 if (sscanf(s, "xregwrite_%d: %s", ®, hexstr) != 2)
01636 {
01637 edt_msg(DEBUG2,
01638 "Error in parsing %s. Expected:\n\n\txregwrite_<decimal_reg>: <hex_parameter> or xregwrite_0x<hex_reg>: <hex_parameter>\n", cfgfile);
01639 edt_msg(DEBUG2, "\nGot:\n\n\t%s\n", s);
01640 return 0;
01641 }
01642 }
01643
01644 if (reg > 0xfe)
01645 {
01646 edt_msg(DEBUG2,
01647 "Error in parsing %s. Address %d is out of range for xilinx_%d.\n",
01648 cfgfile, reg, reg);
01649 edt_msg(DEBUG2, "Legal values are 0 through 254\n");
01650 return -1;
01651 }
01652
01653 value = strtol(hexstr, NULL, 16);
01654
01655 if (value > 0xff)
01656 {
01657 edt_msg(DEBUG2,
01658 "Error in parsing %s. Value %x is out of range for xilinx_%d.\n",
01659 cfgfile, value, reg);
01660 edt_msg(DEBUG2, "Legal values are 0 through ff\n");
01661 return -1;
01662 }
01663
01664
01665
01666
01667
01668 while ((index < 32) && dd_p->xilinx_flag[index] != 0xff)
01669 ++index;
01670
01671 if (index >= 32)
01672 printf("Error! Too_many xregwrite_ directives (max 32)\n");
01673 else
01674 {
01675 dd_p->xilinx_flag[index] = reg;
01676 dd_p->xilinx_value[index] = value;
01677 }
01678 return 1;
01679 }
01680 else return 0;
01681
01682 }
01683
01684 int
01685 check_method_param(char *s, Dependent * dd_p, Edtinfo * ei_p, const char *cfgfile)
01686 {
01687 int ret = 0;
01688 int method_number;
01689 char method_type[64], method_arg[128];
01690 int n;
01691
01692 if (strncmp(s, "method_", 7) == 0)
01693 {
01694 if ((n = sscanf(s, "%s %s", method_type, method_arg)) != 2)
01695 {
01696 edt_msg(DEBUG2,
01697 "Error in parsing %s.\nExpected:\n\n\t%s: <method>: <parameter>\n",
01698 cfgfile, method_type);
01699 edt_msg(DEBUG2, "\nGot:\n\n\t%s\n", s);
01700 return -1;
01701 }
01702 method_type[strlen(method_type) - 1] = '\0';
01703
01704 if (translate_method_arg(method_arg, &method_number))
01705 {
01706 ret = set_method(dd_p, ei_p, method_type, method_number);
01707 }
01708 else
01709 ret = 0;
01710 }
01711 return ret;
01712 }
01713
01714 int
01715 printcfg(Dependent * dd_p)
01716 {
01717 edt_msg(DEBUG2, "\nDependent Struct -- %d bytes (max %d)\n", sizeof(dd_p));
01718 edt_msg(DEBUG2, "-------------------------------------------\n");
01719 edt_msg(DEBUG2, "cameratype '%s'\n", dd_p->cameratype);
01720 edt_msg(DEBUG2, "rbtfile '%s'\n", dd_p->rbtfile);
01721 edt_msg(DEBUG2, "cfgname '%s'\n", dd_p->cfgname);
01722 edt_msg(DEBUG2, "interlace_module '%s'\n", dd_p->interlace_module);
01723 edt_msg(DEBUG2, "width %d\n", dd_p->width);
01724 edt_msg(DEBUG2, "height %d\n", dd_p->height);
01725 edt_msg(DEBUG2, "depth %d\n", dd_p->depth);
01726 edt_msg(DEBUG2, "extdepth %d\n", dd_p->extdepth);
01727 edt_msg(DEBUG2, "slop %d\n", dd_p->slop);
01728 edt_msg(DEBUG2, "image_offset %d\n", dd_p->image_offset);
01729 edt_msg(DEBUG2, "interlace %d\n", dd_p->interlace);
01730 edt_msg(DEBUG2, "swinterlace %d\n", dd_p->swinterlace);
01731 edt_msg(DEBUG2, "default_shutter_speed %d\n", dd_p->default_shutter_speed);
01732 edt_msg(DEBUG2, "shutter_speed_frontp %d\n", dd_p->shutter_speed_frontp);
01733 edt_msg(DEBUG2, "shutter_speed_min %d\n", dd_p->shutter_speed_min);
01734 edt_msg(DEBUG2, "shutter_speed_max %d\n", dd_p->shutter_speed_max);
01735 edt_msg(DEBUG2, "shutter_speed %d\n", dd_p->shutter_speed);
01736 edt_msg(DEBUG2, "default_aperture %d\n", dd_p->default_aperture);
01737 edt_msg(DEBUG2, "aperture_min %d\n", dd_p->aperture_min);
01738 edt_msg(DEBUG2, "aperture_max %d\n", dd_p->aperture_max);
01739 edt_msg(DEBUG2, "aperture %d\n", dd_p->aperture);
01740 edt_msg(DEBUG2, "default_gain %d\n", dd_p->default_gain);
01741 edt_msg(DEBUG2, "gain_frontp %d\n", dd_p->gain_frontp);
01742 edt_msg(DEBUG2, "gain_min %d\n", dd_p->gain_min);
01743 edt_msg(DEBUG2, "gain_max %d\n", dd_p->gain_max);
01744 edt_msg(DEBUG2, "default_offset %d\n", dd_p->default_offset);
01745 edt_msg(DEBUG2, "offset_frontp %d\n", dd_p->offset_frontp);
01746 edt_msg(DEBUG2, "offset_min %d\n", dd_p->offset_min);
01747 edt_msg(DEBUG2, "offset_max %d\n", dd_p->offset_max);
01748 edt_msg(DEBUG2, "continuous %d\n", dd_p->continuous);
01749 edt_msg(DEBUG2, "inv_shutter %d\n", dd_p->inv_shutter);
01750 edt_msg(DEBUG2, "trig_pulse %d\n", dd_p->trig_pulse);
01751 edt_msg(DEBUG2, "dis_shutter %d\n", dd_p->dis_shutter);
01752 edt_msg(DEBUG2, "mode_cntl_norm %04x\n", dd_p->mode_cntl_norm);
01753 edt_msg(DEBUG2, "trigdiv %d\n", dd_p->trigdiv);
01754 edt_msg(DEBUG2, "maxdmasize %d\n", dd_p->maxdmasize);
01755 edt_msg(DEBUG2, "direction %04x\n", dd_p->direction);
01756 edt_msg(DEBUG2, "cameratest %d\n", dd_p->cameratest);
01757 edt_msg(DEBUG2, "genericsim %d\n", dd_p->genericsim);
01758 edt_msg(DEBUG2, "sim_width %d\n", dd_p->sim_width);
01759 edt_msg(DEBUG2, "sim_height %d\n", dd_p->sim_height);
01760 edt_msg(DEBUG2, "line_delay %d\n", dd_p->line_delay);
01761 edt_msg(DEBUG2, "frame_delay %d\n", dd_p->frame_delay);
01762 edt_msg(DEBUG2, "frame_height %d\n", dd_p->frame_height);
01763 edt_msg(DEBUG2, "framesync_mode %d\n", dd_p->framesync_mode);
01764 edt_msg(DEBUG2, "fv_once %d\n", dd_p->fv_once);
01765 edt_msg(DEBUG2, "enable_dalsa %d\n", dd_p->enable_dalsa);
01766 edt_msg(DEBUG2, "lock_shutter %d\n", dd_p->lock_shutter);
01767 edt_msg(DEBUG2, "camera_shutter_timing %d\n", dd_p->camera_shutter_timing);
01768 edt_msg(DEBUG2, "camera_continuous %d\n", dd_p->camera_continuous);
01769 edt_msg(DEBUG2, "camera_binning %d\n", dd_p->camera_binning);
01770 edt_msg(DEBUG2, "camera_data_rate %d\n", dd_p->camera_data_rate);
01771 edt_msg(DEBUG2, "camera_download %d\n", dd_p->camera_download);
01772 edt_msg(DEBUG2, "get_gain %d\n", dd_p->get_gain);
01773 edt_msg(DEBUG2, "get_offset %d\n", dd_p->get_offset);
01774 edt_msg(DEBUG2, "set_gain %d\n", dd_p->set_gain);
01775 edt_msg(DEBUG2, "set_offset %d\n", dd_p->set_offset);
01776 edt_msg(DEBUG2, "first_open %d\n", dd_p->first_open);
01777 edt_msg(DEBUG2, "last_close %d\n", dd_p->last_close);
01778 edt_msg(DEBUG2, "image_depth %d\n", dd_p->image_depth);
01779 edt_msg(DEBUG2, "header_type %d\n", dd_p->header_type);
01780 edt_msg(DEBUG2, "interlace_offset %d\n", dd_p->interlace_offset);
01781 edt_msg(DEBUG2, "serial_exposure %s", dd_p->serial_exposure);
01782 edt_msg(DEBUG2, "serial_gain '%s'", dd_p->serial_gain);
01783 edt_msg(DEBUG2, "serial_offset '%s'x'\n", dd_p->serial_offset);
01784 edt_msg(DEBUG2, "serial_prefix %s'x\n", dd_p->serial_prefix);
01785 edt_msg(DEBUG2, "serial_term %s'x\n", dd_p->serial_term);
01786 edt_msg(DEBUG2, "timeout_multiplier %d\n", dd_p->timeout_multiplier);
01787 edt_msg(DEBUG2, "datapath_reg %04x\n", dd_p->datapath_reg);
01788 edt_msg(DEBUG2, "config_reg %04x\n", dd_p->config_reg);
01789 edt_msg(DEBUG2, "rgb30 %d\n", dd_p->rgb30);
01790 edt_msg(DEBUG2, "markras %04x\n", dd_p->markras);
01791 edt_msg(DEBUG2, "markrasx %04x\n", dd_p->markrasx);
01792 edt_msg(DEBUG2, "markrasy %04x\n", dd_p->markrasy);
01793 edt_msg(DEBUG2, "markbin %04x\n", dd_p->markbin);
01794 edt_msg(DEBUG2, "disable_mdout %d\n", dd_p->disable_mdout);
01795 return (sizeof(Dependent));
01796 }
01797
01798
01799 void
01800 strip_ctrlm(char *s)
01801 {
01802 if (s)
01803 if (s[strlen(s) - 1] == '\r')
01804 s[strlen(s) - 1] = '\0';
01805 }
01806
01807 void
01808 strip_extra_whitespace(char *s)
01809 {
01810 unsigned int i, j=0;
01811 int got_colon = 0;
01812 char tmpstr[MAXINIT];
01813
01814 for (i=0; i<strlen(s); i++)
01815 {
01816 if (s[i] == ':')
01817 got_colon = 1;
01818 if (got_colon)
01819 tmpstr[j++] = s[i];
01820 else if ((s[i] != ' ') && (s[i] != ' '))
01821 tmpstr[j++] = s[i];
01822
01823 }
01824 tmpstr[j] = '\0';
01825 strcpy(s, tmpstr);
01826 }
01827
01828 int
01829 resolve_cameratype(Dependent *dd_p)
01830 {
01831 char tmpstr[256];
01832
01833 if (!(*dd_p->cameratype))
01834 {
01835 sprintf(dd_p->cameratype, "%s%s%s%s%s", dd_p->camera_class,
01836 *dd_p->camera_model? " ":"", dd_p->camera_model,
01837 *dd_p->camera_info? " ":"", dd_p->camera_info);
01838 }
01839
01840
01841
01842
01843 if ((*dd_p->cameratype && *dd_p->camera_class))
01844 {
01845 if (strncmp(dd_p->camera_class, dd_p->cameratype,
01846 strlen(dd_p->camera_class)) != 0)
01847 {
01848 sprintf(tmpstr, "%s %s", dd_p->camera_class, dd_p->cameratype);
01849 strcpy(dd_p->cameratype, tmpstr);
01850 }
01851 }
01852
01853 if (*dd_p->cameratype)
01854 return 1;
01855 return 0;
01856 }
01857
01858 void
01859 add_serial_init_node(Edtinfo *ei_p, enum serial_tag tag, char *serial_init)
01860 {
01861 SerialInitNode *newp = (SerialInitNode *)malloc(sizeof(SerialInitNode));
01862 SerialInitNode *nextp = ei_p->serial_init;
01863
01864 if (ei_p->serial_init == NULL)
01865 ei_p->serial_init = newp;
01866
01867 else
01868 {
01869 while (nextp->next)
01870 nextp = nextp->next;
01871 nextp->next = newp;
01872 }
01873
01874 newp->next = NULL;
01875 newp->tag = tag;
01876 newp->data = (char *)malloc(strlen(serial_init) + 2);
01877 strcpy(newp->data, serial_init);
01878 }
01879