00001
00006 #include "edtinc.h"
00007 #include "clsim_lib.h"
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 void pdv_cls_set_size(PdvDev *pdv_p,
00022 int taps,
00023 int depth ,
00024 int width,
00025 int height,
00026 int hblank,
00027 int totalwidth,
00028 int vblank,
00029 int totalheight)
00030
00031 {
00032 PdvDependent *dd_p = pdv_p->dd_p;
00033 int clocks;
00034
00035 if (taps == 0)
00036 taps = 1;
00037
00038 clocks = width / taps;
00039
00040 if (hblank)
00041 totalwidth = clocks + hblank;
00042
00043 if (vblank)
00044 totalheight = height + vblank;
00045
00046
00047
00048 edt_reg_write(pdv_p, PDV_CLSIM_HCNTMAX, totalwidth-1);
00049 edt_reg_write(pdv_p, PDV_CLSIM_VACTV, height-1);
00050 edt_reg_write(pdv_p, PDV_CLSIM_VCNTMAX, totalheight-1);
00051
00052 edt_reg_write(pdv_p, PDV_CL_DATA_PATH, pdv_p->dd_p->cl_data_path);
00053
00054 edt_reg_write(pdv_p, PDV_CFG, 0);
00055 }
00056
00057
00058
00059
00060
00061
00062
00063 void
00064 pdv_cls_set_line_timing(PdvDev *pdv_p,
00065 int width,
00066 int taps,
00067 int Hfvstart,
00068 int Hfvend,
00069 int Hlvstart,
00070 int Hlvend,
00071 int Hrvstart,
00072 int Hrvend)
00073
00074 {
00075 int clocks;
00076
00077 if (taps == 0)
00078 taps = 1;
00079
00080 clocks = width / taps;
00081
00082 edt_reg_write(pdv_p, PDV_CLSIM_HFVSTART, Hfvstart);
00083 edt_reg_write(pdv_p, PDV_CLSIM_HFVEND, (Hfvend)?Hfvend:Hfvstart+clocks);
00084
00085 edt_reg_write(pdv_p, PDV_CLSIM_HLVSTART, Hlvstart);
00086 edt_reg_write(pdv_p, PDV_CLSIM_HLVEND, (Hlvend)?Hlvend:Hlvstart+clocks);
00087
00088 edt_reg_write(pdv_p, PDV_CLSIM_HRVSTART, Hrvstart);
00089 edt_reg_write(pdv_p, PDV_CLSIM_HRVEND, (Hrvend)?Hrvend:Hrvstart+clocks);
00090
00091 }
00092
00093 int
00094 pdv_cls_get_hgap(PdvDev *pdv_p)
00095
00096 {
00097 int totalcnt;
00098 int clocks;
00099 int taps;
00100 int rgb;
00101
00102 rgb = edt_reg_read(pdv_p, PDV_CL_CFG) & 1;
00103
00104 totalcnt = edt_reg_read(pdv_p, PDV_CLSIM_HCNTMAX) + 1;
00105
00106 if (rgb)
00107 taps = 1;
00108 else if (pdv_get_depth(pdv_p) > 8)
00109 taps = 1;
00110 else
00111 taps = (edt_reg_read(pdv_p, PDV_CL_DATA_PATH) >> 4) + 1;
00112
00113 clocks = pdv_get_width(pdv_p) / taps;
00114
00115 return totalcnt - clocks;
00116
00117 }
00118
00119 int
00120 pdv_cls_get_vgap(PdvDev *pdv_p)
00121
00122 {
00123 int totalcnt;
00124 int vactv;
00125
00126 totalcnt = edt_reg_read(pdv_p, PDV_CLSIM_VCNTMAX) + 1;
00127
00128 vactv = edt_reg_read(pdv_p, PDV_CLSIM_VACTV) + 1;
00129
00130 return totalcnt - vactv;
00131
00132 }
00133
00134
00135
00136
00137
00138
00139 void
00140 pdv_cls_init_serial(PdvDev *pdv_p)
00141
00142 {
00143 pdv_reset_serial(pdv_p);
00144
00145 edt_reg_write(pdv_p, PDV_CMD, 1);
00146
00147 edt_reg_write(pdv_p, PDV_SERIAL_DATA_CNTL, 3);
00148 edt_reg_write(pdv_p, PDV_BYTESWAP, 0);
00149
00150 pdv_serial_read_enable(pdv_p);
00151 }
00152
00153
00154
00155
00156
00157
00158 void pdv_cls_set_cfg_bit(PdvDev *pdv_p,
00159 int reg,
00160 int mask,
00161 int state)
00162
00163 {
00164 int cfg = edt_reg_read(pdv_p, reg);
00165
00166 cfg = (cfg & ~mask) | ((state)? mask : 0);
00167
00168 edt_reg_write(pdv_p, reg, cfg);
00169
00170 }
00171
00172
00173
00174
00175
00176 void
00177 pdv_cls_set_linescan(PdvDev *pdv_p, int state)
00178
00179 {
00180 pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGA, 0x80, state);
00181 }
00182
00183 void
00184 pdv_cls_set_lvcont(PdvDev *pdv_p, int state)
00185
00186 {
00187 pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGA, 0x40, state);
00188 }
00189
00190 void
00191 pdv_cls_set_rven(PdvDev *pdv_p, int state)
00192
00193 {
00194 pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGA, 0x20, state);
00195 }
00196
00197 void
00198 pdv_cls_set_uartloop(PdvDev *pdv_p, int state)
00199
00200 {
00201 pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGA, 0x10, state);
00202 }
00203
00204 void
00205 pdv_cls_set_smallok(PdvDev *pdv_p, int state)
00206
00207 {
00208 pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGA, 8, state);
00209 }
00210
00211 void
00212 pdv_cls_set_intlven(PdvDev *pdv_p, int state)
00213
00214 {
00215 pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGA, 4, state);
00216 }
00217
00218 void
00219 pdv_cls_set_firstfc(PdvDev *pdv_p, int state)
00220
00221 {
00222 pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGA, 2, state);
00223 }
00224
00225 void
00226 pdv_cls_set_datacnt(PdvDev *pdv_p, int state)
00227
00228 {
00229 pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGA, 1, state);
00230 }
00231
00232 void
00233 pdv_cls_set_led(PdvDev *pdv_p, int state)
00234
00235 {
00236 pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGC, 0x80,state);
00237 }
00238
00239 void
00240 pdv_cls_set_trigsrc(PdvDev *pdv_p, int state)
00241
00242 {
00243 pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGC, 8,state);
00244 }
00245 void
00246 pdv_cls_set_trigpol(PdvDev *pdv_p, int state)
00247
00248 {
00249 pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGC, 4,state);
00250 }
00251
00252 void
00253 pdv_cls_set_trigframe(PdvDev *pdv_p, int state)
00254
00255 {
00256 pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGC, 2,state);
00257 }
00258 void
00259 pdv_cls_set_trigline(PdvDev *pdv_p, int state)
00260
00261 {
00262 pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGC, 1,state);
00263 }
00264 void
00265 pdv_cls_sim_start(PdvDev *pdv_p)
00266
00267 {
00268 edt_reg_write(pdv_p, PDV_CFG, 0);
00269 }
00270
00271 void
00272 pdv_cls_sim_stop(PdvDev *pdv_p)
00273
00274 {
00275
00276 edt_reg_write(pdv_p, PDV_CFG, 8);
00277 }
00278
00279 void
00280 pdv_cls_set_height(PdvDev *pdv_p, int rasterlines, int vblank)
00281
00282 {
00283 edt_reg_write(pdv_p, PDV_CLSIM_VACTV, rasterlines-1);
00284
00285 if (vblank > 0)
00286 edt_reg_write(pdv_p, PDV_CLSIM_VCNTMAX, rasterlines-1+vblank);
00287
00288 }
00289
00290 void
00291 pdv_cls_set_width(PdvDev *pdv_p, int width, int hblank)
00292
00293 {
00294 int totalwidth;
00295 int taps = edt_reg_read(pdv_p, PDV_CL_DATA_PATH);
00296
00297 taps = (taps >> 4) + 1;
00298
00299 if (taps == 0)
00300 taps = 1;
00301
00302 totalwidth = width / taps;
00303
00304 if (hblank)
00305 totalwidth += hblank;
00306
00307
00308
00309 edt_reg_write(pdv_p, PDV_CLSIM_HCNTMAX, totalwidth-1);
00310
00311 pdv_cls_set_line_timing(pdv_p,
00312 width,
00313 taps,0,0,0,0,0,0);
00314
00315 }
00316
00317
00318
00319 void pdv_cls_set_clock(PdvDev *pdv_p, double freq)
00320
00321 {
00322 int hex,
00323 bit,
00324 dbit,
00325 m,
00326 n,
00327 n2,
00328 b,
00329 m_best,
00330 n_best;
00331 double ref=14.0;
00332 double targ35,
00333 best35,
00334 current35;
00335 double err_current35,
00336 err_best35,
00337 err1x;
00338
00339 int mmin = (int) (0.99 + 800*4/ref);
00340 int mmax = (int) (1800*4/ref);
00341
00342
00343
00344 if (freq == 0.0)
00345 {
00346 edt_reg_write(pdv_p, EDT_SS_PLL_CTL, 0);
00347 return;
00348 }
00349
00350 if (freq<19.9 || freq>85.1) {
00351 printf("Error, %3.4f is not in range of 20 to 85 MHz\n", freq);
00352 return;
00353 }
00354 if (mmax > 511)
00355 mmax=511;
00356
00357 targ35 = freq*3.5;
00358 best35 = 0.0;
00359 m_best=0;
00360 n_best=0;
00361 err_best35=100.0;
00362
00363 for (m=mmin; m<=mmax; m++)
00364 {
00365 for (n=1; n<=8; n*=2)
00366 {
00367 current35 = ref/8 * m / n;
00368 err_current35 = targ35 - current35;
00369 if (err_current35 < 0)
00370 err_current35 = -err_current35;
00371 if (err_current35 < err_best35)
00372 {
00373 best35=current35;
00374 m_best=m;
00375 n_best=n;
00376 err_best35=err_current35;
00377 }
00378 }
00379 }
00380 if (n_best==1)
00381 n2=3;
00382 else if (n_best==2)
00383 n2=0;
00384 else if (n_best==4)
00385 n2=1;
00386 else if (n_best==8)
00387 n2=2;
00388 hex = n2<<9 | m_best;
00389
00390 err1x = (best35-targ35)/3.5;
00391 if (err1x < 0.0)
00392 err1x = - err1x;
00393 if (err1x > 0.00090)
00394 {
00395 printf("req:%3.4f got:%3.4f err:%3.4f ecl:%3.4f vco:%3.4f m:%d n:%d h:%04x\n",
00396 freq,
00397 best35/3.5,
00398 (best35-targ35)/3.5,
00399 best35,best35*2*n_best,
00400 m_best,n_best,hex);
00401 }
00402
00403 edt_reg_write(pdv_p, EDT_SS_PLL_CTL, 0);
00404 for (bit=13; bit>=0; bit--)
00405 {
00406 b = hex & (1<<bit);
00407 if (b)
00408 dbit=EDT_SS_PLL_DATA;
00409 else
00410 dbit=0;
00411 edt_reg_write(pdv_p, EDT_SS_PLL_CTL, dbit) ;
00412 edt_reg_write(pdv_p, EDT_SS_PLL_CTL, dbit | EDT_SS_PLL_CLK);
00413 }
00414 edt_reg_write(pdv_p, EDT_SS_PLL_CTL, EDT_SS_PLL_STROBE0);
00415 edt_reg_write(pdv_p, EDT_SS_PLL_CTL, 0);
00416 }
00417
00418
00419
00420 void pdv_cls_set_dvalid(PdvDev *pdv_p, u_char skip, u_char mode)
00421 {
00422
00423 edt_reg_write(pdv_p, PDV_CLSIM_CFGB, (skip << 4) | (mode & 3));
00424 }
00425
00426
00427 void pdv_cls_set_fill(PdvDev *pdv_p, u_char left, u_char right)
00428 {
00429
00430 edt_reg_write(pdv_p, PDV_CLSIM_FILLA, left);
00431 edt_reg_write(pdv_p, PDV_CLSIM_FILLB, right);
00432 }
00433
00434
00435 void pdv_cls_set_readvalid(PdvDev *pdv_p,
00436 u_short HrvStart, u_short HrvEnd)
00437 {
00438 edt_reg_write(pdv_p, PDV_CLSIM_HRVSTART, HrvStart);
00439 edt_reg_write(pdv_p, PDV_CLSIM_HRVEND, HrvEnd);
00440 }
00441
00442
00443
00444 void pdv_cls_setup_interleave(PdvDev *pdv_p,
00445 short tap0start, short tap0delta,
00446 short tap1start, short tap1delta,
00447 short tap2start, short tap2delta,
00448 short tap3start, short tap3delta)
00449
00450 {
00451 edt_reg_write(pdv_p, PDV_CLSIM_TAP0START, tap0start);
00452 edt_reg_write(pdv_p, PDV_CLSIM_TAP0DELTA, tap0delta);
00453
00454 edt_reg_write(pdv_p, PDV_CLSIM_TAP1START, tap1start);
00455 edt_reg_write(pdv_p, PDV_CLSIM_TAP1DELTA, tap1delta);
00456
00457 edt_reg_write(pdv_p, PDV_CLSIM_TAP2START, tap2start);
00458 edt_reg_write(pdv_p, PDV_CLSIM_TAP2DELTA, tap2delta);
00459
00460 edt_reg_write(pdv_p, PDV_CLSIM_TAP3START, tap3start);
00461 edt_reg_write(pdv_p, PDV_CLSIM_TAP3DELTA, tap3delta);
00462
00463 }
00464
00465
00466
00467 int
00468 pdv_cls_set_dep(PdvDev *pdv_p)
00469
00470 {
00471 PdvDependent *dd_p = (PdvDependent *) pdv_p->dd_p;
00472 ClSimControl *cls = &dd_p->cls;
00473
00474 edt_startdma_action(pdv_p, EDT_ACT_NEVER);
00475
00476 pdv_cls_sim_stop(pdv_p);
00477
00478
00479 if (cls->pixel_clock == 0)
00480 cls->pixel_clock = 20.0;
00481
00482 pdv_cls_set_clock(pdv_p, cls->pixel_clock);
00483
00484
00485
00486 pdv_set_width(pdv_p, dd_p->width);
00487 pdv_set_height(pdv_p, dd_p->height);
00488 pdv_set_depth(pdv_p, dd_p->depth);
00489
00490
00491 pdv_set_cam_width(pdv_p, dd_p->width);
00492 pdv_set_cam_height(pdv_p, dd_p->height);
00493
00494 if (dd_p->cl_cfg & 1)
00495 {
00496 cls->taps = 1;
00497 dd_p->cl_data_path = 0x37;
00498 }
00499 else if (dd_p->depth > 8)
00500 {
00501 cls->taps = 1;
00502 dd_p->cl_data_path = 0x17;
00503 }
00504 else if (cls->taps == 0)
00505 cls->taps = (dd_p->cl_data_path >> 4) + 1;
00506 else if (dd_p->cl_data_path == 0)
00507 dd_p->cl_data_path = ((cls->taps - 1) << 4) + 7;
00508
00509 if (cls->hblank == 0 && cls->Hcntmax == 0)
00510 cls->hblank = PDV_CLS_DEFAULT_HGAP;
00511
00512 if (cls->vblank == 0 && cls->Vcntmax == 0)
00513 cls->vblank = PDV_CLS_DEFAULT_VGAP;
00514
00515 pdv_cls_set_size(pdv_p,
00516 cls->taps,
00517 dd_p->depth,
00518 dd_p->width,
00519 dd_p->height,
00520 cls->hblank, cls->Hcntmax,
00521 cls->vblank, cls->Vcntmax);
00522
00523 pdv_cls_set_line_timing(pdv_p,
00524 dd_p->width,
00525 cls->taps,
00526 cls->Hfvstart,
00527 cls->Hfvend,
00528 cls->Hlvstart,
00529 cls->Hlvend,
00530 cls->Hrvstart,
00531 cls->Hrvend);
00532
00533
00534
00535 if (cls->Hrvend)
00536 {
00537 pdv_set_width(pdv_p,cls->Hrvend-cls->Hrvstart);
00538 }
00539
00540
00541
00542 pdv_cls_set_linescan(pdv_p, cls->flags.Cfg.linescan);
00543 pdv_cls_set_lvcont(pdv_p, cls->flags.Cfg.lvcont);
00544 pdv_cls_set_rven(pdv_p, cls->flags.Cfg.rven);
00545 pdv_cls_set_uartloop(pdv_p, cls->flags.Cfg.uartloop);
00546 pdv_cls_set_smallok(pdv_p, cls->flags.Cfg.smallok);
00547 pdv_cls_set_intlven(pdv_p, cls->flags.Cfg.intlven);
00548 pdv_cls_set_firstfc(pdv_p, cls->flags.Cfg.firstfc);
00549 pdv_cls_set_datacnt(pdv_p, cls->flags.Cfg.datacnt);
00550
00551 pdv_cls_set_dvalid(pdv_p, cls->flags.Cfg.dvskip, cls->flags.Cfg.dvmode);
00552
00553 pdv_cls_set_led(pdv_p, cls->flags.Cfg.led);
00554 pdv_cls_set_trigsrc(pdv_p, cls->flags.Cfg.trigsrc);
00555 pdv_cls_set_trigpol(pdv_p, cls->flags.Cfg.trigpol);
00556 pdv_cls_set_trigframe(pdv_p, cls->flags.Cfg.trigframe);
00557 pdv_cls_set_trigline(pdv_p, cls->flags.Cfg.trigline);
00558
00559 pdv_cls_set_fill(pdv_p,cls->FillA, cls->FillB);
00560
00561 edt_reg_write(pdv_p, PDV_CLSIM_EXSYNCDLY, cls->Exsyncdly);
00562
00563 if (dd_p->n_intlv_taps == 4)
00564 {
00565 pdv_cls_setup_interleave(pdv_p,
00566 dd_p->intlv_taps[0].startx,
00567 dd_p->intlv_taps[0].dx,
00568 dd_p->intlv_taps[1].startx,
00569 dd_p->intlv_taps[1].dx,
00570 dd_p->intlv_taps[2].startx,
00571 dd_p->intlv_taps[2].dx,
00572 dd_p->intlv_taps[3].startx,
00573 dd_p->intlv_taps[3].dx);
00574 }
00575 else
00576 {
00577 pdv_cls_set_intlven(pdv_p, 0);
00578 }
00579
00580 pdv_cls_sim_start(pdv_p);
00581
00582 return 0;
00583
00584 }
00585
00586
00587
00588 int
00589 pdv_cls_dep_sanity_check(PdvDev *pdv_p)
00590
00591 {
00592 return 1;
00593 }
00594
00595 double
00596 pdv_cls_frame_time(PdvDev *pdv_p)
00597
00598 {
00599 double clock = pdv_p->dd_p->cls.pixel_clock;
00600
00601 if (clock != 0.0)
00602 {
00603 double msecs;
00604 double frameclocks, lineclocks;
00605
00606 msecs = 1.0 / (clock * 1000.0);
00607
00608 lineclocks = edt_reg_read(pdv_p, PDV_CLSIM_HCNTMAX) * msecs;
00609
00610 frameclocks = edt_reg_read(pdv_p, PDV_CLSIM_VCNTMAX) * lineclocks;
00611
00612 return frameclocks;
00613 }
00614
00615 return 0.0;
00616 }
00617
00618
00619
00620
00621
00622 void
00623 pdv_cls_dump_state(PdvDev *pdv_p)
00624
00625 {
00626 int val;
00627 double clock;
00628 val = edt_reg_read(pdv_p, PDV_CL_DATA_PATH);
00629
00630 printf("Taps: %d\n", (val >> 4) + 1);
00631
00632 val = edt_reg_read(pdv_p, PDV_CLSIM_CFGA);
00633 printf("CfgA:\n");
00634 printf(" linescan: %s\n", (val & 0x80)? "enabled":"off");
00635 printf(" lvcont : %s\n", (val & 0x40)? "enabled":"off");
00636 printf(" rven : %s\n", (val & 0x20)? "enabled":"off");
00637 printf(" uartloop: %s\n", (val & 0x10)? "enabled":"off");
00638 printf(" smallok : %s\n", (val & 8)? "enabled":"off");
00639 printf(" intlven : %s\n", (val & 4)? "enabled":"off");
00640 printf(" firstfc : %s\n", (val & 2)? "enabled":"off");
00641 printf(" datacnt : %s\n", (val & 1)? "enabled":"off");
00642 val = edt_reg_read(pdv_p, PDV_CLSIM_CFGB);
00643 printf("CfgB:\n");
00644 printf(" dvskip : %d\n", (val >> 4));
00645 printf(" dvmode : %d\n", (val & 3));
00646 val = edt_reg_read(pdv_p, PDV_CLSIM_CFGC);
00647 printf("CfgC:\n");
00648 printf(" led : %s\n", (val & 0x80)? "enabled":"off");
00649 printf(" trigsrc : %s\n", (val & 8)? "enabled":"off");
00650 printf(" trigpol : %s\n", (val & 4)? "enabled":"off");
00651 printf(" trigfram: %s\n", (val & 2)? "enabled":"off");
00652 printf(" trigline: %s\n", (val & 1)? "enabled":"off");
00653
00654 printf("\nFillA : 0x%x\n", edt_reg_read(pdv_p, PDV_CLSIM_FILLA));
00655 printf("FillB : 0x%x\n\n", edt_reg_read(pdv_p, PDV_CLSIM_FILLB));
00656
00657
00658 val = edt_reg_read(pdv_p, PDV_CLSIM_HCNTMAX);
00659 printf("Hcntmax : %d clocks\n", val+1);
00660
00661 val = edt_reg_read(pdv_p, PDV_CLSIM_VACTV);
00662 printf("Vactv : %d lines\n", val+1);
00663
00664 val = edt_reg_read(pdv_p, PDV_CLSIM_VCNTMAX);
00665 printf("Vcntmax : %d lines\n", val+1);
00666
00667 printf("Hfvstart: %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HFVSTART));
00668 printf("Hfvend : %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HFVEND));
00669 printf("Hlvstart: %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HLVSTART));
00670 printf("Hlvend : %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HLVEND));
00671 printf("Hrvstart: %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HRVSTART));
00672 printf("Hrvend : %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HRVEND));
00673
00674 printf("hblank : %d\n", pdv_cls_get_hgap(pdv_p));
00675 printf("vblank : %d\n", pdv_cls_get_vgap(pdv_p));
00676
00677 if (edt_reg_read(pdv_p, PDV_CLSIM_CFGA) & 4)
00678 {
00679 printf("\nInterleave\n");
00680
00681 printf("Tap 0 : Start %4d Delta %4d\n", edt_reg_read(pdv_p, PDV_CLSIM_TAP0START),
00682 edt_reg_read(pdv_p, PDV_CLSIM_TAP0DELTA));
00683 printf("Tap 1 : Start %4d Delta %4d\n", edt_reg_read(pdv_p, PDV_CLSIM_TAP1START),
00684 edt_reg_read(pdv_p, PDV_CLSIM_TAP1DELTA));
00685 printf("Tap 2 : Start %4d Delta %4d\n", edt_reg_read(pdv_p, PDV_CLSIM_TAP2START),
00686 edt_reg_read(pdv_p, PDV_CLSIM_TAP2DELTA));
00687 printf("Tap 3 : Start %4d Delta %4d\n", edt_reg_read(pdv_p, PDV_CLSIM_TAP3START),
00688 edt_reg_read(pdv_p, PDV_CLSIM_TAP3DELTA));
00689 }
00690
00691 clock = pdv_p->dd_p->cls.pixel_clock;
00692
00693 if (clock != 0.0)
00694 {
00695 double msecs;
00696 double frameclocks, lineclocks;
00697
00698 printf("\npixel_clock : %10.4f MHz\n", pdv_p->dd_p->cls.pixel_clock);
00699
00700 msecs = 1.0 / (clock * 1000.0);
00701
00702 lineclocks = edt_reg_read(pdv_p, PDV_CLSIM_HCNTMAX) * msecs;
00703 printf("Line time : %10.4f msecs\n", lineclocks);
00704
00705 frameclocks = edt_reg_read(pdv_p, PDV_CLSIM_VACTV) * lineclocks;
00706 printf("Active Frame time : %10.4f msecs\n", frameclocks);
00707
00708 frameclocks = edt_reg_read(pdv_p, PDV_CLSIM_VCNTMAX) * lineclocks;
00709 printf("Frame time : %10.4f msecs\n", frameclocks);
00710
00711 if (frameclocks)
00712 printf("Frame Rate : %10.4f fps\n",1000.0 / frameclocks);
00713
00714 }
00715 }
00716
00717
00718 void
00719 pdv_cls_dump_geometry(PdvDev *pdv_p)
00720
00721 {
00722 int val;
00723 val = edt_reg_read(pdv_p, PDV_CL_DATA_PATH);
00724
00725 printf("\nFillA : 0x%x\n", edt_reg_read(pdv_p, PDV_CLSIM_FILLA));
00726 printf("FillB : 0x%x\n\n", edt_reg_read(pdv_p, PDV_CLSIM_FILLB));
00727
00728
00729 val = edt_reg_read(pdv_p, PDV_CLSIM_HCNTMAX);
00730 printf("Hcntmax : %d clocks\n", val+1);
00731
00732 val = edt_reg_read(pdv_p, PDV_CLSIM_VACTV);
00733 printf("Vactv : %d lines\n", val+1);
00734
00735 val = edt_reg_read(pdv_p, PDV_CLSIM_VCNTMAX);
00736 printf("Vcntmax : %d lines\n", val+1);
00737
00738 printf("Hfvstart: %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HFVSTART));
00739 printf("Hfvend : %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HFVEND));
00740 printf("Hlvstart: %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HLVSTART));
00741 printf("Hlvend : %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HLVEND));
00742 printf("Hrvstart: %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HRVSTART));
00743 printf("Hrvend : %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HRVEND));
00744
00745 printf("hblank : %d\n", pdv_cls_get_hgap(pdv_p));
00746 printf("vblank : %d\n", pdv_cls_get_vgap(pdv_p));
00747
00748 }
00749